diff options
author | Kay Sievers <kay.sievers@novell.com> | 2007-05-08 09:17:33 +0200 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2007-05-08 09:17:33 +0200 |
commit | 54bad3644f4ea8132a789e827d05d2e712b4f547 (patch) | |
tree | 2cc04f49d0b3ef104ee2741425e095cf5888d89b /super1.c | |
parent | Fix up calculation of bitmap space when creating v1 metadata. (diff) | |
download | mdadm-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.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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, |