]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/cfs/inode.h
ndb/dns: lookup *all* entries in dblookup(), v4 and v6 queries in parallel, remove...
[plan9front.git] / sys / src / cmd / cfs / inode.h
1 typedef struct Ibuf     Ibuf;
2 typedef struct Imap     Imap;
3 typedef struct Icache   Icache;
4
5 enum
6 {
7         Nicache=        64,             /* number of inodes kept in pool */
8 };
9
10 /*
11  *  a cached inode buffer
12  */
13 struct Ibuf
14 {
15         Lru;                    /* must be first in structure */
16         int     inuse;          /* non-0 if in use */
17         ulong   ino;            /* index into inode table */
18         Inode   inode;          /* the inode contents */
19 };
20
21 /*
22  *  in-core qid to inode mapping
23  */
24 struct Imap
25 {
26         Lru;                    /* must be first in structure */
27         Qid     qid;
28         Ibuf    *b;             /* cache buffer */
29         int     inuse;          /* non-0 if in use */
30 };
31
32 /*
33  *  the inode cache
34  */
35 struct Icache
36 {
37         Disk;
38
39         int     nino;           /* number of inodes */
40         ulong   ib0;            /* first inode block */
41         int     nib;            /* number of inode blocks */
42         int     i2b;            /* inodes to a block */
43
44         Ibuf    ib[Nicache];    /* inode buffers */
45         Lru     blru;
46
47         Imap    *map;           /* inode to qid mapping */
48         Lru     mlru;
49 };
50
51 Ibuf*   ialloc(Icache*, ulong);
52 Ibuf*   iget(Icache*, Qid);
53 Ibuf*   iread(Icache*, ulong);
54 int     iformat(Icache*, int, ulong, char*, int, int);
55 int     iinit(Icache*, int, int, char*);
56 int     iremove(Icache*, ulong);
57 int     iupdate(Icache*, ulong, Qid);
58 int     iwrite(Icache*, Ibuf*);
59 void    ifree(Icache*, Ibuf*);
60 void    iinc(Icache*, Ibuf*);