|
|
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 <common/feature.h>
15: #include <sys/types.h>
16: #include <sys/ksynch.h>
17: #include <common/_time.h>
18: #include <poll.h>
19:
20:
21: /*
22: * Size of pipe buffer.
23: */
24: #define PIPSIZE (ND*BSIZE)
25:
26: /*
27: * File inode.
28: */
29: typedef struct inode {
30: dev_t i_dev; /* Device */
31: ino_t i_ino; /* Inode index */
32: int i_refc; /* Reference count */
33: unsigned i_lrt; /* Last reference time */
34: GATE i_gate; /* Gate */
35: int i_flag; /* Flags */
36: short i_mode; /* Mode and type */
37: short i_nlink; /* Number of links */
38: short i_uid; /* Owner's user id */
39: short i_gid; /* Owner's group id */
40: fsize_t i_size; /* Size of file in bytes */
41: union ia_u {
42: daddr_t i_addr[13]; /* Disk addresses */
43: dev_t i_rdev; /* Real device */
44: struct ip_s { /* Pipes */
45: daddr_t ip_pipe[10];
46: short ip_pnc; /* Number Characters */
47: short ip_prx; /* Reader Offset */
48: short ip_pwx; /* Writer Offset */
49: short ip_par; /* Number Awake Readers */
50: short ip_paw; /* Number Awake Writers */
51: short ip_psr; /* Number Sleeping Readers */
52: short ip_psw; /* Number Sleeping Writers */
53: event_t ip_iev; /* Polling Input Event */
54: event_t ip_oev; /* Polling Output Event */
55: } i_p;
56: } i_a; /* Addresses */
57: time_t i_atime; /* Last access time */
58: time_t i_mtime; /* Last modify time */
59: time_t i_ctime; /* Creation time */
60: #if _I386
61: struct rlock *i_rl; /* List of record locks */
62: daddr_t i_lastblock; /* for readahead */
63: #endif
64: } INODE;
65:
66: /*
67: * Compatibility.
68: */
69: #define i_pipe i_a.i_p.ip_pipe
70: #define i_pnc i_a.i_p.ip_pnc
71: #define i_prx i_a.i_p.ip_prx
72: #define i_pwx i_a.i_p.ip_pwx
73: #define i_par i_a.i_p.ip_par
74: #define i_paw i_a.i_p.ip_paw
75: #define i_psr i_a.i_p.ip_psr
76: #define i_psw i_a.i_p.ip_psw
77: #define i_iev i_a.i_p.ip_iev
78: #define i_oev i_a.i_p.ip_oev
79:
80: /*
81: * Flags.
82: */
83: #define IFACC 0x1 /* File has been accessed */
84: #define IFMOD 0x2 /* File has been modified */
85: #define IFCRT 0x4 /* File has been created */
86: #define IFMNT 0x8 /* Contains mounted file system */
87:
88: #if _I386
89: #define IFEXCL 0x80 /* Exclusive open */
90: #endif /* _I386 */
91:
92: /*
93: * This relates to a hack in the 16-bit system-call interface; this value is
94: * jammed into 16-bit file descriptors. If NOFILE ever gets bigger than this,
95: * 16-bit applications stand to lose big.
96: */
97: #define DUP2 0x40
98:
99: #if __KERNEL__
100:
101: /*
102: * Macro functions.
103: */
104:
105: #define ilock(ip) lock(ip->i_gate)
106: #define iunlock(ip) unlock(ip->i_gate)
107: #define ilocked(ip) __GATE_LOCKED (ip->i_gate)
108:
109: /*
110: * Functions to set modify time.
111: */
112: #define iacc(ip) { \
113: ip->i_flag |= IFACC; \
114: ip->i_atime = timer.t_time; \
115: }
116:
117: #define imod(ip) { \
118: ip->i_flag |= IFMOD; \
119: ip->i_mtime = timer.t_time; \
120: }
121:
122: #define icrt(ip) { \
123: ip->i_flag |= IFCRT; \
124: ip->i_ctime = timer.t_time; \
125: }
126:
127: #define iamc(ip) { \
128: ip->i_flag |= IFACC|IFMOD|IFCRT; \
129: ip->i_atime = timer.t_time; \
130: ip->i_mtime = timer.t_time; \
131: ip->i_ctime = timer.t_time; \
132: }
133:
134: /*
135: * Functions.
136: */
137: extern INODE *exlopen(); /* exec.c */
138: extern INODE *ftoim(); /* fs1.c */
139: extern INODE *imake(); /* fs1.c */
140: extern INODE *iattach(); /* fs1.c */
141: extern INODE *ialloc(); /* fs2.c */
142: extern daddr_t balloc(); /* fs2.c */
143: extern INODE *pmake(); /* pipe.c */
144:
145: /*
146: * Global variables.
147: */
148: extern int ronflag; /* Root is read only */
149: extern INODE *inodep; /* Pointer to in core inodes */
150: extern INODE *acctip; /* Accounting file pointer */
151:
152: #endif /* __KERNEL__ */
153:
154: #endif /* ! defined (__SYS_INODE_H__) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.