I have (for now) these funcions:
Code: Select all
read
write
open
close
readdir
finddir
Code: Select all
read
write
open
close
readdir
finddir
But I don't understand how can I open for example a file like '/usr/lib/file.txt' (if there is this file) with this method...JamesM wrote:Well actually, I happen to have one I cooked up earlier...
http://www.jamesmolloy.co.uk/tutorial_h ... nitrd.html
That is actually explained in detail on that page - did you actually read it or just skim it?MarkOS wrote:But I don't understand how can I open for example a file like '/usr/lib/file.txt' (if there is this file) with this method...JamesM wrote:Well actually, I happen to have one I cooked up earlier...
http://www.jamesmolloy.co.uk/tutorial_h ... nitrd.html
For example if I have the function open("/usr/lib/file.txt"), how can this function open the file?
(assuming this file exists)
It's the only method to do this?AJ wrote:Hi,
You need to have a VFS function which recurses through each path, stopping if it gets to a point where the next item does not exist. For example - first, check if 'usr' exists. If so, search the 'usr' directory for the 'lib' item. If that exists, find 'file.txt' and return a valid handle for that in the selected mode (read/write/append/etc...). If any stage of this fails, you stop and return an error code.
Although this isn't difficult, you need to think carefully about error checking, how errors are handled and exactly what mode types your OS will allow...
Cheers,
Adam