[ Previous | Next | Table of Contents | Index | Library Home |
Technical Reference: Base Operating System and Extensions , Volume 2
Makes a file system available for
Standard C Library
int vmount ( VMount, Size)
struct vmount *VMount;
( Device, Path, Flags)
The vmount subroutine
mounts a file system, thereby making the file available for use. The
vmount subroutine effectively creates what is known as a
virtual file system. After a file system is mounted,
references to the path name that is to be mounted over refer to the root
directory on the mounted file system.
A directory can only be mounted
over a directory, and a file can only be mounted over a file. (The file
or directory may be a symbolic link.)
Therefore, the vmount
subroutine can provide the following types of mounts:
- A local file over a local or
- A local directory over a local
or remote directory
- A remote file over a local
or remote file
- A remote directory over a
local or remote directory.
A mount to a directory or a file can be issued if the calling process has
root user authority or is in the system group and has write access to the
To mount a block device, remote
file, or remote directory, the calling process must also have root user
The mount subroutine
only allows mounts of a block device over a local directory with the default
file system type. The mount subroutine searches the
/etc/filesystems file to find a corresponding stanza for the
desired file system.
mount subroutine interface is provided only for compatibility with
previous releases of the operating system. The use of the
mount subroutine is strongly discouraged by normal application
If the directory you are trying
to mount over has the sticky bit set to on, you must either own that directory
or be the root user for the mount to succeed. This restriction applies
only to directory-over-directory mounts.
- A path name identifying the block device (also called a special file) that
contains the physical file system.
- A path name identifying the directory on which the file system is to be
- Values that define characteristics of the object to be mounted.
Currently these values are defined in the
- Indicates that the object to be mounted is read-only and that write access
is not allowed. If this value is not specified, writing is permitted
according to individual file accessibility.
- Indicates that setuid and setgid programs referenced
through the mount should not be executable. If this value is not
specified, setuid and setgid programs referenced through
the mount may be executable.
- Indicates that opens of device special files referenced through the mount
should not succeed. If this value is not specified, opens of device
special files referenced through the mount may succeed.
- A pointer to a variable-length vmount structure. This
structure is defined in the sys/vmount.h file.
The following fields of the
VMount parameter must be initialized before the call to the
- The revision code in effect when the program that created this virtual
file system was compiled. This is the value
- The total length of the structure with all its data. This must be a
multiple of the word size (4 bytes) and correspond with the Size
- Contains the general mount characteristics. The following value may
- A read-only virtual file system is to be created.
- The type of the generic file system underlying the
VMT_OBJECT. Values for this field are defined in the
sys/vmount.h file and include:
- Indicates the native file system.
- Indicates a Network File System client.
- Indicates a CD-ROM file system.
- An array of structures that describe variable length data associated with
the vmount structure. The structure consists of the
- The offset of the data from the beginning of the vmount
- The size, in bytes, of the data.
The array consists of the following
- Specifies he name of the device, directory, or file to be mounted.
- Specifies the name of the device, directory, or file to be mounted
- Specifies the short (binary) name of the host that owns the mounted
object. This need not be specified if VMT_OBJECT is local
(that is, it has the same vmt_gfstype as / (root), the
root of all file systems).
- Specifies the long (character) name of the host that owns the mounted
object. This need not be specified if VMT_OBJECT is
- Specifies binary information to be passed to the generic file-system
implementation that supports VMT_OBJECT. The interpretation
of this field is specific to the gfs_type.
- Specifies a character string representation of VMT_INFO.
On return from the
vmount subroutine, the following additional fields of the
VMount parameter are initialized:
- Specifies the two-word file system identifier; the interpretation of
this identifier depends on the gfs_type.
- Specifies the unique identifier of the virtual file system. Virtual
file systems do not survive the IPL; neither does this identifier.
- Specifies the time at which the virtual file system was created.
- Specifies the size, in bytes, of the supplied data area.
Upon successful completion, a
value of 0 is returned. Otherwise, a value of -1 is returned, and
the errno global variable is set to indicate the error.
The mount and
vmount subroutines fail and the virtual file system is not created if
any of the following is true:
||The calling process does not have write permission on the stub directory
(the directory to be mounted over).
||VMT_OBJECT specifies a device that is already mounted or an
object that is open for writing, or the kernel's mount table is
||The VMount parameter points to a location outside of the
allocated address space of the process.
||The size of the file system is too big.
||An internal inconsistency has been detected in the file system.
||The contents of the VMount parameter are unintelligible (for
example, the vmt_gfstype is unrecognizable, or the file system
implementation does not understand the VMT_INFO provided).
||The file system type requested has not been configured.
||The object to be mounted is not a file, directory, or device.
||The types of VMT_OBJECT and VMT_STUB are
||VMT_OBJECT specifies a block device, and the calling process
does not have root user authority.
||An attempt has been made to mount a file system for read/write when the
file system cannot support writing.
The mount and
vmount subroutines can also fail if additional
These subroutines are part of
Base Operating System (BOS) Runtime.
The mntctl subroutine, umount (umount or uvmount Subroutine) subroutine.
The mount command, umount command.
Directories, and File Systems for Programmers in AIX 5L Version
5.1 General Programming Concepts: Writing and Debugging
[ Previous | Next | Table of Contents | Index |
Library Home |