Полезная информация

next up previous contents
Next: Quick Anatomy of a Up: Tour of the kernel Previous: Executing programs

Accessing filesystems

It is well known that the filesystem is the most basic resource in a system, so basic and ubiquitous that it needs a more handy name -- I'll stick to the standard practice of calling it simply ``fs''.

I'll assume the reader already knows the basic fs ideas -- access permissions, inodes, the superblock, mounting and umounting. Those concepts are well explained by smarter authors than me within the standard literature, so I won't duplicate their efforts and I'll stick to specific issues.

While the first Unices used to support a single fs type, whose structure was widespread in the whole kernel, today's practice is to use a standardized interface between the kernel and the fs, in order to ease data interchange across architectures. itself provides a standardized layer to pass information between the kernel and each fs module. This interface layer is called VFS, for ``virtual filesystem''.

Filesystem code is therefore split into two layers: the upper layer is concerned with the management of kernel tables and data structures, while the lower layer is made up of the set of fs-dependent functions, and is invoked through the VFS data structures.

All the fs-independent material resides in the fs/*.c files. They address the following issues:

The VFS interface, then, consists of a set of relatively high-level operations which are invoked from the fs-independent code and are actually performed by each filesystem type. The most relevant structures are inode_operations and file_operations, though they're not alone: other structures exist as well. All of them are defined within include/linux/fs.h.

The kernel entry point to the actual file system is the structure file_system_type. An array of file_system_types is embodied within fs/filesystems.c and it is referenced whenever a mount is issued. The function read_super for the relevant fs type is then in charge of filling a struct super_block item, which in turn embeds a struct super_operations and a struct type_sb_info. The former provides pointers to generic fs operations for the current fs-type, the latter embeds specific information for the fs-type.


next up previous contents
Next: Quick Anatomy of a Up: Tour of the kernel Previous: Executing programs

Converted on:
Mon Apr 1 10:20:16 EST 1996