"Fossies" - the Fresh Open Source Software Archive

Member "jfsutils-1.1.15/include/jfs_filsys.h" (22 Nov 2005, 8338 Bytes) of archive /linux/misc/jfsutils-1.1.15.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "jfs_filsys.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  *   Copyright (c) International Business Machines Corp., 2000-2002
    3  *
    4  *   This program is free software;  you can redistribute it and/or modify
    5  *   it under the terms of the GNU General Public License as published by
    6  *   the Free Software Foundation; either version 2 of the License, or
    7  *   (at your option) any later version.
    8  *
    9  *   This program is distributed in the hope that it will be useful,
   10  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
   11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
   12  *   the GNU General Public License for more details.
   13  *
   14  *   You should have received a copy of the GNU General Public License
   15  *   along with this program;  if not, write to the Free Software
   16  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
   17  */
   18 #ifndef _H_JFS_FILSYS
   19 #define _H_JFS_FILSYS
   20 
   21 /*
   22  *  jfs_filsys.h
   23  *
   24  * file system (implementation-dependent) constants
   25  *
   26  * refer to <limits.h> for system wide implementation-dependent constants
   27  */
   28 
   29 #include "jfs_types.h"
   30 
   31 /*
   32  *   file system option (superblock flag)
   33  */
   34 /* platform option (conditional compilation) */
   35 #define JFS_AIX         0x80000000  /* AIX support */
   36 /*  POSIX name/directory  support */
   37 
   38 #define JFS_OS2         0x40000000  /* OS/2 support */
   39 /*  case-insensitive name/directory support */
   40 
   41 #define JFS_DFS         0x20000000  /* DCE DFS LFS support */
   42 
   43 #define JFS_LINUX       0x10000000  /* Linux support */
   44 /*  case-sensitive name/directory support */
   45 
   46 /* directory option */
   47 #define JFS_UNICODE     0x00000001  /* unicode name */
   48 
   49 /* commit option */
   50 #define JFS_COMMIT      0x00000f00  /* commit option mask */
   51 #define JFS_GROUPCOMMIT 0x00000100  /* group (of 1) commit */
   52 #define JFS_LAZYCOMMIT  0x00000200  /* lazy commit */
   53 #define JFS_TMPFS       0x00000400  /* temporary file system -
   54                      * do not log/commit:
   55                      */
   56 
   57 /* log logical volume option */
   58 #define JFS_INLINELOG   0x00000800  /* inline log within file system */
   59 #define JFS_INLINEMOVE  0x00001000  /* inline log being moved */
   60 
   61 /* Secondary aggregate inode table */
   62 #define JFS_BAD_SAIT    0x00010000  /* current secondary ait is bad */
   63 
   64 /* sparse regular file support */
   65 #define JFS_SPARSE      0x00020000  /* sparse regular file */
   66 
   67 /* DASD Limits      F226941 */
   68 #define JFS_DASD_ENABLED    0x00040000  /* DASD limits enabled */
   69 #define JFS_DASD_PRIME      0x00080000  /* Prime DASD usage on boot */
   70 
   71 /* Directory index */
   72 #define JFS_DIR_INDEX   0x00200000  /* Persistant index for */
   73                         /* directory entries    */
   74 
   75 
   76 /*
   77  *  buffer cache configuration
   78  */
   79 /* page size */
   80 #ifdef PSIZE
   81 #undef PSIZE
   82 #endif
   83 #define PSIZE       4096    /* page size (in byte) */
   84 #define L2PSIZE       12    /* log2(PSIZE) */
   85 #define POFFSET     4095    /* offset within page */
   86 
   87 /* buffer page size */
   88 #define BPSIZE  PSIZE
   89 
   90 /*
   91  *  fs fundamental size
   92  *
   93  * PSIZE >= file system block size >= PBSIZE >= DISIZE
   94  */
   95 #define PBSIZE      512 /* physical block size (in byte) */
   96 #define L2PBSIZE      9 /* log2(PBSIZE) */
   97 
   98 #define DISIZE      512 /* on-disk inode size (in byte) */
   99 #define L2DISIZE      9 /* log2(DISIZE) */
  100 
  101 #define IDATASIZE   256 /* inode inline data size */
  102 #define IXATTRSIZE  128 /* inode inline extended attribute size */
  103 
  104 #define XTPAGE_SIZE     4096
  105 #define log2_PAGESIZE     12
  106 
  107 #define IAG_SIZE        4096
  108 #define IAG_EXTENT_SIZE 4096
  109 #define INOSPERIAG      4096    /* number of disk inodes per iag */
  110 #define L2INOSPERIAG      12    /* l2 number of disk inodes per iag */
  111 #define INOSPEREXT        32    /* number of disk inode per extent */
  112 #define L2INOSPEREXT       5    /* l2 number of disk inode per extent */
  113 #define IXSIZE      (DISIZE * INOSPEREXT)   /* inode extent size */
  114 #define INOSPERPAGE        8    /* number of disk inodes per 4K page */
  115 #define L2INOSPERPAGE      3    /* log2(INOSPERPAGE) */
  116 
  117 #define IAGFREELIST_LWM   64
  118 
  119 #define INODE_EXTENT_SIZE       IXSIZE  /* inode extent size */
  120 #define NUM_INODE_PER_EXTENT    INOSPEREXT
  121 #define NUM_INODE_PER_IAG       INOSPERIAG
  122 
  123 #define MINBLOCKSIZE         512
  124 #define MAXBLOCKSIZE        4096
  125 #define MAXFILESIZE     ((int64_t)1 << 52)
  126 
  127 #define JFS_LINK_MAX       65535    /* nlink_t is unsigned short */
  128 
  129 /* Minimum number of bytes supported for a JFS partition */
  130 #define MINJFS          (0x1000000)
  131 #define MINJFSTEXT      "16"
  132 
  133 /*
  134  * fixed physical block address (physical block size = 512 byte)
  135  *
  136  * NOTE: since we can't guarantee a physical block size of 512 bytes the use of
  137  *   these macros should be removed and the byte offset macros used instead.
  138  */
  139 #define SUPER1_B    64  /* primary superblock */
  140 #define AIMAP_B     (SUPER1_B + 8)  /* 1st extent of aggregate inode map */
  141 #define AITBL_B     (AIMAP_B + 16)  /*
  142                      * 1st extent of aggregate inode table
  143                      */
  144 #define SUPER2_B    (AITBL_B + 32)  /* 2ndary superblock pbn */
  145 #define BMAP_B      (SUPER2_B + 8)  /* block allocation map */
  146 
  147 /*
  148  * SIZE_OF_SUPER defines the total amount of space reserved on disk for the
  149  * superblock.  This is not the same as the superblock structure, since all of
  150  * this space is not currently being used.
  151  */
  152 #define SIZE_OF_SUPER   PSIZE
  153 
  154 /*
  155  * SIZE_OF_AG_TABLE defines the amount of space reserved to hold the AG table
  156  */
  157 #define SIZE_OF_AG_TABLE    PSIZE
  158 
  159 /*
  160  * SIZE_OF_MAP_PAGE defines the amount of disk space reserved for each page of
  161  * the inode allocation map (to hold iag)
  162  */
  163 #define SIZE_OF_MAP_PAGE    PSIZE
  164 
  165 /*
  166  * fixed byte offset address
  167  */
  168 #define SUPER1_OFF  0x8000  /* primary superblock */
  169 #define AIMAP_OFF   (SUPER1_OFF + SIZE_OF_SUPER)
  170                     /*
  171                      * Control page of aggregate inode map
  172                      * followed by 1st extent of map
  173                      */
  174 #define AITBL_OFF   (AIMAP_OFF + (SIZE_OF_MAP_PAGE << 1))
  175                     /*
  176                      * 1st extent of aggregate inode table
  177                      */
  178 #define SUPER2_OFF  (AITBL_OFF + INODE_EXTENT_SIZE)
  179                     /*
  180                      * secondary superblock
  181                      */
  182 #define BMAP_OFF    (SUPER2_OFF + SIZE_OF_SUPER)
  183                     /*
  184                      * block allocation map
  185                      */
  186 
  187 /*
  188  * The following macro is used to indicate the number of reserved disk blocks at
  189  * the front of an aggregate, in terms of physical blocks.  This value is
  190  * currently defined to be 32K.  This turns out to be the same as the primary
  191  * superblock's address, since it directly follows the reserved blocks.
  192  */
  193 #define AGGR_RSVD_BLOCKS    SUPER1_B
  194 
  195 /*
  196  * The following macro is used to indicate the number of reserved bytes at the
  197  * front of an aggregate.  This value is currently defined to be 32K.  This
  198  * turns out to be the same as the primary superblock's byte offset, since it
  199  * directly follows the reserved blocks.
  200  */
  201 #define AGGR_RSVD_BYTES SUPER1_OFF
  202 
  203 /*
  204  * The following macro defines the byte offset for the first inode extent in
  205  * the aggregate inode table.  This allows us to find the self inode to find the
  206  * rest of the table.  Currently this value is 44K.
  207  */
  208 #define AGGR_INODE_TABLE_START  AITBL_OFF
  209 
  210 /*
  211  *  fixed reserved inode number
  212  */
  213 /* aggregate inode */
  214 #define AGGR_RESERVED_I 0   /* aggregate inode (reserved) */
  215 #define AGGREGATE_I     1   /* aggregate inode map inode */
  216 #define BMAP_I          2   /* aggregate block allocation map inode */
  217 #define LOG_I           3   /* aggregate inline log inode */
  218 #define BADBLOCK_I      4   /* aggregate bad block inode */
  219 #define FILESYSTEM_I    16  /* 1st/only fileset inode in ait:
  220                  * fileset inode map inode
  221                  */
  222 
  223 /* per fileset inode */
  224 #define FILESET_RSVD_I  0   /* fileset inode (reserved) */
  225 #define FILESET_EXT_I   1   /* fileset inode extension */
  226 #define ROOT_I          2   /* fileset root inode */
  227 #define ACL_I           3   /* fileset ACL inode */
  228 
  229 #define FILESET_OBJECT_I 4  /* the first fileset inode available for a file
  230                  * or directory or link...
  231                  */
  232 #define FIRST_FILESET_INO 16    /* the first aggregate inode which describes
  233                  * an inode.  (To fsck this is also the first
  234                  * inode in part 2 of the agg inode table.)
  235                  */
  236 
  237 /*
  238  *  directory configuration
  239  */
  240 #define JFS_NAME_MAX    255
  241 #define JFS_PATH_MAX    BPSIZE
  242 
  243 
  244 /*
  245  *  file system state (superblock state)
  246  */
  247 #define FM_CLEAN 0x00000000 /* file system is unmounted and clean */
  248 #define FM_MOUNT 0x00000001 /* file system is mounted cleanly */
  249 #define FM_DIRTY 0x00000002 /* file system was not unmounted and clean
  250                  * when mounted or
  251                  * commit failure occurred while being mounted:
  252                  * fsck() must be run to repair
  253                  */
  254 #define FM_LOGREDO 0x00000004   /* log based recovery (logredo()) failed:
  255                  * fsck() must be run to repair
  256                  */
  257 #define FM_EXTENDFS 0x00000008  /* file system extendfs() in progress */
  258 
  259 #endif              /* _H_JFS_FILSYS */