libmount Reference Manual | ||||
---|---|---|---|---|
Top | Description |
int mnt_context_do_mount (struct libmnt_context *cxt
); int mnt_context_finalize_mount (struct libmnt_context *cxt
); int mnt_context_mount (struct libmnt_context *cxt
); int mnt_context_next_mount (struct libmnt_context *cxt
,struct libmnt_iter *itr
,struct libmnt_fs **fs
,int *mntrc
,int *ignored
); int mnt_context_prepare_mount (struct libmnt_context *cxt
); #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 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
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 than you have to call mnt_reset_context()
.
If you want to call mount(2) for the same source and target with a diffrent
mount flags or fstype then you 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 umount.type helper wasn't sucessfully called.
Check mnt_context_get_status()
after error!
|
context |
Returns : |
0 on success; >0 in case of mount(2) error (returns syscall errno), <0 in case of other errors. |
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()
.
|
context |
Returns : |
negative number on error, 0 on success. |
int mnt_context_mount (struct libmnt_context *cxt
);
High-level, mounts 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 could be called only once. If you want to mount with
different setting than you have to call mnt_reset_context()
. It's NOT enough
to call mnt_context_reset_status()
if you want call this function more than
once, whole context has to be reseted.
WARNING: non-zero return code does not mean that mount(2) syscall or mount.type helper wasn't sucessfully called.
Check mnt_context_get_status()
after error!
|
mount context |
Returns : |
0 on success; >0 in case of mount(2) error (returns syscall errno), <0 in case of other errors. |
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.
|
context |
|
iterator |
|
returns the current filesystem |
|
returns the return code from mnt_context_mount()
|
|
returns 1 for not matching and 2 for already mounted filesystems |
Returns : |
0 on success, <0 in case of error (!= mount(2) errors) 1 at the end of the list. |
int mnt_context_prepare_mount (struct libmnt_context *cxt
);
Prepare context for mounting, unnecessary for mnt_context_mount()
.
|
context |
Returns : |
negative number on error, zero on success |