]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: remove unneeded fields from struct bcache_super_block
authorSami Kerola <kerolasa@iki.fi>
Thu, 23 May 2019 20:06:23 +0000 (21:06 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 27 May 2019 09:58:13 +0000 (11:58 +0200)
This started as fix to following warning.

    libblkid/src/superblocks/bcache.c:33:3: warning: ISO C99 doesn’t
    support unnamed structs/unions [-Wc99-c11-compat]

But when sent to review Karel told out rather than getting rid of warnings
lets get rid of everything unnecessary.

[kzak@redhat.com: - use original struct member names rather than 'padN']

Reference: https://github.com/karelzak/util-linux/pull/802
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/superblocks/bcache.c

index 28eb24d5ff524779b5a4233408cac88f5f21b305..aa2dc04ec0ba2c6f7d1500b87da9362bbbd3558e 100644 (file)
 #define node(i, j)         ((i)->d + (j))
 #define end(i)             node(i, le16_to_cpu((i)->keys))
 
+/*
+ * The bcache_super_block is heavily simplified version of struct cache_sb in kernel.
+ * https://github.com/torvalds/linux/blob/master/include/uapi/linux/bcache.h
+ */
 struct bcache_super_block {
        uint64_t                csum;
-       uint64_t                offset; /* sector where this sb was written */
+       uint64_t                offset;         /* where this super block was written */
        uint64_t                version;
-
-       uint8_t                 magic[16];
-
-       uint8_t                 uuid[16];
-       union {
-               uint8_t         set_uuid[16];
-               uint64_t        set_magic;
-       };
-       uint8_t                 label[SB_LABEL_SIZE];
-
-       uint64_t                flags;
-       uint64_t                seq;
-       uint64_t                pad[8];
-
-       union {
-       struct {
-               /* Cache devices */
-               uint64_t        nbuckets;       /* device size */
-
-               uint16_t        block_size;     /* sectors */
-               uint16_t        bucket_size;    /* sectors */
-
-               uint16_t        nr_in_set;
-               uint16_t        nr_this_dev;
-       };
-       struct {
-               /* Backing devices */
-               uint64_t        data_offset;
-
-               /*
-                * block_size from the cache device section is still used by
-                * backing devices, so don't add anything here until we fix
-                * things to not need it for backing devices anymore
-                */
-       };
-       };
-
-       uint32_t                last_mount;     /* time_t */
-
-       uint16_t                first_bucket;
-       union {
-               uint16_t        njournal_buckets;
-               uint16_t        keys;
-       };
-       uint64_t                d[SB_JOURNAL_BUCKETS];  /* journal buckets */
+       uint8_t                 magic[16];      /* bcache file system identifier */
+       uint8_t                 uuid[16];       /* device identifier */
 };
 
 /* magic string */