- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly. - Clean up MFS by removing old, dead code (backwards compatibility is broken by the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all functions have proper banners and prototypes. - VFS should always provide a (syntactically) valid path to the FS; no need for the FS to do sanity checks when leaving/entering mount points. - Fix several bugs in MFS: - Several path lookup bugs in MFS. - A link can be too big for the path buffer. - A mountpoint can become inaccessible when the creation of a new inode fails, because the inode already exists and is a mountpoint. - Introduce support for supplemental groups. - Add test 46 to test supplemental group functionality (and removed obsolete suppl. tests from test 2). - Clean up VFS (not everything is done yet). - ISOFS now opens device read-only. This makes the -r flag in the mount command unnecessary (but will still report to be mounted read-write). - Introduce PipeFS. PipeFS is a new FS that handles all anonymous and named pipes. However, named pipes still reside on the (M)FS, as they are part of the file system on disk. To make this work VFS now has a concept of 'mapped' inodes, which causes read, write, truncate and stat requests to be redirected to the mapped FS, and all other requests to the original FS.
60 lines
2.5 KiB
C
60 lines
2.5 KiB
C
/* Inode table. This table holds inodes that are currently in use. In some
|
|
* cases they have been opened by an open() or creat() system call, in other
|
|
* cases the file system itself needs the inode for one reason or another,
|
|
* such as to search a directory for a path name.
|
|
* The first part of the struct holds fields that are present on the
|
|
* disk; the second part holds fields not present on the disk.
|
|
* The disk inode part is also declared in "type.h" as 'd1_inode' for V1
|
|
* file systems and 'd2_inode' for V2 file systems.
|
|
*
|
|
* Updates:
|
|
* 2007-01-06: jfdsmit@gmail.com added i_zsearch
|
|
*/
|
|
|
|
#include <sys/queue.h>
|
|
|
|
EXTERN struct inode {
|
|
mode_t i_mode; /* file type, protection, etc. */
|
|
nlink_t i_nlinks; /* how many links to this file */
|
|
uid_t i_uid; /* user id of the file's owner */
|
|
gid_t i_gid; /* group number */
|
|
off_t i_size; /* current file size in bytes */
|
|
time_t i_atime; /* time of last access (V2 only) */
|
|
time_t i_mtime; /* when was file data last changed */
|
|
time_t i_ctime; /* when was inode itself changed (V2 only)*/
|
|
zone_t i_zone[V2_NR_TZONES]; /* zone numbers for direct, ind, and dbl ind */
|
|
|
|
/* The following items are not present on the disk. */
|
|
dev_t i_dev; /* which device is the inode on */
|
|
ino_t i_num; /* inode number on its (minor) device */
|
|
int i_count; /* # times inode used; 0 means slot is free */
|
|
int i_ndzones; /* # direct zones (Vx_NR_DZONES) */
|
|
int i_nindirs; /* # indirect zones per indirect block */
|
|
struct super_block *i_sp; /* pointer to super block for inode's device */
|
|
char i_dirt; /* CLEAN or DIRTY */
|
|
bit_t i_zsearch; /* where to start search for new zones */
|
|
|
|
char i_mountpoint; /* true if mounted on */
|
|
|
|
char i_seek; /* set on LSEEK, cleared on READ/WRITE */
|
|
char i_update; /* the ATIME, CTIME, and MTIME bits are here */
|
|
|
|
LIST_ENTRY(inode) i_hash; /* hash list */
|
|
TAILQ_ENTRY(inode) i_unused; /* free and unused list */
|
|
|
|
} inode[NR_INODES];
|
|
|
|
/* list of unused/free inodes */
|
|
EXTERN TAILQ_HEAD(unused_inodes_t, inode) unused_inodes;
|
|
|
|
/* inode hashtable */
|
|
EXTERN LIST_HEAD(inodelist, inode) hash_inodes[INODE_HASH_SIZE];
|
|
|
|
EXTERN unsigned int inode_cache_hit;
|
|
EXTERN unsigned int inode_cache_miss;
|
|
|
|
#define NIL_INODE (struct inode *) 0 /* indicates absence of inode slot */
|
|
|
|
/* Field values. Note that CLEAN and DIRTY are defined in "const.h" */
|
|
#define NO_SEEK 0 /* i_seek = NO_SEEK if last op was not SEEK */
|
|
#define ISEEK 1 /* i_seek = ISEEK if last op was SEEK */
|