Bell 32V development
[unix-history] / usr / src / sys / h / inode.h
CommitLineData
05620f8c
TL
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#define NINDEX 15
15struct group {
16 short g_state;
17 char g_index;
18 char g_rot;
19 struct group *g_group;
20 struct inode *g_inode;
21 struct file *g_file;
22 short g_rotmask;
23 short g_datq;
24 struct chan *g_chans[NINDEX];
25};
26struct inode
27{
28 char i_flag;
29 char i_count; /* reference count */
30 dev_t i_dev; /* device where inode resides */
31 ino_t i_number; /* i number, 1-to-1 with device address */
32 unsigned short i_mode;
33 short i_nlink; /* directory entries */
34 short i_uid; /* owner */
35 short i_gid; /* group of owner */
36 off_t i_size; /* size of file */
37 union {
38 struct {
39 daddr_t i_addr[NADDR]; /* if normal file/directory */
40 daddr_t i_lastr; /* last logical block read (for read-ahead) */
41 };
42 struct {
43 daddr_t i_rdev; /* i_addr[0] */
44 struct group i_group; /* multiplexor group file */
45 };
46 } i_un;
47};
48
49
50extern struct inode inode[]; /* The inode table itself */
51struct inode *mpxip; /* mpx virtual inode */
52
53/* flags */
54#define ILOCK 01 /* inode is locked */
55#define IUPD 02 /* file has been modified */
56#define IACC 04 /* inode access time to be updated */
57#define IMOUNT 010 /* inode is mounted on */
58#define IWANT 020 /* some process waiting on lock */
59#define ITEXT 040 /* inode is pure text prototype */
60#define ICHG 0100 /* inode has been changed */
61
62/* modes */
63#define IFMT 0170000 /* type of file */
64#define IFDIR 0040000 /* directory */
65#define IFCHR 0020000 /* character special */
66#define IFBLK 0060000 /* block special */
67#define IFREG 0100000 /* regular */
68#define IFMPC 0030000 /* multiplexed char special */
69#define IFMPB 0070000 /* multiplexed block special */
70#define ISUID 04000 /* set user id on execution */
71#define ISGID 02000 /* set group id on execution */
72#define ISVTX 01000 /* save swapped text even after use */
73#define IREAD 0400 /* read, write, execute permissions */
74#define IWRITE 0200
75#define IEXEC 0100