]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super1.c
Allow metadata handlers to free their own superblock.
[thirdparty/mdadm.git] / super1.c
index 52783e7766cf227ea26e99b85db2df59a34753ad..804a07e19ded275288dbe171019b85317f776f6c 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -182,7 +182,7 @@ static void examine_super1(void *sbv, char *homehost)
        printf("     Raid Level : %s\n", c?c:"-unknown-");
        printf("   Raid Devices : %d\n", __le32_to_cpu(sb->raid_disks));
        printf("\n");
-       printf("  Used Dev Size : %llu%s\n",
+       printf(" Avail Dev Size : %llu%s\n",
               (unsigned long long)__le64_to_cpu(sb->data_size),
               human_size(__le64_to_cpu(sb->data_size)<<9));
        if (__le32_to_cpu(sb->level) >= 0) {
@@ -202,7 +202,7 @@ static void examine_super1(void *sbv, char *homehost)
                               ddsks*(unsigned long long)__le64_to_cpu(sb->size),
                               human_size(ddsks*__le64_to_cpu(sb->size)<<9));
                if (sb->size != sb->data_size)
-                       printf("      Used Size : %llu%s\n",
+                       printf("  Used Dev Size : %llu%s\n",
                               (unsigned long long)__le64_to_cpu(sb->size),
                               human_size(__le64_to_cpu(sb->size)<<9));
        }
@@ -1001,7 +1001,7 @@ static int load_super1(struct supertype *st, int fd, void **sbp, char *devname)
                /* guess... choose latest ctime */
                tst.ss = &super1;
                for (tst.minor_version = 0; tst.minor_version <= 2 ; tst.minor_version++) {
-                       switch(load_super1(st, fd, sbp, devname)) {
+                       switch(load_super1(&tst, fd, sbp, devname)) {
                        case 0: super = *sbp;
                                if (bestvers == -1 ||
                                    bestctime < __le64_to_cpu(super->ctime)) {
@@ -1020,7 +1020,7 @@ static int load_super1(struct supertype *st, int fd, void **sbp, char *devname)
                        tst.minor_version = bestvers;
                        tst.ss = &super1;
                        tst.max_devs = 384;
-                       rv = load_super1(st, fd, sbp, devname);
+                       rv = load_super1(&tst, fd, sbp, devname);
                        if (rv == 0)
                                *st = tst;
                        return rv;
@@ -1366,6 +1366,12 @@ static int write_bitmap1(struct supertype *st, int fd, void *sbv)
        return rv;
 }
 
+static void free_super1(void *super)
+{
+       if (super)
+               free(super);
+}
+
 struct superswitch super1 = {
 #ifndef MDASSEMBLE
        .examine_super = examine_super1,
@@ -1389,6 +1395,7 @@ struct superswitch super1 = {
        .add_internal_bitmap = add_internal_bitmap1,
        .locate_bitmap = locate_bitmap1,
        .write_bitmap = write_bitmap1,
+       .free_super = free_super1,
        .major = 1,
 #if __BYTE_ORDER == BIG_ENDIAN
        .swapuuid = 0,