up | Inhaltsverzeichniss | Kommentar

Manual page for MOUNT(2V)

mount - mount file system

SYNOPSIS

#include <sys/mount.h>

int mount(type, dir, M_NEWTYPE|flags, data)
char *type;
char *dir;
int flags;
caddr_t data;

SYSTEM V SYNOPSIS

int mount(spec, dir, rdonly)
char *spec;
char *dir;
int rdonly;

DESCRIPTION

mount() attaches a file system to a directory. After a successful return, references to directory dir will refer to the root directory on the newly mounted file system. dir is a pointer to a null-terminated string containing a path name. dir must exist already, and must be a directory. Its old contents are inaccessible while the file system is mounted.

mount() may be invoked only by the super-user.

The flags argument is constructed by the logical OR of the following bits (defined in <sys/mount.h>):

M_RDONLY
mount filesystem read-only.
M_NOSUID
ignore set-uid bit on execution.
M_NEWTYPE
this flag must always be set.
M_GRPID
use BSD file-creation semantics (see open.2v
M_REMOUNT
change options on an existing mount.
M_NOSUB
disallow mounts beneath this filesystem.

Physically write-protected and magnetic tape file systems must be mounted read-only or errors will occur when access times are updated, whether or not any explicit write is attempted.

The type string indicates the type of the filesystem. data is a pointer to a structure which contains the type specific arguments to mount. Below is a list of the filesystem types supported and the type specific arguments to each:



4.2
struct ufs_args {
	char	*fspec;	/* Block special file to mount */
};

"lo"
struct lo_args {
	char	*fsdir;	/* Pathname of directory to mount */
};

"nfs"
#include	<nfs/nfs.h>
#include	<netinet/in.h>
struct nfs_args {
	struct sockaddr_in  *addr; /* file server address */
	fhandle_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 .1 secs */
	int	retrans;	/* times to retry send */
	char	*hostname;	/* server's hostname */
	int	acregmin;	/* attr cache file min secs */
	int	acregmax;	/* attr cache file max secs */
	int	acdirmin;	/* attr cache dir min secs */
	int	acdirmax;	/* attr cache dir max secs */
	char	*netname;	/* server's netname */

};

rfs
struct rfs_args {
	char	*rmtfs	/* name of remote resource */
	struct token {
		int	t_id;		/* token id */
		char	t_uname[64];	/* domain.machine name */
	}	*token;	/* Identifier of remote machine */
};

SYSTEM V DESCRIPTION

mount() requests that a file system contained on the block special file identified by spec be mounted on the directory identified by dir. spec and dir point to path names. When mount() succeeds, subsequent references to the file named by dir refer to the root directory on the mounted file system.

The M_RDONLY bit of rdonly is used to control write permission on the mounted file system. If the bit is set, writing is not allowed. Otherwise, writing is permitted according to the access permissions of individual files.

RETURN VALUES

mount() returns:

0
on success.
-1
on failure and sets errno to indicate the error.

ERRORS

EACCES
Search permission is denied for a component of the path prefix of dir.
EBUSY
Another process currently holds a reference to dir.
EFAULT
dir points outside the process's allocated address space.
EIO
The UFS file system has been tuned to use contiguous blocks that are larger than the maximum block size than the device drivers can support.
ELOOP
Too many symbolic links were encountered in translating the path name of dir.
ENAMETOOLONG
The length of the path argument exceeds {PATH_MAX}.

A pathname component is longer than {NAME_MAX} (see sysconf.2v while {_POSIX_NO_TRUNC} is in effect (see pathconf.2v

ENODEV
The file system type specified by type is not valid or is not configured into the system.
ENOENT
A component of dir does not exist.
ENOTDIR
The file named by dir is not a directory.
EPERM
The caller is not the super-user.

For a 4.2 file system, mount() fails when one of the following occurs:

EACCES
Search permission is denied for a component of the path prefix of fspec.
EFAULT
fspec points outside the process's allocated address space.
EINVAL
The super block for the file system had a bad magic number or an out of range block size.
EIO
An I/O error occurred while reading from or writing to the file system.
ELOOP
Too many symbolic links were encountered in translating the path name of fspec.
EMFILE
No space remains in the mount table.
ENAMETOOLONG
The length of the path argument exceeds {PATH_MAX}.

A pathname component is longer than {NAME_MAX} (see sysconf.2v while {_POSIX_NO_TRUNC} is in effect (see pathconf.2v

ENOENT
A component of fspec does not exist.
ENOMEM
Not enough memory was available to read the cylinder group information for the file system.
ENOTBLK
fspec is not a block device.
ENOTDIR
A component of the path prefix of fspec is not a directory.
ENXIO
The major device number of fspec is out of range (this indicates no device driver exists for the associated hardware).

SYSTEM V ERRORS

EBUSY
The device referred to by spec is currently mounted.

There are no more mount table entries.

ENOENT
The file referred to by spec or dir does not exist.
ENOTBLK
spec is not a block special device.
ENOTDIR
A component of the path prefix of dir or spec is not a directory.
ENXIO
The device referred to by spec does not exist.

SEE ALSO

unmount.2v open.2v lofs.4s fstab.5 mount.8

BUGS

Some of the error codes need translation to more obvious messages.


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97