char *c;
printf(" Magic : %08x\n", sb->md_magic);
- printf(" Version : %02d.%02d.%02d\n", sb->major_version, sb->minor_version,
+ printf(" Version : %d.%02d.%02d\n", sb->major_version, sb->minor_version,
sb->patch_version);
if (sb->minor_version >= 90) {
printf(" UUID : %08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
printf(" Layout : %s\n", c?c:"-unknown-");
}
if (sb->level == 10) {
- printf(" Layout : near=%d, %s=%d\n",
- sb->layout&255,
- (sb->layout&0x10000)?"offset":"far",
- (sb->layout>>8)&255);
+ printf(" Layout :");
+ print_r10_layout(sb->layout);
+ printf("\n");
}
switch(sb->level) {
case 0:
else
printf("%08x", sb->set_uuid0);
}
-
-static void export_detail_super0(struct supertype *st)
-{
- mdp_super_t *sb = st->sb;
- printf("MD_UUID=");
- if (sb->minor_version >= 90)
- printf("%08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
- sb->set_uuid2, sb->set_uuid3);
- else
- printf("%08x", sb->set_uuid0);
- printf("\n");
-}
#endif
static int match_home0(struct supertype *st, char *homehost)
mdp_super_t *sb;
int spares;
- posix_memalign((void**)&sb, 512, MD_SB_BYTES + sizeof(bitmap_super_t));
+ if (posix_memalign((void**)&sb, 512, MD_SB_BYTES + sizeof(bitmap_super_t)) != 0) {
+ fprintf(stderr, Name ": %s could not allocate superblock\n", __func__);
+ return 0;
+ }
memset(sb, 0, MD_SB_BYTES + sizeof(bitmap_super_t));
st->sb = sb;
mdu_disk_info_t disk;
struct devinfo *next;
};
+
+#ifndef MDASSEMBLE
/* Add a device to the superblock being created */
static void add_to_super0(struct supertype *st, mdu_disk_info_t *dinfo,
int fd, char *devname)
di->next = NULL;
*dip = di;
}
+#endif
static int store_super0(struct supertype *st, int fd)
{
if (second->md_magic != MD_SB_MAGIC)
return 1;
if (!first) {
- posix_memalign((void**)&first, 512,
- MD_SB_BYTES + sizeof(struct bitmap_super_s));
+ if (posix_memalign((void**)&first, 512,
+ MD_SB_BYTES + sizeof(struct bitmap_super_s)) != 0) {
+ fprintf(stderr, Name
+ ": %s could not allocate superblock\n", __func__);
+ return 1;
+ }
memcpy(first, second, MD_SB_BYTES + sizeof(struct bitmap_super_s));
st->sb = first;
return 0;
return 1;
}
- posix_memalign((void**)&super, 512, MD_SB_BYTES + sizeof(bitmap_super_t)+512);
+ if (posix_memalign((void**)&super, 512,
+ MD_SB_BYTES + sizeof(bitmap_super_t)+512) != 0) {
+ fprintf(stderr, Name
+ ": %s could not allocate superblock\n", __func__);
+ return 1;
+ }
if (read(fd, super, sizeof(*super)) != MD_SB_BYTES) {
if (devname)
st->minor_version = 90;
st->max_devs = MD_SB_DISKS;
st->sb = NULL;
+ /* we sometimes get 00.90 */
+ while (arg[0] == '0' && arg[1] == '0')
+ arg++;
if (strcmp(arg, "0") == 0 ||
strcmp(arg, "0.90") == 0 ||
strcmp(arg, "default") == 0 ||
st->sb = NULL;
}
+#ifndef MDASSEMBLE
static int validate_geometry0(struct supertype *st, int level,
int layout, int raiddisks,
int chunk, unsigned long long size,
*freesize = MD_NEW_SIZE_SECTORS(ldsize >> 9);
return 1;
}
+#endif /* MDASSEMBLE */
struct superswitch super0 = {
#ifndef MDASSEMBLE
.export_examine_super = export_examine_super0,
.detail_super = detail_super0,
.brief_detail_super = brief_detail_super0,
- .export_detail_super = export_detail_super0,
.write_init_super = write_init_super0,
+ .validate_geometry = validate_geometry0,
+ .add_to_super = add_to_super0,
#endif
.match_home = match_home0,
.uuid_from_super = uuid_from_super0,
.getinfo_super = getinfo_super0,
.update_super = update_super0,
.init_super = init_super0,
- .add_to_super = add_to_super0,
.store_super = store_super0,
.compare_super = compare_super0,
.load_super = load_super0,
.locate_bitmap = locate_bitmap0,
.write_bitmap = write_bitmap0,
.free_super = free_super0,
- .validate_geometry = validate_geometry0,
};