tools lib traceevent, perf tools: Rename pevent_read_number_* APIs
authorTzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Wed, 8 Aug 2018 18:02:53 +0000 (14:02 -0400)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 13 Aug 2018 18:22:05 +0000 (15:22 -0300)
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_" and not "pevent_". This changes
APIs: pevent_read_number, pevent_read_number_field

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180808180700.804271434@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/traceevent/event-parse.c
tools/lib/traceevent/event-parse.h
tools/lib/traceevent/parse-filter.c
tools/lib/traceevent/plugin_kmem.c
tools/lib/traceevent/plugin_mac80211.c
tools/perf/util/data-convert-bt.c
tools/perf/util/python.c
tools/perf/util/scripting-engines/trace-event-python.c
tools/perf/util/sort.c
tools/perf/util/trace-event-parse.c

index 2b717c2d65ccf6916130d173c1fb00c4b4a64143..4220b15781c86ffeffeed99892ae8cebc10222a9 100644 (file)
@@ -3329,7 +3329,7 @@ tep_find_any_field(struct event_format *event, const char *name)
 }
 
 /**
- * pevent_read_number - read a number from data
+ * tep_read_number - read a number from data
  * @pevent: handle for the pevent
  * @ptr: the raw data
  * @size: the size of the data that holds the number
@@ -3337,8 +3337,8 @@ tep_find_any_field(struct event_format *event, const char *name)
  * Returns the number (converted to host) from the
  * raw data.
  */
-unsigned long long pevent_read_number(struct tep_handle *pevent,
-                                     const void *ptr, int size)
+unsigned long long tep_read_number(struct tep_handle *pevent,
+                                  const void *ptr, int size)
 {
        switch (size) {
        case 1:
@@ -3356,7 +3356,7 @@ unsigned long long pevent_read_number(struct tep_handle *pevent,
 }
 
 /**
- * pevent_read_number_field - read a number from data
+ * tep_read_number_field - read a number from data
  * @field: a handle to the field
  * @data: the raw data to read
  * @value: the value to place the number in
@@ -3366,8 +3366,8 @@ unsigned long long pevent_read_number(struct tep_handle *pevent,
  *
  * Returns 0 on success, -1 otherwise.
  */
-int pevent_read_number_field(struct format_field *field, const void *data,
-                            unsigned long long *value)
+int tep_read_number_field(struct format_field *field, const void *data,
+                         unsigned long long *value)
 {
        if (!field)
                return -1;
@@ -3376,8 +3376,8 @@ int pevent_read_number_field(struct format_field *field, const void *data,
        case 2:
        case 4:
        case 8:
-               *value = pevent_read_number(field->event->pevent,
-                                           data + field->offset, field->size);
+               *value = tep_read_number(field->event->pevent,
+                                        data + field->offset, field->size);
                return 0;
        default:
                return -1;
@@ -3420,7 +3420,7 @@ static int __parse_common(struct tep_handle *pevent, void *data,
                if (ret < 0)
                        return ret;
        }
-       return pevent_read_number(pevent, data + *offset, *size);
+       return tep_read_number(pevent, data + *offset, *size);
 }
 
 static int trace_parse_common_type(struct tep_handle *pevent, void *data)
@@ -3559,8 +3559,8 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
                        
                }
                /* must be a number */
-               val = pevent_read_number(pevent, data + arg->field.field->offset,
-                               arg->field.field->size);
+               val = tep_read_number(pevent, data + arg->field.field->offset,
+                                     arg->field.field->size);
                break;
        case PRINT_FLAGS:
        case PRINT_SYMBOL:
@@ -3603,7 +3603,7 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
 
                        switch (larg->type) {
                        case PRINT_DYNAMIC_ARRAY:
-                               offset = pevent_read_number(pevent,
+                               offset = tep_read_number(pevent,
                                                   data + larg->dynarray.field->offset,
                                                   larg->dynarray.field->size);
                                if (larg->dynarray.field->elementsize)
@@ -3632,8 +3632,8 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
                        default:
                                goto default_op; /* oops, all bets off */
                        }
-                       val = pevent_read_number(pevent,
-                                                data + offset, field_size);
+                       val = tep_read_number(pevent,
+                                             data + offset, field_size);
                        if (typearg)
                                val = eval_type(val, typearg, 1);
                        break;
@@ -3733,9 +3733,9 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
                }
                break;
        case PRINT_DYNAMIC_ARRAY_LEN:
-               offset = pevent_read_number(pevent,
-                                           data + arg->dynarray.field->offset,
-                                           arg->dynarray.field->size);
+               offset = tep_read_number(pevent,
+                                        data + arg->dynarray.field->offset,
+                                        arg->dynarray.field->size);
                /*
                 * The total allocated length of the dynamic array is
                 * stored in the top half of the field, and the offset
@@ -3745,9 +3745,9 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
                break;
        case PRINT_DYNAMIC_ARRAY:
                /* Without [], we pass the address to the dynamic data */
-               offset = pevent_read_number(pevent,
-                                           data + arg->dynarray.field->offset,
-                                           arg->dynarray.field->size);
+               offset = tep_read_number(pevent,
+                                        data + arg->dynarray.field->offset,
+                                        arg->dynarray.field->size);
                /*
                 * The total allocated length of the dynamic array is
                 * stored in the top half of the field, and the offset
@@ -3992,7 +3992,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
        case PRINT_HEX_STR:
                if (arg->hex.field->type == PRINT_DYNAMIC_ARRAY) {
                        unsigned long offset;
-                       offset = pevent_read_number(pevent,
+                       offset = tep_read_number(pevent,
                                data + arg->hex.field->dynarray.field->offset,
                                arg->hex.field->dynarray.field->size);
                        hex = data + (offset & 0xffff);
@@ -4023,9 +4023,9 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
                        unsigned long offset;
                        struct format_field *field =
                                arg->int_array.field->dynarray.field;
-                       offset = pevent_read_number(pevent,
-                                                   data + field->offset,
-                                                   field->size);
+                       offset = tep_read_number(pevent,
+                                                data + field->offset,
+                                                field->size);
                        num = data + (offset & 0xffff);
                } else {
                        field = arg->int_array.field->field.field;
@@ -4253,7 +4253,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
                pevent->bprint_ip_field = ip_field;
        }
 
-       ip = pevent_read_number(pevent, data + ip_field->offset, ip_field->size);
+       ip = tep_read_number(pevent, data + ip_field->offset, ip_field->size);
 
        /*
         * The first arg is the IP pointer.
@@ -4347,7 +4347,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
                                /* the pointers are always 4 bytes aligned */
                                bptr = (void *)(((unsigned long)bptr + 3) &
                                                ~3);
-                               val = pevent_read_number(pevent, bptr, vsize);
+                               val = tep_read_number(pevent, bptr, vsize);
                                bptr += vsize;
                                arg = alloc_arg();
                                if (!arg) {
@@ -4421,7 +4421,7 @@ get_bprint_format(void *data, int size __maybe_unused,
                pevent->bprint_fmt_field = field;
        }
 
-       addr = pevent_read_number(pevent, data + field->offset, field->size);
+       addr = tep_read_number(pevent, data + field->offset, field->size);
 
        printk = find_printk(pevent, addr);
        if (!printk) {
@@ -4811,7 +4811,7 @@ void tep_print_field(struct trace_seq *s, void *data,
                offset = field->offset;
                len = field->size;
                if (field->flags & FIELD_IS_DYNAMIC) {
-                       val = pevent_read_number(pevent, data + offset, len);
+                       val = tep_read_number(pevent, data + offset, len);
                        offset = val;
                        len = offset >> 16;
                        offset &= 0xffff;
@@ -4831,8 +4831,8 @@ void tep_print_field(struct trace_seq *s, void *data,
                        field->flags &= ~FIELD_IS_STRING;
                }
        } else {
-               val = pevent_read_number(pevent, data + field->offset,
-                                        field->size);
+               val = tep_read_number(pevent, data + field->offset,
+                                     field->size);
                if (field->flags & FIELD_IS_POINTER) {
                        trace_seq_printf(s, "0x%llx", val);
                } else if (field->flags & FIELD_IS_SIGNED) {
@@ -6253,7 +6253,7 @@ int get_field_val(struct trace_seq *s, struct format_field *field,
                return -1;
        }
 
-       if (pevent_read_number_field(field, record->data, val)) {
+       if (tep_read_number_field(field, record->data, val)) {
                if (err)
                        trace_seq_printf(s, " %s=INVALID", name);
                return -1;
@@ -6302,7 +6302,7 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
 
        offset = field->offset;
        if (field->flags & FIELD_IS_DYNAMIC) {
-               offset = pevent_read_number(event->pevent,
+               offset = tep_read_number(event->pevent,
                                            data + offset, field->size);
                *len = offset >> 16;
                offset &= 0xffff;
@@ -6408,7 +6408,7 @@ int tep_print_num_field(struct trace_seq *s, const char *fmt,
        if (!field)
                goto failed;
 
-       if (pevent_read_number_field(field, record->data, &val))
+       if (tep_read_number_field(field, record->data, &val))
                goto failed;
 
        return trace_seq_printf(s, fmt, val);
@@ -6443,7 +6443,7 @@ int tep_print_func_field(struct trace_seq *s, const char *fmt,
        if (!field)
                goto failed;
 
-       if (pevent_read_number_field(field, record->data, &val))
+       if (tep_read_number_field(field, record->data, &val))
                goto failed;
 
        func = find_func(pevent, val);
index fb7f2277bbec70cb7d29a30e7da80858060fcc8d..58d9f0dedf05710e42964645eaaacf5bd039334c 100644 (file)
@@ -693,9 +693,9 @@ struct format_field *tep_find_any_field(struct event_format *event, const char *
 const char *pevent_find_function(struct tep_handle *pevent, unsigned long long addr);
 unsigned long long
 pevent_find_function_address(struct tep_handle *pevent, unsigned long long addr);
-unsigned long long pevent_read_number(struct tep_handle *pevent, const void *ptr, int size);
-int pevent_read_number_field(struct format_field *field, const void *data,
-                            unsigned long long *value);
+unsigned long long tep_read_number(struct tep_handle *pevent, const void *ptr, int size);
+int tep_read_number_field(struct format_field *field, const void *data,
+                         unsigned long long *value);
 
 struct event_format *tep_find_event(struct tep_handle *pevent, int id);
 
index 7b6bab1ab0cdc47b70311ad63646022fabd1c389..732c9e7d8aafbe3e2c0923aac4c4f219807f4a7a 100644 (file)
@@ -1728,7 +1728,7 @@ get_value(struct event_format *event,
        if (field == &cpu)
                return record->cpu;
 
-       pevent_read_number_field(field, record->data, &val);
+       tep_read_number_field(field, record->data, &val);
 
        if (!(field->flags & FIELD_IS_SIGNED))
                return val;
index a5f8641495f3aa2e6fd85520264cc303964c246b..28cabe250daffe5d18e496ffb2a9ec3e9f3e0493 100644 (file)
@@ -35,7 +35,7 @@ static int call_site_handler(struct trace_seq *s, struct tep_record *record,
        if (!field)
                return 1;
 
-       if (pevent_read_number_field(field, data, &val))
+       if (tep_read_number_field(field, data, &val))
                return 1;
 
        func = pevent_find_function(event->pevent, val);
index 611250300855911f27354177f46ef9ff725f2b07..5197f940d153943e8f696ef8bfe0798d510ffb15 100644 (file)
@@ -42,7 +42,7 @@ static void print_string(struct trace_seq *s, struct event_format *event,
 
        if (!strncmp(f->type, "__data_loc", 10)) {
                unsigned long long v;
-               if (pevent_read_number_field(f, data, &v)) {
+               if (tep_read_number_field(f, data, &v)) {
                        trace_seq_printf(s, "invalid_data_loc");
                        return;
                }
index 5744c12641a53d341ef46d548a3498272841cf54..abd38abf1d918ab81b360ed9691831eaac162161 100644 (file)
@@ -310,8 +310,8 @@ static int add_tracepoint_field_value(struct ctf_writer *cw,
        if (flags & FIELD_IS_DYNAMIC) {
                unsigned long long tmp_val;
 
-               tmp_val = pevent_read_number(fmtf->event->pevent,
-                               data + offset, len);
+               tmp_val = tep_read_number(fmtf->event->pevent,
+                                         data + offset, len);
                offset = tmp_val;
                len = offset >> 16;
                offset &= 0xffff;
@@ -353,7 +353,7 @@ static int add_tracepoint_field_value(struct ctf_writer *cw,
                else {
                        unsigned long long value_int;
 
-                       value_int = pevent_read_number(
+                       value_int = tep_read_number(
                                        fmtf->event->pevent,
                                        data + offset + i * len, len);
 
index ff01cd53edddc9d559839ab2964bd95e7a3f49d4..f74fbb652a4fe33909de64aa55182085acddceef 100644 (file)
@@ -351,7 +351,7 @@ tracepoint_field(struct pyrf_event *pe, struct format_field *field)
                offset = field->offset;
                len    = field->size;
                if (field->flags & FIELD_IS_DYNAMIC) {
-                       val     = pevent_read_number(pevent, data + offset, len);
+                       val     = tep_read_number(pevent, data + offset, len);
                        offset  = val;
                        len     = offset >> 16;
                        offset &= 0xffff;
@@ -364,8 +364,8 @@ tracepoint_field(struct pyrf_event *pe, struct format_field *field)
                        field->flags &= ~FIELD_IS_STRING;
                }
        } else {
-               val = pevent_read_number(pevent, data + field->offset,
-                                        field->size);
+               val = tep_read_number(pevent, data + field->offset,
+                                     field->size);
                if (field->flags & FIELD_IS_POINTER)
                        ret = PyLong_FromUnsignedLong((unsigned long) val);
                else if (field->flags & FIELD_IS_SIGNED)
index 77bddd50e7056618156c6e64e64b74674636ebad..dfc6093f118c9787ad0a1dd8e530103188f66676 100644 (file)
@@ -871,8 +871,8 @@ static void python_process_tracepoint(struct perf_sample *sample,
                        offset = field->offset;
                        len    = field->size;
                        if (field->flags & FIELD_IS_DYNAMIC) {
-                               val     = pevent_read_number(scripting_context->pevent,
-                                                            data + offset, len);
+                               val     = tep_read_number(scripting_context->pevent,
+                                                         data + offset, len);
                                offset  = val;
                                len     = offset >> 16;
                                offset &= 0xffff;
index 93bc9b1860afa772284d56761cfa6b8daa6e443e..b284276ec963548e3633ac7e21ecded8666b56e1 100644 (file)
@@ -2074,7 +2074,7 @@ static int64_t __sort__hde_cmp(struct perf_hpp_fmt *fmt,
        if (field->flags & FIELD_IS_DYNAMIC) {
                unsigned long long dyn;
 
-               pevent_read_number_field(field, a->raw_data, &dyn);
+               tep_read_number_field(field, a->raw_data, &dyn);
                offset = dyn & 0xffff;
                size = (dyn >> 16) & 0xffff;
 
index f8b91f3813ca7df1fd86b44eeb20f08cc7e5088c..a0e2b2c5456716147b1e83fd925473f13043e420 100644 (file)
@@ -48,7 +48,7 @@ static int get_common_field(struct scripting_context *context,
                *size = field->size;
        }
 
-       return pevent_read_number(pevent, context->event_data + *offset, *size);
+       return tep_read_number(pevent, context->event_data + *offset, *size);
 }
 
 int common_lock_depth(struct scripting_context *context)
@@ -103,14 +103,14 @@ raw_field_value(struct event_format *event, const char *name, void *data)
        if (!field)
                return 0ULL;
 
-       pevent_read_number_field(field, data, &val);
+       tep_read_number_field(field, data, &val);
 
        return val;
 }
 
 unsigned long long read_size(struct event_format *event, void *ptr, int size)
 {
-       return pevent_read_number(event->pevent, ptr, size);
+       return tep_read_number(event->pevent, ptr, size);
 }
 
 void event_format__fprintf(struct event_format *event,