VFS, files, and directories...
Posted: Fri Oct 28, 2005 7:51 pm
Hi All,
I have a question about designing the VFS layer.
What advantages are there for having a file descriptor represent both files AND directories?
Would having the VFS distinguish between directories and files (or file streams, to be more extensible/unified) as separate types/interfaces have any benefits? And what disadvantages would this entail?
I'm just thinking about operations that you perform on directories versus file streams.
For example: seeking on a directory seems pointless, but then other kinds of file streams are non-seekable too.
On the other hand: you can't open a file, and try and read it as a directory. However: if you were tricky, you could treat a file as a directory when that file is say a file archive, or a disk image.
So, I'm quite undecided. It seems everybody treats files & directories as a single base type (the file descriptor). Therefore, all your guys thoughts are very welcome =)
Jonathan
I have a question about designing the VFS layer.
What advantages are there for having a file descriptor represent both files AND directories?
Would having the VFS distinguish between directories and files (or file streams, to be more extensible/unified) as separate types/interfaces have any benefits? And what disadvantages would this entail?
I'm just thinking about operations that you perform on directories versus file streams.
For example: seeking on a directory seems pointless, but then other kinds of file streams are non-seekable too.
On the other hand: you can't open a file, and try and read it as a directory. However: if you were tricky, you could treat a file as a directory when that file is say a file archive, or a disk image.
So, I'm quite undecided. It seems everybody treats files & directories as a single base type (the file descriptor). Therefore, all your guys thoughts are very welcome =)
Jonathan