lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200409193543.18115-8-mathieu.desnoyers@efficios.com>
Date:   Thu,  9 Apr 2020 15:35:41 -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 7/9] block: genhd: export-GPL gendisk_name

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@...icios.com>
Cc: Tejun Heo <tj@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Thomas Gleixner <tglx@...utronix.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ