]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Update to support the V2 Bestbits EA format.
authorTheodore Ts'o <tytso@mit.edu>
Wed, 22 May 2002 04:22:38 +0000 (00:22 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 22 May 2002 04:22:38 +0000 (00:22 -0400)
e2fsck/ChangeLog
e2fsck/pass1.c
lib/ext2fs/ChangeLog
lib/ext2fs/ext2_ext_attr.h

index 15b5d48b408199c5889b58c6acc8f977a5135c23..5952bdcb6aa75ef72d540df4aaf0286fca4865d2 100644 (file)
@@ -1,3 +1,9 @@
+2002-05-22  Theodore Ts'o  <tytso@mit.edu>
+
+       * pass1.c (check_ext_attr): Update to support the V2 Bestbits EA
+               format.  We automatically determine from the first EA
+               block we visit whether we are using the V1 or V2 format.
+
 2002-05-21  Theodore Ts'o  <tytso@mit.edu>
 
        * pass1.c (process_block): If an inode has too many blocks or
index c8eee89ebd1f5df704b86ed66927f3ba889f612d..b15e120be954d4eef55d25486c957127110dde1b 100644 (file)
@@ -984,6 +984,7 @@ static int check_ext_attr(e2fsck_t ctx, struct problem_context *pctx,
        struct ext2_ext_attr_entry *entry;
        int             count;
        region_t        region;
+       int             ext_attr_ver;
        
        blk = inode->i_file_acl;
        if (blk == 0)
@@ -1061,10 +1062,13 @@ static int check_ext_attr(e2fsck_t ctx, struct problem_context *pctx,
                goto clear_extattr;
        header = (struct ext2_ext_attr_header *) block_buf;
        pctx->blk = inode->i_file_acl;
-       if (header->h_magic != EXT2_EXT_ATTR_MAGIC) {
-               if (fix_problem(ctx, PR_1_BAD_EA_BLOCK, pctx))
-                       goto clear_extattr;
-       }
+       if (header->h_magic != EXT2_EXT_ATTR_MAGIC_v1)
+               ext_attr_ver = 1;
+       if (header->h_magic != EXT2_EXT_ATTR_MAGIC)
+               ext_attr_ver = 2;
+       else if (fix_problem(ctx, PR_1_BAD_EA_BLOCK, pctx))
+               goto clear_extattr;
+
        if (header->h_blocks != 1) {
                if (fix_problem(ctx, PR_1_EA_MULTI_BLOCK, pctx))
                        goto clear_extattr;
@@ -1089,7 +1093,10 @@ static int check_ext_attr(e2fsck_t ctx, struct problem_context *pctx,
                        if (fix_problem(ctx, PR_1_EA_ALLOC_COLLISION, pctx))
                                goto clear_extattr;
                }
-               if (entry->e_name_len == 0 || entry->e_name_index != 0) {
+               if ((ext_attr_ver == 1 &&
+                    (entry->e_name_len == 0 || entry->e_name_index != 0)) ||
+                   (ext_attr_ver == 2 &&
+                    entry->e_name_index == 0)) {
                        if (fix_problem(ctx, PR_1_EA_BAD_NAME, pctx))
                                goto clear_extattr;
                }
index 7569f2b629f95e2faee09a1a78ca6f1b73f1a7de..f8d08d9696852306e9594ade4007b111a6556d68 100644 (file)
@@ -1,3 +1,7 @@
+2002-05-21  Theodore Ts'o  <tytso@mit.edu>
+
+       * ext2_ext_attr.h: Update to V2 version of the Bestbits format.
+
 2002-05-16  Andreas Dilger <adilger@clusterfs.com>
 
        * ext2_fs.h: Change limits to support filesystems with 8k blocks.
index 504f747f147fdefa6957b833cb3afdb657836517..7fff2669ab37493b2bf94f8e85ac7dfba114223e 100644 (file)
@@ -7,7 +7,8 @@
 */
 
 /* Magic value in attribute blocks */
-#define EXT2_EXT_ATTR_MAGIC            0xEA010000
+#define EXT2_EXT_ATTR_MAGIC_v1         0xEA010000
+#define EXT2_EXT_ATTR_MAGIC            0xEA020000
 
 /* Maximum number of references to one attribute block */
 #define EXT2_EXT_ATTR_REFCOUNT_MAX     1024
@@ -22,7 +23,7 @@ struct ext2_ext_attr_header {
 
 struct ext2_ext_attr_entry {
        __u8    e_name_len;     /* length of name */
-       __u8    e_name_index;   /* index into table of names (n/i) */
+       __u8    e_name_index;   /* attribute name index */
        __u16   e_value_offs;   /* offset in disk block of value */
        __u32   e_value_block;  /* disk block attribute is stored on (n/i) */
        __u32   e_value_size;   /* size of attribute value */