diff options
author | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
---|---|---|
committer | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
commit | e5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch) | |
tree | d8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/cmd/cfs/inode.h |
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/cmd/cfs/inode.h')
-rwxr-xr-x | sys/src/cmd/cfs/inode.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/sys/src/cmd/cfs/inode.h b/sys/src/cmd/cfs/inode.h new file mode 100755 index 000000000..22fa16047 --- /dev/null +++ b/sys/src/cmd/cfs/inode.h @@ -0,0 +1,60 @@ +typedef struct Ibuf Ibuf; +typedef struct Imap Imap; +typedef struct Icache Icache; + +enum +{ + Nicache= 64, /* number of inodes kept in pool */ +}; + +/* + * a cached inode buffer + */ +struct Ibuf +{ + Lru; /* must be first in structure */ + int inuse; /* non-0 if in use */ + ulong ino; /* index into inode table */ + Inode inode; /* the inode contents */ +}; + +/* + * in-core qid to inode mapping + */ +struct Imap +{ + Lru; /* must be first in structure */ + Qid qid; + Ibuf *b; /* cache buffer */ + int inuse; /* non-0 if in use */ +}; + +/* + * the inode cache + */ +struct Icache +{ + Disk; + + int nino; /* number of inodes */ + ulong ib0; /* first inode block */ + int nib; /* number of inode blocks */ + int i2b; /* inodes to a block */ + + Ibuf ib[Nicache]; /* inode buffers */ + Lru blru; + + Imap *map; /* inode to qid mapping */ + Lru mlru; +}; + +Ibuf* ialloc(Icache*, ulong); +Ibuf* iget(Icache*, Qid); +Ibuf* iread(Icache*, ulong); +int iformat(Icache*, int, ulong, char*, int, int); +int iinit(Icache*, int, int, char*); +int iremove(Icache*, ulong); +int iupdate(Icache*, ulong, Qid); +int iwrite(Icache*, Ibuf*); +void ifree(Icache*, Ibuf*); +void iinc(Icache*, Ibuf*); |