]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
imsm: fix mpb_size calculation in write_super_imsm
[thirdparty/mdadm.git] / super0.c
index ae9e662afc525a37fc76167891765d68f7e1e520..24ea009a9354fa314058a8b0743f35abcd29d1fc 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -301,18 +301,6 @@ static void brief_detail_super0(struct supertype *st)
        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)
@@ -370,6 +358,7 @@ static void getinfo_super0(struct supertype *st, struct mdinfo *info)
        info->data_offset = 0;
 
        sprintf(info->text_version, "0.%d", sb->minor_version);
+       info->safe_mode_delay = 200;
 
        uuid_from_super0(st, info->uuid);
 
@@ -633,6 +622,8 @@ struct devinfo {
        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)
@@ -660,6 +651,7 @@ static void add_to_super0(struct supertype *st, mdu_disk_info_t *dinfo,
        di->next = NULL;
        *dip = di;
 }
+#endif
 
 static int store_super0(struct supertype *st, int fd)
 {
@@ -889,6 +881,9 @@ static struct supertype *match_metadata_desc0(char *arg)
        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 ||
@@ -1035,10 +1030,12 @@ static void free_super0(struct supertype *st)
        st->sb = NULL;
 }
 
+#ifndef MDASSEMBLE
 static int validate_geometry0(struct supertype *st, int level,
                              int layout, int raiddisks,
                              int chunk, unsigned long long size,
-                             char *subdev, unsigned long long *freesize)
+                             char *subdev, unsigned long long *freesize,
+                             int verbose)
 {
        unsigned long long ldsize;
        int fd;
@@ -1054,10 +1051,12 @@ static int validate_geometry0(struct supertype *st, int level,
 
        fd = open(subdev, O_RDONLY|O_EXCL, 0);
        if (fd < 0) {
-               fprintf(stderr, Name ": Cannot open %s: %s\n",
-                       subdev, strerror(errno));
+               if (verbose)
+                       fprintf(stderr, Name ": super0.90 cannot open %s: %s\n",
+                               subdev, strerror(errno));
                return 0;
        }
+
        if (!get_dev_size(fd, subdev, &ldsize)) {
                close(fd);
                return 0;
@@ -1071,6 +1070,7 @@ static int validate_geometry0(struct supertype *st, int level,
        *freesize = MD_NEW_SIZE_SECTORS(ldsize >> 9);
        return 1;
 }
+#endif /* MDASSEMBLE */
 
 struct superswitch super0 = {
 #ifndef MDASSEMBLE
@@ -1079,15 +1079,15 @@ struct superswitch super0 = {
        .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,
@@ -1097,5 +1097,4 @@ struct superswitch super0 = {
        .locate_bitmap = locate_bitmap0,
        .write_bitmap = write_bitmap0,
        .free_super = free_super0,
-       .validate_geometry = validate_geometry0,
 };