]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-ddf.c
Assemble: allow members of containers to be assembled and auto-assembled.
[thirdparty/mdadm.git] / super-ddf.c
index 527e32635da56fe61f60fb2e3cab08f11fe3c8a8..98e75ad6948902cbc1a751f853e99c6d8b067471 100644 (file)
@@ -446,7 +446,10 @@ static int calc_crc(void *buf, int len)
 
        newcrc = crc32(0, buf, len);
        ddf->crc = oldcrc;
-       return newcrc;
+       /* The crc is store (like everything) bigendian, so convert
+        * here for simplicity
+        */
+       return __cpu_to_be32(newcrc);
 }
 
 static int load_ddf_header(int fd, unsigned long long lba,
@@ -1134,7 +1137,7 @@ static void brief_examine_super_ddf(struct supertype *st)
        char nbuf[64];
        getinfo_super_ddf(st, &info);
        fname_from_uuid(st, &info, nbuf, ':');
-       printf("ARRAY /dev/ddf metadata=ddf UUID=%s\n", nbuf + 5);
+       printf("ARRAY metadata=ddf UUID=%s\n", nbuf + 5);
 }
 
 static void detail_super_ddf(struct supertype *st, char *homehost)
@@ -3076,6 +3079,8 @@ static void ddf_process_update(struct supertype *st,
                               mppe * (sizeof(__u32) + sizeof(__u64)));
                } else {
                        /* A new VD_CONF */
+                       if (!update->space)
+                               return;
                        vcl = update->space;
                        update->space = NULL;
                        vcl->next = ddf->conflist;
@@ -3136,9 +3141,10 @@ static void ddf_prepare_update(struct supertype *st,
        struct ddf_super *ddf = st->sb;
        __u32 *magic = (__u32*)update->buf;
        if (*magic == DDF_VD_CONF_MAGIC)
-               posix_memalign(&update->space, 512,
+               if (posix_memalign(&update->space, 512,
                               offsetof(struct vcl, conf)
-                              + ddf->conf_rec_len * 512);
+                              + ddf->conf_rec_len * 512) != 0)
+                       update->space = NULL;
 }
 
 /*