inode.h File

Purpose

Describes a file system file or directory entry as it is listed on a disk.

Syntax

#include <sys/types.h>
#include <sys/ino.h>

Description

The inode file for an ordinary file or directory in a file system has the following structure defined by the sys/ino.h file format:

struct dinode
 {
    /*  generation number  */
    ulong di_gen;
    /*  mode_t returned by stat () */
    /*  format,attributes and permission bits  */
mode_t  di_mode;
  
/* number of links to file(if 0,inode is available)  */
ushort di_nlink;
  
/* accounting ID  */
ushort di_acct;
  
/* user id of owner  */
uid_t di_uid;
  
/* group id of owner  */
gid_t di_gid;
  
/* size of file  */
off_t di_size;
  
/* number of blocks actually used by file  */
ulong di_nblocks;
  
/* time last modified  */
struct timestruc_t di_mtime_ts;
  
/* time last accessed  */
struct timestruc_t di_atime_ts;
  
/* time last changed inode  */
struct timestruc_t di_ctime_ts;
  
/*defines for old time_t names */
#define di_mtime   di_mtime_ts.tv_sec
#define di_atime   di_atime_ts.tv_sec
#define di_ctime   di_ctime_ts.tv_sec
  
/* extended access control information  */
long di_acl;  /* acl pointer  */
#define ACL_INCORE  (1<<31)
ulong di_sec;   /*    reserved    */
  
/*  spares  */
ulong di_rsrvd[5];
  
/***** file type-dependent information ****/
/* size of private data in disk inode is D_PRIVATE.
* location and size of fields depend on object type.
*/
# define D_PRIVATE 48
  
  union di_info
{
    /* all types must fit within d_private  */
    char d_private[D_PRIVATE];
    /* jfs regular file or directory.  */
    struct regdir
    {
         /*privilege vector-only for non-directory  */
         struct
        {
             ulong_di_offset;
             ulong_di_flags;
             define;PCL_ENABLED(1<<31)
             define PCL_EXTENDED(1<<30)
             define PCL_FLAGS\
                   (PCL_ENABLED|PCL_EXTENDED)
        }_di_privingo;
        priv_t_di_priv;
        /* ACL templates - only for directory  */
        struct
        {
             ulong_di_aclf;
             ulong_di_acld;
             {_di_aclingo;
        } _di_sec;
} _di_file;
  
/* offsets of regular file or directory private data.  */
#  define di_rdaddr         _di_info._di_file._di_rdaddr
   define di_vindirect      _di_info._di_file._di_vinderect
   define di_rinderect      _di_info._di_file._di_rinderect
   define di_privinfo       _di_info._di_file._di_sec._di_privinfo
   define di_privoffset     _di_privinfo._di_privoffset
   define di_privflags      _di_privinfo._di_privflags
   define di_priv           _di_info._di_file._di_sec._di_priv
   define di_aclf           _di_info._di_file._di_sec._di_aclinfo._di_aclf
   define di_acld           _di_info._di_file._di_sec._di_aclinfo._di_acld
       /*special file (device)  /*
       struct
       }
          dev_t_di_rdev;
       }_di_dev;
  
/* offsets of special file private data.  */
#    define di_rdev         _di_infor._di_dev._di_rdev
#    define di_bnlastr      _di_info._di_dev._di_bnlastr
#    define di_dgp          _di_info._di_dev._di_dgp
#    define di_pino         _di_info._di_dev._di_pino
  
     /*
      * symbolic link.link is stored inode if its
      * length is less than D_PRIVATE. Otherwise like
      * regular file.
      */
     union
{
         char         _s_private[D_PRIVATE];
         struct       regdir_s_symfile;
         }_di_sym;
  
/* offset of symbolic link private data  */
#  define di_symlink   _di_info._di_sym._s_private


    /*
     *data for mounted filesystem. kept in inode = 0
     *and dev = devt of mounted filesystem in inode table.
     */
     struct mountnode
 {
     struct inode    *_iplog;    /*itab of log*/
     struct inode    *_ipinode;  /*itab of .inodes*/
     struct inode    *_ipind;    /*itab of .indirect*/
     struct inode    *_ipinomap; /*itab of inode map*/
     struct inode    *_ipdmap;   /*itab of disk map*/
     struct inode    *_ipsuper;  /*itab of super blk*/
     struct inode    *_ipinodex; /*itab of .inodex*/
     struct jfsmount *_jfsmnt;   /* ptr to mount data*/
     ushort           _fperpage; /* frag per block */
     ushort           _agsize;   /* frags per ag */
     ushort           _iagsize;  /* inodes per ag */
 }_mt_info;
  
 /*
  * data for mounted filesystem. kept in inode = 0
  * and dev = devt of mounted filesystem in inode table.
  */
 struct mountnode
 {
     struct inode    *_iplog;    /*itab of log*/
     struct inode    *_ipinode;  /*itab of .inodes*/
     struct inode    *_ipind;    /*itab of .indirect*/
     struct inode    *_ipinomap; /*itab of inode map*/
     struct inode    *_ipdmap;   /*itab of disk map*/
     struct inode    *_ipsuper;  /*itab of super blk*/
     struct inode    *_ipinodex; /*itab of .inodex*/
     struct jfsmount *_jfsmnt;   /* ptr to mount data*/
     ushort           _fperpage; /* frag per block */
     ushort           _agsize;   /* frags per ag */
     ushort           _iagsize;  /* inodes per ag */
     ushort           _compress  /* > 0 if data comp */
 }_mt_info;
  
/* offsets of MOUNT data */
#    define di_iplog    _di_info._mt_info._iplog
#    define di_ipinode  _di_info._mt_info._ipinode
#    define di_ipind    _di_info._mt_info._ipind
#    define di_ipinomap _di_info._mt_info._ipinomap
#    define di_ipdmap   _di_info._mt_info._ipdmap
#    define di_ipsuper  _di_info._mt_info._ipsuper
#    define di_ipinodex _di_info._mt_info._ipinodex
#    define di_jfsmnt   _di_info._mt_info._jfsmnt
#    define di_fperpage _di_info._mt_info._fperpage
#    define di_agsize   _di_info._mt_info._agsize
#    define di_iagsize  _di_info._mt_info._iagsize
  
     /*
      * log info. kept in inode = 0 and dev = devt of
      * log device filesystem in inode table.
      */
     struct lognode
     {
         int _logptr    /* page number end of log */
         int _logsize   /* log size in pages */
         int _logend    /* eor in page _logptr */
         int _logsync   /* addr in last syncpt record */
         int _nextsync  /* bytes to next logsyncpt */
     struct gnode * _logdgp; /* pointer to device gnode */
     }_di_log;
  
/* offsets of MOUNT data */
#  define di_iplog      _di_info._mt_info._iplog
#  define di_ipinode    _di_info._mt_info._ipinode
#  define di_ipind      _di_info._mt_info._ipind
#  define di_ipinomap   _di_info._mt_info._ipinomap
#  define di_ipdmap     _di_info._mt_info._ipdmap
#  define di_ipsuper    _di_info._mt_info._ipsuper
#  define di_ipinodex   _di_info._mt_info._ipinodex
#  define di_jfsmnt     _di_info._mt_info._jfsmnt
#  define di_fperpage   _di_info._mt_info._fperpage
#  define di_agsize     _di_info._mt_info._agsize
#  define di_iagsize    _di_info._mt_info._iagsize
#  define di_compress   _di_info._mt_info._compress
 
    /*
     * log info. kept in inode = 0 and dev = devt of
     * log device filesystem in inode table.
     */
    struct lognode
    {
        int _logptr         /* page number end of log */
        int _logsize        /* log size in pages */
        int _logend         /* eor in page _logptr */
        int _logsync        /* addr in last syncpt record */
        int _nextsync       /* bytes to next logsyncpt */
    struct gnode * _logdgp; /* pointer to device gnode */
 }_di_log;
  
/* offsets of LOG data */
#  define di_logptr  _di_info._di_log._logptr
#  define di_logsize _di_info._di_log._logsize
#  define di_logend  _di_info._di_log._logend
#  define di_logsync _di_info._di_log._logsync
#  define di_nextsync  _di_info._di_log._nextsync
#  define di_logdgp  _di_info._di_log._logdgp
  }_di_info;
};