X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=include%2Fwrapper%2Fgenhd.h;h=3c6dbcbe41a386e6c0bfa593c6c3bf479009f399;hb=b2cf5e0b0edcfe64d158119097fa49321cf9ba97;hp=807074ddcbe3e3102f010c52e63cfd37fc128a18;hpb=117ab60f69a98dcbc365de8008ab93e6699d153a;p=lttng-modules.git diff --git a/include/wrapper/genhd.h b/include/wrapper/genhd.h index 807074dd..3c6dbcbe 100644 --- a/include/wrapper/genhd.h +++ b/include/wrapper/genhd.h @@ -14,37 +14,17 @@ #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; - } -} - +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) +#define LTTNG_GENHD_FL_HIDDEN GENHD_FL_HIDDEN #else - -static inline -char *wrapper_disk_name(struct gendisk *hd, int partno, char *buf) -{ - return disk_name(hd, partno, buf); -} - +#define LTTNG_GENHD_FL_HIDDEN GENHD_FL_SUPPRESS_PARTITION_INFO #endif #ifdef CONFIG_KALLSYMS_ALL +#include +#include + static inline struct class *wrapper_get_block_class(void) { @@ -58,6 +38,19 @@ struct class *wrapper_get_block_class(void) return ptr_block_class; } +/* + * Canary function to check for 'block_class' at compile time. + * + * From 'include/linux/genhd.h': + * + * extern struct class block_class; + */ +static inline +struct class *__canary__get_block_class(void) +{ + return &block_class; +} + static inline struct device_type *wrapper_get_disk_type(void) { @@ -71,6 +64,16 @@ struct device_type *wrapper_get_disk_type(void) return ptr_disk_type; } +/* + * No canary for 'disk_type', it's only defined in 'block/genhd.c'. + * + * static inline + * struct device_type *__canary__get_disk_type(void) + * { + * return &disk_type; + * } + */ + #else static inline