Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

unmount(2)

open(2)

mount(8)

MOUNT(2)  —  UNIX Programmer’s Manual

NAME

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;

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>):

mount filesystem read-only. 

ignore set-uid bit on execution. 

this flag must always be set. 

use BSD file-creation semantics (see open(2)).

change options on an existing mount. 

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.3"
struct ufs_args {
char∗fspec;/∗ Block special file 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 ∗/
intflags;/∗ flags ∗/
intwsize;/∗ write size in bytes ∗/
intrsize;/∗ read size in bytes ∗/
inttimeo;/∗ initial timeout in .1 secs ∗/
intretrans;/∗ times to retry send ∗/
char∗hostname;/∗ server’s hostname ∗/
intacregmin;/∗ attr cache file min secs ∗/
intacregmax;/∗ attr cache file max secs ∗/
intacdirmin;/∗ attr cache dir min secs ∗/
intacdirmax;/∗ attr cache dir max secs ∗/
char∗netname;/∗ server’s netname ∗/
 };

RETURN VALUE

Upon successful completion a value of 0 is returned.  Otherwise, a value of −1 is returned and errno is set to indicate the error. 

ERRORS

mount() fails when one of the following occurs:

EPERM The caller is not the super-user. 

ENODEV The file system type specified by type is not valid or is not configured into the system. 

ENAMETOOLONG The length of a component of the path name of dir exceeds 255 characters, or the length of the entire path name of dir exceeds 1023 characters. 

ENOENT A component of dir does not exist. 

EACCES Search permission is denied for a component of the path prefix of dir.

ENOTDIR The file named by dir is not a directory. 

EBUSY Another process currently holds a reference to dir.

EFAULT dir points outside the process’s allocated address space. 

ELOOP Too many symbolic links were encountered in translating the path name of dir.

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

ENOTBLK fspec is not a block device. 

ENXIO The major device number of fspec is out of range (this indicates no device driver exists for the associated hardware). 

EMFILE No space remains in the mount table. 

EINVAL The super block for the file system had a bad magic number or an out of range block size. 

ENOMEM Not enough memory was available to read the cylinder group information for the file system. 

ENOTDIR A component of the path prefix of fspec is not a directory. 

ENAMETOOLONG The length of a component of the path name of fspec exceeds 255 characters, or the length of the entire path name of fspec exceeds 1023 characters. 

ENOENT A component of fspec does not exist. 

EACCES Search permission is denied for a component of the path prefix of fspec.

EFAULT fspec points outside the process’s allocated address space. 

ELOOP Too many symbolic links were encountered in translating the path name of fspec.

EIO An I/O error occurred while reading from or writing to the file system. 

SEE ALSO

unmount(2), open(2), mount(8)

BUGS

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

7th Edition  —  Revision 1.4 of 01/07/90

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026