[Prev][Next][Index][Thread]

Re: fopen()



> From: Facundo Arena <trax@abaconet.com.ar>
> Subject: fopen()
> 
> Once I have my linux partition mounted: can I use the fopen function
> to open a file?

Yes, but you have to do some more initialization beyond mounting the
partition. I suggest you look at the example program:

	examples/x86/more/netbsd_fs_posix.c

which is a demonstration kernel that does something like what you want to
do. Specifically, there is a call to start_fs() in that program. That
routine lives in oskit/startup/start_fs.c. Start_fs() arranges for the
the filesystem namespace to be created from the blkio (partition), and for
that namespace to be made available to the C/Posix library so that the
fopen call has something to operate on (that is, the filesystem namespace).
Put another way, after the mount and getroot, you need to initialize the
namespace and the clientos library. The example program you started with
(linux_fs_com) was intended to talk to the COM interfaces directly, not to
the C/Posix library.

Look for the call to oskit_create_fsnamespace() in start_fs(). Note that
this stuff is mostly documented in the oskit manual in the chapters
describing the clientos (Chap 11), filesystem namespace (Chap 20), Posix
LIbrary (Chap 17), and the C libraries (Chap 12 or 18).

Good Luck. Let us know if you have any more questions.

Lbs

---------------------------------------------------------------------------
Leigh B. Stoller                     Computer Science - Flux Research Group
stoller@cs.utah.edu                  University of Utah
http://www.cs.utah.edu/~stoller      Salt Lake City, Utah 84112
Voice: (541) 758-6252                FAX: (801) 585-3743
---------------------------------------------------------------------------