]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-mbr.c
__write_init_super_ddf(): Use posix_memalign() instead of static aligned buffer
[thirdparty/mdadm.git] / super-mbr.c
index 0751e17cec965fd9182e8a53613070157bf3f07e..64999637229452477cddfcb9340ff20c3c27e48a 100644 (file)
@@ -80,9 +80,6 @@ static int load_super_mbr(struct supertype *st, int fd, char *devname)
 
        free_mbr(st);
 
-       if (st->subarray[0])
-               return 1;
-
        if (posix_memalign((void**)&super, 512, 512) != 0) {
                fprintf(stderr, Name ": %s could not allocate superblock\n",
                        __func__);
@@ -172,13 +169,14 @@ static void getinfo_mbr(struct supertype *st, struct mdinfo *info, char *map)
 
 static struct supertype *match_metadata_desc(char *arg)
 {
-       struct supertype *st = malloc(sizeof(*st));
+       struct supertype *st;
 
-       if (!st)
-               return st;
        if (strcmp(arg, "mbr") != 0)
                return NULL;
 
+       st = malloc(sizeof(*st));
+       if (!st)
+               return st;
        st->ss = &mbr;
        st->info = NULL;
        st->minor_version = 0;
@@ -190,7 +188,7 @@ static struct supertype *match_metadata_desc(char *arg)
 #ifndef MDASSEMBLE
 static int validate_geometry(struct supertype *st, int level,
                             int layout, int raiddisks,
-                            int chunk, unsigned long long size,
+                            int *chunk, unsigned long long size,
                             char *subdev, unsigned long long *freesize,
                             int verbose)
 {
@@ -202,8 +200,8 @@ static int validate_geometry(struct supertype *st, int level,
 struct superswitch mbr = {
 #ifndef MDASSEMBLE
        .examine_super = examine_mbr,
-#endif
        .validate_geometry = validate_geometry,
+#endif
        .match_metadata_desc = match_metadata_desc,
        .load_super = load_super_mbr,
        .store_super = store_mbr,