1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
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 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
16 #include <linux/blkdev.h>
18 #include <linux/genhd.h>
21 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
22 #define LTTNG_GENHD_FL_HIDDEN GENHD_FL_HIDDEN
24 #define LTTNG_GENHD_FL_HIDDEN GENHD_FL_SUPPRESS_PARTITION_INFO
27 #ifdef CONFIG_KALLSYMS_ALL
29 #include <linux/kallsyms.h>
30 #include <wrapper/kallsyms.h>
33 struct class *wrapper_get_block_class(void)
35 struct class *ptr_block_class
;
37 ptr_block_class
= (struct class *) kallsyms_lookup_dataptr("block_class");
38 if (!ptr_block_class
) {
39 printk_once(KERN_WARNING
"LTTng: block_class symbol lookup failed.\n");
42 return ptr_block_class
;
46 * Canary function to check for 'block_class' at compile time.
48 * From 'include/linux/genhd.h':
50 * extern struct class block_class;
53 struct class *__canary__get_block_class(void)
59 struct device_type
*wrapper_get_disk_type(void)
61 struct device_type
*ptr_disk_type
;
63 ptr_disk_type
= (struct device_type
*) kallsyms_lookup_dataptr("disk_type");
65 printk_once(KERN_WARNING
"LTTng: disk_type symbol lookup failed.\n");
72 * No canary for 'disk_type', it's only defined in 'block/genhd.c'.
75 * struct device_type *__canary__get_disk_type(void)
84 struct class *wrapper_get_block_class(void)
87 * Symbol block_class is not exported.
88 * TODO: return &block_class;
90 /* Feature currently unavailable without KALLSYMS_ALL */
95 struct device_type
*wrapper_get_disk_type(void)
98 * Symbol disk_type is not exported.
99 * TODO: return &disk_type;
101 /* Feature currently unavailable without KALLSYMS_ALL */
107 #endif /* _LTTNG_WRAPPER_GENHD_H */
This page took 0.038087 seconds and 4 git commands to generate.