return mnt_fs_set_source(mnt_context_get_fs(cxt), source);
}
+/**
+ * mnt_context_get_source:
+ * @cxt: mount context
+ *
+ * Returns: returns pointer or NULL in case of error pr if not set.
+ */
+const char *mnt_context_get_source(struct libmnt_context *cxt)
+{
+ return mnt_fs_get_source(mnt_context_get_fs(cxt));
+}
+
/**
* mnt_context_set_target:
* @cxt: mount context
return mnt_fs_set_target(mnt_context_get_fs(cxt), target);
}
+/**
+ * mnt_context_get_target:
+ * @cxt: mount context
+ *
+ * Returns: returns pointer or NULL in case of error pr if not set.
+ */
+const char *mnt_context_get_target(struct libmnt_context *cxt)
+{
+ return mnt_fs_get_target(mnt_context_get_fs(cxt));
+}
+
/**
* mnt_context_set_fstype:
* @cxt: mount context
return mnt_fs_set_fstype(mnt_context_get_fs(cxt), fstype);
}
+/**
+ * mnt_context_get_fstype:
+ * @cxt: mount context
+ *
+ * Returns: returns pointer or NULL in case of error pr if not set.
+ */
+const char *mnt_context_get_fstype(struct libmnt_context *cxt)
+{
+ return mnt_fs_get_fstype(mnt_context_get_fs(cxt));
+}
+
/**
* mnt_context_set_options:
* @cxt: mount context
*
* This function infors libmount that used from [u]mount.<type> helper.
*
+ * The function also calls mnt_context_disable_helpers() to avoid recursive
+ * mount.<type> helpers calling. It you really want to call another
+ * mount.<type> helper from your helper than you have to explicitly enable this
+ * feature by:
+ *
+ * mnt_context_disable_helpers(cxt, FALSE);
+ *
* Returns: 0 on success, negative number in case of error.
*/
int mnt_context_init_helper(struct libmnt_context *cxt, int flags)
{
- return set_flag(cxt, MNT_FL_HELPER, 1);
+ int rc = mnt_context_disable_helpers(cxt, TRUE);
+
+ if (!rc)
+ return set_flag(cxt, MNT_FL_HELPER, 1);
+ return rc;
}
#ifdef TEST_PROGRAM
extern int mnt_context_set_source(struct libmnt_context *cxt, const char *source);
extern int mnt_context_set_target(struct libmnt_context *cxt, const char *target);
extern int mnt_context_set_fstype(struct libmnt_context *cxt, const char *fstype);
+extern const char *mnt_context_get_source(struct libmnt_context *cxt);
+extern const char *mnt_context_get_target(struct libmnt_context *cxt);
+extern const char *mnt_context_get_fstype(struct libmnt_context *cxt);
+
extern int mnt_context_set_options(struct libmnt_context *cxt, const char *optstr);
extern int mnt_context_append_options(struct libmnt_context *cxt,
const char *optstr);
mnt_context_get_cache;
mnt_context_get_fs;
mnt_context_get_fstab;
+ mnt_context_get_fstype;
mnt_context_get_lock;
mnt_context_get_mflags;
mnt_context_get_mtab;
mnt_context_get_optsmode;
+ mnt_context_get_source;
mnt_context_get_status;
+ mnt_context_get_target;
mnt_context_get_user_mflags;
mnt_context_init_helper;
mnt_context_is_fake;
mnt_context_set_fstab;
mnt_context_set_fstype;
mnt_context_set_fstype_pattern;
- mnt_context_set_mountdata;
mnt_context_set_mflags;
+ mnt_context_set_mountdata;
mnt_context_set_options;
mnt_context_set_options_pattern;
mnt_context_set_optsmode;