[Top] [Prev] [Next] [Bottom]


[Contents] [Index]

mount - add to namespace

mount:fn (fd: ref FD; target: string, flag: int, 
	aname: string): int;

## returns 0 if successful, -1 if unsuccessful.
The fd argument to mount is a file descriptor of an open pipe or network connection to a file server ready to receive Styx messages. The target file must be a directory. After a successful mount the file tree served by fd will be visible with its root directory having name target.

With mount, the file descriptor fd must be open for reading and writing and connected to a file server. (See dial, announce, export, listen - network connections.)

After the mount, the file tree starting at target is served by a kernel mnt device. That device will turn operations in the tree into messages on fd.

The string aname is currently unused.

Example

The mountfd file descriptor is mounted to the target named by mountpoint. It will be mounted after any files currently in that directory, amd if mountpoint does not exist, it will be created (see Options for bind and mount ).

if (sys->mount(mountfd, mountpoint, 
	sys->MAFTER | sys->MCREATE, nil) < 0  {
sys->print("mount %s failed: %r\n", mountpoint);
} 

Options for bind and mount

For both bind and mount, the flag controls details of the modification made to the namespace. In the following descriptions, source refers to the file as defined by name or the root directory served by fd. Both target and source files must be directories, or both must non-directories. The flag parameter can be one of the following:

MREPL

Replace the target file by the source. An evaluation of target will be translated to the source file. If they are directories target becomes a union directory consisting of one directory, the source file.

MBEFORE

Both target and source must be directories. Add the files of the source directory to the union directory at target so its contents appear first in the union. After a bind or mount with this option, the source directory will be searched first when evaluating file names in the union directory.

MAFTER

Like MBEFORE but the source directory goes at the end of the union.

MCREATE

The MCREATE flag can be OR'ed with any of the flags previously described above. When a create call attempts to create in a union directory, and the file does not exist, the elements of the union are searched in order until one is found with MCREATE set. The file is created in that directory; if that attempt fails, the create fails. (see open, create - open/create a file for reading or writing)



[Top] [Prev] [Next] [Bottom]

infernosupport@lucent.com
Copyright © 1997, Lucent Technologies, Inc.. All rights reserved.