summaryrefslogtreecommitdiffstats
path: root/super1.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-05-23 04:57:04 +0000
committerNeil Brown <neilb@suse.de>2006-05-23 04:57:04 +0000
commitc4f12c134069e191b08074b4ed7ba689d0827d11 (patch)
tree292b9970ee244976b9ba1218c0bd1314532611f9 /super1.c
parente5eac01f3d52ceb932445f90c0aaa86f244e26e7 (diff)
downloadmdadm-c4f12c134069e191b08074b4ed7ba689d0827d11.tar.gz
mdadm-c4f12c134069e191b08074b4ed7ba689d0827d11.tar.xz
mdadm-c4f12c134069e191b08074b4ed7ba689d0827d11.zip
Allow --update=name to update the name during assembly.
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/super1.c b/super1.c
index 533929a..2ccda5d 100644
--- a/super1.c
+++ b/super1.c
@@ -496,6 +496,19 @@ static int update_super1(struct mdinfo *info, void *sbv, char *update,
memcpy(bm->uuid, info->uuid, 16);
}
}
+ if (strcmp(update, "name") == 0) {
+ if (info->name[0] == 0)
+ sprintf(info->name, "%d", info->array.md_minor);
+ memset(sb->set_name, 0, sizeof(sb->set_name));
+ if (homehost &&
+ strchr(info->name, ':') == NULL &&
+ strlen(homehost)+1+strlen(info->name) < 32) {
+ strcpy(sb->set_name, homehost);
+ strcat(sb->set_name, ":");
+ strcat(sb->set_name, info->name);
+ } else
+ strcpy(sb->set_name, info->name);
+ }
if (strcmp(update, "_reshape_progress")==0)
sb->reshape_position = __cpu_to_le64(info->reshape_progress);