FAT | RFS | XFS | ZFS
mount()
PROTOTYPE
#include <posix.h>
int mount(char *name);
DESCRIPTION
mount() adds the files and directories on the volume specified by name to the accessible path hierarchy. Unmounted volumes use a minimum of system resources. Mounting a volume makes it ready to be used by applications but may allocate memory and additional resources.
name must match the name of a volume added by FatAddVol(), XfsAddVol(), etc. Typically, volumes are added by their device driver during system initialization.
If successful, mount() returns 0. Otherwise, it sets errno and returns -1.
ERROR CODES
| EEXIST | A volume with the same name is already mounted. |
| EFAULT | name equals NULL. |
| EINVAL | The volume is unformatted. |
| ENOENT | No attached volume matches the specified name. |
EXAMPLE
/*-----------------------------------------------------------------*/
/* Okay if able to mount or already mounted. */
/*-----------------------------------------------------------------*/
if (mount(vol_name) == 0) || errno == EEXIST)
printf("Mounted volume \"%s\"\n", vol_name);
/*-----------------------------------------------------------------*/
/* Else if not unformatted, should have succeeded. */
/*-----------------------------------------------------------------*/
else if (errno != EINVAL)
error("mount() failed.");