Top |
int | mnt_context_do_mount () |
int | mnt_context_finalize_mount () |
int | mnt_context_mount () |
int | mnt_context_next_mount () |
int | mnt_context_prepare_mount () |
#define | MNT_MS_COMMENT |
#define | MNT_MS_GROUP |
#define | MNT_MS_HELPER |
#define | MNT_MS_LOOP |
#define | MNT_MS_NETDEV |
#define | MNT_MS_NOAUTO |
#define | MNT_MS_NOFAIL |
#define | MNT_MS_OFFSET |
#define | MNT_MS_OWNER |
#define | MNT_MS_SIZELIMIT |
#define | MNT_MS_ENCRYPTION |
#define | MNT_MS_UHELPER |
#define | MNT_MS_USER |
#define | MNT_MS_USERS |
#define | MNT_MS_XCOMMENT |
#define | MNT_MS_XFSTABCOMM |
#define | MS_BIND |
#define | MS_DIRSYNC |
#define | MS_I_VERSION |
#define | MS_MANDLOCK |
#define | MS_MGC_MSK |
#define | MS_MGC_VAL |
#define | MS_MOVE |
#define | MS_NOATIME |
#define | MS_NODEV |
#define | MS_NODIRATIME |
#define | MS_NOEXEC |
#define | MS_NOSUID |
#define | MS_OWNERSECURE |
#define | MS_PRIVATE |
#define | MS_PROPAGATION |
#define | MS_RDONLY |
#define | MS_REC |
#define | MS_RELATIME |
#define | MS_REMOUNT |
#define | MS_SECURE |
#define | MS_SHARED |
#define | MS_SILENT |
#define | MS_SLAVE |
#define | MS_STRICTATIME |
#define | MS_SYNCHRONOUS |
#define | MS_UNBINDABLE |
#define | MS_LAZYTIME |
int
mnt_context_do_mount (struct libmnt_context *cxt
);
Call mount(2) or mount.type helper. Unnecessary for mnt_context_mount()
.
Note that this function could be called only once. If you want to mount
another source or target, then you have to call mnt_reset_context()
.
If you want to call mount(2) for the same source and target with different
mount flags or fstype, then call mnt_context_reset_status()
and then try
again mnt_context_do_mount()
.
WARNING: non-zero return code does not mean that mount(2) syscall or mount.type helper wasn't successfully called.
Check mnt_context_get_status()
after error!
int
mnt_context_finalize_mount (struct libmnt_context *cxt
);
Mtab update, etc. Unnecessary for mnt_context_mount()
, but should be called
after mnt_context_do_mount()
. See also mnt_context_set_syscall_status()
.
int
mnt_context_mount (struct libmnt_context *cxt
);
High-level, mounts the filesystem by mount(2) or fork()
+exec(/sbin/mount.type).
This is similar to:
mnt_context_prepare_mount(cxt); mnt_context_do_mount(cxt); mnt_context_finalize_mount(cxt);
See also mnt_context_disable_helpers()
.
Note that this function should be called only once. If you want to mount with
different settings, then you have to call mnt_reset_context()
. It's NOT enough
to call mnt_context_reset_status()
. If you want to call this function more than
once, the whole context has to be reset.
WARNING: non-zero return code does not mean that mount(2) syscall or mount.type helper wasn't successfully called.
Check mnt_context_get_status()
after error!
int mnt_context_next_mount (struct libmnt_context *cxt
,struct libmnt_iter *itr
,struct libmnt_fs **fs
,int *mntrc
,int *ignored
);
This function tries to mount the next filesystem from fstab (as returned by
mnt_context_get_fstab()
). See also mnt_context_set_fstab()
.
You can filter out filesystems by:
mnt_context_set_options_pattern()
to simulate mount -a -O pattern
mnt_context_set_fstype_pattern()
to simulate mount -a -t pattern
If the filesystem is already mounted or does not match defined criteria,
then the mnt_context_next_mount()
function returns zero, but the ignored
is
non-zero. Note that the root filesystem and filesystems with "noauto" option
are always ignored.
If mount(2) syscall or mount.type helper failed, then the
mnt_context_next_mount()
function returns zero, but the mntrc
is non-zero.
Use also mnt_context_get_status()
to check if the filesystem was
successfully mounted.
cxt |
context |
|
itr |
iterator |
|
fs |
returns the current filesystem |
|
mntrc |
returns the return code from |
|
ignored |
returns 1 for non-matching and 2 for already mounted filesystems |
int
mnt_context_prepare_mount (struct libmnt_context *cxt
);
Prepare context for mounting, unnecessary for mnt_context_mount()
.