Browse Source

FIX: in-inode EA entries not having their e_value_offs set correctly.

pull/8/head
ngkaho1234 9 years ago
parent
commit
a1504e63d4
  1. 16
      lwext4/ext4.c
  2. 3
      lwext4/ext4_xattr.c

16
lwext4/ext4.c

@ -739,17 +739,17 @@ static int ext4_generic_open2(ext4_file *f, const char *path, int flags,
private_ret = ext4_fs_get_xattr_ref(&f->mp->fs, &ref,
&xattr_ref);
if (private_ret == EOK) {
#define EXT4_XATTR_TEST_DATA_SIZE 1024
#define EXT4_XATTR_TEST_DATA_SIZE 20
#define EXT4_XATTR_TEST_NAME "bad_boy"
static char test_data[EXT4_XATTR_TEST_DATA_SIZE] = {'a'};
ext4_dmask_set(EXT4_DEBUG_ALL);
/*ext4_fs_set_xattr(&xattr_ref,*/
/*EXT4_XATTR_INDEX_USER,*/
/*EXT4_XATTR_TEST_NAME,*/
/*strlen(EXT4_XATTR_TEST_NAME),*/
/*test_data,*/
/*EXT4_XATTR_TEST_DATA_SIZE,*/
/*0);*/
ext4_fs_set_xattr(&xattr_ref,
EXT4_XATTR_INDEX_USER,
EXT4_XATTR_TEST_NAME,
strlen(EXT4_XATTR_TEST_NAME),
test_data,
EXT4_XATTR_TEST_DATA_SIZE,
0);
ext4_fs_put_xattr_ref(&xattr_ref);
}
}

3
lwext4/ext4_xattr.c

@ -629,7 +629,8 @@ ext4_xattr_write_to_disk(struct ext4_xattr_ref *xattr_ref)
entry->e_name_len = to_le32(item->name_len);
entry->e_name_index = item->name_index;
entry->e_value_offs =
(char *)ibody_data - (char *)ibody_header;
(char *)ibody_data -
(char *)EXT4_XATTR_IFIRST(ibody_header);
entry->e_value_block = 0;
entry->e_value_size = item->data_size;
memcpy(EXT4_XATTR_NAME(entry), item->name, item->name_len);

Loading…
Cancel
Save