int nfd, fd2;
int d, nd;
struct supertype *st = NULL;
-
+
if (ioctl(fd, GET_ARRAY_INFO, &info.array) < 0) {
fprintf(stderr, Name ": cannot get array info for %s\n", devname);
fprintf(stderr, Name ": cannot open device file %s\n", dv);
return 1;
}
- if (super) free(super);
+ if (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);
/* Ok, looks good. Lets update the superblock and write it out to
* newdev.
*/
-
+
info.disk.number = d;
info.disk.major = major(stb.st_rdev);
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)) {
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)) {
fprintf(stderr, Name ": Cannot store new superblock on %s\n", dv);
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);
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);
break;
sleep(1);
}
-
+
/* invalidate superblocks */
memset(&bsb, 0, sizeof(bsb));
for (i=odisks; i<d ; i++) {
if (st->ss->load_super(st, fd, &super, NULL))
continue;
- st->ss->getinfo_super(&dinfo, super);
- free(super); super = NULL;
+ 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,
0) < 0)
if (st->ss->load_super(st, fdlist[j], &super, NULL))
/* FIXME should be this be an error */
continue;
- st->ss->getinfo_super(&dinfo, super);
- free(super); super = NULL;
+ st->ss->getinfo_super(st, &dinfo, super);
+ st->ss->free_super(st, super);
+ super = NULL;
offsets[j] = dinfo.data_offset;
}
printf(Name ": restoring critical section\n");
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);
- free(super);
+ st->ss->free_super(st, super);
}
/* And we are done! */