1MOUNT(2) 386BSD Programmer's Manual MOUNT(2) 2 3NNAAMMEE 4 mmoouunntt, uunnmmoouunntt - mount or dismount a filesystem 5 6SSYYNNOOPPSSIISS 7 ##iinncclluuddee <<ssyyss//mmoouunntt..hh>> 8 9 _i_n_t 10 mmoouunntt(_i_n_t _t_y_p_e, _c_o_n_s_t _c_h_a_r *_d_i_r, _i_n_t _f_l_a_g_s, _c_a_d_d_r__t _d_a_t_a) 11 12 _i_n_t 13 uunnmmoouunntt(_c_o_n_s_t _c_h_a_r *_d_i_r, _i_n_t _f_l_a_g_s) 14 15DDEESSCCRRIIPPTTIIOONN 16 The mmoouunntt() function grafts a filesystem object onto the system file tree 17 at the point _d_i_r. The argument _d_a_t_a describes the filesystem object to be 18 mounted. The argument _t_y_p_e tells the kernel how to interpret _d_a_t_a (See 19 _t_y_p_e below). The contents of the filesystem become available through the 20 new mount point _d_i_r. Any files in _d_i_r at the time of a successful mount 21 are swept under the carpet so to speak, and are unavailable until the 22 filesystem is unmounted. 23 24 The following _f_l_a_g_s may be specified to suppress default semantics which 25 affect filesystem access. 26 27 M_RDONLY The file system should be treated as read-only; Even the 28 super-user may not write on it. 29 30 M_NOEXEC Do not allow files to be executed from the file system. 31 32 M_NOSUID Do not honor setuid or setgid bits on files when executing 33 them. 34 35 M_NODEV Do not interpret special files on the file system. 36 37 M_SYNCHRONOUS All I/O to the file system should be done synchronously. 38 39 The flag M_UPDATE indicates that the mount command is being applied to an 40 already mounted file system. This allows the mount flags to be changed 41 without requiring that the file system be unmounted and remounted. Some 42 file systems may not allow all flags to be changed. For example, most 43 file systems will not allow a change from read-write to read-only. 44 45 The _t_y_p_e argument defines the type of the file system. The types of file 46 systems known to the system are defined in <_s_y_s/_m_o_u_n_t._h>. _D_a_t_a is a 47 pointer to a structure that contains the type specific arguments to 48 mount. The currently supported types of file systems and their type 49 specific data are: 50 51 MOUNT_UFS 52 struct ufs_args { 53 char *fspec; /* Block special file to mount */ 54 int exflags; /* export related flags */ 55 uid_t exroot; /* mapping for root uid */ 56 }; 57 58 MOUNT_NFS 59 struct nfs_args { 60 struct sockaddr_in *addr; /* file server address */ 61 nfsv2fh_t *fh; /* File handle to be mounted */ 62 int flags; /* flags */ 63 int wsize; /* write size in bytes */ 64 int rsize; /* read size in bytes */ 65 int timeo; /* initial timeout 0.1 secs */ 66 int retrans; /* times to retry send */ 67 char *hostname; /* server's name */ 68 }; 69 70 MOUNT_MFS 71 struct mfs_args { 72 char *name; /* name of backing process */ 73 caddr_t base; /* base address of the file system */ 74 u_long size; /* size of the file system */ 75 }; 76 77 The uummoouunntt() function call disassociates the filesystem from the 78 specified mount point _d_i_r. 79 80 The _f_l_a_g_s argument may have one of the following values: 81 82 MNT_NOFORCE The unmount should fail if any files are active on the 83 file system. 84 85 MNT_FORCE The file system should be forcibly unmounted even if files 86 are still active. Active special devices continue to 87 work, but any further accesses to any other active files 88 result in errors even if the file system is later 89 remounted. 90 91RREETTUURRNN VVAALLUUEESS 92 The mmoouunntt() returns the value 0 if the mount was successful, otherwise -1 93 is returned and the variable _e_r_r_n_o is set to indicate the error. 94 95 UUmmoouunntt returns the value 0 if the umount succeeded; otherwise -1 is 96 returned and the variable _e_r_r_n_o is set to indicate the error. 97 98EERRRROORRSS 99 MMoouunntt() will fail when one of the following occurs: 100 101 [EPERM] The caller is not the super-user. 102 103 [ENAMETOOLONG] 104 A component of a pathname exceeded 255 characters, or the 105 entire length of a path name exceeded 1023 characters. 106 107 [ELOOP] Too many symbolic links were encountered in translating a 108 pathname. 109 110 [ENOENT] A component of _d_i_r does not exist. 111 112 [ENOTDIR] A component of _n_a_m_e is not a directory, or a path prefix of 113 _s_p_e_c_i_a_l is not a directory. 114 115 [EINVAL] A pathname contains a character with the high-order bit set. 116 117 [EBUSY] Another process currently holds a reference to _d_i_r. 118 119 [EFAULT] _D_i_r points outside the process's allocated address space. 120 121 The following errors can occur for a _u_f_s file system mount: 122 123 [ENODEV] A component of ufs_args _f_s_p_e_c does not exist. 124 125 [ENOTBLK] _F_s_p_e_c is not a block device. 126 127 [ENXIO] The major device number of _f_s_p_e_c is out of range (this 128 indicates no device driver exists for the associated 129 hardware). 130 131 132 [EBUSY] _F_s_p_e_c is already mounted. 133 134 [EMFILE] No space remains in the mount table. 135 136 [EINVAL] The super block for the file system had a bad magic number or 137 an out of range block size. 138 139 [ENOMEM] Not enough memory was available to read the cylinder group 140 information for the file system. 141 142 [EIO] An I/O error occurred while reading the super block or 143 cylinder group information. 144 145 [EFAULT] _F_s_p_e_c points outside the process's allocated address space. 146 147 The following errors can occur for a _n_f_s file system mount: 148 149 [ETIMEDOUT] 150 _N_f_s timed out trying to contact the server. 151 152 [EFAULT] Some part of the information described by nfs_args points 153 outside the process's allocated address space. 154 155 The following errors can occur for a _m_f_s file system mount: 156 157 [EMFILE] No space remains in the mount table. 158 159 [EINVAL] The super block for the file system had a bad magic number or 160 an out of range block size. 161 162 [ENOMEM] Not enough memory was available to read the cylinder group 163 information for the file system. 164 165 [EIO] An paging error occurred while reading the super block or 166 cylinder group information. 167 168 [EFAULT] _N_a_m_e points outside the process's allocated address space. 169 170 UUmmoouunntt may fail with one of the following errors: 171 172 [EPERM] The caller is not the super-user. 173 174 [ENOTDIR] A component of the path is not a directory. 175 176 [EINVAL] The pathname contains a character with the high-order bit set. 177 178 [ENAMETOOLONG] 179 A component of a pathname exceeded 255 characters, or an 180 entire path name exceeded 1023 characters. 181 182 [ELOOP] Too many symbolic links were encountered in translating the 183 pathname. 184 185 [EINVAL] The requested directory is not in the mount table. 186 187 [EBUSY] A process is holding a reference to a file located on the file 188 system. 189 190 [EIO] An I/O error occurred while writing cached file system 191 information. 192 193 [EFAULT] _D_i_r points outside the process's allocated address space. 194 195 A _u_f_s or _m_f_s mount can also fail if the maximum number of filesystems are 196 currently mounted. 197 198SSEEEE AALLSSOO 199 mount(8), umount(8), mfs(8) 200 201BBUUGGSS 202 Some of the error codes need translation to more obvious messages. 203 204HHIISSTTOORRYY 205 MMoouunntt() and uummoouunntt() function calls appeared in Version 6 AT&T UNIX. 206 2074th Berkeley Distribution March 15, 1991 4 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265