[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200409193543.18115-9-mathieu.desnoyers@efficios.com>
Date: Thu, 9 Apr 2020 15:35:42 -0400
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Will Deacon <will@...nel.org>, akpm@...ux-foundation.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"K . Prasad" <prasad@...ux.vnet.ibm.com>,
Masami Hiramatsu <mhiramat@...nel.org>, rostedt@...dmis.org,
Alexei Starovoitov <ast@...nel.org>
Cc: linux-kernel@...r.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Tejun Heo <tj@...nel.org>
Subject: [RFC PATCH 8/9] block: genhd: export-GPL generic disk device type
Iteration on class devices is exported for use by GPL modules, but
there is no exported function for getting the generic disk device type
which is required to perform iteration on the generic disks.
Export a new getter for disk device type for use by GPL modules. This is
useful for tracing a meaningful list of block devices from tracers
implemented as GPL modules.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Tejun Heo <tj@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
---
block/genhd.c | 9 +++++++++
include/linux/genhd.h | 2 ++
2 files changed, 11 insertions(+)
diff --git a/block/genhd.c b/block/genhd.c
index 409c5a92b0b9..e104b696002f 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1546,6 +1546,15 @@ static const struct device_type disk_type = {
.devnode = block_devnode,
};
+/*
+ * Return the generic disk device type.
+ */
+const struct device_type *gendisk_device_type(void)
+{
+ return &disk_type;
+}
+EXPORT_SYMBOL_GPL(gendisk_device_type);
+
#ifdef CONFIG_PROC_FS
/*
* aggregate disk stat collector. Uses the same stats that the sysfs
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 9b3fffdf4011..3307dfae72cb 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -353,6 +353,8 @@ extern void blk_register_region(dev_t devt, unsigned long range,
void *data);
extern void blk_unregister_region(dev_t devt, unsigned long range);
+extern const struct device_type *gendisk_device_type(void);
+
#define alloc_disk_node(minors, node_id) \
({ \
static struct lock_class_key __key; \
--
2.17.1
Powered by blists - more mailing lists