From 5c520b7f25de46446d3a634572b62b6cda4ae171 Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Tue, 21 Sep 2004 18:32:22 -0700 Subject: [PATCH] [PATCH] ext3 endianness annotations and bugfixes * missing le32_to_cpu() in a bunch of printks * on big-endian boxen ext3_error() failed to set EXT3_ERROR_FS in ->s_state (cpu_to_le32() instead of cpu_to_le16()) Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/ext3/acl.h | 12 ++-- fs/ext3/balloc.c | 4 +- fs/ext3/ialloc.c | 4 +- fs/ext3/inode.c | 46 +++++++------ fs/ext3/namei.c | 37 +++++------ fs/ext3/super.c | 31 ++++----- fs/ext3/xattr.c | 2 +- fs/ext3/xattr.h | 16 ++--- include/linux/ext3_fs.h | 136 +++++++++++++++++++------------------- include/linux/ext3_fs_i.h | 2 +- 10 files changed, 145 insertions(+), 145 deletions(-) diff --git a/fs/ext3/acl.h b/fs/ext3/acl.h index 9d9d9d2e4a0c8..f83830d44d204 100644 --- a/fs/ext3/acl.h +++ b/fs/ext3/acl.h @@ -10,18 +10,18 @@ #define EXT3_ACL_MAX_ENTRIES 32 typedef struct { - __u16 e_tag; - __u16 e_perm; - __u32 e_id; + __le16 e_tag; + __le16 e_perm; + __le32 e_id; } ext3_acl_entry; typedef struct { - __u16 e_tag; - __u16 e_perm; + __le16 e_tag; + __le16 e_perm; } ext3_acl_entry_short; typedef struct { - __u32 a_version; + __le32 a_version; } ext3_acl_header; static inline size_t ext3_acl_size(int count) diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 4ebdcf4833c38..1088c8879146e 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c @@ -91,8 +91,8 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) if (!bh) ext3_error (sb, "read_block_bitmap", "Cannot read block bitmap - " - "block_group = %d, block_bitmap = %lu", - block_group, (unsigned long) desc->bg_block_bitmap); + "block_group = %d, block_bitmap = %u", + block_group, le32_to_cpu(desc->bg_block_bitmap)); error_out: return bh; } diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 7a559a02c961b..a3ca0238635a6 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c @@ -64,8 +64,8 @@ read_inode_bitmap(struct super_block * sb, unsigned long block_group) if (!bh) ext3_error(sb, "read_inode_bitmap", "Cannot read inode bitmap - " - "block_group = %lu, inode_bitmap = %lu", - block_group, (unsigned long) desc->bg_inode_bitmap); + "block_group = %lu, inode_bitmap = %u", + block_group, le32_to_cpu(desc->bg_inode_bitmap)); error_out: return bh; } diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 41101698b3aa3..7650d0dad3514 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c @@ -305,12 +305,12 @@ static int ext3_alloc_block (handle_t *handle, typedef struct { - u32 *p; - u32 key; + __le32 *p; + __le32 key; struct buffer_head *bh; } Indirect; -static inline void add_chain(Indirect *p, struct buffer_head *bh, u32 *v) +static inline void add_chain(Indirect *p, struct buffer_head *bh, __le32 *v) { p->key = *(p->p = v); p->bh = bh; @@ -441,7 +441,7 @@ static Indirect *ext3_get_branch(struct inode *inode, int depth, int *offsets, /* Reader: pointers */ if (!verify_chain(chain, p)) goto changed; - add_chain(++p, bh, (u32*)bh->b_data + *++offsets); + add_chain(++p, bh, (__le32*)bh->b_data + *++offsets); /* Reader: end */ if (!p->key) goto no_block; @@ -482,8 +482,8 @@ no_block: static unsigned long ext3_find_near(struct inode *inode, Indirect *ind) { struct ext3_inode_info *ei = EXT3_I(inode); - u32 *start = ind->bh ? (u32*) ind->bh->b_data : ei->i_data; - u32 *p; + __le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data; + __le32 *p; unsigned long bg_start; unsigned long colour; @@ -611,7 +611,7 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode, } memset(bh->b_data, 0, blocksize); - branch[n].p = (u32*) bh->b_data + offsets[n]; + branch[n].p = (__le32*) bh->b_data + offsets[n]; *branch[n].p = branch[n].key; BUFFER_TRACE(bh, "marking uptodate"); set_buffer_uptodate(bh); @@ -1767,7 +1767,7 @@ unlock: * or memcmp with zero_page, whatever is better for particular architecture. * Linus? */ -static inline int all_zeroes(u32 *p, u32 *q) +static inline int all_zeroes(__le32 *p, __le32 *q) { while (p < q) if (*p++) @@ -1814,7 +1814,7 @@ static Indirect *ext3_find_shared(struct inode *inode, int depth, int offsets[4], Indirect chain[4], - u32 *top) + __le32 *top) { Indirect *partial, *p; int k, err; @@ -1834,7 +1834,7 @@ static Indirect *ext3_find_shared(struct inode *inode, if (!partial->key && *partial->p) /* Writer: end */ goto no_top; - for (p=partial; p>chain && all_zeroes((u32*)p->bh->b_data,p->p); p--) + for (p=partial; p>chain && all_zeroes((__le32*)p->bh->b_data,p->p); p--) ; /* * OK, we've found the last block that must survive. The rest of our @@ -1873,9 +1873,9 @@ no_top: static void ext3_clear_blocks(handle_t *handle, struct inode *inode, struct buffer_head *bh, unsigned long block_to_free, unsigned long count, - u32 *first, u32 *last) + __le32 *first, __le32 *last) { - u32 *p; + __le32 *p; if (try_to_extend_transaction(handle, inode)) { if (bh) { BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata"); @@ -1931,15 +1931,16 @@ ext3_clear_blocks(handle_t *handle, struct inode *inode, struct buffer_head *bh, * block pointers. */ static void ext3_free_data(handle_t *handle, struct inode *inode, - struct buffer_head *this_bh, u32 *first, u32 *last) + struct buffer_head *this_bh, + __le32 *first, __le32 *last) { unsigned long block_to_free = 0; /* Starting block # of a run */ unsigned long count = 0; /* Number of blocks in the run */ - u32 *block_to_free_p = NULL; /* Pointer into inode/ind + __le32 *block_to_free_p = NULL; /* Pointer into inode/ind corresponding to block_to_free */ unsigned long nr; /* Current block # */ - u32 *p; /* Pointer into inode/ind + __le32 *p; /* Pointer into inode/ind for current block */ int err; @@ -1998,10 +1999,10 @@ static void ext3_free_data(handle_t *handle, struct inode *inode, */ static void ext3_free_branches(handle_t *handle, struct inode *inode, struct buffer_head *parent_bh, - u32 *first, u32 *last, int depth) + __le32 *first, __le32 *last, int depth) { unsigned long nr; - u32 *p; + __le32 *p; if (is_handle_aborted(handle)) return; @@ -2031,8 +2032,9 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode, /* This zaps the entire block. Bottom up. */ BUFFER_TRACE(bh, "free child branches"); - ext3_free_branches(handle, inode, bh, (u32*)bh->b_data, - (u32*)bh->b_data + addr_per_block, + ext3_free_branches(handle, inode, bh, + (__le32*)bh->b_data, + (__le32*)bh->b_data + addr_per_block, depth); /* @@ -2137,13 +2139,13 @@ void ext3_truncate(struct inode * inode) { handle_t *handle; struct ext3_inode_info *ei = EXT3_I(inode); - u32 *i_data = ei->i_data; + __le32 *i_data = ei->i_data; int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb); struct address_space *mapping = inode->i_mapping; int offsets[4]; Indirect chain[4]; Indirect *partial; - int nr = 0; + __le32 nr = 0; int n; long last_block; unsigned blocksize = inode->i_sb->s_blocksize; @@ -2250,7 +2252,7 @@ void ext3_truncate(struct inode * inode) /* Clear the ends of indirect blocks on the shared branch */ while (partial > chain) { ext3_free_branches(handle, inode, partial->bh, partial->p + 1, - (u32*)partial->bh->b_data + addr_per_block, + (__le32*)partial->bh->b_data+addr_per_block, (chain+n-1) - partial); BUFFER_TRACE(partial->bh, "call brelse"); brelse (partial->bh); diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 36e5b4ec3daff..e7e287e19cfe0 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c @@ -71,9 +71,6 @@ static struct buffer_head *ext3_append(handle_t *handle, #define swap(x, y) do { typeof(x) z = x; x = y; y = z; } while (0) #endif -typedef struct { u32 v; } le_u32; -typedef struct { u16 v; } le_u16; - #ifdef DX_DEBUG #define dxtrace(command) command #else @@ -82,22 +79,22 @@ typedef struct { u16 v; } le_u16; struct fake_dirent { - /*le*/u32 inode; - /*le*/u16 rec_len; + __le32 inode; + __le16 rec_len; u8 name_len; u8 file_type; }; struct dx_countlimit { - le_u16 limit; - le_u16 count; + __le16 limit; + __le16 count; }; struct dx_entry { - le_u32 hash; - le_u32 block; + __le32 hash; + __le32 block; }; /* @@ -114,7 +111,7 @@ struct dx_root char dotdot_name[4]; struct dx_root_info { - le_u32 reserved_zero; + __le32 reserved_zero; u8 hash_version; u8 info_length; /* 8 */ u8 indirect_levels; @@ -184,42 +181,42 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry, static inline unsigned dx_get_block (struct dx_entry *entry) { - return le32_to_cpu(entry->block.v) & 0x00ffffff; + return le32_to_cpu(entry->block) & 0x00ffffff; } static inline void dx_set_block (struct dx_entry *entry, unsigned value) { - entry->block.v = cpu_to_le32(value); + entry->block = cpu_to_le32(value); } static inline unsigned dx_get_hash (struct dx_entry *entry) { - return le32_to_cpu(entry->hash.v); + return le32_to_cpu(entry->hash); } static inline void dx_set_hash (struct dx_entry *entry, unsigned value) { - entry->hash.v = cpu_to_le32(value); + entry->hash = cpu_to_le32(value); } static inline unsigned dx_get_count (struct dx_entry *entries) { - return le16_to_cpu(((struct dx_countlimit *) entries)->count.v); + return le16_to_cpu(((struct dx_countlimit *) entries)->count); } static inline unsigned dx_get_limit (struct dx_entry *entries) { - return le16_to_cpu(((struct dx_countlimit *) entries)->limit.v); + return le16_to_cpu(((struct dx_countlimit *) entries)->limit); } static inline void dx_set_count (struct dx_entry *entries, unsigned value) { - ((struct dx_countlimit *) entries)->count.v = cpu_to_le16(value); + ((struct dx_countlimit *) entries)->count = cpu_to_le16(value); } static inline void dx_set_limit (struct dx_entry *entries, unsigned value) { - ((struct dx_countlimit *) entries)->limit.v = cpu_to_le16(value); + ((struct dx_countlimit *) entries)->limit = cpu_to_le16(value); } static inline unsigned dx_root_limit (struct inode *dir, unsigned infosize) @@ -2258,7 +2255,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, } else { BUFFER_TRACE(new_bh, "get write access"); ext3_journal_get_write_access(handle, new_bh); - new_de->inode = le32_to_cpu(old_inode->i_ino); + new_de->inode = cpu_to_le32(old_inode->i_ino); if (EXT3_HAS_INCOMPAT_FEATURE(new_dir->i_sb, EXT3_FEATURE_INCOMPAT_FILETYPE)) new_de->file_type = old_de->file_type; @@ -2313,7 +2310,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, if (dir_bh) { BUFFER_TRACE(dir_bh, "get_write_access"); ext3_journal_get_write_access(handle, dir_bh); - PARENT_INO(dir_bh->b_data) = le32_to_cpu(new_dir->i_ino); + PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino); BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata"); ext3_journal_dirty_metadata(handle, dir_bh); old_dir->i_nlink--; diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 1274b1f790b01..a93964e67a2c5 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c @@ -138,7 +138,7 @@ static void ext3_handle_error(struct super_block *sb) struct ext3_super_block *es = EXT3_SB(sb)->s_es; EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; - es->s_state |= cpu_to_le32(EXT3_ERROR_FS); + es->s_state |= cpu_to_le16(EXT3_ERROR_FS); if (sb->s_flags & MS_RDONLY) return; @@ -377,7 +377,7 @@ static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi) "inode %s:%ld at %p: mode %o, nlink %d, next %d\n", inode->i_sb->s_id, inode->i_ino, inode, inode->i_mode, inode->i_nlink, - le32_to_cpu(NEXT_ORPHAN(inode))); + NEXT_ORPHAN(inode)); } } @@ -391,7 +391,7 @@ void ext3_put_super (struct super_block * sb) journal_destroy(sbi->s_journal); if (!(sb->s_flags & MS_RDONLY)) { EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); - es->s_state = le16_to_cpu(sbi->s_mount_state); + es->s_state = cpu_to_le16(sbi->s_mount_state); BUFFER_TRACE(sbi->s_sbh, "marking dirty"); mark_buffer_dirty(sbi->s_sbh); ext3_commit_super(sb, es, 1); @@ -964,8 +964,7 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es, es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & ~EXT3_VALID_FS); #endif if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) - es->s_max_mnt_count = - (__s16) cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT); + es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT); es->s_mnt_count=cpu_to_le16(le16_to_cpu(es->s_mnt_count) + 1); es->s_mtime = cpu_to_le32(get_seconds()); ext3_update_dynamic_rev(sb); @@ -1221,6 +1220,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) int db_count; int i; int needs_recovery; + __le32 features; sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) @@ -1313,17 +1313,18 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) * previously didn't change the revision level when setting the flags, * so there is a chance incompat flags are set on a rev 0 filesystem. */ - if ((i = EXT3_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP))) { + features = EXT3_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP); + if (features) { printk(KERN_ERR "EXT3-fs: %s: couldn't mount because of " "unsupported optional features (%x).\n", - sb->s_id, i); + sb->s_id, le32_to_cpu(features)); goto failed_mount; } - if (!(sb->s_flags & MS_RDONLY) && - (i = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP))){ + features = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP); + if (!(sb->s_flags & MS_RDONLY) && features) { printk(KERN_ERR "EXT3-fs: %s: couldn't mount RDWR because of " "unsupported optional features (%x).\n", - sb->s_id, i); + sb->s_id, le32_to_cpu(features)); goto failed_mount; } blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); @@ -1360,7 +1361,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) } es = (struct ext3_super_block *)(((char *)bh->b_data) + offset); sbi->s_es = es; - if (es->s_magic != le16_to_cpu(EXT3_SUPER_MAGIC)) { + if (es->s_magic != cpu_to_le16(EXT3_SUPER_MAGIC)) { printk (KERN_ERR "EXT3-fs: Magic mismatch, very weird !\n"); goto failed_mount; @@ -1737,10 +1738,10 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb, printk(KERN_ERR "EXT3-fs: I/O error on journal device\n"); goto out_journal; } - if (ntohl(journal->j_superblock->s_nr_users) != 1) { + if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) { printk(KERN_ERR "EXT3-fs: External journal has more than one " "user (unsupported) - %d\n", - ntohl(journal->j_superblock->s_nr_users)); + be32_to_cpu(journal->j_superblock->s_nr_users)); goto out_journal; } EXT3_SB(sb)->journal_bdev = bdev; @@ -2065,13 +2066,13 @@ int ext3_remount (struct super_block * sb, int * flags, char * data) ext3_mark_recovery_complete(sb, es); } else { - int ret; + __le32 ret; if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP))) { printk(KERN_WARNING "EXT3-fs: %s: couldn't " "remount RDWR because of unsupported " "optional features (%x).\n", - sb->s_id, ret); + sb->s_id, le32_to_cpu(ret)); return -EROFS; } /* diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index 163db30a214e8..e6df2ba425d6d 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c @@ -1130,7 +1130,7 @@ static inline void ext3_xattr_hash_entry(struct ext3_xattr_header *header, } if (entry->e_value_block == 0 && entry->e_value_size != 0) { - __u32 *value = (__u32 *)((char *)header + + __le32 *value = (__le32 *)((char *)header + le16_to_cpu(entry->e_value_offs)); for (n = (le32_to_cpu(entry->e_value_size) + EXT3_XATTR_ROUND) >> EXT3_XATTR_PAD_BITS; n; n--) { diff --git a/fs/ext3/xattr.h b/fs/ext3/xattr.h index 9c71433c6a900..2aabe9f591d23 100644 --- a/fs/ext3/xattr.h +++ b/fs/ext3/xattr.h @@ -25,20 +25,20 @@ #define EXT3_XATTR_INDEX_SECURITY 6 struct ext3_xattr_header { - __u32 h_magic; /* magic number for identification */ - __u32 h_refcount; /* reference count */ - __u32 h_blocks; /* number of disk blocks used */ - __u32 h_hash; /* hash value of all attributes */ + __le32 h_magic; /* magic number for identification */ + __le32 h_refcount; /* reference count */ + __le32 h_blocks; /* number of disk blocks used */ + __le32 h_hash; /* hash value of all attributes */ __u32 h_reserved[4]; /* zero right now */ }; struct ext3_xattr_entry { __u8 e_name_len; /* length of name */ __u8 e_name_index; /* attribute name index */ - __u16 e_value_offs; /* offset in disk block of value */ - __u32 e_value_block; /* disk block attribute is stored on (n/i) */ - __u32 e_value_size; /* size of attribute value */ - __u32 e_hash; /* hash value of name and value */ + __le16 e_value_offs; /* offset in disk block of value */ + __le32 e_value_block; /* disk block attribute is stored on (n/i) */ + __le32 e_value_size; /* size of attribute value */ + __le32 e_hash; /* hash value of name and value */ char e_name[0]; /* attribute name */ }; diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index c95c5802852ae..5891758fa28c7 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h @@ -129,14 +129,14 @@ struct statfs; */ struct ext3_group_desc { - __u32 bg_block_bitmap; /* Blocks bitmap block */ - __u32 bg_inode_bitmap; /* Inodes bitmap block */ - __u32 bg_inode_table; /* Inodes table block */ - __u16 bg_free_blocks_count; /* Free blocks count */ - __u16 bg_free_inodes_count; /* Free inodes count */ - __u16 bg_used_dirs_count; /* Directories count */ + __le32 bg_block_bitmap; /* Blocks bitmap block */ + __le32 bg_inode_bitmap; /* Inodes bitmap block */ + __le32 bg_inode_table; /* Inodes table block */ + __le16 bg_free_blocks_count; /* Free blocks count */ + __le16 bg_free_inodes_count; /* Free inodes count */ + __le16 bg_used_dirs_count; /* Directories count */ __u16 bg_pad; - __u32 bg_reserved[3]; + __le32 bg_reserved[3]; }; /* @@ -213,17 +213,17 @@ struct ext3_group_desc * Structure of an inode on the disk */ struct ext3_inode { - __u16 i_mode; /* File mode */ - __u16 i_uid; /* Low 16 bits of Owner Uid */ - __u32 i_size; /* Size in bytes */ - __u32 i_atime; /* Access time */ - __u32 i_ctime; /* Creation time */ - __u32 i_mtime; /* Modification time */ - __u32 i_dtime; /* Deletion Time */ - __u16 i_gid; /* Low 16 bits of Group Id */ - __u16 i_links_count; /* Links count */ - __u32 i_blocks; /* Blocks count */ - __u32 i_flags; /* File flags */ + __le16 i_mode; /* File mode */ + __le16 i_uid; /* Low 16 bits of Owner Uid */ + __le32 i_size; /* Size in bytes */ + __le32 i_atime; /* Access time */ + __le32 i_ctime; /* Creation time */ + __le32 i_mtime; /* Modification time */ + __le32 i_dtime; /* Deletion Time */ + __le16 i_gid; /* Low 16 bits of Group Id */ + __le16 i_links_count; /* Links count */ + __le32 i_blocks; /* Blocks count */ + __le32 i_flags; /* File flags */ union { struct { __u32 l_i_reserved1; @@ -235,18 +235,18 @@ struct ext3_inode { __u32 m_i_reserved1; } masix1; } osd1; /* OS dependent 1 */ - __u32 i_block[EXT3_N_BLOCKS];/* Pointers to blocks */ - __u32 i_generation; /* File version (for NFS) */ - __u32 i_file_acl; /* File ACL */ - __u32 i_dir_acl; /* Directory ACL */ - __u32 i_faddr; /* Fragment address */ + __le32 i_block[EXT3_N_BLOCKS];/* Pointers to blocks */ + __le32 i_generation; /* File version (for NFS) */ + __le32 i_file_acl; /* File ACL */ + __le32 i_dir_acl; /* Directory ACL */ + __le32 i_faddr; /* Fragment address */ union { struct { __u8 l_i_frag; /* Fragment number */ __u8 l_i_fsize; /* Fragment size */ __u16 i_pad1; - __u16 l_i_uid_high; /* these 2 fields */ - __u16 l_i_gid_high; /* were reserved2[0] */ + __le16 l_i_uid_high; /* these 2 fields */ + __le16 l_i_gid_high; /* were reserved2[0] */ __u32 l_i_reserved2; } linux2; struct { @@ -364,31 +364,31 @@ struct ext3_inode { * Structure of the super block */ struct ext3_super_block { -/*00*/ __u32 s_inodes_count; /* Inodes count */ - __u32 s_blocks_count; /* Blocks count */ - __u32 s_r_blocks_count; /* Reserved blocks count */ - __u32 s_free_blocks_count; /* Free blocks count */ -/*10*/ __u32 s_free_inodes_count; /* Free inodes count */ - __u32 s_first_data_block; /* First Data Block */ - __u32 s_log_block_size; /* Block size */ - __s32 s_log_frag_size; /* Fragment size */ -/*20*/ __u32 s_blocks_per_group; /* # Blocks per group */ - __u32 s_frags_per_group; /* # Fragments per group */ - __u32 s_inodes_per_group; /* # Inodes per group */ - __u32 s_mtime; /* Mount time */ -/*30*/ __u32 s_wtime; /* Write time */ - __u16 s_mnt_count; /* Mount count */ - __s16 s_max_mnt_count; /* Maximal mount count */ - __u16 s_magic; /* Magic signature */ - __u16 s_state; /* File system state */ - __u16 s_errors; /* Behaviour when detecting errors */ - __u16 s_minor_rev_level; /* minor revision level */ -/*40*/ __u32 s_lastcheck; /* time of last check */ - __u32 s_checkinterval; /* max. time between checks */ - __u32 s_creator_os; /* OS */ - __u32 s_rev_level; /* Revision level */ -/*50*/ __u16 s_def_resuid; /* Default uid for reserved blocks */ - __u16 s_def_resgid; /* Default gid for reserved blocks */ +/*00*/ __le32 s_inodes_count; /* Inodes count */ + __le32 s_blocks_count; /* Blocks count */ + __le32 s_r_blocks_count; /* Reserved blocks count */ + __le32 s_free_blocks_count; /* Free blocks count */ +/*10*/ __le32 s_free_inodes_count; /* Free inodes count */ + __le32 s_first_data_block; /* First Data Block */ + __le32 s_log_block_size; /* Block size */ + __le32 s_log_frag_size; /* Fragment size */ +/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */ + __le32 s_frags_per_group; /* # Fragments per group */ + __le32 s_inodes_per_group; /* # Inodes per group */ + __le32 s_mtime; /* Mount time */ +/*30*/ __le32 s_wtime; /* Write time */ + __le16 s_mnt_count; /* Mount count */ + __le16 s_max_mnt_count; /* Maximal mount count */ + __le16 s_magic; /* Magic signature */ + __le16 s_state; /* File system state */ + __le16 s_errors; /* Behaviour when detecting errors */ + __le16 s_minor_rev_level; /* minor revision level */ +/*40*/ __le32 s_lastcheck; /* time of last check */ + __le32 s_checkinterval; /* max. time between checks */ + __le32 s_creator_os; /* OS */ + __le32 s_rev_level; /* Revision level */ +/*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */ + __le16 s_def_resgid; /* Default gid for reserved blocks */ /* * These fields are for EXT3_DYNAMIC_REV superblocks only. * @@ -402,16 +402,16 @@ struct ext3_super_block { * feature set, it must abort and not try to meddle with * things it doesn't understand... */ - __u32 s_first_ino; /* First non-reserved inode */ - __u16 s_inode_size; /* size of inode structure */ - __u16 s_block_group_nr; /* block group # of this superblock */ - __u32 s_feature_compat; /* compatible feature set */ -/*60*/ __u32 s_feature_incompat; /* incompatible feature set */ - __u32 s_feature_ro_compat; /* readonly-compatible feature set */ + __le32 s_first_ino; /* First non-reserved inode */ + __le16 s_inode_size; /* size of inode structure */ + __le16 s_block_group_nr; /* block group # of this superblock */ + __le32 s_feature_compat; /* compatible feature set */ +/*60*/ __le32 s_feature_incompat; /* incompatible feature set */ + __le32 s_feature_ro_compat; /* readonly-compatible feature set */ /*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */ /*78*/ char s_volume_name[16]; /* volume name */ /*88*/ char s_last_mounted[64]; /* directory where last mounted */ -/*C8*/ __u32 s_algorithm_usage_bitmap; /* For compression */ +/*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */ /* * Performance hints. Directory preallocation should only * happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on. @@ -423,15 +423,15 @@ struct ext3_super_block { * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. */ /*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */ -/*E0*/ __u32 s_journal_inum; /* inode number of journal file */ - __u32 s_journal_dev; /* device number of journal file */ - __u32 s_last_orphan; /* start of list of inodes to delete */ - __u32 s_hash_seed[4]; /* HTREE hash seed */ +/*E0*/ __le32 s_journal_inum; /* inode number of journal file */ + __le32 s_journal_dev; /* device number of journal file */ + __le32 s_last_orphan; /* start of list of inodes to delete */ + __le32 s_hash_seed[4]; /* HTREE hash seed */ __u8 s_def_hash_version; /* Default hash version to use */ __u8 s_reserved_char_pad; __u16 s_reserved_word_pad; - __u32 s_default_mount_opts; - __u32 s_first_meta_bg; /* First metablock block group */ + __le32 s_default_mount_opts; + __le32 s_first_meta_bg; /* First metablock block group */ __u32 s_reserved[190]; /* Padding to the end of the block */ }; @@ -546,9 +546,9 @@ static inline struct ext3_inode_info *EXT3_I(struct inode *inode) #define EXT3_NAME_LEN 255 struct ext3_dir_entry { - __u32 inode; /* Inode number */ - __u16 rec_len; /* Directory entry length */ - __u16 name_len; /* Name length */ + __le32 inode; /* Inode number */ + __le16 rec_len; /* Directory entry length */ + __le16 name_len; /* Name length */ char name[EXT3_NAME_LEN]; /* File name */ }; @@ -559,8 +559,8 @@ struct ext3_dir_entry { * file_type field. */ struct ext3_dir_entry_2 { - __u32 inode; /* Inode number */ - __u16 rec_len; /* Directory entry length */ + __le32 inode; /* Inode number */ + __le16 rec_len; /* Directory entry length */ __u8 name_len; /* Name length */ __u8 file_type; char name[EXT3_NAME_LEN]; /* File name */ diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h index 7451cdcfb9da5..48baa3f4b04d6 100644 --- a/include/linux/ext3_fs_i.h +++ b/include/linux/ext3_fs_i.h @@ -22,7 +22,7 @@ * second extended file system inode data in memory */ struct ext3_inode_info { - __u32 i_data[15]; + __le32 i_data[15]; /* unconverted */ __u32 i_flags; #ifdef EXT3_FRAGMENTS __u32 i_faddr; -- 2.53.0