Mount a filesystem
#include <sys/mount.h>
int mount( const char* spec,
const char* dir,
int flags,
const char* type,
const void* data,
int datalen );
libc
The mount() function sends a request to servers to mount the services provided by spec
and type at dir. The parameters are:
- spec
- Null-terminated string describing a special device (e.g. /dev/hd0t77).
- dir
- Null-terminated string with the directory to be mounted (e.g. /mnt/home).
- flags
- A flag that's passed to the driver:
- _MOUNT_READONLY
- Mark the filesystem mountpoint as read-only.
- _MOUNT_NOEXEC
- Don't allow executables to load.
- _MOUNT_NOSUID
- Don't honor setuid bits on the filesystem.
- _MOUNT_NOCREAT
- Don't allow file creation on the filesystem.
- _MOUNT_OFF32
- Limit off_t to 32 bits.
- _MOUNT_NOATIME
- Disable logging of file access times.
- _MOUNT_BEFORE
- Call resmgr_attach() with RESMGR_FLAG_BEFORE.
- _MOUNT_AFTER
- Call resmgr_attach() with RESMGR_FLAG_AFTER.
- _MOUNT_OPAQUE
- Call resmgr_attach() with RESMGR_FLAG_OPAQUE.
- _MOUNT_UNMOUNT
- Unmount this path.
- _MOUNT_REMOUNT
- This path is already mounted, perform an update.
- _MOUNT_FORCE
- Force an unmount or a remount change.
- _MOUNT_ENUMERATE
- Auto-detect on this device.
- type
- Null-terminated string with the filesystem type (e.g. "nfs", "cifs", "qnx4",
"ext2", "network").
- data
- A pointer to additional data to be sent to the manager.
If datalen is <0 the data points to a null-terminated string.
- datalen
- Length of the data in bytes that's being sent to the server or <0 if the data is a null-terminated string.
If _MFLAG_OCB is passed to mount() as part of the flags
then the special device string is passed and all servers are contacted.
If it isn't passed as part of the flags and the special device spec exists,
then only the server that created that device is contacted and the fullpath to spec is provided.
If datalen is any value <0 then it is assumed that if
there is a data pointer that it is a pointer to a string.
NULL is a valid spec value if there is no special device.
-1 on failure; no server supports the request (errno is set).
QNX 6
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
resmgr_attach(),
umount()
Writing a Resource Manager in Programmer's Guide