linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] md: register new md sysfs file 'uuid' read-only
@ 2012-10-02 13:42 Sebastian Riemer
  2012-10-02 22:30 ` NeilBrown
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Riemer @ 2012-10-02 13:42 UTC (permalink / raw)
  To: linux-raid; +Cc: Sebastian Riemer

Report the UUID of the MD array in the following format:
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

This is useful if you don't want to wait for udev to
identify your MD array.

Signed-off-by: Sebastian Riemer <sebastian.riemer@profitbricks.com>
---
 drivers/md/md.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 308e87b..4e654d1 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3730,6 +3730,14 @@ static struct md_sysfs_entry md_raid_disks =
 __ATTR(raid_disks, S_IRUGO|S_IWUSR, raid_disks_show, raid_disks_store);
 
 static ssize_t
+uuid_show(struct mddev *mddev, char *page)
+{
+	return sprintf(page, "%pU\n", mddev->uuid);
+}
+static struct md_sysfs_entry md_uuid =
+__ATTR(uuid, S_IRUGO, uuid_show, NULL);
+
+static ssize_t
 chunk_size_show(struct mddev *mddev, char *page)
 {
 	if (mddev->reshape_position != MaxSector &&
@@ -4667,6 +4675,7 @@ static struct attribute *md_default_attrs[] = {
 	&md_level.attr,
 	&md_layout.attr,
 	&md_raid_disks.attr,
+	&md_uuid.attr,
 	&md_chunk_size.attr,
 	&md_size.attr,
 	&md_resync_start.attr,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-10-09  8:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-02 13:42 [PATCH] md: register new md sysfs file 'uuid' read-only Sebastian Riemer
2012-10-02 22:30 ` NeilBrown
2012-10-08 16:32   ` Sebastian Riemer
2012-10-08 17:50     ` Phil Turmel
2012-10-09  3:02     ` NeilBrown
2012-10-09  8:54       ` Sebastian Riemer

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).