]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
When assembly arrays using incomplete detail, prefer arrays built for this host.
[thirdparty/mdadm.git] / super0.c
index 85e54fc9bc7c5fa1a84fcab177fcbcb66af08f47..cc2f7a95a000c37bf1c0ab9646fcf0ca499835fe 100644 (file)
--- 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,