From 29e7c5b37d76ef85f8d0bebbe3d453c9a14e0d3f Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 8 Sep 2005 14:12:45 +0000 Subject: [PATCH] make LTTV support the facility.xml in eventdefs : multiple facilities found by checksum git-svn-id: http://ltt.polymtl.ca/svn@1162 04897980-b3bd-0310-b5e0-8ef037075253 --- .../{s390-kernel.xml => s390_kernel.xml} | 0 ltt/branches/poly/ltt/facility.c | 27 +++++++++---------- ltt/branches/poly/ltt/tracefile.c | 7 ++--- 3 files changed, 16 insertions(+), 18 deletions(-) rename ltt/branches/poly/facilities/{s390-kernel.xml => s390_kernel.xml} (100%) diff --git a/ltt/branches/poly/facilities/s390-kernel.xml b/ltt/branches/poly/facilities/s390_kernel.xml similarity index 100% rename from ltt/branches/poly/facilities/s390-kernel.xml rename to ltt/branches/poly/facilities/s390_kernel.xml diff --git a/ltt/branches/poly/ltt/facility.c b/ltt/branches/poly/ltt/facility.c index 0da437c3..5b2c8ba4 100644 --- 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 * + * Open the facility corresponding to the right checksum. + * *returns 0 on success, 1 on error. ****************************************************************************/ @@ -79,8 +81,8 @@ int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname) parse_file_t in; facility_t * fac; unsigned long checksum; - //GError * error = NULL; gchar buffer[BUFFER_SIZE]; + gboolean generated = FALSE; in.buffer = &(buffer[0]); in.lineno = 0; @@ -88,8 +90,6 @@ int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname) 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", @@ -98,9 +98,6 @@ int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname) 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; @@ -122,8 +119,11 @@ int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname) 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); free(fac->capname); @@ -142,17 +142,14 @@ int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname) goto parse_error; } } - + parse_error: - //g_io_channel_shutdown(in.channel, FALSE, &error); /* No flush */ - //if(error != NULL) { 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", f->name, f->checksum); + return ret; } diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 144ee8cf..b9ab0b71 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -804,7 +804,7 @@ static int open_tracefiles(LttTrace *trace, gchar *root_path, /* ltt_get_facility_description * - * Opens the trace corresponding to the requested facility (identified by fac_id + * Opens the file corresponding to the requested facility (identified by fac_id * and checksum). * * The name searched is : %trace root%/eventdefs/facname_checksum.xml @@ -836,7 +836,7 @@ static int ltt_get_facility_description(LttFacility *f, textlen+=strlen(text); if(textlen >= PATH_MAX) goto name_error; strcat(desc_file_name, text); - +#if 0 text = "_"; textlen+=strlen(text); if(textlen >= PATH_MAX) goto name_error; @@ -848,11 +848,12 @@ static int ltt_get_facility_description(LttFacility *f, textlen=strlen(desc_file_name); +#endif //0 text = ".xml"; textlen+=strlen(text); if(textlen >= PATH_MAX) goto name_error; strcat(desc_file_name, text); - + err = ltt_facility_open(f, t, desc_file_name); if(err) goto facility_error; -- 2.34.1