AFAIK, it is called the "file service" or virtual file system layer.. at least that's what I call it
I am not a very good teacher, so I'll just describe I'll be trying to follow (me too, am implementing file services to my kernel at the moment!). The first layer are the wrappers fs_open(), fs_read() etc. around vfs.open(), vfs.read().
You surely will want to be able to mount many fs-modules, right? im my design vfs is a vfs_t class (don't know if it is a good idea to keep it in classes, but we'll see). It mount()s and umount()s fs from the service. Each mounted device tells the following:
/*procedures for devices*/
struct file_operations
{
int ( *lseek ) ( struct file_handle_t *, int, int );
int ( *read ) ( struct file_handle_t *, char *, int );
int ( *write ) ( struct file_handle_t *, char *, int );
int ( *readdir ) ( struct file_handle_t *, struct dirent *, int count );
int ( *ioctl ) ( struct file_handle_t *, uint32, uint32 );
int ( *open ) ( struct file_handle_t * );
int ( *close ) ( struct file_handle_t * );
};
As you see, file_operations::open returns int. vfs_t::open(), instead, returns file_handle_t, which is the handle to access a file.
A file being accessed gets it's own file_t element, counting how many handles access the file, it's name, it's handles, if the file is already open it tells if another process can open it. The handle is used for handling it, sent to the funcs.
I wonder what other designs do other people at the forum have? It would be interesting to compare the various parts.
Hope this helps,
Adrian.