Full-featured filesystems are hard to write and require a considerable amount of effort until they reach a usable, efficient, and correct state. This is reasonable if the filesystem is really supposed to store data on disk. However, filesystems — especially virtual ones — serve many purposes that differ from storing proper files on a block device. Such filesystems still run in the kernel, and their code is thus subjected to the rigorous quality requirements imposed by the kernel developers. However, various standard methods makes this aspect of life much easier. A small filesystem library — libfs — contains nearly all ingredients required to implement a filesystem. Developers only need to provide an interface to their data, and they are done.
Additionally, some more standard routines — in the form of the seq_file mechanism — are available to handle sequential files with little effort. Finally, developers might want to just export a value or two into userspace without messing with the existing filesystems like procfs. The kernel also provides a cure for this need: The debugfs filesystem allows for implementing a bidirectional debugging interface with only a few function calls.
Continue reading here: Sequential Files
Was this article helpful?