Monday, October 22, 2007

Inode explained...

VFS deals with inode that represent a file or directory object (handle). An inode cache is maintained by the VFS layer to keep track of all frequently used inodes. Each inode contains an inode number that is unique: ls –i can list the inode number associated to a file or directory. Inode manipulation is implemented through the inode operations that define how to: mkdir, rmdir, create, lookup, rename, get attribute, etc…

struct inode_operations {
struct file_operations * default_file_ops;
int (*create) (struct inode *,struct dentry *,int);
struct dentry * (*lookup) (struct inode *,struct dentry *);
int (*link) (struct dentry *,struct inode *,struct dentry *);
int (*unlink) (struct inode *,struct dentry *);
int (*symlink) (struct inode *,struct dentry *,const char *);
int (*mkdir) (struct inode *,struct dentry *,int);
int (*rmdir) (struct inode *,struct dentry *);
int (*mknod) (struct inode *,struct dentry *,int,int);
int (*rename) (struct inode *, struct dentry *,
struct inode *, struct dentry *);
int (*readlink) (struct dentry *, char *,int);
struct dentry * (*follow_link) (struct dentry *, struct dentry *, unsigned int);

int (*get_block) (struct inode *, long, struct buffer_head *, int);

int (*readpage) (struct file *, struct page *);
int (*writepage) (struct file *, struct page *);
int (*flushpage) (struct inode *, struct page *, unsigned long);

void (*truncate) (struct inode *);
int (*permission) (struct inode *, int);
int (*smap) (struct inode *,int);
int (*revalidate) (struct dentry *);
};

No comments: