fine tune per architecture facilities
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 18 Dec 2005 06:49:59 +0000 (06:49 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 18 Dec 2005 06:49:59 +0000 (06:49 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1440 04897980-b3bd-0310-b5e0-8ef037075253

genevent-new/genevent.c
genevent-new/parser.c
genevent-new/parser.h

index 9113a11ceec1d968ed2941ad667be46d86a60e8b..a691d48150be7f133c5c9c8ec0b763c1145b049f 100644 (file)
@@ -1575,7 +1575,12 @@ void print_log_header_head(facility_t *fac, FILE *fd)
        fprintf(fd, "#ifndef _LTT_FACILITY_%s_H_\n", fac->capname);
        fprintf(fd, "#define _LTT_FACILITY_%s_H_\n\n", fac->capname);
   fprintf(fd, "#include <linux/types.h>\n");
-  fprintf(fd, "#include <linux/ltt/ltt-facility-id-%s.h>\n", fac->name);
+       if(!fac->arch)
+         fprintf(fd, "#include <linux/ltt/ltt-facility-id-%s.h>\n", fac->name);
+       else
+         fprintf(fd, "#include <asm/ltt/ltt-facility-id-%s_%s.h>\n",
+                               fac->name,
+                               fac->arch);
   fprintf(fd, "#include <linux/ltt-core.h>\n");
        fprintf(fd, "\n");
 }
@@ -1665,6 +1670,14 @@ int print_log_header(facility_t *fac)
        strncat(filename, fac->name, PATH_MAX - filename_size);
        filename_size = strlen(filename);
 
+       if(fac->arch) {
+               strncat(filename, "_", PATH_MAX - filename_size);
+               filename_size = strlen(filename);
+
+               strncat(filename, fac->arch, PATH_MAX - filename_size);
+               filename_size = strlen(filename);
+       }
+
        strncat(filename, ".h", PATH_MAX - filename_size);
        filename_size = strlen(filename);
        
@@ -1713,6 +1726,14 @@ int print_id_header(facility_t *fac)
        strncat(filename, fac->name, PATH_MAX - filename_size);
        filename_size = strlen(filename);
 
+       if(fac->arch) {
+               strncat(filename, "_", PATH_MAX - filename_size);
+               filename_size = strlen(filename);
+
+               strncat(filename, fac->arch, PATH_MAX - filename_size);
+               filename_size = strlen(filename);
+       }
+
        strncat(filename, ".h", PATH_MAX - filename_size);
        filename_size = strlen(filename);
        
@@ -1780,6 +1801,14 @@ int print_loader_header(facility_t *fac)
        strncat(filename, fac->name, PATH_MAX - filename_size);
        filename_size = strlen(filename);
 
+       if(fac->arch) {
+               strncat(filename, "_", PATH_MAX - filename_size);
+               filename_size = strlen(filename);
+
+               strncat(filename, fac->arch, PATH_MAX - filename_size);
+               filename_size = strlen(filename);
+       }
+
        strncat(filename, ".h", PATH_MAX - filename_size);
        filename_size = strlen(filename);
        
@@ -1795,8 +1824,13 @@ int print_loader_header(facility_t *fac)
   fprintf(fd, "#define _LTT_FACILITY_LOADER_%s_H_\n\n", fac->capname);
   fprintf(fd, "#ifdef CONFIG_LTT\n\n");
   fprintf(fd,"#include <linux/ltt-facilities.h>\n");
-  fprintf(fd,"#include <linux/ltt/ltt-facility-id-%s.h>\n\n",
-                       fac->name);
+       if(!fac->arch)
+         fprintf(fd,"#include <linux/ltt/ltt-facility-id-%s.h>\n\n",
+                               fac->name);
+       else
+         fprintf(fd,"#include <asm/ltt/ltt-facility-id-%s_%s.h>\n\n",
+                               fac->name,
+                               fac->arch);
   fprintf(fd,"ltt_facility_t\tltt_facility_%s;\n", fac->name);
   fprintf(fd,"ltt_facility_t\tltt_facility_%s_%X;\n\n",
                        fac->name, fac->checksum);
@@ -1832,6 +1866,14 @@ int print_loader_c(facility_t *fac)
        strncat(filename, fac->name, PATH_MAX - filename_size);
        filename_size = strlen(filename);
 
+       if(fac->arch) {
+               strncat(filename, "_", PATH_MAX - filename_size);
+               filename_size = strlen(filename);
+
+               strncat(filename, fac->arch, PATH_MAX - filename_size);
+               filename_size = strlen(filename);
+       }
+
        strncat(filename, ".c", PATH_MAX - filename_size);
        filename_size = strlen(filename);
        
@@ -1844,7 +1886,10 @@ int print_loader_c(facility_t *fac)
        }
 
   fprintf(fd, "/*\n");
-  fprintf(fd, " * ltt-facility-loader-%s.c\n", fac->name);
+       if(!fac->arch)
+         fprintf(fd, " * ltt-facility-loader-%s.c\n", fac->name);
+       else
+         fprintf(fd, " * ltt-facility-loader-%s_%s.c\n", fac->name, fac->arch);
   fprintf(fd, " *\n");
   fprintf(fd, " * (C) Copyright  2005 - \n");
   fprintf(fd, " *          Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)\n");
@@ -1858,7 +1903,11 @@ int print_loader_c(facility_t *fac)
   fprintf(fd, "#include <linux/module.h>\n");
   fprintf(fd, "#include <linux/init.h>\n");
   fprintf(fd, "#include <linux/config.h>\n");
-  fprintf(fd, "#include \"ltt-facility-loader-%s.h\"\n", fac->name);
+       if(!fac->arch)
+       fprintf(fd, "#include \"ltt-facility-loader-%s.h\"\n", fac->name);
+       else
+         fprintf(fd, "#include \"ltt-facility-loader-%s_%s.h\"\n",
+                               fac->name, fac->arch);
   fprintf(fd, "\n");
   fprintf(fd, "\n");
   fprintf(fd, "#ifdef CONFIG_LTT\n");
index b8f2a6a2fc03d924847d5dda9d045c8f0c873f2b..6dbf402d76fd4f008f8d8c5cce17378df0617b15 100644 (file)
@@ -267,6 +267,7 @@ void getFacilityAttributes(parse_file_t *in, facility_t *fac)
   char car;
   
   fac->name = NULL;
+  fac->arch = NULL;
 
   while(1) {
     token = getToken(in); 
@@ -281,7 +282,12 @@ void getFacilityAttributes(parse_file_t *in, facility_t *fac)
       if(car == EOF) in->error(in,"name was expected");
       else if(car == '\"') fac->name = allocAndCopy(getQuotedString(in));
       else fac->name = allocAndCopy(getName(in));
-    }
+    } else if(!strcmp("arch", token)) {
+      getEqual(in);
+      car = seekNextChar(in);
+      if(car == '\"') fac->name = allocAndCopy(getQuotedString(in));
+                       else fac->arch = allocAndCopy(getName(in));
+               }
   }
 }
 
@@ -420,7 +426,7 @@ void parseFacility(parse_file_t *in, facility_t * fac)
   
   getFacilityAttributes(in, fac);
   if(fac->name == NULL) in->error(in, "Attribute not named");
-
+       
   fac->capname = allocAndCopy(fac->name);
        strupper(fac->capname);
   getRAnglebracket(in);    
@@ -1551,5 +1557,3 @@ char *appendString(char *s, char *suffix)
   strcat(tmp,suffix);  
   return tmp;
 }
-
-
index 21884fb6d0b82d35f44bd4cc12ee19e5f3e7a799..4215f286cd82077ad90b90df4a49ed305d88c345 100644 (file)
@@ -137,6 +137,7 @@ typedef struct _event {
 typedef struct _facility {
   char * name;
        char * capname;
+       char * arch;
   char * description;
   sequence_t events;
   sequence_t unnamed_types; //FIXME : remove
This page took 0.027472 seconds and 4 git commands to generate.