shithub: lwext4

Download patch

ref: 00affc044c56435a81fe070a53729c0f6fcbdc08
parent: 2651b659e1ad76ad7b5980573643b513b571be9e
author: gkostka <kostka.grzegorz@gmail.com>
date: Wed Sep 16 19:45:13 EDT 2015

Resolve some endianes issues

--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -153,7 +153,7 @@
 	/* Find a non-empty directory entry */
 	bool found = false;
 	while (it.current != NULL) {
-		if (it.current->inode != 0) {
+		if (ext4_dir_entry_ll_get_inode(it.current) != 0) {
 			uint16_t name_size = ext4_dir_entry_ll_get_name_length(
 			    &fs->sb, it.current);
 			if (!ext4_is_dots(it.current->name, name_size)) {
@@ -666,7 +666,7 @@
 		if (parent_inode)
 			*parent_inode = ref.index;
 
-		next_inode = result.dentry->inode;
+		next_inode = ext4_dir_entry_ll_get_inode(result.dentry);
 		inode_type =
 		    ext4_dir_entry_ll_get_inode_type(&mp->fs.sb, result.dentry);
 
@@ -806,7 +806,7 @@
 			break;
 		}
 
-		next_inode = result.dentry->inode;
+		next_inode = ext4_dir_entry_ll_get_inode(result.dentry);
 		inode_type =
 		    ext4_dir_entry_ll_get_inode_type(&mp->fs.sb, result.dentry);
 
@@ -1696,7 +1696,7 @@
 			if ((it.current->name_length == 2) &&
 			    ext4_is_dots(it.current->name,
 					 it.current->name_length)) {
-				inode_up = it.current->inode;
+				inode_up = ext4_dir_entry_ll_get_inode(it.current);
 			}
 
 			/*If directory or file entry,  but not "." ".." entry*/
@@ -1705,8 +1705,9 @@
 
 				/*Get child inode reference do unlink
 				 * directory/file.*/
-				r = ext4_fs_get_inode_ref(
-				    &f.mp->fs, it.current->inode, &child);
+				r = ext4_fs_get_inode_ref(&f.mp->fs,
+				        ext4_dir_entry_ll_get_inode(it.current),
+				        &child);
 				if (r != EOK)
 					break;
 
@@ -1721,7 +1722,7 @@
 					/*Has directory children. Go into this
 					 * directory.*/
 					inode_up = inode_current;
-					inode_current = it.current->inode;
+					inode_current = ext4_dir_entry_ll_get_inode(it.current);
 					depth++;
 					ext4_fs_put_inode_ref(&child);
 					break;
--- a/lwext4/ext4_dir.c
+++ b/lwext4/ext4_dir.c
@@ -180,7 +180,7 @@
 		if (!it->current)
 			break;
 		/*Skip NULL referenced entry*/
-		if (it->current->inode != 0)
+		if (ext4_dir_entry_ll_get_inode(it->current) != 0)
 			break;
 	}
 
@@ -531,7 +531,7 @@
 			break;
 
 		/* Valid entry - check it */
-		if (dentry->inode != 0) {
+		if (ext4_dir_entry_ll_get_inode(dentry) != 0) {
 			/* For more efficient compare only lengths firstly*/
 			if (ext4_dir_entry_ll_get_name_length(sb, dentry) ==
 			    name_len) {