Skip to content

Commit bfdccd7

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 e28c79c commit bfdccd7

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

include/linux/ftrace.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,22 @@ enum ftrace_ops_cmd {
405405
typedef int (*ftrace_ops_func_t)(struct ftrace_ops *op, enum ftrace_ops_cmd cmd);
406406

407407
#ifdef CONFIG_DYNAMIC_FTRACE
408+
409+
#define FTRACE_HASH_DEFAULT_BITS 10
410+
411+
struct ftrace_hash {
412+
unsigned long size_bits;
413+
struct hlist_head *buckets;
414+
unsigned long count;
415+
unsigned long flags;
416+
struct rcu_head rcu;
417+
};
418+
419+
struct ftrace_hash *alloc_ftrace_hash(int size_bits);
420+
void free_ftrace_hash(struct ftrace_hash *hash);
421+
struct ftrace_func_entry *add_hash_entry_direct(struct ftrace_hash *hash,
422+
unsigned long ip, unsigned long direct);
423+
408424
/* The hash used to know what functions callbacks trace */
409425
struct ftrace_ops_hash {
410426
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;

kernel/trace/trace.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -899,14 +899,6 @@ enum {
899899
FTRACE_HASH_FL_MOD = (1 << 0),
900900
};
901901

902-
struct ftrace_hash {
903-
unsigned long size_bits;
904-
struct hlist_head *buckets;
905-
unsigned long count;
906-
unsigned long flags;
907-
struct rcu_head rcu;
908-
};
909-
910902
struct ftrace_func_entry *
911903
ftrace_lookup_ip(struct ftrace_hash *hash, unsigned long ip);
912904

0 commit comments

Comments
 (0)