]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Add 'supertype' arg to almost all metadata methods.
authorNeil Brown <neilb@suse.de>
Fri, 14 Dec 2007 09:14:16 +0000 (20:14 +1100)
committerNeil Brown <neilb@suse.de>
Fri, 14 Dec 2007 09:14:16 +0000 (20:14 +1100)
The 'superblock' will be moved into this structure soon.

13 files changed:
Assemble.c
Create.c
Detail.c
Examine.c
Grow.c
Incremental.c
Kill.c
Manage.c
Query.c
mdadm.h
super0.c
super1.c
util.c

index c30dfe99292c077659963073b644f70f9cddd9b7..7837b19bf4f2c61924eeacd3f58568cebffd1278 100644 (file)
@@ -251,7 +251,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                                fprintf( stderr, Name ": no RAID superblock on %s\n",
                                         devname);
                } else {
                                fprintf( stderr, Name ": no RAID superblock on %s\n",
                                         devname);
                } else {
-                       tst->ss->getinfo_super(&info, super);
+                       tst->ss->getinfo_super(tst, &info, super);
                }
                if (dfd >= 0) close(dfd);
 
                }
                if (dfd >= 0) close(dfd);
 
@@ -294,7 +294,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                        if (tst == NULL || super == NULL)
                                continue;
                        if (update == NULL &&
                        if (tst == NULL || super == NULL)
                                continue;
                        if (update == NULL &&
-                           tst->ss->match_home(super, homehost)==0) {
+                           tst->ss->match_home(tst, super, homehost)==0) {
                                if ((inargv && verbose >= 0) || verbose > 0)
                                        fprintf(stderr, Name ": %s is not built for host %s.\n",
                                                devname, homehost);
                                if ((inargv && verbose >= 0) || verbose > 0)
                                        fprintf(stderr, Name ": %s is not built for host %s.\n",
                                                devname, homehost);
@@ -314,7 +314,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                if (!super) {
                        fprintf(stderr, Name ": %s has no superblock - assembly aborted\n",
                                devname);
                if (!super) {
                        fprintf(stderr, Name ": %s has no superblock - assembly aborted\n",
                                devname);
-                       st->ss->free_super(first_super);
+                       st->ss->free_super(st, first_super);
                        return 1;
                }
 
                        return 1;
                }
 
@@ -331,8 +331,10 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                        if (mdfd < 0)
                                goto loop;
                        if (homehost) {
                        if (mdfd < 0)
                                goto loop;
                        if (homehost) {
-                               int first = st->ss->match_home(first_super, homehost);
-                               int last = tst->ss->match_home(super, homehost);
+                               int first = st->ss->match_home(st, first_super,
+                                                              homehost);
+                               int last = tst->ss->match_home(tst, super,
+                                                              homehost);
                                if (first+last == 1) {
                                        /* We can do something */
                                        if (first) {/* just ignore this one */
                                if (first+last == 1) {
                                        /* We can do something */
                                        if (first) {/* just ignore this one */
@@ -355,8 +357,8 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                        }
                        fprintf(stderr, Name ": superblock on %s doesn't match others - assembly aborted\n",
                                devname);
                        }
                        fprintf(stderr, Name ": superblock on %s doesn't match others - assembly aborted\n",
                                devname);
-                       tst->ss->free_super(super);
-                       st->ss->free_super(first_super);
+                       tst->ss->free_super(tst, super);
+                       st->ss->free_super(st, first_super);
                        return 1;
                }
 
                        return 1;
                }
 
@@ -364,7 +366,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
 
        loop:
                if (super)
 
        loop:
                if (super)
-                       tst->ss->free_super(super);
+                       tst->ss->free_super(tst, super);
                super = NULL;
        }
 
                super = NULL;
        }
 
@@ -378,7 +380,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                if (!first_super) {
                        return 2;
                }
                if (!first_super) {
                        return 2;
                }
-               st->ss->getinfo_super(&info, first_super);
+               st->ss->getinfo_super(st, &info, first_super);
                c = strchr(info.name, ':');
                if (c) c++; else c= info.name;
                if (isdigit(*c) && ((ident->autof & 7)==4 || (ident->autof&7)==6))
                c = strchr(info.name, ':');
                if (c) c++; else c= info.name;
                if (isdigit(*c) && ((ident->autof & 7)==4 || (ident->autof&7)==6))
@@ -388,7 +390,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                        asprintf(&mddev, "/dev/md/%s", c);
                mdfd = open_mddev(mddev, ident->autof);
                if (mdfd < 0) {
                        asprintf(&mddev, "/dev/md/%s", c);
                mdfd = open_mddev(mddev, ident->autof);
                if (mdfd < 0) {
-                       st->ss->free_super(first_super);
+                       st->ss->free_super(st, first_super);
                        free(devices);
                        first_super = NULL;
                        goto try_again;
                        free(devices);
                        first_super = NULL;
                        goto try_again;
@@ -405,7 +407,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                                        mddev, tmpdev->devname);
                        close(mdfd);
                        mdfd = -1;
                                        mddev, tmpdev->devname);
                        close(mdfd);
                        mdfd = -1;
-                       st->ss->free_super(first_super);
+                       st->ss->free_super(st, first_super);
                        free(devices);
                        first_super = NULL;
                        goto try_again;
                        free(devices);
                        first_super = NULL;
                        goto try_again;
@@ -443,13 +445,14 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                        remove_partitions(dfd);
 
                        st->ss->load_super(st, dfd, &super, NULL);
                        remove_partitions(dfd);
 
                        st->ss->load_super(st, dfd, &super, NULL);
-                       st->ss->getinfo_super(&info, super);
+                       st->ss->getinfo_super(st, &info, super);
 
                        memcpy(info.uuid, ident->uuid, 16);
                        strcpy(info.name, ident->name);
                        info.array.md_minor = minor(stb2.st_rdev);
 
 
                        memcpy(info.uuid, ident->uuid, 16);
                        strcpy(info.name, ident->name);
                        info.array.md_minor = minor(stb2.st_rdev);
 
-                       st->ss->update_super(&info, super, update, devname, verbose,
+                       st->ss->update_super(st, &info, super, update,
+                                            devname, verbose,
                                             ident->uuid_set, homehost);
                        if (strcmp(update, "uuid")==0 &&
                            !ident->uuid_set) {
                                             ident->uuid_set, homehost);
                        if (strcmp(update, "uuid")==0 &&
                            !ident->uuid_set) {
@@ -481,7 +484,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                        remove_partitions(dfd);
 
                        st->ss->load_super(st, dfd, &super, NULL);
                        remove_partitions(dfd);
 
                        st->ss->load_super(st, dfd, &super, NULL);
-                       st->ss->getinfo_super(&info, super);
+                       st->ss->getinfo_super(st, &info, super);
                        close(dfd);
                }
 
                        close(dfd);
                }
 
@@ -562,7 +565,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                devcnt++;
 
                if (super)
                devcnt++;
 
                if (super)
-                       st->ss->free_super(super);
+                       st->ss->free_super(st, super);
                super = NULL;
        }
 
                super = NULL;
        }
 
@@ -572,12 +575,12 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
        if (devcnt == 0) {
                fprintf(stderr, Name ": no devices found for %s\n",
                        mddev);
        if (devcnt == 0) {
                fprintf(stderr, Name ": no devices found for %s\n",
                        mddev);
-               st->ss->free_super(first_super);
+               st->ss->free_super(st, first_super);
                if (must_close) close(mdfd);
                return 1;
        }
 
                if (must_close) close(mdfd);
                return 1;
        }
 
-       st->ss->getinfo_super(&info, first_super);
+       st->ss->getinfo_super(st, &info, first_super);
        clean = info.array.state & 1;
 
        /* now we have some devices that might be suitable.
        clean = info.array.state & 1;
 
        /* now we have some devices that might be suitable.
@@ -655,7 +658,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                        continue;
                }
                info.events = devices[most_recent].events;
                        continue;
                }
                info.events = devices[most_recent].events;
-               st->ss->update_super(&info, super, "force-one",
+               st->ss->update_super(st, &info, super, "force-one",
                                     devices[chosen_drive].devname, verbose,
                                     0, NULL);
 
                                     devices[chosen_drive].devname, verbose,
                                     0, NULL);
 
@@ -664,7 +667,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                        fprintf(stderr, Name ": Could not re-write superblock on %s\n",
                                devices[chosen_drive].devname);
                        devices[chosen_drive].events = 0;
                        fprintf(stderr, Name ": Could not re-write superblock on %s\n",
                                devices[chosen_drive].devname);
                        devices[chosen_drive].events = 0;
-                       st->ss->free_super(super);
+                       st->ss->free_super(st, super);
                        continue;
                }
                close(fd);
                        continue;
                }
                close(fd);
@@ -672,7 +675,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                devices[chosen_drive].uptodate = 1;
                avail[chosen_drive] = 1;
                okcnt++;
                devices[chosen_drive].uptodate = 1;
                avail[chosen_drive] = 1;
                okcnt++;
-               st->ss->free_super(super);
+               st->ss->free_super(st, super);
 
                /* If there are any other drives of the same vintage,
                 * add them in as well.  We can't lose and we might gain
 
                /* If there are any other drives of the same vintage,
                 * add them in as well.  We can't lose and we might gain
@@ -726,7 +729,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                if (must_close) close(mdfd);
                return 1;
        }
                if (must_close) close(mdfd);
                return 1;
        }
-       st->ss->getinfo_super(&info, super);
+       st->ss->getinfo_super(st, &info, super);
        for (i=0; i<bestcnt; i++) {
                int j = best[i];
                unsigned int desired_state;
        for (i=0; i<bestcnt; i++) {
                int j = best[i];
                unsigned int desired_state;
@@ -745,7 +748,8 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                info.disk.state = desired_state;
 
                if (devices[j].uptodate &&
                info.disk.state = desired_state;
 
                if (devices[j].uptodate &&
-                   st->ss->update_super(&info, super, "assemble", NULL, verbose, 0, NULL)) {
+                   st->ss->update_super(st, &info, super, "assemble", NULL,
+                                        verbose, 0, NULL)) {
                        if (force) {
                                if (verbose >= 0)
                                        fprintf(stderr, Name ": "
                        if (force) {
                                if (verbose >= 0)
                                        fprintf(stderr, Name ": "
@@ -771,7 +775,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
            !enough(info.array.level, info.array.raid_disks,
                    info.array.layout, clean,
                    avail, okcnt)) {
            !enough(info.array.level, info.array.raid_disks,
                    info.array.layout, clean,
                    avail, okcnt)) {
-               change += st->ss->update_super(&info, super, "force-array",
+               change += st->ss->update_super(st, &info, super, "force-array",
                                        devices[chosen_drive].devname, verbose,
                                               0, NULL);
                clean = 1;
                                        devices[chosen_drive].devname, verbose,
                                               0, NULL);
                clean = 1;
index 8f554fad64001f446901f6840136a0864be2761e..77aaf8e6ae67e13164d213a6f0afa2eaff278141 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -478,7 +478,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
        if (bitmap_file) {
                int uuid[4];
 
        if (bitmap_file) {
                int uuid[4];
 
-               st->ss->uuid_from_super(uuid, super);
+               st->ss->uuid_from_super(st, uuid, super);
                if (CreateBitmap(bitmap_file, force, (char*)uuid, bitmap_chunk,
                                 delay, write_behind,
                                 bitmapsize,
                if (CreateBitmap(bitmap_file, force, (char*)uuid, bitmap_chunk,
                                 delay, write_behind,
                                 bitmapsize,
@@ -542,7 +542,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
                        }
                        switch(pass){
                        case 1:
                        }
                        switch(pass){
                        case 1:
-                               st->ss->add_to_super(super, &disk);
+                               st->ss->add_to_super(st, super, &disk);
                                break;
                        case 2:
                                if (disk.state == 1) break;
                                break;
                        case 2:
                                if (disk.state == 1) break;
@@ -553,7 +553,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
                                if (ioctl(mdfd, ADD_NEW_DISK, &disk)) {
                                        fprintf(stderr, Name ": ADD_NEW_DISK for %s failed: %s\n",
                                                dv->devname, strerror(errno));
                                if (ioctl(mdfd, ADD_NEW_DISK, &disk)) {
                                        fprintf(stderr, Name ": ADD_NEW_DISK for %s failed: %s\n",
                                                dv->devname, strerror(errno));
-                                       st->ss->free_super(super);
+                                       st->ss->free_super(st, super);
                                        return 1;
                                }
 
                                        return 1;
                                }
 
@@ -562,7 +562,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
                        if (dv == moved_disk && dnum != insert_point) break;
                }
        }
                        if (dv == moved_disk && dnum != insert_point) break;
                }
        }
-       st->ss->free_super(super);
+       st->ss->free_super(st, super);
 
        /* param is not actually used */
        if (runstop == 1 || subdevs >= raiddisks) {
 
        /* param is not actually used */
        if (runstop == 1 || subdevs >= raiddisks) {
index a57960383654845cf1c9a76a9a9c8c52b9cdec99..cebba6ee61c688a73cbcae459fc2c07fe3438e8f 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -116,10 +116,10 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
                                int fd2 = dev_open(dv, O_RDONLY);
                                if (fd2 >=0 && st &&
                                    st->ss->load_super(st, fd2, &super, NULL) == 0) {
                                int fd2 = dev_open(dv, O_RDONLY);
                                if (fd2 >=0 && st &&
                                    st->ss->load_super(st, fd2, &super, NULL) == 0) {
-                                       st->ss->getinfo_super(&info, super);
+                                       st->ss->getinfo_super(st, &info, super);
                                        if (info.array.ctime != array.ctime ||
                                            info.array.level != array.level) {
                                        if (info.array.ctime != array.ctime ||
                                            info.array.level != array.level) {
-                                               st->ss->free_super(super);
+                                               st->ss->free_super(st, super);
                                                super = NULL;
                                        }
                                }
                                                super = NULL;
                                        }
                                }
@@ -138,7 +138,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
                printf("MD_METADATA=%d.%d\n", array.major_version,
                       array.minor_version);
                if (super)
                printf("MD_METADATA=%d.%d\n", array.major_version,
                       array.minor_version);
                if (super)
-                       st->ss->export_super(super);
+                       st->ss->export_super(st, super);
                goto out;
        }
 
                goto out;
        }
 
@@ -278,7 +278,7 @@ This is pretty boring
                } else if (e && e->percent >= 0)
                        printf("\n");
                if (super && st)
                } else if (e && e->percent >= 0)
                        printf("\n");
                if (super && st)
-                       st->ss->detail_super(super, homehost);
+                       st->ss->detail_super(st, super, homehost);
 
                printf("    Number   Major   Minor   RaidDevice State\n");
        }
 
                printf("    Number   Major   Minor   RaidDevice State\n");
        }
@@ -377,9 +377,9 @@ This is pretty boring
        }
        if (spares && brief) printf(" spares=%d", spares);
        if (super && brief && st)
        }
        if (spares && brief) printf(" spares=%d", spares);
        if (super && brief && st)
-               st->ss->brief_detail_super(super);
+               st->ss->brief_detail_super(st, super);
        if (super)
        if (super)
-               st->ss->free_super(super);
+               st->ss->free_super(st, super);
 
        if (brief > 1 && devices) printf("\n   devices=%s", devices);
        if (brief) printf("\n");
 
        if (brief > 1 && devices) printf("\n   devices=%s", devices);
        if (brief) printf("\n");
index b4dc963a46d43d29648df030be19a47b6743547c..b5316b9169149c48d47fb9516925f0dfa67869c8 100644 (file)
--- a/Examine.c
+++ b/Examine.c
@@ -99,13 +99,15 @@ int Examine(mddev_dev_t devlist, int brief, int scan,
                        continue;
 
                if (SparcAdjust)
                        continue;
 
                if (SparcAdjust)
-                       st->ss->update_super(NULL, super, "sparc2.2", devlist->devname, 0, 0, NULL);
+                       st->ss->update_super(st, NULL, super, "sparc2.2",
+                                            devlist->devname, 0, 0, NULL);
                /* Ok, its good enough to try, though the checksum could be wrong */
                if (brief) {
                        struct array *ap;
                        char *d;
                        for (ap=arrays; ap; ap=ap->next) {
                /* Ok, its good enough to try, though the checksum could be wrong */
                if (brief) {
                        struct array *ap;
                        char *d;
                        for (ap=arrays; ap; ap=ap->next) {
-                               if (st->ss == ap->st->ss && st->ss->compare_super(&ap->super, super)==0)
+                               if (st->ss == ap->st->ss &&
+                                   st->ss->compare_super(&ap->super, super)==0)
                                        break;
                        }
                        if (!ap) {
                                        break;
                        }
                        if (!ap) {
@@ -116,10 +118,10 @@ int Examine(mddev_dev_t devlist, int brief, int scan,
                                ap->spares = 0;
                                ap->st = st;
                                arrays = ap;
                                ap->spares = 0;
                                ap->st = st;
                                arrays = ap;
-                               st->ss->getinfo_super(&ap->info, super);
+                               st->ss->getinfo_super(st, &ap->info, super);
                        } else {
                        } else {
-                               st->ss->getinfo_super(&ap->info, super);
-                               st->ss->free_super(super);
+                               st->ss->getinfo_super(st, &ap->info, super);
+                               st->ss->free_super(st, super);
                        }
                        if (!(ap->info.disk.state & MD_DISK_SYNC))
                                ap->spares++;
                        }
                        if (!(ap->info.disk.state & MD_DISK_SYNC))
                                ap->spares++;
@@ -127,8 +129,8 @@ int Examine(mddev_dev_t devlist, int brief, int scan,
                        dl_add(ap->devs, d);
                } else {
                        printf("%s:\n",devlist->devname);
                        dl_add(ap->devs, d);
                } else {
                        printf("%s:\n",devlist->devname);
-                       st->ss->examine_super(super, homehost);
-                       st->ss->free_super(super);
+                       st->ss->examine_super(st, super, homehost);
+                       st->ss->free_super(st, super);
                }
        }
        if (brief) {
                }
        }
        if (brief) {
@@ -136,7 +138,7 @@ int Examine(mddev_dev_t devlist, int brief, int scan,
                for (ap=arrays; ap; ap=ap->next) {
                        char sep='=';
                        char *d;
                for (ap=arrays; ap; ap=ap->next) {
                        char sep='=';
                        char *d;
-                       ap->st->ss->brief_examine_super(ap->super);
+                       ap->st->ss->brief_examine_super(ap->st, ap->super);
                        if (ap->spares) printf("   spares=%d", ap->spares);
                        if (brief > 1) {
                                printf("   devices");
                        if (ap->spares) printf("   spares=%d", ap->spares);
                        if (brief > 1) {
                                printf("   devices");
@@ -145,7 +147,7 @@ int Examine(mddev_dev_t devlist, int brief, int scan,
                                        sep=',';
                                }
                        }
                                        sep=',';
                                }
                        }
-                       ap->st->ss->free_super(ap->super);
+                       ap->st->ss->free_super(ap->st, ap->super);
                        /* FIXME free ap */
                        if (ap->spares || brief > 1)
                                printf("\n");
                        /* FIXME free ap */
                        if (ap->spares || brief > 1)
                                printf("\n");
diff --git a/Grow.c b/Grow.c
index 793e5515995c49cea14b423703069d5334d792c1..0aa7287b6e15a79eb401068448e107f9314e4746 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -104,7 +104,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
                        return 1;
                }
                if (super)
                        return 1;
                }
                if (super)
-                       st->ss->free_super(super);
+                       st->ss->free_super(st, super);
                super= NULL;
                if (st->ss->load_super(st, fd2, &super, NULL)) {
                        fprintf(stderr, Name ": cannot find super block on %s\n", dv);
                super= NULL;
                if (st->ss->load_super(st, fd2, &super, NULL)) {
                        fprintf(stderr, Name ": cannot find super block on %s\n", dv);
@@ -122,7 +122,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
        info.disk.minor = minor(stb.st_rdev);
        info.disk.raid_disk = d;
        info.disk.state = (1 << MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE);
        info.disk.minor = minor(stb.st_rdev);
        info.disk.raid_disk = d;
        info.disk.state = (1 << MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE);
-       st->ss->update_super(&info, super, "linear-grow-new", newdev,
+       st->ss->update_super(st, &info, super, "linear-grow-new", newdev,
                             0, 0, NULL);
 
        if (st->ss->store_super(st, nfd, super)) {
                             0, 0, NULL);
 
        if (st->ss->store_super(st, nfd, super)) {
@@ -178,7 +178,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
                info.array.active_disks = nd+1;
                info.array.working_disks = nd+1;
 
                info.array.active_disks = nd+1;
                info.array.working_disks = nd+1;
 
-               st->ss->update_super(&info, super, "linear-grow-update", dv,
+               st->ss->update_super(st, &info, super, "linear-grow-update", dv,
                                     0, 0, NULL);
 
                if (st->ss->store_super(st, fd2, super)) {
                                     0, 0, NULL);
 
                if (st->ss->store_super(st, fd2, super)) {
@@ -352,7 +352,7 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int
                        if (fd2 >= 0 &&
                            st->ss->load_super(st, fd2, &super, NULL) == 0) {
                                close(fd2);
                        if (fd2 >= 0 &&
                            st->ss->load_super(st, fd2, &super, NULL) == 0) {
                                close(fd2);
-                               st->ss->uuid_from_super(uuid, super);
+                               st->ss->uuid_from_super(st, uuid, super);
                                break;
                        }
                        close(fd2);
                                break;
                        }
                        close(fd2);
@@ -712,7 +712,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
 
 
                memcpy(bsb.magic, "md_backup_data-1", 16);
 
 
                memcpy(bsb.magic, "md_backup_data-1", 16);
-               st->ss->uuid_from_super((int*)&bsb.set_uuid, super);
+               st->ss->uuid_from_super(st, (int*)&bsb.set_uuid, super);
                bsb.mtime = __cpu_to_le64(time(0));
                bsb.arraystart = 0;
                bsb.length = __cpu_to_le64(last_block);
                bsb.mtime = __cpu_to_le64(time(0));
                bsb.arraystart = 0;
                bsb.length = __cpu_to_le64(last_block);
@@ -906,8 +906,8 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
                        if (st->ss->load_super(st, fd, &super, NULL))
                                continue;
 
                        if (st->ss->load_super(st, fd, &super, NULL))
                                continue;
 
-                       st->ss->getinfo_super(&dinfo, super);
-                       st->ss->free_super(super);
+                       st->ss->getinfo_super(st, &dinfo, super);
+                       st->ss->free_super(st, super);
                        super = NULL;
                        if (lseek64(fd,
                                    (dinfo.data_offset + dinfo.component_size - 8) <<9,
                        super = NULL;
                        if (lseek64(fd,
                                    (dinfo.data_offset + dinfo.component_size - 8) <<9,
@@ -949,8 +949,8 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
                        if (st->ss->load_super(st, fdlist[j], &super, NULL))
                                /* FIXME should be this be an error */
                                continue;
                        if (st->ss->load_super(st, fdlist[j], &super, NULL))
                                /* FIXME should be this be an error */
                                continue;
-                       st->ss->getinfo_super(&dinfo, super);
-                       st->ss->free_super(super);
+                       st->ss->getinfo_super(st, &dinfo, super);
+                       st->ss->free_super(st, super);
                        super = NULL;
                        offsets[j] = dinfo.data_offset;
                }
                        super = NULL;
                        offsets[j] = dinfo.data_offset;
                }
@@ -973,11 +973,13 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
                        if (fdlist[j] < 0) continue;
                        if (st->ss->load_super(st, fdlist[j], &super, NULL))
                                continue;
                        if (fdlist[j] < 0) continue;
                        if (st->ss->load_super(st, fdlist[j], &super, NULL))
                                continue;
-                       st->ss->getinfo_super(&dinfo, super);
+                       st->ss->getinfo_super(st, &dinfo, super);
                        dinfo.reshape_progress = __le64_to_cpu(bsb.length);
                        dinfo.reshape_progress = __le64_to_cpu(bsb.length);
-                       st->ss->update_super(&dinfo, super, "_reshape_progress",NULL,0, 0, NULL);
+                       st->ss->update_super(st, &dinfo, super,
+                                            "_reshape_progress",
+                                            NULL,0, 0, NULL);
                        st->ss->store_super(st, fdlist[j], super);
                        st->ss->store_super(st, fdlist[j], super);
-                       st->ss->free_super(super);
+                       st->ss->free_super(st, super);
                }
 
                /* And we are done! */
                }
 
                /* And we are done! */
index 94ef47d527b27ac214f208e8551c28bffce4a759..fdd8fb40e64fa2818c068d1d8026bd17d797b26a 100644 (file)
@@ -141,7 +141,7 @@ int Incremental(char *devname, int verbose, int runstop,
                close(dfd);
                return 1;
        }
                close(dfd);
                return 1;
        }
-       st->ss->getinfo_super(&info, super);
+       st->ss->getinfo_super(st, &info, super);
        close (dfd);
 
        /* 3/ Check if there is a match in mdadm.conf */
        close (dfd);
 
        /* 3/ Check if there is a match in mdadm.conf */
@@ -207,7 +207,7 @@ int Incremental(char *devname, int verbose, int runstop,
        /* 3a/ if not, check for homehost match.  If no match, reject. */
        if (!match) {
                if (homehost == NULL ||
        /* 3a/ if not, check for homehost match.  If no match, reject. */
        if (!match) {
                if (homehost == NULL ||
-                   st->ss->match_home(super, homehost) == 0) {
+                   st->ss->match_home(st, super, homehost) == 0) {
                        if (verbose >= 0)
                                fprintf(stderr, Name
              ": not found in mdadm.conf and not identified by homehost.\n");
                        if (verbose >= 0)
                                fprintf(stderr, Name
              ": not found in mdadm.conf and not identified by homehost.\n");
@@ -354,7 +354,7 @@ int Incremental(char *devname, int verbose, int runstop,
                        return 2;
                }
                close(dfd2);
                        return 2;
                }
                close(dfd2);
-               st->ss->getinfo_super(&info2, super2);
+               st->ss->getinfo_super(st, &info2, super2);
                if (info.array.level != info2.array.level ||
                    memcmp(info.uuid, info2.uuid, 16) != 0 ||
                    info.array.raid_disks != info2.array.raid_disks) {
                if (info.array.level != info2.array.level ||
                    memcmp(info.uuid, info2.uuid, 16) != 0 ||
                    info.array.raid_disks != info2.array.raid_disks) {
@@ -501,8 +501,8 @@ static void find_reject(int mdfd, struct supertype *st, struct sysarray *sra,
                        close(dfd);
                        continue;
                }
                        close(dfd);
                        continue;
                }
-               st->ss->getinfo_super(&info, super);
-               st->ss->free_super(super);
+               st->ss->getinfo_super(st, &info, super);
+               st->ss->free_super(st, super);
                close(dfd);
 
                if (info.disk.number != number ||
                close(dfd);
 
                if (info.disk.number != number ||
@@ -545,7 +545,7 @@ static int count_active(struct supertype *st, int mdfd, char **availp,
                close(dfd);
                if (ok != 0)
                        continue;
                close(dfd);
                if (ok != 0)
                        continue;
-               st->ss->getinfo_super(&info, super);
+               st->ss->getinfo_super(st, &info, super);
                if (info.disk.state & (1<<MD_DISK_SYNC))
                {
                        if (avail == NULL) {
                if (info.disk.state & (1<<MD_DISK_SYNC))
                {
                        if (avail == NULL) {
@@ -574,24 +574,24 @@ static int count_active(struct supertype *st, int mdfd, char **availp,
                                        if (avail[i])
                                                avail[i]--;
                                avail[info.disk.raid_disk] = 2;
                                        if (avail[i])
                                                avail[i]--;
                                avail[info.disk.raid_disk] = 2;
-                               st->ss->free_super(best_super);
+                               st->ss->free_super(st, best_super);
                                best_super = super;
                                super = NULL;
                        } else { /* info.events much bigger */
                                cnt = 1; cnt1 = 0;
                                memset(avail, 0, info.disk.raid_disk);
                                max_events = info.events;
                                best_super = super;
                                super = NULL;
                        } else { /* info.events much bigger */
                                cnt = 1; cnt1 = 0;
                                memset(avail, 0, info.disk.raid_disk);
                                max_events = info.events;
-                               st->ss->free_super(best_super);
+                               st->ss->free_super(st, best_super);
                                best_super = super;
                                super = NULL;
                        }
                }
                if (super)
                                best_super = super;
                                super = NULL;
                        }
                }
                if (super)
-                       st->ss->free_super(super);
+                       st->ss->free_super(st, super);
        }
        if (best_super) {
        }
        if (best_super) {
-               st->ss->getinfo_super(bestinfo,best_super);
-               st->ss->free_super(best_super);
+               st->ss->getinfo_super(st, bestinfo,best_super);
+               st->ss->free_super(st, best_super);
        }
        return cnt + cnt1;
 }
        }
        return cnt + cnt1;
 }
@@ -628,7 +628,7 @@ void RebuildMap(void)
                        close(dfd);
                        if (ok != 0)
                                continue;
                        close(dfd);
                        if (ok != 0)
                                continue;
-                       st->ss->getinfo_super(&info, super);
+                       st->ss->getinfo_super(st, &info, super);
                        if (md->devnum > 0)
                                path = map_dev(MD_MAJOR, md->devnum, 0);
                        else
                        if (md->devnum > 0)
                                path = map_dev(MD_MAJOR, md->devnum, 0);
                        else
@@ -636,7 +636,7 @@ void RebuildMap(void)
                        map_add(&map, md->devnum, st->ss->major,
                                st->minor_version,
                                info.uuid, path ? : "/unknown");
                        map_add(&map, md->devnum, st->ss->major,
                                st->minor_version,
                                info.uuid, path ? : "/unknown");
-                       st->ss->free_super(super);
+                       st->ss->free_super(st, super);
                        break;
                }
        }
                        break;
                }
        }
diff --git a/Kill.c b/Kill.c
index c13dba7e81ba68798a743c37040b73a9e3e20e1f..d7e52f5030205af64379770ae93c131b9e87b234 100644 (file)
--- a/Kill.c
+++ b/Kill.c
@@ -66,7 +66,7 @@ int Kill(char *dev, int force, int quiet)
        if (rv== 0 || (force && rv >= 2)) {
                mdu_array_info_t info;
                info.major_version = -1; /* zero superblock */
        if (rv== 0 || (force && rv >= 2)) {
                mdu_array_info_t info;
                info.major_version = -1; /* zero superblock */
-               st->ss->free_super(super);
+               st->ss->free_super(st, super);
                st->ss->init_super(st, &super, &info, 0, "", NULL, NULL);
                if (st->ss->store_super(st, fd, super)) {
                        if (!quiet)
                st->ss->init_super(st, &super, &info, 0, "", NULL, NULL);
                if (st->ss->store_super(st, fd, super)) {
                        if (!quiet)
index af87f79edeb36624612aafa7fbbb5f8de73e2c8b..5219e6eb8760ec2b287f10f3d6567297bbe72838 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -373,7 +373,7 @@ int Manage_subdevs(char *devname, int fd,
                                 * and was temporarily removed, and is now being re-added.
                                 * If so, we can simply re-add it.
                                 */
                                 * and was temporarily removed, and is now being re-added.
                                 * If so, we can simply re-add it.
                                 */
-                               st->ss->uuid_from_super(duuid, dsuper);
+                               st->ss->uuid_from_super(st, duuid, dsuper);
 
                                /* re-add doesn't work for version-1 superblocks
                                 * before 2.6.18 :-(
 
                                /* re-add doesn't work for version-1 superblocks
                                 * before 2.6.18 :-(
@@ -382,14 +382,14 @@ int Manage_subdevs(char *devname, int fd,
                                    get_linux_version() <= 2006018)
                                        ;
                                else if (osuper) {
                                    get_linux_version() <= 2006018)
                                        ;
                                else if (osuper) {
-                                       st->ss->uuid_from_super(ouuid, osuper);
+                                       st->ss->uuid_from_super(st, ouuid, osuper);
                                        if (memcmp(duuid, ouuid, sizeof(ouuid))==0) {
                                                /* looks close enough for now.  Kernel
                                                 * will worry about whether a bitmap
                                                 * based reconstruction is possible.
                                                 */
                                                struct mdinfo mdi;
                                        if (memcmp(duuid, ouuid, sizeof(ouuid))==0) {
                                                /* looks close enough for now.  Kernel
                                                 * will worry about whether a bitmap
                                                 * based reconstruction is possible.
                                                 */
                                                struct mdinfo mdi;
-                                               st->ss->getinfo_super(&mdi, osuper);
+                                               st->ss->getinfo_super(st, &mdi, osuper);
                                                disc.major = major(stb.st_rdev);
                                                disc.minor = minor(stb.st_rdev);
                                                disc.number = mdi.disk.number;
                                                disc.major = major(stb.st_rdev);
                                                disc.minor = minor(stb.st_rdev);
                                                disc.number = mdi.disk.number;
@@ -436,7 +436,7 @@ int Manage_subdevs(char *devname, int fd,
                        if (array.not_persistent==0) {
                                if (dv->writemostly)
                                        disc.state |= 1 << MD_DISK_WRITEMOSTLY;
                        if (array.not_persistent==0) {
                                if (dv->writemostly)
                                        disc.state |= 1 << MD_DISK_WRITEMOSTLY;
-                               st->ss->add_to_super(dsuper, &disc);
+                               st->ss->add_to_super(st, dsuper, &disc);
                                if (st->ss->write_init_super(st, dsuper, &disc, dv->devname))
                                        return 1;
                        } else if (dv->re_add) {
                                if (st->ss->write_init_super(st, dsuper, &disc, dv->devname))
                                        return 1;
                        } else if (dv->re_add) {
diff --git a/Query.c b/Query.c
index e1743ef3685e7d79233b71b4315dd2ccfdbf1fa2..19b2ce5e621c226445003cb5ec631b6b0371142b 100644 (file)
--- a/Query.c
+++ b/Query.c
@@ -96,7 +96,7 @@ int Query(char *dev)
        close(fd);
        if (superror == 0) {
                /* array might be active... */
        close(fd);
        if (superror == 0) {
                /* array might be active... */
-               st->ss->getinfo_super(&info, super);
+               st->ss->getinfo_super(st, &info, super);
                if (st->ss->major == 0) {
                        mddev = get_md_name(info.array.md_minor);
                        disc.number = info.disk.number;
                if (st->ss->major == 0) {
                        mddev = get_md_name(info.array.md_minor);
                        disc.number = info.disk.number;
diff --git a/mdadm.h b/mdadm.h
index de71b55a0b67d841d6a3e827915539cbdcfbe30b..bf583b41e9ce347fa4d54b0c7be1fbe4847345ec 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -341,19 +341,20 @@ extern char *map_dev(int major, int minor, int create);
 
 
 extern struct superswitch {
 
 
 extern struct superswitch {
-       void (*examine_super)(void *sbv, char *homehost);
-       void (*brief_examine_super)(void *sbv);
-       void (*detail_super)(void *sbv, char *homehost);
-       void (*export_super)(void *sbv);
-       void (*brief_detail_super)(void *sbv);
-       void (*uuid_from_super)(int uuid[4], void *sbv);
-       void (*getinfo_super)(struct mdinfo *info, void *sbv);
-       int (*match_home)(void *sbv, char *homehost);
-       int (*update_super)(struct mdinfo *info, void *sbv, char *update,
+       void (*examine_super)(struct supertype *st, void *sbv, char *homehost);
+       void (*brief_examine_super)(struct supertype *st, void *sbv);
+       void (*detail_super)(struct supertype *st, void *sbv, char *homehost);
+       void (*export_super)(struct supertype *st, void *sbv);
+       void (*brief_detail_super)(struct supertype *st, void *sbv);
+       void (*uuid_from_super)(struct supertype *st, int uuid[4], void *sbv);
+       void (*getinfo_super)(struct supertype *st, struct mdinfo *info, void *sbv);
+       int (*match_home)(struct supertype *st, void *sbv, char *homehost);
+       int (*update_super)(struct supertype *st, struct mdinfo *info,
+                           void *sbv, char *update,
                            char *devname, int verbose,
                            int uuid_set, char *homehost);
        int (*init_super)(struct supertype *st, void **sbp, mdu_array_info_t *info, unsigned long long size, char *name, char *homehost, int *uuid);
                            char *devname, int verbose,
                            int uuid_set, char *homehost);
        int (*init_super)(struct supertype *st, void **sbp, mdu_array_info_t *info, unsigned long long size, char *name, char *homehost, int *uuid);
-       void (*add_to_super)(void *sbv, mdu_disk_info_t *dinfo);
+       void (*add_to_super)(struct supertype *st, void *sbv, mdu_disk_info_t *dinfo);
        int (*store_super)(struct supertype *st, int fd, void *sbv);
        int (*write_init_super)(struct supertype *st, void *sbv, mdu_disk_info_t *dinfo, char *devname);
        int (*compare_super)(void **firstp, void *secondv);
        int (*store_super)(struct supertype *st, int fd, void *sbv);
        int (*write_init_super)(struct supertype *st, void *sbv, mdu_disk_info_t *dinfo, char *devname);
        int (*compare_super)(void **firstp, void *secondv);
@@ -365,7 +366,7 @@ extern struct superswitch {
                                   unsigned long long size, int may_change, int major);
        void (*locate_bitmap)(struct supertype *st, int fd, void *sbv);
        int (*write_bitmap)(struct supertype *st, int fd, void *sbv);
                                   unsigned long long size, int may_change, int major);
        void (*locate_bitmap)(struct supertype *st, int fd, void *sbv);
        int (*write_bitmap)(struct supertype *st, int fd, void *sbv);
-       void (*free_super)(void *super);
+       void (*free_super)(struct supertype *st, void *super);
        int major;
        int swapuuid; /* true if uuid is bigending rather than hostendian */
 } super0, super1, *superlist[];
        int major;
        int swapuuid; /* true if uuid is bigending rather than hostendian */
 } super0, super1, *superlist[];
index 9a7eb15e268b8fe1f91ff63b52cab69f9b8fe6ab..b81037ed67a08a5dcc0359ea93adcaa3ed1c9c3d 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -85,7 +85,7 @@ void super0_swap_endian(struct mdp_superblock_s *sb)
 
 #ifndef MDASSEMBLE
 
 
 #ifndef MDASSEMBLE
 
-static void examine_super0(void *sbv, char *homehost)
+static void examine_super0(struct supertype *st, void *sbv, char *homehost)
 {
        mdp_super_t *sb = sbv;
        time_t atime;
 {
        mdp_super_t *sb = sbv;
        time_t atime;
@@ -231,7 +231,7 @@ static void examine_super0(void *sbv, char *homehost)
        }
 }
 
        }
 }
 
-static void brief_examine_super0(void *sbv)
+static void brief_examine_super0(struct supertype *st, void *sbv)
 {
        mdp_super_t *sb = sbv;
        char *c=map_num(pers, sb->level);
 {
        mdp_super_t *sb = sbv;
        char *c=map_num(pers, sb->level);
@@ -250,7 +250,7 @@ static void brief_examine_super0(void *sbv)
        printf("\n");
 }
 
        printf("\n");
 }
 
-static void detail_super0(void *sbv, char *homehost)
+static void detail_super0(struct supertype *st, void *sbv, char *homehost)
 {
        mdp_super_t *sb = sbv;
        printf("           UUID : ");
 {
        mdp_super_t *sb = sbv;
        printf("           UUID : ");
@@ -270,7 +270,7 @@ static void detail_super0(void *sbv, char *homehost)
        printf("\n         Events : %d.%d\n\n", sb->events_hi, sb->events_lo);
 }
 
        printf("\n         Events : %d.%d\n\n", sb->events_hi, sb->events_lo);
 }
 
-static void brief_detail_super0(void *sbv)
+static void brief_detail_super0(struct supertype *st, void *sbv)
 {
        mdp_super_t *sb = sbv;
        printf(" UUID=");
 {
        mdp_super_t *sb = sbv;
        printf(" UUID=");
@@ -281,7 +281,7 @@ static void brief_detail_super0(void *sbv)
                printf("%08x", sb->set_uuid0);
 }
 
                printf("%08x", sb->set_uuid0);
 }
 
-static void export_super0(void *sbv)
+static void export_super0(struct supertype *st, void *sbv)
 {
        mdp_super_t *sb = sbv;
        printf("MD_UUID=");
 {
        mdp_super_t *sb = sbv;
        printf("MD_UUID=");
@@ -294,7 +294,7 @@ static void export_super0(void *sbv)
 }
 #endif
 
 }
 #endif
 
-static int match_home0(void *sbv, char *homehost)
+static int match_home0(struct supertype *st, void *sbv, char *homehost)
 {
        mdp_super_t *sb = sbv;
        char buf[20];
 {
        mdp_super_t *sb = sbv;
        char buf[20];
@@ -305,7 +305,7 @@ static int match_home0(void *sbv, char *homehost)
        return (memcmp(&sb->set_uuid2, hash, 8)==0);
 }
 
        return (memcmp(&sb->set_uuid2, hash, 8)==0);
 }
 
-static void uuid_from_super0(int uuid[4], void * sbv)
+static void uuid_from_super0(struct supertype *st, int uuid[4], void * sbv)
 {
        mdp_super_t *super = sbv;
        uuid[0] = super->set_uuid0;
 {
        mdp_super_t *super = sbv;
        uuid[0] = super->set_uuid0;
@@ -320,7 +320,7 @@ static void uuid_from_super0(int uuid[4], void * sbv)
        }
 }
 
        }
 }
 
-static void getinfo_super0(struct mdinfo *info, void *sbv)
+static void getinfo_super0(struct supertype *st, struct mdinfo *info, void *sbv)
 {
        mdp_super_t *sb = sbv;
        int working = 0;
 {
        mdp_super_t *sb = sbv;
        int working = 0;
@@ -348,7 +348,7 @@ static void getinfo_super0(struct mdinfo *info, void *sbv)
        info->events = md_event(sb);
        info->data_offset = 0;
 
        info->events = md_event(sb);
        info->data_offset = 0;
 
-       uuid_from_super0(info->uuid, sbv);
+       uuid_from_super0(st, info->uuid, sbv);
 
        if (sb->minor_version > 90 && (sb->reshape_position+1) != 0) {
                info->reshape_active = 1;
 
        if (sb->minor_version > 90 && (sb->reshape_position+1) != 0) {
                info->reshape_active = 1;
@@ -372,7 +372,8 @@ static void getinfo_super0(struct mdinfo *info, void *sbv)
 }
 
 
 }
 
 
-static int update_super0(struct mdinfo *info, void *sbv, char *update,
+static int update_super0(struct supertype *st, struct mdinfo *info,
+                        void *sbv, char *update,
                         char *devname, int verbose,
                         int uuid_set, char *homehost)
 {
                         char *devname, int verbose,
                         int uuid_set, char *homehost)
 {
@@ -507,7 +508,7 @@ static int update_super0(struct mdinfo *info, void *sbv, char *update,
                if (sb->state & (1<<MD_SB_BITMAP_PRESENT)) {
                        struct bitmap_super_s *bm;
                        bm = (struct bitmap_super_s*)(sb+1);
                if (sb->state & (1<<MD_SB_BITMAP_PRESENT)) {
                        struct bitmap_super_s *bm;
                        bm = (struct bitmap_super_s*)(sb+1);
-                       uuid_from_super0((int*)bm->uuid, sbv);
+                       uuid_from_super0(st, (int*)bm->uuid, sbv);
                }
        }
        if (strcmp(update, "_reshape_progress")==0)
                }
        }
        if (strcmp(update, "_reshape_progress")==0)
@@ -603,7 +604,7 @@ static int init_super0(struct supertype *st, void **sbp, mdu_array_info_t *info,
 }
 
 /* Add a device to the superblock being created */
 }
 
 /* Add a device to the superblock being created */
-static void add_to_super0(void *sbv, mdu_disk_info_t *dinfo)
+static void add_to_super0(struct supertype *st, void *sbv, mdu_disk_info_t *dinfo)
 {
        mdp_super_t *sb = sbv;
        mdp_disk_t *dk = &sb->disks[dinfo->number];
 {
        mdp_super_t *sb = sbv;
        mdp_disk_t *dk = &sb->disks[dinfo->number];
@@ -696,8 +697,8 @@ static int compare_super0(void **firstp, void *secondv)
                return 0;
        }
 
                return 0;
        }
 
-       uuid_from_super0(uuid1, first);
-       uuid_from_super0(uuid2, second);
+       uuid_from_super0(NULL, uuid1, first);
+       uuid_from_super0(NULL, uuid2, second);
        if (!same_uuid(uuid1, uuid2, 0))
                return 2;
        if (first->major_version != second->major_version ||
        if (!same_uuid(uuid1, uuid2, 0))
                return 2;
        if (first->major_version != second->major_version ||
@@ -798,7 +799,7 @@ static int load_super0(struct supertype *st, int fd, void **sbp, char *devname)
            != sizeof(struct bitmap_super_s))
                goto no_bitmap;
 
            != sizeof(struct bitmap_super_s))
                goto no_bitmap;
 
-       uuid_from_super0(uuid, super);
+       uuid_from_super0(st, uuid, super);
        bsb = (struct bitmap_super_s *)(super+1);
        if (__le32_to_cpu(bsb->magic) != BITMAP_MAGIC ||
            memcmp(bsb->uuid, uuid, 16) != 0)
        bsb = (struct bitmap_super_s *)(super+1);
        if (__le32_to_cpu(bsb->magic) != BITMAP_MAGIC ||
            memcmp(bsb->uuid, uuid, 16) != 0)
@@ -875,7 +876,7 @@ static int add_internal_bitmap0(struct supertype *st, void *sbv, int *chunkp,
        memset(bms, 0, sizeof(*bms));
        bms->magic = __cpu_to_le32(BITMAP_MAGIC);
        bms->version = __cpu_to_le32(major);
        memset(bms, 0, sizeof(*bms));
        bms->magic = __cpu_to_le32(BITMAP_MAGIC);
        bms->version = __cpu_to_le32(major);
-       uuid_from_super0((int*)bms->uuid, sb);
+       uuid_from_super0(st, (int*)bms->uuid, sb);
        bms->chunksize = __cpu_to_le32(chunk);
        bms->daemon_sleep = __cpu_to_le32(delay);
        bms->sync_size = __cpu_to_le64(size);
        bms->chunksize = __cpu_to_le32(chunk);
        bms->daemon_sleep = __cpu_to_le32(delay);
        bms->sync_size = __cpu_to_le64(size);
@@ -953,7 +954,7 @@ int write_bitmap0(struct supertype *st, int fd, void *sbv)
        return rv;
 }
 
        return rv;
 }
 
-static void free_super0(void *super)
+static void free_super0(struct supertype *st, void *super)
 {
        if (super)
                free(super);
 {
        if (super)
                free(super);
index 804a07e19ded275288dbe171019b85317f776f6c..a534c3349201893a0d214850757fdfffa9a73685 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -142,7 +142,7 @@ static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb)
 }
 
 #ifndef MDASSEMBLE
 }
 
 #ifndef MDASSEMBLE
-static void examine_super1(void *sbv, char *homehost)
+static void examine_super1(struct supertype *st, void *sbv, char *homehost)
 {
        struct mdp_superblock_1 *sb = sbv;
        time_t atime;
 {
        struct mdp_superblock_1 *sb = sbv;
        time_t atime;
@@ -341,7 +341,7 @@ static void examine_super1(void *sbv, char *homehost)
 }
 
 
 }
 
 
-static void brief_examine_super1(void *sbv)
+static void brief_examine_super1(struct supertype *st, void *sbv)
 {
        struct mdp_superblock_1 *sb = sbv;
        int i;
 {
        struct mdp_superblock_1 *sb = sbv;
        int i;
@@ -375,7 +375,7 @@ static void brief_examine_super1(void *sbv)
        printf("\n");
 }
 
        printf("\n");
 }
 
-static void detail_super1(void *sbv, char *homehost)
+static void detail_super1(struct supertype *st, void *sbv, char *homehost)
 {
        struct mdp_superblock_1 *sb = sbv;
        int i;
 {
        struct mdp_superblock_1 *sb = sbv;
        int i;
@@ -394,7 +394,7 @@ static void detail_super1(void *sbv, char *homehost)
        printf("\n         Events : %llu\n\n", (unsigned long long)__le64_to_cpu(sb->events));
 }
 
        printf("\n         Events : %llu\n\n", (unsigned long long)__le64_to_cpu(sb->events));
 }
 
-static void brief_detail_super1(void *sbv)
+static void brief_detail_super1(struct supertype *st, void *sbv)
 {
        struct mdp_superblock_1 *sb = sbv;
        int i;
 {
        struct mdp_superblock_1 *sb = sbv;
        int i;
@@ -408,7 +408,7 @@ static void brief_detail_super1(void *sbv)
        }
 }
 
        }
 }
 
-static void export_super1(void *sbv)
+static void export_super1(struct supertype *st, void *sbv)
 {
        struct mdp_superblock_1 *sb = sbv;
        int i;
 {
        struct mdp_superblock_1 *sb = sbv;
        int i;
@@ -432,7 +432,7 @@ static void export_super1(void *sbv)
 
 #endif
 
 
 #endif
 
-static int match_home1(void *sbv, char *homehost)
+static int match_home1(struct supertype *st, void *sbv, char *homehost)
 {
        struct mdp_superblock_1 *sb = sbv;
        int l = homehost ? strlen(homehost) : 0;
 {
        struct mdp_superblock_1 *sb = sbv;
        int l = homehost ? strlen(homehost) : 0;
@@ -442,7 +442,7 @@ static int match_home1(void *sbv, char *homehost)
                strncmp(sb->set_name, homehost, l) == 0);
 }
 
                strncmp(sb->set_name, homehost, l) == 0);
 }
 
-static void uuid_from_super1(int uuid[4], void * sbv)
+static void uuid_from_super1(struct supertype *st, int uuid[4], void * sbv)
 {
        struct mdp_superblock_1 *super = sbv;
        char *cuuid = (char*)uuid;
 {
        struct mdp_superblock_1 *super = sbv;
        char *cuuid = (char*)uuid;
@@ -451,7 +451,7 @@ static void uuid_from_super1(int uuid[4], void * sbv)
                cuuid[i] = super->set_uuid[i];
 }
 
                cuuid[i] = super->set_uuid[i];
 }
 
-static void getinfo_super1(struct mdinfo *info, void *sbv)
+static void getinfo_super1(struct supertype *st, struct mdinfo *info, void *sbv)
 {
        struct mdp_superblock_1 *sb = sbv;
        int working = 0;
 {
        struct mdp_superblock_1 *sb = sbv;
        int working = 0;
@@ -522,7 +522,8 @@ static void getinfo_super1(struct mdinfo *info, void *sbv)
        info->array.working_disks = working;
 }
 
        info->array.working_disks = working;
 }
 
-static int update_super1(struct mdinfo *info, void *sbv, char *update,
+static int update_super1(struct supertype *st, struct mdinfo *info,
+                        void *sbv, char *update,
                         char *devname, int verbose,
                         int uuid_set, char *homehost)
 {
                         char *devname, int verbose,
                         int uuid_set, char *homehost)
 {
@@ -734,7 +735,7 @@ static int init_super1(struct supertype *st, void **sbp, mdu_array_info_t *info,
 }
 
 /* Add a device to the superblock being created */
 }
 
 /* Add a device to the superblock being created */
-static void add_to_super1(void *sbv, mdu_disk_info_t *dk)
+static void add_to_super1(struct supertype *st, void *sbv, mdu_disk_info_t *dk)
 {
        struct mdp_superblock_1 *sb = sbv;
        __u16 *rp = sb->dev_roles + dk->number;
 {
        struct mdp_superblock_1 *sb = sbv;
        __u16 *rp = sb->dev_roles + dk->number;
@@ -1124,7 +1125,7 @@ static int load_super1(struct supertype *st, int fd, void **sbp, char *devname)
            != sizeof(struct bitmap_super_s))
                goto no_bitmap;
 
            != sizeof(struct bitmap_super_s))
                goto no_bitmap;
 
-       uuid_from_super1(uuid, super);
+       uuid_from_super1(st, uuid, super);
        if (__le32_to_cpu(bsb->magic) != BITMAP_MAGIC ||
            memcmp(bsb->uuid, uuid, 16) != 0)
                goto no_bitmap;
        if (__le32_to_cpu(bsb->magic) != BITMAP_MAGIC ||
            memcmp(bsb->uuid, uuid, 16) != 0)
                goto no_bitmap;
@@ -1301,7 +1302,7 @@ add_internal_bitmap1(struct supertype *st, void *sbv,
        memset(bms, 0, sizeof(*bms));
        bms->magic = __cpu_to_le32(BITMAP_MAGIC);
        bms->version = __cpu_to_le32(major);
        memset(bms, 0, sizeof(*bms));
        bms->magic = __cpu_to_le32(BITMAP_MAGIC);
        bms->version = __cpu_to_le32(major);
-       uuid_from_super1((int*)bms->uuid, sb);
+       uuid_from_super1(st, (int*)bms->uuid, sb);
        bms->chunksize = __cpu_to_le32(chunk);
        bms->daemon_sleep = __cpu_to_le32(delay);
        bms->sync_size = __cpu_to_le64(size);
        bms->chunksize = __cpu_to_le32(chunk);
        bms->daemon_sleep = __cpu_to_le32(delay);
        bms->sync_size = __cpu_to_le64(size);
@@ -1366,7 +1367,7 @@ static int write_bitmap1(struct supertype *st, int fd, void *sbv)
        return rv;
 }
 
        return rv;
 }
 
-static void free_super1(void *super)
+static void free_super1(struct supertype *st, void *super)
 {
        if (super)
                free(super);
 {
        if (super)
                free(super);
diff --git a/util.c b/util.c
index b6681f55a0e9cda025dca7be80216b81532f7a7f..0662c4e288015b47ed17ec3fc45a370f488605c2 100644 (file)
--- a/util.c
+++ b/util.c
@@ -333,8 +333,8 @@ int check_raid(int fd, char *name)
        /* Looks like a raid array .. */
        fprintf(stderr, Name ": %s appears to be part of a raid array:\n",
                name);
        /* Looks like a raid array .. */
        fprintf(stderr, Name ": %s appears to be part of a raid array:\n",
                name);
-       st->ss->getinfo_super(&info, super);
-       st->ss->free_super(super);
+       st->ss->getinfo_super(st, &info, super);
+       st->ss->free_super(st, super);
        crtime = info.array.ctime;
        level = map_num(pers, info.array.level);
        if (!level) level = "-unknown-";
        crtime = info.array.ctime;
        level = map_num(pers, info.array.level);
        if (!level) level = "-unknown-";
@@ -763,7 +763,7 @@ struct supertype *guess_super(int fd)
                rv = ss->load_super(st, fd, &sbp, NULL);
                if (rv == 0) {
                        struct mdinfo info;
                rv = ss->load_super(st, fd, &sbp, NULL);
                if (rv == 0) {
                        struct mdinfo info;
-                       ss->getinfo_super(&info, sbp);
+                       st->ss->getinfo_super(st, &info, sbp);
                        if (bestsuper == -1 ||
                            besttime < info.array.ctime) {
                                bestsuper = i;
                        if (bestsuper == -1 ||
                            besttime < info.array.ctime) {
                                bestsuper = i;