Discussion:
Clarification on Mount
(too old to reply)
Iulian Neamtiu
2005-04-18 17:45:28 UTC
Permalink
You don't have to do much in gosfs.c::GOSFS_Mount(), the bulk is already
done for you in vfs.c::Mount(). In principle, you need to check whether
the device you're trying to mount is a legit GOSFS device (i.e.
formatted) and if so, create a buffer cache for the device and use it
thereafter for all disk I/O operations.

Technically speaking:
- you need to create a buffer cache and save it in mountPoint->fsData;
even better, create a structure GOSFS_Instance that contains whatever
info you need associated with a mount point (e.g. buffer cache, pointer
to superblock, cache of the root directory, etc.) and point fsData to an
instance of that structure.

- then, using the buffer cache, read the superblock for the device and
check its validity (magic number, that is)

- set mountPoint->ops to be &s_gosfsMountPointOps

- return 0 if all went well, or error code otherwise (take one from errno.h)


Iulian
Huyen Tue Dao
2005-04-19 01:49:47 UTC
Permalink
Post by Iulian Neamtiu
- you need to create a buffer cache and save it in mountPoint->fsData;
even better, create a structure GOSFS_Instance that contains whatever
info you need associated with a mount point (e.g. buffer cache, pointer
to superblock, cache of the root directory, etc.) and point fsData to an
instance of that structure.
I'm sorry could someone clarify what the cache of the root directory is
exactly? Is that just the block containing the root directory?

H
Iulian Neamtiu
2005-04-19 02:20:34 UTC
Permalink
Post by Huyen Tue Dao
Post by Iulian Neamtiu
- you need to create a buffer cache and save it in mountPoint->fsData;
even better, create a structure GOSFS_Instance that contains whatever
info you need associated with a mount point (e.g. buffer cache, pointer
to superblock, cache of the root directory, etc.) and point fsData to an
instance of that structure.
I'm sorry could someone clarify what the cache of the root directory is
exactly? Is that just the block containing the root directory?
Well - I presume you'll have to write a lookup function at some point
(that given a path, walks down the directory structure and in
the end returns a directory entry) and since you start looking up at the
root dir, you might for instance save
an struct FS_Buffer * pointer to the root directory so that
you have it handy at all times.

Same thing for the superblock (remember
the free block bitmap resides in the superblock, and you'll need access to
that frequently, and it needs to stay in sync, so you'll have a buffer
cache buffer for it).

Iulian

Loading...