[Return to Top] [Standard Processes]

EROS Object Reference

Standard Processes

SFS: Simple Filesystem

D R A F T

Description

SFS is a simple filesystem constisting of a tree of directory and file processes, which are differentiated by their alleged keytypes. SFS is designed to provide just enough functionality to interact with many UNIX applications built using an SFS-modified C library.

Directory traversals begin with the root directory process. The first time root is CALLed, it initializes itself as an empty directory process.


Figure 1: Typical directory structure

Directory and file processes obtain space dynamically from a space bank. SFS utilizes a process creator for file and directory creation.


Operations

Check Alleged Key Type (OC = KT)

Returns the alleged type of the object.
ReplyR1AKT_SFSF: Key is a file process.

AKT_SFSD: Key is a directory process.

Read (OC = 0)

Read from the file. "rcv.len" indicates the number of bytes actually read.
RequestLFile descriptor.
LBytes to read.
ResultRC_OKRead successful.
1File is not open.
2This operation is only permitted on file processes.
3Generic error.
3The file descriptor's mode does not permit this operation.
ReplyB*Bytes read.

Write (OC = 1)

Write to the file
RequestLFile descriptor.
B*Up to one page of data.
ResultRC_OKWrite successful.
1File is not open.
2This operation is only permitted on file processes.
3Generic error.
4File descriptor's mode does not permit this operation.
5Out of space.
ReplyLNumber of bytes actually written.

Open (OC = 2)

Open a file for reading or writing
RequestLFlags
flags is one of O_RDONLY, O_WRONLY or O_RDWR which request opening the file read-only, write-only or read/write, respectively.
LMode (not currently implemented)
ResultRC_OKOpen successful.
1Generic error.
2File is already open.
ReplyLFile descriptor.

Close (OC = 3)

Close an open file.
RequestLFile descriptor
ResultRC_OKClose successful.
1Generic error.
2File is not open.

Seek (OC = 4)

reposition file read/write offset
RequestLFile descriptor
LOffset
LWhence
If whence is SEEK_SET, the offset is set to offset bytes.
If whence is SEEK_CUR, the offset is set to its current location plus offset bytes.
If whence is SEEK_END, the offset is set to the size of the file plus offset bytes.
ResultRC_OKSeek successful.
1Generic error.
2Seek past EOF.
ReplyLResulting offset location.

Creat (OC = 5)

Create a new file or directory.
RequestLFlags (0=file, 1=directory)
ResultRC_OKCreat successful.
1This operation is valid only on directory processes.
2A file by that name already exists.
3Out of space.
ReplySK0Start key for new file/directory.

Remove (OC = 6)

Remove a file or directory. Directories must be empty.
RequestLFlags (0=normal, 1=force)
ResultRC_OKRemove successful.
1Directory not empty.
2Directory/file is still open and operation was not forced.

Readdir (OC = 7)

Read from a directory.
RequestLFlags (0=get start key, 1=get dir listing)
LFileID
ResultRC_OKRead successful.
1Generic error.
2Directory is not open.
ReplySK0Start key for given FileID
B*Directory listing (filename\255fileid\255filename\255fileid...)


Mike Berry <berrym@eros-os.org>

Copyright 1998 by Jonathan Shapiro. All rights reserved. For terms of redistribution, see the GNU General Public License