Pick a Free OS

User login

Navigation

Virtual File System - Part 2

It extracts a free inode from the complete list of inodes and fills it with the file-system-specific data. After this, it enters the 'filename' in the directory specified by the parameter dir.

* lookup

This function searches for the inode corresponding to the file 'filename' and returns it in the parameter 'result_inode'.

* link

This function sets up a hard link between the oldinode and the filename specified by 'filename' present in the directory 'dir'. Before this routine is called, a check is made to ensure that both the inodes 'oldinode' and 'dir' reside on the same device.

* unlink

This function deletes the file 'filename' present in the directory 'dir'.

* symlink

It creates a symbolic link under the name 'filename' in the directory 'dir' and makes it point to the file specified by 'destname'.

* mkdir

This function sets up a subdirectory with name 'filename' under the directory 'dir' and sets the access rights for the subdirectory as specified by the parameter 'mode'.

* rmdir

This function deletes the subdirectory 'filename' present in the directory 'dir', after checking that the subdirectory is empty and performing some other validations.

* mknod

This function creates a new file with name 'filename' under the directory 'dir' and sets up the access rights for the inode to those specified by the parameter 'mode'. If the inode points to a device file, then the device number is given by the parameter 'rdev'.

* rename

This function changes the name of a file, by removing the old name 'oldname' from the old directory 'olddir' and making an entry for 'newname' under the directory 'newdir'.

* readlink

This function reads symbolic links and copies the pathname for the link to which it points in the buffer 'buf' passed as a parameter. If the buffer is small, then the pathname is truncated to fit into the buffer.

* follow_link

It is used to resolve symbolic links, by returning the inode to which the 'inode1' points. The result is passed back via the paramter result_inode.

* bmap

This function enables memory mapping of files. It maps a block from the file to an address in the user address space.

* truncate

This function is used to change the size of the file corresponding to 'inode1'. Normally it shortens the length of the file, but if the implementation allows, the length of the file can even be increased. The new length of the file is specified in the 'i_size' field of the inode 'inode1' before a call is made to this routine.

* permission