read_inode: ext2_read_inode, write_inode: ext2_write_inode, put_inode: ext2_put_inode, delete_inode: ext2_delete_inode, put_super: ext2_put_super, write_super: ext2_write_super, statfs: ext2_statfs, remount_fs: ext2_remount,
void (*read_inode) (struct inode *inode);Read the inode data on the disk and store its information into the inode structure argument. The unique identifying number for this inode must be present in the inode->i_ino before making the call.
Fields not set by read_inode are the following:
i_hash i_list i_dentry i_dirty_buffers i_dirty_data_buffers
void (*read_inode2) (struct inode *inode, void *p) ;
read_inode2 is a kludge that supports ReiserFS.
ReiserFS requires more information than can be placed in the
inode->i_ino field.
void (*write_inode) (struct inode *inode, int do_sync);Requests that the disk inode be modified to contain the contents of the inode object passed as its argument. The second argument if nonzero, requests the disk be synchronized upon writing, that is, to wait until the disk is updated.
void (*put_inode) (struct inode *inode);Notifies the file system that the inode structure can be freed. If no other processes use the object, associated resources can be released.
void (*delete_inode) (struct inode *inode);Deletes all data blocks associated with the specified inode, the inode itself, and any associated file system data.
void (*put_super) (struct super_block *super);Notifies the file system that the super_block argument has can be released because the logical file system has been unmounted.
void (*write_super) (struct super_block *super);Updates the file system to implement the contents of the associated super_block object.
int (*statfs) (struct super_block *super, struct statfs *buf);Fills the statfs structure with current state information from the file system identified by the super_block.
int (*remount_fs) (struct super_block *super, int *flags, char *data);Remounts the file system specified by super_block with the flags specified by the integer argument and options specified in the character data buffer.
void (*dirty_inode) (struct inode *inode);mark_inode_dirty.
void (*write_super_lockfs) (struct super_block *super);
void (*unlockfs) (struct super_block *super);
void (*clear_inode) (struct inode *inode);clear_inode does the freeing of
the inode's pages then calls this only if it is defined.
void (*umount_begin) (struct super_block *super);nfs
implementation.
struct dentry * (*fh_to_dentry)(struct super_block *sb, __u32 *fh, int len, int fhtype, int parent);int (*dentry_to_fh)(struct dentry *, __u32 *fh, int *lenp, int need_parent);
int (*show_options)(struct seq_file *, struct vfsmount *);read_inode: coda_read_inode, clear_inode: coda_clear_inode, put_super: coda_put_super, statfs: coda_statfs,
struct inode_operations ext3_file_inode_operations = {
truncate: ext3_truncate, /* BKL held */
setattr: ext3_setattr, /* BKL held */
};
In namei.c (two different ways):
/*
* directories can handle most operations...
*/
struct inode_operations ext3_dir_inode_operations = {
create: ext3_create, /* BKL held */
lookup: ext3_lookup, /* BKL held */
link: ext3_link, /* BKL held */
unlink: ext3_unlink, /* BKL held */
symlink: ext3_symlink, /* BKL held */
mkdir: ext3_mkdir, /* BKL held */
rmdir: ext3_rmdir, /* BKL held */
mknod: ext3_mknod, /* BKL held */
rename: ext3_rename, /* BKL held */
};
struct inode_operations page_symlink_inode_operations = {
readlink: page_readlink,
follow_link: page_follow_link,
};
In symlink.c:
struct inode_operations ext3_fast_symlink_inode_operations = {
readlink: ext3_readlink, /* BKL not held. Don't need */
follow_link: ext3_follow_link, /* BKL not held. Don't need */
};
And finally in bad_inode.c:
struct inode_operations bad_inode_ops =
{
create: EIO_ERROR,
lookup: EIO_ERROR,
link: EIO_ERROR,
unlink: EIO_ERROR,
symlink: EIO_ERROR,
mkdir: EIO_ERROR,
rmdir: EIO_ERROR,
mknod: EIO_ERROR,
rename: EIO_ERROR,
readlink: EIO_ERROR,
follow_link: bad_follow_link,
truncate: EIO_ERROR,
permission: EIO_ERROR,
revalidate: EIO_ERROR,
};
static int bad_follow_link(struct dentry *dent, struct nameidata *nd)
{
return vfs_follow_link(nd, ERR_PTR(-EIO));
}
static int return_EIO(void)
{
return -EIO;
}
static inline void *ERR_PTR(long error)
{
return (void *) error;
}
#define EIO_ERROR ((void *) (return_EIO))
The following initialization code appears in ext3_read_inode
in inode.c:
if (inode->i_ino == EXT3_ACL_IDX_INO ||
inode->i_ino == EXT3_ACL_DATA_INO)
/* Nothing to do */ ;
else if (S_ISREG(inode->i_mode)) {
inode->i_op = &ext3_file_inode_operations;
inode->i_fop = &ext3_file_operations;
inode->i_mapping->a_ops = &ext3_aops;
} else if (S_ISDIR(inode->i_mode)) {
inode->i_op = &ext3_dir_inode_operations;
inode->i_fop = &ext3_dir_operations;
} else if (S_ISLNK(inode->i_mode)) {
if (!inode->i_blocks)
inode->i_op = &ext3_fast_symlink_inode_operations;
else {
inode->i_op = &page_symlink_inode_operations;
inode->i_mapping->a_ops = &ext3_aops;
}
} else
init_special_inode(inode, inode->i_mode,
le32_to_cpu(iloc.raw_inode->i_block[0]));
int (*create) (struct inode *inode,struct dentry *dentry,int mode);This function creates a new inode on disk for the file associated with the dentry object and sets its file mode to have the specified bits.
struct dentry * (*lookup) (struct inode *dir,struct dentry *dentry);
This searches the directory structure in dir for the entry
having the same file name as given in the specified dentry. The
dentry is updated to refer to the inode of the file that is found.
int (*link) (struct dentry *old_dentry,struct inode *dir,struct dentry *dentry);
This creates a new file in the directory dir. The
new file is a hard link to the file referenced by
old_dentry. It's name is given by the
dentry argument, which is updated to refer to the
newly created file instance.
int (*unlink) (struct inode *dir,struct dentry *dentry);
This removes from dir the instance of a link to
the file referred to by dentry.
int (*symlink) (struct inode *dir,struct dentry *dentry,const char *symname);
This function creates a new inode that will correspond to the
specified dentry in directory dir, and
will symbolically link to the path specified in symname.
The dentry is updated to refer to the new inode.
int (*mkdir) (struct inode *dir,struct dentry *dentry,int mode);
This creates a new directory inside of directory dir
having the filename specified in dentry, and with
permissions specified by mode. The dentry is updated
to reference the newly created directory.
int (*rmdir) (struct inode *dir,struct dentry *dentry);
Removes the directory specified in dentry from directory
dir.
int (*mknod) (struct inode *dir,struct dentry *dentry,int mode,int rdev);
This function creates a special file in directory
dir having the name specified in dentry,
with file type