[PATCH 3/3] [RFC] fs: print preferred name in procfs messages

From: Nao Nishijima
Date: Wed Jun 15 2011 - 04:24:06 EST


Make disk_name() return preferred name instead of disk_name
when preferred name is set. disk_name() is used in
/proc/{partitions, diskstats}. Therefore, those files show
preferred name.

Suggested-by: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Nao Nishijima <nao.nishijima.xt@xxxxxxxxxxx>
---

fs/partitions/check.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index d545e97..4ffdcf4 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -125,11 +125,13 @@ static int (*check_part[])(struct parsed_partitions *) = {
char *disk_name(struct gendisk *hd, int partno, char *buf)
{
if (!partno)
- snprintf(buf, BDEVNAME_SIZE, "%s", hd->disk_name);
+ snprintf(buf, BDEVNAME_SIZE, "%s", dev_name(disk_to_dev(hd)));
else if (isdigit(hd->disk_name[strlen(hd->disk_name)-1]))
- snprintf(buf, BDEVNAME_SIZE, "%sp%d", hd->disk_name, partno);
+ snprintf(buf, BDEVNAME_SIZE, "%sp%d", dev_name(disk_to_dev(hd)),
+ partno);
else
- snprintf(buf, BDEVNAME_SIZE, "%s%d", hd->disk_name, partno);
+ snprintf(buf, BDEVNAME_SIZE, "%s%d", dev_name(disk_to_dev(hd)),
+ partno);

return buf;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/