]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Incremental.c
Add must_be_container helper.
[thirdparty/mdadm.git] / Incremental.c
index fe85c109b1e90b838693c784b7b3b86979f3c147..b7bf0b4f417d60c8736ab6a0ed10e2e7fb2a3309 100644 (file)
@@ -44,7 +44,7 @@ static int Incremental_container(struct supertype *st, char *devname,
                                 char *homehost,
                                 int verbose, int runstop, int autof);
 
-static struct mddev_ident_s *search_mdstat(struct supertype *st,
+static struct mddev_ident *search_mdstat(struct supertype *st,
                                           struct mdinfo *info,
                                           char *devname,
                                           int verbose, int *rvp);
@@ -92,7 +92,7 @@ int Incremental(char *devname, int verbose, int runstop,
         */
        struct stat stb;
        struct mdinfo info, dinfo;
-       struct mddev_ident_s *match;
+       struct mddev_ident *match;
        char chosen_name[1024];
        int rv = 1;
        struct map_ent *mp, *map = NULL;
@@ -103,7 +103,6 @@ int Incremental(char *devname, int verbose, int runstop,
        char *name_to_use;
        mdu_array_info_t ainf;
        struct dev_policy *policy = NULL;
-       unsigned long long size;
 
        struct createinfo *ci = conf_get_create_info();
 
@@ -127,9 +126,7 @@ int Incremental(char *devname, int verbose, int runstop,
                return rv;
        }
        /* If the device is a container, we do something very different */
-       if (get_dev_size(dfd, devname, &size) == 0)
-               goto out;
-       if (size == 0) {
+       if (must_be_container(dfd)) {
                if (!st)
                        st = super_by_fd(dfd, NULL);
                if (st)
@@ -558,12 +555,12 @@ out:
        return rv;
 }
 
-static struct mddev_ident_s *search_mdstat(struct supertype *st,
+static struct mddev_ident *search_mdstat(struct supertype *st,
                                           struct mdinfo *info,
                                           char *devname,
                                           int verbose, int *rvp)
 {
-       struct mddev_ident_s *array_list, *match;
+       struct mddev_ident *array_list, *match;
        array_list = conf_get_ident(NULL);
        match = NULL;
        for (; array_list; array_list = array_list->next) {
@@ -862,7 +859,7 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
                /* add current device to chosen array as a spare */
                int mdfd = open_dev(devname2devnum(chosen->sys_name));
                if (mdfd >= 0) {
-                       struct mddev_dev_s devlist;
+                       struct mddev_dev devlist;
                        char devname[20];
                        devlist.next = NULL;
                        devlist.used = 0;
@@ -1123,7 +1120,7 @@ int IncrementalScan(int verbose)
         */
        struct map_ent *mapl = NULL;
        struct map_ent *me;
-       mddev_ident_t devs, mddev;
+       struct mddev_ident *devs, *mddev;
        int rv = 0;
 
        map_read(&mapl);
@@ -1230,7 +1227,7 @@ static int Incremental_container(struct supertype *st, char *devname,
        struct map_ent *map = NULL;
        struct mdinfo info;
        int trustworthy;
-       struct mddev_ident_s *match;
+       struct mddev_ident *match;
        int rv = 0;
 
        memset(&info, 0, sizeof(info));
@@ -1268,7 +1265,7 @@ static int Incremental_container(struct supertype *st, char *devname,
                int mdfd;
                char chosen_name[1024];
                struct map_ent *mp;
-               struct mddev_ident_s *match = NULL;
+               struct mddev_ident *match = NULL;
 
                mp = map_by_uuid(&map, ra->uuid);
 
@@ -1284,7 +1281,7 @@ static int Incremental_container(struct supertype *st, char *devname,
                         * member == ra->text_version after second slash.
                         */
                        char *sub = strchr(ra->text_version+1, '/');
-                       struct mddev_ident_s *array_list;
+                       struct mddev_ident *array_list;
                        if (sub) {
                                sub++;
                                array_list = conf_get_ident(NULL);
@@ -1363,7 +1360,7 @@ int IncrementalRemove(char *devname, int verbose)
        int mdfd;
        int rv;
        struct mdstat_ent *ent;
-       struct mddev_dev_s devlist;
+       struct mddev_dev devlist;
 
        if (strchr(devname, '/')) {
                fprintf(stderr, Name ": incremental removal requires a "