free_gpt(st);
if (posix_memalign((void**)&super, 4096, 32*512) != 0) {
- pr_err("%s could not allocate superblock\n",
- __func__);
+ pr_err("could not allocate superblock\n");
return 1;
}
- ioctl(fd, BLKFLSBUF, 0); /* make sure we read current data */
-
lseek(fd, 0, 0);
if (read(fd, super, sizeof(*super)) != sizeof(*super)) {
no_read:
free(super);
return 1;
}
-
+
if (super->magic != MBR_SIGNATURE_MAGIC ||
super->parts[0].part_type != MBR_GPT_PARTITION_TYPE) {
not_found:
static struct supertype *match_metadata_desc(char *arg)
{
- struct supertype *st = malloc(sizeof(*st));
+ struct supertype *st = xmalloc(sizeof(*st));
if (!st)
return st;
static int validate_geometry(struct supertype *st, int level,
int layout, int raiddisks,
int *chunk, unsigned long long size,
+ unsigned long long data_offset,
char *subdev, unsigned long long *freesize,
int verbose)
{