|
|
1.1 root 1: /*
2: * The I node is the focus of all
3: * file activity in unix. There is a unique
4: * inode allocated for each active file,
5: * each current directory, each mounted-on
6: * file, text file, and the root. An inode is 'named'
7: * by its dev/inumber pair. (iget/iget.c)
8: * Data, from mode on, is read in
9: * from permanent inode on volume.
10: */
11:
12: #define NADDR 13
13:
14: struct inode
15: {
16: short i_flag;
17: u_char i_count; /* reference count */
18: char i_fstyp; /* type of its filesystem */
19: dev_t i_dev; /* device where inode resides */
20: long i_number; /* i number, 1-to-1 with device address */
21: unsigned short i_mode;
22: short i_nlink; /* directory entries */
23: short i_uid; /* owner */
24: short i_gid; /* group of owner */
25: off_t i_size; /* size of file */
26: struct stdata *i_sptr; /* stream associated with this inode */
27: union {
28: struct {
29: daddr_t I_addr[NADDR]; /* if normal file/directory */
30: daddr_t I_lastr; /* last read (for read-ahead) */
31: } i_f;
32: #define i_addr i_f.I_addr
33: #define i_lastr i_f.I_lastr
34: struct {
35: daddr_t I_rdev; /* i_addr[0] */
36: long I_key; /* see istread */
37: } i_d;
38: #define i_rdev i_d.I_rdev
39: #define i_key i_d.I_key
40: struct {
41: long I_tag;
42: struct inode *I_cip; /* communications */
43: } i_a; /* when i_fstyp != 0 */
44: #define i_tag i_a.I_tag
45: #define i_cip i_a.I_cip
46: struct {
47: struct proc *I_proc; /* sanity checking */
48: int I_sigmask; /* signal trace mask */
49: } i_p;
50: #define i_proc i_p.I_proc
51: #define i_sigmask i_p.I_sigmask
52: } i_un;
53: short i_hlink; /* link in hash chain (iget/iput/ifind) */
54: };
55:
56: #ifdef KERNEL
57: struct inode *inode, *inodeNINODE;
58: int ninode;
59:
60: struct inode *rootdir; /* pointer to inode of root directory */
61:
62: struct inode *ialloc();
63: struct inode *ifind();
64: struct inode *iget();
65: struct inode *owner();
66: struct inode *maknode();
67: struct inode *namei();
68: struct inode *openi();
69: #endif
70:
71: /* flags */
72: #define ILOCK 01 /* inode is locked */
73: #define IUPD 02 /* file has been modified */
74: #define IACC 04 /* inode access time to be updated */
75: #define IMOUNT 010 /* inode is mounted on */
76: #define IWANT 020 /* some process waiting on lock */
77: #define ITEXT 040 /* inode is pure text prototype */
78: #define ICHG 0100 /* inode has been changed */
79: #define IPIPE 0200 /* inode is a pipe */
80: #define IDEAD 0400 /* only iput and iget */
81: #define IALOCK 01000 /* advisory lock has been set */
82:
83: /* modes */
84: #define IFMT 0170000 /* type of file */
85: #define IFDIR 0040000 /* directory */
86: #define IFCHR 0020000 /* character special */
87: #define IFBLK 0060000 /* block special */
88: #define IFREG 0100000 /* regular */
89: #define IFLNK 0120000 /* symbolic link to another file */
90: #define ISUID 04000 /* set user id on execution */
91: #define ISGID 02000 /* set group id on execution */
92: #define ISVTX 01000 /* save swapped text even after use */
93: #define IREAD 0400 /* read, write, execute permissions */
94: #define IWRITE 0200
95: #define IEXEC 0100
96:
97: struct argnamei { /* namei's flag argument */
98: short flag; /* type of request */
99: ino_t ino; /* ino and dev for linking */
100: dev_t idev;
101: short mode; /* mode for creating */
102: };
103: #define NI_DEL 1 /* unlink this file */
104: #define NI_CREAT 2 /* create it if it doesn't exits */
105: #define NI_NXCREAT 3 /* create it, error if it already exists */
106: #define NI_LINK 4 /* make a link */
107: #define NI_MKDIR 5 /* make a directory */
108: #define NI_RMDIR 6 /* remove a directory */
109: struct nx { /* arg to real nami */
110: struct inode *dp;
111: char *cp;
112: struct buf *nbp;
113: int nlink;
114: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.