FILESYS(4spp) RISC/os Reference Manual FILESYS(4spp)
NAME
filesys - general description of file system interface
SYNOPSIS
{
initroutine, openroutine, readroutine,
writeroutine, ioctlroutine, closeroutine
}
DESCRIPTION
New file systems and protocol support is added to the stan-
dalone I/O system by writing the file system or protocol
implementation routines and making a new entry to the file
system configuration structure fstable in the file
saio/conf.c. The format of a file system configuration
entry is shown above. The fields in a file system confi-
guration entry have the following usage:
init_routine(iop)
The initialization routine is called during the startup
initialization of the standalone I/O library when a
program is run. The main function of the initializa-
tion routine is to initialize global data of the file
system routines. The initialization routine usually
does not reference a hardware device.
open_routine(iop, path, flags)
The open routine is called in response to a read(3spp)
request. It is called after the standalone I/O system
has called the device driver open routine. It is
passed a pointer to a struct iob associated with the
descriptor being opened, the path component of the file
to be opened, and flags indicating if the open is
read-only, write-only, or read-write. The main func-
tion of the file system open routine is to establish
enough context regarding the file named in path so that
future read and write requests can be accomplished.
For UNIX file systems, this is accomplished by locating
and reading the appropriate struct inode from the dev-
ice. Protocol implementations locate an appropriate
file server during the open.
read_routine(iop, buffer, count)
The read routine is passed a pointer to a struct iob
associated with the descriptor being read, the address
of a user's buffer, and a byte count indicating the
amount of data to transfer. The read routine accom-
plishes the data transfer by referring to data esta-
blished during the open and making calls to the lower
level device driver. The lower level device driver is
called indirectly through the struct iob, allowing a
file system implementation to serve multiple devices.
Printed 1/6/92 Page 1
FILESYS(4spp) RISC/os Reference Manual FILESYS(4spp)
write_routine(iop, buffer, count)
The write routine functions similarly to the read rou-
tine to accomplish writes to a file system or via a
protocol.
ioctl_routine(iop, command, argument)
The ioctl routine implements any special functions pos-
sible on the file system or protocol. It is passed a
struct iob pointer associated with the descriptor being
operated on, a command indicating the operation to per-
form, and an argument that is specific to the command.
close_routine(iop)
The close routine is passed a pointer to a struct iob
associated with the descriptor being closed. The close
routine performs any clean-up activities necessary with
terminating access to the descriptor.
SEE ALSO
intro(4spp)
Page 2 Printed 1/6/92