#define MNT_FAT 1 #define MNT_EXT 2 #define MS_RDONLY 1 #define MNT_FORCE 1 int mount(const char *source, int source_len, const char *target, int target_len, int fs_type, unsigned long flags); int umount(const char *target, int target_len, int flags);
These syscalls mount and unmount filesystems. For mount
, source
is the source device while target
is where to mount in the
global virtual filesystem. For umount
, target
is the path to
unmount.
For mount
, fs_type
can be one of the following values to choose
the filesystem type to mount, it must be specified, detection is not done.
MNT_FAT
: FAT family filesystem.
MNT_EXT
: EXT family filesystem.
flags
may contain MS_RDONLY
to force mounting read-only mounting.
For umount
, flags
allows the following options:
MNT_FORCE
: Unmount the filesystem even if busy, can cause data loss.
These syscalls returns 0
on success or -1
on failure, with the
following errno:
EFAULT
: Incorrect addresses for the string arguments.
EACCES
: MAC forbid this operation.
EINVAL
: Wrong arguments.
EBUSY
: For umount
, the mount is busy, and MNT_FORCE
was
not passed.