remove vfdcnt, IPIPE and IFPORT
[unix-history] / usr / src / sys / ufs / ffs / inode.h
CommitLineData
a59abf09 1/* inode.h 4.8 81/11/08 */
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 12struct 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 {
24 struct {
0aee3fe5 25 daddr_t I_addr[NADDR]; /* if normal file/directory */
a59abf09 26 daddr_t I_lastr; /* last read (read-ahead) */
0aee3fe5
BJ
27 } i_f;
28#define i_addr i_f.I_addr
29#define i_lastr i_f.I_lastr
d0064d3a 30 struct {
0aee3fe5 31 daddr_t I_rdev; /* i_addr[0] */
0aee3fe5
BJ
32 } i_d;
33#define i_rdev i_d.I_rdev
d0064d3a 34 } i_un;
a59abf09
BJ
35/* end read from disk */
36 short i_XXXXXX; /* ### */
37/* SHOULD USE POINTERS, NOT INDICES, FOR HAS CHAIN */
d0064d3a
BJ
38 short i_hlink; /* link in hash chain (iget/iput/ifind) */
39};
40
41#ifdef KERNEL
a0eab615
BJ
42struct inode *inode, *inodeNINODE;
43int ninode;
d0064d3a
BJ
44
45struct inode *rootdir; /* pointer to inode of root directory */
d0064d3a
BJ
46
47struct inode *ialloc();
48struct inode *ifind();
49struct inode *iget();
50struct inode *owner();
51struct inode *maknode();
52struct inode *namei();
53#endif
54
55/* flags */
56#define ILOCK 01 /* inode is locked */
57#define IUPD 02 /* file has been modified */
58#define IACC 04 /* inode access time to be updated */
59#define IMOUNT 010 /* inode is mounted on */
60#define IWANT 020 /* some process waiting on lock */
61#define ITEXT 040 /* inode is pure text prototype */
62#define ICHG 0100 /* inode has been changed */
63
64/* modes */
65#define IFMT 0170000 /* type of file */
66#define IFDIR 0040000 /* directory */
67#define IFCHR 0020000 /* character special */
68#define IFBLK 0060000 /* block special */
69#define IFREG 0100000 /* regular */
d0064d3a
BJ
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