return fs ? fs->flags : 0;
}
+/**
+ * mnt_fs_get_propagation:
+ * @fs: mountinfo entry
+ * @flags: returns propagation MS_* flags as present in mountinfo file
+ *
+ * Note that this function set @flags to zero if not found any propagation flag
+ * in mountinfo file. The kernel default is MS_PRIVATE, this flag is not stored
+ * in the mountinfo file.
+ *
+ * Returns: 0 on success or negative number in case of error.
+ */
+int mnt_fs_get_propagation(struct libmnt_fs *fs, unsigned long *flags)
+{
+ if (!fs || !flags)
+ return -EINVAL;
+
+ *flags = 0;
+
+ if (!fs->opt_fields)
+ return 0;
+
+ /*
+ * The optional fields format is incompatible with mount options
+ * ... we have to parse the field here.
+ */
+ *flags |= strstr(fs->opt_fields, "shared:") ? MS_SHARED : MS_PRIVATE;
+
+ if (strstr(fs->opt_fields, "master:"))
+ *flags |= MS_SLAVE;
+ if (strstr(fs->opt_fields, "unbindable"))
+ *flags |= MS_UNBINDABLE;
+
+ return 0;
+}
+
/**
* mnt_fs_is_kernel:
* @fs: filesystem
extern const char *mnt_fs_get_optional_fields(struct libmnt_fs *fs)
__ul_attribute__((nonnull))
__ul_attribute__((warn_unused_result));
+extern int mnt_fs_get_propagation(struct libmnt_fs *fs, unsigned long *flags);
+
extern int mnt_fs_set_options(struct libmnt_fs *fs, const char *optstr);
extern int mnt_fs_append_options(struct libmnt_fs *fs, const char *optstr);
extern int mnt_fs_prepend_options(struct libmnt_fs *fs, const char *optstr);