int (*rename) (struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry);
Given an existing file (specified by old_dentry, in
an existing directory (old_dir), insert the file
into directory new_dir having the name specified
in new_dentry, fill in the contents of
new_dentry, and remove the file from
old_dir.
Is the fs code responsible for checking circularities, etc?
int (*readlink) (struct dentry *dentry, char *buffer,int buflen);
Note that followlink must be defined if readlink is defined.
If symbolic links are not supported, this can be null.
The buffer argument is a pointer in user space to
a buffer (of length buflen) in which to
store the symbolic link path associated with the file identified
by the dentry argument.
In many file system implementations, this will call
int vfs_readlink(struct dentry *dentry, char *buffer, int buflen, const char *link)
with the symlink path as the fourth argument. This makes
the file system implementation easier because the fs programmer
does not have to handle copying from kernel space into user
space (which is typically an architecture dependent operation).
int (*follow_link) (struct dentry *dentry, struct nameidata *nd);
The dentry specifies a symbolic link. The function
is to fill in the nameidata structure pointed to
by nd.
In many file system implementations, this function will extract
the symbolic link path from the inode, then call
int vfs_follow_link(struct nameidata *nd, const char *link)
with the link argument set to the symlink path.
A
nameidatastruct looks as follows:
struct nameidata {
struct dentry *dentry;
struct vfsmount *mnt;
struct qstr last;
unsigned int flags;
int last_type;
};
void (*truncate) (struct inode *inode);
This function truncates the inode argument to
the size that has been (re)set inside the inode structure
i_size field.
int (*permission) (struct inode *inode , int mask);
If the default vfs_permission checks are not
sufficient to check the ownership and permissions of
inode to see if the permissions requested in
mask are allowed, then a special
permission function can be provided.
int (*revalidate) (struct dentry *);Not sure how this works. It seems to be used to revalidate cached entries for file systems such as nfs
int (*setattr) (struct dentry *dentry, struct iattr *attr);
The file system can define a special way to set the attributes of
an an inode by providing this function that takes a dentry
and iattr structure containing the attributes
to be set (such as time, permissions, uid, size)
for that inode. If not defined, the attributes are set in
the inode structure and it is marked dirty.
int (*getattr) (struct dentry *dentry, struct iattr *attr);
The file system can define a special way to get attributes
from an inode by providing this function which sets the
attribute structure attr from the information in
the inode referred to by dentry.