]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - util.c
fix: adding spare via incremental do not trigger recovery
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index 2a206448e4e2b07586d4baa7968941ef108afb86..7544ce17a3c760c9817a11d1f0b14208584c515b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1123,7 +1123,7 @@ struct supertype *super_by_fd(int fd, char **subarrayp)
 }
 #endif /* !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO) */
 
-int dev_size_from_id(unsigned int id, unsigned long long *size)
+int dev_size_from_id(dev_t id, unsigned long long *size)
 {
        char buf[20];
        int fd;
@@ -1681,13 +1681,18 @@ unsigned long long min_recovery_start(struct mdinfo *array)
        return recovery_start;
 }
 
-char *devnum2devname(int num)
+void fmt_devname(char *name, int num)
 {
-       char name[100];
        if (num >= 0)
                sprintf(name, "md%d", num);
        else
                sprintf(name, "md_d%d", -1-num);
+}
+
+char *devnum2devname(int num)
+{
+       char name[100];
+       fmt_devname(name,num);
        return strdup(name);
 }
 
@@ -1885,6 +1890,7 @@ void append_metadata_update(struct supertype *st, void *buf, int len)
        mu->buf = buf;
        mu->len = len;
        mu->space = NULL;
+       mu->space_list = NULL;
        mu->next = NULL;
        *st->update_tail = mu;
        st->update_tail = &mu->next;
@@ -1896,3 +1902,13 @@ void append_metadata_update(struct supertype *st, void *buf, int len)
 unsigned int __invalid_size_argument_for_IOC = 0;
 #endif
 
+int experimental(void)
+{
+       if (check_env("MDADM_EXPERIMENTAL"))
+               return 1;
+       else {
+               fprintf(stderr, Name ": To use this feature MDADM_EXPERIMENTAL enviroment variable has to defined.\n");
+               return 0;
+       }
+}
+