From: Theodore Ts'o Date: Wed, 22 May 2002 04:22:38 +0000 (-0400) Subject: Update to support the V2 Bestbits EA format. X-Git-Tag: E2FSPROGS-1.28-WIP-0626~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d63467ddb76ef0c08481b74dae1fc7d6f364d1d;p=thirdparty%2Fe2fsprogs.git Update to support the V2 Bestbits EA format. --- diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 15b5d48b4..5952bdcb6 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,9 @@ +2002-05-22 Theodore Ts'o + + * 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 * pass1.c (process_block): If an inode has too many blocks or diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index c8eee89eb..b15e120be 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -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; } diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 7569f2b62..f8d08d969 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,7 @@ +2002-05-21 Theodore Ts'o + + * ext2_ext_attr.h: Update to V2 version of the Bestbits format. + 2002-05-16 Andreas Dilger * ext2_fs.h: Change limits to support filesystems with 8k blocks. diff --git a/lib/ext2fs/ext2_ext_attr.h b/lib/ext2fs/ext2_ext_attr.h index 504f747f1..7fff2669a 100644 --- a/lib/ext2fs/ext2_ext_attr.h +++ b/lib/ext2fs/ext2_ext_attr.h @@ -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 */