%H%->%G%
[unix-history] / usr / src / sys / ufs / ffs / inode.h
CommitLineData
f86df66c 1/* inode.h 3.6 %G% */
d0064d3a
BJ
2
3/*
4 * The I node is the focus of all
5 * file activity in unix. There is a unique
6 * inode allocated for each active file,
7 * each current directory, each mounted-on
8 * file, text file, and the root. An inode is 'named'
9 * by its dev/inumber pair. (iget/iget.c)
10 * Data, from mode on, is read in
11 * from permanent inode on volume.
12 */
13
14#define NADDR 13
15
16#define NINDEX 15
17struct group
18{
19 short g_state;
20 char g_index;
21 char g_rot;
22 struct group *g_group;
23 struct inode *g_inode;
24 struct file *g_file;
25 short g_rotmask;
26 short g_datq;
27 struct chan *g_chans[NINDEX];
28};
29struct inode
30{
31 char i_flag;
32 char i_count; /* reference count */
33 dev_t i_dev; /* device where inode resides */
34 ino_t i_number; /* i number, 1-to-1 with device address */
35 unsigned short i_mode;
36 short i_nlink; /* directory entries */
37 short i_uid; /* owner */
38 short i_gid; /* group of owner */
39 off_t i_size; /* size of file */
40 union {
41 struct {
0aee3fe5 42 daddr_t I_addr[NADDR]; /* if normal file/directory */
cd01c533 43 daddr_t I_lastr; /* last read (for read-ahead) */
0aee3fe5
BJ
44 } i_f;
45#define i_addr i_f.I_addr
46#define i_lastr i_f.I_lastr
d0064d3a 47 struct {
0aee3fe5
BJ
48 daddr_t I_rdev; /* i_addr[0] */
49 struct group I_group; /* multiplexor group file */
50 } i_d;
51#define i_rdev i_d.I_rdev
52#define i_group i_d.I_group
d0064d3a
BJ
53 } i_un;
54 short i_vfdcnt; /* number of fd's vreading this inode */
55 short i_hlink; /* link in hash chain (iget/iput/ifind) */
56};
57
58#ifdef KERNEL
59extern struct inode inode[]; /* The inode table itself */
60
61struct inode *rootdir; /* pointer to inode of root directory */
62struct inode *mpxip; /* mpx virtual inode */
63
64struct inode *ialloc();
65struct inode *ifind();
66struct inode *iget();
67struct inode *owner();
68struct inode *maknode();
69struct inode *namei();
70#endif
71
72/* flags */
73#define ILOCK 01 /* inode is locked */
74#define IUPD 02 /* file has been modified */
75#define IACC 04 /* inode access time to be updated */
76#define IMOUNT 010 /* inode is mounted on */
77#define IWANT 020 /* some process waiting on lock */
78#define ITEXT 040 /* inode is pure text prototype */
79#define ICHG 0100 /* inode has been changed */
eec31342 80#define IPIPE 0200 /* inode is a pipe */
d0064d3a
BJ
81
82/* modes */
83#define IFMT 0170000 /* type of file */
84#define IFDIR 0040000 /* directory */
85#define IFCHR 0020000 /* character special */
86#define IFBLK 0060000 /* block special */
87#define IFREG 0100000 /* regular */
88#define IFMPC 0030000 /* multiplexed char special */
89#define IFMPB 0070000 /* multiplexed block special */
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