diff options
| author | Alexander Viro <viro@parcelfarce.linux.theplanet.co.uk> | 2004-09-08 20:35:13 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-09-08 20:35:13 -0700 |
| commit | 3cae3cfd8c961c50a75319400ff407a23391d60c (patch) | |
| tree | 11258bef38c120bca14f63efea6513bb56b63361 | |
| parent | 5d7b32de9935c65ca8285ac6ec2382afdbb5d479 (diff) | |
[PATCH] ext2 endianness annotations
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | fs/ext2/acl.h | 12 | ||||
| -rw-r--r-- | fs/ext2/ext2.h | 2 | ||||
| -rw-r--r-- | fs/ext2/inode.c | 34 | ||||
| -rw-r--r-- | fs/ext2/super.c | 12 | ||||
| -rw-r--r-- | fs/ext2/xattr.c | 2 | ||||
| -rw-r--r-- | fs/ext2/xattr.h | 16 | ||||
| -rw-r--r-- | include/linux/ext2_fs.h | 144 |
7 files changed, 111 insertions, 111 deletions
diff --git a/fs/ext2/acl.h b/fs/ext2/acl.h index 01937daf1168..b0a1c4b38be7 100644 --- a/fs/ext2/acl.h +++ b/fs/ext2/acl.h @@ -10,18 +10,18 @@ #define EXT2_ACL_MAX_ENTRIES 32 typedef struct { - __u16 e_tag; - __u16 e_perm; - __u32 e_id; + __le16 e_tag; + __le16 e_perm; + __le32 e_id; } ext2_acl_entry; typedef struct { - __u16 e_tag; - __u16 e_perm; + __le16 e_tag; + __le16 e_perm; } ext2_acl_entry_short; typedef struct { - __u32 a_version; + __le32 a_version; } ext2_acl_header; static inline size_t ext2_acl_size(int count) diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h index bfabd0b3c56f..9d8770e8af0f 100644 --- a/fs/ext2/ext2.h +++ b/fs/ext2/ext2.h @@ -5,7 +5,7 @@ * second extended file system inode data in memory */ struct ext2_inode_info { - __u32 i_data[15]; + __le32 i_data[15]; __u32 i_flags; __u32 i_faddr; __u8 i_frag_no; diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 694e6ee40690..a77e96a1a00f 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -142,12 +142,12 @@ static int ext2_alloc_block (struct inode * inode, unsigned long goal, int *err) } 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; @@ -280,7 +280,7 @@ static Indirect *ext2_get_branch(struct inode *inode, read_lock(&EXT2_I(inode)->i_meta_lock); 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); read_unlock(&EXT2_I(inode)->i_meta_lock); if (!p->key) goto no_block; @@ -321,8 +321,8 @@ no_block: static unsigned long ext2_find_near(struct inode *inode, Indirect *ind) { struct ext2_inode_info *ei = EXT2_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; @@ -440,7 +440,7 @@ static int ext2_alloc_branch(struct inode *inode, lock_buffer(bh); memset(bh->b_data, 0, blocksize); branch[n].bh = bh; - branch[n].p = (u32*) bh->b_data + offsets[n]; + branch[n].p = (__le32 *) bh->b_data + offsets[n]; *branch[n].p = branch[n].key; set_buffer_uptodate(bh); unlock_buffer(bh); @@ -702,7 +702,7 @@ struct address_space_operations ext2_nobh_aops = { * 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++) @@ -748,7 +748,7 @@ static Indirect *ext2_find_shared(struct inode *inode, int depth, int offsets[4], Indirect chain[4], - u32 *top) + __le32 *top) { Indirect *partial, *p; int k, err; @@ -768,7 +768,7 @@ static Indirect *ext2_find_shared(struct inode *inode, write_unlock(&EXT2_I(inode)->i_meta_lock); 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 @@ -803,7 +803,7 @@ no_top: * stored as little-endian 32-bit) and updating @inode->i_blocks * appropriately. */ -static inline void ext2_free_data(struct inode *inode, u32 *p, u32 *q) +static inline void ext2_free_data(struct inode *inode, __le32 *p, __le32 *q) { unsigned long block_to_free = 0, count = 0; unsigned long nr; @@ -843,7 +843,7 @@ static inline void ext2_free_data(struct inode *inode, u32 *p, u32 *q) * stored as little-endian 32-bit) and updating @inode->i_blocks * appropriately. */ -static void ext2_free_branches(struct inode *inode, u32 *p, u32 *q, int depth) +static void ext2_free_branches(struct inode *inode, __le32 *p, __le32 *q, int depth) { struct buffer_head * bh; unsigned long nr; @@ -867,8 +867,8 @@ static void ext2_free_branches(struct inode *inode, u32 *p, u32 *q, int depth) continue; } ext2_free_branches(inode, - (u32*)bh->b_data, - (u32*)bh->b_data + addr_per_block, + (__le32*)bh->b_data, + (__le32*)bh->b_data + addr_per_block, depth); bforget(bh); ext2_free_blocks(inode, nr, 1); @@ -880,12 +880,12 @@ static void ext2_free_branches(struct inode *inode, u32 *p, u32 *q, int depth) void ext2_truncate (struct inode * inode) { - u32 *i_data = EXT2_I(inode)->i_data; + __le32 *i_data = EXT2_I(inode)->i_data; int addr_per_block = EXT2_ADDR_PER_BLOCK(inode->i_sb); int offsets[4]; Indirect chain[4]; Indirect *partial; - int nr = 0; + __le32 nr = 0; int n; long iblock; unsigned blocksize; @@ -933,7 +933,7 @@ void ext2_truncate (struct inode * inode) while (partial > chain) { ext2_free_branches(inode, partial->p + 1, - (u32*)partial->bh->b_data + addr_per_block, + (__le32*)partial->bh->b_data+addr_per_block, (chain+n-1) - partial); mark_buffer_dirty_inode(partial->bh, inode); brelse (partial->bh); diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 582fd490f715..ad3face04fe4 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -113,7 +113,7 @@ static void ext2_put_super (struct super_block * sb) if (!(sb->s_flags & MS_RDONLY)) { struct ext2_super_block *es = sbi->s_es; - es->s_state = le16_to_cpu(sbi->s_mount_state); + es->s_state = cpu_to_le16(sbi->s_mount_state); ext2_sync_super(sb, es); } db_count = sbi->s_gdb_count; @@ -428,8 +428,8 @@ static int ext2_setup_super (struct super_block * sb, (le32_to_cpu(es->s_lastcheck) + le32_to_cpu(es->s_checkinterval) <= get_seconds())) printk ("EXT2-fs warning: checktime reached, " "running e2fsck is recommended\n"); - if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) - es->s_max_mnt_count = (__s16) cpu_to_le16(EXT2_DFL_MAX_MNT_COUNT); + if (!le16_to_cpu(es->s_max_mnt_count)) + es->s_max_mnt_count = cpu_to_le16(EXT2_DFL_MAX_MNT_COUNT); es->s_mnt_count=cpu_to_le16(le16_to_cpu(es->s_mnt_count) + 1); ext2_write_super(sb); if (test_opt (sb, DEBUG)) @@ -551,7 +551,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) int blocksize = BLOCK_SIZE; int db_count; int i, j; - __u32 features; + __le32 features; sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) @@ -675,7 +675,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) } es = (struct ext2_super_block *) (((char *)bh->b_data) + offset); sbi->s_es = es; - if (es->s_magic != le16_to_cpu(EXT2_SUPER_MAGIC)) { + if (es->s_magic != cpu_to_le16(EXT2_SUPER_MAGIC)) { printk ("EXT2-fs: Magic mismatch, very weird !\n"); goto failed_mount; } @@ -918,7 +918,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) es->s_state = cpu_to_le16(sbi->s_mount_state); es->s_mtime = cpu_to_le32(get_seconds()); } else { - __u32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, + __le32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP); if (ret) { printk("EXT2-fs: %s: couldn't remount RDWR because of " diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index 85ee4e8bee0e..c8642719c170 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c @@ -1071,7 +1071,7 @@ static inline void ext2_xattr_hash_entry(struct ext2_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) + EXT2_XATTR_ROUND) >> EXT2_XATTR_PAD_BITS; n; n--) { diff --git a/fs/ext2/xattr.h b/fs/ext2/xattr.h index a113ead4adf9..6268bcdaf753 100644 --- a/fs/ext2/xattr.h +++ b/fs/ext2/xattr.h @@ -26,20 +26,20 @@ #define EXT2_XATTR_INDEX_SECURITY 6 struct ext2_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 ext2_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/ext2_fs.h b/include/linux/ext2_fs.h index d701ba88c688..fab43527e597 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h @@ -135,14 +135,14 @@ static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb) */ struct ext2_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 */ - __u16 bg_pad; - __u32 bg_reserved[3]; + __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 */ + __le16 bg_pad; + __le32 bg_reserved[3]; }; /* @@ -209,49 +209,49 @@ struct ext2_group_desc * Structure of an inode on the disk */ struct ext2_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; + __le32 l_i_reserved1; } linux1; struct { - __u32 h_i_translator; + __le32 h_i_translator; } hurd1; struct { - __u32 m_i_reserved1; + __le32 m_i_reserved1; } masix1; } osd1; /* OS dependent 1 */ - __u32 i_block[EXT2_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[EXT2_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 { __u8 h_i_frag; /* Fragment number */ __u8 h_i_fsize; /* Fragment size */ - __u16 h_i_mode_high; - __u16 h_i_uid_high; - __u16 h_i_gid_high; - __u32 h_i_author; + __le16 h_i_mode_high; + __le16 h_i_uid_high; + __le16 h_i_gid_high; + __le32 h_i_author; } hurd2; struct { __u8 m_i_frag; /* Fragment number */ @@ -335,31 +335,31 @@ struct ext2_inode { * Structure of the super block */ struct ext2_super_block { - __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 */ - __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 */ - __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 */ - __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 */ - __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 */ - __u16 s_def_resuid; /* Default uid for reserved blocks */ - __u16 s_def_resgid; /* Default gid for reserved blocks */ + __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 */ + __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 */ + __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 */ + __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 */ + __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 */ + __le16 s_def_resuid; /* Default uid for reserved blocks */ + __le16 s_def_resgid; /* Default gid for reserved blocks */ /* * These fields are for EXT2_DYNAMIC_REV superblocks only. * @@ -373,16 +373,16 @@ struct ext2_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 */ - __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 */ + __le32 s_feature_incompat; /* incompatible feature set */ + __le32 s_feature_ro_compat; /* readonly-compatible feature set */ __u8 s_uuid[16]; /* 128-bit uuid for volume */ char s_volume_name[16]; /* volume name */ char s_last_mounted[64]; /* directory where last mounted */ - __u32 s_algorithm_usage_bitmap; /* For compression */ + __le32 s_algorithm_usage_bitmap; /* For compression */ /* * Performance hints. Directory preallocation should only * happen if the EXT2_COMPAT_PREALLOC flag is on. @@ -401,8 +401,8 @@ struct ext2_super_block { __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 */ }; @@ -504,9 +504,9 @@ struct ext2_super_block { #define EXT2_NAME_LEN 255 struct ext2_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[EXT2_NAME_LEN]; /* File name */ }; @@ -517,8 +517,8 @@ struct ext2_dir_entry { * file_type field. */ struct ext2_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[EXT2_NAME_LEN]; /* File name */ |
