X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=genevent%2Fparser.h;h=8fd75743c96fe35c0dcb19890a885f2026db996e;hb=61c4d2a50f664080cff16912b5105184d535ffd0;hp=904109349dcc5ec1f13492e7d5cd45b8ef0919ce;hpb=90699b2bad4ff49fcaf0ad8520d7cf41ffc6c393;p=lttv.git diff --git a/genevent/parser.h b/genevent/parser.h index 90410934..8fd75743 100644 --- a/genevent/parser.h +++ b/genevent/parser.h @@ -64,7 +64,7 @@ char *getQuotedString(parse_file_t *in); char *getName(parse_file_t *in); int getNumber(parse_file_t *in); char *getEqual(parse_file_t *in); -char seekNextChar(parse_file_t *in); +int seekNextChar(parse_file_t *in); void skipComment(parse_file_t * in); void skipEOL(parse_file_t * in); @@ -77,9 +77,15 @@ static const int BUFFER_SIZE = 1024; /* Events data types */ typedef enum _data_type { + INT_FIXED, + UINT_FIXED, + POINTER, + CHAR, + UCHAR, + SHORT, + USHORT, INT, UINT, - POINTER, LONG, ULONG, SIZE_T, @@ -95,24 +101,23 @@ typedef enum _data_type { NONE } data_type_t; -/* Event type descriptors */ - typedef struct _type_descriptor { char * type_name; //used for named type data_type_t type; char *fmt; - int size; + size_t size; sequence_t labels; // for enumeration + sequence_t labels_values; // for enumeration sequence_t labels_description; int already_printed; - sequence_t fields; // for structure - struct _type_descriptor *nested_type; // for array and sequence - int alignment; + sequence_t fields; // for structure, array and sequence (field_t type) + int custom_write; /* Should we use a custom write function ? */ + int network; /* Is the type a in network byte order ? */ } type_descriptor_t; -/* Fields within types */ +/* Fields within types or events */ typedef struct _field{ char *name; char *description; @@ -125,21 +130,29 @@ typedef struct _field{ typedef struct _event { char *name; char *description; - type_descriptor_t *type; + //type_descriptor_t *type; + sequence_t fields; /* event fields */ int per_trace; /* Is the event able to be logged to a specific trace ? */ int per_tracefile; /* Must we log this event in a specific tracefile ? */ + int param_buffer; /* For userspace tracing : takes a buffer as parameter? */ + int no_instrument_function; + int high_priority; } event_t; typedef struct _facility { char * name; char * capname; + char * arch; char * description; sequence_t events; - sequence_t unnamed_types; + sequence_t unnamed_types; //FIXME : remove table_t named_types; + unsigned int checksum; + int user; /* Is this a userspace facility ? */ } facility_t; -int getSize(parse_file_t *in); +int getSizeindex(unsigned int value); +unsigned long long int getSize(parse_file_t *in); unsigned long getTypeChecksum(unsigned long aCrc, type_descriptor_t * type); void parseFacility(parse_file_t *in, facility_t * fac); @@ -149,35 +162,25 @@ void parseTypeDefinition(parse_file_t *in, sequence_t * unnamed_types, table_t * named_types); type_descriptor_t *parseType(parse_file_t *in, type_descriptor_t *t, sequence_t * unnamed_types, table_t * named_types); -void parseFields(parse_file_t *in, type_descriptor_t *t, - sequence_t * unnamed_types, table_t * named_types); +void parseFields(parse_file_t *in, field_t *f, + sequence_t * unnamed_types, + table_t * named_types, + int tag); void checkNamedTypesImplemented(table_t * namedTypes); type_descriptor_t * find_named_type(char *name, table_t * named_types); void generateChecksum(char * facName, - unsigned long * checksum, sequence_t * events); + unsigned int * checksum, sequence_t * events); /* get attributes */ char * getNameAttribute(parse_file_t *in); char * getFormatAttribute(parse_file_t *in); int getSizeAttribute(parse_file_t *in); -int getValueAttribute(parse_file_t *in); -char * getValueStrAttribute(parse_file_t *in); +int getValueAttribute(parse_file_t *in, long long *value); char * getDescription(parse_file_t *in); -static char *intOutputTypes[] = { - "int8_t", "int16_t", "int32_t", "int64_t", "short int", "int", "long int" }; - -static char *uintOutputTypes[] = { - "uint8_t", "uint16_t", "uint32_t", "uint64_t", "unsigned short int", - "unsigned int", "unsigned long int" }; - -static char *floatOutputTypes[] = { - "undef", "undef", "float", "double", "undef", "float", "double" }; - - /* Dynamic memory allocation and freeing */ void * memAlloc(int size); @@ -217,4 +220,13 @@ crc32(const char *s) } +extern char *intOutputTypes[]; + +extern char *uintOutputTypes[]; + +extern char *floatOutputTypes[]; + + + + #endif // PARSER_H