diff options
author | Martin Pelikan <pelikan@cvs.openbsd.org> | 2014-07-11 12:08:22 +0000 |
---|---|---|
committer | Martin Pelikan <pelikan@cvs.openbsd.org> | 2014-07-11 12:08:22 +0000 |
commit | d1d6ad5e77514dab7c869b9b3e26ea3e05f80117 (patch) | |
tree | 5f738460e48b5bbe108e1ad524bde5d82a1661f9 /sys/ufs/ext2fs | |
parent | 3b948690f9f782345cd1eb523dc6e340dfb018f2 (diff) |
updated inode format, whitespace, re-formatting
Diffstat (limited to 'sys/ufs/ext2fs')
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_dinode.h | 43 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_inode.c | 53 |
2 files changed, 51 insertions, 45 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_dinode.h b/sys/ufs/ext2fs/ext2fs_dinode.h index 7abe1214cf2..5e20f07f1f2 100644 --- a/sys/ufs/ext2fs/ext2fs_dinode.h +++ b/sys/ufs/ext2fs/ext2fs_dinode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_dinode.h,v 1.14 2014/07/10 09:24:18 pelikan Exp $ */ +/* $OpenBSD: ext2fs_dinode.h,v 1.15 2014/07/11 12:08:21 pelikan Exp $ */ /* $NetBSD: ext2fs_dinode.h,v 1.6 2000/01/26 16:21:33 bouyer Exp $ */ /* @@ -66,27 +66,36 @@ struct ext2fs_dinode { u_int16_t e2di_mode; /* 0: IFMT, permissions; see below. */ - u_int16_t e2di_uid_low; /* 2: Owner UID, lowest bits */ - 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_uid_low; /* 2: owner UID, bits 15:0 */ + u_int32_t e2di_size; /* 4: file size (bytes) bits 31:0 */ + u_int32_t e2di_atime; /* 8: Access time */ + u_int32_t e2di_ctime; /* 12: Change time */ + u_int32_t e2di_mtime; /* 16: Modification time */ + u_int32_t e2di_dtime; /* 20: Deletion time */ u_int16_t e2di_gid_low; /* 24: Owner GID, lowest bits */ 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_nblock; /* 28: blocks count */ + u_int32_t e2di_flags; /* 32: status flags (chflags) */ + u_int32_t e2di_version_lo; /* 36: inode version, bits 31:0 */ u_int32_t e2di_blocks[NDADDR+NIADDR]; /* 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_facl; /* 104: file ACL, bits 31:0 */ + u_int32_t e2di_size_hi; /* 108: file size (bytes), bits 63:32 */ u_int32_t e2di_faddr; /* 112: fragment address (obsolete) */ - u_int16_t e2di_nblock_hi; /* 116: Blocks count bits 47:32 */ - u_int16_t e2di_facl_hi; /* 118: file ACL bits 47:32 */ - u_int16_t e2di_uid_high; /* 120: 16 highest bits of uid */ - u_int16_t e2di_gid_high; /* 122: 16 highest bits of gid */ - u_int32_t e2di_linux_reserved3; /* 124 */ + u_int16_t e2di_nblock_hi; /* 116: blocks count, bits 47:32 */ + u_int16_t e2di_facl_hi; /* 118: file ACL, bits 47:32 */ + u_int16_t e2di_uid_high; /* 120: owner UID, bits 31:16 */ + u_int16_t e2di_gid_high; /* 122: owner GID, bits 31:16 */ + u_int16_t e2di_chksum_lo; /* 124: inode checksum, bits 15:0 */ + u_int16_t e2di__reserved; /* 126: unused */ + u_int16_t e2di_isize; /* 128: size of this inode */ + u_int16_t e2di_chksum_hi; /* 130: inode checksum, bits 31:16 */ + u_int32_t e2di_x_ctime; /* 132: extra Change time */ + u_int32_t e2di_x_mtime; /* 136: extra Modification time */ + u_int32_t e2di_x_atime; /* 140: extra Access time */ + u_int32_t e2di_crtime; /* 144: Creation (birth) time */ + u_int32_t e2di_x_crtime; /* 148: extra Creation (birth) time */ + u_int32_t e2di_version_hi; /* 152: inode version, bits 63:31 */ }; #define E2MAXSYMLINKLEN ((NDADDR + NIADDR) * sizeof(u_int32_t)) diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c index 83f9feedc45..be01e0c9cd1 100644 --- a/sys/ufs/ext2fs/ext2fs_inode.c +++ b/sys/ufs/ext2fs/ext2fs_inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_inode.c,v 1.49 2014/07/08 17:19:26 deraadt Exp $ */ +/* $OpenBSD: ext2fs_inode.c,v 1.50 2014/07/11 12:08:21 pelikan Exp $ */ /* $NetBSD: ext2fs_inode.c,v 1.24 2001/06/19 12:59:18 wiz Exp $ */ /* @@ -62,40 +62,37 @@ static int ext2fs_indirtrunc(struct inode *, int32_t, int32_t, u_int64_t ext2fs_size(struct inode *ip) { - u_int64_t size = ip->i_e2fs_size; + u_int64_t size = ip->i_e2fs_size; - if ((ip->i_e2fs_mode & IFMT) == IFREG) - size |= (u_int64_t)ip->i_e2fs_dacl << 32; + if ((ip->i_e2fs_mode & IFMT) == IFREG) + size |= (u_int64_t)ip->i_e2fs_size_hi << 32; - return (size); + return (size); } int ext2fs_setsize(struct inode *ip, u_int64_t size) { - if ((ip->i_e2fs_mode & IFMT) == IFREG || - ip->i_e2fs_mode == 0) { - ip->i_e2fs_dacl = size >> 32; - if (size >= 0x80000000U) { - struct m_ext2fs *fs = ip->i_e2fs; - - if (fs->e2fs.e2fs_rev <= E2FS_REV0) { - /* Linux automagically upgrades to REV1 here! */ - return (EFBIG); - } - if (!(fs->e2fs.e2fs_features_rocompat - & EXT2F_ROCOMPAT_LARGEFILE)) { - fs->e2fs.e2fs_features_rocompat |= - EXT2F_ROCOMPAT_LARGEFILE; - fs->e2fs_fmod = 1; - } - } - } else if (size >= 0x80000000U) - return (EFBIG); - - ip->i_e2fs_size = size; - - return (0); + struct m_ext2fs *fs = ip->i_e2fs; + + if (size < /* XXX MAXFILESIZE */ INT_MAX) { + /* If HUGE_FILEs are off, e2fs_maxfilesize will protect us. */ + if ((ip->i_e2fs_mode & IFMT) == IFREG || ip->i_e2fs_mode == 0) + ip->i_e2fs_size_hi = size >> 32; + + ip->i_e2fs_size = size; + return (0); + } + + /* Linux automagically upgrades to REV1 here! */ + if (fs->e2fs.e2fs_rev <= E2FS_REV0) + return (EFBIG); + + if ((fs->e2fs.e2fs_features_rocompat & EXT2F_ROCOMPAT_LARGEFILE) == 0) { + fs->e2fs.e2fs_features_rocompat |= EXT2F_ROCOMPAT_LARGEFILE; + fs->e2fs_fmod = 1; + } + return (EFBIG); } |