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,
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)
mppe * (sizeof(__u32) + sizeof(__u64)));
} else {
/* A new VD_CONF */
+ if (!update->space)
+ return;
vcl = update->space;
update->space = NULL;
vcl->next = ddf->conflist;
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;
}
/*
/* Cool, we have a device with some space at pos */
di = malloc(sizeof(*di));
+ if (!di)
+ continue;
memset(di, 0, sizeof(*di));
di->disk.number = i;
di->disk.raid_disk = i;
* phys_refnum and lba_offset values
*/
mu = malloc(sizeof(*mu));
+ if (mu && posix_memalign(&mu->space, 512, sizeof(struct vcl)) != 0) {
+ free(mu);
+ mu = NULL;
+ }
+ if (!mu) {
+ while (rv) {
+ struct mdinfo *n = rv->next;
+
+ free(rv);
+ rv = n;
+ }
+ return NULL;
+ }
+
mu->buf = malloc(ddf->conf_rec_len * 512);
- posix_memalign(&mu->space, 512, sizeof(struct vcl));
mu->len = ddf->conf_rec_len;
mu->next = *updates;
vc = find_vdcr(ddf, a->info.container_member);