jfs_dinode.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) International Business Machines Corp., 2000-2001
  4. */
  5. #ifndef _H_JFS_DINODE
  6. #define _H_JFS_DINODE
  7. /*
  8. * jfs_dinode.h: on-disk inode manager
  9. */
  10. #define INODESLOTSIZE 128
  11. #define L2INODESLOTSIZE 7
  12. #define log2INODESIZE 9 /* log2(bytes per dinode) */
  13. /*
  14. * on-disk inode : 512 bytes
  15. *
  16. * note: align 64-bit fields on 8-byte boundary.
  17. */
  18. struct dinode {
  19. /*
  20. * I. base area (128 bytes)
  21. * ------------------------
  22. *
  23. * define generic/POSIX attributes
  24. */
  25. __le32 di_inostamp; /* 4: stamp to show inode belongs to fileset */
  26. __le32 di_fileset; /* 4: fileset number */
  27. __le32 di_number; /* 4: inode number, aka file serial number */
  28. __le32 di_gen; /* 4: inode generation number */
  29. pxd_t di_ixpxd; /* 8: inode extent descriptor */
  30. __le64 di_size; /* 8: size */
  31. __le64 di_nblocks; /* 8: number of blocks allocated */
  32. __le32 di_nlink; /* 4: number of links to the object */
  33. __le32 di_uid; /* 4: user id of owner */
  34. __le32 di_gid; /* 4: group id of owner */
  35. __le32 di_mode; /* 4: attribute, format and permission */
  36. struct timestruc_t di_atime; /* 8: time last data accessed */
  37. struct timestruc_t di_ctime; /* 8: time last status changed */
  38. struct timestruc_t di_mtime; /* 8: time last data modified */
  39. struct timestruc_t di_otime; /* 8: time created */
  40. dxd_t di_acl; /* 16: acl descriptor */
  41. dxd_t di_ea; /* 16: ea descriptor */
  42. __le32 di_next_index; /* 4: Next available dir_table index */
  43. __le32 di_acltype; /* 4: Type of ACL */
  44. /*
  45. * Extension Areas.
  46. *
  47. * Historically, the inode was partitioned into 4 128-byte areas,
  48. * the last 3 being defined as unions which could have multiple
  49. * uses. The first 96 bytes had been completely unused until
  50. * an index table was added to the directory. It is now more
  51. * useful to describe the last 3/4 of the inode as a single
  52. * union. We would probably be better off redesigning the
  53. * entire structure from scratch, but we don't want to break
  54. * commonality with OS/2's JFS at this time.
  55. */
  56. union {
  57. struct {
  58. /*
  59. * This table contains the information needed to
  60. * find a directory entry from a 32-bit index.
  61. * If the index is small enough, the table is inline,
  62. * otherwise, an x-tree root overlays this table
  63. */
  64. struct dir_table_slot _table[12]; /* 96: inline */
  65. dtroot_t _dtroot; /* 288: dtree root */
  66. } _dir; /* (384) */
  67. #define di_dirtable u._dir._table
  68. #define di_dtroot u._dir._dtroot
  69. #define di_parent di_dtroot.header.idotdot
  70. #define di_DASD di_dtroot.header.DASD
  71. struct {
  72. union {
  73. u8 _data[96]; /* 96: unused */
  74. struct {
  75. void *_imap; /* 4: unused */
  76. __le32 _gengen; /* 4: generator */
  77. } _imap;
  78. } _u1; /* 96: */
  79. #define di_gengen u._file._u1._imap._gengen
  80. union {
  81. xtpage_t _xtroot;
  82. struct {
  83. u8 unused[16]; /* 16: */
  84. dxd_t _dxd; /* 16: */
  85. union {
  86. /*
  87. * The fast symlink area
  88. * is expected to overflow
  89. * into _inlineea when
  90. * needed (which will clear
  91. * INLINEEA).
  92. */
  93. struct {
  94. union {
  95. __le32 _rdev; /* 4: */
  96. u8 _fastsymlink[128];
  97. } _u;
  98. u8 _inlineea[128];
  99. };
  100. u8 _inline_all[256];
  101. };
  102. } _special;
  103. } _u2;
  104. } _file;
  105. #define di_xtroot u._file._u2._xtroot
  106. #define di_dxd u._file._u2._special._dxd
  107. #define di_btroot di_xtroot
  108. #define di_inlinedata u._file._u2._special._u
  109. #define di_rdev u._file._u2._special._u._rdev
  110. #define di_fastsymlink u._file._u2._special._u._fastsymlink
  111. #define di_inlineea u._file._u2._special._inlineea
  112. #define di_inline_all u._file._u2._special._inline_all
  113. } u;
  114. };
  115. /* extended mode bits (on-disk inode di_mode) */
  116. #define IFJOURNAL 0x00010000 /* journalled file */
  117. #define ISPARSE 0x00020000 /* sparse file enabled */
  118. #define INLINEEA 0x00040000 /* inline EA area free */
  119. #define ISWAPFILE 0x00800000 /* file open for pager swap space */
  120. /* more extended mode bits: attributes for OS/2 */
  121. #define IREADONLY 0x02000000 /* no write access to file */
  122. #define IHIDDEN 0x04000000 /* hidden file */
  123. #define ISYSTEM 0x08000000 /* system file */
  124. #define IDIRECTORY 0x20000000 /* directory (shadow of real bit) */
  125. #define IARCHIVE 0x40000000 /* file archive bit */
  126. #define INEWNAME 0x80000000 /* non-8.3 filename format */
  127. #define IRASH 0x4E000000 /* mask for changeable attributes */
  128. #define ATTRSHIFT 25 /* bits to shift to move attribute
  129. specification to mode position */
  130. /* extended attributes for Linux */
  131. #define JFS_NOATIME_FL 0x00080000 /* do not update atime */
  132. #define JFS_DIRSYNC_FL 0x00100000 /* dirsync behaviour */
  133. #define JFS_SYNC_FL 0x00200000 /* Synchronous updates */
  134. #define JFS_SECRM_FL 0x00400000 /* Secure deletion */
  135. #define JFS_UNRM_FL 0x00800000 /* allow for undelete */
  136. #define JFS_APPEND_FL 0x01000000 /* writes to file may only append */
  137. #define JFS_IMMUTABLE_FL 0x02000000 /* Immutable file */
  138. #define JFS_FL_USER_VISIBLE 0x03F80000
  139. #define JFS_FL_USER_MODIFIABLE 0x03F80000
  140. #define JFS_FL_INHERIT 0x03C80000
  141. #endif /*_H_JFS_DINODE */