kallsyms.c (3eb66e91a25497065c5322b1268cbc3953642227) kallsyms.c (155681fcd7f82882a730240c2dde7eee76a46314)
1// SPDX-License-Identifier: GPL-2.0
2#include <ctype.h>
3#include "symbol/kallsyms.h"
4#include <stdio.h>
5#include <stdlib.h>
6
7u8 kallsyms2elf_type(char type)
8{
9 type = tolower(type);
10 return (type == 't' || type == 'w') ? STT_FUNC : STT_OBJECT;
11}
12
13bool kallsyms__is_function(char symbol_type)
14{
15 symbol_type = toupper(symbol_type);
16 return symbol_type == 'T' || symbol_type == 'W';
17}
18
1// SPDX-License-Identifier: GPL-2.0
2#include <ctype.h>
3#include "symbol/kallsyms.h"
4#include <stdio.h>
5#include <stdlib.h>
6
7u8 kallsyms2elf_type(char type)
8{
9 type = tolower(type);
10 return (type == 't' || type == 'w') ? STT_FUNC : STT_OBJECT;
11}
12
13bool kallsyms__is_function(char symbol_type)
14{
15 symbol_type = toupper(symbol_type);
16 return symbol_type == 'T' || symbol_type == 'W';
17}
18
19/*
20 * While we find nice hex chars, build a long_val.
21 * Return number of chars processed.
22 */
23int hex2u64(const char *ptr, u64 *long_val)
24{
25 char *p;
26
27 *long_val = strtoull(ptr, &p, 16);
28
29 return p - ptr;
30}
31
19int kallsyms__parse(const char *filename, void *arg,
20 int (*process_symbol)(void *arg, const char *name,
21 char type, u64 start))
22{
23 char *line = NULL;
24 size_t n;
25 int err = -1;
26 FILE *file = fopen(filename, "r");

--- 50 unchanged lines hidden ---
32int kallsyms__parse(const char *filename, void *arg,
33 int (*process_symbol)(void *arg, const char *name,
34 char type, u64 start))
35{
36 char *line = NULL;
37 size_t n;
38 int err = -1;
39 FILE *file = fopen(filename, "r");

--- 50 unchanged lines hidden ---