summaryrefslogtreecommitdiffstats
path: root/super1.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2005-08-09 05:23:20 +0000
committerNeil Brown <neilb@suse.de>2005-08-09 05:23:20 +0000
commit947fd4ddb554fd2c3d81c190dfe63407f8771eb8 (patch)
tree10b16db86578ca184faabae4232a886d2cff1ddc /super1.c
parentdfd4d8ee426fb71a369f494f95fe95b114a33c7c (diff)
downloadmdadm-947fd4ddb554fd2c3d81c190dfe63407f8771eb8.tar.gz
mdadm-947fd4ddb554fd2c3d81c190dfe63407f8771eb8.tar.xz
mdadm-947fd4ddb554fd2c3d81c190dfe63407f8771eb8.zip
Support nameing of version-1 arrays.
--name is recognised in --create and --assemble name= is recognised in config file. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/super1.c b/super1.c
index f59eff0..e25d005 100644
--- a/super1.c
+++ b/super1.c
@@ -230,6 +230,8 @@ static void brief_examine_super1(void *sbv)
printf("%02x", sb->set_uuid[i]);
if ((i&3)==0 && i != 0) printf(":");
}
+ if (sb->set_name[0])
+ printf(" name=%.32s", sb->set_name);
printf("\n");
}
@@ -238,6 +240,7 @@ static void detail_super1(void *sbv)
struct mdp_superblock_1 *sb = sbv;
int i;
+ printf(" Name : %.32s\n", sb->set_name);
printf(" UUID : ");
for (i=0; i<16; i++) {
printf("%02x", sb->set_uuid[i]);
@@ -251,6 +254,8 @@ static void brief_detail_super1(void *sbv)
struct mdp_superblock_1 *sb = sbv;
int i;
+ if (sb->set_name[0])
+ printf(" name=%.32s", sb->set_name);
printf(" UUID=");
for (i=0; i<16; i++) {
printf("%02x", sb->set_uuid[i]);
@@ -269,7 +274,7 @@ static void uuid_from_super1(int uuid[4], void * sbv)
cuuid[i] = super->set_uuid[i];
}
-static void getinfo_super1(struct mdinfo *info, void *sbv)
+static void getinfo_super1(struct mdinfo *info, mddev_ident_t ident, void *sbv)
{
struct mdp_superblock_1 *sb = sbv;
int working = 0;
@@ -309,6 +314,9 @@ static void getinfo_super1(struct mdinfo *info, void *sbv)
memcpy(info->uuid, sb->set_uuid, 16);
+ strncpy(ident->name, sb->set_name, 32);
+ ident->name[32] = 0;
+
for (i=0; i< __le32_to_cpu(sb->max_dev); i++) {
role = __le16_to_cpu(sb->dev_roles[i]);
if (/*role == 0xFFFF || */role < info->array.raid_disks)
@@ -375,7 +383,7 @@ static __u64 event_super1(void *sbv)
return __le64_to_cpu(sb->events);
}
-static int init_super1(struct supertype *st, void **sbp, mdu_array_info_t *info)
+static int init_super1(struct supertype *st, void **sbp, mdu_array_info_t *info, char *name)
{
struct mdp_superblock_1 *sb = malloc(1024);
int spares;
@@ -402,7 +410,8 @@ static int init_super1(struct supertype *st, void **sbp, mdu_array_info_t *info)
*(__u32*)(sb->set_uuid+8) = random();
*(__u32*)(sb->set_uuid+12) = random();
- /* FIXME name */
+ memset(sb->set_name, 0, 32);
+ strcpy(sb->set_name, name);
sb->ctime = __cpu_to_le64((unsigned long long)time(0));
sb->level = __cpu_to_le32(info->level);