shithub: lwext4

Download patch

ref: a1504e63d4fd0852c4203f43a1bcb4fb7d425aa2
parent: 15ace36d9b3bcb9699b5aed7196916de8694de6c
author: ngkaho1234 <[email protected]>
date: Mon Oct 5 20:16:09 EDT 2015

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

--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -739,17 +739,17 @@
 			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);
 			}
 		}
--- a/lwext4/ext4_xattr.c
+++ b/lwext4/ext4_xattr.c
@@ -629,7 +629,8 @@
 				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);