Commit | Line | Data |
---|---|---|
541352f0 | 1 | /* inode.h 4.9 81/11/14 */ |
d0064d3a BJ |
2 | |
3 | /* | |
a59abf09 BJ |
4 | * The I node is the focus of all file activity in UNIX. |
5 | * There is a unique inode allocated for each active file, | |
6 | * each current directory, each mounted-on file, text file, and the root. | |
7 | * An inode is 'named' by its dev/inumber pair. (iget/iget.c) | |
8 | * Data, from mode on, is read in from permanent inode on volume. | |
d0064d3a | 9 | */ |
d0064d3a BJ |
10 | #define NADDR 13 |
11 | ||
a59abf09 | 12 | struct inode { |
d0064d3a BJ |
13 | char i_flag; |
14 | char i_count; /* reference count */ | |
15 | dev_t i_dev; /* device where inode resides */ | |
16 | ino_t i_number; /* i number, 1-to-1 with device address */ | |
a59abf09 BJ |
17 | /* begin read from disk */ |
18 | u_short i_mode; | |
d0064d3a BJ |
19 | short i_nlink; /* directory entries */ |
20 | short i_uid; /* owner */ | |
21 | short i_gid; /* group of owner */ | |
22 | off_t i_size; /* size of file */ | |
23 | union { | |
541352f0 BJ |
24 | struct i_f { |
25 | daddr_t if_addr[NADDR]; /* if normal file/directory */ | |
26 | daddr_t if_lastr; /* last read (read-ahead) */ | |
0aee3fe5 | 27 | } i_f; |
541352f0 BJ |
28 | struct i_d { |
29 | daddr_t id_rdev; /* i_addr[0] */ | |
0aee3fe5 | 30 | } i_d; |
541352f0 BJ |
31 | struct i_s { |
32 | struct socket *is_socket; | |
33 | } i_s; | |
34 | #define i_addr i_f.if_addr | |
35 | #define i_lastr i_f.if_lastr | |
36 | #define i_rdev i_d.id_rdev | |
37 | #define i_socket i_s.is_socket | |
d0064d3a | 38 | } i_un; |
a59abf09 BJ |
39 | /* end read from disk */ |
40 | short i_XXXXXX; /* ### */ | |
41 | /* SHOULD USE POINTERS, NOT INDICES, FOR HAS CHAIN */ | |
d0064d3a BJ |
42 | short i_hlink; /* link in hash chain (iget/iput/ifind) */ |
43 | }; | |
44 | ||
45 | #ifdef KERNEL | |
a0eab615 BJ |
46 | struct inode *inode, *inodeNINODE; |
47 | int ninode; | |
d0064d3a BJ |
48 | |
49 | struct inode *rootdir; /* pointer to inode of root directory */ | |
d0064d3a BJ |
50 | |
51 | struct inode *ialloc(); | |
52 | struct inode *ifind(); | |
53 | struct inode *iget(); | |
54 | struct inode *owner(); | |
55 | struct inode *maknode(); | |
56 | struct inode *namei(); | |
57 | #endif | |
58 | ||
59 | /* flags */ | |
60 | #define ILOCK 01 /* inode is locked */ | |
61 | #define IUPD 02 /* file has been modified */ | |
62 | #define IACC 04 /* inode access time to be updated */ | |
63 | #define IMOUNT 010 /* inode is mounted on */ | |
64 | #define IWANT 020 /* some process waiting on lock */ | |
65 | #define ITEXT 040 /* inode is pure text prototype */ | |
66 | #define ICHG 0100 /* inode has been changed */ | |
67 | ||
68 | /* modes */ | |
69 | #define IFMT 0170000 /* type of file */ | |
541352f0 BJ |
70 | #define IFCHR 0020000 /* character special */ |
71 | #define IFDIR 0040000 /* directory */ | |
72 | #define IFBLK 0060000 /* block special */ | |
73 | #define IFREG 0100000 /* regular */ | |
74 | #define IFSYMREG 0110000 /* regular symbolic link */ | |
75 | #define IFSYMDIR 0130000 /* directory symbolic link */ | |
76 | #define IFPORTAL 0140000 /* portal */ | |
d0064d3a BJ |
77 | #define ISUID 04000 /* set user id on execution */ |
78 | #define ISGID 02000 /* set group id on execution */ | |
79 | #define ISVTX 01000 /* save swapped text even after use */ | |
80 | #define IREAD 0400 /* read, write, execute permissions */ | |
81 | #define IWRITE 0200 | |
82 | #define IEXEC 0100 |