home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / UNIX3862.ZIP / U386-06.ZIP / U386-6.TD0 / usr / include / sys / inode.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-26  |  6.0 KB  |  171 lines

  1. /*    Copyright (c) 1984, 1986, 1987, 1988 AT&T    */
  2. /*      All Rights Reserved      */
  3.  
  4. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T    */
  5. /*    The copyright notice above does not evidence any       */
  6. /*    actual or intended publication of such source code.    */
  7.  
  8. /*    Copyright (c) 1987, 1988 Microsoft Corporation    */
  9. /*      All Rights Reserved    */
  10.  
  11. /*    This Module contains Proprietary Information of Microsoft  */
  12. /*    Corporation and should be treated as Confidential.       */
  13.  
  14. #ident    "@(#)head.sys:inode.h    1.3.1.2"
  15.  
  16. #define FSPTR 1
  17. /*
  18.  *    The I node is the focus of all file activity in unix.
  19.  *    There is a unique inode allocated for each active file,
  20.  *    each current directory, each mounted-on file, text file,
  21.  *    and the root. An inode is 'named' by its dev/inumber
  22.  *    pair. (iget/iget.c) Data, from mode on, is read in from
  23.  *    permanent inode on volume.
  24.  */
  25.  
  26.  
  27. struct iisem {              /* XENIX semaphore */
  28.     short  i_scount;        /* current semaphore count */
  29.     short  i_eflag;         /* err flg */
  30.     struct file *i_headw;   /* first waiter */
  31.     struct file *i_tailw;   /* last waiter */
  32. };
  33.  
  34. struct iisd {               /* XENIX shared data */
  35.     union {
  36.     struct  region *i_region;  /* Pointer to the shared region */
  37.     struct  iisd *i_chain;     /* next available shared data structure */
  38.     } i_iun;
  39.     unsigned i_len;         /* limit of segment (seg size - 1) */
  40.     short    i_snum;         /* serial # for sdgetv, sdwaitv */
  41.     short    i_flags;        /* LOCKED, etc. */
  42. };
  43.  
  44. typedef    struct    inode
  45. {
  46.     struct    inode    *i_forw;    /* inode hash chain */
  47.     struct    inode    *i_back;    /* '' */
  48.     struct    inode    *av_forw;    /* freelist chain */
  49.     struct    inode    *av_back;    /* '' */
  50.     int    *i_fsptr;    /* "typeless" pointer to fs dependent */
  51.     long    i_number;    /* i number, 1-to-1 with dev address */
  52.     ushort    i_ftype;    /* file type = IFDIR, IFREG, etc. */
  53.     short    i_fstyp;    /* File system type */
  54.     off_t    i_size;        /* size of file */
  55.     ushort    i_uid;        /* owner */
  56.     ushort    i_gid;        /* group of owner */
  57.     ushort    i_flag;
  58.     ushort    i_fill;
  59.     cnt_t    i_count;    /* reference count */
  60.     short    i_nlink;    /* directory entries */
  61.     dev_t    i_rdev;        /* Raw device number */
  62.     dev_t    i_dev;        /* device where inode resides */
  63.  
  64.     struct    mount    *i_mntdev;    /* ptr to mount dev inode resides on */
  65.     union i_u {
  66.  
  67.         struct    mount    *i_mton;    /* pntr to mount table entry */
  68.                         /* that this inode is "mounted on" */
  69.         struct stdata    *i_sp;  /* Associated stream.        */
  70.         struct iisem    *isem;    /* ptr to XENIX  semaphores */
  71.         struct iisd    *isd;    /* ptr to XENIX shared data */
  72.     } i_un;
  73. #ifdef FSPTR
  74.     struct fstypsw *i_fstypp;    /* pointer to file system */
  75.                     /* switch structure */
  76. #endif
  77.     long    *i_filocks;    /* pointer to filock (structure) list */
  78.     struct    rcvd    *i_rcvd;    /* receive descriptor */
  79.     unsigned long    i_vcode;    /* inode version code (RFS caching) */
  80.     ushort    i_wcnt;            /* open for write count (RFS caching) */
  81. } inode_t;
  82.  
  83. extern struct inode inode[];    /* The inode table itself */
  84.  
  85. struct    ifreelist
  86. {    int    pad[2];        /* must match struct inode !*/
  87.     struct inode    *av_forw;
  88.     struct inode    *av_back;
  89. } ;
  90.  
  91. extern struct ifreelist ifreelist;
  92.  
  93. #define    i_sptr    i_un.i_sp
  94. #define    i_mnton    i_un.i_mton
  95. #define    i_sem     i_un.isem    /* for i_ftype==IFNAM && i_namtype==IFSEM */
  96. #define    i_sd     i_un.isd    /* for i_ftype==IFNAM && i_namtype==IFSHD */
  97.  
  98. /* for IFNAM type files, the subtype is encoded in i_rdev */
  99. #define i_namtype i_rdev
  100.  
  101. /* flags */
  102.  
  103. #define    ILOCK    0x01        /* inode is locked */
  104. #define    IUPD    0x02        /* file has been modified */
  105. #define    IACC    0x04        /* inode access time to be updated */
  106. #define    IMOUNT    0x08        /* inode is mounted on */
  107. #define    IWANT    0x10        /* some process waiting on lock */
  108. #define    ITEXT    0x20        /* inode is pure text prototype */
  109. #define    ICHG    0x40        /* inode has been changed */
  110. #define ISYN    0x80        /* do synchronous write for iupdate */
  111. #define    IADV    0x100        /* advertised */
  112. #define    IDOTDOT    0x200        /* object of remote mount */
  113. #define    IRMOUNT    0x800        /* remotely mounted    */
  114. #define    IISROOT    0x1000        /* This is a root inode of an fs */
  115. #define IWROTE    0x2000        /* write has happened since open */
  116. #define IXLOCKED 0x4000        /* enforce file locks for XENIX compatibility */
  117.  
  118. /* file types */
  119. /* WARNING: The following defines should NOT change!If more */
  120. /* file types need to be added they should be added in the low */
  121. /* bits */
  122.  
  123. #define    IFMT    0xf000        /* type of file */
  124. #define        IFDIR    0x4000    /* directory */
  125. #define        IFCHR    0x2000    /* character special */
  126. #define        IFBLK    0x6000    /* block special */
  127. #define        IFREG    0x8000    /* regular */
  128. #define        IFMPC    0x3000    /* multiplexed char special */
  129. #define        IFMPB    0x7000    /* multiplexed block special */
  130. #define        IFIFO    0x1000    /* fifo special */
  131. #define        IFNAM    0x5000    /* special named file - subtype in r_dev */
  132.  
  133. #define        IFSEM  1    /* XENIX semaphore subtype of IFNAM type file */
  134. #define        IFSHD  2    /* XENIX shared data subtype of IFNAM */
  135.                 /*    type file */
  136.  
  137. /* file modes */
  138. /* the System V Rel 2 chmod system call only knows about */
  139. /* ISUID, ISGID, ISVTX */
  140. /* Therefore, the bit positions of ISUID, ISGID, and ISVTX */
  141. /* should not change */
  142. #define    ISUID    0x800        /* set user id on execution */
  143. #define    ISGID    0x400        /* set group id on execution */
  144. #define ISVTX    0x200        /* save swapped text even after use */
  145.  
  146. /* access requests */
  147. /* the System V Rel 2 chmod system call only knows about */
  148. /* IREAD, IWRITE, IEXEC */
  149. /* Therefore, the bit positions of IREAD, IWRITE, and IEXEC */
  150. /* should not change */
  151. #define    IREAD        0x100    /* read permission */
  152. #define    IWRITE        0x080    /* write permission */
  153. #define    IEXEC        0x040    /* execute permission */
  154. #define    ICDEXEC        0x020    /* cd permission */
  155. #define    IOBJEXEC    0x010    /* execute as an object file */
  156.                 /* i.e., 410, 411, 413 */
  157. #define IMNDLCK        0x001    /* mandatory locking set */
  158.  
  159. #define    MODEMSK        0xfff    /* Nine permission bits - read/write/ */
  160.                 /* execute for user/group/others and */
  161.                 /* ISUID, ISGID, and ISVTX */    
  162.                 /* This is another way of saying: */
  163.                 /* (ISUID|ISGID|ISVTX| */
  164.                 /* (IREAD|IWRITE|IEXEC)| */
  165.                 /* ((IREAD|IWRITE|IEXEC)>>3)| */
  166.                 /* ((IREAD|IWRITE|IEXEC)>>6)) */
  167. #define    PERMMSK        0x1ff    /* Nine permission bits: */
  168.                 /* ((IREAD|IWRITE|IEXEC)| */
  169.                 /* ((IREAD|IWRITE|IEXEC)>>3)| */
  170.                 /* ((IREAD|IWRITE|IEXEC)>>6)) */
  171.