Discussion:
confused
(too old to reply)
c***@CSIC.UMD.EDU
2005-04-13 17:04:50 UTC
Permalink
after attending the
discussion section
today i felt i had a
pretty good idea
over what i was
doing. however after
messing around with
the code a little
bit i got a little
confused.

from the project5
guideline it says to
start with the
function
GOSFS_Format (
Block_Device * )
this makes perfect
sense as we want to
format the ide1
first then mount it.
however, after i
started coding a
little bit the first
TODO i got was from
the Sys_Format (
state ).

i began implementing
that a little bit
then went back to
GOSFS_Format.
however, i do not
understand exactly
what each one is
supposed to do.
there isn't an
explanation or
description of what
these functions are
meant to do. i
looked at vfs.c's
format function and
figured that's what
the GOSFS_Format to
do. i understand it
has something to do
with inheritance. i
just couldn't find
where exactly
GOSFS_Format gets
called. i'm guessing
sys_format is
supposed to call it.

anyone have any
hints to fix this
confusion?
Iulian Neamtiu
2005-04-15 15:45:50 UTC
Permalink
When you call Format("ide1", "gosfs"), in user space,
it is handled by Format() in vfs.c which in turn will dispatch it to
GOSFS_Format() in gosfs.c

The inheritance mentioned in the recitation is only conceptual.
If you look at Init_GOSFS() in gosfs.c:
Register_Filesystem("gosfs", &s_gosfsFilesystemOps)

you see that the inheritance is actually implemented by requiring each
filesystem to support a couple of standard operations.

But that's done for you, you don't need to bother with implementing any
kind of inheritance. Read the guideline as well.

In GOSFS_Format(struct Block_Device *blockDev) you'll need to write the
superblock to blockDev.

Get_Num_Blocks(blockDev) will give you the device size in sectors, and
you'll devide that by GOSFS_SECTORS_PER_FS_BLOCK to get the size in blocks.

We warmly recommend you use the buffer cache instead of reading and
writing to the device directly. Check out section 10.7 in the guideline
for details.


Iulian

Loading...