Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libsymbols kallsyms: Move hex2u64 out of header

hex2u64 is a helper that's out of place in kallsyms.h as not being
kallsyms related. Move from kallsyms.h to the only user.

Committer notes:

Move it out of tools/lib/symbol/kallsyms.c as well, as we had to leave
it there in the previous patch lest we break the build.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lore.kernel.org/lkml/20200501221315.54715-4-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
32add10f 53df2b93

+14 -15
-13
tools/lib/symbol/kallsyms.c
··· 11 11 return (type == 't' || type == 'w') ? STT_FUNC : STT_OBJECT; 12 12 } 13 13 14 - /* 15 - * While we find nice hex chars, build a long_val. 16 - * Return number of chars processed. 17 - */ 18 - int hex2u64(const char *ptr, u64 *long_val) 19 - { 20 - char *p; 21 - 22 - *long_val = strtoull(ptr, &p, 16); 23 - 24 - return p - ptr; 25 - } 26 - 27 14 bool kallsyms__is_function(char symbol_type) 28 15 { 29 16 symbol_type = toupper(symbol_type);
-2
tools/lib/symbol/kallsyms.h
··· 18 18 return isupper(type) ? STB_GLOBAL : STB_LOCAL; 19 19 } 20 20 21 - int hex2u64(const char *ptr, u64 *long_val); 22 - 23 21 u8 kallsyms2elf_type(char type); 24 22 25 23 bool kallsyms__is_function(char symbol_type);
+14
tools/perf/util/symbol.c
··· 566 566 return symbols__sort_by_name(&dso->symbol_names, &dso->symbols); 567 567 } 568 568 569 + /* 570 + * While we find nice hex chars, build a long_val. 571 + * Return number of chars processed. 572 + */ 573 + static int hex2u64(const char *ptr, u64 *long_val) 574 + { 575 + char *p; 576 + 577 + *long_val = strtoull(ptr, &p, 16); 578 + 579 + return p - ptr; 580 + } 581 + 582 + 569 583 int modules__parse(const char *filename, void *arg, 570 584 int (*process_module)(void *arg, const char *name, 571 585 u64 start, u64 size))