Page 2 of 2
Re: Questions about file handling
Posted: Sat Mar 03, 2012 2:30 pm
by brain
Here's how I do it, there are multiple drivers that implement FS_FileSystem structs and call attach_filesystem to add them to the list.
http://brainbox.cc/repository/trunk/six ... lesystem.c
you can also see the related header file:
http://brainbox.cc/repository/trunk/six ... lesystem.h
Re: Questions about file handling
Posted: Sun Mar 04, 2012 5:25 am
by tobbebia
bluemoon wrote:Don't mix volumes with mount table, they can be isolated.
Think about this, you have a list of volume objects, which can do this thing:
FILE_NODE file;
volume->open(&file, "/abc.txt");
Now, the mount mechanism is merely hash mapping.
Code: Select all
vfs_mount_add("/", vol[0]);
vfs_mount_add("/foo/", vol[1]);
When open a file
This resolve into vol[1] and pass "/abc.txt" to it.
But what if I do readdir on "/". Then it wont list foo as a dir.
Re: Questions about file handling
Posted: Sun Mar 04, 2012 5:27 am
by bluemoon
One way to workaround that is to enforce a directory present before mounting. Just like any unix.
ps. I see nothing wrong by not showing /foo if it does not exist on the volume. It's just a metter of policy and user experience.
Re: Questions about file handling
Posted: Sun Mar 04, 2012 6:06 am
by tobbebia
bluemoon wrote:One way to workaround that is to enforce a directory present before mounting. Just like any unix.
ps. I see nothing wrong by not showing /foo if it does not exist on the volume. It's just a metter of policy and user experience.
Thanks for your informing replies! As I'm not a very experienced linux user I didn't know about that. So basically I should make an initrd filesystem and create those folder: "/dev, /dev/hdd0, /dev/usb" etc?