summaryrefslogtreecommitdiffstats
path: root/super0.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-05-23 06:33:28 +0000
committerNeil Brown <neilb@suse.de>2006-05-23 06:33:28 +0000
commit83b6208e890f29115c56a252de82dfd7c50488d0 (patch)
treeccf7ab891b274cc805602a6400ee2736c03101a6 /super0.c
parent811e6cbed7cc06e6946e4a851710fb1e8cb36fd5 (diff)
downloadmdadm-83b6208e890f29115c56a252de82dfd7c50488d0.tar.gz
mdadm-83b6208e890f29115c56a252de82dfd7c50488d0.tar.xz
mdadm-83b6208e890f29115c56a252de82dfd7c50488d0.zip
When assembly arrays using incomplete detail, prefer arrays built for this host.
i.e. if assembling with --name or --super-minor, then if we find two different arrays with the same apparent identity, and one was built for 'this' host, then prefer that one instead of giving up in disgust. Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'super0.c')
-rw-r--r--super0.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/super0.c b/super0.c
index 85e54fc..cc2f7a9 100644
--- a/super0.c
+++ b/super0.c
@@ -269,6 +269,17 @@ static void brief_detail_super0(void *sbv)
printf("%08x", sb->set_uuid0);
}
#endif
+
+static int match_home0(void *sbv, char *homehost)
+{
+ mdp_super_t *sb = sbv;
+ unsigned char *hash = SHA1((unsigned char *)homehost,
+ strlen(homehost),
+ NULL);
+
+ return (memcmp(&sb->set_uuid2, hash, 8)==0);
+}
+
static void uuid_from_super0(int uuid[4], void * sbv)
{
mdp_super_t *super = sbv;
@@ -942,6 +953,7 @@ struct superswitch super0 = {
.detail_super = detail_super0,
.brief_detail_super = brief_detail_super0,
#endif
+ .match_home = match_home0,
.uuid_from_super = uuid_from_super0,
.getinfo_super = getinfo_super0,
.update_super = update_super0,