moss.fs
Interface MFSOps

All Known Implementing Classes:
MDevFS, MHostFS, MObjFS, MProcFS

public interface MFSOps

This interface define kernel "file-system operations". File-system drivers must implement this (probably in addition to MFileOps and MDirOps).


Method Summary
 int access(java.lang.String path, int amode)
          tests for access to a file
 int link(java.lang.String oldpath, java.lang.String newpath)
          creates a `hard-link'
 int mkdir(java.lang.String path, int flags)
          creates a directory in the file-system
 int mknod(java.lang.String path, int mode, int majmin)
          creates a special file on the file-system
 int mount(java.lang.String mount_path, java.lang.String[] options)
          this is called when a file-system is first created and mounted.
 int open(java.lang.String path, MFile handle, int flags, int mode)
          called to open a file.
 int opendir(java.lang.String path, MFile handle)
          called to open a directory (read-only!).
 int readlink(java.lang.String path, byte[] buf, int buflen)
          reads the contents of a symbolic-link on the file-system
 int rmdir(java.lang.String path)
          removes a directory from the file-system (must be empty)
 int stat(java.lang.String path, MInode statbuf)
          retrieves information about a name on the file-system
 int symlink(java.lang.String oldpath, java.lang.String newpath)
          creates a symbolic link
 int umount(java.lang.String[] options)
          this is called before a file-system is un-mounted.
 int unlink(java.lang.String path)
          removes a name from the file-system (may be a directory -- must be empty)
 int utime(java.lang.String path, long[] times)
          sets access and modification times for a file (inode)
 

Method Detail

mount

int mount(java.lang.String mount_path,
          java.lang.String[] options)
this is called when a file-system is first created and mounted. This should be used to provide any file-system specific setup.

Parameters:
mount_path - full path from the root (/) to where this is being mounted. A single "/" indicates that this is being mounted as the root file-system.
options - file-system specific options
Returns:
0 on success, or < 0 indicating error

umount

int umount(java.lang.String[] options)
this is called before a file-system is un-mounted.

Parameters:
options - file-system specific un-mounting options
Returns:
0 on success, or < 0 indicating error

open

int open(java.lang.String path,
         MFile handle,
         int flags,
         int mode)
called to open a file.

Parameters:
path - relative path to the file (e.g. `etc/passwd' for the root file-system)
handle - file-handle to be associated with this file
flags - open flags
mode - file mode if creating
Returns:
0 on success, or < 0 indicating error

opendir

int opendir(java.lang.String path,
            MFile handle)
called to open a directory (read-only!).

Parameters:
path - relative path to the directory (e.g. `/etc/init.d' for the root file-system)
handle - file-handle to be associated with this directory
Returns:
0 on success, or < 0 indicating error

mkdir

int mkdir(java.lang.String path,
          int flags)
creates a directory in the file-system

Parameters:
path - relative path to the directory to be created
flags - flags (mode)
Returns:
0 on success, or < 0 indicating error

unlink

int unlink(java.lang.String path)
removes a name from the file-system (may be a directory -- must be empty)

Parameters:
path - relative path to the name to be removed
Returns:
0 on success, or < 0 indicating error

rmdir

int rmdir(java.lang.String path)
removes a directory from the file-system (must be empty)

Parameters:
path - relative path to the directory to be removed
Returns:
0 on success, or < 0 indicating error

link

int link(java.lang.String oldpath,
         java.lang.String newpath)
creates a `hard-link'

Parameters:
oldpath - existing relative path (e.g. local/packages/nmh for "usr" file-system)
newpath - new relative path
Returns:
0 on success, or < 0 indicating error

symlink

int symlink(java.lang.String oldpath,
            java.lang.String newpath)
creates a symbolic link

Parameters:
oldpath - full path to existing name (e.g. /usr/local/packages/nmh-1.4 for "usr" file-system)
newpath - relative path to new link (e.g. local/packages/nmh for "usr" file-system)
Returns:
0 on success, or < 0 indicating error

mknod

int mknod(java.lang.String path,
          int mode,
          int majmin)
creates a special file on the file-system

Parameters:
path - relative path to file to create
mode - file mode flags
majmin - major and minor numbers `((major << 16) | minor)' for block/char special files, otherwise ignored.
Returns:
0 on success, or < 0 indicating error

readlink

int readlink(java.lang.String path,
             byte[] buf,
             int buflen)
reads the contents of a symbolic-link on the file-system

Parameters:
path - relative path to symbolic link on file-system
buf - buffer where the link data is stored
buflen - maximum number of bytes to write into `buf'
Returns:
number of bytes read on success, or < 0 indicating error

utime

int utime(java.lang.String path,
          long[] times)
sets access and modification times for a file (inode)

Parameters:
path - relative path to name
times - array of two `long's that are the access and modification times respectively
Returns:
0 on success, or < 0 indicating error

stat

int stat(java.lang.String path,
         MInode statbuf)
retrieves information about a name on the file-system

Parameters:
path - relative path to name
statbuf - buffer in which information is placed
Returns:
0 on success, or < 0 indicating error

access

int access(java.lang.String path,
           int amode)
tests for access to a file

Parameters:
path - relative path to name
amode - access mode ([FRWX]_OK constants)
Returns:
0 on success, or < 0 indicating error