diff --git a/lwext4/ext4.c b/lwext4/ext4.c index 8b13cc9..9ffffb3 100644 --- a/lwext4/ext4.c +++ b/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); } } diff --git a/lwext4/ext4_xattr.c b/lwext4/ext4_xattr.c index 2a4b12f..f43d5a4 100644 --- a/lwext4/ext4_xattr.c +++ b/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);