sys_mount  [fs/namespace.c]


Mounts filesystems.

Arguments

eax 21
ebx Pointer to a null-terminated string that specifies the file system to attach (usually it's a device name, but can also be a directory name or a dummy).
ecx Pointer to a null-terminated string that specifies the directory where to attach the file system.
edx Pointer to a null-terminated string that specifies the file system type. Refer to /proc/filesystems for the list of supported file systems.
esi Mount flags:
MS_RDONLY Mount file system read-only.
MS_NOSUID Do not honor set-user-ID and set-group-ID bits when executing programs from this file system. This flag is settable on a per-mount-point basis.
MS_NODEV Do not allow access to devices (special files) on this file system. This flag is settable on a per-mount-point basis.
MS_NOEXEC Do not allow programs to be executed from this file system. This flag is settable on a per-mount-point basis.
MS_SYNCHRONOUS Make writes on this file system synchronous (as though the O_SYNC flag to sys_open was specified for all file opens to this file system).
MS_REMOUNT Remount an existing mount. This is allows you to change the mount flags and data (pointed by edi) of an existing mount without having to unmount and remount the file system. ebx and ecx should be the same values specified in the initial sys_mount call; edx is ignored.

The following mount flags can be changed: MS_RDONLY, MS_SYNCHRONOUS, MS_MANDLOCK
Before kernel 2.6.16 the following could also be changed: MS_NOATIME and MS_NODIRATIME.
MS_MANDLOCK Permit mandatory locking on files in this file system. (Mandatory locking must still be enabled on a per-file basis, as described in sys_fcntl.)
MS_DIRSYNC
Make directory changes on this file system synchronous.
MS_NOATIME Do not update access times for (all types of) files on this file system.
From Linux 2.6.16 onwards, this flag is settable on a per-mount-point basis
.
MS_NODIRATIME Do not update access times for directories on this file system.
From Linux 2.6.16 onwards, this flag is settable on a per-mount-point basis
.
MS_BIND Perform a bind mount, making a file or a directory subtree visible at another point within a file system. Bind mounts may cross file system boundaries and span sys_chroot jails. The edx, edi, and other mount flags are ignored.
MS_MOVE Move a subtree. ebx specifies an existing mount point and ecx specifies the new location. The move is atomic: at no point is the subtree unmounted. The edx, edi, and other mount flags are ignored.
MS_REC *to be documented*
MS_SILENT *to be documented*
edi Pointer to a file system's specific null-terminated string. Typically it is a string of comma-separated options understood by this file system. See man 8 mount for a description of available commands.

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values which result from filesystem type independent errors. Each filesystem type may have its own special errors and its own special behavior.

-EACCES A component of a path was not searchable. Or, mounting a read-only filesystem was attempted without giving the MS_RDONLY flag. Or, the block device source is located on a filesystem mounted with the MS_NODEV option.
-EBUSY Source pointed by ebx is already mounted. Or, it cannot be remounted read-only, because it still holds files open for writing. Or, it cannot be mounted on target because target is still busy (it is the working directory of some task, the mount point of another device, has open files, etc.). Or, it could not be unmounted because it is busy.
-EFAULT One of the pointer arguments points outside the user address space.
-EINVAL Source pointed by ebx had an invalid superblock. Or, a remount (MS_REMOUNT) was attempted, but source was not already mounted on target. Or, a move (MS_MOVE) was attempted, but source was not a mount point, or was '/'. Or, an unmount was attempted, but target was not a mount point.
-ELOOP Too many link encountered during pathname resolution. Or, a move was attempted, while target pointed by ecx is a descendant of the source pointed by ebx.
-EMFILE (In case no block device is required:) Table of dummy devices is full.
-ENAMETOOLONG A pathname was longer than MAXPATHLEN.
-ENODEV Specified file system type is not configured in the kernel.
-ENOENT A pathname was empty or had a nonexistent component.
-ENOMEM The kernel could not allocate a free page to copy filenames or data into.
-ENOTBLK Source pointed by ebx is not a block device (and a device was required).
-ENOTDIR The second argument, or a prefix of the first argument, is not a directory.
-ENXIO The major number of the block device pointed by ebx is out of range.
-EPERM The caller does not have the required privileges.

Remarks

Appropriate privilege (the CAP_SYS_ADMIN capability) is required to mount filesystems.

Filesystem can be visible at multiple mount points, and multiple mounts can be stacked on the same mount point.

An attempt to execute a set-user-ID or set-group-ID program on a filesystem mounted with MS_NOSUID is silently ignored.

Compatibility

n/a