1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
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.
9 * Copyright (C) 2011-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 #ifndef _LTTNG_WRAPPER_GENHD_H
13 #define _LTTNG_WRAPPER_GENHD_H
15 #include <linux/genhd.h>
17 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
18 #define LTTNG_GENHD_FL_HIDDEN GENHD_FL_HIDDEN
20 #define LTTNG_GENHD_FL_HIDDEN GENHD_FL_SUPPRESS_PARTITION_INFO
23 #ifdef CONFIG_KALLSYMS_ALL
25 #include <linux/kallsyms.h>
26 #include <wrapper/kallsyms.h>
29 struct class *wrapper_get_block_class(void)
31 struct class *ptr_block_class
;
33 ptr_block_class
= (struct class *) kallsyms_lookup_dataptr("block_class");
34 if (!ptr_block_class
) {
35 printk_once(KERN_WARNING
"LTTng: block_class symbol lookup failed.\n");
38 return ptr_block_class
;
42 * Canary function to check for 'block_class' at compile time.
44 * From 'include/linux/genhd.h':
46 * extern struct class block_class;
49 struct class *__canary__get_block_class(void)
55 struct device_type
*wrapper_get_disk_type(void)
57 struct device_type
*ptr_disk_type
;
59 ptr_disk_type
= (struct device_type
*) kallsyms_lookup_dataptr("disk_type");
61 printk_once(KERN_WARNING
"LTTng: disk_type symbol lookup failed.\n");
68 * No canary for 'disk_type', it's only defined in 'block/genhd.c'.
71 * struct device_type *__canary__get_disk_type(void)
80 struct class *wrapper_get_block_class(void)
83 * Symbol block_class is not exported.
84 * TODO: return &block_class;
86 /* Feature currently unavailable without KALLSYMS_ALL */
91 struct device_type
*wrapper_get_disk_type(void)
94 * Symbol disk_type is not exported.
95 * TODO: return &disk_type;
97 /* Feature currently unavailable without KALLSYMS_ALL */
103 #endif /* _LTTNG_WRAPPER_GENHD_H */
This page took 0.03229 seconds and 4 git commands to generate.