Skip to content

Commit 3bce4b5

Browse files
olsajiriKernel Patches Daemon
authored andcommitted
ftrace: Export some of hash related functions
We are going to use these functions in following changes. Signed-off-by: Jiri Olsa <[email protected]>
1 parent 23c6c8e commit 3bce4b5

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

include/linux/ftrace.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ static inline void early_trace_init(void) { }
8282

8383
struct module;
8484
struct ftrace_hash;
85+
struct ftrace_func_entry;
8586

8687
#if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_MODULES) && \
8788
defined(CONFIG_DYNAMIC_FTRACE)
@@ -405,6 +406,14 @@ enum ftrace_ops_cmd {
405406
typedef int (*ftrace_ops_func_t)(struct ftrace_ops *op, enum ftrace_ops_cmd cmd);
406407

407408
#ifdef CONFIG_DYNAMIC_FTRACE
409+
410+
#define FTRACE_HASH_DEFAULT_BITS 10
411+
412+
struct ftrace_hash *alloc_ftrace_hash(int size_bits);
413+
void free_ftrace_hash(struct ftrace_hash *hash);
414+
struct ftrace_func_entry *add_hash_entry_direct(struct ftrace_hash *hash,
415+
unsigned long ip, unsigned long direct);
416+
408417
/* The hash used to know what functions callbacks trace */
409418
struct ftrace_ops_hash {
410419
struct ftrace_hash __rcu *notrace_hash;

kernel/trace/ftrace.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
})
6969

7070
/* hash bits for specific function selection */
71-
#define FTRACE_HASH_DEFAULT_BITS 10
7271
#define FTRACE_HASH_MAX_BITS 12
7372

7473
#ifdef CONFIG_DYNAMIC_FTRACE
@@ -1185,7 +1184,7 @@ static void __add_hash_entry(struct ftrace_hash *hash,
11851184
hash->count++;
11861185
}
11871186

1188-
static struct ftrace_func_entry *
1187+
struct ftrace_func_entry *
11891188
add_hash_entry_direct(struct ftrace_hash *hash, unsigned long ip, unsigned long direct)
11901189
{
11911190
struct ftrace_func_entry *entry;
@@ -1265,7 +1264,7 @@ static void clear_ftrace_mod_list(struct list_head *head)
12651264
mutex_unlock(&ftrace_lock);
12661265
}
12671266

1268-
static void free_ftrace_hash(struct ftrace_hash *hash)
1267+
void free_ftrace_hash(struct ftrace_hash *hash)
12691268
{
12701269
if (!hash || hash == EMPTY_HASH)
12711270
return;
@@ -1305,7 +1304,7 @@ void ftrace_free_filter(struct ftrace_ops *ops)
13051304
}
13061305
EXPORT_SYMBOL_GPL(ftrace_free_filter);
13071306

1308-
static struct ftrace_hash *alloc_ftrace_hash(int size_bits)
1307+
struct ftrace_hash *alloc_ftrace_hash(int size_bits)
13091308
{
13101309
struct ftrace_hash *hash;
13111310
int size;

0 commit comments

Comments
 (0)