summaryrefslogtreecommitdiffstats
path: root/super1.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@novell.com>2007-05-08 09:17:33 +0200
committerNeil Brown <neilb@suse.de>2007-05-08 09:17:33 +0200
commit54bad3644f4ea8132a789e827d05d2e712b4f547 (patch)
tree2cc04f49d0b3ef104ee2741425e095cf5888d89b /super1.c
parentFix up calculation of bitmap space when creating v1 metadata. (diff)
downloadmdadm-54bad3644f4ea8132a789e827d05d2e712b4f547.tar.xz
mdadm-54bad3644f4ea8132a789e827d05d2e712b4f547.zip
Add --export option to --detail to use key=value pairs.
udev likes to get information about a device as key=value pairs so it can create disk/by-id links etc. So add --export flag which causes the output of --detail to easily parsable. From: Kay Sievers <kay.sievers@novell.com>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/super1.c b/super1.c
index effed54a..efe8a460 100644
--- a/super1.c
+++ b/super1.c
@@ -393,6 +393,28 @@ static void brief_detail_super1(void *sbv)
}
}
+static void export_super1(void *sbv)
+{
+ struct mdp_superblock_1 *sb = sbv;
+ int i;
+ int len = 32;
+
+ for (i=0; i<32; i++)
+ if (sb->set_name[i] == '\n' ||
+ sb->set_name[i] == '\0') {
+ len = i;
+ break;
+ }
+ if (len)
+ printf("MD_NAME=%.*s\n", len, sb->set_name);
+ printf("MD_UUID=");
+ for (i=0; i<16; i++) {
+ if ((i&3)==0 && i != 0) printf(":");
+ printf("%02x", sb->set_uuid[i]);
+ }
+ printf("\n");
+}
+
#endif
static int match_home1(void *sbv, char *homehost)
@@ -1300,6 +1322,7 @@ struct superswitch super1 = {
.brief_examine_super = brief_examine_super1,
.detail_super = detail_super1,
.brief_detail_super = brief_detail_super1,
+ .export_super = export_super1,
#endif
.match_home = match_home1,
.uuid_from_super = uuid_from_super1,