]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: fix binary and source compatibility with the dump program
authorTheodore Ts'o <tytso@mit.edu>
Thu, 15 Sep 2011 19:44:56 +0000 (15:44 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 15 Sep 2011 19:44:56 +0000 (15:44 -0400)
The dump program relies on fs->frag_size and the
EXT2_FRAGS_PER_BLOCK() macro.  Kind of silly for it to do so, but it's
part of the kludgy way the dump program (which was originally written
for the BSD FFS was ported over to support ext2/3.)  Given how it
makes assumptions about the ext2/3/4 file system being similar to the
BSD FFS, it's a bit of a miracle it works for ext4 --- or at least
appears to work...

Addresses-Debian-Bug: #636418

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/ext2_fs.h
lib/ext2fs/ext2fs.h
lib/ext2fs/initialize.c
lib/ext2fs/openfs.c

index 2d960910c540812cc94e1047274f390036a43eb2..a3e1c5becd07a632639f2fedd02eb68c631ee0f5 100644 (file)
                                                (s)->s_log_cluster_size)
 #define EXT2_CLUSTER_SIZE_BITS(s)      ((s)->s_log_cluster_size + 10)
 
+/*
+ * Macro-instructions used to manage fragments
+ *
+ * Note: for backwards compatibility only, for the dump program.
+ * Ext2/3/4 will never support fragments....
+ */
+#define EXT2_MIN_FRAG_SIZE              EXT2_MIN_BLOCK_SIZE
+#define EXT2_MAX_FRAG_SIZE              EXT2_MAX_BLOCK_SIZE
+#define EXT2_MIN_FRAG_LOG_SIZE          EXT2_MIN_BLOCK_LOG_SIZE
+#define EXT2_FRAG_SIZE(s)              EXT2_BLOCK_SIZE(s)
+#define EXT2_FRAGS_PER_BLOCK(s)                1
+
 /*
  * ACL structures
  */
index 5379422ba44ec2b0c8a62dd06c35a8b76e53e104..9e92e946e2753677ddac27317d2890ec11c5cb06 100644 (file)
@@ -195,7 +195,7 @@ struct struct_ext2_filsys {
        char *                          device_name;
        struct ext2_super_block *       super;
        unsigned int                    blocksize;
-       int                             cluster_ratio_bits;
+       int                             fragsize;
        dgrp_t                          group_desc_count;
        unsigned long                   desc_blocks;
        struct ext2_group_desc *        group_desc;
@@ -216,10 +216,11 @@ struct struct_ext2_filsys {
        struct ext2_image_hdr *         image_header;
        __u32                           umask;
        time_t                          now;
+       int                             cluster_ratio_bits;
        /*
         * Reserved for future expansion
         */
-       __u32                           reserved[7];
+       __u32                           reserved[6];
 
        /*
         * Reserved for the use of the calling application.
index b9d45aefcd7219cac281a76faf34c63165ead8ac..79f893a56876b189558d4d4c7093d15ab34351a1 100644 (file)
@@ -177,7 +177,7 @@ errcode_t ext2fs_initialize(const char *name, int flags,
 
        super->s_creator_os = CREATOR_OS;
 
-       fs->blocksize = EXT2_BLOCK_SIZE(super);
+       fs->fragsize = fs->blocksize = EXT2_BLOCK_SIZE(super);
        fs->cluster_ratio_bits = super->s_log_cluster_size -
                super->s_log_block_size;
 
index a598ca04a39921188d476982f37cf2d61f13ca00..0f1df20753549ddb2298a9412d2447d348a15f3f 100644 (file)
@@ -245,7 +245,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
                retval = EXT2_ET_CORRUPT_SUPERBLOCK;
                goto cleanup;
        }
-       fs->blocksize = EXT2_BLOCK_SIZE(fs->super);
+       fs->fragsize = fs->blocksize = EXT2_BLOCK_SIZE(fs->super);
        if (EXT2_INODE_SIZE(fs->super) < EXT2_GOOD_OLD_INODE_SIZE) {
                retval = EXT2_ET_CORRUPT_SUPERBLOCK;
                goto cleanup;