VFS is a common model for all the different file systems (Ext2,vfat,nfs...). All the file systems (if the file system is good) manage the same objects (superblock,inode...) like you said. That's why the VFS can implement some generic method like the open,close...I am trying to better understand the interaction between the VFS layer and Ext2/3 file system. Linux kernel books like 'Understanding Linux Kernel' and Robert Love's book along with all the online material talk about VFS as a abstraction to the kernel that hides the various different file systems. I understand that the VFS has various objects like the Superblock Object, File Object and others and also the various operations(like methods) that can be invoked on them.
On the other hand, when I got into understanding Ext2/3, I saw that this file system also had Superblocks organized as Block groups and other data structures that were similar to VFS's. Further, it also has superblock operations, inode operations among others that is so similar to VFS operations [example :- just like VFS' ulink() operation, Ext2 has ext2_ulink()].
But when you use the open function, you have to access data on a physical media, which is formatted into ext2 or vfat or ...
And the data are organized differently if it's a vfat or an ext2 fs.
So the VFS layer will call low level functions to manage the data for the specific file system.
This is done by pointers function.
In the superblock struct fore example, you have a field with all the operations. This field is done with some pointer to function (the name function aren't exact) :
superblock_struct->read_superblock() ;
this method will read the superblock on the file system (and call the corresponding method (ext2_read_superblock()..)
Thanks in advance, KM
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/