]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super1.c
Remove stray semicolon
[thirdparty/mdadm.git] / super1.c
index 887db10c5f4cc6f1e863702c71d606a1c30c21e0..fe915f8d921ca498d02eef3a9cf92dfaedec8f22 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -375,6 +375,40 @@ static void brief_examine_super1(struct supertype *st)
        printf("\n");
 }
 
+static void export_examine_super1(struct supertype *st)
+{
+       struct mdp_superblock_1 *sb = st->sb;
+       int i;
+       int len = 32;
+
+       printf("MD_LEVEL=%s\n", map_num(pers, __le32_to_cpu(sb->level)));
+       printf("MD_DEVICES=%d\n", __le32_to_cpu(sb->raid_disks));
+       for (i=0; i<32; i++)
+               if (sb->set_name[i] == '\n' ||
+                   sb->set_name[i] == '\0') {
+                       len = i;
+                       break;
+               }
+       if (len)
+               printf("MD_NAME=%.*s\n", len, sb->set_name);
+       printf("MD_UUID=");
+       for (i=0; i<16; i++) {
+               if ((i&3)==0 && i != 0) printf(":");
+               printf("%02x", sb->set_uuid[i]);
+       }
+       printf("\n");
+       printf("MD_UPDATE_TIME=%llu\n",
+              __le64_to_cpu(sb->utime) & 0xFFFFFFFFFFULL);
+       printf("MD_DEV_UUID=");
+       for (i=0; i<16; i++) {
+               if ((i&3)==0 && i != 0) printf(":");
+               printf("%02x", sb->device_uuid[i]);
+       }
+       printf("\n");
+       printf("MD_EVENTS=%llu\n",
+              (unsigned long long)__le64_to_cpu(sb->events));
+}
+
 static void detail_super1(struct supertype *st, char *homehost)
 {
        struct mdp_superblock_1 *sb = st->sb;
@@ -408,7 +442,7 @@ static void brief_detail_super1(struct supertype *st)
        }
 }
 
-static void export_super1(struct supertype *st)
+static void export_detail_super1(struct supertype *st)
 {
        struct mdp_superblock_1 *sb = st->sb;
        int i;
@@ -905,7 +939,7 @@ static int write_init_super1(struct supertype *st,
         * for a bitmap.
         */
        array_size = __le64_to_cpu(sb->size);
-       /* work out how much space we left of a bitmap */
+       /* work out how much space we left for a bitmap */
        bm_space = choose_bm_space(array_size);
 
        switch(st->minor_version) {
@@ -915,6 +949,8 @@ static int write_init_super1(struct supertype *st,
                sb_offset &= ~(4*2-1);
                sb->super_offset = __cpu_to_le64(sb_offset);
                sb->data_offset = __cpu_to_le64(0);
+               if (sb_offset - bm_space < array_size)
+                       bm_space = sb_offset - array_size;
                sb->data_size = __cpu_to_le64(sb_offset - bm_space);
                break;
        case 1:
@@ -1384,9 +1420,10 @@ struct superswitch super1 = {
 #ifndef MDASSEMBLE
        .examine_super = examine_super1,
        .brief_examine_super = brief_examine_super1,
+       .export_examine_super = export_examine_super1,
        .detail_super = detail_super1,
        .brief_detail_super = brief_detail_super1,
-       .export_super = export_super1,
+       .export_detail_super = export_detail_super1,
 #endif
        .match_home = match_home1,
        .uuid_from_super = uuid_from_super1,