#define MNT_FAT 1 #define MNT_EXT 2 #define MNT_DEV 3 #define MS_RDONLY 0b0001 #define MS_REMOUNT 0b0010 #define MS_RELATIME 0b0100 #define MS_NOATIME 0b1000 #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.
MNT_DEV
: DevFS filesystem, cannot be used.
For mount
, flags
allows:
MNT_RDONLY
: Mount as read-only.
MNT_REMOUNT
: Remount an existing filesystem.
MNT_RELATIME
: Use relative time for the mount, to know what it does,
Generic filesystem options. Conflicts with MNT_NOATIME
.\
MNT_NOATIME
: Do not track access times. To know what it does,
Generic filesystem options.
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.