File Operations

Files must not only be able to store information, but must also allow this information to be manipulated. From the user viewpoint, manipulation is performed by functions of the standard library. These instruct the kernel to execute system calls, which then perform the required operations. Of course, the interface may not differ for each filesystem implementation. The VFS layer therefore provides abstracted operations that link general file objects with the low-level mechanisms of the underlying filesystem.

The structure used to abstract the file operations must be kept as general as possible or as necessary to cater for a wide range of target files. At the same time, it must not feature too many specialized operations that are useful for one particular file type but not for the rest. Nevertheless, the special requirements of the various files (normal files, device files, etc.) must be satisfied in order to exploit their capabilities to the full.

Each file instance includes a pointer to an instance of the struct file_operations structure that holds function pointers to all possible file operations. This structure is defined as follows:

Continue reading here: Info

Was this article helpful?

0 0