From patchwork Mon Aug 29 08:46:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 663510 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3sN4z036mYz9sBM for ; Mon, 29 Aug 2016 18:47:24 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=walle.cc header.i=@walle.cc header.b=mDwjBdg9; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B42AF4B811; Mon, 29 Aug 2016 10:47:19 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TfVJ8Pwk6uEB; Mon, 29 Aug 2016 10:47:19 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CA8C24B698; Mon, 29 Aug 2016 10:47:18 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7C6924B698 for ; Mon, 29 Aug 2016 10:47:12 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2-O9b7Bvrw-h for ; Mon, 29 Aug 2016 10:47:12 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from ssl.serverraum.org (ssl.serverraum.org [213.133.101.245]) by theia.denx.de (Postfix) with ESMTPS id C44384B77D for ; Mon, 29 Aug 2016 10:47:08 +0200 (CEST) Received: from mwalle01.kse.adk.loc (unknown [194.25.174.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 9489D2245E; Mon, 29 Aug 2016 10:47:02 +0200 (CEST) Authentication-Results: ssl.serverraum.org; dmarc=none header.from=walle.cc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1472460422; bh=XsGyUVl2fG9JbsxWt1fWZSmWXhQYcnCSvK/YFC21RRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mDwjBdg9pdMd3gn61n0xHdgtyoL9HkNKqLiDmoThhvxboUFuzTk5xz+CY4Eepxk7T dwqdyC/vOi5TzoF2x3wa8FG/jCt0PamCTcadeXdDxZ0EYPENO15J/NWrZiDAu/aRAT ollDLSpx9kn1g/tAP36/0p5ZvYg5WYQ2crDBSCqY= From: Michael Walle To: Tom Rini Date: Mon, 29 Aug 2016 10:46:43 +0200 Message-Id: <1472460406-20418-2-git-send-email-michael@walle.cc> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1472460406-20418-1-git-send-email-michael@walle.cc> References: <1472460406-20418-1-git-send-email-michael@walle.cc> X-Virus-Scanned: clamav-milter 0.99.2 at web X-Virus-Status: Clean X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on web.serverraum.org Cc: u-boot@lists.denx.de, thomas.schaefer@kontron.com Subject: [U-Boot] [PATCH v3 1/4] ext4: change structure fields to __le/__be types X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 --- fs/ext4/ext4_journal.h | 40 +++++++-------- include/ext_common.h | 136 ++++++++++++++++++++++++------------------------- 2 files changed, 88 insertions(+), 88 deletions(-) diff --git a/fs/ext4/ext4_journal.h b/fs/ext4/ext4_journal.h index d926094..d54165c 100644 --- a/fs/ext4/ext4_journal.h +++ b/fs/ext4/ext4_journal.h @@ -49,9 +49,9 @@ struct dirty_blocks { /* Standard header for all descriptor blocks: */ struct journal_header_t { - __u32 h_magic; - __u32 h_blocktype; - __u32 h_sequence; + __be32 h_magic; + __be32 h_blocktype; + __be32 h_sequence; }; /* The journal superblock. All fields are in big-endian byte order. */ @@ -60,35 +60,35 @@ struct journal_superblock_t { struct journal_header_t s_header; /* Static information describing the journal */ - __u32 s_blocksize; /* journal device blocksize */ - __u32 s_maxlen; /* total blocks in journal file */ - __u32 s_first; /* first block of log information */ + __be32 s_blocksize; /* journal device blocksize */ + __be32 s_maxlen; /* total blocks in journal file */ + __be32 s_first; /* first block of log information */ /* Dynamic information describing the current state of the log */ - __u32 s_sequence; /* first commit ID expected in log */ - __u32 s_start; /* blocknr of start of log */ + __be32 s_sequence; /* first commit ID expected in log */ + __be32 s_start; /* blocknr of start of log */ /* Error value, as set by journal_abort(). */ - __s32 s_errno; + __be32 s_errno; /* Remaining fields are only valid in a version-2 superblock */ - __u32 s_feature_compat; /* compatible feature set */ - __u32 s_feature_incompat; /* incompatible feature set */ - __u32 s_feature_ro_compat; /* readonly-compatible feature set */ + __be32 s_feature_compat; /* compatible feature set */ + __be32 s_feature_incompat; /* incompatible feature set */ + __be32 s_feature_ro_compat; /* readonly-compatible feature set */ /* 0x0030 */ __u8 s_uuid[16]; /* 128-bit uuid for journal */ /* 0x0040 */ - __u32 s_nr_users; /* Nr of filesystems sharing log */ + __be32 s_nr_users; /* Nr of filesystems sharing log */ - __u32 s_dynsuper; /* Blocknr of dynamic superblock copy */ + __be32 s_dynsuper; /* Blocknr of dynamic superblock copy */ /* 0x0048 */ - __u32 s_max_transaction; /* Limit of journal blocks per trans. */ - __u32 s_max_trans_data; /* Limit of data blocks per trans. */ + __be32 s_max_transaction; /* Limit of journal blocks per trans. */ + __be32 s_max_trans_data; /* Limit of data blocks per trans. */ /* 0x0050 */ - __u32 s_padding[44]; + __be32 s_padding[44]; /* 0x0100 */ __u8 s_users[16 * 48]; /* ids of all fs'es sharing the log */ @@ -96,13 +96,13 @@ struct journal_superblock_t { } ; struct ext3_journal_block_tag { - uint32_t block; - uint32_t flags; + __be32 block; + __be32 flags; }; struct journal_revoke_header_t { struct journal_header_t r_header; - int r_count; /* Count of bytes used in the block */ + __be32 r_count; /* Count of bytes used in the block */ }; struct revoke_blk_list { diff --git a/include/ext_common.h b/include/ext_common.h index 6cddf16..c12e526 100644 --- a/include/ext_common.h +++ b/include/ext_common.h @@ -66,92 +66,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 {