home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / inode.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  6.2 KB  |  173 lines

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