Commit 2e493e2a authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Don't use devfs names in disk_name()

From: Christoph Hellwig <hch@lst.de>

disk_name() (and hence bdevname()) are now returning devfs-style device names
when devfs is enabled.

This is nice, but these names are very long, and they overflow the 32-char
buffers which these functions use.

The choices are:

a) Use a bigger buffer (increase BDEVNAME_SIZE).

   This might be practical.  But how big?

b) return the name in kmalloced memory, make caller free it up.   Yuk.

c) Add a print_bdevname() thing and intersperse that amongst the printk's.
   This would work.

d) Just print the non-devfs device name.   That's what this patch does.
parent 741698b7
......@@ -96,19 +96,6 @@ static int (*check_part[])(struct parsed_partitions *, struct block_device *) =
char *disk_name(struct gendisk *hd, int part, char *buf)
{
#ifdef CONFIG_DEVFS_FS
if (hd->devfs_name[0] != '\0') {
if (part)
snprintf(buf, BDEVNAME_SIZE, "%s/part%d",
hd->devfs_name, part);
else if (hd->minors != 1)
snprintf(buf, BDEVNAME_SIZE, "%s/disc", hd->devfs_name);
else
snprintf(buf, BDEVNAME_SIZE, "%s", hd->devfs_name);
return buf;
}
#endif
if (!part)
snprintf(buf, BDEVNAME_SIZE, "%s", hd->disk_name);
else if (isdigit(hd->disk_name[strlen(hd->disk_name)-1]))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment