Pick a Free OS

User login

Navigation

Virtual File System - Part 2

The Inode

An inode contains the management information for a particular file. The information contained includes owner id, size of file, access time, access rights, and the allocation of data to blocks on the physical media. The inode already contains a few block numbers to ensure efficient access to small files. Access to larger files is provided via indirect blocks that contain block numbers. The indirect blocks come in three flavors:

*Indirect reference

*Double indirect reference

*Triple indirect reference

The definition of the inode structure is as follows:

struct inode

{

dev_t i_dev; /* file device number */

unsigned long i_ino; /* inode number */

umode_t i_mode; /* file type and access rights */

nlink_t i_nlink; /* number of hard links */

uid_t i_uid; /* owner */

gid_t i_gid; /* owner group */

dev_t i_rdev; /* device, if device file */

off_t i_size; /* size of file */

time_t i_atime; /* time of last access */

time_t i_mtime; /* time of last modification */

time_t i_ctime; /* time of creation */

unsigned long i_blksize; /* block size */

unsigned long i_blocks; /* number of blocks */

unsigned long i_version; /* DCache version

management */

struct semaphore i_sem; /* access control */

struct inode_operations *i_op; /* inode operations */

struct super_block *i_sb; /* superblock */

struct wait_queue *i_wait; /* wait queue */

struct file_lock *i_flock; /* file locks */

struct vm_area_struct *i_mmap; /* memory areas */

struct inode *i_next; /* inode linking */

struct inode *i_prev; /* inode linking */

struct inode *i_hash_next; /* for hashing */

struct inode *i_hash_prev;/* for hashing */

struct inode *i_mount; /* root inode of mounted

File System */

unsigned short i_count; /* reference counter */

unsigned short i_flags; /* flags */

unsigned char i_lock; /* lock */

unsigned char i_dirt; /* inode has been modified */

unsigned char i_pipe; /* inode represents a pipe */

unsigned char i_sock; /* it represents a socket */

unsigned char i_seek; /* not used */

unsigned char i_update; /* inode is current */

union {

struct pipe_inode_info pipe_i;

struct ext2_inode_info ext2_i;

struct msdos_inode_info msdos_i;

...........

...........

...........

void * generic_ip;

} u; /* File System specific info */

};