X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fmdadm.git;a=blobdiff_plain;f=super-gpt.c;h=fa7fdabea004092db104bc1f838f00a5f2b06be6;hp=f60a67148c92c44e7f4d4ed3dc0ea600e96f24b1;hb=72d566f68d495261608a900b2d8cb8d037cd9178;hpb=71204a50293035e5e7eb4807285ac0181c69e4f3 diff --git a/super-gpt.c b/super-gpt.c index f60a6714..fa7fdabe 100644 --- a/super-gpt.c +++ b/super-gpt.c @@ -76,8 +76,8 @@ static int load_gpt(struct supertype *st, int fd, char *devname) free_gpt(st); - if (posix_memalign((void**)&super, 512, 32*512) != 0) { - fprintf(stderr, Name ": %s could not allocate superblock\n", + if (posix_memalign((void**)&super, 4096, 32*512) != 0) { + pr_err("%s could not allocate superblock\n", __func__); return 1; } @@ -88,7 +88,7 @@ static int load_gpt(struct supertype *st, int fd, char *devname) if (read(fd, super, sizeof(*super)) != sizeof(*super)) { no_read: if (devname) - fprintf(stderr, Name ": Cannot read partition table on %s\n", + pr_err("Cannot read partition table on %s\n", devname); free(super); return 1; @@ -98,7 +98,7 @@ static int load_gpt(struct supertype *st, int fd, char *devname) super->parts[0].part_type != MBR_GPT_PARTITION_TYPE) { not_found: if (devname) - fprintf(stderr, Name ": No partition table found on %s\n", + pr_err("No partition table found on %s\n", devname); free(super); return 1; @@ -175,12 +175,14 @@ static void getinfo_gpt(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 = xmalloc(sizeof(*st)); if (!st) return st; - if (strcmp(arg, "gpt") != 0) + if (strcmp(arg, "gpt") != 0) { + free(st); return NULL; + } st->ss = &gpt; st->info = NULL; @@ -193,11 +195,11 @@ 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) { - fprintf(stderr, Name ": gpt metadata cannot be used this way\n"); + pr_err("gpt metadata cannot be used this way\n"); return 0; } #endif