From 4695871f8d57f73b63559a7be2ef78ed105b9a2e Mon Sep 17 00:00:00 2001 From: jhb Date: Wed, 27 Apr 2011 18:15:34 +0000 Subject: [PATCH] Various style fixes including using uint*_t instead of u_int*_t. Submitted by: Pedro F. Giffuni giffunip at yahoo --- sys/fs/ext2fs/ext2_alloc.c | 4 +- sys/fs/ext2fs/ext2_dinode.h | 46 +++++++------- sys/fs/ext2fs/ext2_dir.h | 14 ++--- sys/fs/ext2fs/ext2fs.h | 119 ++++++++++++++++++++---------------- sys/fs/ext2fs/inode.h | 38 ++++++------ 5 files changed, 116 insertions(+), 105 deletions(-) diff --git a/sys/fs/ext2fs/ext2_alloc.c b/sys/fs/ext2fs/ext2_alloc.c index 293517771bcc..635a6e2b07e3 100644 --- a/sys/fs/ext2fs/ext2_alloc.c +++ b/sys/fs/ext2fs/ext2_alloc.c @@ -181,7 +181,7 @@ return ENOSPC; struct ext2mount *ump; struct cluster_save *buflist; struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp; - int32_t start_lbn, end_lbn, soff, newblk, blkno =0; + int32_t start_lbn, end_lbn, soff, newblk, blkno; int i, len, start_lvl, end_lvl, pref, ssize; vp = ap->a_vp; @@ -231,7 +231,7 @@ return ENOSPC; * Find the preferred location for the cluster. */ EXT2_LOCK(ump); - pref = ext2_blkpref(ip, start_lbn, soff, sbap, blkno); + pref = ext2_blkpref(ip, start_lbn, soff, sbap, 0); /* * If the block range spans two block maps, get the second map. */ diff --git a/sys/fs/ext2fs/ext2_dinode.h b/sys/fs/ext2fs/ext2_dinode.h index ba19d5b57b1c..3d744b994111 100755 --- a/sys/fs/ext2fs/ext2_dinode.h +++ b/sys/fs/ext2fs/ext2_dinode.h @@ -66,29 +66,29 @@ * Structure of an inode on the disk */ struct ext2fs_dinode { - u_int16_t e2di_mode; /* 0: IFMT, permissions; see below. */ - u_int16_t e2di_uid; /* 2: Owner UID */ - u_int32_t e2di_size; /* 4: Size (in bytes) */ - u_int32_t e2di_atime; /* 8: Access time */ - u_int32_t e2di_ctime; /* 12: Create time */ - u_int32_t e2di_mtime; /* 16: Modification time */ - u_int32_t e2di_dtime; /* 20: Deletion time */ - u_int16_t e2di_gid; /* 24: Owner GID */ - u_int16_t e2di_nlink; /* 26: File link count */ - u_int32_t e2di_nblock; /* 28: Blocks count */ - u_int32_t e2di_flags; /* 32: Status flags (chflags) */ - u_int32_t e2di_linux_reserved1; /* 36 */ - u_int32_t e2di_blocks[EXT2_N_BLOCKS]; /* 40: disk blocks */ - u_int32_t e2di_gen; /* 100: generation number */ - u_int32_t e2di_facl; /* 104: file ACL (not implemented) */ - u_int32_t e2di_dacl; /* 108: dir ACL (not implemented) */ - u_int32_t e2di_faddr; /* 112: fragment address */ - u_int8_t e2di_nfrag; /* 116: fragment number */ - u_int8_t e2di_fsize; /* 117: fragment size */ - u_int16_t e2di_linux_reserved2; /* 118 */ - u_int16_t e2di_uid_high; /* 120: Owner UID top 16 bits */ - u_int16_t e2di_gid_high; /* 122: Owner GID top 16 bits */ - u_int32_t e2di_linux_reserved3; /* 124 */ + uint16_t e2di_mode; /* 0: IFMT, permissions; see below. */ + uint16_t e2di_uid; /* 2: Owner UID */ + uint32_t e2di_size; /* 4: Size (in bytes) */ + uint32_t e2di_atime; /* 8: Access time */ + uint32_t e2di_ctime; /* 12: Create time */ + uint32_t e2di_mtime; /* 16: Modification time */ + uint32_t e2di_dtime; /* 20: Deletion time */ + uint16_t e2di_gid; /* 24: Owner GID */ + uint16_t e2di_nlink; /* 26: File link count */ + uint32_t e2di_nblock; /* 28: Blocks count */ + uint32_t e2di_flags; /* 32: Status flags (chflags) */ + uint32_t e2di_linux_reserved1; /* 36 */ + uint32_t e2di_blocks[EXT2_N_BLOCKS]; /* 40: disk blocks */ + uint32_t e2di_gen; /* 100: generation number */ + uint32_t e2di_facl; /* 104: file ACL (not implemented) */ + uint32_t e2di_dacl; /* 108: dir ACL (not implemented) */ + uint32_t e2di_faddr; /* 112: fragment address */ + uint8_t e2di_nfrag; /* 116: fragment number */ + uint8_t e2di_fsize; /* 117: fragment size */ + uint16_t e2di_linux_reserved2; /* 118 */ + uint16_t e2di_uid_high; /* 120: Owner UID top 16 bits */ + uint16_t e2di_gid_high; /* 122: Owner GID top 16 bits */ + uint32_t e2di_linux_reserved3; /* 124 */ }; #endif /* !_FS_EXT2FS_EXT2_DINODE_H_ */ diff --git a/sys/fs/ext2fs/ext2_dir.h b/sys/fs/ext2fs/ext2_dir.h index 06762682b1b9..5e111662dc73 100755 --- a/sys/fs/ext2fs/ext2_dir.h +++ b/sys/fs/ext2fs/ext2_dir.h @@ -35,9 +35,9 @@ #define EXT2FS_MAXNAMLEN 255 struct ext2fs_direct { - u_int32_t e2d_ino; /* inode number of entry */ - u_int16_t e2d_reclen; /* length of this record */ - u_int16_t e2d_namlen; /* length of string in d_name */ + uint32_t e2d_ino; /* inode number of entry */ + uint16_t e2d_reclen; /* length of this record */ + uint16_t e2d_namlen; /* length of string in d_name */ char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */ }; /* @@ -47,10 +47,10 @@ struct ext2fs_direct { * file_type field. */ struct ext2fs_direct_2 { - u_int32_t e2d_ino; /* inode number of entry */ - u_int16_t e2d_reclen; /* length of this record */ - u_int8_t e2d_namlen; /* length of string in d_name */ - u_int8_t e2d_type; /* file type */ + uint32_t e2d_ino; /* inode number of entry */ + uint16_t e2d_reclen; /* length of this record */ + uint8_t e2d_namlen; /* length of string in d_name */ + uint8_t e2d_type; /* file type */ char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */ }; /* diff --git a/sys/fs/ext2fs/ext2fs.h b/sys/fs/ext2fs/ext2fs.h index b2f2f2932325..baac2de0292f 100755 --- a/sys/fs/ext2fs/ext2fs.h +++ b/sys/fs/ext2fs/ext2fs.h @@ -65,44 +65,55 @@ * Super block for an ext2fs file system. */ struct ext2fs { - u_int32_t e2fs_icount; /* Inode count */ - u_int32_t e2fs_bcount; /* blocks count */ - u_int32_t e2fs_rbcount; /* reserved blocks count */ - u_int32_t e2fs_fbcount; /* free blocks count */ - u_int32_t e2fs_ficount; /* free inodes count */ - u_int32_t e2fs_first_dblock; /* first data block */ - u_int32_t e2fs_log_bsize; /* block size = 1024*(2^e2fs_log_bsize) */ - u_int32_t e2fs_log_fsize; /* fragment size */ - u_int32_t e2fs_bpg; /* blocks per group */ - u_int32_t e2fs_fpg; /* frags per group */ - u_int32_t e2fs_ipg; /* inodes per group */ - u_int32_t e2fs_mtime; /* mount time */ - u_int32_t e2fs_wtime; /* write time */ - u_int16_t e2fs_mnt_count; /* mount count */ - u_int16_t e2fs_max_mnt_count; /* max mount count */ - u_int16_t e2fs_magic; /* magic number */ - u_int16_t e2fs_state; /* file system state */ - u_int16_t e2fs_beh; /* behavior on errors */ - u_int16_t e2fs_minrev; /* minor revision level */ - u_int32_t e2fs_lastfsck; /* time of last fsck */ - u_int32_t e2fs_fsckintv; /* max time between fscks */ - u_int32_t e2fs_creator; /* creator OS */ - u_int32_t e2fs_rev; /* revision level */ - u_int16_t e2fs_ruid; /* default uid for reserved blocks */ - u_int16_t e2fs_rgid; /* default gid for reserved blocks */ + uint32_t e2fs_icount; /* Inode count */ + uint32_t e2fs_bcount; /* blocks count */ + uint32_t e2fs_rbcount; /* reserved blocks count */ + uint32_t e2fs_fbcount; /* free blocks count */ + uint32_t e2fs_ficount; /* free inodes count */ + uint32_t e2fs_first_dblock; /* first data block */ + uint32_t e2fs_log_bsize; /* block size = 1024*(2^e2fs_log_bsize) */ + uint32_t e2fs_log_fsize; /* fragment size */ + uint32_t e2fs_bpg; /* blocks per group */ + uint32_t e2fs_fpg; /* frags per group */ + uint32_t e2fs_ipg; /* inodes per group */ + uint32_t e2fs_mtime; /* mount time */ + uint32_t e2fs_wtime; /* write time */ + uint16_t e2fs_mnt_count; /* mount count */ + uint16_t e2fs_max_mnt_count; /* max mount count */ + uint16_t e2fs_magic; /* magic number */ + uint16_t e2fs_state; /* file system state */ + uint16_t e2fs_beh; /* behavior on errors */ + uint16_t e2fs_minrev; /* minor revision level */ + uint32_t e2fs_lastfsck; /* time of last fsck */ + uint32_t e2fs_fsckintv; /* max time between fscks */ + uint32_t e2fs_creator; /* creator OS */ + uint32_t e2fs_rev; /* revision level */ + uint16_t e2fs_ruid; /* default uid for reserved blocks */ + uint16_t e2fs_rgid; /* default gid for reserved blocks */ /* EXT2_DYNAMIC_REV superblocks */ - u_int32_t e2fs_first_ino; /* first non-reserved inode */ - u_int16_t e2fs_inode_size; /* size of inode structure */ - u_int16_t e2fs_block_group_nr; /* block grp number of this sblk*/ - u_int32_t e2fs_features_compat; /* compatible feature set */ - u_int32_t e2fs_features_incompat; /* incompatible feature set */ - u_int32_t e2fs_features_rocompat; /* RO-compatible feature set */ - u_int8_t e2fs_uuid[16]; /* 128-bit uuid for volume */ - char e2fs_vname[16]; /* volume name */ - char e2fs_fsmnt[64]; /* name mounted on */ - u_int32_t e2fs_algo; /* For comcate for dir */ - u_int16_t e2fs_reserved_ngdb; /* # of reserved gd blocks for resize */ - u_int32_t reserved2[204]; + uint32_t e2fs_first_ino; /* first non-reserved inode */ + uint16_t e2fs_inode_size; /* size of inode structure */ + uint16_t e2fs_block_group_nr; /* block grp number of this sblk*/ + uint32_t e2fs_features_compat; /* compatible feature set */ + uint32_t e2fs_features_incompat; /* incompatible feature set */ + uint32_t e2fs_features_rocompat; /* RO-compatible feature set */ + uint8_t e2fs_uuid[16]; /* 128-bit uuid for volume */ + char e2fs_vname[16]; /* volume name */ + char e2fs_fsmnt[64]; /* name mounted on */ + uint32_t e2fs_algo; /* For compression */ + uint8_t e2fs_prealloc; /* # of blocks for old prealloc */ + uint8_t e2fs_dir_prealloc; /* # of blocks for old prealloc dirs */ + uint16_t e2fs_reserved_ngdb; /* # of reserved gd blocks for resize */ + char e3fs_journal_uuid[16]; /* uuid of journal superblock */ + uint32_t e3fs_journal_inum; /* inode number of journal file */ + uint32_t e3fs_journal_dev; /* device number of journal file */ + uint32_t e3fs_last_orphan; /* start of list of inodes to delete */ + uint32_t e3fs_hash_seed[4]; /* HTREE hash seed */ + char e3fs_def_hash_version; /* Default hash version to use */ + char e3fs_reserved_char_pad; + uint32_t e3fs_default_mount_opts; + uint32_t e3fs_first_meta_bg; /* First metablock block group */ + uint32_t reserved2[190]; /* Padding to the end of the block */ }; @@ -112,14 +123,14 @@ struct ext2fs { struct m_ext2fs { struct ext2fs * e2fs; - char e2fs_fsmnt[MAXMNTLEN];/* name mounted on */ - char e2fs_ronly; /* mounted read-only flag */ - char e2fs_fmod; /* super block modified flag */ + char e2fs_fsmnt[MAXMNTLEN];/* name mounted on */ + char e2fs_ronly; /* mounted read-only flag */ + char e2fs_fmod; /* super block modified flag */ uint32_t e2fs_bsize; /* Block size */ uint32_t e2fs_bshift; /* calc of logical block no */ - int32_t e2fs_bmask; /* calc of block offset */ - int32_t e2fs_bpg; /* Number of blocks per group */ - int64_t e2fs_qbmask; /* = s_blocksize -1 */ + int32_t e2fs_bmask; /* calc of block offset */ + int32_t e2fs_bpg; /* Number of blocks per group */ + int64_t e2fs_qbmask; /* = s_blocksize -1 */ uint32_t e2fs_fsbtodb; /* Shift to get disk block */ uint32_t e2fs_ipg; /* Number of inodes per group */ uint32_t e2fs_ipb; /* Number of inodes per block */ @@ -137,9 +148,9 @@ struct m_ext2fs { uint32_t e2fs_blocksize_bits; uint32_t e2fs_total_dir; /* Total number of directories */ uint8_t *e2fs_contigdirs; /* (u) # of contig. allocated dirs */ - char e2fs_wasvalid; /* valid at mount time */ - off_t e2fs_maxfilesize; - struct ext2_gd *e2fs_gd; /* Group Descriptors */ + char e2fs_wasvalid; /* valid at mount time */ + off_t e2fs_maxfilesize; + struct ext2_gd *e2fs_gd; /* Group Descriptors */ }; /* @@ -232,14 +243,14 @@ struct m_ext2fs { /* ext2 file system block group descriptor */ struct ext2_gd { - u_int32_t ext2bgd_b_bitmap; /* blocks bitmap block */ - u_int32_t ext2bgd_i_bitmap; /* inodes bitmap block */ - u_int32_t ext2bgd_i_tables; /* inodes table block */ - u_int16_t ext2bgd_nbfree; /* number of free blocks */ - u_int16_t ext2bgd_nifree; /* number of free inodes */ - u_int16_t ext2bgd_ndirs; /* number of directories */ - u_int16_t reserved; - u_int32_t reserved2[3]; + uint32_t ext2bgd_b_bitmap; /* blocks bitmap block */ + uint32_t ext2bgd_i_bitmap; /* inodes bitmap block */ + uint32_t ext2bgd_i_tables; /* inodes table block */ + uint16_t ext2bgd_nbfree; /* number of free blocks */ + uint16_t ext2bgd_nifree; /* number of free inodes */ + uint16_t ext2bgd_ndirs; /* number of directories */ + uint16_t reserved; + uint32_t reserved2[3]; }; /* EXT2FS metadatas are stored in little-endian byte order. These macros diff --git a/sys/fs/ext2fs/inode.h b/sys/fs/ext2fs/inode.h index 4fd66019a78e..99437d5bc034 100644 --- a/sys/fs/ext2fs/inode.h +++ b/sys/fs/ext2fs/inode.h @@ -63,7 +63,7 @@ struct inode { struct vnode *i_vnode;/* Vnode associated with this inode. */ struct ext2mount *i_ump; - u_int32_t i_flag; /* flags, see below */ + uint32_t i_flag; /* flags, see below */ ino_t i_number; /* The identity of the inode. */ struct m_ext2fs *i_e2fs; /* EXT2FS */ @@ -71,21 +71,21 @@ struct inode { /* * Side effects; used during directory lookup. */ - int32_t i_count; /* Size of free slot in directory. */ - doff_t i_endoff; /* End of useful stuff in directory. */ - doff_t i_diroff; /* Offset in dir, where we found last entry. */ - doff_t i_offset; /* Offset of free space in directory. */ + int32_t i_count; /* Size of free slot in directory. */ + doff_t i_endoff; /* End of useful stuff in directory. */ + doff_t i_diroff; /* Offset in dir, where we found last entry. */ + doff_t i_offset; /* Offset of free space in directory. */ - u_int32_t i_block_group; - u_int32_t i_next_alloc_block; - u_int32_t i_next_alloc_goal; - u_int32_t i_prealloc_block; - u_int32_t i_prealloc_count; + uint32_t i_block_group; + uint32_t i_next_alloc_block; + uint32_t i_next_alloc_goal; + uint32_t i_prealloc_block; + uint32_t i_prealloc_count; /* Fields from struct dinode in UFS. */ - u_int16_t i_mode; /* IFMT, permissions; see below. */ + uint16_t i_mode; /* IFMT, permissions; see below. */ int16_t i_nlink; /* File link count. */ - u_int64_t i_size; /* File byte count. */ + uint64_t i_size; /* File byte count. */ int32_t i_atime; /* Last access time. */ int32_t i_atimensec; /* Last access time. */ int32_t i_mtime; /* Last modified time. */ @@ -94,11 +94,11 @@ struct inode { int32_t i_ctimensec; /* Last inode change time. */ int32_t i_db[NDADDR]; /* Direct disk blocks. */ int32_t i_ib[NIADDR]; /* Indirect disk blocks. */ - u_int32_t i_flags; /* Status flags (chflags). */ + uint32_t i_flags; /* Status flags (chflags). */ int32_t i_blocks; /* Blocks actually held. */ int32_t i_gen; /* Generation number. */ - u_int32_t i_uid; /* File owner. */ - u_int32_t i_gid; /* File group. */ + uint32_t i_uid; /* File owner. */ + uint32_t i_gid; /* File group. */ }; /* @@ -162,10 +162,10 @@ struct indir { /* This overlays the fid structure (see mount.h). */ struct ufid { - u_int16_t ufid_len; /* Length of structure. */ - u_int16_t ufid_pad; /* Force 32-bit alignment. */ - ino_t ufid_ino; /* File number (ino). */ - int32_t ufid_gen; /* Generation number. */ + uint16_t ufid_len; /* Length of structure. */ + uint16_t ufid_pad; /* Force 32-bit alignment. */ + ino_t ufid_ino; /* File number (ino). */ + int32_t ufid_gen; /* Generation number. */ }; #endif /* _KERNEL */