summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2007-12-14 20:14:16 +1100
committerNeil Brown <neilb@suse.de>2007-12-14 20:14:16 +1100
commit68c7d6d790f856b4e8301d0afa7fc6873a0d4bb8 (patch)
tree56f8b050b39fb8008a8b25310fc6f9609796fc26
parentdf37ffc0393b919ba5607bb48b2eaf2f9a1832d7 (diff)
downloadmdadm-68c7d6d790f856b4e8301d0afa7fc6873a0d4bb8.tar.gz
mdadm-68c7d6d790f856b4e8301d0afa7fc6873a0d4bb8.tar.xz
mdadm-68c7d6d790f856b4e8301d0afa7fc6873a0d4bb8.zip
Add 'supertype' arg to almost all metadata methods.
The 'superblock' will be moved into this structure soon.
-rw-r--r--Assemble.c50
-rw-r--r--Create.c8
-rw-r--r--Detail.c12
-rw-r--r--Examine.c20
-rw-r--r--Grow.c26
-rw-r--r--Incremental.c26
-rw-r--r--Kill.c2
-rw-r--r--Manage.c8
-rw-r--r--Query.c2
-rw-r--r--mdadm.h23
-rw-r--r--super0.c35
-rw-r--r--super1.c27
-rw-r--r--util.c6
13 files changed, 128 insertions, 117 deletions
diff --git a/Assemble.c b/Assemble.c
index c30dfe9..7837b19 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -251,7 +251,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
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);
@@ -294,7 +294,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
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);
@@ -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);
- st->ss->free_super(first_super);
+ st->ss->free_super(st, first_super);
return 1;
}
@@ -331,8 +331,10 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
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 */
@@ -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);
- 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;
}
@@ -364,7 +366,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
loop:
if (super)
- tst->ss->free_super(super);
+ tst->ss->free_super(tst, super);
super = NULL;
}
@@ -378,7 +380,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
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))
@@ -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) {
- st->ss->free_super(first_super);
+ st->ss->free_super(st, first_super);
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;
- st->ss->free_super(first_super);
+ st->ss->free_super(st, first_super);
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);
- 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);
- 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) {
@@ -481,7 +484,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
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);
}
@@ -562,7 +565,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
devcnt++;
if (super)
- st->ss->free_super(super);
+ st->ss->free_super(st, super);
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);
- st->ss->free_super(first_super);
+ st->ss->free_super(st, first_super);
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.
@@ -655,7 +658,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
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);
@@ -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;
- st->ss->free_super(super);
+ st->ss->free_super(st, super);
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++;
- 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
@@ -726,7 +729,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
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;
@@ -745,7 +748,8 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
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 ": "
@@ -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)) {
- 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;
diff --git a/Create.c b/Create.c
index 8f554fa..77aaf8e 100644
--- 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];
- 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,
@@ -542,7 +542,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
}
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;
@@ -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));
- st->ss->free_super(super);
+ st->ss->free_super(st, super);
return 1;
}
@@ -562,7 +562,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
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) {
diff --git a/Detail.c b/Detail.c
index a579603..cebba6e 100644
--- 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) {
- st->ss->getinfo_super(&info, super);
+ st->ss->getinfo_super(st, &info, super);
if (info.array.ctime != array.ctime ||
info.array.level != array.level) {
- st->ss->free_super(super);
+ st->ss->free_super(st, super);
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)
- st->ss->export_super(super);
+ st->ss->export_super(st, super);
goto out;
}
@@ -278,7 +278,7 @@ This is pretty boring
} 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");
}
@@ -377,9 +377,9 @@ This is pretty boring
}
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)
- st->ss->free_super(super);
+ st->ss->free_super(st, super);
if (brief > 1 && devices) printf("\n devices=%s", devices);
if (brief) printf("\n");
diff --git a/Examine.c b/Examine.c
index b4dc963..b5316b9 100644
--- a/Examine.c
+++ b/Examine.c
@@ -99,13 +99,15 @@ int Examine(mddev_dev_t devlist, int brief, int scan,
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) {
- 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) {
@@ -116,10 +118,10 @@ int Examine(mddev_dev_t devlist, int brief, int scan,
ap->spares = 0;
ap->st = st;
arrays = ap;
- st->ss->getinfo_super(&ap->info, super);
+ st->ss->getinfo_super(st, &ap->info, super);
} 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++;
@@ -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);
- 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) {
@@ -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;
- 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");
@@ -145,7 +147,7 @@ int Examine(mddev_dev_t devlist, int brief, int scan,
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");
diff --git a/Grow.c b/Grow.c
index 793e551..0aa7287 100644
--- a/Grow.c
+++ b/Grow.c
@@ -104,7 +104,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
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);
@@ -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);
- 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)) {
@@ -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;
- 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)) {
@@ -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);
- st->ss->uuid_from_super(uuid, super);
+ st->ss->uuid_from_super(st, uuid, super);
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);
- 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);
@@ -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;
- 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,
@@ -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;
- 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;
}
@@ -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;
- st->ss->getinfo_super(&dinfo, super);
+ st->ss->getinfo_super(st, &dinfo, super);
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->free_super(super);
+ st->ss->free_super(st, super);
}
/* And we are done! */
diff --git a/Incremental.c b/Incremental.c
index 94ef47d..fdd8fb4 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -141,7 +141,7 @@ int Incremental(char *devname, int verbose, int runstop,
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 */
@@ -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 ||
- 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");
@@ -354,7 +354,7 @@ int Incremental(char *devname, int verbose, int runstop,
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) {
@@ -501,8 +501,8 @@ static void find_reject(int mdfd, struct supertype *st, struct sysarray *sra,
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 ||
@@ -545,7 +545,7 @@ static int count_active(struct supertype *st, int mdfd, char **availp,
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) {
@@ -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;
- 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;
- st->ss->free_super(best_super);
+ st->ss->free_super(st, best_super);
best_super = super;
super = NULL;
}
}
if (super)
- st->ss->free_super(super);
+ st->ss->free_super(st, 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;
}
@@ -628,7 +628,7 @@ void RebuildMap(void)
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
@@ -636,7 +636,7 @@ void RebuildMap(void)
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;
}
}
diff --git a/Kill.c b/Kill.c
index c13dba7..d7e52f5 100644
--- 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 */
- 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)
diff --git a/Manage.c b/Manage.c
index af87f79..5219e6e 100644
--- 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.
*/
- 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 :-(
@@ -382,14 +382,14 @@ int Manage_subdevs(char *devname, int fd,
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;
- 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;
@@ -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;
- 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) {
diff --git a/Query.c b/Query.c
index e1743ef..19b2ce5 100644
--- a/Query.c
+++ b/Query.c
@@ -96,7 +96,7 @@ int Query(char *dev)
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;
diff --git a/mdadm.h b/mdadm.h
index de71b55..bf583b4 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -341,19 +341,20 @@ extern char *map_dev(int major, int minor, int create);
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);
- 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);
@@ -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);
- 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[];
diff --git a/super0.c b/super0.c
index 9a7eb15..b81037e 100644
--- a/super0.c
+++ b/super0.c
@@ -85,7 +85,7 @@ void super0_swap_endian(struct mdp_superblock_s *sb)
#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;
@@ -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);
@@ -250,7 +250,7 @@ static void brief_examine_super0(void *sbv)
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 : ");
@@ -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);
}
-static void brief_detail_super0(void *sbv)
+static void brief_detail_super0(struct supertype *st, void *sbv)
{
mdp_super_t *sb = sbv;
printf(" UUID=");
@@ -281,7 +281,7 @@ static void brief_detail_super0(void *sbv)
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=");
@@ -294,7 +294,7 @@ static void export_super0(void *sbv)
}
#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];
@@ -305,7 +305,7 @@ static int match_home0(void *sbv, char *homehost)
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;
@@ -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;
@@ -348,7 +348,7 @@ static void getinfo_super0(struct mdinfo *info, void *sbv)
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;
@@ -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)
{
@@ -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);
- uuid_from_super0((int*)bm->uuid, sbv);
+ uuid_from_super0(st, (int*)bm->uuid, sbv);
}
}
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 */
-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];
@@ -696,8 +697,8 @@ static int compare_super0(void **firstp, void *secondv)
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 ||
@@ -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;
- 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)
@@ -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);
- 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);
@@ -953,7 +954,7 @@ int write_bitmap0(struct supertype *st, int fd, void *sbv)
return rv;
}
-static void free_super0(void *super)
+static void free_super0(struct supertype *st, void *super)
{
if (super)
free(super);
diff --git a/super1.c b/super1.c
index 804a07e..a534c33 100644
--- a/super1.c
+++ b/super1.c
@@ -142,7 +142,7 @@ static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb)
}
#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;
@@ -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;
@@ -375,7 +375,7 @@ static void brief_examine_super1(void *sbv)
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;
@@ -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));
}
-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;
@@ -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;
@@ -432,7 +432,7 @@ static void export_super1(void *sbv)
#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;
@@ -442,7 +442,7 @@ static int match_home1(void *sbv, char *homehost)
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;
@@ -451,7 +451,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 supertype *st, struct mdinfo *info, void *sbv)
{
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;
}
-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)
{
@@ -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 */
-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;
@@ -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;
- 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;
@@ -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);
- 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);
@@ -1366,7 +1367,7 @@ static int write_bitmap1(struct supertype *st, int fd, void *sbv)
return rv;
}
-static void free_super1(void *super)
+static void free_super1(struct supertype *st, void *super)
{
if (super)
free(super);
diff --git a/util.c b/util.c
index b6681f5..0662c4e 100644
--- 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);
- 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-";
@@ -763,7 +763,7 @@ struct supertype *guess_super(int fd)
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;