Writing a new filesystem driver.

Mike A. Harris (mharris@ican.net)
Fri, 11 Dec 1998 23:24:17 -0500 (EST)


I am in the process of writing a new filesystem driver. I have
never taken on any task of this magnitude at the kernel level as
of yet. I've snooped through the kernel sources several times
however, and feel comfortable so far.

When I decided to implement the filesystem driver, I originally
wanted to just do it purely from reading the existing sources and
documentation, without bothering anyone with questions.

However... the available documentation, although it has been
VERY helpful, leaves me with some questions nonetheless. So as
such, I'm looking for a fs mentor, and/or someone who can tell me
where TFM is that I should R. ;o)

I have read Documentation/vfs.txt (the bible), and have studied
the minix, romfs, ext2fs, and fat filesystem code. I havent dove
deeply into it at all, but I've tried to learn what I need to do
the job, and how the structures and methods work in the fs. I
must say that I am amazed at the amount of design that has went
into the vfs, and the filesystems, it is very very structured! I
just need to understand it now. ;o)

The filesystem that I'm implementing is a *VERY* simple one,
which exists allready, just not for Linux. I'd prefer to not
announce what it is unless I have to though, as I'd like to
finish it off first and then surprise everyone with it. ;o) I
will say one thing: People who are into the emulator scene will
appreciate my efforts. ;o)

So, this filesystem is very very primative, and I fully
understand the workings of the filesystem itself, and could write
user mode programs to access the FS easily (although I haven't
yet). I've implemented the necessary data structures for
on-disk, and in-memory (for superblock, and inode data), and am
kindof stuck with what to do now.

The superblock structure seems to become complicated quite
quickly when analyzing the minix sources. Lots of deeply nested
stuff, etc... I lose track of what is going on.

So, question number 1 is:

Is there a SIMPLE filesystem implementation existing for Linux
that may or may not be part of the official kernel? The
filesystem I'm working on is a floppy disk based system - not
based on any UNIX filesystems. If anything it is closer to FAT
than anything.

Secondly, is there a TEMPLATE directory of some kind that gives
the necessary empty functions, etc for the bare minimum stuff
that must be implemented?

Can anyone offer suggestions as to what to do when implementing a
filesystem?

Will my filesystem be available through the loopback driver? Or
will I need to immediately implement a hardware driver for the
real disk drive as well? (Something I plan on doing as well later
on).

I've got a disk image from this drive, with a working filesystem
on it, and that is what I want to work from. I'd like to
implement parts of it in userland until I see I can get dir
listings, and access files read-only. Then make it read-write,
and offer file creation/deletion/rename/etc... THEN make it a
kernel module, and finally integrate it into the kernel proper.

I'm looking for any help that anyone can provide with this issue.
As I've said, I completely understand the filesystem itself, and
have all the documentation I need for it, but I don't completely
understand the Linux VFS layer quite yet, and I'd like to have
more info on it, and implementing filesystems in Linux. I'm
looking for either electronically available info (HOWTO's, FAQ's,
docs, text files, email, whatever) rather than hard copy books,
etc.. I can't afford to buy a book for this, and I prefer
electronic documentation anyways.

Any help from the guru's out there would be greatly appreciated,
and if necessary, I will tell the filesystem that I'm
implementing, but I'd rather not yet...

Thanks very much in advance!

--
Mike A. Harris  -  Computer Consultant  -  Linux advocate

Linux software galore: http://freshmeat.net

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/