aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/traceevent/event-parse.c
diff options
context:
space:
mode:
authorTzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>2018-09-19 14:56:46 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-09-19 16:14:13 -0400
commitbb39ccb204cc2e8135660b9cb768ffcf242bf33e (patch)
tree13ff769289faf758328f46a916af7ee6c0dffc57 /tools/lib/traceevent/event-parse.c
parent2c92f9828b3ca4e82e7ceffeea76c6fba4044acc (diff)
tools lib traceevent, perf tools: Rename enum format_flags to enum tep_format_flags
In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_". This renames enum format_flags to enum tep_format_flags and adds prefix TEP_ to all of its members. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180919185722.803127871@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/traceevent/event-parse.c')
-rw-r--r--tools/lib/traceevent/event-parse.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 32547abb6500..508c89365c90 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -1301,7 +1301,7 @@ static int event_read_id(void)
1301 1301
1302static int field_is_string(struct tep_format_field *field) 1302static int field_is_string(struct tep_format_field *field)
1303{ 1303{
1304 if ((field->flags & FIELD_IS_ARRAY) && 1304 if ((field->flags & TEP_FIELD_IS_ARRAY) &&
1305 (strstr(field->type, "char") || strstr(field->type, "u8") || 1305 (strstr(field->type, "char") || strstr(field->type, "u8") ||
1306 strstr(field->type, "s8"))) 1306 strstr(field->type, "s8")))
1307 return 1; 1307 return 1;
@@ -1328,7 +1328,7 @@ static int field_is_long(struct tep_format_field *field)
1328 1328
1329static unsigned int type_size(const char *name) 1329static unsigned int type_size(const char *name)
1330{ 1330{
1331 /* This covers all FIELD_IS_STRING types. */ 1331 /* This covers all TEP_FIELD_IS_STRING types. */
1332 static struct { 1332 static struct {
1333 const char *type; 1333 const char *type;
1334 unsigned int size; 1334 unsigned int size;
@@ -1416,7 +1416,7 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f
1416 type == EVENT_OP && strcmp(token, ".") == 0)) { 1416 type == EVENT_OP && strcmp(token, ".") == 0)) {
1417 1417
1418 if (strcmp(token, "*") == 0) 1418 if (strcmp(token, "*") == 0)
1419 field->flags |= FIELD_IS_POINTER; 1419 field->flags |= TEP_FIELD_IS_POINTER;
1420 1420
1421 if (field->type) { 1421 if (field->type) {
1422 char *new_type; 1422 char *new_type;
@@ -1455,7 +1455,7 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f
1455 char *new_brackets; 1455 char *new_brackets;
1456 int len; 1456 int len;
1457 1457
1458 field->flags |= FIELD_IS_ARRAY; 1458 field->flags |= TEP_FIELD_IS_ARRAY;
1459 1459
1460 type = read_token(&token); 1460 type = read_token(&token);
1461 1461
@@ -1544,11 +1544,11 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f
1544 } 1544 }
1545 1545
1546 if (field_is_string(field)) 1546 if (field_is_string(field))
1547 field->flags |= FIELD_IS_STRING; 1547 field->flags |= TEP_FIELD_IS_STRING;
1548 if (field_is_dynamic(field)) 1548 if (field_is_dynamic(field))
1549 field->flags |= FIELD_IS_DYNAMIC; 1549 field->flags |= TEP_FIELD_IS_DYNAMIC;
1550 if (field_is_long(field)) 1550 if (field_is_long(field))
1551 field->flags |= FIELD_IS_LONG; 1551 field->flags |= TEP_FIELD_IS_LONG;
1552 1552
1553 if (test_type_token(type, token, EVENT_OP, ";")) 1553 if (test_type_token(type, token, EVENT_OP, ";"))
1554 goto fail; 1554 goto fail;
@@ -1597,7 +1597,7 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f
1597 goto fail; 1597 goto fail;
1598 1598
1599 if (strtoul(token, NULL, 0)) 1599 if (strtoul(token, NULL, 0))
1600 field->flags |= FIELD_IS_SIGNED; 1600 field->flags |= TEP_FIELD_IS_SIGNED;
1601 1601
1602 free_token(token); 1602 free_token(token);
1603 if (read_expected(EVENT_OP, ";") < 0) 1603 if (read_expected(EVENT_OP, ";") < 0)
@@ -1609,14 +1609,14 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f
1609 1609
1610 free_token(token); 1610 free_token(token);
1611 1611
1612 if (field->flags & FIELD_IS_ARRAY) { 1612 if (field->flags & TEP_FIELD_IS_ARRAY) {
1613 if (field->arraylen) 1613 if (field->arraylen)
1614 field->elementsize = field->size / field->arraylen; 1614 field->elementsize = field->size / field->arraylen;
1615 else if (field->flags & FIELD_IS_DYNAMIC) 1615 else if (field->flags & TEP_FIELD_IS_DYNAMIC)
1616 field->elementsize = size_dynamic; 1616 field->elementsize = size_dynamic;
1617 else if (field->flags & FIELD_IS_STRING) 1617 else if (field->flags & TEP_FIELD_IS_STRING)
1618 field->elementsize = 1; 1618 field->elementsize = 1;
1619 else if (field->flags & FIELD_IS_LONG) 1619 else if (field->flags & TEP_FIELD_IS_LONG)
1620 field->elementsize = event->pevent ? 1620 field->elementsize = event->pevent ?
1621 event->pevent->long_size : 1621 event->pevent->long_size :
1622 sizeof(long); 1622 sizeof(long);
@@ -2089,11 +2089,11 @@ process_entry(struct tep_event_format *event __maybe_unused, struct print_arg *a
2089 2089
2090 if (is_flag_field) { 2090 if (is_flag_field) {
2091 arg->field.field = tep_find_any_field(event, arg->field.name); 2091 arg->field.field = tep_find_any_field(event, arg->field.name);
2092 arg->field.field->flags |= FIELD_IS_FLAG; 2092 arg->field.field->flags |= TEP_FIELD_IS_FLAG;
2093 is_flag_field = 0; 2093 is_flag_field = 0;
2094 } else if (is_symbolic_field) { 2094 } else if (is_symbolic_field) {
2095 arg->field.field = tep_find_any_field(event, arg->field.name); 2095 arg->field.field = tep_find_any_field(event, arg->field.name);
2096 arg->field.field->flags |= FIELD_IS_SYMBOLIC; 2096 arg->field.field->flags |= TEP_FIELD_IS_SYMBOLIC;
2097 is_symbolic_field = 0; 2097 is_symbolic_field = 0;
2098 } 2098 }
2099 2099
@@ -3901,7 +3901,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
3901 * and the size is the same as long_size, assume that it 3901 * and the size is the same as long_size, assume that it
3902 * is a pointer. 3902 * is a pointer.
3903 */ 3903 */
3904 if (!(field->flags & FIELD_IS_ARRAY) && 3904 if (!(field->flags & TEP_FIELD_IS_ARRAY) &&
3905 field->size == pevent->long_size) { 3905 field->size == pevent->long_size) {
3906 3906
3907 /* Handle heterogeneous recording and processing 3907 /* Handle heterogeneous recording and processing
@@ -4794,16 +4794,16 @@ void tep_print_field(struct trace_seq *s, void *data,
4794 unsigned int offset, len, i; 4794 unsigned int offset, len, i;
4795 struct tep_handle *pevent = field->event->pevent; 4795 struct tep_handle *pevent = field->event->pevent;
4796 4796
4797 if (field->flags & FIELD_IS_ARRAY) { 4797 if (field->flags & TEP_FIELD_IS_ARRAY) {
4798 offset = field->offset; 4798 offset = field->offset;
4799 len = field->size; 4799 len = field->size;
4800 if (field->flags & FIELD_IS_DYNAMIC) { 4800 if (field->flags & TEP_FIELD_IS_DYNAMIC) {
4801 val = tep_read_number(pevent, data + offset, len); 4801 val = tep_read_number(pevent, data + offset, len);
4802 offset = val; 4802 offset = val;
4803 len = offset >> 16; 4803 len = offset >> 16;
4804 offset &= 0xffff; 4804 offset &= 0xffff;
4805 } 4805 }
4806 if (field->flags & FIELD_IS_STRING && 4806 if (field->flags & TEP_FIELD_IS_STRING &&
4807 is_printable_array(data + offset, len)) { 4807 is_printable_array(data + offset, len)) {
4808 trace_seq_printf(s, "%s", (char *)data + offset); 4808 trace_seq_printf(s, "%s", (char *)data + offset);
4809 } else { 4809 } else {
@@ -4815,21 +4815,21 @@ void tep_print_field(struct trace_seq *s, void *data,
4815 *((unsigned char *)data + offset + i)); 4815 *((unsigned char *)data + offset + i));
4816 } 4816 }
4817 trace_seq_putc(s, ']'); 4817 trace_seq_putc(s, ']');
4818 field->flags &= ~FIELD_IS_STRING; 4818 field->flags &= ~TEP_FIELD_IS_STRING;
4819 } 4819 }
4820 } else { 4820 } else {
4821 val = tep_read_number(pevent, data + field->offset, 4821 val = tep_read_number(pevent, data + field->offset,
4822 field->size); 4822 field->size);
4823 if (field->flags & FIELD_IS_POINTER) { 4823 if (field->flags & TEP_FIELD_IS_POINTER) {
4824 trace_seq_printf(s, "0x%llx", val); 4824 trace_seq_printf(s, "0x%llx", val);
4825 } else if (field->flags & FIELD_IS_SIGNED) { 4825 } else if (field->flags & TEP_FIELD_IS_SIGNED) {
4826 switch (field->size) { 4826 switch (field->size) {
4827 case 4: 4827 case 4:
4828 /* 4828 /*
4829 * If field is long then print it in hex. 4829 * If field is long then print it in hex.
4830 * A long usually stores pointers. 4830 * A long usually stores pointers.
4831 */ 4831 */
4832 if (field->flags & FIELD_IS_LONG) 4832 if (field->flags & TEP_FIELD_IS_LONG)
4833 trace_seq_printf(s, "0x%x", (int)val); 4833 trace_seq_printf(s, "0x%x", (int)val);
4834 else 4834 else
4835 trace_seq_printf(s, "%d", (int)val); 4835 trace_seq_printf(s, "%d", (int)val);
@@ -4844,7 +4844,7 @@ void tep_print_field(struct trace_seq *s, void *data,
4844 trace_seq_printf(s, "%lld", val); 4844 trace_seq_printf(s, "%lld", val);
4845 } 4845 }
4846 } else { 4846 } else {
4847 if (field->flags & FIELD_IS_LONG) 4847 if (field->flags & TEP_FIELD_IS_LONG)
4848 trace_seq_printf(s, "0x%llx", val); 4848 trace_seq_printf(s, "0x%llx", val);
4849 else 4849 else
4850 trace_seq_printf(s, "%llu", val); 4850 trace_seq_printf(s, "%llu", val);
@@ -6288,7 +6288,7 @@ void *tep_get_field_raw(struct trace_seq *s, struct tep_event_format *event,
6288 len = &dummy; 6288 len = &dummy;
6289 6289
6290 offset = field->offset; 6290 offset = field->offset;
6291 if (field->flags & FIELD_IS_DYNAMIC) { 6291 if (field->flags & TEP_FIELD_IS_DYNAMIC) {
6292 offset = tep_read_number(event->pevent, 6292 offset = tep_read_number(event->pevent,
6293 data + offset, field->size); 6293 data + offset, field->size);
6294 *len = offset >> 16; 6294 *len = offset >> 16;