From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Will Deacon <will@kernel.org>,
akpm@linux-foundation.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"K . Prasad" <prasad@linux.vnet.ibm.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
rostedt@goodmis.org, Alexei Starovoitov <ast@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Tejun Heo <tj@kernel.org>
Subject: [RFC PATCH 7/9] block: genhd: export-GPL gendisk_name
Date: Thu, 9 Apr 2020 15:35:41 -0400 [thread overview]
Message-ID: <20200409193543.18115-8-mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <20200409193543.18115-1-mathieu.desnoyers@efficios.com>
Iteration on class devices is exported for use by GPL modules, but the
helper for formatting generic disk name is not.
The symbol "disk_name" used for this helper could benefit from
a more specific namespacing. Rename it to "gendisk_name" and adapt all
users across the kernel tree.
Export the generic disk name formatting helper 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@efficios.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
block/bio.c | 2 +-
block/blk-settings.c | 2 +-
block/blk.h | 2 +-
block/genhd.c | 13 +++++++------
block/partitions/core.c | 2 +-
5 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index 21cbaa6a1c20..d6665bab1fef 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -725,7 +725,7 @@ EXPORT_SYMBOL(bio_clone_fast);
const char *bio_devname(struct bio *bio, char *buf)
{
- return disk_name(bio->bi_disk, bio->bi_partno, buf);
+ return gendisk_name(bio->bi_disk, bio->bi_partno, buf);
}
EXPORT_SYMBOL(bio_devname);
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 14397b4c4b53..0b2eed0ed556 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -622,7 +622,7 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
if (bdev_stack_limits(&t->limits, bdev, offset >> 9) < 0) {
char top[BDEVNAME_SIZE], bottom[BDEVNAME_SIZE];
- disk_name(disk, 0, top);
+ gendisk_name(disk, 0, top);
bdevname(bdev, bottom);
printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
diff --git a/block/blk.h b/block/blk.h
index 0a94ec68af32..21978defa4b5 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -385,7 +385,7 @@ struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, sector_t sector);
int blk_alloc_devt(struct hd_struct *part, dev_t *devt);
void blk_free_devt(dev_t devt);
void blk_invalidate_devt(dev_t devt);
-char *disk_name(struct gendisk *hd, int partno, char *buf);
+char *gendisk_name(struct gendisk *hd, int partno, char *buf);
#define ADDPART_FLAG_NONE 0
#define ADDPART_FLAG_RAID 1
#define ADDPART_FLAG_WHOLEDISK 2
diff --git a/block/genhd.c b/block/genhd.c
index 06b642b23a07..409c5a92b0b9 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -74,7 +74,7 @@ EXPORT_SYMBOL_GPL(set_capacity_revalidate_and_notify);
* Format the device name of the indicated disk into the supplied buffer and
* return a pointer to that same buffer for convenience.
*/
-char *disk_name(struct gendisk *hd, int partno, char *buf)
+char *gendisk_name(struct gendisk *hd, int partno, char *buf)
{
if (!partno)
snprintf(buf, BDEVNAME_SIZE, "%s", hd->disk_name);
@@ -85,10 +85,11 @@ char *disk_name(struct gendisk *hd, int partno, char *buf)
return buf;
}
+EXPORT_SYMBOL_GPL(gendisk_name);
const char *bdevname(struct block_device *bdev, char *buf)
{
- return disk_name(bdev->bd_disk, bdev->bd_part->partno, buf);
+ return gendisk_name(bdev->bd_disk, bdev->bd_part->partno, buf);
}
EXPORT_SYMBOL(bdevname);
@@ -1081,8 +1082,8 @@ void __init printk_all_partitions(void)
printk("%s%s %10llu %s %s", is_part0 ? "" : " ",
bdevt_str(part_devt(part), devt_buf),
- (unsigned long long)part_nr_sects_read(part) >> 1
- , disk_name(disk, part->partno, name_buf),
+ (unsigned long long)part_nr_sects_read(part) >> 1,
+ gendisk_name(disk, part->partno, name_buf),
part->info ? part->info->uuid : "");
if (is_part0) {
if (dev->parent && dev->parent->driver)
@@ -1175,7 +1176,7 @@ static int show_partition(struct seq_file *seqf, void *v)
seq_printf(seqf, "%4d %7d %10llu %s\n",
MAJOR(part_devt(part)), MINOR(part_devt(part)),
(unsigned long long)part_nr_sects_read(part) >> 1,
- disk_name(sgp, part->partno, buf));
+ gendisk_name(sgp, part->partno, buf));
disk_part_iter_exit(&piter);
return 0;
@@ -1583,7 +1584,7 @@ static int diskstats_show(struct seq_file *seqf, void *v)
"%lu %u"
"\n",
MAJOR(part_devt(hd)), MINOR(part_devt(hd)),
- disk_name(gp, hd->partno, buf),
+ gendisk_name(gp, hd->partno, buf),
stat.ios[STAT_READ],
stat.merges[STAT_READ],
stat.sectors[STAT_READ],
diff --git a/block/partitions/core.c b/block/partitions/core.c
index b79c4513629b..56f0b730a2a0 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -129,7 +129,7 @@ static struct parsed_partitions *check_partition(struct gendisk *hd,
state->pp_buf[0] = '\0';
state->bdev = bdev;
- disk_name(hd, 0, state->name);
+ gendisk_name(hd, 0, state->name);
snprintf(state->pp_buf, PAGE_SIZE, " %s:", state->name);
if (isdigit(state->name[strlen(state->name)-1]))
sprintf(state->name, "p");
--
2.17.1
next prev parent reply other threads:[~2020-04-09 19:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-09 19:35 [RFC PATCH 0/9] Export information needed by the LTTng kernel tracer Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 1/9] tracepoint: call vmalloc_sync_mappings() on registration Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 2/9] bpf: allow up to 13 arguments for tracepoints Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 3/9] writeback: tracing: pass global_wb_domain as tracepoint parameter Mathieu Desnoyers
2020-04-09 22:33 ` Alexei Starovoitov
2020-04-10 11:54 ` Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 4/9] stacktrace: export-GPL stack_trace_save_user Mathieu Desnoyers
2020-04-12 8:31 ` Christoph Hellwig
2020-04-09 19:35 ` [RFC PATCH 5/9] sched: export-GPL task_prio Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 6/9] mm: export-GPL get_pageblock_migratetype Mathieu Desnoyers
2020-04-12 8:14 ` Christoph Hellwig
2020-04-09 19:35 ` Mathieu Desnoyers [this message]
2020-04-09 19:35 ` [RFC PATCH 8/9] block: genhd: export-GPL generic disk device type Mathieu Desnoyers
2020-04-10 6:33 ` Greg Kroah-Hartman
2020-04-10 13:31 ` Mathieu Desnoyers
2020-04-10 15:44 ` Steven Rostedt
2020-04-11 6:45 ` Greg Kroah-Hartman
2020-04-09 19:35 ` [RFC PATCH 9/9] block: genhd: export-GPL generic disk block class Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200409193543.18115-8-mathieu.desnoyers@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=prasad@linux.vnet.ibm.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).