OSDN Git Service

perf kallsyms: Adopt hex2u64 from tools/perf/util/util.h
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 25 Jun 2019 21:13:17 +0000 (18:13 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 25 Jun 2019 21:13:17 +0000 (18:13 -0300)
Just removing more stuff from tools/perf/, this is mostly used in the
kallsyms parsing and in places in perf where kallsyms is involved, so we
get it for free there.

With this we reduce a bit more util.h.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-5mc1zg0jqdwgkn8c358kaba6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/symbol/kallsyms.c
tools/lib/symbol/kallsyms.h
tools/perf/util/util.c
tools/perf/util/util.h

index 96d8305..7501611 100644 (file)
@@ -16,6 +16,19 @@ bool kallsyms__is_function(char symbol_type)
        return symbol_type == 'T' || symbol_type == 'W';
 }
 
+/*
+ * While we find nice hex chars, build a long_val.
+ * Return number of chars processed.
+ */
+int hex2u64(const char *ptr, u64 *long_val)
+{
+       char *p;
+
+       *long_val = strtoull(ptr, &p, 16);
+
+       return p - ptr;
+}
+
 int kallsyms__parse(const char *filename, void *arg,
                    int (*process_symbol)(void *arg, const char *name,
                                          char type, u64 start))
index 72ab987..bd988f7 100644 (file)
@@ -18,6 +18,8 @@ static inline u8 kallsyms2elf_binding(char type)
        return isupper(type) ? STB_GLOBAL : STB_LOCAL;
 }
 
+int hex2u64(const char *ptr, u64 *long_val);
+
 u8 kallsyms2elf_type(char type);
 
 bool kallsyms__is_function(char symbol_type);
index d388f80..a61535c 100644 (file)
@@ -434,19 +434,6 @@ size_t hex_width(u64 v)
        return n;
 }
 
-/*
- * While we find nice hex chars, build a long_val.
- * Return number of chars processed.
- */
-int hex2u64(const char *ptr, u64 *long_val)
-{
-       char *p;
-
-       *long_val = strtoull(ptr, &p, 16);
-
-       return p - ptr;
-}
-
 int perf_event_paranoid(void)
 {
        int value;
index 09c1b0f..125e215 100644 (file)
@@ -43,7 +43,6 @@ ssize_t readn(int fd, void *buf, size_t n);
 ssize_t writen(int fd, const void *buf, size_t n);
 
 size_t hex_width(u64 v);
-int hex2u64(const char *ptr, u64 *val);
 
 extern unsigned int page_size;
 int __pure cacheline_size(void);