1 #ifndef _LTTNG_WRAPPER_GENHD_H
2 #define _LTTNG_WRAPPER_GENHD_H
7 * wrapper around block layer functions and data structures. Using
8 * KALLSYMS to get its address when available, else we need to have a
9 * kernel that exports this function to GPL modules.
11 * Copyright (C) 2011-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; only
16 * version 2.1 of the License.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28 #include <linux/genhd.h>
30 #ifdef CONFIG_KALLSYMS
32 #include <linux/kallsyms.h>
36 char *wrapper_disk_name(struct gendisk
*hd
, int partno
, char *buf
)
38 char *(*disk_name_sym
)(struct gendisk
*hd
, int partno
, char *buf
);
40 disk_name_sym
= (void *) kallsyms_lookup_funcptr("disk_name");
42 return disk_name_sym(hd
, partno
, buf
);
44 printk(KERN_WARNING
"LTTng: disk_name symbol lookup failed.\n");
52 char *wrapper_disk_name(struct gendisk
*hd
, int partno
, char *buf
)
54 return disk_name(hd
, partno
, buf
);
59 #ifdef CONFIG_KALLSYMS_ALL
62 struct class *wrapper_get_block_class(void)
64 struct class *ptr_block_class
;
66 ptr_block_class
= (struct class *) kallsyms_lookup_dataptr("block_class");
67 if (!ptr_block_class
) {
68 printk(KERN_WARNING
"LTTng: block_class symbol lookup failed.\n");
71 return ptr_block_class
;
75 struct device_type
*wrapper_get_disk_type(void)
77 struct device_type
*ptr_disk_type
;
79 ptr_disk_type
= (struct device_type
*) kallsyms_lookup_dataptr("disk_type");
81 printk(KERN_WARNING
"LTTng: disk_type symbol lookup failed.\n");
90 struct class *wrapper_get_block_class(void)
93 * Symbol block_class is not exported.
94 * TODO: return &block_class;
96 /* Feature currently unavailable without KALLSYMS_ALL */
101 struct device_type
*wrapper_get_disk_type(void)
104 * Symbol disk_type is not exported.
105 * TODO: return &disk_type;
107 /* Feature currently unavailable without KALLSYMS_ALL */
113 #endif /* _LTTNG_WRAPPER_GENHD_H */
This page took 0.031441 seconds and 4 git commands to generate.