shithub: lwext4

Download patch

ref: e86559d56de5796dba4a6c74d1663d814ef18a60
parent: bb389cbdc64a61a9b04966346735cb8efcfc68d1
author: gkostka <kostka.grzegorz@gmail.com>
date: Thu Nov 19 17:56:10 EST 2015

Fix style/indentaton in ext4_inode

--- a/lwext4/ext4_fs.c
+++ b/lwext4/ext4_fs.c
@@ -652,8 +652,8 @@
 			to_le32(ext4_inode_get_generation(inode_ref->inode));
 
 		/* Preparation: temporarily set bg checksum to 0 */
-		orig_checksum = ext4_inode_get_checksum(sb, inode_ref->inode);
-		ext4_inode_set_checksum(sb, inode_ref->inode, 0);
+		orig_checksum = ext4_inode_get_csum(sb, inode_ref->inode);
+		ext4_inode_set_csum(sb, inode_ref->inode, 0);
 
 		/* First calculate crc32 checksum against fs uuid */
 		checksum = ext4_crc32c(EXT4_CRC32_INIT, sb->uuid,
@@ -665,7 +665,7 @@
 		/* Finally calculate crc32 checksum against 
 		 * the entire inode */
 		checksum = ext4_crc32c(checksum, inode_ref->inode, inode_size);
-		ext4_inode_set_checksum(sb, inode_ref->inode, orig_checksum);
+		ext4_inode_set_csum(sb, inode_ref->inode, orig_checksum);
 
 		/* If inode size is not large enough to hold the
 		 * upper 16bit of the checksum */
@@ -686,7 +686,7 @@
 		return;
 
 	uint32_t csum = ext4_fs_inode_checksum(inode_ref);
-	ext4_inode_set_checksum(sb, inode_ref->inode, csum);
+	ext4_inode_set_csum(sb, inode_ref->inode, csum);
 }
 
 #if CONFIG_META_CSUM_ENABLE
@@ -696,7 +696,7 @@
 	if (!ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM))
 		return true;
 
-	return ext4_inode_get_checksum(sb, inode_ref->inode) ==
+	return ext4_inode_get_csum(sb, inode_ref->inode) ==
 		ext4_fs_inode_checksum(inode_ref);
 }
 #else
--- a/lwext4/ext4_inode.c
+++ b/lwext4/ext4_inode.c
@@ -108,8 +108,7 @@
 	inode->size_hi = to_le32(size >> 32);
 }
 
-uint32_t
-ext4_inode_get_checksum(struct ext4_sblock *sb, struct ext4_inode *inode)
+uint32_t ext4_inode_get_csum(struct ext4_sblock *sb, struct ext4_inode *inode)
 {
 	uint16_t inode_size = ext4_get16(sb, inode_size);
 	uint32_t v = to_le16(inode->osd2.linux2.checksum_lo);
@@ -120,8 +119,7 @@
 	return v;
 }
 
-void
-ext4_inode_set_checksum(struct ext4_sblock *sb, struct ext4_inode *inode,
+void ext4_inode_set_csum(struct ext4_sblock *sb, struct ext4_inode *inode,
 			uint32_t checksum)
 {
 	uint16_t inode_size = ext4_get16(sb, inode_size);
@@ -192,23 +190,22 @@
 uint64_t ext4_inode_get_blocks_count(struct ext4_sblock *sb,
 				     struct ext4_inode *inode)
 {
-	uint64_t count = to_le32(inode->blocks_count_lo);
+	uint64_t cnt = to_le32(inode->blocks_count_lo);
 
 	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_HUGE_FILE)) {
 
 		/* 48-bit field */
-		count |= ((uint64_t)to_le16(inode->osd2.linux2.blocks_high))
-			 << 32;
+		cnt |= (uint64_t)to_le16(inode->osd2.linux2.blocks_high) << 32;
 
 		if (ext4_inode_has_flag(inode, EXT4_INODE_FLAG_HUGE_FILE)) {
 
-			uint32_t block_bits = ext4_inode_block_bits_count(
-			    ext4_sb_get_block_size(sb));
-			return count << (block_bits - 9);
+			uint32_t block_count = ext4_sb_get_block_size(sb);
+			uint32_t b = ext4_inode_block_bits_count(block_count);
+			return cnt << (b - 9);
 		}
 	}
 
-	return count;
+	return cnt;
 }
 
 int ext4_inode_set_blocks_count(struct ext4_sblock *sb,
@@ -239,8 +236,8 @@
 		inode->osd2.linux2.blocks_high = to_le16(count >> 32);
 		ext4_inode_clear_flag(inode, EXT4_INODE_FLAG_HUGE_FILE);
 	} else {
-		uint32_t block_bits =
-		    ext4_inode_block_bits_count(ext4_sb_get_block_size(sb));
+		uint32_t block_count = ext4_sb_get_block_size(sb);
+		uint32_t block_bits =ext4_inode_block_bits_count(block_count);
 
 		ext4_inode_set_flag(inode, EXT4_INODE_FLAG_HUGE_FILE);
 		count = count >> (block_bits - 9);
@@ -285,8 +282,7 @@
 	uint64_t v = to_le32(inode->file_acl_lo);
 
 	if (ext4_get32(sb, creator_os) == EXT4_SUPERBLOCK_OS_LINUX)
-		v |= ((uint32_t)to_le16(inode->osd2.linux2.file_acl_high))
-		     << 16;
+		v |= (uint32_t)to_le16(inode->osd2.linux2.file_acl_high) << 16;
 
 	return v;
 }
--- a/lwext4/ext4_inode.h
+++ b/lwext4/ext4_inode.h
@@ -297,7 +297,7 @@
  * @param inode I-node to get checksum value from
  */
 uint32_t
-ext4_inode_get_checksum(struct ext4_sblock *sb, struct ext4_inode *inode);
+ext4_inode_get_csum(struct ext4_sblock *sb, struct ext4_inode *inode);
 
 /**@brief Get inode checksum(crc32)
  * @param sb    Superblock
@@ -304,7 +304,7 @@
  * @param inode I-node to get checksum value from
  */
 void
-ext4_inode_set_checksum(struct ext4_sblock *sb, struct ext4_inode *inode,
+ext4_inode_set_csum(struct ext4_sblock *sb, struct ext4_inode *inode,
 			uint32_t checksum);
 
 /**@brief Check if i-node can be truncated.