vxfs_inode.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /*
  2. * Copyright (c) 2000-2001 Christoph Hellwig.
  3. * Copyright (c) 2016 Krzysztof Blaszkowski
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions, and the following disclaimer,
  11. * without modification.
  12. * 2. The name of the author may not be used to endorse or promote products
  13. * derived from this software without specific prior written permission.
  14. *
  15. * Alternatively, this software may be distributed under the terms of the
  16. * GNU General Public License ("GPL").
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  19. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  22. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. * SUCH DAMAGE.
  29. *
  30. */
  31. #ifndef _VXFS_INODE_H_
  32. #define _VXFS_INODE_H_
  33. /*
  34. * Veritas filesystem driver - inode structure.
  35. *
  36. * This file contains the definition of the disk and core
  37. * inodes of the Veritas Filesystem.
  38. */
  39. #define VXFS_ISIZE 0x100 /* Inode size */
  40. #define VXFS_NDADDR 10 /* Number of direct addrs in inode */
  41. #define VXFS_NIADDR 2 /* Number of indirect addrs in inode */
  42. #define VXFS_NIMMED 96 /* Size of immediate data in inode */
  43. #define VXFS_NTYPED 6 /* Num of typed extents */
  44. #define VXFS_TYPED_OFFSETMASK (0x00FFFFFFFFFFFFFFULL)
  45. #define VXFS_TYPED_TYPEMASK (0xFF00000000000000ULL)
  46. #define VXFS_TYPED_TYPESHIFT 56
  47. #define VXFS_TYPED_PER_BLOCK(sbp) \
  48. ((sbp)->s_blocksize / sizeof(struct vxfs_typed))
  49. /*
  50. * Possible extent descriptor types for %VXFS_ORG_TYPED extents.
  51. */
  52. enum {
  53. VXFS_TYPED_INDIRECT = 1,
  54. VXFS_TYPED_DATA = 2,
  55. VXFS_TYPED_INDIRECT_DEV4 = 3,
  56. VXFS_TYPED_DATA_DEV4 = 4,
  57. };
  58. /*
  59. * Data stored immediately in the inode.
  60. */
  61. struct vxfs_immed {
  62. __u8 vi_immed[VXFS_NIMMED];
  63. };
  64. struct vxfs_ext4 {
  65. __fs32 ve4_spare; /* ?? */
  66. __fs32 ve4_indsize; /* Indirect extent size */
  67. __fs32 ve4_indir[VXFS_NIADDR]; /* Indirect extents */
  68. struct direct { /* Direct extents */
  69. __fs32 extent; /* Extent number */
  70. __fs32 size; /* Size of extent */
  71. } ve4_direct[VXFS_NDADDR];
  72. };
  73. struct vxfs_typed {
  74. __fs64 vt_hdr; /* Header, 0xTTOOOOOOOOOOOOOO; T=type,O=offs */
  75. __fs32 vt_block; /* Extent block */
  76. __fs32 vt_size; /* Size in blocks */
  77. };
  78. struct vxfs_typed_dev4 {
  79. __fs64 vd4_hdr; /* Header, 0xTTOOOOOOOOOOOOOO; T=type,O=offs */
  80. __fs64 vd4_block; /* Extent block */
  81. __fs64 vd4_size; /* Size in blocks */
  82. __fs32 vd4_dev; /* Device ID */
  83. __u8 __pad1;
  84. };
  85. /*
  86. * The inode as contained on the physical device.
  87. */
  88. struct vxfs_dinode {
  89. __fs32 vdi_mode;
  90. __fs32 vdi_nlink; /* Link count */
  91. __fs32 vdi_uid; /* UID */
  92. __fs32 vdi_gid; /* GID */
  93. __fs64 vdi_size; /* Inode size in bytes */
  94. __fs32 vdi_atime; /* Last time accessed - sec */
  95. __fs32 vdi_autime; /* Last time accessed - usec */
  96. __fs32 vdi_mtime; /* Last modify time - sec */
  97. __fs32 vdi_mutime; /* Last modify time - usec */
  98. __fs32 vdi_ctime; /* Create time - sec */
  99. __fs32 vdi_cutime; /* Create time - usec */
  100. __u8 vdi_aflags; /* Allocation flags */
  101. __u8 vdi_orgtype; /* Organisation type */
  102. __fs16 vdi_eopflags;
  103. __fs32 vdi_eopdata;
  104. union {
  105. __fs32 rdev;
  106. __fs32 dotdot;
  107. struct {
  108. __u32 reserved;
  109. __fs32 fixextsize;
  110. } i_regular;
  111. struct {
  112. __fs32 matchino;
  113. __fs32 fsetindex;
  114. } i_vxspec;
  115. __u64 align;
  116. } vdi_ftarea;
  117. __fs32 vdi_blocks; /* How much blocks does inode occupy */
  118. __fs32 vdi_gen; /* Inode generation */
  119. __fs64 vdi_version; /* Version */
  120. union {
  121. struct vxfs_immed immed;
  122. struct vxfs_ext4 ext4;
  123. struct vxfs_typed typed[VXFS_NTYPED];
  124. } vdi_org;
  125. __fs32 vdi_iattrino;
  126. };
  127. #define vdi_rdev vdi_ftarea.rdev
  128. #define vdi_dotdot vdi_ftarea.dotdot
  129. #define vdi_fixextsize vdi_ftarea.regular.fixextsize
  130. #define vdi_matchino vdi_ftarea.vxspec.matchino
  131. #define vdi_fsetindex vdi_ftarea.vxspec.fsetindex
  132. #define vdi_immed vdi_org.immed
  133. #define vdi_ext4 vdi_org.ext4
  134. #define vdi_typed vdi_org.typed
  135. /*
  136. * The inode as represented in the main memory.
  137. */
  138. struct vxfs_inode_info {
  139. struct inode vfs_inode;
  140. __u32 vii_mode;
  141. __u32 vii_nlink; /* Link count */
  142. __u32 vii_uid; /* UID */
  143. __u32 vii_gid; /* GID */
  144. __u64 vii_size; /* Inode size in bytes */
  145. __u32 vii_atime; /* Last time accessed - sec */
  146. __u32 vii_autime; /* Last time accessed - usec */
  147. __u32 vii_mtime; /* Last modify time - sec */
  148. __u32 vii_mutime; /* Last modify time - usec */
  149. __u32 vii_ctime; /* Create time - sec */
  150. __u32 vii_cutime; /* Create time - usec */
  151. __u8 vii_orgtype; /* Organisation type */
  152. union {
  153. __u32 rdev;
  154. __u32 dotdot;
  155. } vii_ftarea;
  156. __u32 vii_blocks; /* How much blocks does inode occupy */
  157. __u32 vii_gen; /* Inode generation */
  158. union {
  159. struct vxfs_immed immed;
  160. struct vxfs_ext4 ext4;
  161. struct vxfs_typed typed[VXFS_NTYPED];
  162. } vii_org;
  163. };
  164. #define vii_rdev vii_ftarea.rdev
  165. #define vii_dotdot vii_ftarea.dotdot
  166. #define vii_immed vii_org.immed
  167. #define vii_ext4 vii_org.ext4
  168. #define vii_typed vii_org.typed
  169. static inline struct vxfs_inode_info *VXFS_INO(struct inode *inode)
  170. {
  171. return container_of(inode, struct vxfs_inode_info, vfs_inode);
  172. }
  173. #endif /* _VXFS_INODE_H_ */