diff options
author | Dan Williams <dan.j.williams@intel.com> | 2008-11-26 15:39:51 -0700 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-11-27 15:30:39 +1100 |
commit | f20c3968363a16f3c8dce5d69863bbb54a4d236e (patch) | |
tree | c96904d976647f1051b9f3dbc2cf72c27b428624 /super-intel.c | |
parent | fabbfd48b6c2398a344d2d4f7cbf0ab98181a6d4 (diff) | |
download | mdadm-f20c3968363a16f3c8dce5d69863bbb54a4d236e.tar.gz mdadm-f20c3968363a16f3c8dce5d69863bbb54a4d236e.tar.xz mdadm-f20c3968363a16f3c8dce5d69863bbb54a4d236e.zip |
allow add_to_super to return errors
Prepare add_to_super to validate disks against the platform capabilities
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'super-intel.c')
-rw-r--r-- | super-intel.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/super-intel.c b/super-intel.c index 433fa46..d39b88ca 100644 --- a/super-intel.c +++ b/super-intel.c @@ -1911,7 +1911,7 @@ static int init_super_imsm(struct supertype *st, mdu_array_info_t *info, } #ifndef MDASSEMBLE -static void add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk, +static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk, int fd, char *devname) { struct intel_super *super = st->sb; @@ -1929,7 +1929,7 @@ static void add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk, break; if (!dl || ! (dk->state & (1<<MD_DISK_SYNC))) - return; + return 1; /* add a pristine spare to the metadata */ if (dl->index < 0) { @@ -1950,9 +1950,11 @@ static void add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk, sum = __gen_imsm_checksum(mpb); mpb->family_num = __cpu_to_le32(sum); } + + return 0; } -static void add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, +static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, int fd, char *devname) { struct intel_super *super = st->sb; @@ -1962,17 +1964,15 @@ static void add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, int rv; struct stat stb; - if (super->current_vol >= 0) { - add_to_super_imsm_volume(st, dk, fd, devname); - return; - } + if (super->current_vol >= 0) + return add_to_super_imsm_volume(st, dk, fd, devname); fstat(fd, &stb); dd = malloc(sizeof(*dd)); if (!dd) { fprintf(stderr, Name ": malloc failed %s:%d.\n", __func__, __LINE__); - abort(); + return 1; } memset(dd, 0, sizeof(*dd)); dd->major = major(stb.st_rdev); @@ -2005,6 +2005,8 @@ static void add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, dd->next = super->disks; super->disks = dd; } + + return 0; } static int store_imsm_mpb(int fd, struct intel_super *super); |