Remove ident arg from getinfo_super;

Add a 'name' field to 'info' to compensate.

Signed-off-by: Neil Brown <neilb@suse.de>
This commit is contained in:
Neil Brown 2006-03-27 04:34:38 +00:00
parent 2efedc7bd2
commit 313176636e
11 changed files with 22 additions and 28 deletions

View File

@ -117,7 +117,6 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
unsigned int num_devs;
mddev_dev_t tmpdev;
struct mdinfo info;
struct mddev_ident_s ident2;
char *avail;
int nextspare = 0;
@ -215,7 +214,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, &ident2, super);
tst->ss->getinfo_super(&info, super);
}
if (dfd >= 0) close(dfd);
@ -227,7 +226,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
continue;
}
if (ident->name[0] &&
(!super || strncmp(ident2.name, ident->name, 32)!=0)) {
(!super || strncmp(info.name, ident->name, 32)!=0)) {
if ((inargv && verbose >= 0) || verbose > 0)
fprintf(stderr, Name ": %s has wrong name.\n",
devname);
@ -374,7 +373,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
return 1;
}
st->ss->getinfo_super(&info, &ident2, first_super);
st->ss->getinfo_super(&info, first_super);
/* now we have some devices that might be suitable.
* I wonder how many
@ -500,7 +499,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
fprintf(stderr, Name ": No suitable drives found for %s\n", mddev);
return 1;
}
st->ss->getinfo_super(&info, &ident2, super);
st->ss->getinfo_super(&info, super);
for (i=0; i<bestcnt; i++) {
int j = best[i];
unsigned int desired_state;

View File

@ -4,6 +4,7 @@ Changes Prior to 2.4 release
backup after a crash.
- Put a 'canary' at each end of the backup so a corruption
can be more easily detected.
- Remove useless 'ident' arguement from ->getinfo_super method.
Changes Prior to 2.3.1 release
- Fixed -O2 compile so I could make and RPM.

View File

@ -114,8 +114,7 @@ int Detail(char *dev, int brief, int test)
if (fd2 >=0 && st &&
st->ss->load_super(st, fd2, &super, NULL) == 0) {
struct mdinfo info;
struct mddev_ident_s ident;
st->ss->getinfo_super(&info, &ident, super);
st->ss->getinfo_super(&info, super);
if (info.array.ctime != array.ctime ||
info.array.level != array.level) {
free(super);

View File

@ -62,7 +62,6 @@ int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust, struct su
void *super;
struct supertype *st;
struct mdinfo info;
struct mddev_ident_s ident;
void *devs;
struct array *next;
int spares;
@ -113,9 +112,9 @@ int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust, struct su
ap->spares = 0;
ap->st = st;
arrays = ap;
st->ss->getinfo_super(&ap->info, &ap->ident, super);
st->ss->getinfo_super(&ap->info, super);
} else {
st->ss->getinfo_super(&ap->info, &ap->ident, super);
st->ss->getinfo_super(&ap->info, super);
free(super);
}
if (!(ap->info.disk.state & MD_DISK_SYNC))

7
Grow.c
View File

@ -835,7 +835,6 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
for (i=old_disks; i<cnt; i++) {
void *super = NULL;
struct mdinfo dinfo;
struct mddev_ident_s id;
struct mdp_backup_super bsb;
char buf[4096];
@ -851,7 +850,7 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
if (st->ss->load_super(st, fdlist[i], &super, NULL))
continue;
st->ss->getinfo_super(&dinfo, &id, super);
st->ss->getinfo_super(&dinfo, super);
free(super); super = NULL;
if (lseek64(fdlist[i],
(dinfo.data_offset + dinfo.component_size - 8) <<9,
@ -893,7 +892,7 @@ 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, &id, super);
st->ss->getinfo_super(&dinfo, super);
free(super); super = NULL;
offsets[j] = dinfo.data_offset;
}
@ -916,7 +915,7 @@ 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, &id, super);
st->ss->getinfo_super(&dinfo, super);
dinfo.reshape_progress = __le64_to_cpu(bsb.length);
st->ss->update_super(&dinfo, super, "_reshape_progress",NULL,0);
st->ss->store_super(st, fdlist[j], super);

View File

@ -278,8 +278,7 @@ int Manage_subdevs(char *devname, int fd,
* based reconstruct is possible
*/
struct mdinfo mdi;
struct mddev_ident_s ident;
st->ss->getinfo_super(&mdi, &ident, osuper);
st->ss->getinfo_super(&mdi, osuper);
disc.major = major(stb.st_rdev);
disc.minor = minor(stb.st_rdev);
disc.number = mdi.disk.number;

View File

@ -42,7 +42,6 @@ int Query(char *dev)
int ioctlerr;
int superror, superrno;
struct mdinfo info;
struct mddev_ident_s ident;
mdu_array_info_t array;
void *super;
struct supertype *st = NULL;
@ -105,7 +104,7 @@ int Query(char *dev)
close(fd);
if (superror == 0) {
/* array might be active... */
st->ss->getinfo_super(&info, &ident, super);
st->ss->getinfo_super(&info, super);
if (st->ss->major == 0) {
mddev = get_md_name(info.array.md_minor);
disc.number = info.disk.number;

View File

@ -91,6 +91,7 @@ struct mdinfo {
mdu_disk_info_t disk;
__u64 events;
int uuid[4];
char name[33];
unsigned long long data_offset;
unsigned long long component_size;
int reshape_active;
@ -254,7 +255,7 @@ extern struct superswitch {
void (*detail_super)(void *sbv);
void (*brief_detail_super)(void *sbv);
void (*uuid_from_super)(int uuid[4], void *sbv);
void (*getinfo_super)(struct mdinfo *info, mddev_ident_t ident, void *sbv);
void (*getinfo_super)(struct mdinfo *info, void *sbv);
int (*update_super)(struct mdinfo *info, void *sbv, char *update, char *devname, int verbose);
__u64 (*event_super)(void *sbv);
int (*init_super)(struct supertype *st, void **sbp, mdu_array_info_t *info, unsigned long long size, char *name);

View File

@ -265,7 +265,7 @@ static void uuid_from_super0(int uuid[4], void * sbv)
}
}
static void getinfo_super0(struct mdinfo *info, mddev_ident_t ident, void *sbv)
static void getinfo_super0(struct mdinfo *info, void *sbv)
{
mdp_super_t *sb = sbv;
int working = 0;
@ -304,7 +304,7 @@ static void getinfo_super0(struct mdinfo *info, mddev_ident_t ident, void *sbv)
} else
info->reshape_active = 0;
ident->name[0] = 0;
info->name[0] = 0;
/* work_disks is calculated rather than read directly */
for (i=0; i < MD_SB_DISKS; i++)
if ((sb->disks[i].state & (1<<MD_DISK_SYNC)) &&

View File

@ -353,7 +353,7 @@ static void uuid_from_super1(int uuid[4], void * sbv)
cuuid[i] = super->set_uuid[i];
}
static void getinfo_super1(struct mdinfo *info, mddev_ident_t ident, void *sbv)
static void getinfo_super1(struct mdinfo *info, void *sbv)
{
struct mdp_superblock_1 *sb = sbv;
int working = 0;
@ -399,8 +399,8 @@ static void getinfo_super1(struct mdinfo *info, mddev_ident_t ident, void *sbv)
memcpy(info->uuid, sb->set_uuid, 16);
strncpy(ident->name, sb->set_name, 32);
ident->name[32] = 0;
strncpy(info->name, sb->set_name, 32);
info->name[32] = 0;
if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE)) {
info->reshape_active = 1;

6
util.c
View File

@ -248,7 +248,6 @@ int check_raid(int fd, char *name)
{
void *super;
struct mdinfo info;
struct mddev_ident_s ident;
time_t crtime;
char *level;
struct supertype *st = guess_super(fd);
@ -258,7 +257,7 @@ 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, &ident, super);
st->ss->getinfo_super(&info, super);
free(super);
crtime = info.array.ctime;
level = map_num(pers, info.array.level);
@ -653,8 +652,7 @@ struct supertype *guess_super(int fd)
rv = ss->load_super(st, fd, &sbp, NULL);
if (rv == 0) {
struct mdinfo info;
struct mddev_ident_s ident;
ss->getinfo_super(&info, &ident, sbp);
ss->getinfo_super(&info, sbp);
if (bestsuper == -1 ||
besttime < info.array.ctime) {
bestsuper = i;