summaryrefslogtreecommitdiff
path: root/super1.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2007-12-14 20:14:27 +1100
committerNeil Brown <neilb@suse.de>2007-12-14 20:14:27 +1100
commit64557c33917a6f661d091e36ab00065d4107dcee (patch)
treedb872e93c086ff5db556d1236239e391de122738 /super1.c
parent68c7d6d790f856b4e8301d0afa7fc6873a0d4bb8 (diff)
downloadmdadm-64557c33917a6f661d091e36ab00065d4107dcee.tar.gz
Fix compare_super to take supertype instead of a superblock.
As this function takes 2 superblocks, the change is a bit more subtle, so is done separately.
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/super1.c b/super1.c
index a534c33..9bf5912 100644
--- a/super1.c
+++ b/super1.c
@@ -661,6 +661,7 @@ static int init_super1(struct supertype *st, void **sbp, mdu_array_info_t *info,
char defname[10];
memset(sb, 0, 1024);
+ st->sb = sb;
if (info->major_version == -1) {
/* zeroing superblock */
*sbp = sb;
@@ -947,7 +948,7 @@ static int write_init_super1(struct supertype *st, void *sbv,
return rv;
}
-static int compare_super1(void **firstp, void *secondv)
+static int compare_super1(struct supertype *st, struct supertype *tst)
{
/*
* return:
@@ -956,8 +957,8 @@ static int compare_super1(void **firstp, void *secondv)
* 2 wrong uuid
* 3 wrong other info
*/
- struct mdp_superblock_1 *first = *firstp;
- struct mdp_superblock_1 *second = secondv;
+ struct mdp_superblock_1 *first = st->sb;
+ struct mdp_superblock_1 *second = tst->sb;
if (second->magic != __cpu_to_le32(MD_SB_MAGIC))
return 1;
@@ -969,7 +970,7 @@ static int compare_super1(void **firstp, void *secondv)
sizeof(struct misc_dev_info));
memcpy(first, second, 1024+sizeof(bitmap_super_t) +
sizeof(struct misc_dev_info));
- *firstp = first;
+ st->sb = first;
return 0;
}
if (memcmp(first->set_uuid, second->set_uuid, 16)!= 0)
@@ -1106,6 +1107,7 @@ static int load_super1(struct supertype *st, int fd, void **sbp, char *devname)
free(super);
return 2;
}
+ st->sb = super;
*sbp = super;
bsb = (struct bitmap_super_s *)(((char*)super)+1024);
@@ -1144,6 +1146,7 @@ static struct supertype *match_metadata_desc1(char *arg)
st->ss = &super1;
st->max_devs = 384;
+ st->sb = NULL;
if (strcmp(arg, "1.0") == 0) {
st->minor_version = 0;
return st;