diff options
author | Neil Brown <neilb@suse.de> | 2005-05-04 01:44:32 +0200 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2005-05-04 01:44:32 +0200 |
commit | f9ce90ba509d0b624cc38635861b9c27550fbefc (patch) | |
tree | de5576f6c939e0fd95f76030b4d273fdfc9f5945 /Kill.c | |
parent | Separate sueprblock handling into separate file (diff) | |
download | mdadm-f9ce90ba509d0b624cc38635861b9c27550fbefc.tar.xz mdadm-f9ce90ba509d0b624cc38635861b9c27550fbefc.zip |
Add a 'super-switch' so that different format superblocks can be used.
This includes:
adding --metadata= option to choose metadata format
adding metadata= word to config file.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Diffstat (limited to 'Kill.c')
-rw-r--r-- | Kill.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -43,19 +43,28 @@ int Kill(char *dev, int force) void *super; int fd, rv = 0; + struct superswitch *ss; fd = open(dev, O_RDWR|O_EXCL); if (fd < 0) { fprintf(stderr, Name ": Couldn't open %s for write - not zeroing\n", dev); return 1; - } - rv = load_super0(fd, &super, dev); + } + ss = guess_super(fd, dev); + if (ss == NULL) { + fprintf(stderr, Name ": Unrecognised md component device - %s\n", dev); + return 1; + } + rv = ss->load_super(fd, &super, dev); if (force && rv >= 2) rv = 0; /* ignore bad data in superblock */ if (rv== 0 || (force && rv >= 2)) { - memset(&super, 0, sizeof(super)); - if (store_super0(fd, super)) { + mdu_array_info_t info; + info.major_version = -1; /* zero superblock */ + free(super); + ss->init_super(&super, &info); + if (ss->store_super(fd, super)) { fprintf(stderr, Name ": Could not zero superblock on %s\n", dev); rv = 1; |