| 1 | #ifndef _LTT_MARKERS_FIELD_H |
| 2 | #define _LTT_MARKERS_FIELD_H |
| 3 | |
| 4 | /* |
| 5 | * Marker field support header. |
| 6 | * |
| 7 | * Mathieu Desnoyers, August 2007 |
| 8 | * License: LGPL. |
| 9 | */ |
| 10 | |
| 11 | #include <glib.h> |
| 12 | |
| 13 | enum ltt_type { |
| 14 | LTT_TYPE_SIGNED_INT, |
| 15 | LTT_TYPE_UNSIGNED_INT, |
| 16 | LTT_TYPE_POINTER, |
| 17 | LTT_TYPE_STRING, |
| 18 | LTT_TYPE_COMPACT, |
| 19 | LTT_TYPE_NONE, |
| 20 | }; |
| 21 | |
| 22 | /* |
| 23 | * Fields "offset" and "size" below are only valid while the event is being |
| 24 | * read. They are also being shared with events of the same type coming from |
| 25 | * other per-cpu tracefiles. Therefore, the "LttEvent" fields_offsets offset and |
| 26 | * size should be used rather than these. |
| 27 | */ |
| 28 | struct marker_field { |
| 29 | GQuark name; |
| 30 | enum ltt_type type; |
| 31 | unsigned int index; /* Field index within the event */ |
| 32 | unsigned long _offset; /* offset in the event data, USED ONLY INTERNALLY BY LIB */ |
| 33 | unsigned long _size; /* size of field. USED ONLY INTERNALLY BY LIB */ |
| 34 | unsigned long alignment; |
| 35 | unsigned long attributes; |
| 36 | int static_offset; /* boolean - private - is the field offset statically |
| 37 | * known with the preceding types ? */ |
| 38 | GString *fmt; |
| 39 | }; |
| 40 | |
| 41 | static inline GQuark marker_field_get_name(struct marker_field *field) |
| 42 | { |
| 43 | return field->name; |
| 44 | } |
| 45 | |
| 46 | static inline enum ltt_type marker_field_get_type(struct marker_field *field) |
| 47 | { |
| 48 | return field->type; |
| 49 | } |
| 50 | |
| 51 | /* |
| 52 | * Returns 0 if size is not known statically. |
| 53 | */ |
| 54 | static inline long marker_field_get_size(struct marker_field *field) |
| 55 | { |
| 56 | return field->_size; |
| 57 | } |
| 58 | |
| 59 | static inline unsigned int marker_field_get_index(struct marker_field *field) |
| 60 | { |
| 61 | return field->index; |
| 62 | } |
| 63 | |
| 64 | #endif //_LTT_MARKERS_FIELD_H |