make LTTV support the facility.xml in eventdefs : multiple facilities found by checksum
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 8 Sep 2005 14:12:45 +0000 (14:12 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 8 Sep 2005 14:12:45 +0000 (14:12 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1162 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/facilities/s390-kernel.xml [deleted file]
ltt/branches/poly/facilities/s390_kernel.xml [new file with mode: 0644]
ltt/branches/poly/ltt/facility.c
ltt/branches/poly/ltt/tracefile.c

diff --git a/ltt/branches/poly/facilities/s390-kernel.xml b/ltt/branches/poly/facilities/s390-kernel.xml
deleted file mode 100644 (file)
index 8334c9d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<facility name=s390_kernel>
-  <description>The kernel facility has events related to kernel execution status.</description>
-
-  <event name=trap_entry>
-    <description>Entry in a trap</description>
-    <struct>
-      <field name="trap_id"> <description>Trap number</description> <uint size=8/> </field>
-      <field name="address"> <description>Address where trap occured</description> <pointer/> </field>
-     </struct>
-  </event>
-
-</facility>
diff --git a/ltt/branches/poly/facilities/s390_kernel.xml b/ltt/branches/poly/facilities/s390_kernel.xml
new file mode 100644 (file)
index 0000000..8334c9d
--- /dev/null
@@ -0,0 +1,12 @@
+<facility name=s390_kernel>
+  <description>The kernel facility has events related to kernel execution status.</description>
+
+  <event name=trap_entry>
+    <description>Entry in a trap</description>
+    <struct>
+      <field name="trap_id"> <description>Trap number</description> <uint size=8/> </field>
+      <field name="address"> <description>Address where trap occured</description> <pointer/> </field>
+     </struct>
+  </event>
+
+</facility>
index 0da437c329f50377c6ed856e8e0de4822928272e..5b2c8ba4f2c76188427f47884fa192bc54dd1499 100644 (file)
@@ -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;
 }
 
index 144ee8cfa0dd60a1b389ff12acc919e62b476291..b9ab0b71f2f5d79defa33b0c0e36f08f96ddbc29 100644 (file)
@@ -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;
 
This page took 0.02626 seconds and 4 git commands to generate.