vxfs_inode.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:5k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * Copyright (c) 2000-2001 Christoph Hellwig.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions, and the following disclaimer,
  10.  *    without modification.
  11.  * 2. The name of the author may not be used to endorse or promote products
  12.  *    derived from this software without specific prior written permission.
  13.  *
  14.  * Alternatively, this software may be distributed under the terms of the
  15.  * GNU General Public License ("GPL").
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  18.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20.  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  21.  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27.  * SUCH DAMAGE.
  28.  *
  29.  */
  30. #ifndef _VXFS_INODE_H_
  31. #define _VXFS_INODE_H_
  32. #ident "$Id: vxfs_inode.h,v 1.15 2001/05/26 22:41:23 hch Exp hch $"
  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. u_int8_t vi_immed[VXFS_NIMMED];
  63. };
  64. struct vxfs_ext4 {
  65. u_int32_t ve4_spare; /* ?? */
  66. u_int32_t ve4_indsize; /* Indirect extent size */
  67. vx_daddr_t ve4_indir[VXFS_NIADDR]; /* Indirect extents */
  68. struct direct { /* Direct extents */
  69. vx_daddr_t extent; /* Extent number */
  70. int32_t size; /* Size of extent */
  71. } ve4_direct[VXFS_NDADDR];
  72. };
  73. struct vxfs_typed {
  74. u_int64_t vt_hdr; /* Header, 0xTTOOOOOOOOOOOOOO; T=type,O=offs */
  75. vx_daddr_t vt_block; /* Extent block */
  76. int32_t vt_size; /* Size in blocks */
  77. };
  78. struct vxfs_typed_dev4 {
  79. u_int64_t vd4_hdr; /* Header, 0xTTOOOOOOOOOOOOOO; T=type,O=offs */
  80. u_int64_t vd4_block; /* Extent block */
  81. u_int64_t vd4_size; /* Size in blocks */
  82. int32_t vd4_dev; /* Device ID */
  83. u_int32_t __pad1;
  84. };
  85. /*
  86.  * The inode as contained on the physical device.
  87.  */
  88. struct vxfs_dinode {
  89. int32_t vdi_mode;
  90. u_int32_t vdi_nlink; /* Link count */
  91. u_int32_t vdi_uid; /* UID */
  92. u_int32_t vdi_gid; /* GID */
  93. u_int64_t vdi_size; /* Inode size in bytes */
  94. u_int32_t vdi_atime; /* Last time accessed - sec */
  95. u_int32_t vdi_autime; /* Last time accessed - usec */
  96. u_int32_t vdi_mtime; /* Last modify time - sec */
  97. u_int32_t vdi_mutime; /* Last modify time - usec */
  98. u_int32_t vdi_ctime; /* Create time - sec */
  99. u_int32_t vdi_cutime; /* Create time - usec */
  100. u_int8_t vdi_aflags; /* Allocation flags */
  101. u_int8_t vdi_orgtype; /* Organisation type */
  102. u_int16_t vdi_eopflags;
  103. u_int32_t vdi_eopdata;
  104. union {
  105. u_int32_t rdev;
  106. u_int32_t dotdot;
  107. struct {
  108. u_int32_t reserved;
  109. u_int32_t fixextsize;
  110. } i_regular;
  111. struct {
  112. u_int32_t matchino;
  113. u_int32_t fsetindex;
  114. } i_vxspec;
  115. u_int64_t align;
  116. } vdi_ftarea;
  117. u_int32_t vdi_blocks; /* How much blocks does inode occupy */
  118. u_int32_t vdi_gen; /* Inode generation */
  119. u_int64_t 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. u_int32_t 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.  * TBD: This should become a separate structure...
  139.  */
  140. #define vxfs_inode_info vxfs_dinode
  141. #define vii_mode vdi_mode
  142. #define vii_uid vdi_uid
  143. #define vii_gid vdi_gid
  144. #define vii_nlink vdi_nlink
  145. #define vii_size vdi_size
  146. #define vii_atime vdi_atime
  147. #define vii_ctime vdi_ctime
  148. #define vii_mtime vdi_mtime
  149. #define vii_blocks vdi_blocks
  150. #define vii_org vdi_org
  151. #define vii_orgtype vdi_orgtype
  152. #define vii_gen vdi_gen
  153. #define vii_rdev vdi_ftarea.rdev
  154. #define vii_dotdot vdi_ftarea.dotdot
  155. #define vii_fixextsize vdi_ftarea.regular.fixextsize
  156. #define vii_matchino vdi_ftarea.vxspec.matchino
  157. #define vii_fsetindex vdi_ftarea.vxspec.fsetindex
  158. #define vii_immed vdi_org.immed
  159. #define vii_ext4 vdi_org.ext4
  160. #define vii_typed vdi_org.typed
  161. #endif /* _VXFS_INODE_H_ */