18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (c) 2000-2001 Christoph Hellwig. 38c2ecf20Sopenharmony_ci * Copyright (c) 2016 Krzysztof Blaszkowski 48c2ecf20Sopenharmony_ci * All rights reserved. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 78c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions 88c2ecf20Sopenharmony_ci * are met: 98c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright 108c2ecf20Sopenharmony_ci * notice, this list of conditions, and the following disclaimer, 118c2ecf20Sopenharmony_ci * without modification. 128c2ecf20Sopenharmony_ci * 2. The name of the author may not be used to endorse or promote products 138c2ecf20Sopenharmony_ci * derived from this software without specific prior written permission. 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the 168c2ecf20Sopenharmony_ci * GNU General Public License ("GPL"). 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 198c2ecf20Sopenharmony_ci * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 208c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 218c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 228c2ecf20Sopenharmony_ci * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 238c2ecf20Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 248c2ecf20Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 258c2ecf20Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 268c2ecf20Sopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 278c2ecf20Sopenharmony_ci * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 288c2ecf20Sopenharmony_ci * SUCH DAMAGE. 298c2ecf20Sopenharmony_ci * 308c2ecf20Sopenharmony_ci */ 318c2ecf20Sopenharmony_ci#ifndef _VXFS_INODE_H_ 328c2ecf20Sopenharmony_ci#define _VXFS_INODE_H_ 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci/* 358c2ecf20Sopenharmony_ci * Veritas filesystem driver - inode structure. 368c2ecf20Sopenharmony_ci * 378c2ecf20Sopenharmony_ci * This file contains the definition of the disk and core 388c2ecf20Sopenharmony_ci * inodes of the Veritas Filesystem. 398c2ecf20Sopenharmony_ci */ 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define VXFS_ISIZE 0x100 /* Inode size */ 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define VXFS_NDADDR 10 /* Number of direct addrs in inode */ 458c2ecf20Sopenharmony_ci#define VXFS_NIADDR 2 /* Number of indirect addrs in inode */ 468c2ecf20Sopenharmony_ci#define VXFS_NIMMED 96 /* Size of immediate data in inode */ 478c2ecf20Sopenharmony_ci#define VXFS_NTYPED 6 /* Num of typed extents */ 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#define VXFS_TYPED_OFFSETMASK (0x00FFFFFFFFFFFFFFULL) 508c2ecf20Sopenharmony_ci#define VXFS_TYPED_TYPEMASK (0xFF00000000000000ULL) 518c2ecf20Sopenharmony_ci#define VXFS_TYPED_TYPESHIFT 56 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define VXFS_TYPED_PER_BLOCK(sbp) \ 548c2ecf20Sopenharmony_ci ((sbp)->s_blocksize / sizeof(struct vxfs_typed)) 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* 578c2ecf20Sopenharmony_ci * Possible extent descriptor types for %VXFS_ORG_TYPED extents. 588c2ecf20Sopenharmony_ci */ 598c2ecf20Sopenharmony_cienum { 608c2ecf20Sopenharmony_ci VXFS_TYPED_INDIRECT = 1, 618c2ecf20Sopenharmony_ci VXFS_TYPED_DATA = 2, 628c2ecf20Sopenharmony_ci VXFS_TYPED_INDIRECT_DEV4 = 3, 638c2ecf20Sopenharmony_ci VXFS_TYPED_DATA_DEV4 = 4, 648c2ecf20Sopenharmony_ci}; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci/* 678c2ecf20Sopenharmony_ci * Data stored immediately in the inode. 688c2ecf20Sopenharmony_ci */ 698c2ecf20Sopenharmony_cistruct vxfs_immed { 708c2ecf20Sopenharmony_ci __u8 vi_immed[VXFS_NIMMED]; 718c2ecf20Sopenharmony_ci}; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_cistruct vxfs_ext4 { 748c2ecf20Sopenharmony_ci __fs32 ve4_spare; /* ?? */ 758c2ecf20Sopenharmony_ci __fs32 ve4_indsize; /* Indirect extent size */ 768c2ecf20Sopenharmony_ci __fs32 ve4_indir[VXFS_NIADDR]; /* Indirect extents */ 778c2ecf20Sopenharmony_ci struct direct { /* Direct extents */ 788c2ecf20Sopenharmony_ci __fs32 extent; /* Extent number */ 798c2ecf20Sopenharmony_ci __fs32 size; /* Size of extent */ 808c2ecf20Sopenharmony_ci } ve4_direct[VXFS_NDADDR]; 818c2ecf20Sopenharmony_ci}; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_cistruct vxfs_typed { 848c2ecf20Sopenharmony_ci __fs64 vt_hdr; /* Header, 0xTTOOOOOOOOOOOOOO; T=type,O=offs */ 858c2ecf20Sopenharmony_ci __fs32 vt_block; /* Extent block */ 868c2ecf20Sopenharmony_ci __fs32 vt_size; /* Size in blocks */ 878c2ecf20Sopenharmony_ci}; 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_cistruct vxfs_typed_dev4 { 908c2ecf20Sopenharmony_ci __fs64 vd4_hdr; /* Header, 0xTTOOOOOOOOOOOOOO; T=type,O=offs */ 918c2ecf20Sopenharmony_ci __fs64 vd4_block; /* Extent block */ 928c2ecf20Sopenharmony_ci __fs64 vd4_size; /* Size in blocks */ 938c2ecf20Sopenharmony_ci __fs32 vd4_dev; /* Device ID */ 948c2ecf20Sopenharmony_ci __u8 __pad1; 958c2ecf20Sopenharmony_ci}; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci/* 988c2ecf20Sopenharmony_ci * The inode as contained on the physical device. 998c2ecf20Sopenharmony_ci */ 1008c2ecf20Sopenharmony_cistruct vxfs_dinode { 1018c2ecf20Sopenharmony_ci __fs32 vdi_mode; 1028c2ecf20Sopenharmony_ci __fs32 vdi_nlink; /* Link count */ 1038c2ecf20Sopenharmony_ci __fs32 vdi_uid; /* UID */ 1048c2ecf20Sopenharmony_ci __fs32 vdi_gid; /* GID */ 1058c2ecf20Sopenharmony_ci __fs64 vdi_size; /* Inode size in bytes */ 1068c2ecf20Sopenharmony_ci __fs32 vdi_atime; /* Last time accessed - sec */ 1078c2ecf20Sopenharmony_ci __fs32 vdi_autime; /* Last time accessed - usec */ 1088c2ecf20Sopenharmony_ci __fs32 vdi_mtime; /* Last modify time - sec */ 1098c2ecf20Sopenharmony_ci __fs32 vdi_mutime; /* Last modify time - usec */ 1108c2ecf20Sopenharmony_ci __fs32 vdi_ctime; /* Create time - sec */ 1118c2ecf20Sopenharmony_ci __fs32 vdi_cutime; /* Create time - usec */ 1128c2ecf20Sopenharmony_ci __u8 vdi_aflags; /* Allocation flags */ 1138c2ecf20Sopenharmony_ci __u8 vdi_orgtype; /* Organisation type */ 1148c2ecf20Sopenharmony_ci __fs16 vdi_eopflags; 1158c2ecf20Sopenharmony_ci __fs32 vdi_eopdata; 1168c2ecf20Sopenharmony_ci union { 1178c2ecf20Sopenharmony_ci __fs32 rdev; 1188c2ecf20Sopenharmony_ci __fs32 dotdot; 1198c2ecf20Sopenharmony_ci struct { 1208c2ecf20Sopenharmony_ci __u32 reserved; 1218c2ecf20Sopenharmony_ci __fs32 fixextsize; 1228c2ecf20Sopenharmony_ci } i_regular; 1238c2ecf20Sopenharmony_ci struct { 1248c2ecf20Sopenharmony_ci __fs32 matchino; 1258c2ecf20Sopenharmony_ci __fs32 fsetindex; 1268c2ecf20Sopenharmony_ci } i_vxspec; 1278c2ecf20Sopenharmony_ci __u64 align; 1288c2ecf20Sopenharmony_ci } vdi_ftarea; 1298c2ecf20Sopenharmony_ci __fs32 vdi_blocks; /* How much blocks does inode occupy */ 1308c2ecf20Sopenharmony_ci __fs32 vdi_gen; /* Inode generation */ 1318c2ecf20Sopenharmony_ci __fs64 vdi_version; /* Version */ 1328c2ecf20Sopenharmony_ci union { 1338c2ecf20Sopenharmony_ci struct vxfs_immed immed; 1348c2ecf20Sopenharmony_ci struct vxfs_ext4 ext4; 1358c2ecf20Sopenharmony_ci struct vxfs_typed typed[VXFS_NTYPED]; 1368c2ecf20Sopenharmony_ci } vdi_org; 1378c2ecf20Sopenharmony_ci __fs32 vdi_iattrino; 1388c2ecf20Sopenharmony_ci}; 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci#define vdi_rdev vdi_ftarea.rdev 1418c2ecf20Sopenharmony_ci#define vdi_dotdot vdi_ftarea.dotdot 1428c2ecf20Sopenharmony_ci#define vdi_fixextsize vdi_ftarea.regular.fixextsize 1438c2ecf20Sopenharmony_ci#define vdi_matchino vdi_ftarea.vxspec.matchino 1448c2ecf20Sopenharmony_ci#define vdi_fsetindex vdi_ftarea.vxspec.fsetindex 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci#define vdi_immed vdi_org.immed 1478c2ecf20Sopenharmony_ci#define vdi_ext4 vdi_org.ext4 1488c2ecf20Sopenharmony_ci#define vdi_typed vdi_org.typed 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci/* 1528c2ecf20Sopenharmony_ci * The inode as represented in the main memory. 1538c2ecf20Sopenharmony_ci */ 1548c2ecf20Sopenharmony_cistruct vxfs_inode_info { 1558c2ecf20Sopenharmony_ci struct inode vfs_inode; 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci __u32 vii_mode; 1588c2ecf20Sopenharmony_ci __u32 vii_nlink; /* Link count */ 1598c2ecf20Sopenharmony_ci __u32 vii_uid; /* UID */ 1608c2ecf20Sopenharmony_ci __u32 vii_gid; /* GID */ 1618c2ecf20Sopenharmony_ci __u64 vii_size; /* Inode size in bytes */ 1628c2ecf20Sopenharmony_ci __u32 vii_atime; /* Last time accessed - sec */ 1638c2ecf20Sopenharmony_ci __u32 vii_autime; /* Last time accessed - usec */ 1648c2ecf20Sopenharmony_ci __u32 vii_mtime; /* Last modify time - sec */ 1658c2ecf20Sopenharmony_ci __u32 vii_mutime; /* Last modify time - usec */ 1668c2ecf20Sopenharmony_ci __u32 vii_ctime; /* Create time - sec */ 1678c2ecf20Sopenharmony_ci __u32 vii_cutime; /* Create time - usec */ 1688c2ecf20Sopenharmony_ci __u8 vii_orgtype; /* Organisation type */ 1698c2ecf20Sopenharmony_ci union { 1708c2ecf20Sopenharmony_ci __u32 rdev; 1718c2ecf20Sopenharmony_ci __u32 dotdot; 1728c2ecf20Sopenharmony_ci } vii_ftarea; 1738c2ecf20Sopenharmony_ci __u32 vii_blocks; /* How much blocks does inode occupy */ 1748c2ecf20Sopenharmony_ci __u32 vii_gen; /* Inode generation */ 1758c2ecf20Sopenharmony_ci union { 1768c2ecf20Sopenharmony_ci struct vxfs_immed immed; 1778c2ecf20Sopenharmony_ci struct vxfs_ext4 ext4; 1788c2ecf20Sopenharmony_ci struct vxfs_typed typed[VXFS_NTYPED]; 1798c2ecf20Sopenharmony_ci } vii_org; 1808c2ecf20Sopenharmony_ci}; 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci#define vii_rdev vii_ftarea.rdev 1838c2ecf20Sopenharmony_ci#define vii_dotdot vii_ftarea.dotdot 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci#define vii_immed vii_org.immed 1868c2ecf20Sopenharmony_ci#define vii_ext4 vii_org.ext4 1878c2ecf20Sopenharmony_ci#define vii_typed vii_org.typed 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_cistatic inline struct vxfs_inode_info *VXFS_INO(struct inode *inode) 1908c2ecf20Sopenharmony_ci{ 1918c2ecf20Sopenharmony_ci return container_of(inode, struct vxfs_inode_info, vfs_inode); 1928c2ecf20Sopenharmony_ci} 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ci#endif /* _VXFS_INODE_H_ */ 195