1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * A generic stack depot implementation
5 * Author: Alexander Potapenko <glider@google.com>
6 * Copyright (C) 2016 Google, Inc.
8 * Based on code by Dmitry Chernenkov.
11 #ifndef _LINUX_STACKDEPOT_H
12 #define _LINUX_STACKDEPOT_H
14 #include <linux/gfp.h>
16 typedef u32 depot_stack_handle_t;
18 depot_stack_handle_t __stack_depot_save(unsigned long *entries,
19 unsigned int nr_entries,
20 gfp_t gfp_flags, bool can_alloc);
22 depot_stack_handle_t stack_depot_save(unsigned long *entries,
23 unsigned int nr_entries, gfp_t gfp_flags);
25 unsigned int stack_depot_fetch(depot_stack_handle_t handle,
26 unsigned long **entries);
28 int stack_depot_snprint(depot_stack_handle_t handle, char *buf, size_t size,
31 void stack_depot_print(depot_stack_handle_t stack);
33 #ifdef CONFIG_STACKDEPOT
34 int stack_depot_init(void);
36 static inline int stack_depot_init(void)
40 #endif /* CONFIG_STACKDEPOT */