mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/7] ext4: change structure fields to __le/__be types
Date: Mon, 20 Mar 2017 15:35:26 +0300	[thread overview]
Message-ID: <20170320123532.24059-2-antonynpavlov@gmail.com> (raw)
In-Reply-To: <20170320123532.24059-1-antonynpavlov@gmail.com>

This is an adoption of the U-Boot commit

| commit 2a0b7a971aac682112cf676c6583196faafcb2b0
| Author: Michael Walle <michael@walle.cc>
| Date:   Mon Aug 29 10:46:43 2016 +0200
|
|     ext4: change structure fields to __le/__be types
|
|     Change all the types of ext2/4 fields to little endian types and all the
|     JBD fields to big endian types. Now we can use sparse (make C=1) to check
|     for statements where we need byteswaps.
|
|     Signed-off-by: Michael Walle <michael@walle.cc>

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 fs/ext4/ext_common.h | 136 +++++++++++++++++++++++++--------------------------
 1 file changed, 68 insertions(+), 68 deletions(-)

diff --git a/fs/ext4/ext_common.h b/fs/ext4/ext_common.h
index 704d8e66a..a8d86472e 100644
--- a/fs/ext4/ext_common.h
+++ b/fs/ext4/ext_common.h
@@ -79,92 +79,92 @@
 
 /* The ext2 superblock.  */
 struct ext2_sblock {
-	uint32_t total_inodes;
-	uint32_t total_blocks;
-	uint32_t reserved_blocks;
-	uint32_t free_blocks;
-	uint32_t free_inodes;
-	uint32_t first_data_block;
-	uint32_t log2_block_size;
-	uint32_t log2_fragment_size;
-	uint32_t blocks_per_group;
-	uint32_t fragments_per_group;
-	uint32_t inodes_per_group;
-	uint32_t mtime;
-	uint32_t utime;
-	uint16_t mnt_count;
-	uint16_t max_mnt_count;
-	uint16_t magic;
-	uint16_t fs_state;
-	uint16_t error_handling;
-	uint16_t minor_revision_level;
-	uint32_t lastcheck;
-	uint32_t checkinterval;
-	uint32_t creator_os;
-	uint32_t revision_level;
-	uint16_t uid_reserved;
-	uint16_t gid_reserved;
-	uint32_t first_inode;
-	uint16_t inode_size;
-	uint16_t block_group_number;
-	uint32_t feature_compatibility;
-	uint32_t feature_incompat;
-	uint32_t feature_ro_compat;
-	uint32_t unique_id[4];
+	__le32 total_inodes;
+	__le32 total_blocks;
+	__le32 reserved_blocks;
+	__le32 free_blocks;
+	__le32 free_inodes;
+	__le32 first_data_block;
+	__le32 log2_block_size;
+	__le32 log2_fragment_size;
+	__le32 blocks_per_group;
+	__le32 fragments_per_group;
+	__le32 inodes_per_group;
+	__le32 mtime;
+	__le32 utime;
+	__le16 mnt_count;
+	__le16 max_mnt_count;
+	__le16 magic;
+	__le16 fs_state;
+	__le16 error_handling;
+	__le16 minor_revision_level;
+	__le32 lastcheck;
+	__le32 checkinterval;
+	__le32 creator_os;
+	__le32 revision_level;
+	__le16 uid_reserved;
+	__le16 gid_reserved;
+	__le32 first_inode;
+	__le16 inode_size;
+	__le16 block_group_number;
+	__le32 feature_compatibility;
+	__le32 feature_incompat;
+	__le32 feature_ro_compat;
+	__le32 unique_id[4];
 	char volume_name[16];
 	char last_mounted_on[64];
-	uint32_t compression_info;
+	__le32 compression_info;
 };
 
 struct ext2_block_group {
-	__u32 block_id;	/* Blocks bitmap block */
-	__u32 inode_id;	/* Inodes bitmap block */
-	__u32 inode_table_id;	/* Inodes table block */
-	__u16 free_blocks;	/* Free blocks count */
-	__u16 free_inodes;	/* Free inodes count */
-	__u16 used_dir_cnt;	/* Directories count */
-	__u16 bg_flags;
-	__u32 bg_reserved[2];
-	__u16 bg_itable_unused; /* Unused inodes count */
-	__u16 bg_checksum;	/* crc16(s_uuid+grouo_num+group_desc)*/
+	__le32 block_id;	/* Blocks bitmap block */
+	__le32 inode_id;	/* Inodes bitmap block */
+	__le32 inode_table_id;	/* Inodes table block */
+	__le16 free_blocks;	/* Free blocks count */
+	__le16 free_inodes;	/* Free inodes count */
+	__le16 used_dir_cnt;	/* Directories count */
+	__le16 bg_flags;
+	__le32 bg_reserved[2];
+	__le16 bg_itable_unused; /* Unused inodes count */
+	__le16 bg_checksum;	/* crc16(s_uuid+grouo_num+group_desc)*/
 };
 
 /* The ext2 inode. */
 struct ext2_inode {
-	uint16_t mode;
-	uint16_t uid;
-	uint32_t size;
-	uint32_t atime;
-	uint32_t ctime;
-	uint32_t mtime;
-	uint32_t dtime;
-	uint16_t gid;
-	uint16_t nlinks;
-	uint32_t blockcnt;	/* Blocks of 512 bytes!! */
-	uint32_t flags;
-	uint32_t osd1;
+	__le16 mode;
+	__le16 uid;
+	__le32 size;
+	__le32 atime;
+	__le32 ctime;
+	__le32 mtime;
+	__le32 dtime;
+	__le16 gid;
+	__le16 nlinks;
+	__le32 blockcnt;	/* Blocks of 512 bytes!! */
+	__le32 flags;
+	__le32 osd1;
 	union {
 		struct datablocks {
-			uint32_t dir_blocks[INDIRECT_BLOCKS];
-			uint32_t indir_block;
-			uint32_t double_indir_block;
-			uint32_t triple_indir_block;
+			__le32 dir_blocks[INDIRECT_BLOCKS];
+			__le32 indir_block;
+			__le32 double_indir_block;
+			__le32 triple_indir_block;
 		} blocks;
 		char symlink[60];
 	} b;
-	uint32_t version;
-	uint32_t acl;
-	uint32_t dir_acl;
-	uint32_t fragment_addr;
-	uint32_t osd2[3];
+	__le32 version;
+	__le32 acl;
+	__le32 dir_acl;
+	__le32 fragment_addr;
+	__le32 osd2[3];
 };
 
 /* The header of an ext2 directory entry. */
 struct ext2_dirent {
-	uint32_t inode;
-	uint16_t direntlen;
-	uint8_t namelen;
-	uint8_t filetype;
+	__le32 inode;
+	__le16 direntlen;
+	__u8 namelen;
+	__u8 filetype;
 };
 
 struct ext2fs_node {
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2017-03-20 12:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20 12:35 [PATCH 0/7] fix ext4 support for volumes greater than 4 GiB Antony Pavlov
2017-03-20 12:35 ` Antony Pavlov [this message]
2017-03-20 12:35 ` [PATCH 2/7] ext4: use kernel names for byte swaps Antony Pavlov
2017-03-20 12:35 ` [PATCH 3/7] ext4: drop unused and misdefined INODE_SIZE_FILESYSTEM macro Antony Pavlov
2017-03-20 12:35 ` [PATCH 4/7] ext4: fix wrong usage of le32_to_cpu() Antony Pavlov
2017-03-20 12:35 ` [PATCH 5/7] ext4: Update ext2/3/4 superblock, group descriptor and inode structures Antony Pavlov
2017-03-20 12:35 ` [PATCH 6/7] ext4: determine group descriptor size for 64bit feature Antony Pavlov
2017-03-20 12:35 ` [PATCH 7/7] ext4: Use correct descriptor size when reading the block group descriptor Antony Pavlov
2017-03-22  6:57 ` [PATCH 0/7] fix ext4 support for volumes greater than 4 GiB Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170320123532.24059-2-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox