From: compudj Date: Sun, 18 Dec 2005 06:49:59 +0000 (+0000) Subject: fine tune per architecture facilities X-Git-Tag: v0.12.20~2049 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ffaf5031680617709c7ae1b7f1a3cf5cdf784805;p=lttv.git fine tune per architecture facilities git-svn-id: http://ltt.polymtl.ca/svn@1440 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/genevent-new/genevent.c b/genevent-new/genevent.c index 9113a11c..a691d481 100644 --- a/genevent-new/genevent.c +++ b/genevent-new/genevent.c @@ -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 \n"); - fprintf(fd, "#include \n", fac->name); + if(!fac->arch) + fprintf(fd, "#include \n", fac->name); + else + fprintf(fd, "#include \n", + fac->name, + fac->arch); fprintf(fd, "#include \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 \n"); - fprintf(fd,"#include \n\n", - fac->name); + if(!fac->arch) + fprintf(fd,"#include \n\n", + fac->name); + else + fprintf(fd,"#include \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 \n"); fprintf(fd, "#include \n"); fprintf(fd, "#include \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"); diff --git a/genevent-new/parser.c b/genevent-new/parser.c index b8f2a6a2..6dbf402d 100644 --- a/genevent-new/parser.c +++ b/genevent-new/parser.c @@ -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; } - - diff --git a/genevent-new/parser.h b/genevent-new/parser.h index 21884fb6..4215f286 100644 --- a/genevent-new/parser.h +++ b/genevent-new/parser.h @@ -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