diff options
author | Sebastian Parschauer <s.parschauer@gmx.de> | 2020-07-28 12:01:39 +0200 |
---|---|---|
committer | Song Liu <songliubraving@fb.com> | 2020-08-02 23:03:51 -0700 |
commit | ec164d07aa771370c7c24c1fa7f7692ad30f01cb (patch) | |
tree | 6187f353fe1098d7b40d8668387526b797949e58 /drivers/md/md.c | |
parent | d9c0fa509eafb31605bddda34e2e39f4354563b6 (diff) | |
download | lwn-ec164d07aa771370c7c24c1fa7f7692ad30f01cb.tar.gz lwn-ec164d07aa771370c7c24c1fa7f7692ad30f01cb.zip |
md: register new md sysfs file 'uuid' read-only
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 array.
And it is also easy for script to monitor it with the format.
Signed-off-by: Sebastian Parschauer <s.parschauer@gmx.de>
[Guoqing: mention the change in md.rst]
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | 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 5e8f772ab117..5116d29b74e1 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4253,6 +4253,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 && @@ -5508,6 +5516,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, |