wrapper: remove genhd wrapper
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 13 Apr 2020 18:51:23 +0000 (14:51 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 13 Apr 2020 19:27:25 +0000 (15:27 -0400)
lttng-statedump-impl.c
wrapper/genhd.h [deleted file]

index a40ef760902db32ac657072fb7cb881ef40f04df..657031ec9e535990683d37c24bbb64ae6e75ced0 100644 (file)
 #include <linux/device.h>
 #include <linux/fdtable.h>
 #include <linux/irq.h>
+#include <linux/genhd.h>
 
 #include <lttng-events.h>
 #include <lttng-tracer.h>
-#include <wrapper/genhd.h>
 
 /* Define the tracepoints, but do not build the probes */
 #define CREATE_TRACE_POINTS
@@ -114,19 +114,11 @@ enum lttng_process_status {
 static
 int lttng_enumerate_block_devices(struct lttng_session *session)
 {
-       struct class *ptr_block_class;
-       struct device_type *ptr_disk_type;
        struct class_dev_iter iter;
        struct device *dev;
 
-       ptr_block_class = wrapper_get_block_class();
-       if (!ptr_block_class)
-               return -ENOSYS;
-       ptr_disk_type = wrapper_get_disk_type();
-       if (!ptr_disk_type) {
-               return -ENOSYS;
-       }
-       class_dev_iter_init(&iter, ptr_block_class, NULL, ptr_disk_type);
+       class_dev_iter_init(&iter, gendisk_block_class(), NULL,
+                           gendisk_device_type());
        while ((dev = class_dev_iter_next(&iter))) {
                struct disk_part_iter piter;
                struct gendisk *disk = dev_to_disk(dev);
@@ -145,7 +137,7 @@ int lttng_enumerate_block_devices(struct lttng_session *session)
                        char name_buf[BDEVNAME_SIZE];
                        char *p;
 
-                       p = wrapper_disk_name(disk, part->partno, name_buf);
+                       p = gendisk_name(disk, part->partno, name_buf);
                        if (!p) {
                                disk_part_iter_exit(&piter);
                                class_dev_iter_exit(&iter);
diff --git a/wrapper/genhd.h b/wrapper/genhd.h
deleted file mode 100644 (file)
index 807074d..0000000
+++ /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 <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _LTTNG_WRAPPER_GENHD_H
-#define _LTTNG_WRAPPER_GENHD_H
-
-#include <linux/genhd.h>
-
-#ifdef CONFIG_KALLSYMS
-
-#include <linux/kallsyms.h>
-#include <wrapper/kallsyms.h>
-
-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 */
This page took 0.028596 seconds and 4 git commands to generate.