shithub: lwext4

Download patch

ref: 08450828b9e7998fb4316725abc4862761f9ed75
parent: 3bf6bcf4999ba59d843ff69256e03d1c6b411158
author: gkostka <[email protected]>
date: Sat Nov 21 13:59:15 EST 2015

Refactor some problematic (too long) dir entry data structures

--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -146,7 +146,7 @@
 		return EOK;
 	}
 
-	struct ext4_dir_iterator it;
+	struct ext4_dir_iter it;
 	int rc = ext4_dir_iterator_init(&it, enode, 0);
 	if (rc != EOK)
 		return rc;
@@ -154,9 +154,9 @@
 	/* Find a non-empty directory entry */
 	bool found = false;
 	while (it.curr != NULL) {
-		if (ext4_dir_entry_ll_get_inode(it.curr) != 0) {
+		if (ext4_dir_en_get_inode(it.curr) != 0) {
 			uint16_t nsize;
-			nsize = ext4_dir_entry_ll_get_name_length(sb, it.curr);
+			nsize = ext4_dir_en_get_name_len(sb, it.curr);
 			if (!ext4_is_dots(it.curr->name, nsize)) {
 				found = true;
 				break;
@@ -246,7 +246,7 @@
 			if (r != EOK)
 				return EIO;
 
-			ext4_dir_entry_ll_set_inode(res.dentry,	parent->index);
+			ext4_dir_en_set_inode(res.dentry, parent->index);
 			res.block.dirty = true;
 			r = ext4_dir_destroy_result(child, &res);
 			if (r != EOK)
@@ -659,10 +659,10 @@
 		if (parent_inode)
 			*parent_inode = ref.index;
 
-		next_inode = ext4_dir_entry_ll_get_inode(result.dentry);
+		next_inode = ext4_dir_en_get_inode(result.dentry);
 		if (ext4_sb_feature_incom(sb, EXT4_FINCOM_FILETYPE)) {
 			uint8_t t;
-			t = ext4_dir_entry_ll_get_inode_type(sb, result.dentry);
+			t = ext4_dir_en_get_inode_type(sb, result.dentry);
 			imode = ext4_fs_correspond_inode_mode(t);
 		} else {
 			struct ext4_inode_ref child_ref;
@@ -816,7 +816,7 @@
 		next_inode = result.dentry->inode;
 		if (ext4_sb_feature_incom(sb, EXT4_FINCOM_FILETYPE)) {
 			uint8_t t;
-			t = ext4_dir_entry_ll_get_inode_type(sb, result.dentry);
+			t = ext4_dir_en_get_inode_type(sb, result.dentry);
 			inode_mode = ext4_fs_correspond_inode_mode(t);
 		} else {
 			struct ext4_inode_ref child_ref;
@@ -2186,7 +2186,7 @@
 	struct ext4_mountpoint *mp = ext4_get_mount(path);
 	struct ext4_inode_ref act;
 	struct ext4_inode_ref child;
-	struct ext4_dir_iterator it;
+	struct ext4_dir_iter it;
 
 	uint32_t name_off;
 	uint32_t inode_up;
@@ -2241,18 +2241,18 @@
 			}
 
 			/*Get up directory inode when ".." entry*/
-			if ((it.curr->name_length == 2) &&
-			    ext4_is_dots(it.curr->name, it.curr->name_length)) {
-				inode_up = ext4_dir_entry_ll_get_inode(it.curr);
+			if ((it.curr->name_len == 2) &&
+			    ext4_is_dots(it.curr->name, it.curr->name_len)) {
+				inode_up = ext4_dir_en_get_inode(it.curr);
 			}
 
 			/*If directory or file entry,  but not "." ".." entry*/
-			if (!ext4_is_dots(it.curr->name, it.curr->name_length)) {
+			if (!ext4_is_dots(it.curr->name, it.curr->name_len)) {
 
 				/*Get child inode reference do unlink
 				 * directory/file.*/
 				uint32_t cinode;
-				cinode = ext4_dir_entry_ll_get_inode(it.curr);
+				cinode = ext4_dir_en_get_inode(it.curr);
 				r = ext4_fs_get_inode_ref(fs, cinode, &child);
 				if (r != EOK)
 					break;
@@ -2278,7 +2278,7 @@
 				 * unlink.*/
 				r = ext4_unlink(f.mp, &act, &child,
 						(char *)it.curr->name,
-						it.curr->name_length);
+						it.curr->name_len);
 				if (r != EOK) {
 					ext4_fs_put_inode_ref(&child);
 					break;
@@ -2433,7 +2433,7 @@
 	int r;
 	ext4_direntry *de = 0;
 	struct ext4_inode_ref dir;
-	struct ext4_dir_iterator it;
+	struct ext4_dir_iter it;
 
 	EXT4_MP_LOCK(d->f.mp);
 
--- a/lwext4/ext4_dir.c
+++ b/lwext4/ext4_dir.c
@@ -53,7 +53,7 @@
 /* Walk through a dirent block to find a checksum "dirent" at the tail */
 static struct ext4_dir_entry_tail *
 ext4_dir_get_tail(struct ext4_inode_ref *inode_ref,
-		struct ext4_dir_entry_ll *de)
+		struct ext4_dir_en *de)
 {
 	struct ext4_dir_entry_tail *t;
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
@@ -72,7 +72,7 @@
 
 #if CONFIG_META_CSUM_ENABLE
 static uint32_t ext4_dir_csum(struct ext4_inode_ref *inode_ref,
-			      struct ext4_dir_entry_ll *dirent, int size)
+			      struct ext4_dir_en *dirent, int size)
 {
 	uint32_t csum;
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
@@ -94,7 +94,7 @@
 #endif
 
 bool ext4_dir_csum_verify(struct ext4_inode_ref *inode_ref,
-			      struct ext4_dir_entry_ll *dirent)
+			      struct ext4_dir_en *dirent)
 {
 #ifdef CONFIG_META_CSUM_ENABLE
 	struct ext4_dir_entry_tail *t;
@@ -126,7 +126,7 @@
 }
 
 void ext4_dir_set_csum(struct ext4_inode_ref *inode_ref,
-			   struct ext4_dir_entry_ll *dirent)
+			   struct ext4_dir_en *dirent)
 {
 	struct ext4_dir_entry_tail *t;
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
@@ -150,7 +150,7 @@
  * @param block_size Size of data block
  * @return Error code
  */
-static int ext4_dir_iterator_set(struct ext4_dir_iterator *it,
+static int ext4_dir_iterator_set(struct ext4_dir_iter *it,
 				 uint32_t block_size)
 {
 	uint32_t off_in_block = it->curr_off % block_size;
@@ -166,16 +166,16 @@
 	if (off_in_block > block_size - 8)
 		return EIO;
 
-	struct ext4_dir_entry_ll *en;
+	struct ext4_dir_en *en;
 	en = (void *)(it->curr_blk.data + off_in_block);
 
 	/* Ensure that the whole entry does not overflow the block */
-	uint16_t length = ext4_dir_entry_ll_get_entry_length(en);
+	uint16_t length = ext4_dir_en_get_entry_len(en);
 	if (off_in_block + length > block_size)
 		return EIO;
 
 	/* Ensure the name length is not too large */
-	if (ext4_dir_entry_ll_get_name_length(sb, en) > length - 8)
+	if (ext4_dir_en_get_name_len(sb, en) > length - 8)
 		return EIO;
 
 	/* Everything OK - "publish" the entry */
@@ -189,7 +189,7 @@
  * @param pos Position of the next entry
  * @return Error code
  */
-static int ext4_dir_iterator_seek(struct ext4_dir_iterator *it, uint64_t pos)
+static int ext4_dir_iterator_seek(struct ext4_dir_iter *it, uint64_t pos)
 {
 	struct ext4_sblock *sb = &it->inode_ref->fs->sb;
 	struct ext4_inode *inode = it->inode_ref->inode;
@@ -250,7 +250,7 @@
 	return ext4_dir_iterator_set(it, block_size);
 }
 
-int ext4_dir_iterator_init(struct ext4_dir_iterator *it,
+int ext4_dir_iterator_init(struct ext4_dir_iter *it,
 			   struct ext4_inode_ref *inode_ref, uint64_t pos)
 {
 	it->inode_ref = inode_ref;
@@ -261,19 +261,19 @@
 	return ext4_dir_iterator_seek(it, pos);
 }
 
-int ext4_dir_iterator_next(struct ext4_dir_iterator *it)
+int ext4_dir_iterator_next(struct ext4_dir_iter *it)
 {
 	int r = EOK;
 	uint16_t skip;
 
 	while (r == EOK) {
-		skip = ext4_dir_entry_ll_get_entry_length(it->curr);
+		skip = ext4_dir_en_get_entry_len(it->curr);
 		r = ext4_dir_iterator_seek(it, it->curr_off + skip);
 
 		if (!it->curr)
 			break;
 		/*Skip NULL referenced entry*/
-		if (ext4_dir_entry_ll_get_inode(it->curr) != 0)
+		if (ext4_dir_en_get_inode(it->curr) != 0)
 			break;
 	}
 
@@ -280,7 +280,7 @@
 	return r;
 }
 
-int ext4_dir_iterator_fini(struct ext4_dir_iterator *it)
+int ext4_dir_iterator_fini(struct ext4_dir_iter *it)
 {
 	it->curr = 0;
 
@@ -290,7 +290,7 @@
 	return EOK;
 }
 
-void ext4_dir_write_entry(struct ext4_sblock *sb, struct ext4_dir_entry_ll *en,
+void ext4_dir_write_entry(struct ext4_sblock *sb, struct ext4_dir_en *en,
 			  uint16_t entry_len, struct ext4_inode_ref *child,
 			  const char *name, size_t name_len)
 {
@@ -300,13 +300,13 @@
 	/* Set type of entry */
 	switch (ext4_inode_type(sb, child->inode)) {
 	case EXT4_INODE_MODE_DIRECTORY:
-		ext4_dir_entry_ll_set_inode_type(sb, en, EXT4_DE_DIR);
+		ext4_dir_en_set_inode_type(sb, en, EXT4_DE_DIR);
 		break;
 	case EXT4_INODE_MODE_FILE:
-		ext4_dir_entry_ll_set_inode_type(sb, en, EXT4_DE_REG_FILE);
+		ext4_dir_en_set_inode_type(sb, en, EXT4_DE_REG_FILE);
 		break;
 	case EXT4_INODE_MODE_SOFTLINK:
-		ext4_dir_entry_ll_set_inode_type(sb, en, EXT4_DE_SYMLINK);
+		ext4_dir_en_set_inode_type(sb, en, EXT4_DE_SYMLINK);
 		break;
 	default:
 		/* FIXME: right now we only support 3 inode type. */
@@ -314,9 +314,9 @@
 	}
 
 	/* Set basic attributes */
-	ext4_dir_entry_ll_set_inode(en, child->index);
-	ext4_dir_entry_ll_set_entry_length(en, entry_len);
-	ext4_dir_entry_ll_set_name_length(sb, en, name_len);
+	ext4_dir_en_set_inode(en, child->index);
+	ext4_dir_en_set_entry_len(en, entry_len);
+	ext4_dir_en_set_name_len(sb, en, name_len);
 
 	/* Write name */
 	memcpy(en->name, name, name_len);
@@ -408,7 +408,7 @@
 
 	/* Fill block with zeroes */
 	memset(b.data, 0, block_size);
-	struct ext4_dir_entry_ll *blk_en = (void *)b.data;
+	struct ext4_dir_en *blk_en = (void *)b.data;
 
 	/* Save new block */
 	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
@@ -491,7 +491,7 @@
 		}
 
 		/* Try to find entry in block */
-		struct ext4_dir_entry_ll *res_entry;
+		struct ext4_dir_en *res_entry;
 		rc = ext4_dir_find_in_block(&b, sb, name_len, name, &res_entry);
 		if (rc == EOK) {
 			result->block = b;
@@ -524,7 +524,7 @@
 		return rc;
 
 	/* Invalidate entry */
-	ext4_dir_entry_ll_set_inode(result.dentry, 0);
+	ext4_dir_en_set_inode(result.dentry, 0);
 
 	/* Store entry position in block */
 	uint32_t pos = (uint8_t *)result.dentry - result.block.data;
@@ -537,14 +537,14 @@
 		uint32_t offset = 0;
 
 		/* Start from the first entry in block */
-		struct ext4_dir_entry_ll *tmp_de =(void *)result.block.data;
-		uint16_t de_len = ext4_dir_entry_ll_get_entry_length(tmp_de);
+		struct ext4_dir_en *tmp_de =(void *)result.block.data;
+		uint16_t de_len = ext4_dir_en_get_entry_len(tmp_de);
 
 		/* Find direct predecessor of removed entry */
 		while ((offset + de_len) < pos) {
-			offset += ext4_dir_entry_ll_get_entry_length(tmp_de);
+			offset += ext4_dir_en_get_entry_len(tmp_de);
 			tmp_de = (void *)(result.block.data + offset);
-			de_len = ext4_dir_entry_ll_get_entry_length(tmp_de);
+			de_len = ext4_dir_en_get_entry_len(tmp_de);
 		}
 
 		ext4_assert(de_len + offset == pos);
@@ -551,12 +551,12 @@
 
 		/* Add to removed entry length to predecessor's length */
 		uint16_t del_len;
-		del_len = ext4_dir_entry_ll_get_entry_length(result.dentry);
-		ext4_dir_entry_ll_set_entry_length(tmp_de, de_len + del_len);
+		del_len = ext4_dir_en_get_entry_len(result.dentry);
+		ext4_dir_en_set_entry_len(tmp_de, de_len + del_len);
 	}
 
 	ext4_dir_set_csum(parent,
-			(struct ext4_dir_entry_ll *)result.block.data);
+			(struct ext4_dir_en *)result.block.data);
 	result.block.dirty = true;
 
 	return ext4_dir_destroy_result(parent, &result);
@@ -576,8 +576,8 @@
 		required_len += 4 - (required_len % 4);
 
 	/* Initialize pointers, stop means to upper bound */
-	struct ext4_dir_entry_ll *start = (void *)dst_blk->data;
-	struct ext4_dir_entry_ll *stop = (void *)(dst_blk->data + block_size);
+	struct ext4_dir_en *start = (void *)dst_blk->data;
+	struct ext4_dir_en *stop = (void *)(dst_blk->data + block_size);
 
 	/*
 	 * Walk through the block and check for invalid entries
@@ -584,9 +584,9 @@
 	 * or entries with free space for new entry
 	 */
 	while (start < stop) {
-		uint32_t inode = ext4_dir_entry_ll_get_inode(start);
-		uint16_t rec_len = ext4_dir_entry_ll_get_entry_length(start);
-		uint8_t itype = ext4_dir_entry_ll_get_inode_type(sb, start);
+		uint32_t inode = ext4_dir_en_get_inode(start);
+		uint16_t rec_len = ext4_dir_en_get_entry_len(start);
+		uint8_t itype = ext4_dir_en_get_inode_type(sb, start);
 
 		/* If invalid and large enough entry, use it */
 		if ((inode == 0) && (itype != EXT4_DIRENTRY_DIR_CSUM) &&
@@ -602,7 +602,7 @@
 		/* Valid entry, try to split it */
 		if (inode != 0) {
 			uint16_t used_len;
-			used_len = ext4_dir_entry_ll_get_name_length(sb, start);
+			used_len = ext4_dir_en_get_name_len(sb, start);
 
 			uint16_t sz;
 			sz = sizeof(struct ext4_fake_dir_entry) + used_len;
@@ -615,9 +615,9 @@
 			/* There is free space for new entry */
 			if (free_space >= required_len) {
 				/* Cut tail of current entry */
-				struct ext4_dir_entry_ll * new_entry;
+				struct ext4_dir_en * new_entry;
 				new_entry = (void *)((uint8_t *)start + sz);
-				ext4_dir_entry_ll_set_entry_length(start, sz);
+				ext4_dir_en_set_entry_len(start, sz);
 				ext4_dir_write_entry(sb, new_entry, free_space,
 						     child, name, name_len);
 
@@ -638,10 +638,10 @@
 
 int ext4_dir_find_in_block(struct ext4_block *block, struct ext4_sblock *sb,
 			   size_t name_len, const char *name,
-			   struct ext4_dir_entry_ll **res_entry)
+			   struct ext4_dir_en **res_entry)
 {
 	/* Start from the first entry in block */
-	struct ext4_dir_entry_ll *de = (struct ext4_dir_entry_ll *)block->data;
+	struct ext4_dir_en *de = (struct ext4_dir_en *)block->data;
 
 	/* Set upper bound for cycling */
 	uint8_t *addr_limit = block->data + ext4_sb_get_block_size(sb);
@@ -653,9 +653,9 @@
 			break;
 
 		/* Valid entry - check it */
-		if (ext4_dir_entry_ll_get_inode(de) != 0) {
+		if (ext4_dir_en_get_inode(de) != 0) {
 			/* For more efficient compare only lengths firstly*/
-			uint16_t el = ext4_dir_entry_ll_get_name_length(sb, de);
+			uint16_t el = ext4_dir_en_get_name_len(sb, de);
 			if (el == name_len) {
 				/* Compare names */
 				if (memcmp(name, de->name, name_len) == 0) {
@@ -665,7 +665,7 @@
 			}
 		}
 
-		uint16_t de_len = ext4_dir_entry_ll_get_entry_length(de);
+		uint16_t de_len = ext4_dir_en_get_entry_len(de);
 
 		/* Corrupted entry */
 		if (de_len == 0)
@@ -672,7 +672,7 @@
 			return EINVAL;
 
 		/* Jump to next entry */
-		de = (struct ext4_dir_entry_ll *)((uint8_t *)de + de_len);
+		de = (struct ext4_dir_en *)((uint8_t *)de + de_len);
 	}
 
 	/* Entry not found */
--- a/lwext4/ext4_dir.h
+++ b/lwext4/ext4_dir.h
@@ -58,7 +58,7 @@
  * @return I-node number
  */
 static inline uint32_t
-ext4_dir_entry_ll_get_inode(struct ext4_dir_entry_ll *de)
+ext4_dir_en_get_inode(struct ext4_dir_en *de)
 {
 	return to_le32(de->inode);
 }
@@ -68,7 +68,7 @@
  * @param inode I-node number
  */
 static inline void
-ext4_dir_entry_ll_set_inode(struct ext4_dir_entry_ll *de, uint32_t inode)
+ext4_dir_en_set_inode(struct ext4_dir_en *de, uint32_t inode)
 {
 	de->inode = to_le32(inode);
 }
@@ -78,7 +78,7 @@
  * @param inode I-node number
  */
 static inline void
-ext4_dx_dot_entry_set_inode(struct ext4_dir_idx_dot_entry *de, uint32_t inode)
+ext4_dx_dot_en_set_inode(struct ext4_dir_idx_dot_en *de, uint32_t inode)
 {
 	de->inode = to_le32(inode);
 }
@@ -87,10 +87,9 @@
  * @param de Directory entry
  * @return Entry length
  */
-static inline uint16_t
-ext4_dir_entry_ll_get_entry_length(struct ext4_dir_entry_ll *de)
+static inline uint16_t ext4_dir_en_get_entry_len(struct ext4_dir_en *de)
 {
-	return to_le16(de->entry_length);
+	return to_le16(de->entry_len);
 }
 
 /**@brief Set directory entry length.
@@ -97,11 +96,9 @@
  * @param de     Directory entry
  * @param length Entry length
  */
-static inline void
-ext4_dir_entry_ll_set_entry_length(struct ext4_dir_entry_ll *de,
-				   uint16_t len)
+static inline void ext4_dir_en_set_entry_len(struct ext4_dir_en *de, uint16_t l)
 {
-	de->entry_length = to_le16(len);
+	de->entry_len = to_le16(l);
 }
 
 /**@brief Get directory entry name length.
@@ -109,11 +106,10 @@
  * @param de Directory entry
  * @return Entry name length
  */
-static inline uint16_t
-ext4_dir_entry_ll_get_name_length(struct ext4_sblock *sb,
-				  struct ext4_dir_entry_ll *de)
+static inline uint16_t ext4_dir_en_get_name_len(struct ext4_sblock *sb,
+						struct ext4_dir_en *de)
 {
-	uint16_t v = de->name_length;
+	uint16_t v = de->name_len;
 
 	if ((ext4_get32(sb, rev_level) == 0) &&
 	    (ext4_get32(sb, minor_rev_level) < 5))
@@ -127,10 +123,11 @@
  * @param de     Directory entry
  * @param length Entry name length
  */
-static inline void ext4_dir_entry_ll_set_name_length(
-    struct ext4_sblock *sb, struct ext4_dir_entry_ll *de, uint16_t len)
+static inline void ext4_dir_en_set_name_len(struct ext4_sblock *sb,
+					    struct ext4_dir_en *de,
+					    uint16_t len)
 {
-	de->name_length = (len << 8) >> 8;
+	de->name_len = (len << 8) >> 8;
 
 	if ((ext4_get32(sb, rev_level) == 0) &&
 	    (ext4_get32(sb, minor_rev_level) < 5))
@@ -142,9 +139,8 @@
  * @param de Directory entry
  * @return I-node type (file, dir, etc.)
  */
-static inline uint8_t
-ext4_dir_entry_ll_get_inode_type(struct ext4_sblock *sb,
-				 struct ext4_dir_entry_ll *de)
+static inline uint8_t ext4_dir_en_get_inode_type(struct ext4_sblock *sb,
+						 struct ext4_dir_en *de)
 {
 	if ((ext4_get32(sb, rev_level) > 0) ||
 	    (ext4_get32(sb, minor_rev_level) >= 5))
@@ -158,12 +154,12 @@
  * @param type I-node type (file, dir, etc.)
  */
 
-static inline void ext4_dir_entry_ll_set_inode_type(
-    struct ext4_sblock *sb, struct ext4_dir_entry_ll *de, uint8_t type)
+static inline void ext4_dir_en_set_inode_type(struct ext4_sblock *sb,
+					      struct ext4_dir_en *de, uint8_t t)
 {
 	if ((ext4_get32(sb, rev_level) > 0) ||
 	    (ext4_get32(sb, minor_rev_level) >= 5))
-		de->in.inode_type = type;
+		de->in.inode_type = t;
 }
 
 /**@brief Verify checksum of a linear directory leaf block
@@ -172,7 +168,7 @@
  * @return true means the block passed checksum verification
  */
 bool ext4_dir_csum_verify(struct ext4_inode_ref *inode_ref,
-			      struct ext4_dir_entry_ll *dirent);
+			  struct ext4_dir_en *dirent);
 
 /**@brief Initialize directory iterator.
  * Set position to the first valid entry from the required position.
@@ -181,7 +177,7 @@
  * @param pos       Position to start reading entries from
  * @return Error code
  */
-int ext4_dir_iterator_init(struct ext4_dir_iterator *it,
+int ext4_dir_iterator_init(struct ext4_dir_iter *it,
 			   struct ext4_inode_ref *inode_ref, uint64_t pos);
 
 /**@brief Jump to the next valid entry
@@ -188,7 +184,7 @@
  * @param it Initialized iterator
  * @return Error code
  */
-int ext4_dir_iterator_next(struct ext4_dir_iterator *it);
+int ext4_dir_iterator_next(struct ext4_dir_iter *it);
 
 /**@brief Uninitialize directory iterator.
  *        Release all allocated structures.
@@ -195,7 +191,7 @@
  * @param it Iterator to be finished
  * @return Error code
  */
-int ext4_dir_iterator_fini(struct ext4_dir_iterator *it);
+int ext4_dir_iterator_fini(struct ext4_dir_iter *it);
 
 /**@brief Write directory entry to concrete data block.
  * @param sb        Superblock
@@ -205,7 +201,7 @@
  * @param name      Name of the new entry
  * @param name_len  Length of entry name
  */
-void ext4_dir_write_entry(struct ext4_sblock *sb, struct ext4_dir_entry_ll *en,
+void ext4_dir_write_entry(struct ext4_sblock *sb, struct ext4_dir_en *en,
 			  uint16_t entry_len, struct ext4_inode_ref *child,
 			  const char *name, size_t name_len);
 
@@ -263,7 +259,7 @@
  */
 int ext4_dir_find_in_block(struct ext4_block *block, struct ext4_sblock *sb,
 			   size_t name_len, const char *name,
-			   struct ext4_dir_entry_ll **res_entry);
+			   struct ext4_dir_en **res_entry);
 
 /**@brief Simple function to release allocated data from result.
  * @param parent Parent inode
@@ -275,7 +271,7 @@
 			    struct ext4_dir_search_result *result);
 
 void ext4_dir_set_csum(struct ext4_inode_ref *inode_ref,
-			   struct ext4_dir_entry_ll *dirent);
+		       struct ext4_dir_en *dirent);
 
 
 void ext4_dir_init_entry_tail(struct ext4_dir_entry_tail *t);
--- a/lwext4/ext4_dir_idx.c
+++ b/lwext4/ext4_dir_idx.c
@@ -237,20 +237,20 @@
 
 static struct ext4_dir_idx_climit *
 ext4_dir_dx_get_climit(struct ext4_inode_ref *inode_ref,
-			   struct ext4_dir_entry_ll *dirent, int *offset)
+			   struct ext4_dir_en *dirent, int *offset)
 {
-	struct ext4_dir_entry_ll *dp;
+	struct ext4_dir_en *dp;
 	struct ext4_dir_idx_root *root;
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
 	uint32_t block_size = ext4_sb_get_block_size(sb);
-	uint16_t entry_len = ext4_dir_entry_ll_get_entry_length(dirent);
+	uint16_t entry_len = ext4_dir_en_get_entry_len(dirent);
 	int count_offset;
 
 
 	if (entry_len == 12) {
 		root = (struct ext4_dir_idx_root *)dirent;
-		dp = (struct ext4_dir_entry_ll *)&root->dots[1];
-		if (ext4_dir_entry_ll_get_entry_length(dp) != (block_size - 12))
+		dp = (struct ext4_dir_en *)&root->dots[1];
+		if (ext4_dir_en_get_entry_len(dp) != (block_size - 12))
 			return NULL;
 		if (root->info.reserved_zero)
 			return NULL;
@@ -273,7 +273,7 @@
  *       Currently we do not verify the checksum of HTree node.
  */
 static bool ext4_dir_dx_csum_verify(struct ext4_inode_ref *inode_ref,
-				    struct ext4_dir_entry_ll *de)
+				    struct ext4_dir_en *de)
 {
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
 	uint32_t block_size = ext4_sb_get_block_size(sb);
@@ -306,7 +306,7 @@
 
 
 static void ext4_dir_set_dx_csum(struct ext4_inode_ref *inode_ref,
-				 struct ext4_dir_entry_ll *dirent)
+				 struct ext4_dir_en *dirent)
 {
 	int coff, limit, count;
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
@@ -362,13 +362,13 @@
 	struct ext4_dir_idx_rinfo *info = &(root->info);
 
 	memset(root, 0, sizeof(struct ext4_dir_idx_root));
-	struct ext4_dir_entry_ll *de;
+	struct ext4_dir_en *de;
 
 	/* Initialize dot entries */
-	de = (struct ext4_dir_entry_ll *)root->dots;
+	de = (struct ext4_dir_en *)root->dots;
 	ext4_dir_write_entry(sb, de, 12, dir, ".", strlen("."));
 
-	de = (struct ext4_dir_entry_ll *)(root->dots + 1);
+	de = (struct ext4_dir_en *)(root->dots + 1);
 	uint16_t elen = block_size - 12;
 	ext4_dir_write_entry(sb, de, elen, parent, "..", strlen(".."));
 
@@ -386,7 +386,7 @@
 	ext4_dir_dx_climit_set_count(climit, 1);
 
 	uint32_t entry_space;
-	entry_space = block_size - 2 * sizeof(struct ext4_dir_idx_dot_entry) -
+	entry_space = block_size - 2 * sizeof(struct ext4_dir_idx_dot_en) -
 			sizeof(struct ext4_dir_idx_rinfo);
 
 	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM))
@@ -410,20 +410,20 @@
 	}
 
 	/* Fill the whole block with empty entry */
-	struct ext4_dir_entry_ll *be = (void *)new_block.data;
+	struct ext4_dir_en *be = (void *)new_block.data;
 
 	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		uint16_t len = block_size - sizeof(struct ext4_dir_entry_tail);
-		ext4_dir_entry_ll_set_entry_length(be, len);
-		ext4_dir_entry_ll_set_name_length(sb, be, 0);
-		ext4_dir_entry_ll_set_inode_type(sb, be, EXT4_DE_UNKNOWN);
+		ext4_dir_en_set_entry_len(be, len);
+		ext4_dir_en_set_name_len(sb, be, 0);
+		ext4_dir_en_set_inode_type(sb, be, EXT4_DE_UNKNOWN);
 		ext4_dir_init_entry_tail(EXT4_DIRENT_TAIL(be, block_size));
 		ext4_dir_set_csum(dir, be);
 	} else {
-		ext4_dir_entry_ll_set_entry_length(be, block_size);
+		ext4_dir_en_set_entry_len(be, block_size);
 	}
 
-	ext4_dir_entry_ll_set_inode(be, 0);
+	ext4_dir_en_set_inode(be, 0);
 
 	new_block.dirty = true;
 	rc = ext4_block_set(dir->fs->bdev, &new_block);
@@ -436,7 +436,7 @@
 	struct ext4_dir_idx_entry *entry = root->en;
 	ext4_dir_dx_entry_set_block(entry, iblock);
 
-	ext4_dir_set_dx_csum(dir, (struct ext4_dir_entry_ll *)block.data);
+	ext4_dir_set_dx_csum(dir, (struct ext4_dir_en *)block.data);
 	block.dirty = true;
 
 	return ext4_block_set(dir->fs->bdev, &block);
@@ -474,7 +474,7 @@
 	/* Check if node limit is correct */
 	uint32_t block_size = ext4_sb_get_block_size(sb);
 	uint32_t entry_space = block_size;
-	entry_space -= 2 * sizeof(struct ext4_dir_idx_dot_entry);
+	entry_space -= 2 * sizeof(struct ext4_dir_idx_dot_en);
 	entry_space -= sizeof(struct ext4_dir_idx_rinfo);
 	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM))
 		entry_space -= sizeof(struct ext4_dir_idx_tail);
@@ -771,7 +771,7 @@
 		}
 
 		/* Linear search inside block */
-		struct ext4_dir_entry_ll *de;
+		struct ext4_dir_en *de;
 		rc = ext4_dir_find_in_block(&b, &fs->sb, name_len, name, &de);
 
 		/* Found => return it */
@@ -927,7 +927,7 @@
 		return ENOMEM;
 
 	/* dot entry has the smallest size available */
-	uint32_t max_ecnt = block_size / sizeof(struct ext4_dir_idx_dot_entry);
+	uint32_t max_ecnt = block_size / sizeof(struct ext4_dir_idx_dot_en);
 
 	/* Allocate sort entry */
 	struct ext4_dx_sort_entry *sort;
@@ -946,12 +946,12 @@
 	memcpy(&hinfo_tmp, hinfo, sizeof(struct ext4_hash_info));
 
 	/* Load all valid entries to the buffer */
-	struct ext4_dir_entry_ll *de = (void *)old_data_block->data;
+	struct ext4_dir_en *de = (void *)old_data_block->data;
 	uint8_t *entry_buffer_ptr = entry_buffer;
 	while ((void *)de < (void *)(old_data_block->data + block_size)) {
 		/* Read only valid entries */
-		if (ext4_dir_entry_ll_get_inode(de) && de->name_length) {
-			uint8_t len = ext4_dir_entry_ll_get_name_length(sb, de);
+		if (ext4_dir_en_get_inode(de) && de->name_len) {
+			uint8_t len = ext4_dir_en_get_name_len(sb, de);
 			rc = ext4_dir_dx_hash_string(&hinfo_tmp, len,
 						     (char *)de->name);
 			if (rc != EOK) {
@@ -975,7 +975,7 @@
 			idx++;
 		}
 
-		size_t elen = ext4_dir_entry_ll_get_entry_length(de);
+		size_t elen = ext4_dir_en_get_entry_len(de);
 		de = (void *)((uint8_t *)de + elen);
 	}
 
@@ -1039,11 +1039,11 @@
 		ptr = old_data_block->data + off;
 		memcpy(ptr, sort[i].dentry, sort[i].rec_len);
 
-		struct ext4_dir_entry_ll *t = ptr;
+		struct ext4_dir_en *t = ptr;
 		if (i < (mid - 1))
-			ext4_dir_entry_ll_set_entry_length(t, sort[i].rec_len);
+			ext4_dir_en_set_entry_len(t, sort[i].rec_len);
 		else
-			ext4_dir_entry_ll_set_entry_length(t, block_size - off);
+			ext4_dir_en_set_entry_len(t, block_size - off);
 
 		off += sort[i].rec_len;
 	}
@@ -1054,11 +1054,11 @@
 		ptr = new_data_block_tmp.data + off;
 		memcpy(ptr, sort[i].dentry, sort[i].rec_len);
 
-		struct ext4_dir_entry_ll *t = ptr;
+		struct ext4_dir_en *t = ptr;
 		if (i < (idx - 1))
-			ext4_dir_entry_ll_set_entry_length(t, sort[i].rec_len);
+			ext4_dir_en_set_entry_len(t, sort[i].rec_len);
 		else
-			ext4_dir_entry_ll_set_entry_length(t, block_size - off);
+			ext4_dir_en_set_entry_len(t, block_size - off);
 
 		off += sort[i].rec_len;
 	}
@@ -1189,7 +1189,7 @@
 			if (position_index >= count_left) {
 				ext4_dir_set_dx_csum(
 						ino_ref,
-						(struct ext4_dir_entry_ll *)
+						(struct ext4_dir_en *)
 						dxb->b.data);
 				dxb->b.dirty = true;
 
@@ -1415,7 +1415,7 @@
 	struct ext4_dir_idx_root *root = (void *)block.data;
 
 	/* Fill the inode field with a new parent ino. */
-	ext4_dx_dot_entry_set_inode(&root->dots[1], parent_inode);
+	ext4_dx_dot_en_set_inode(&root->dots[1], parent_inode);
 
 	ext4_dir_set_dx_csum(dir, (void *)block.data);
 	block.dirty = true;
--- a/lwext4/ext4_types.h
+++ b/lwext4/ext4_types.h
@@ -485,7 +485,7 @@
 
 #define EXT4_DIRENTRY_DIR_CSUM 0xDE
 
-union ext4_dir_entry_ll_internal {
+union ext4_dir_en_internal {
 	uint8_t name_length_high; /* Higher 8 bits of name length */
 	uint8_t inode_type;       /* Type of referenced inode (in rev >= 0.5) */
 } __attribute__((packed));
@@ -493,26 +493,26 @@
 /**
  * Linked list directory entry structure
  */
-struct ext4_dir_entry_ll {
+struct ext4_dir_en {
 	uint32_t inode;	/* I-node for the entry */
-	uint16_t entry_length; /* Distance to the next directory entry */
-	uint8_t name_length;   /* Lower 8 bits of name length */
+	uint16_t entry_len; /* Distance to the next directory entry */
+	uint8_t name_len;   /* Lower 8 bits of name length */
 
-	union ext4_dir_entry_ll_internal in;
+	union ext4_dir_en_internal in;
 
 	uint8_t name[EXT4_DIRECTORY_FILENAME_LEN]; /* Entry name */
 } __attribute__((packed));
 
-struct ext4_dir_iterator {
+struct ext4_dir_iter {
 	struct ext4_inode_ref *inode_ref;
 	struct ext4_block curr_blk;
 	uint64_t curr_off;
-	struct ext4_dir_entry_ll *curr;
+	struct ext4_dir_en *curr;
 };
 
 struct ext4_dir_search_result {
 	struct ext4_block block;
-	struct ext4_dir_entry_ll *dentry;
+	struct ext4_dir_en *dentry;
 };
 
 /* Structures for indexed directory */
@@ -522,7 +522,7 @@
 	uint16_t count;
 };
 
-struct ext4_dir_idx_dot_entry {
+struct ext4_dir_idx_dot_en {
 	uint32_t inode;
 	uint16_t entry_length;
 	uint8_t name_length;
@@ -544,7 +544,7 @@
 };
 
 struct ext4_dir_idx_root {
-	struct ext4_dir_idx_dot_entry dots[2];
+	struct ext4_dir_idx_dot_en dots[2];
 	struct ext4_dir_idx_rinfo info;
 	struct ext4_dir_idx_entry en[];
 };