|
|
1.1 root 1: /* (-lgl
2: * COHERENT Version 4.0
3: * Copyright (c) 1982, 1992 by Mark Williams Company.
4: * All rights reserved. May not be copied without permission.
5: -lgl) */
6: /*
7: * /usr/include/sys/inode.h
8: * Memory resident inodes.
9: */
10:
11: #ifndef __SYS_INODE_H__
12: #define __SYS_INODE_H__
13:
14: #include <sys/types.h>
15: #include <sys/ksynch.h>
16: #include <sys/_time.h>
17: #include <poll.h>
18:
19:
20: /*
21: * Size of pipe buffer.
22: */
23: #define PIPSIZE (ND*BSIZE)
24:
25: /*
26: * File inode.
27: */
28: typedef struct inode {
29: dev_t i_dev; /* Device */
30: ino_t i_ino; /* Inode index */
31: int i_refc; /* Reference count */
32: unsigned i_lrt; /* Last reference time */
33: GATE i_gate; /* Gate */
34: int i_flag; /* Flags */
35: short i_mode; /* Mode and type */
36: short i_nlink; /* Number of links */
37: short i_uid; /* Owner's user id */
38: short i_gid; /* Owner's group id */
39: fsize_t i_size; /* Size of file in bytes */
40: union ia_u {
41: daddr_t i_addr[13]; /* Disk addresses */
42: dev_t i_rdev; /* Real device */
43: struct ip_s { /* Pipes */
44: daddr_t ip_pipe[10];
45: short ip_pnc; /* Number Characters */
46: short ip_prx; /* Reader Offset */
47: short ip_pwx; /* Writer Offset */
48: short ip_par; /* Number Awake Readers */
49: short ip_paw; /* Number Awake Writers */
50: short ip_psr; /* Number Sleeping Readers */
51: short ip_psw; /* Number Sleeping Writers */
52: event_t ip_iev; /* Polling Input Event */
53: event_t ip_oev; /* Polling Output Event */
54: } i_p;
55: } i_a; /* Addresses */
56: time_t i_atime; /* Last access time */
57: time_t i_mtime; /* Last modify time */
58: time_t i_ctime; /* Creation time */
59: #ifdef _I386
60: struct rlock *i_rl; /* List of record locks */
61: #endif
62: } INODE;
63:
64: /*
65: * Compatibility.
66: */
67: #define i_pipe i_a.i_p.ip_pipe
68: #define i_pnc i_a.i_p.ip_pnc
69: #define i_prx i_a.i_p.ip_prx
70: #define i_pwx i_a.i_p.ip_pwx
71: #define i_par i_a.i_p.ip_par
72: #define i_paw i_a.i_p.ip_paw
73: #define i_psr i_a.i_p.ip_psr
74: #define i_psw i_a.i_p.ip_psw
75: #define i_iev i_a.i_p.ip_iev
76: #define i_oev i_a.i_p.ip_oev
77:
78: /*
79: * Flags.
80: */
81: #define IFACC 0x1 /* File has been accessed */
82: #define IFMOD 0x2 /* File has been modified */
83: #define IFCRT 0x4 /* File has been created */
84: #define IFMNT 0x8 /* Contains mounted file system */
85: #ifdef _I386
86: #define IFEXCL 0x80 /* Exclusive open */
87: #endif /* _I386 */
88:
89: /*
90: * Permission bits.
91: */
92: #define IPE 0x01 /* Execute */
93: #define IPW 0x02 /* Write */
94: #define IPR 0x04 /* Read */
95:
96: /*
97: * Modifier bits for fdopen().
98: */
99: #define IPNDLY 0x08
100: #define IPAPPEND 0x10
101: #ifdef _I386
102: #define IPSYNC 0x20
103: #define IPEXCL 0x40
104: #define IPNOCTTY 0x80
105: #endif /* _I386 */
106:
107: /*
108: * Bit for dup system call.
109: */
110: #define DUP2 0x40
111:
112: #ifdef KERNEL
113: /*
114: * Macro functions.
115: */
116: #define ilock(ip) lock(ip->i_gate)
117: #define iunlock(ip) unlock(ip->i_gate)
118: #define ilocked(ip) locked(ip->i_gate)
119:
120: /*
121: * Functions to set modify time.
122: */
123: #define iacc(ip) { \
124: ip->i_flag |= IFACC; \
125: ip->i_atime = timer.t_time; \
126: }
127:
128: #define imod(ip) { \
129: ip->i_flag |= IFMOD; \
130: ip->i_mtime = timer.t_time; \
131: }
132:
133: #define icrt(ip) { \
134: ip->i_flag |= IFCRT; \
135: ip->i_ctime = timer.t_time; \
136: }
137:
138: #define iamc(ip) { \
139: ip->i_flag |= IFACC|IFMOD|IFCRT; \
140: ip->i_atime = timer.t_time; \
141: ip->i_mtime = timer.t_time; \
142: ip->i_ctime = timer.t_time; \
143: }
144:
145: /*
146: * Functions.
147: */
148: extern INODE *exlopen(); /* exec.c */
149: extern INODE *ftoim(); /* fs1.c */
150: extern INODE *imake(); /* fs1.c */
151: extern INODE *iattach(); /* fs1.c */
152: extern INODE *ialloc(); /* fs2.c */
153: extern daddr_t balloc(); /* fs2.c */
154: extern INODE *pmake(); /* pipe.c */
155:
156: /*
157: * Global variables.
158: */
159: extern int ronflag; /* Root is read only */
160: extern INODE *inodep; /* Pointer to in core inodes */
161: extern INODE *acctip; /* Accounting file pointer */
162:
163: #endif
164:
165: #endif
166:
167: /* end of sys/inode.h */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.