[RFC PATCH 3/4] fs: modify disk_name() for alias name

From: Nao Nishijima
Date: Fri Jul 08 2011 - 04:47:13 EST


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

Signed-off-by: Nao Nishijima <nao.nishijima.xt@xxxxxxxxxxx>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx>
---

Documentation/ABI/testing/sysfs-block | 8 ++++----
fs/partitions/check.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-block b/Documentation/ABI/testing/sysfs-block
index 07c4fcd..432140c 100644
--- a/Documentation/ABI/testing/sysfs-block
+++ b/Documentation/ABI/testing/sysfs-block
@@ -217,7 +217,7 @@ Description:
instead of raw device name. However, kernel doesn't show those
persistent names on its message (e.g. dmesg).
This file can store an alias name of the disk and it would be
- appeared in kernel messages if it is set. A disk can have an
- alias name which length is up to 255bytes. Users can use
- use alphabets, numbers, "-" and "_" in alias name and can
- change it anytime.
+ appeared in kernel messages and procfs if it is set. A disk
+ can have an alias name which length is up to 255bytes. Users
+ can use use alphabets, numbers, "-" and "_" in alias name and
+ can change it anytime.
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index d545e97..d0bfe56 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -125,11 +125,11 @@ 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", alias_name(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", alias_name(hd), partno);
else
- snprintf(buf, BDEVNAME_SIZE, "%s%d", hd->disk_name, partno);
+ snprintf(buf, BDEVNAME_SIZE, "%s%d", alias_name(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/