projects
/
lttv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib list
[lttv.git]
/
ltt
/
branches
/
poly
/
ltt
/
facility.c
diff --git
a/ltt/branches/poly/ltt/facility.c
b/ltt/branches/poly/ltt/facility.c
index 53519c02a683046b00b0b10b2c95aa16931a3aff..f4c0acae6c939f6f488a31cbc6c9fd40d908c1fd 100644
(file)
--- a/
ltt/branches/poly/ltt/facility.c
+++ b/
ltt/branches/poly/ltt/facility.c
@@
-69,6
+69,8
@@
void freeLttNamedType(LttType * type);
* t : the trace containing the facilities
* pathname : the path name of the facility
*
* t : the trace containing the facilities
* pathname : the path name of the facility
*
+ * Open the facility corresponding to the right checksum.
+ *
*returns 0 on success, 1 on error.
****************************************************************************/
*returns 0 on success, 1 on error.
****************************************************************************/
@@
-79,16
+81,15
@@
int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname)
parse_file_t in;
facility_t * fac;
unsigned long checksum;
parse_file_t in;
facility_t * fac;
unsigned long checksum;
- //GError * error = NULL;
gchar buffer[BUFFER_SIZE];
gchar buffer[BUFFER_SIZE];
+ gboolean generated = FALSE;
in.buffer = &(buffer[0]);
in.lineno = 0;
in.error = error_callback;
in.name = pathname;
in.buffer = &(buffer[0]);
in.lineno = 0;
in.error = error_callback;
in.name = pathname;
+ in.unget = 0;
- //in.fd = g_open(in.name, O_RDONLY, 0);
- //if(in.fd < 0 ) {
in.fp = fopen(in.name, "r");
if(in.fp == NULL) {
g_warning("cannot open facility description file %s",
in.fp = fopen(in.name, "r");
if(in.fp == NULL) {
g_warning("cannot open facility description file %s",
@@
-97,9
+98,6
@@
int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname)
goto open_error;
}
goto open_error;
}
- //in.channel = g_io_channel_unix_new(in.fd);
- //in.pos = 0;
-
while(1){
token = getToken(&in);
if(in.type == ENDFILE) break;
while(1){
token = getToken(&in);
if(in.type == ENDFILE) break;
@@
-121,10
+119,14
@@
int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname)
checkNamedTypesImplemented(&fac->named_types);
generateChecksum(fac->name, &checksum, &fac->events);
checkNamedTypesImplemented(&fac->named_types);
generateChecksum(fac->name, &checksum, &fac->events);
-
- generateFacility(f, fac, checksum);
+
+ if(checksum == f->checksum) {
+ generateFacility(f, fac, checksum);
+ generated = TRUE;
+ }
g_free(fac->name);
g_free(fac->name);
+ free(fac->capname);
g_free(fac->description);
freeEvents(&fac->events);
sequence_dispose(&fac->events);
g_free(fac->description);
freeEvents(&fac->events);
sequence_dispose(&fac->events);
@@
-133,6
+135,7
@@
int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname)
freeTypes(&fac->unnamed_types);
sequence_dispose(&fac->unnamed_types);
g_free(fac);
freeTypes(&fac->unnamed_types);
sequence_dispose(&fac->unnamed_types);
g_free(fac);
+ if(generated) break; /* use the first good match */
}
else {
g_warning("facility token was expected in file %s", in.name);
}
else {
g_warning("facility token was expected in file %s", in.name);
@@
-140,17
+143,17
@@
int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname)
goto parse_error;
}
}
goto parse_error;
}
}
-
+
parse_error:
parse_error:
- //g_io_channel_shutdown(in.channel, FALSE, &error); /* No flush */
- //if(error != NULL) {
fclose(in.fp);
open_error:
fclose(in.fp);
open_error:
- // g_warning("Can not close file: \n%s\n", error->message);
- // g_error_free(error);
- //}
- //g_close(in.fd);
+ if(!generated) {
+ g_warning("Cannot find facility %s, checksum 0x%X",
+ g_quark_to_string(f->name), f->checksum);
+ ret = 1;
+ }
+
return ret;
}
return ret;
}
This page took
0.022846 seconds
and
4
git commands to generate.