file system design

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
pepito

file system design

Post by pepito »

Hello:

I am working into my OS's file system and I choice the FAT architecture.

By now it works like this:

If the user want to work with some volume, the user must call a function called 'open_volume()'. This function load the FAT information about the volume and return an address to this information. Then when need data about this volume just read it from this address.

All this work fine, but I have some questions about how I must handle the directories information.

It is necessary a work directory for each volume the user open?
It is possible open many directories for each volume?
What kind on information is necessary to save about the directories?

Maybe someone have some idea or know some web site where I could get some ideas.

Every little idea can help me,
thank you very much,

pepito
Adek336

RE:file system design

Post by Adek336 »

It depends if your system works under protected mode.

Under pmode, user apps/kernel will access the filesystem through the vfs layer; the vfs layer checks the device needed base on the dir name (/fd -> contact fat12 + fdc driver, /hd0- contact fat32+hd driver). To read a directory, I use the standard functions

DIRh *opendir(char *name);
dirent *readdir(DIRh *handle);
void closedir(DIRh *handle);

All the necessary info on the dir sits right in the DIRh struct. Each process has it's own current_dir.

The VFS layer has an array of fs_t classes. fat12fs_t, ext2fs_t inherit fs_t. The struct keeps info on current media, the source (so one ext2fs driver can manage 3 ext2fs harddrives: each class keeps it's source, like /dev/hd0 /dev/hd1 etc.)

Hope this helps,
Adrian
Post Reply