Remove silly convention that major='-1' means 'zero superblock'.

Use 'info pointer is NULL' instead.
This commit is contained in:
Neil Brown 2008-07-12 20:27:39 +10:00
parent d2ca644994
commit ba7eb04f71
5 changed files with 9 additions and 16 deletions

View File

@ -487,7 +487,6 @@ int Create(struct supertype *st, char *mddev, int mdfd,
+ info.array.failed_disks;
info.array.layout = layout;
info.array.chunk_size = chunk*1024;
info.array.major_version = 0; /* Flag to say "not zeroing superblock" */
if (name == NULL || *name == 0) {
/* base name on mddev */

4
Kill.c
View File

@ -63,10 +63,8 @@ int Kill(char *dev, int force, int quiet, int noexcl)
if (force && rv >= 2)
rv = 0; /* ignore bad data in superblock */
if (rv== 0 || (force && rv >= 2)) {
mdu_array_info_t info;
info.major_version = -1; /* zero superblock */
st->ss->free_super(st);
st->ss->init_super(st, &info, 0, "", NULL, NULL);
st->ss->init_super(st, NULL, 0, "", NULL, NULL);
if (st->ss->store_super(st, fd)) {
if (!quiet)
fprintf(stderr, Name ": Could not zero superblock on %s\n",

View File

@ -1455,6 +1455,11 @@ static int init_super_ddf(struct supertype *st,
struct phys_disk *pd;
struct virtual_disk *vd;
if (!info) {
st->sb = NULL;
return 0;
}
ddf = malloc(sizeof(*ddf));
memset(ddf, 0, sizeof(*ddf));
ddf->dlist = NULL; /* no physical disks yet */
@ -2558,15 +2563,6 @@ static struct mdinfo *container_content_ddf(struct supertype *st)
return rest;
}
static int init_zero_ddf(struct supertype *st,
mdu_array_info_t *info,
unsigned long long size, char *name,
char *homehost, int *uuid)
{
st->sb = NULL;
return 0;
}
static int store_zero_ddf(struct supertype *st, int fd)
{
unsigned long long dsize;
@ -3115,7 +3111,7 @@ struct superswitch super_ddf = {
.compare_super = compare_super_ddf,
.load_super = load_super_ddf,
.init_super = init_zero_ddf,
.init_super = init_super_ddf,
.store_super = store_zero_ddf,
.free_super = free_super_ddf,
.match_metadata_desc = match_metadata_desc_ddf,

View File

@ -559,7 +559,7 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
memset(sb, 0, MD_SB_BYTES + sizeof(bitmap_super_t));
st->sb = sb;
if (info->major_version == -1) {
if (info == NULL) {
/* zeroing the superblock */
return 0;
}

View File

@ -697,7 +697,7 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
memset(sb, 0, 1024);
st->sb = sb;
if (info->major_version == -1) {
if (info == NULL) {
/* zeroing superblock */
return 0;
}