]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - util.c
Introduce MaxSector
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index 662061b0b29fd61dcf7e5b3041e3d4a8c7a33938..d49a4edd4a100ed0b6ecc303f2a3f003331ea3cf 100644 (file)
--- a/util.c
+++ b/util.c
@@ -261,9 +261,9 @@ int enough(int level, int raid_disks, int layout, int clean,
                } while (first != 0);
                return 1;
 
-       case -4:
+       case LEVEL_MULTIPATH:
                return avail_disks>= 1;
-       case -1:
+       case LEVEL_LINEAR:
        case 0:
                return avail_disks == raid_disks;
        case 1:
@@ -336,17 +336,15 @@ void copy_uuid(void *a, int b[4], int swapuuid)
                memcpy(a, b, 16);
 }
 
-char *fname_from_uuid(struct supertype *st, struct mdinfo *info, char *buf, char sep)
+char *__fname_from_uuid(int id[4], int swap, char *buf, char sep)
 {
        int i, j;
-       int id;
        char uuid[16];
        char *c = buf;
        strcpy(c, "UUID-");
        c += strlen(c);
-       copy_uuid(uuid, info->uuid, st->ss->swapuuid);
+       copy_uuid(uuid, id, swap);
        for (i = 0; i < 4; i++) {
-               id = uuid[i];
                if (i)
                        *c++ = sep;
                for (j = 3; j >= 0; j--) {
@@ -355,6 +353,12 @@ char *fname_from_uuid(struct supertype *st, struct mdinfo *info, char *buf, char
                }
        }
        return buf;
+
+}
+
+char *fname_from_uuid(struct supertype *st, struct mdinfo *info, char *buf, char sep)
+{
+       return __fname_from_uuid(info->uuid, st->ss->swapuuid, buf, sep);
 }
 
 #ifndef MDASSEMBLE
@@ -1206,7 +1210,7 @@ int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
 char *devnum2devname(int num)
 {
        char name[100];
-       if (num > 0)
+       if (num >= 0)
                sprintf(name, "md%d", num);
        else
                sprintf(name, "md_d%d", -1-num);