All rights reserved.
%sccs.include.redist.man%
@(#)mount.2 6.10 (Berkeley) 06/23/90
#include <sys/mount.h> mount(type, dir, flags, data) int type; char *dir; int flags; caddr_t data;unmount(dir, flags) char *dir; int flags;
The flag argument determines whether certain semantics should be suppressed when accessing the file system:
The flag M_UPDATE indicates that the mount command is being applied to an already mounted file system. This allows the mount flags to be changed without requiring that the file system be unmounted and remounted. Some file systems may not allow all flags to be changed. For example, most file systems will not allow a change from read-write to read-only.
The type argument defines the type of the file system. The types of file systems known to the system are defined in mount.h . Data is a pointer to a structure that contains the type specific arguments to mount. The currently supported types of file systems and their type specific data are:
struct ufs_args { char *fspec; /* Block special file to mount */ int exflags; /* export related flags */ uid_t exroot; /* mapping for root uid */ };
struct nfs_args { struct sockaddr_in *addr; /* file server address */ nfsv2fh_t *fh; /* File handle to be mounted */ int flags; /* flags */ int wsize; /* write size in bytes */ int rsize; /* read size in bytes */ int timeo; /* initial timeout in 0.1 secs */ int retrans; /* times to retry send */ char *hostname; /* server's name */ };
struct mfs_args { char *name; /* name of backing process */ caddr_t base; /* base address of the file system */ u_long size; /* size of the file system */ };
Umount announces to the system that the file system mounted at dir is no longer to contain that file system. The associated directory reverts to its ordinary interpretation.
The flags argument may have the following values:
Umount returns 0 if the action occurred; -1 if an error occurred. The unmount will fail if there are active files in the mounted file system.
15 [EPERM] The caller is not the super-user.
15 [ENAMETOOLONG] A component of a pathname exceeded 255 characters, or the entire length of a path name exceeded 1023 characters.
15 [ELOOP] Too many symbolic links were encountered in translating a pathname.
15 [ENOENT] A component of dir does not exist.
15 [ENOTDIR] A component of name is not a directory, or a path prefix of special is not a directory.
15 [EINVAL] A pathname contains a character with the high-order bit set.
15 [EBUSY] Another process currently holds a reference to dir .
15 [EFAULT] Dir points outside the process's allocated address space.
The following errors can occur for a ufs file system mount:
15 [ENODEV] A component of ufs_args fspec does not exist.
15 [ENOTBLK] Fspec is not a block device.
15 [ENXIO] The major device number of fspec is out of range (this indicates no device driver exists for the associated hardware).
15 [EBUSY] Fspec is already mounted.
15 [EMFILE] No space remains in the mount table.
15 [EINVAL] The super block for the file system had a bad magic number or an out of range block size.
15 [ENOMEM] Not enough memory was available to read the cylinder group information for the file system.
15 [EIO] An I/O error occurred while reading the super block or cylinder group information.
15 [EFAULT] Fspec points outside the process's allocated address space.
The following errors can occur for a nfs file system mount:
15 [ETIMEDOUT] Nfs timed out trying to contact the server.
15 [EFAULT] Some part of the information described by nfs_args points outside the process's allocated address space.
The following errors can occur for a mfs file system mount:
15 [EMFILE] No space remains in the mount table.
15 [EINVAL] The super block for the file system had a bad magic number or an out of range block size.
15 [ENOMEM] Not enough memory was available to read the cylinder group information for the file system.
15 [EIO] An paging error occurred while reading the super block or cylinder group information.
15 [EFAULT] Name points outside the process's allocated address space.
Umount may fail with one of the following errors:
15 [EPERM] The caller is not the super-user.
15 [ENOTDIR] A component of the path is not a directory.
15 [EINVAL] The pathname contains a character with the high-order bit set.
15 [ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.
15 [ELOOP] Too many symbolic links were encountered in translating the pathname.
15 [EINVAL] The requested directory is not in the mount table.
15 [EBUSY] A process is holding a reference to a file located on the file system.
15 [EIO] An I/O error occurred while writing cached file system information.
15 [EFAULT] Dir points outside the process's allocated address space.