Mono.Fuse : Mono.Fuse Namespace

FileSystem Class

Interface to the Linux File System in User Space (FUSE) Library.

public abstract class FileSystem : IDisposable


Thread Safety

This type is safe for multithreaded operations.

Remarks

The Mono.Fuse.FileSystem type facilitates the implementation of FUSE file system programs. Subclasses can override the FileSystem methods to subscribe and respond to file system events, allowing any other program to communicate with the FileSystem subclass as if it were a file system.

Overridable methods correspond to the following categories:

Note to Inheritors

Inherited classes must be thread-safe by default. If the inherited class cannot be thread safe, then the FileSystem.MultiThreaded property should be set to false, or the -s program argument should be passed to FileSystem.ParseFuseArguments or the Mono.Fuse.FileSystem(System.String[]) constructor.

Not all methods need to be overridden. If a method isn't overridden, then Mono.Unix.Native.Errno.ENOSYS will be returned to the calling program, and nothing will happen when that operation is requested. For example, if you don't override FileSystem.OnCreateDirectory, then if a program attempts to call Mono.Unix.Native.Syscall.mkdir (e.g. through the mkdir(1) program) it will get an error, and the operation will not continue.

Some methods need to be implemented in sets, or a InvalidOperationException will be generated from FileSystem.Start. These sets are:

Examples

The following sample file system will return the contents of SimpleFS.names when the directory is read.

C# Example
using System;
using System.Collections.Generic;
using Mono.Fuse;
using Mono.Unix.Native;

class SimpleFS : FileSystem {
  private List<string> names = new List<string> ();

  public SimpleFS (string[] args) : base (args)
  {
    names.Add ("/foo");
    names.Add ("/bar");
    names.Add ("/baz");
  }

  protected override Errno OnReadDirectory (string directory, OpenedPathInfo info,
      out IEnumerable<DirectoryEntry> names)
  {
    if (directory != "/") {
      names = null;
      return Errno.ENOENT;
    }
    names = ListNames (directory);
    return 0;
  }

  private IEnumerable<DirectoryEntry> ListNames (string directory)
  {
    foreach (string name in names) {
      yield return new DirectoryEntry (name.Substring (1));
    }
  }

  protected override Errno OnGetPathStatus (string path, ref Stat stbuf)
  {
    stbuf = new Stat ();
    if (path == "/") {
      stbuf.st_mode  = NativeConvert.FromUnixPermissionString ("dr-xr-xr-x");
      stbuf.st_nlink = 1;
      return 0;
    }
    if (!names.Contains (path))
      return Errno.ENOENT;
    stbuf.st_mode = NativeConvert.FromUnixPermissionString ("-r--r--r--");
    return 0;
  }

  public static void Main (string[] args)
  {
    using (SimpleFS fs = new SimpleFS (args)) {
      fs.Start ();
    }
  }
}

The above program can be compiled as:

sh Example
gmcs -r:Mono.Fuse.dll -r:Mono.Posix.dll SimpleFS.cs

The resulting program can then be used by executing it and using normal shell programs to interact with it.

sh Example
$ mono SimpleFS.exe mountpoint &
$ ls -1 mountpoint
bar
baz
foo

The program can be terminated by unmounting mountpoint by using the fusermount program:

sh Example
fusermount -u mountpoint

Members

See Also: Inherited members from object.

Protected Constructors

Creates and initializes a new instance of the Mono.Fuse.FileSystem class.
Creates and initializes a new instance of the Mono.Fuse.FileSystem class for the specified mount point.
Creates and initializes a new instance of the Mono.Fuse.FileSystem class using the specified arguments.

Properties

AllowAccessToOthers
bool . Allow access to other users.
AllowAccessToRoot
bool . Allow access to other users.
AllowMountOverNonEmptyDirectory
bool . Allow mounting over a non-empty directory.
AttributeTimeout
double . Cache timeout for attributes.
DefaultGroupId
long . Default file owner Group ID.
DefaultUmask
Mono.Unix.Native.FilePermissions . Default file umask.
DefaultUserId
long . Default file owner User ID.
DeletedPathTimeout
double . Cache timeout for deleted path names.
EnableDirectIO
bool . Enable Direct I/O.
EnableFuseDebugOutput
bool . Enable generation of FUSE debug messages to the standard output stream.
EnableKernelCache
bool . Cache files in kernel.
EnableKernelPermissionChecking
bool . Enable permission checking by the OS kernel.
EnableLargeReadRequests
bool . Issue large read requests.
FuseOptions [read-only]
System.Collections.Generic.IDictionary<System.String,System.String> . FUSE startup options.
ImmediatePathRemoval
bool . Immediately remove file and directories, don't hide them.
MaxReadSize
int . Gets or sets the maximum size of read requests.
MountPoint
string . The directory to mount the file system over.
MultiThreaded
bool . Controls whether FUSE will invoke Mono.Fuse.FileSystem methods in a multithreaded manner.
Name
string . Gets or sets the file system name.
PathTimeout
double . Cache timeout for path names.
ReaddirSetsInode
bool . Readdir sets inodes.
SetsInodes
bool . FileSystem sets inode numbers.

Methods

Dispose ()
Cleans up FUSE resources.
ParseFuseArguments (string[]) : string[]
Parses args looking for FUSE options.
static ShowFuseHelp (string)
Writes FUSE argument information to your programs standard error stream.
Start ()
Initializes FUSE and starts file system event processing.
Stop ()
Exits the FUSE event loop.

Protected Methods

Dispose (bool)
Release resources associated with this instance.
static GetOperationContext () : FileSystemOperationContext
Gets a Mono.Fuse.FileSystemOperationContext instance containing additional contextual information for the current operation.
OnAccessPath (string, Mono.Unix.Native.AccessModes) : Mono.Unix.Native.Errno
Check file access permissions.
OnChangePathOwner (string, long, long) : Mono.Unix.Native.Errno
Change owner and group of a file.
OnChangePathPermissions (string, Mono.Unix.Native.FilePermissions) : Mono.Unix.Native.Errno
Change the permission bits of a file.
OnChangePathTimes (string, ref Mono.Unix.Native.Utimbuf) : Mono.Unix.Native.Errno
Set file access and modification times.
OnCreateDirectory (string, Mono.Unix.Native.FilePermissions) : Mono.Unix.Native.Errno
Create a directory.
OnCreateHandle (string, OpenedPathInfo, Mono.Unix.Native.FilePermissions) : Mono.Unix.Native.Errno
Create and open a file.
OnCreateHardLink (string, string) : Mono.Unix.Native.Errno
Create a hard link to a file.
OnCreateSpecialFile (string, Mono.Unix.Native.FilePermissions, ulong) : Mono.Unix.Native.Errno
Create a special or ordinary file.
OnCreateSymbolicLink (string, string) : Mono.Unix.Native.Errno
Create a symbolic link.
OnFlushHandle (string, OpenedPathInfo) : Mono.Unix.Native.Errno
Possibly flush cached data.
OnGetFileSystemStatus (string, out Mono.Unix.Native.Statvfs) : Mono.Unix.Native.Errno
Get file system statistics.
OnGetHandleStatus (string, OpenedPathInfo, out Mono.Unix.Native.Stat) : Mono.Unix.Native.Errno
Get attributes of an open file.
OnGetPathExtendedAttribute (string, string, byte[], out int) : Mono.Unix.Native.Errno
Retreive an extended attribute value.
OnGetPathStatus (string, out Mono.Unix.Native.Stat) : Mono.Unix.Native.Errno
Get file or directory attributes.
OnListPathExtendedAttributes (string, out string[]) : Mono.Unix.Native.Errno
List extended attribute names.
OnOpenDirectory (string, OpenedPathInfo) : Mono.Unix.Native.Errno
Open a directory for later reading.
OnOpenHandle (string, OpenedPathInfo) : Mono.Unix.Native.Errno
Open or create a file for reading or writing.
OnReadDirectory (string, OpenedPathInfo, out System.Collections.Generic.IEnumerable<Mono.Fuse.DirectoryEntry>) : Mono.Unix.Native.Errno
Read the files in a directory.
OnReadHandle (string, OpenedPathInfo, byte[], long, out int) : Mono.Unix.Native.Errno
Read data from an open file.
OnReadSymbolicLink (string, out string) : Mono.Unix.Native.Errno
Read the target of a symbolic link.
OnReleaseDirectory (string, OpenedPathInfo) : Mono.Unix.Native.Errno
Release a directory.
OnReleaseHandle (string, OpenedPathInfo) : Mono.Unix.Native.Errno
Close an opened file.
OnRemoveDirectory (string) : Mono.Unix.Native.Errno
Remove a directory
OnRemoveFile (string) : Mono.Unix.Native.Errno
Remove a directory entry.
OnRemovePathExtendedAttribute (string, string) : Mono.Unix.Native.Errno
Remove an extended attribute.
OnRenamePath (string, string) : Mono.Unix.Native.Errno
Rename a file or directory.
OnSetPathExtendedAttribute (string, string, byte[], Mono.Unix.Native.XattrFlags) : Mono.Unix.Native.Errno
Create or modify an extended attribute.
OnSynchronizeDirectory (string, OpenedPathInfo, bool) : Mono.Unix.Native.Errno
Synchronize directory contents.
OnSynchronizeHandle (string, OpenedPathInfo, bool) : Mono.Unix.Native.Errno
Synchronize file contents.
OnTruncateFile (string, long) : Mono.Unix.Native.Errno
Change the size of a file.
OnTruncateHandle (string, OpenedPathInfo, long) : Mono.Unix.Native.Errno
Change the size of an open file.
OnWriteHandle (string, OpenedPathInfo, byte[], long, out int) : Mono.Unix.Native.Errno
Write data to an open file.

Member Details

FileSystem Constructor

protected FileSystem ()

Creates and initializes a new instance of the Mono.Fuse.FileSystem class.

Remarks


FileSystem Constructor

protected FileSystem (string mountPoint)

Creates and initializes a new instance of the Mono.Fuse.FileSystem class for the specified mount point.

Parameters

mountPoint
A string containing the directory that should be mounted.

Remarks

This constructor initializes the FileSystem.MountPoint property to mountPoint.

FileSystem Constructor

protected FileSystem (string[] args)

Creates and initializes a new instance of the Mono.Fuse.FileSystem class using the specified arguments.

Parameters

args
A string array containing FUSE arguments and the mountpoint.

Remarks

This constructor is equivalent to calling the FileSystem constructor, calling FileSystem.ParseFuseArguments with args, and setting FileSystem.MountPoint to the last array element in the array returned by ParseFuseArguments.

ParseFuseArguments Method

public string[] ParseFuseArguments (string[] args)

Parses args looking for FUSE options.

Parameters

args
A string array containing the arguments to initialize the FUSE library with.

Returns

A string array containing any unhandled args elements.

Exceptions

Type Condition
ArgumentException If args contains a -o argument without a following string or string=value argument.

Remarks

This method parses args looking for FUSE-formatted arguments. A FUSE-formatted argument is one of:

  • -d to enable FUSE debug output. This is also equivalent to -odebug.
  • -f to enable foreground output. This is the only permitted behavior anyway, so it's simply ignored.
  • -s to disable multithreading support within FUSE. By default multithreading is enabled. (See also FileSystem.MultiThreaded.)
  • Any argument of the form -ostring, -ostring=value, and the argument pairs -o string, -o string=value. Any argument or argument pair matching this pattern will be handled by ParseFuseArguments.

This method initializes the FileSystem.FuseOptions property to contain the specified arguments.

Note:

If any non-FUSE arguments are captured by this method, they will be stored in FileSystem.FuseOptions and provided to FUSE during the FileSystem.Start method. If any non-FUSE arguments are passed to FUSE, FUSE will report an error.

Do not pass non-FUSE arguments to FUSE.


ShowFuseHelp Method

public static void ShowFuseHelp (string appname)

Writes FUSE argument information to your programs standard error stream.

Parameters

appname
A string containing the program name to display within the help text.

Remarks

Use this method to show the FUSE arguments within your help information.

Examples

FileSystem.ShowFuseHelp should be used to augment your help text generation when handling the standard --help argument.

C# Example
using System;
using Mono.Fuse;

class Help {
	public static void Main ()
	{
		FileSystem.ShowFuseHelp ("helpfs");
		Console.Error.WriteLine ("helpfs options:");
		Console.Error.WriteLine ("    --argument-name-here   Summary Information");
	}
}

The above program generates the output:

output Example
usage: helpfs mountpoint [options]

general options:
    -o opt,[opt...]        mount options
    -h   --help            print help
    -V   --version         print version

FUSE options:
    -d   -o debug          enable debug output (implies -f)
    -f                     foreground operation
    -s                     disable multi-threaded operation

    -o allow_other         allow access to other users
    -o allow_root          allow access to root
    -o nonempty            allow mounts over non-empty file/dir
    -o default_permissions enable permission checking by kernel
    -o fsname=NAME         set filesystem name
    -o large_read          issue large read requests (2.4 only)
    -o max_read=N          set maximum size of read requests

    -o hard_remove         immediate removal (don't hide files)
    -o use_ino             let filesystem set inode numbers
    -o readdir_ino         try to fill in d_ino in readdir
    -o direct_io           use direct I/O
    -o kernel_cache        cache files in kernel
    -o umask=M             set file permissions (octal)
    -o uid=N               set file owner
    -o gid=N               set file group
    -o entry_timeout=T     cache timeout for names (1.0s)
    -o negative_timeout=T  cache timeout for deleted names (0.0s)
    -o attr_timeout=T      cache timeout for attributes (1.0s)

helpfs options:
    --argument-name-here   Summary Information

Dispose Method

public void Dispose ()

Cleans up FUSE resources.

Remarks

This method should be called when FileSystem.Start returns.

If a subclass needs to cleanup its resources, it should override FileSystem.Dispose(bool).


Dispose Method

protected virtual void Dispose (bool disposing)

Release resources associated with this instance.

Parameters

disposing
A bool specifying whether this was called as a result of an explicit FileSystem.Dispose() call instead of through the finalizer.

Remarks

Subclasses should override this method if they need to release resources during class cleanup.

Note to Inheritors

Overridding implementations must call the Mono.Fuse.FileSystem base method as part of their implementation so that Mono.Fuse.FileSystem has a chance to cleanup FUSE.


Start Method

public void Start ()

Initializes FUSE and starts file system event processing.

See Also

Exceptions

Type Condition
InvalidOperationException

FileSystem.MountPoint is null.

-or-

A file operation "set" was not fully implemented. Sets include:

NotSupportedException

There was an error initializing FUSE. This is frequently because the FUSE kernel module hasn't been loaded (try running /sbin/modprobe fuse as the root user) or FileSystem.MountPoint could not be mounted (it's not empty or it's already mounted).

FileSystem.MountPoint could not be mounted.

-or

A new FUSE instance could not be created.

Remarks

Creates a FUSE argument based on FileSystem.FuseOptions, initializes FUSE with these arguments, mounts the directory FileSystem.MountPoint, and starts event processing.

If FileSystem.MultiThreaded is true, then FUSE will be allowed to invoke Mono.Fuse.FileSystem operations in a multithreaded manner. Otherwise, only a single thread will be used to invoke FileSystem operations.

This method will not return until FileSystem.MountPoint is unmounted using the fusermount program or the FileSystem.Stop method is invoked.


Stop Method

public void Stop ()

Exits the FUSE event loop.

Remarks

This method can be invoked to cause the FUSE event loop to stop, allowing FileSystem.Start to return.

GetOperationContext Method

protected static FileSystemOperationContext GetOperationContext ()

Gets a Mono.Fuse.FileSystemOperationContext instance containing additional contextual information for the current operation.

Returns

A Mono.Fuse.FileSystemOperationContext instance containing conextual information for the current operation.

Remarks

This method should only be invoked from within an overridden method such as FileSystem.OnGetPathStatus to retrieve additional contextual information for the current file system operation.

OnGetPathStatus Method

protected virtual Mono.Unix.Native.Errno OnGetPathStatus (string path, [System.Runtime.InteropServices.Out] out Mono.Unix.Native.Stat stat)

Get file or directory attributes.

Parameters

path
A string containing the file or directory to get the status of.
stat
A Mono.Unix.Native.Stat that will hold status information for path.

Returns

Returns 0 if successful; otherwise, returns the reason for the failure.

Usage

The following errors can be returned:

Error Details
Mono.Unix.Native.Errno.EACCES

Search permission is denied for a component of the path prefix.

Mono.Unix.Native.Errno.EIO

An I/O error occurred while reading from or writing to the file system.

Mono.Unix.Native.Errno.ELOOP

Too many symbolic links were encountered in translating the pathname.

Mono.Unix.Native.Errno.ENAMETOOLONG

A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.

Mono.Unix.Native.Errno.ENOENT

The named file does not exist.

Mono.Unix.Native.Errno.ENOTDIR

A component of the path prefix is not a directory.

Mono.Unix.Native.Errno.EOVERFLOW

The file size in bytes cannot be represented correctly in the structure pointed to by stat .

Remarks

Similar to Mono.Unix.Native.Syscall.stat. The Mono.Unix.Native.Stat.st_dev and Mono.Unix.Native.Stat.st_blksize fields are ignored.

The Mono.Unix.Native.Stat.st_ino field is ignored unless the FileSystem.SetsInodes mount option is true.

Note to Inheritors

Overriding implementations should not generate an exception. All exceptions which escape this method are translated into Mono.Unix.Native.Errno.EIO.


OnReadSymbolicLink Method

protected virtual Mono.Unix.Native.Errno OnReadSymbolicLink (string link, [System.Runtime.InteropServices.Out] out string target)

Read the target of a symbolic link.

Parameters

link
A string containing the file or directory to get the status of.
target
A string reference which will be filled in to contain the target of the symbolic link link.

Returns

Returns 0 if successful; otherwise, returns the reason for the failure.

Usage

The following errors can be returned:

Error Details
Mono.Unix.Native.Errno.ENOTDIR

A component of the path prefix is not a directory.

Mono.Unix.Native.Errno.ENAMETOOLONG

A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.

Mono.Unix.Native.Errno.ENOENT

The named file does not exist.

Mono.Unix.Native.Errno.EACCES

Search permission is denied for a component of the path prefix.

Mono.Unix.Native.Errno.ELOOP

Too many symbolic links were encountered in translating the pathname.

Mono.Unix.Native.Errno.EINVAL

The named file is not a symbolic link.

Mono.Unix.Native.Errno.EIO

An I/O error occurred while reading from the file system.

Remarks

Simiar to Mono.Unix.Native.Syscall.readlink.

Note to Inheritors

Overriding implementations should not generate an exception. All exceptions which escape this method are translated into Mono.Unix.Native.Errno.EIO.


OnCreateSpecialFile Method

protected virtual Mono.Unix.Native.Errno OnCreateSpecialFile (string file, Mono.Unix.Native.FilePermissions perms, ulong dev)

Create a special or ordinary file.

Parameters

file
A string containing the file or directory to get the status of.
perms
A Mono.Unix.Native.FilePermissions instance containing the permissions of the file to create.
dev
If perms is of the type Mono.Unix.Native.FilePermissions.S_IFCHR or Mono.Unix.Native.FilePermissions.S_IFBLK thsn dev is a ulong containing the major and minor numbers of the newly created device special file; otherwise, dev is ignored.

Returns

Returns 0 if successful; otherwise, returns the reason for the failure.

Usage

The following errors can be returned:

Error Details
Mono.Unix.Native.Errno.ENOTDIR

A component of the path prefix is not a directory.

Mono.Unix.Native.Errno.ENAMETOOLONG

A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.

Mono.Unix.Native.Errno.ENOENT

A component of the path prefix does not exist.

Mono.Unix.Native.Errno.EACCES

Search permission is denied for a component of the path prefix.

Mono.Unix.Native.Errno.ELOOP

Too many symbolic links were encountered in translating the pathname.

Mono.Unix.Native.Errno.EPERM

The process's effective user ID is not super-user.

Mono.Unix.Native.Errno.EIO

An I/O error occurred while making the directory entry or allocating the inode.

Mono.Unix.Native.Errno.ENOSPC

The directory in which the entry for the new node is being placed cannot be extended because there is no space left on the file system containing the directory.

Mono.Unix.Native.Errno.ENOSPC

There are no free inodes on the file system on which the node is being created.

Mono.Unix.Native.Errno.EDQUOT

The directory in which the entry for the new node is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted.

Mono.Unix.Native.Errno.EDQUOT

The user's quota of inodes on the file system on which the node is being created has been exhausted.

Mono.Unix.Native.Errno.EROFS

The named file resides on a read-only file system.

Mono.Unix.Native.Errno.EEXIST

The named file exists.

Mono.Unix.Native.Errno.EINVAL

Creating anything else than a block or character special file (or a whiteout ) is not supported.

Remarks

Simiar to Mono.Unix.Native.Syscall.mknod. This is the Mono.Unix.Native.Syscall.mknod.

This is called for the creation of all non-directory, non-symlink nodes unless FileSystem.OnCreateHandle is overridden.

Note to Inheritors

Overriding implementations should not generate an exception. All exceptions which escape this method are translated into Mono.Unix.Native.Errno.EIO.


OnCreateDirectory Method

protected virtual Mono.Unix.Native.Errno OnCreateDirectory (string directory, Mono.Unix.Native.FilePermissions mode)

Create a directory.

Parameters

directory
A string containing the file or directory to get the status of.
mode
A Mono.Unix.Native.FilePermissions instance containing the permissions of the directory to create.

Returns

Returns 0 if successful; otherwise, returns the reason for the failure.

Usage

The following errors can be returned:

Error Details
Mono.Unix.Native.Errno.ENOTDIR

A component of the path prefix is not a directory.

Mono.Unix.Native.Errno.ENAMETOOLONG

A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.

Mono.Unix.Native.Errno.ENOENT

A component of the path prefix does not exist.

Mono.Unix.Native.Errno.EACCES

Search permission is denied for a component of the path prefix, or write permission is denied on the parent directory of the directory to be created.

Mono.Unix.Native.Errno.ELOOP

Too many symbolic links were encountered in translating the pathname.

Mono.Unix.Native.Errno.EROFS

The named file resides on a read-only file system.

Mono.Unix.Native.Errno.EEXIST

The named file exists.

Mono.Unix.Native.Errno.ENOSPC

The new directory cannot be created because there is no space left on the file system that will contain the directory.

Mono.Unix.Native.Errno.ENOSPC

There are no free inodes on the file system on which the directory is being created.

Mono.Unix.Native.Errno.EDQUOT

The new directory cannot be created because the user's quota of disk blocks on the file system that will contain the directory has been exhausted.

Mono.Unix.Native.Errno.EDQUOT

The user's quota of inodes on the file system on which the directory is being created has been exhausted.

Mono.Unix.Native.Errno.EIO

An I/O error occurred while making the directory entry or allocating the inode.

Mono.Unix.Native.Errno.EIO

An I/O error occurred while reading from or writing to the file system.

Remarks

Note to Inheritors

Overriding implementations should not generate an exception. All exceptions which escape this method are translated into Mono.Unix.Native.Errno.EIO.


OnRemoveFile Method

protected virtual Mono.Unix.Native.Errno OnRemoveFile (string file)

Remove a directory entry.

Parameters

file
A string containing the file or directory to get the status of.

Returns

Returns 0 if successful; otherwise, returns the reason for the failure.

Usage

The following errors can be returned:

Error Details
Mono.Unix.Native.Errno.ENOTDIR

A component of the path prefix is not a directory.

Mono.Unix.Native.Errno.ENAMETOOLONG

A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.

Mono.Unix.Native.Errno.ENOENT

The named file does not exist.

Mono.Unix.Native.Errno.EACCES

Search permission is denied for a component of the path prefix.

Mono.Unix.Native.Errno.EACCES

Write permission is denied on the directory containing the link to be removed.

Mono.Unix.Native.Errno.ELOOP

Too many symbolic links were encountered in translating the pathname.

Mono.Unix.Native.Errno.EPERM

The named file is a directory.

Mono.Unix.Native.Errno.EPERM

The named file has its immutable or append-only flag set, see the Mono.Unix.Native.Syscall.chflags(2) manual page for more information.

Mono.Unix.Native.Errno.EPERM

The directory containing the file is marked sticky, and neither the containing directory nor the file to be removed are owned by the effective user ID.

Mono.Unix.Native.Errno.EBUSY

The entry to be unlinked is the mount point for a mounted file system.

Mono.Unix.Native.Errno.EIO

An I/O error occurred while deleting the directory entry or deallocating the inode.

Mono.Unix.Native.Errno.EROFS

The named file resides on a read-only file system.

Remarks

Similar to Mono.Unix.Native.Syscall.unlink.

Note to Inheritors

Overriding implementations should not generate an exception. All exceptions which escape this method are translated into Mono.Unix.Native.Errno.EIO.


OnRemoveDirectory Method

protected virtual Mono.Unix.Native.Errno OnRemoveDirectory (string directory)

Remove a directory

Parameters

directory
A string containing the directory to remove.

Returns

Returns 0 if successful; otherwise, returns the reason for the failure.

Usage

The following errors can be returned:

Error Details
Mono.Unix.Native.Errno.ENOTDIR

A component of the path is not a directory.

Mono.Unix.Native.Errno.ENAMETOOLONG

A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.

Mono.Unix.Native.Errno.ENOENT

The named directory does not exist.

Mono.Unix.Native.Errno.ELOOP

Too many symbolic links were encountered in translating the pathname.

Mono.Unix.Native.Errno.ENOTEMPTY

The named directory contains files other than "." and ".." in it.

Mono.Unix.Native.Errno.EACCES

Search permission is denied for a component of the path prefix.

Mono.Unix.Native.Errno.EACCES

Write permission is denied on the directory containing the link to be removed.

Mono.Unix.Native.Errno.EPERM

The directory containing the directory to be removed is marked sticky, and neither the containing directory nor the directory to be removed are owned by the effective user ID.

Mono.Unix.Native.Errno.EBUSY

The directory to be removed is the mount point for a mounted file system.

Mono.Unix.Native.Errno.EIO

An I/O error occurred while deleting the directory entry or deallocating the inode.

Mono.Unix.Native.Errno.EROFS

The directory entry to be removed resides on a read-only file system.

Remarks

Similar to Mono.Unix.Native.Syscall.rmdir.

Note to Inheritors

Overriding implementations should not generate an exception. All exceptions which escape this method are translated into Mono.Unix.Native.Errno.EIO.


OnCreateSymbolicLink Method

protected virtual Mono.Unix.Native.Errno OnCreateSymbolicLink (string target, string link)

Create a symbolic link.

Parameters

target
A string containing the target of the symbolic link.
link
A string containing the path of the symbolic link itself.

Returns

Returns 0 if successful; otherwise, returns the reason for the failure.

Usage

The following errors can be returned:

Error Details
Mono.Unix.Native.Errno.ENOTDIR

A component of the name2 prefix is not a directory.

Mono.Unix.Native.Errno.ENAMETOOLONG

A component of either pathname exceeded 255 characters, or the entire length of either path name exceeded 1023 characters.

Mono.Unix.Native.Errno.ENOENT

The named file does not exist.

Mono.Unix.Native.Errno.EACCES

A component of the link path prefix denies search permission.

Mono.Unix.Native.Errno.ELOOP

Too many symbolic links were encountered in translating the pathname.

Mono.Unix.Native.Errno.EEXIST

The path name pointed at by the link argument already exists.

Mono.Unix.Native.Errno.EIO

An I/O error occurred while making the directory entry for link , or allocating the inode for link , or writing out the link contents of link .

Mono.Unix.Native.Errno.EROFS

The file link would reside on a read-only file system.

Mono.Unix.Native.Errno.ENOSPC

The directory in which the entry for the new symbolic link is being placed cannot be extended because there is no space left on the file system containing the directory.

Mono.Unix.Native.Errno.ENOSPC

The new symbolic link cannot be created because there is no space left on the file system that will contain the symbolic link.

Mono.Unix.Native.Errno.ENOSPC

There are no free inodes on the file system on which the symbolic link is being created.

Mono.Unix.Native.Errno.EDQUOT

The directory in which the entry for the new symbolic link is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted.

Mono.Unix.Native.Errno.EDQUOT

The new symbolic link cannot be created because the user's quota of disk blocks on the file system that will contain the symbolic link has been exhausted.

Mono.Unix.Native.Errno.EDQUOT

The user's quota of inodes on the file system on which the symbolic link is being created has been exhausted.

Mono.Unix.Native.Errno.EIO

An I/O error occurred while making the directory entry or allocating the inode.

Remarks

Similar to Mono.Unix.Native.Syscall.symlink.

Note to Inheritors

Overriding implementations should not generate an exception. All exceptions which escape this method are translated into Mono.Unix.Native.Errno.EIO.


OnRenamePath Method

protected virtual Mono.Unix.Native.Errno OnRenamePath (string oldpath, string newpath)

Rename a file or directory.

Parameters

oldpath
A string containing the path to rename.
newpath
A string containing the new path name.

Returns

Returns 0 if successful; otherwise, returns the reason for the failure.

Usage

The following errors can be returned:

Error Details
Mono.Unix.Native.Errno.ENAMETOOLONG

A component of either pathname exceeded 255 characters, or the entire length of either path name exceeded 1023 characters.