summaryrefslogtreecommitdiffstats
path: root/super0.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 /super0.c
parent68c7d6d790f856b4e8301d0afa7fc6873a0d4bb8 (diff)
downloadmdadm-64557c33917a6f661d091e36ab00065d4107dcee.tar.gz
mdadm-64557c33917a6f661d091e36ab00065d4107dcee.tar.xz
mdadm-64557c33917a6f661d091e36ab00065d4107dcee.zip
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 'super0.c')
-rw-r--r--super0.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/super0.c b/super0.c
index b81037e..873fd95 100644
--- a/super0.c
+++ b/super0.c
@@ -535,6 +535,7 @@ static int init_super0(struct supertype *st, void **sbp, mdu_array_info_t *info,
int spares;
memset(sb, 0, MD_SB_BYTES + sizeof(bitmap_super_t));
+ st->sb = sb;
if (info->major_version == -1) {
/* zeroing the superblock */
*sbp = sb;
@@ -675,7 +676,7 @@ static int write_init_super0(struct supertype *st, void *sbv, mdu_disk_info_t *d
return rv;
}
-static int compare_super0(void **firstp, void *secondv)
+static int compare_super0(struct supertype *st, struct supertype *tst)
{
/*
* return:
@@ -684,16 +685,16 @@ static int compare_super0(void **firstp, void *secondv)
* 2 wrong uuid
* 3 wrong other info
*/
- mdp_super_t *first = *firstp;
- mdp_super_t *second = secondv;
-
+ mdp_super_t *first = st->sb;
+ mdp_super_t *second = tst->sb;
int uuid1[4], uuid2[4];
+
if (second->md_magic != MD_SB_MAGIC)
return 1;
if (!first) {
first = malloc(MD_SB_BYTES + sizeof(struct bitmap_super_s));
memcpy(first, second, MD_SB_BYTES + sizeof(struct bitmap_super_s));
- *firstp = first;
+ st->sb = first;
return 0;
}
@@ -781,6 +782,7 @@ static int load_super0(struct supertype *st, int fd, void **sbp, char *devname)
free(super);
return 2;
}
+ st->sb = super;
*sbp = super;
if (st->ss == NULL) {
st->ss = &super0;
@@ -820,6 +822,7 @@ static struct supertype *match_metadata_desc0(char *arg)
st->ss = &super0;
st->minor_version = 90;
st->max_devs = MD_SB_DISKS;
+ st->sb = NULL;
if (strcmp(arg, "0") == 0 ||
strcmp(arg, "0.90") == 0 ||
strcmp(arg, "default") == 0