From 313176636ee8c24cf1464cfec159d41ffcffacb3 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Mon, 27 Mar 2006 04:34:38 +0000 Subject: [PATCH] Remove ident arg from getinfo_super; Add a 'name' field to 'info' to compensate. Signed-off-by: Neil Brown --- Assemble.c | 9 ++++----- ChangeLog | 1 + Detail.c | 3 +-- Examine.c | 5 ++--- Grow.c | 7 +++---- Manage.c | 3 +-- Query.c | 3 +-- mdadm.h | 3 ++- super0.c | 4 ++-- super1.c | 6 +++--- util.c | 6 ++---- 11 files changed, 22 insertions(+), 28 deletions(-) diff --git a/Assemble.c b/Assemble.c index 2dca21df..a8a331e1 100644 --- a/Assemble.c +++ b/Assemble.c @@ -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; igetinfo_super method. Changes Prior to 2.3.1 release - Fixed -O2 compile so I could make and RPM. diff --git a/Detail.c b/Detail.c index 774a7509..15c751f8 100644 --- a/Detail.c +++ b/Detail.c @@ -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); diff --git a/Examine.c b/Examine.c index fcfb02b8..b4425e5a 100644 --- a/Examine.c +++ b/Examine.c @@ -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)) diff --git a/Grow.c b/Grow.c index 44329228..04de4550 100644 --- a/Grow.c +++ b/Grow.c @@ -835,7 +835,6 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt for (i=old_disks; iss->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); diff --git a/Manage.c b/Manage.c index 67e72107..f7f3f6ef 100644 --- a/Manage.c +++ b/Manage.c @@ -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; diff --git a/Query.c b/Query.c index a76c6920..d2bfb052 100644 --- a/Query.c +++ b/Query.c @@ -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; diff --git a/mdadm.h b/mdadm.h index 00c280b3..c929be95 100644 --- a/mdadm.h +++ b/mdadm.h @@ -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); diff --git a/super0.c b/super0.c index 99d09a43..c7f2f613 100644 --- a/super0.c +++ b/super0.c @@ -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<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; diff --git a/util.c b/util.c index 0af43313..ff175009 100644 --- a/util.c +++ b/util.c @@ -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; -- 2.39.2