]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super1.c
Discard devnum in favour of devnm
[thirdparty/mdadm.git] / super1.c
index fe83af5b3d00619b04622e8eb82c19411f2d1d71..d0f1d5f089850751c4546d7278fe21a4499e7495 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -885,6 +885,21 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
        int rv = 0;
        struct mdp_superblock_1 *sb = st->sb;
 
+       if (strcmp(update, "homehost") == 0 &&
+           homehost) {
+               /* Note that 'homehost' is special as it is really
+                * a "name" update.
+                */
+               char *c;
+               update = "name";
+               c = strchr(sb->set_name, ':');
+               if (c)
+                       strncpy(info->name, c+1, 31 - (c-sb->set_name));
+               else
+                       strncpy(info->name, sb->set_name, 32);
+               info->name[32] = 0;
+       }
+
        if (strcmp(update, "force-one")==0) {
                /* Not enough devices for a working array,
                 * so bring this one up-to-date
@@ -1037,16 +1052,6 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
                        sb->bblog_shift = 0;
                        sb->bblog_offset = 0;
                }
-       } else if (strcmp(update, "homehost") == 0 &&
-                  homehost) {
-               char *c;
-               update = "name";
-               c = strchr(sb->set_name, ':');
-               if (c)
-                       strncpy(info->name, c+1, 31 - (c-sb->set_name));
-               else
-                       strncpy(info->name, sb->set_name, 32);
-               info->name[32] = 0;
        } else if (strcmp(update, "name") == 0) {
                if (info->name[0] == 0)
                        sprintf(info->name, "%d", info->array.md_minor);
@@ -1711,7 +1716,7 @@ static struct supertype *match_metadata_desc1(char *arg)
 {
        struct supertype *st = xcalloc(1, sizeof(*st));
 
-       st->container_dev = NoMdDev;
+       st->container_devnm[0] = 0;
        st->ss = &super1;
        st->max_devs = MAX_DEVS;
        st->sb = NULL;