X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=wrapper%2Fgenhd.h;fp=wrapper%2Fgenhd.h;h=0000000000000000000000000000000000000000;hb=117ab60f69a98dcbc365de8008ab93e6699d153a;hp=807074ddcbe3e3102f010c52e63cfd37fc128a18;hpb=7c6d929d62a6e24fb1dbeaee5cd2c8afe77720b7;p=lttng-modules.git diff --git a/wrapper/genhd.h b/wrapper/genhd.h deleted file mode 100644 index 807074dd..00000000 --- a/wrapper/genhd.h +++ /dev/null @@ -1,100 +0,0 @@ -/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) - * - * wrapper/genhd.h - * - * wrapper around block layer functions and data structures. Using - * KALLSYMS to get its address when available, else we need to have a - * kernel that exports this function to GPL modules. - * - * Copyright (C) 2011-2014 Mathieu Desnoyers - */ - -#ifndef _LTTNG_WRAPPER_GENHD_H -#define _LTTNG_WRAPPER_GENHD_H - -#include - -#ifdef CONFIG_KALLSYMS - -#include -#include - -static inline -char *wrapper_disk_name(struct gendisk *hd, int partno, char *buf) -{ - char *(*disk_name_sym)(struct gendisk *hd, int partno, char *buf); - - disk_name_sym = (void *) kallsyms_lookup_funcptr("disk_name"); - if (disk_name_sym) { - return disk_name_sym(hd, partno, buf); - } else { - printk_once(KERN_WARNING "LTTng: disk_name symbol lookup failed.\n"); - return NULL; - } -} - -#else - -static inline -char *wrapper_disk_name(struct gendisk *hd, int partno, char *buf) -{ - return disk_name(hd, partno, buf); -} - -#endif - -#ifdef CONFIG_KALLSYMS_ALL - -static inline -struct class *wrapper_get_block_class(void) -{ - struct class *ptr_block_class; - - ptr_block_class = (struct class *) kallsyms_lookup_dataptr("block_class"); - if (!ptr_block_class) { - printk_once(KERN_WARNING "LTTng: block_class symbol lookup failed.\n"); - return NULL; - } - return ptr_block_class; -} - -static inline -struct device_type *wrapper_get_disk_type(void) -{ - struct device_type *ptr_disk_type; - - ptr_disk_type = (struct device_type *) kallsyms_lookup_dataptr("disk_type"); - if (!ptr_disk_type) { - printk_once(KERN_WARNING "LTTng: disk_type symbol lookup failed.\n"); - return NULL; - } - return ptr_disk_type; -} - -#else - -static inline -struct class *wrapper_get_block_class(void) -{ - /* - * Symbol block_class is not exported. - * TODO: return &block_class; - */ - /* Feature currently unavailable without KALLSYMS_ALL */ - return NULL; -} - -static inline -struct device_type *wrapper_get_disk_type(void) -{ - /* - * Symbol disk_type is not exported. - * TODO: return &disk_type; - */ - /* Feature currently unavailable without KALLSYMS_ALL */ - return NULL; -} - -#endif - -#endif /* _LTTNG_WRAPPER_GENHD_H */