Use exported symbol bdevname() instead of disk_name()
[lttng-modules.git] / include / wrapper / genhd.h
1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
2 *
3 * wrapper/genhd.h
4 *
5 * wrapper around block layer functions and data structures. Using
6 * KALLSYMS to get its address when available, else we need to have a
7 * kernel that exports this function to GPL modules.
8 *
9 * Copyright (C) 2011-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 */
11
12 #ifndef _LTTNG_WRAPPER_GENHD_H
13 #define _LTTNG_WRAPPER_GENHD_H
14
15 #include <linux/genhd.h>
16
17 #ifdef CONFIG_KALLSYMS_ALL
18
19 #include <linux/kallsyms.h>
20 #include <wrapper/kallsyms.h>
21
22 static inline
23 struct class *wrapper_get_block_class(void)
24 {
25 struct class *ptr_block_class;
26
27 ptr_block_class = (struct class *) kallsyms_lookup_dataptr("block_class");
28 if (!ptr_block_class) {
29 printk_once(KERN_WARNING "LTTng: block_class symbol lookup failed.\n");
30 return NULL;
31 }
32 return ptr_block_class;
33 }
34
35 static inline
36 struct device_type *wrapper_get_disk_type(void)
37 {
38 struct device_type *ptr_disk_type;
39
40 ptr_disk_type = (struct device_type *) kallsyms_lookup_dataptr("disk_type");
41 if (!ptr_disk_type) {
42 printk_once(KERN_WARNING "LTTng: disk_type symbol lookup failed.\n");
43 return NULL;
44 }
45 return ptr_disk_type;
46 }
47
48 #else
49
50 static inline
51 struct class *wrapper_get_block_class(void)
52 {
53 /*
54 * Symbol block_class is not exported.
55 * TODO: return &block_class;
56 */
57 /* Feature currently unavailable without KALLSYMS_ALL */
58 return NULL;
59 }
60
61 static inline
62 struct device_type *wrapper_get_disk_type(void)
63 {
64 /*
65 * Symbol disk_type is not exported.
66 * TODO: return &disk_type;
67 */
68 /* Feature currently unavailable without KALLSYMS_ALL */
69 return NULL;
70 }
71
72 #endif
73
74 #endif /* _LTTNG_WRAPPER_GENHD_H */
This page took 0.03086 seconds and 4 git commands to generate.