diff options
author | Neil Brown <neilb@suse.de> | 2005-05-04 01:44:18 +0200 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2005-05-04 01:44:18 +0200 |
commit | 4b1ac34b51a3783ab528b1af307156fab057b543 (patch) | |
tree | c8588c2bc60c5ee0c1b5c189667e6592927f213c /Kill.c | |
parent | Release 1.11.0 (diff) | |
download | mdadm-4b1ac34b51a3783ab528b1af307156fab057b543.tar.xz mdadm-4b1ac34b51a3783ab528b1af307156fab057b543.zip |
Separate sueprblock handling into separate file
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Diffstat (limited to 'Kill.c')
-rw-r--r-- | Kill.c | 30 |
1 files changed, 8 insertions, 22 deletions
@@ -41,7 +41,7 @@ int Kill(char *dev, int force) * Definitely not safe. */ - mdp_super_t super; + void *super; int fd, rv = 0; fd = open(dev, O_RDWR|O_EXCL); @@ -50,32 +50,18 @@ int Kill(char *dev, int force) dev); return 1; } - rv = load_super(fd, &super); - if (force && rv >= 5) + rv = load_super0(fd, &super, dev); + if (force && rv >= 2) rv = 0; /* ignore bad data in superblock */ - switch(rv) { - case 1: - fprintf(stderr, Name ": cannot file device size for %s: %s\n", - dev, strerror(errno)); - break; - case 2: - fprintf(stderr, Name ": %s is too small for md.\n", dev); - break; - case 3: - case 4: - fprintf(stderr, Name ": cannot access superblock on %s.\n", dev); - break; - case 5: - case 6: - fprintf(stderr, Name ": %s does not appear to have an MD superblock.\n", dev); - break; - } - if (!rv) { + if (rv== 0 || (force && rv >= 2)) { memset(&super, 0, sizeof(super)); - if (store_super(fd, &super)) { + if (store_super0(fd, super)) { fprintf(stderr, Name ": Could not zero superblock on %s\n", dev); rv = 1; + } else if (rv) { + fprintf(stderr, Name ": superblock zeroed anyway\n"); + rv = 0; } } close(fd); |