summaryrefslogtreecommitdiff
path: root/shlibs
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2011-01-22 00:09:34 +0100
committerKarel Zak <kzak@redhat.com>2011-01-22 00:27:26 +0100
commit68164f6c308af1f53567b627876cd1bc8afe8817 (patch)
tree619ba5ff92b2f6a23ce899b9f771279179a7c7ba /shlibs
parent8c0797e702773730ca3c1cc93039d4f7ef89dd39 (diff)
downloadutil-linux-old-68164f6c308af1f53567b627876cd1bc8afe8817.tar.gz
libmount: cleanup API, remove typedef
- replace mnt_ with libmnt_ prefix for types (the old prefix was too generic) - remove typedef, use struct everywhere - use shorter functions names (s/userspace/user/; s/mountflags/mflags/) Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs')
-rw-r--r--shlibs/mount/docs/libmount-sections.txt78
-rw-r--r--shlibs/mount/samples/mount.c18
-rw-r--r--shlibs/mount/src/cache.c53
-rw-r--r--shlibs/mount/src/context.c237
-rw-r--r--shlibs/mount/src/context_mount.c30
-rw-r--r--shlibs/mount/src/context_umount.c42
-rw-r--r--shlibs/mount/src/fs.c174
-rw-r--r--shlibs/mount/src/iter.c12
-rw-r--r--shlibs/mount/src/libmount.h.in424
-rw-r--r--shlibs/mount/src/lock.c32
-rw-r--r--shlibs/mount/src/mount.sym70
-rw-r--r--shlibs/mount/src/mountP.h70
-rw-r--r--shlibs/mount/src/optmap.c18
-rw-r--r--shlibs/mount/src/optstr.c63
-rw-r--r--shlibs/mount/src/tab.c273
-rw-r--r--shlibs/mount/src/tab_parse.c134
-rw-r--r--shlibs/mount/src/tab_update.c146
-rw-r--r--shlibs/mount/src/test.c4
-rw-r--r--shlibs/mount/src/utils.c16
-rw-r--r--shlibs/mount/src/version.c4
20 files changed, 963 insertions, 935 deletions
diff --git a/shlibs/mount/docs/libmount-sections.txt b/shlibs/mount/docs/libmount-sections.txt
index a7ff4c7b..956fe8a5 100644
--- a/shlibs/mount/docs/libmount-sections.txt
+++ b/shlibs/mount/docs/libmount-sections.txt
@@ -24,7 +24,6 @@ mnt_unmangle
<SECTION>
<FILE>cache</FILE>
-mnt_cache
mnt_cache_device_has_tag
mnt_cache_find_tag_value
mnt_cache_read_tags
@@ -52,7 +51,6 @@ mnt_split_optstr
<SECTION>
<FILE>iter</FILE>
-mnt_iter
mnt_free_iter
mnt_iter_get_direction
mnt_new_iter
@@ -61,13 +59,11 @@ mnt_reset_iter
<SECTION>
<FILE>optmap</FILE>
-struct mnt_optmap
mnt_get_builtin_optmap
</SECTION>
<SECTION>
<FILE>lock</FILE>
-mnt_lock
mnt_free_lock
mnt_lock_file
mnt_new_lock
@@ -76,14 +72,13 @@ mnt_unlock_file
<SECTION>
<FILE>fs</FILE>
-mnt_fs
mnt_copy_fs
mnt_free_fs
mnt_free_mntent
mnt_fs_append_attributes
mnt_fs_append_fs_options
mnt_fs_append_options
-mnt_fs_append_userspace_options
+mnt_fs_append_user_options
mnt_fs_append_vfs_options
mnt_fs_get_attribute
mnt_fs_get_attributes
@@ -102,7 +97,7 @@ mnt_fs_get_srcpath
mnt_fs_get_tag
mnt_fs_get_target
mnt_fs_get_userdata
-mnt_fs_get_userspace_options
+mnt_fs_get_user_options
mnt_fs_get_vfs_options
mnt_fs_match_fstype
mnt_fs_match_options
@@ -111,7 +106,7 @@ mnt_fs_match_target
mnt_fs_prepend_attributes
mnt_fs_prepend_fs_options
mnt_fs_prepend_options
-mnt_fs_prepend_userspace_options
+mnt_fs_prepend_user_options
mnt_fs_prepend_vfs_options
mnt_fs_print_debug
mnt_fs_set_attributes
@@ -125,7 +120,7 @@ mnt_fs_set_root
mnt_fs_set_source
mnt_fs_set_target
mnt_fs_set_userdata
-mnt_fs_set_userspace_options
+mnt_fs_set_user_options
mnt_fs_set_vfs_options
mnt_fs_strdup_options
mnt_new_fs
@@ -134,51 +129,48 @@ mnt_fs_to_mntent
<SECTION>
<FILE>tab</FILE>
-mnt_tab
-mnt_free_tab
-mnt_new_tab
-mnt_new_tab_from_dir
-mnt_new_tab_from_file
-mnt_tab_add_fs
-mnt_tab_find_next_fs
-mnt_tab_find_pair
-mnt_tab_find_source
-mnt_tab_find_srcpath
-mnt_tab_find_tag
-mnt_tab_find_target
-mnt_tab_get_cache
-mnt_tab_get_name
-mnt_tab_get_nents
-mnt_tab_get_root_fs
-mnt_tab_next_child_fs
-mnt_tab_next_fs
-mnt_tab_parse_file
-mnt_tab_parse_fstab
-mnt_tab_parse_mtab
-mnt_tab_parse_stream
-mnt_tab_remove_fs
-mnt_tab_set_cache
-mnt_tab_set_iter
-mnt_tab_set_parser_errcb
+mnt_free_table
+mnt_new_table
+mnt_new_table_from_dir
+mnt_new_table_from_file
+mnt_table_add_fs
+mnt_table_find_next_fs
+mnt_table_find_pair
+mnt_table_find_source
+mnt_table_find_srcpath
+mnt_table_find_tag
+mnt_table_find_target
+mnt_table_get_cache
+mnt_table_get_name
+mnt_table_get_nents
+mnt_table_get_root_fs
+mnt_table_next_child_fs
+mnt_table_next_fs
+mnt_table_parse_file
+mnt_table_parse_fstab
+mnt_table_parse_mtab
+mnt_table_parse_stream
+mnt_table_remove_fs
+mnt_table_set_cache
+mnt_table_set_iter
+mnt_table_set_parser_errcb
</SECTION>
<SECTION>
<FILE>update</FILE>
-mnt_update
mnt_free_update
mnt_new_update
mnt_update_force_rdonly
mnt_update_get_filename
mnt_update_get_fs
-mnt_update_get_mountflags
+mnt_update_get_mflags
mnt_update_is_ready
mnt_update_set_fs
-mnt_update_tab
+mnt_update_table
</SECTION>
<SECTION>
<FILE>context</FILE>
-mnt_context
mnt_context_append_options
mnt_context_apply_fstab
mnt_context_disable_canonicalize
@@ -197,10 +189,10 @@ mnt_context_get_cache
mnt_context_get_fs
mnt_context_get_fstab
mnt_context_get_lock
-mnt_context_get_mountflags
+mnt_context_get_mflags
mnt_context_get_mtab
mnt_context_get_status
-mnt_context_get_userspace_mountflags
+mnt_context_get_user_mflags
mnt_context_is_restricted
mnt_context_set_cache
mnt_context_set_fs
@@ -208,13 +200,13 @@ mnt_context_set_fstab
mnt_context_set_fstype
mnt_context_set_fstype_pattern
mnt_context_set_mountdata
-mnt_context_set_mountflags
+mnt_context_set_mflags
mnt_context_set_options
mnt_context_set_options_pattern
mnt_context_set_optsmode
mnt_context_set_source
mnt_context_set_target
-mnt_context_set_userspace_mountflags
+mnt_context_set_user_mflags
mnt_context_strerror
mnt_free_context
mnt_new_context
diff --git a/shlibs/mount/samples/mount.c b/shlibs/mount/samples/mount.c
index aa713001..5e87d88d 100644
--- a/shlibs/mount/samples/mount.c
+++ b/shlibs/mount/samples/mount.c
@@ -50,7 +50,7 @@
#define EX_FAIL 32 /* mount failure */
#define EX_SOMEOK 64 /* some mount succeeded */
-static mnt_lock *lock;
+static struct libmnt_lock *lock;
static void lock_atexit_cleanup(void)
{
@@ -98,13 +98,13 @@ static const char *opt_to_longopt(int c, const struct option *opts)
return NULL;
}
-static int print_all(mnt_context *cxt, char *pattern, int show_label)
+static int print_all(struct libmnt_context *cxt, char *pattern, int show_label)
{
int rc = 0;
- mnt_tab *tb;
- mnt_iter *itr;
- mnt_fs *fs;
- mnt_cache *cache = NULL;
+ struct libmnt_table *tb;
+ struct libmnt_iter *itr;
+ struct libmnt_fs *fs;
+ struct libmnt_cache *cache = NULL;
rc = mnt_context_get_mtab(cxt, &tb);
if (rc)
@@ -117,7 +117,7 @@ static int print_all(mnt_context *cxt, char *pattern, int show_label)
if (show_label)
cache = mnt_new_cache();
- while(mnt_tab_next_fs(tb, itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, itr, &fs) == 0) {
const char *type = mnt_fs_get_fstype(fs);
const char *src = mnt_fs_get_source(fs);
char *optstr = mnt_fs_strdup_options(fs);
@@ -203,7 +203,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
int main(int argc, char **argv)
{
int c, rc = EXIT_FAILURE, all = 0, show_labels = 0;
- mnt_context *cxt;
+ struct libmnt_context *cxt;
char *source = NULL, *srcbuf = NULL;
char *types = NULL;
unsigned long oper = 0;
@@ -403,7 +403,7 @@ int main(int argc, char **argv)
usage(stderr);
if (oper)
- mnt_context_set_mountflags(cxt, oper);
+ mnt_context_set_mflags(cxt, oper);
lock = mnt_context_get_lock(cxt);
if (lock)
diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c
index 9e20a2ae..e0641c17 100644
--- a/shlibs/mount/src/cache.c
+++ b/shlibs/mount/src/cache.c
@@ -44,7 +44,7 @@ struct mnt_cache_entry {
int flag;
};
-struct _mnt_cache {
+struct libmnt_cache {
struct mnt_cache_entry *ents;
size_t nents;
size_t nallocs;
@@ -67,11 +67,11 @@ struct _mnt_cache {
/**
* mnt_new_cache:
*
- * Returns: new mnt_cache instance or NULL in case of ENOMEM error.
+ * Returns: new struct libmnt_cache instance or NULL in case of ENOMEM error.
*/
-mnt_cache *mnt_new_cache(void)
+struct libmnt_cache *mnt_new_cache(void)
{
- mnt_cache *cache = calloc(1, sizeof(struct _mnt_cache));
+ struct libmnt_cache *cache = calloc(1, sizeof(*cache));
if (!cache)
return NULL;
DBG(CACHE, mnt_debug_h(cache, "alloc"));
@@ -80,11 +80,11 @@ mnt_cache *mnt_new_cache(void)
/**
* mnt_free_cache:
- * @cache: pointer to mnt_cache instance
+ * @cache: pointer to struct libmnt_cache instance
*
* Deallocates the cache.
*/
-void mnt_free_cache(mnt_cache *cache)
+void mnt_free_cache(struct libmnt_cache *cache)
{
int i;
@@ -108,7 +108,7 @@ void mnt_free_cache(mnt_cache *cache)
}
/* note that the @native could be tha same pointer as @real */
-static int mnt_cache_add_entry(mnt_cache *cache, char *native,
+static int mnt_cache_add_entry(struct libmnt_cache *cache, char *native,
char *real, int flag)
{
struct mnt_cache_entry *e;
@@ -141,7 +141,7 @@ static int mnt_cache_add_entry(mnt_cache *cache, char *native,
}
/* add tag to the cache, @real has to be allocated string */
-static int mnt_cache_add_tag(mnt_cache *cache, const char *token,
+static int mnt_cache_add_tag(struct libmnt_cache *cache, const char *token,
const char *value, char *real, int flag)
{
size_t tksz, vlsz;
@@ -179,7 +179,7 @@ static int mnt_cache_add_tag(mnt_cache *cache, const char *token,
/*
* Returns cached canonicalized path or NULL.
*/
-static const char *mnt_cache_find_path(mnt_cache *cache, const char *path)
+static const char *mnt_cache_find_path(struct libmnt_cache *cache, const char *path)
{
int i;
@@ -202,7 +202,7 @@ static const char *mnt_cache_find_path(mnt_cache *cache, const char *path)
/*
* Returns cached path or NULL.
*/
-static const char *mnt_cache_find_tag(mnt_cache *cache,
+static const char *mnt_cache_find_tag(struct libmnt_cache *cache,
const char *token, const char *value)
{
int i;
@@ -231,7 +231,7 @@ static const char *mnt_cache_find_tag(mnt_cache *cache,
/*
* returns (in @res) blkid prober, the @cache argument is optional
*/
-static int mnt_cache_get_probe(mnt_cache *cache, const char *devname,
+static int mnt_cache_get_probe(struct libmnt_cache *cache, const char *devname,
blkid_probe *res)
{
blkid_probe pr = cache ? cache->pr : NULL;
@@ -266,7 +266,7 @@ static int mnt_cache_get_probe(mnt_cache *cache, const char *devname,
/**
* mnt_cache_read_tags
- * @cache: pointer to mnt_cache instance
+ * @cache: pointer to struct libmnt_cache instance
* @devname: path device
*
* Reads @devname LABEL and UUID to the @cache.
@@ -274,7 +274,7 @@ static int mnt_cache_get_probe(mnt_cache *cache, const char *devname,
* Returns: 0 if at least one tag was added, 1 if no tag was added or
* negative number in case of error.
*/
-int mnt_cache_read_tags(mnt_cache *cache, const char *devname)
+int mnt_cache_read_tags(struct libmnt_cache *cache, const char *devname)
{
int i, ntags = 0, rc;
blkid_probe pr;
@@ -349,7 +349,7 @@ error:
*
* Returns: 1 on success or 0.
*/
-int mnt_cache_device_has_tag(mnt_cache *cache, const char *devname,
+int mnt_cache_device_has_tag(struct libmnt_cache *cache, const char *devname,
const char *token, const char *value)
{
const char *path = mnt_cache_find_tag(cache, token, value);
@@ -367,7 +367,7 @@ int mnt_cache_device_has_tag(mnt_cache *cache, const char *devname,
*
* Returns: LABEL or UUID for the @devname or NULL in case of error.
*/
-char *mnt_cache_find_tag_value(mnt_cache *cache,
+char *mnt_cache_find_tag_value(struct libmnt_cache *cache,
const char *devname, const char *token)
{
int i;
@@ -399,7 +399,7 @@ char *mnt_cache_find_tag_value(mnt_cache *cache,
* Returns: filesystem type or NULL in case of error. The result has to be
* deallocated by free() if @cache is NULL.
*/
-char *mnt_get_fstype(const char *devname, int *ambi, mnt_cache *cache)
+char *mnt_get_fstype(const char *devname, int *ambi, struct libmnt_cache *cache)
{
blkid_probe pr;
const char *data;
@@ -438,7 +438,7 @@ char *mnt_get_fstype(const char *devname, int *ambi, mnt_cache *cache)
* Returns: absolute path or NULL in case of error. The result has to be
* deallocated by free() if @cache is NULL.
*/
-char *mnt_resolve_path(const char *path, mnt_cache *cache)
+char *mnt_resolve_path(const char *path, struct libmnt_cache *cache)
{
char *p = NULL;
char *native = NULL;
@@ -486,7 +486,8 @@ error:
* Returns: device name or NULL in case of error. The result has to be
* deallocated by free() if @cache is NULL.
*/
-char *mnt_resolve_tag(const char *token, const char *value, mnt_cache *cache)
+char *mnt_resolve_tag(const char *token, const char *value,
+ struct libmnt_cache *cache)
{
char *p = NULL;
@@ -527,7 +528,7 @@ error:
* Returns: canonicalized path or NULL. The result has to be
* deallocated by free() if @cache is NULL.
*/
-char *mnt_resolve_spec(const char *spec, mnt_cache *cache)
+char *mnt_resolve_spec(const char *spec, struct libmnt_cache *cache)
{
char *cn = NULL;
@@ -552,10 +553,10 @@ char *mnt_resolve_spec(const char *spec, mnt_cache *cache)
#ifdef TEST_PROGRAM
-int test_resolve_path(struct mtest *ts, int argc, char *argv[])
+int test_resolve_path(struct libmnt_test *ts, int argc, char *argv[])
{
char line[BUFSIZ];
- mnt_cache *cache;
+ struct libmnt_cache *cache;
cache = mnt_new_cache();
if (!cache)
@@ -575,10 +576,10 @@ int test_resolve_path(struct mtest *ts, int argc, char *argv[])
return 0;
}
-int test_resolve_spec(struct mtest *ts, int argc, char *argv[])
+int test_resolve_spec(struct libmnt_test *ts, int argc, char *argv[])
{
char line[BUFSIZ];
- mnt_cache *cache;
+ struct libmnt_cache *cache;
cache = mnt_new_cache();
if (!cache)
@@ -598,10 +599,10 @@ int test_resolve_spec(struct mtest *ts, int argc, char *argv[])
return 0;
}
-int test_read_tags(struct mtest *ts, int argc, char *argv[])
+int test_read_tags(struct libmnt_test *ts, int argc, char *argv[])
{
char line[BUFSIZ];
- mnt_cache *cache;
+ struct libmnt_cache *cache;
int i;
cache = mnt_new_cache();
@@ -654,7 +655,7 @@ int test_read_tags(struct mtest *ts, int argc, char *argv[])
int main(int argc, char *argv[])
{
- struct mtest ts[] = {
+ struct libmnt_test ts[] = {
{ "--resolve-path", test_resolve_path, " resolve paths from stdin" },
{ "--resolve-spec", test_resolve_spec, " evaluate specs from stdin" },
{ "--read-tags", test_read_tags, " read devname or TAG from stdin (\"quit\" to exit)" },
diff --git a/shlibs/mount/src/context.c b/shlibs/mount/src/context.c
index b01d4bd0..d82532e3 100644
--- a/shlibs/mount/src/context.c
+++ b/shlibs/mount/src/context.c
@@ -12,10 +12,10 @@
*
* <informalexample>
* <programlisting>
- * mnt_context *cxt = mnt_new_context();
+ * struct libmnt_context *cxt = mnt_new_context();
*
* mnt_context_set_options(cxt, "aaa,bbb,ccc=CCC");
- * mnt_context_set_mountflags(cxt, MS_NOATIME|MS_NOEXEC);
+ * mnt_context_set_mflags(cxt, MS_NOATIME|MS_NOEXEC);
* mnt_context_set_target(cxt, "/mnt/foo");
*
* if (!mnt_context_do_mount(cxt))
@@ -47,9 +47,9 @@
*
* Returns: newly allocated mount context
*/
-mnt_context *mnt_new_context(void)
+struct libmnt_context *mnt_new_context(void)
{
- mnt_context *cxt;
+ struct libmnt_context *cxt;
uid_t ruid, euid;
cxt = calloc(1, sizeof(*cxt));
@@ -83,7 +83,7 @@ mnt_context *mnt_new_context(void)
*
* Deallocates context struct.
*/
-void mnt_free_context(mnt_context *cxt)
+void mnt_free_context(struct libmnt_context *cxt)
{
if (!cxt)
return;
@@ -96,7 +96,7 @@ void mnt_free_context(mnt_context *cxt)
free(cxt->optstr_pattern);
if (!(cxt->flags & MNT_FL_EXTERN_FSTAB))
- mnt_free_tab(cxt->fstab);
+ mnt_free_table(cxt->fstab);
if (!(cxt->flags & MNT_FL_EXTERN_CACHE))
mnt_free_cache(cxt->cache);
@@ -126,7 +126,7 @@ void mnt_free_context(mnt_context *cxt)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_reset_context(mnt_context *cxt)
+int mnt_reset_context(struct libmnt_context *cxt)
{
int fl;
@@ -138,7 +138,7 @@ int mnt_reset_context(mnt_context *cxt)
if (!(cxt->flags & MNT_FL_EXTERN_FS))
mnt_free_fs(cxt->fs);
- mnt_free_tab(cxt->mtab);
+ mnt_free_table(cxt->mtab);
free(cxt->helper);
free(cxt->orig_user);
@@ -163,7 +163,7 @@ int mnt_reset_context(mnt_context *cxt)
return 0;
}
-static int set_flag(mnt_context *cxt, int flag, int enable)
+static int set_flag(struct libmnt_context *cxt, int flag, int enable)
{
if (!cxt)
return -EINVAL;
@@ -180,7 +180,7 @@ static int set_flag(mnt_context *cxt, int flag, int enable)
*
* Returns: 0 for unrestricted mount (user is root), or 1 for non-root mounts
*/
-int mnt_context_is_restricted(mnt_context *cxt)
+int mnt_context_is_restricted(struct libmnt_context *cxt)
{
assert(cxt);
return cxt->restricted;
@@ -195,7 +195,7 @@ int mnt_context_is_restricted(mnt_context *cxt)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_optsmode(mnt_context *cxt, int mode)
+int mnt_context_set_optsmode(struct libmnt_context *cxt, int mode)
{
if (!cxt)
return -EINVAL;
@@ -210,7 +210,7 @@ int mnt_context_set_optsmode(mnt_context *cxt, int mode)
* Returns: MNT_OMASK_* mask or zero.
*/
-int mnt_context_get_optsmode(mnt_context *cxt)
+int mnt_context_get_optsmode(struct libmnt_context *cxt)
{
return cxt ? cxt->optsmode : 0;
}
@@ -226,11 +226,11 @@ int mnt_context_get_optsmode(mnt_context *cxt)
*
* This fuction has effect to the private fstab instance only (see
* mnt_context_set_fstab()). If you want to use an external fstab then you need
- * manage your private mnt_cache (see mnt_tab_set_cache(fstab, NULL).
+ * manage your private struct libmnt_cache (see mnt_table_set_cache(fstab, NULL).
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_disable_canonicalize(mnt_context *cxt, int disable)
+int mnt_context_disable_canonicalize(struct libmnt_context *cxt, int disable)
{
return set_flag(cxt, MNT_FL_NOCANONICALIZE, disable);
}
@@ -244,7 +244,7 @@ int mnt_context_disable_canonicalize(mnt_context *cxt, int disable)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_enable_lazy(mnt_context *cxt, int enable)
+int mnt_context_enable_lazy(struct libmnt_context *cxt, int enable)
{
return set_flag(cxt, MNT_FL_LAZY, enable);
}
@@ -255,7 +255,7 @@ int mnt_context_enable_lazy(mnt_context *cxt, int enable)
*
* Returns: 1 if lazy umount is enabled or 0
*/
-int mnt_context_is_lazy(mnt_context *cxt)
+int mnt_context_is_lazy(struct libmnt_context *cxt)
{
return cxt && (cxt->flags & MNT_FL_LAZY) ? 1 : 0;
}
@@ -271,7 +271,7 @@ int mnt_context_is_lazy(mnt_context *cxt)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_enable_rdonly_umount(mnt_context *cxt, int enable)
+int mnt_context_enable_rdonly_umount(struct libmnt_context *cxt, int enable)
{
return set_flag(cxt, MNT_FL_RDONLY_UMOUNT, enable);
}
@@ -285,7 +285,7 @@ int mnt_context_enable_rdonly_umount(mnt_context *cxt, int enable)
*
* Returns: 1 if read-only remount failed umount(2) is enables or 0
*/
-int mnt_context_is_rdonly_umount(mnt_context *cxt)
+int mnt_context_is_rdonly_umount(struct libmnt_context *cxt)
{
return cxt && (cxt->flags & MNT_FL_RDONLY_UMOUNT) ? 1 : 0;
}
@@ -299,7 +299,7 @@ int mnt_context_is_rdonly_umount(mnt_context *cxt)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_disable_helpers(mnt_context *cxt, int disable)
+int mnt_context_disable_helpers(struct libmnt_context *cxt, int disable)
{
return set_flag(cxt, MNT_FL_NOHELPERS, disable);
}
@@ -313,7 +313,7 @@ int mnt_context_disable_helpers(mnt_context *cxt, int disable)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_enable_sloppy(mnt_context *cxt, int enable)
+int mnt_context_enable_sloppy(struct libmnt_context *cxt, int enable)
{
return set_flag(cxt, MNT_FL_SLOPPY, enable);
}
@@ -324,7 +324,7 @@ int mnt_context_enable_sloppy(mnt_context *cxt, int enable)
*
* Returns: 1 if sloppy flag is enabled or 0
*/
-int mnt_context_is_sloppy(mnt_context *cxt)
+int mnt_context_is_sloppy(struct libmnt_context *cxt)
{
return cxt && (cxt->flags & MNT_FL_SLOPPY) ? 1 : 0;
}
@@ -338,7 +338,7 @@ int mnt_context_is_sloppy(mnt_context *cxt)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_enable_fake(mnt_context *cxt, int enable)
+int mnt_context_enable_fake(struct libmnt_context *cxt, int enable)
{
return set_flag(cxt, MNT_FL_FAKE, enable);
}
@@ -349,7 +349,7 @@ int mnt_context_enable_fake(mnt_context *cxt, int enable)
*
* Returns: 1 if fake flag is enabled or 0
*/
-int mnt_context_is_fake(mnt_context *cxt)
+int mnt_context_is_fake(struct libmnt_context *cxt)
{
return cxt && (cxt->flags & MNT_FL_FAKE) ? 1 : 0;
}
@@ -363,7 +363,7 @@ int mnt_context_is_fake(mnt_context *cxt)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_disable_mtab(mnt_context *cxt, int disable)
+int mnt_context_disable_mtab(struct libmnt_context *cxt, int disable)
{
return set_flag(cxt, MNT_FL_NOMTAB, disable);
}
@@ -374,7 +374,7 @@ int mnt_context_disable_mtab(mnt_context *cxt, int disable)
*
* Returns: 1 if no-mtab is enabled or 0
*/
-int mnt_context_is_nomtab(mnt_context *cxt)
+int mnt_context_is_nomtab(struct libmnt_context *cxt)
{
return cxt && (cxt->flags & MNT_FL_NOMTAB) ? 1 : 0;
}
@@ -388,7 +388,7 @@ int mnt_context_is_nomtab(mnt_context *cxt)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_enable_force(mnt_context *cxt, int enable)
+int mnt_context_enable_force(struct libmnt_context *cxt, int enable)
{
return set_flag(cxt, MNT_FL_FORCE, enable);
}
@@ -399,7 +399,7 @@ int mnt_context_enable_force(mnt_context *cxt, int enable)
*
* Returns: 1 if force umounting flag is enabled or 0
*/
-int mnt_context_is_force(mnt_context *cxt)
+int mnt_context_is_force(struct libmnt_context *cxt)
{
return cxt && (cxt->flags & MNT_FL_FORCE) ? 1 : 0;
}
@@ -413,7 +413,7 @@ int mnt_context_is_force(mnt_context *cxt)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_enable_verbose(mnt_context *cxt, int enable)
+int mnt_context_enable_verbose(struct libmnt_context *cxt, int enable)
{
return set_flag(cxt, MNT_FL_VERBOSE, enable);
}
@@ -424,7 +424,7 @@ int mnt_context_enable_verbose(mnt_context *cxt, int enable)
*
* Returns: 1 if verbose flag is enabled or 0
*/
-int mnt_context_is_verbose(mnt_context *cxt)
+int mnt_context_is_verbose(struct libmnt_context *cxt)
{
return cxt && (cxt->flags & MNT_FL_VERBOSE) ? 1 : 0;
}
@@ -438,7 +438,7 @@ int mnt_context_is_verbose(mnt_context *cxt)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_enable_loopdel(mnt_context *cxt, int enable)
+int mnt_context_enable_loopdel(struct libmnt_context *cxt, int enable)
{
return set_flag(cxt, MNT_FL_LOOPDEL, enable);
}
@@ -458,7 +458,7 @@ int mnt_context_enable_loopdel(mnt_context *cxt, int enable)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_fs(mnt_context *cxt, mnt_fs *fs)
+int mnt_context_set_fs(struct libmnt_context *cxt, struct libmnt_fs *fs)
{
if (!cxt)
return -EINVAL;
@@ -480,7 +480,7 @@ int mnt_context_set_fs(mnt_context *cxt, mnt_fs *fs)
*
* Returns: pointer to FS description or NULL in case of calloc() errrr.
*/
-mnt_fs *mnt_context_get_fs(mnt_context *cxt)
+struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt)
{
if (!cxt)
return NULL;
@@ -498,7 +498,7 @@ mnt_fs *mnt_context_get_fs(mnt_context *cxt)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_source(mnt_context *cxt, const char *source)
+int mnt_context_set_source(struct libmnt_context *cxt, const char *source)
{
return mnt_fs_set_source(mnt_context_get_fs(cxt), source);
}
@@ -510,7 +510,7 @@ int mnt_context_set_source(mnt_context *cxt, const char *source)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_target(mnt_context *cxt, const char *target)
+int mnt_context_set_target(struct libmnt_context *cxt, const char *target)
{
return mnt_fs_set_target(mnt_context_get_fs(cxt), target);
}
@@ -525,7 +525,7 @@ int mnt_context_set_target(mnt_context *cxt, const char *target)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_fstype(mnt_context *cxt, const char *fstype)
+int mnt_context_set_fstype(struct libmnt_context *cxt, const char *fstype)
{
if (fstype && strchr(fstype, ','))
return -EINVAL;
@@ -539,7 +539,7 @@ int mnt_context_set_fstype(mnt_context *cxt, const char *fstype)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_options(mnt_context *cxt, const char *optstr)
+int mnt_context_set_options(struct libmnt_context *cxt, const char *optstr)
{
return mnt_fs_set_options(mnt_context_get_fs(cxt), optstr);
}
@@ -551,7 +551,7 @@ int mnt_context_set_options(mnt_context *cxt, const char *optstr)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_append_options(mnt_context *cxt, const char *optstr)
+int mnt_context_append_options(struct libmnt_context *cxt, const char *optstr)
{
return mnt_fs_append_options(mnt_context_get_fs(cxt), optstr);
}
@@ -565,7 +565,7 @@ int mnt_context_append_options(mnt_context *cxt, const char *optstr)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_fstype_pattern(mnt_context *cxt, const char *pattern)
+int mnt_context_set_fstype_pattern(struct libmnt_context *cxt, const char *pattern)
{
char *p = NULL;
@@ -590,7 +590,7 @@ int mnt_context_set_fstype_pattern(mnt_context *cxt, const char *pattern)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_options_pattern(mnt_context *cxt, const char *pattern)
+int mnt_context_set_options_pattern(struct libmnt_context *cxt, const char *pattern)
{
char *p = NULL;
@@ -611,7 +611,7 @@ int mnt_context_set_options_pattern(mnt_context *cxt, const char *pattern)
* @cxt: mount context
* @tb: fstab
*
- * The mount context reads /etc/fstab to the the private mnt_tab by default.
+ * The mount context reads /etc/fstab to the the private struct libmnt_table by default.
* This function allows to overwrite the private fstab with an external
* instance. Note that the external instance is not deallocated by mnt_free_context().
*
@@ -623,12 +623,12 @@ int mnt_context_set_options_pattern(mnt_context *cxt, const char *pattern)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_fstab(mnt_context *cxt, mnt_tab *tb)
+int mnt_context_set_fstab(struct libmnt_context *cxt, struct libmnt_table *tb)
{
if (!cxt)
return -EINVAL;
if (!(cxt->flags & MNT_FL_EXTERN_FSTAB))
- mnt_free_tab(cxt->fstab);
+ mnt_free_table(cxt->fstab);
set_flag(cxt, MNT_FL_EXTERN_FSTAB, tb != NULL);
cxt->fstab = tb;
@@ -640,13 +640,13 @@ int mnt_context_set_fstab(mnt_context *cxt, mnt_tab *tb)
* @cxt: mount context
* @tb: returns fstab
*
- * See also mnt_tab_parse_fstab() for more details about fstab.
+ * See also mnt_table_parse_fstab() for more details about fstab.
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_get_fstab(mnt_context *cxt, mnt_tab **tb)
+int mnt_context_get_fstab(struct libmnt_context *cxt, struct libmnt_table **tb)
{
- mnt_cache *cache;
+ struct libmnt_cache *cache;
if (!cxt)
return -EINVAL;
@@ -654,11 +654,11 @@ int mnt_context_get_fstab(mnt_context *cxt, mnt_tab **tb)
if (!cxt->fstab) {
int rc;
- cxt->fstab = mnt_new_tab();
+ cxt->fstab = mnt_new_table();
if (!cxt->fstab)
return -ENOMEM;
cxt->flags &= ~MNT_FL_EXTERN_FSTAB;
- rc = mnt_tab_parse_fstab(cxt->fstab, NULL);
+ rc = mnt_table_parse_fstab(cxt->fstab, NULL);
if (rc)
return rc;
}
@@ -667,7 +667,7 @@ int mnt_context_get_fstab(mnt_context *cxt, mnt_tab **tb)
/* never touch an external fstab */
if (!(cxt->flags & MNT_FL_EXTERN_FSTAB))
- mnt_tab_set_cache(cxt->fstab, cache);
+ mnt_table_set_cache(cxt->fstab, cache);
if (tb)
*tb = cxt->fstab;
@@ -679,13 +679,13 @@ int mnt_context_get_fstab(mnt_context *cxt, mnt_tab **tb)
* @cxt: mount context
* @tb: returns mtab
*
- * See also mnt_tab_parse_mtab() for more details about mtab/mountinfo.
+ * See also mnt_table_parse_mtab() for more details about mtab/mountinfo.
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_get_mtab(mnt_context *cxt, mnt_tab **tb)
+int mnt_context_get_mtab(struct libmnt_context *cxt, struct libmnt_table **tb)
{
- mnt_cache *cache;
+ struct libmnt_cache *cache;
if (!cxt)
return -EINVAL;
@@ -693,16 +693,16 @@ int mnt_context_get_mtab(mnt_context *cxt, mnt_tab **tb)
if (!cxt->mtab) {
int rc;
- cxt->mtab = mnt_new_tab();
+ cxt->mtab = mnt_new_table();
if (!cxt->mtab)
return -ENOMEM;
- rc = mnt_tab_parse_mtab(cxt->mtab, cxt->mtab_path);
+ rc = mnt_table_parse_mtab(cxt->mtab, cxt->mtab_path);
if (rc)
return rc;
}
cache = mnt_context_get_cache(cxt);
- mnt_tab_set_cache(cxt->mtab, cache);
+ mnt_table_set_cache(cxt->mtab, cache);
if (tb)
*tb = cxt->mtab;
@@ -714,7 +714,7 @@ int mnt_context_get_mtab(mnt_context *cxt, mnt_tab **tb)
* @cxt: mount context
* @cache: cache instance or nULL
*
- * The mount context maintains a private mnt_cache by default. This function
+ * The mount context maintains a private struct libmnt_cache by default. This function
* allows to overwrite the private cache with an external instance. Note that
* the external instance is not deallocated by mnt_free_context().
*
@@ -723,7 +723,7 @@ int mnt_context_get_mtab(mnt_context *cxt, mnt_tab **tb)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_cache(mnt_context *cxt, mnt_cache *cache)
+int mnt_context_set_cache(struct libmnt_context *cxt, struct libmnt_cache *cache)
{
if (!cxt)
return -EINVAL;
@@ -743,7 +743,7 @@ int mnt_context_set_cache(mnt_context *cxt, mnt_cache *cache)
*
* Returns: pointer to cache or NULL if canonicalization is disabled.
*/
-mnt_cache *mnt_context_get_cache(mnt_context *cxt)
+struct libmnt_cache *mnt_context_get_cache(struct libmnt_context *cxt)
{
if (!cxt || (cxt->flags & MNT_FL_NOCANONICALIZE))
return NULL;
@@ -771,7 +771,7 @@ mnt_cache *mnt_context_get_cache(mnt_context *cxt)
*
* Returns: pointer to lock struct or NULL.
*/
-mnt_lock *mnt_context_get_lock(mnt_context *cxt)
+struct libmnt_lock *mnt_context_get_lock(struct libmnt_context *cxt)
{
if (!cxt || (cxt->flags & MNT_FL_NOMTAB) || !cxt->mtab_writable)
return NULL;
@@ -783,14 +783,16 @@ mnt_lock *mnt_context_get_lock(mnt_context *cxt)
}
/**
- * mnt_context_set_mountflags:
+ * mnt_context_set_mflags:
* @cxt: mount context
* @flags: mount(2) flags (MS_* flags)
*
+ * Sets mount flags (see mount(2) man page).
+ *
* Note that mount context allows to define mount options by mount flags. It
* means you can for example use
*
- * mnt_context_set_mountflags(cxt, MS_NOEXEC | MS_NOSUID);
+ * mnt_context_set_mflags(cxt, MS_NOEXEC | MS_NOSUID);
*
* rather than
*
@@ -800,7 +802,7 @@ mnt_lock *mnt_context_get_lock(mnt_context *cxt)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_mountflags(mnt_context *cxt, unsigned long flags)
+int mnt_context_set_mflags(struct libmnt_context *cxt, unsigned long flags)
{
if (!cxt)
return -EINVAL;
@@ -809,16 +811,16 @@ int mnt_context_set_mountflags(mnt_context *cxt, unsigned long flags)
}
/**
- * mnt_context_get_mountflags:
+ * mnt_context_get_mflags:
* @cxt: mount context
- * @flags: returns mount flags
+ * @flags: returns MS_* mount flags
*
* Converts mount options string to MS_* flags and bitewise-OR the result with
- * already defined flags (see mnt_context_set_mountflags()).
+ * already defined flags (see mnt_context_set_mflags()).
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_get_mountflags(mnt_context *cxt, unsigned long *flags)
+int mnt_context_get_mflags(struct libmnt_context *cxt, unsigned long *flags)
{
int rc = 0;
if (!cxt || !flags)
@@ -837,15 +839,17 @@ int mnt_context_get_mountflags(mnt_context *cxt, unsigned long *flags)
}
/**
- * mnt_context_set_userspace_mountflags:
+ * mnt_context_set_user_mflags:
* @cxt: mount context
* @flags: mount(2) flags (MNT_MS_* flags, e.g. MNT_MS_LOOP)
*
- * See also notest for mnt_context_set_mountflags().
+ * Sets userspace mount flags.
+ *
+ * See also notest for mnt_context_set_mflags().
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_userspace_mountflags(mnt_context *cxt, unsigned long flags)
+int mnt_context_set_user_mflags(struct libmnt_context *cxt, unsigned long flags)
{
if (!cxt)
return -EINVAL;
@@ -854,16 +858,16 @@ int mnt_context_set_userspace_mountflags(mnt_context *cxt, unsigned long flags)
}
/**
- * mnt_context_get_userspace_mountflags:
+ * mnt_context_get_user_mflags:
* @cxt: mount context
* @flags: returns mount flags
*
* Converts mount options string to MNT_MS_* flags and bitewise-OR the result
- * with already defined flags (see mnt_context_set_userspace_mountflags()).
+ * with already defined flags (see mnt_context_set_user_mflags()).
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_get_userspace_mountflags(mnt_context *cxt, unsigned long *flags)
+int mnt_context_get_user_mflags(struct libmnt_context *cxt, unsigned long *flags)
{
int rc = 0;
if (!cxt || !flags)
@@ -871,7 +875,7 @@ int mnt_context_get_userspace_mountflags(mnt_context *cxt, unsigned long *flags)
*flags = 0;
if (!(cxt->flags & MNT_FL_MOUNTFLAGS_MERGED) && cxt->fs) {
- const char *o = mnt_fs_get_userspace_options(cxt->fs);
+ const char *o = mnt_fs_get_user_options(cxt->fs);
if (o)
rc = mnt_optstr_get_flags(o, flags,
mnt_get_builtin_optmap(MNT_USERSPACE_MAP));
@@ -881,13 +885,13 @@ int mnt_context_get_userspace_mountflags(mnt_context *cxt, unsigned long *flags)
return rc;
}
-static int is_loop(mnt_context *cxt)
+static int is_loop(struct libmnt_context *cxt)
{
unsigned long fl = 0;
if (cxt->user_mountflags & MNT_MS_LOOP)
return 1;
- if (!mnt_context_get_mountflags(cxt, &fl) && (fl & MNT_MS_LOOP))
+ if (!mnt_context_get_mflags(cxt, &fl) && (fl & MNT_MS_LOOP))
return 1;
/* TODO:
@@ -910,7 +914,7 @@ static int is_loop(mnt_context *cxt)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_set_mountdata(mnt_context *cxt, void *data)
+int mnt_context_set_mountdata(struct libmnt_context *cxt, void *data)
{
if (!cxt)
return -EINVAL;
@@ -922,10 +926,10 @@ int mnt_context_set_mountdata(mnt_context *cxt, void *data)
/*
* Translates LABEL/UUID/path to mountable path
*/
-int mnt_context_prepare_srcpath(mnt_context *cxt)
+int mnt_context_prepare_srcpath(struct libmnt_context *cxt)
{
const char *path = NULL;
- mnt_cache *cache;
+ struct libmnt_cache *cache;
const char *t, *v, *src;
int rc = 0;
@@ -993,10 +997,10 @@ int mnt_context_prepare_srcpath(mnt_context *cxt)
return 0;
}
-int mnt_context_prepare_target(mnt_context *cxt)
+int mnt_context_prepare_target(struct libmnt_context *cxt)
{
const char *tgt;
- mnt_cache *cache;
+ struct libmnt_cache *cache;
int rc = 0;
assert(cxt);
@@ -1027,7 +1031,7 @@ int mnt_context_prepare_target(mnt_context *cxt)
return 0;
}
-int mnt_context_guess_fstype(mnt_context *cxt)
+int mnt_context_guess_fstype(struct libmnt_context *cxt)
{
char *type;
const char *dev;
@@ -1061,7 +1065,7 @@ int mnt_context_guess_fstype(mnt_context *cxt)
goto err;
if (access(dev, F_OK) == 0) {
- mnt_cache *cache = mnt_context_get_cache(cxt);
+ struct libmnt_cache *cache = mnt_context_get_cache(cxt);
type = mnt_get_fstype(dev, &cxt->ambi, cache);
if (type) {
@@ -1095,7 +1099,7 @@ err:
* Returns: 0 on success or negative number in case of error. Note that success
* does not mean that there is any usable helper, you have to check cxt->helper.
*/
-int mnt_context_prepare_helper(mnt_context *cxt, const char *name,
+int mnt_context_prepare_helper(struct libmnt_context *cxt, const char *name,
const char *type)
{
char search_path[] = FS_SEARCH_PATH; /* from config.h */
@@ -1148,7 +1152,7 @@ int mnt_context_prepare_helper(mnt_context *cxt, const char *name,
return 0;
}
-int mnt_context_merge_mountflags(mnt_context *cxt)
+int mnt_context_merge_mflags(struct libmnt_context *cxt)
{
unsigned long fl = 0;
int rc;
@@ -1157,7 +1161,7 @@ int mnt_context_merge_mountflags(mnt_context *cxt)
DBG(CXT, mnt_debug_h(cxt, "merging mount flags"));
- rc = mnt_context_get_mountflags(cxt, &fl);
+ rc = mnt_context_get_mflags(cxt, &fl);
if (rc)
return rc;
cxt->mountflags = fl;
@@ -1168,12 +1172,12 @@ int mnt_context_merge_mountflags(mnt_context *cxt)
*/
fl = 0;
- rc = mnt_context_get_userspace_mountflags(cxt, &fl);
+ rc = mnt_context_get_user_mflags(cxt, &fl);
if (rc)
return rc;
cxt->user_mountflags = fl;
- DBG(CXT, mnt_debug_h(cxt, "final flags: VFS=%08lx userspace=%08lx",
+ DBG(CXT, mnt_debug_h(cxt, "final flags: VFS=%08lx user=%08lx",
cxt->mountflags, cxt->user_mountflags));
cxt->flags |= MNT_FL_MOUNTFLAGS_MERGED;
@@ -1183,7 +1187,7 @@ int mnt_context_merge_mountflags(mnt_context *cxt)
/*
* Prepare /etc/mtab or /dev/.mount/utab
*/
-int mnt_context_prepare_update(mnt_context *cxt)
+int mnt_context_prepare_update(struct libmnt_context *cxt)
{
int rc;
const char *target;
@@ -1236,7 +1240,7 @@ int mnt_context_prepare_update(mnt_context *cxt)
return rc < 0 ? rc : 0;
}
-int mnt_context_update_tabs(mnt_context *cxt)
+int mnt_context_update_tabs(struct libmnt_context *cxt)
{
unsigned long fl;
@@ -1259,7 +1263,7 @@ int mnt_context_update_tabs(mnt_context *cxt)
return 0;
}
- fl = mnt_update_get_mountflags(cxt->update);
+ fl = mnt_update_get_mflags(cxt->update);
if ((cxt->mountflags & MS_RDONLY) != (fl & MS_RDONLY))
/*
* fix MS_RDONLY in options
@@ -1267,12 +1271,13 @@ int mnt_context_update_tabs(mnt_context *cxt)
mnt_update_force_rdonly(cxt->update,
cxt->mountflags & MS_RDONLY);
- return mnt_update_tab(cxt->update, mnt_context_get_lock(cxt));
+ return mnt_update_table(cxt->update, mnt_context_get_lock(cxt));
}
-static int apply_tab(mnt_context *cxt, mnt_tab *tb, int direction)
+static int apply_table(struct libmnt_context *cxt, struct libmnt_table *tb,
+ int direction)
{
- mnt_fs *fs = NULL;
+ struct libmnt_fs *fs = NULL;
const char *src = NULL, *tgt = NULL;
int rc;
@@ -1286,12 +1291,12 @@ static int apply_tab(mnt_context *cxt, mnt_tab *tb, int direction)
tgt = mnt_fs_get_target(cxt->fs);
if (tgt && src)
- fs = mnt_tab_find_pair(tb, src, tgt, direction);
+ fs = mnt_table_find_pair(tb, src, tgt, direction);
else {
if (src)
- fs = mnt_tab_find_source(tb, src, direction);
+ fs = mnt_table_find_source(tb, src, direction);
else if (tgt)
- fs = mnt_tab_find_target(tb, tgt, direction);
+ fs = mnt_table_find_target(tb, tgt, direction);
if (!fs) {
/* swap source and target (if @src is not LABEL/UUID),
@@ -1303,9 +1308,9 @@ static int apply_tab(mnt_context *cxt, mnt_tab *tb, int direction)
* example bind mount, symlink to device, ...).
*/
if (src && !mnt_fs_get_tag(cxt->fs, NULL, NULL))
- fs = mnt_tab_find_target(tb, src, direction);
+ fs = mnt_table_find_target(tb, src, direction);
if (!fs && tgt)
- fs = mnt_tab_find_source(tb, tgt, direction);
+ fs = mnt_table_find_source(tb, tgt, direction);
}
}
@@ -1336,8 +1341,8 @@ static int apply_tab(mnt_context *cxt, mnt_tab *tb, int direction)
rc = mnt_fs_set_fs_options(cxt->fs,
mnt_fs_get_fs_options(fs));
if (!rc)
- rc = mnt_fs_set_userspace_options(cxt->fs,
- mnt_fs_get_userspace_options(fs));
+ rc = mnt_fs_set_user_options(cxt->fs,
+ mnt_fs_get_user_options(fs));
} else if (cxt->optsmode & MNT_OMODE_APPEND) {
rc = mnt_fs_append_vfs_options(cxt->fs,
@@ -1346,8 +1351,8 @@ static int apply_tab(mnt_context *cxt, mnt_tab *tb, int direction)
rc = mnt_fs_append_fs_options(cxt->fs,
mnt_fs_get_fs_options(fs));
if (!rc)
- rc = mnt_fs_append_userspace_options(cxt->fs,
- mnt_fs_get_userspace_options(fs));
+ rc = mnt_fs_append_user_options(cxt->fs,
+ mnt_fs_get_user_options(fs));
} else if (cxt->optsmode & MNT_OMODE_PREPEND) {
rc = mnt_fs_prepend_vfs_options(cxt->fs,
@@ -1356,8 +1361,8 @@ static int apply_tab(mnt_context *cxt, mnt_tab *tb, int direction)
rc = mnt_fs_prepend_fs_options(cxt->fs,
mnt_fs_get_fs_options(fs));
if (!rc)
- rc = mnt_fs_prepend_userspace_options(cxt->fs,
- mnt_fs_get_userspace_options(fs));
+ rc = mnt_fs_prepend_user_options(cxt->fs,
+ mnt_fs_get_user_options(fs));
}
if (!rc)
@@ -1374,10 +1379,10 @@ static int apply_tab(mnt_context *cxt, mnt_tab *tb, int direction)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_apply_fstab(mnt_context *cxt)
+int mnt_context_apply_fstab(struct libmnt_context *cxt)
{
int rc = -1;
- mnt_tab *tab = NULL;
+ struct libmnt_table *tab = NULL;
const char *src = NULL, *tgt = NULL;
assert(cxt);
@@ -1415,14 +1420,14 @@ int mnt_context_apply_fstab(mnt_context *cxt)
if (cxt->optsmode & MNT_OMODE_FSTAB) {
rc = mnt_context_get_fstab(cxt, &tab);
if (!rc)
- rc = apply_tab(cxt, tab, MNT_ITER_FORWARD);
+ rc = apply_table(cxt, tab, MNT_ITER_FORWARD);
}
/* try mtab */
if (rc == -1 && (cxt->optsmode & MNT_OMODE_MTAB)) {
rc = mnt_context_get_mtab(cxt, &tab);
if (!rc)
- rc = apply_tab(cxt, tab, MNT_ITER_BACKWARD);
+ rc = apply_table(cxt, tab, MNT_ITER_BACKWARD);
}
if (rc)
DBG(CXT, mnt_debug_h(cxt, "failed to found entry in fstab/mtab"));
@@ -1435,7 +1440,7 @@ int mnt_context_apply_fstab(mnt_context *cxt)
*
* Returns: 1 if /sbin/mount.type or mount(2) syscall was successfull or 0.
*/
-int mnt_context_get_status(mnt_context *cxt)
+int mnt_context_get_status(struct libmnt_context *cxt)
{
return cxt && (!cxt->syscall_status || !cxt->helper_exec_status);
}
@@ -1448,7 +1453,7 @@ int mnt_context_get_status(mnt_context *cxt)
*
* Returns: 0 or negative number in case of error.
*/
-int mnt_context_strerror(mnt_context *cxt, char *buf, size_t bufsiz)
+int mnt_context_strerror(struct libmnt_context *cxt, char *buf, size_t bufsiz)
{
/* TODO: based on cxt->syscall_errno or cxt->helper_status */
return 0;
@@ -1463,14 +1468,14 @@ int mnt_context_strerror(mnt_context *cxt, char *buf, size_t bufsiz)
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_context_init_helper(mnt_context *cxt, int flags)
+int mnt_context_init_helper(struct libmnt_context *cxt, int flags)
{
return set_flag(cxt, MNT_FL_HELPER, 1);
}
#ifdef TEST_PROGRAM
-mnt_lock *lock;
+struct libmnt_lock *lock;
static void lock_fallback(void)
{
@@ -1478,10 +1483,10 @@ static void lock_fallback(void)
mnt_unlock_file(lock);
}
-int test_mount(struct mtest *ts, int argc, char *argv[])
+int test_mount(struct libmnt_test *ts, int argc, char *argv[])
{
int idx = 1, rc = 0;
- mnt_context *cxt;
+ struct libmnt_context *cxt;
if (argc < 2)
return -EINVAL;
@@ -1524,10 +1529,10 @@ int test_mount(struct mtest *ts, int argc, char *argv[])
return rc;
}
-int test_umount(struct mtest *ts, int argc, char *argv[])
+int test_umount(struct libmnt_test *ts, int argc, char *argv[])
{
int idx = 1, rc = 0;
- mnt_context *cxt;
+ struct libmnt_context *cxt;
if (argc < 2)
return -EINVAL;
@@ -1580,7 +1585,7 @@ err:
int main(int argc, char *argv[])
{
- struct mtest tss[] = {
+ struct libmnt_test tss[] = {
{ "--mount", test_mount, "[-o <opts>] [-t <type>] <spec>|<src> <target>" },
{ "--umount", test_umount, "[-t <type>] [-f][-l][-r] <src>|<target>" },
{ NULL }};
diff --git a/shlibs/mount/src/context_mount.c b/shlibs/mount/src/context_mount.c
index a54983fa..367d1341 100644
--- a/shlibs/mount/src/context_mount.c
+++ b/shlibs/mount/src/context_mount.c
@@ -27,13 +27,13 @@
/*
* this has to be called after mnt_context_evaluate_permissions()
*/
-static int fix_optstr(mnt_context *cxt)
+static int fix_optstr(struct libmnt_context *cxt)
{
int rc = 0, rem_se = 0;
char *next;
char *name, *val;
size_t namesz, valsz;
- mnt_fs *fs;
+ struct libmnt_fs *fs;
assert(cxt);
assert(cxt->fs);
@@ -120,7 +120,7 @@ done:
* Converts already evalulated and fixed options to the form that is compatible
* with /sbin/mount.<type> helpers.
*/
-static int generate_helper_optstr(mnt_context *cxt, char **optstr)
+static int generate_helper_optstr(struct libmnt_context *cxt, char **optstr)
{
int rc = 0;
@@ -145,7 +145,7 @@ static int generate_helper_optstr(mnt_context *cxt, char **optstr)
/*
* this has to be called before fix_optstr()
*/
-static int evaluate_permissions(mnt_context *cxt)
+static int evaluate_permissions(struct libmnt_context *cxt)
{
unsigned long u_flags = 0;
const char *srcpath;
@@ -161,7 +161,7 @@ static int evaluate_permissions(mnt_context *cxt)
DBG(CXT, mnt_debug_h(cxt, "mount: evaluating permissions"));
- mnt_context_get_userspace_mountflags(cxt, &u_flags);
+ mnt_context_get_user_mflags(cxt, &u_flags);
if (!mnt_context_is_restricted(cxt)) {
/*
@@ -230,7 +230,7 @@ static int evaluate_permissions(mnt_context *cxt)
*
* Returns: negative number on error, 1 if @c is unknown option, 0 on success.
*/
-int mnt_context_mounthelper_setopt(mnt_context *cxt, int c, char *arg)
+int mnt_context_mounthelper_setopt(struct libmnt_context *cxt, int c, char *arg)
{
int rc = -EINVAL;
@@ -272,7 +272,7 @@ int mnt_context_mounthelper_setopt(mnt_context *cxt, int c, char *arg)
return rc;
}
-static int exec_helper(mnt_context *cxt)
+static int exec_helper(struct libmnt_context *cxt)
{
char *o = NULL;
int rc;
@@ -360,7 +360,7 @@ static int exec_helper(mnt_context *cxt)
* The default is to use fstype from cxt->fs, this could be overwritten by
* @try_type argument.
*/
-static int do_mount(mnt_context *cxt, const char *try_type)
+static int do_mount(struct libmnt_context *cxt, const char *try_type)
{
int rc = 0;
const char *src, *target, *type;
@@ -411,7 +411,7 @@ static int do_mount(mnt_context *cxt, const char *try_type)
}
if (try_type && cxt->update) {
- mnt_fs *fs = mnt_update_get_fs(cxt->update);
+ struct libmnt_fs *fs = mnt_update_get_fs(cxt->update);
if (fs)
rc = mnt_fs_set_fstype(fs, try_type);
}
@@ -423,7 +423,7 @@ static int do_mount(mnt_context *cxt, const char *try_type)
return rc;
}
-static int do_mount_by_pattern(mnt_context *cxt, const char *pattern)
+static int do_mount_by_pattern(struct libmnt_context *cxt, const char *pattern)
{
int neg = pattern && strncmp(pattern, "no", 2) == 0;
int rc = -EINVAL;
@@ -483,7 +483,7 @@ static int do_mount_by_pattern(mnt_context *cxt, const char *pattern)
*
* Returns: negative number on error, zero on success
*/
-int mnt_context_prepare_mount(mnt_context *cxt)
+int mnt_context_prepare_mount(struct libmnt_context *cxt)
{
int rc = -EINVAL;
@@ -507,7 +507,7 @@ int mnt_context_prepare_mount(mnt_context *cxt)
/* TODO: fstab is unnecessary for MS_{MOVE,BIND,STARED,...} */
rc = mnt_context_apply_fstab(cxt);
if (!rc)
- rc = mnt_context_merge_mountflags(cxt);
+ rc = mnt_context_merge_mflags(cxt);
if (!rc)
rc = evaluate_permissions(cxt);
if (!rc)
@@ -536,7 +536,7 @@ int mnt_context_prepare_mount(mnt_context *cxt)
*
* Returns: negative number on error, zero on success
*/
-int mnt_context_do_mount(mnt_context *cxt)
+int mnt_context_do_mount(struct libmnt_context *cxt)
{
const char *type;
@@ -577,7 +577,7 @@ int mnt_context_do_mount(mnt_context *cxt)
* does not mean that mount(2) syscall or mount.type helper wasn't
* sucessfully called. Check mnt_context_get_status() after error!
*/
-int mnt_mount_context(mnt_context *cxt)
+int mnt_mount_context(struct libmnt_context *cxt)
{
int rc;
@@ -609,7 +609,7 @@ int mnt_mount_context(mnt_context *cxt)
*
* Returns: negative number on error, 0 on success.
*/
-int mnt_context_finalize_mount(mnt_context *cxt)
+int mnt_context_finalize_mount(struct libmnt_context *cxt)
{
int rc;
diff --git a/shlibs/mount/src/context_umount.c b/shlibs/mount/src/context_umount.c
index 9b411d86..c04672d6 100644
--- a/shlibs/mount/src/context_umount.c
+++ b/shlibs/mount/src/context_umount.c
@@ -21,12 +21,12 @@
#include "strutils.h"
#include "mountP.h"
-static int lookup_umount_fs(mnt_context *cxt)
+static int lookup_umount_fs(struct libmnt_context *cxt)
{
int rc;
const char *tgt;
- mnt_tab *mtab;
- mnt_fs *fs;
+ struct libmnt_table *mtab;
+ struct libmnt_fs *fs;
assert(cxt);
assert(cxt->fs);
@@ -43,13 +43,13 @@ static int lookup_umount_fs(mnt_context *cxt)
DBG(CXT, mnt_debug_h(cxt, "umount: failed to read mtab"));
return rc;
}
- fs = mnt_tab_find_target(mtab, tgt, MNT_ITER_BACKWARD);
+ fs = mnt_table_find_target(mtab, tgt, MNT_ITER_BACKWARD);
if (!fs) {
/* maybe the option is source rather than target (mountpoint) */
- fs = mnt_tab_find_source(mtab, tgt, MNT_ITER_BACKWARD);
+ fs = mnt_table_find_source(mtab, tgt, MNT_ITER_BACKWARD);
if (fs) {
- mnt_fs *fs1 = mnt_tab_find_target(mtab,
+ struct libmnt_fs *fs1 = mnt_table_find_target(mtab,
mnt_fs_get_target(fs),
MNT_ITER_BACKWARD);
if (!fs1) {
@@ -87,7 +87,7 @@ static int lookup_umount_fs(mnt_context *cxt)
if (!rc)
rc = mnt_fs_set_fs_options(cxt->fs, mnt_fs_get_fs_options(fs));
if (!rc)
- rc = mnt_fs_set_userspace_options(cxt->fs, mnt_fs_get_userspace_options(fs));
+ rc = mnt_fs_set_user_options(cxt->fs, mnt_fs_get_user_options(fs));
if (!rc && mnt_fs_get_bindsrc(fs))
rc = mnt_fs_set_bindsrc(cxt->fs, mnt_fs_get_bindsrc(fs));
@@ -102,7 +102,7 @@ static int lookup_umount_fs(mnt_context *cxt)
*
* TODO : move this to loopdev.c
*/
-static int mnt_loopdev_associated_fs(const char *devname, mnt_fs *fs)
+static int mnt_loopdev_associated_fs(const char *devname, struct libmnt_fs *fs)
{
uintmax_t offset = 0;
const char *src;
@@ -118,7 +118,7 @@ static int mnt_loopdev_associated_fs(const char *devname, mnt_fs *fs)
return 0;
/* check for offset option in @fs */
- optstr = (char *) mnt_fs_get_userspace_options(fs);
+ optstr = (char *) mnt_fs_get_user_options(fs);
if (optstr && !mnt_optstr_get_option(optstr, "offset=", &val, &valsz)) {
int rc;
@@ -141,13 +141,13 @@ static int mnt_loopdev_associated_fs(const char *devname, mnt_fs *fs)
/*
* Note that cxt->fs contains relevant mtab entry!
*/
-static int evaluate_permissions(mnt_context *cxt)
+static int evaluate_permissions(struct libmnt_context *cxt)
{
- mnt_tab *fstab;
+ struct libmnt_table *fstab;
unsigned long u_flags = 0;
const char *tgt, *src, *optstr;
int rc, ok = 0;
- mnt_fs *fs;
+ struct libmnt_fs *fs;
assert(cxt);
assert(cxt->fs);
@@ -172,7 +172,7 @@ static int evaluate_permissions(mnt_context *cxt)
(cxt->user_mountflags & MNT_MS_UHELPER)) {
char *suffix = NULL;
- char *o = (char *) mnt_fs_get_userspace_options(cxt->fs);
+ char *o = (char *) mnt_fs_get_user_options(cxt->fs);
size_t valsz;
rc = mnt_optstr_get_option(o, "uhelper", &suffix, &valsz);
@@ -210,14 +210,14 @@ static int evaluate_permissions(mnt_context *cxt)
* then "mount /dev/sda4" followed by "umount /mnt/zip" used to fail.
* So, we must not look for file, but for the pair (dev,file) in fstab.
*/
- fs = mnt_tab_find_pair(fstab, src, tgt, MNT_ITER_FORWARD);
+ fs = mnt_table_find_pair(fstab, src, tgt, MNT_ITER_FORWARD);
if (!fs) {
/*
* It's possible that there is /path/file.img in fstab and
* /dev/loop0 in mtab -- then we have to check releation
* between loopdev and the file.
*/
- fs = mnt_tab_find_target(fstab, tgt, MNT_ITER_FORWARD);
+ fs = mnt_table_find_target(fstab, tgt, MNT_ITER_FORWARD);
if (fs) {
const char *dev = mnt_fs_get_srcpath(cxt->fs); /* devname from mtab */
@@ -242,7 +242,7 @@ static int evaluate_permissions(mnt_context *cxt)
* The options `user', `owner' and `group' only allow unmounting by the
* user that mounted (visible in mtab).
*/
- optstr = mnt_fs_get_userspace_options(fs); /* FSTAB mount options! */
+ optstr = mnt_fs_get_user_options(fs); /* FSTAB mount options! */
if (!optstr)
goto eperm;
@@ -278,7 +278,7 @@ static int evaluate_permissions(mnt_context *cxt)
}
/* get options from mtab */
- optstr = mnt_fs_get_userspace_options(cxt->fs);
+ optstr = mnt_fs_get_user_options(cxt->fs);
if (optstr && !mnt_optstr_get_option((char *) optstr,
"user", &mtab_user, &sz) && sz)
ok = !strncmp(curr_user, mtab_user, sz);
@@ -293,7 +293,7 @@ eperm:
return -EPERM;
}
-static int exec_helper(mnt_context *cxt)
+static int exec_helper(struct libmnt_context *cxt)
{
int rc;
@@ -369,7 +369,7 @@ static int exec_helper(mnt_context *cxt)
return rc;
}
-static int do_umount(mnt_context *cxt)
+static int do_umount(struct libmnt_context *cxt)
{
int rc = 0;
const char *src, *target;
@@ -450,7 +450,7 @@ static int do_umount(mnt_context *cxt)
*
* Returns: 0 on success, and negative number in case of error.
*/
-int mnt_context_do_umount(mnt_context *cxt)
+int mnt_context_do_umount(struct libmnt_context *cxt)
{
int rc;
@@ -466,7 +466,7 @@ int mnt_context_do_umount(mnt_context *cxt)
rc = lookup_umount_fs(cxt);
if (!rc)
- rc = mnt_context_merge_mountflags(cxt);
+ rc = mnt_context_merge_mflags(cxt);
if (!rc)
rc = evaluate_permissions(cxt);
if (!rc)
diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c
index 9078f406..03fe4bbe 100644
--- a/shlibs/mount/src/fs.c
+++ b/shlibs/mount/src/fs.c
@@ -8,7 +8,7 @@
/**
* SECTION: fs
* @title: Filesystem
- * @short_description: mnt_fs represents one entry in fstab/mtab/mountinfo
+ * @short_description: struct libmnt_fs represents one entry in fstab/mtab/mountinfo
*
*/
#include <stdio.h>
@@ -25,11 +25,11 @@
/**
* mnt_new_fs:
*
- * Returns: newly allocated mnt_file fs.
+ * Returns: newly allocated struct libmnt_fs.
*/
-mnt_fs *mnt_new_fs(void)
+struct libmnt_fs *mnt_new_fs(void)
{
- mnt_fs *fs = calloc(1, sizeof(struct _mnt_fs));
+ struct libmnt_fs *fs = calloc(1, sizeof(*fs));
if (!fs)
return NULL;
@@ -43,7 +43,7 @@ mnt_fs *mnt_new_fs(void)
*
* Deallocates the fs.
*/
-void mnt_free_fs(mnt_fs *fs)
+void mnt_free_fs(struct libmnt_fs *fs)
{
if (!fs)
return;
@@ -103,9 +103,9 @@ static inline int cpy_str_at_offset(void *new, const void *old, size_t offset)
*
* Returns: copy of @fs
*/
-mnt_fs *mnt_copy_fs(const mnt_fs *fs)
+struct libmnt_fs *mnt_copy_fs(const struct libmnt_fs *fs)
{
- mnt_fs *n = mnt_new_fs();
+ struct libmnt_fs *n = mnt_new_fs();
if (!n)
return NULL;
@@ -114,25 +114,25 @@ mnt_fs *mnt_copy_fs(const mnt_fs *fs)
n->parent = fs->parent;
n->devno = fs->devno;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, source)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, source)))
goto err;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, tagname)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, tagname)))
goto err;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, tagval)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, tagval)))
goto err;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, root)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, root)))
goto err;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, target)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, target)))
goto err;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, fstype)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, fstype)))
goto err;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, vfs_optstr)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, vfs_optstr)))
goto err;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, fs_optstr)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, fs_optstr)))
goto err;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, user_optstr)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, user_optstr)))
goto err;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, attrs)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, attrs)))
goto err;
n->freq = fs->freq;
@@ -152,18 +152,18 @@ err:
*
* Returns: copy of @fs.
*/
-mnt_fs *mnt_copy_mtab_fs(const mnt_fs *fs)
+struct libmnt_fs *mnt_copy_mtab_fs(const struct libmnt_fs *fs)
{
- mnt_fs *n = mnt_new_fs();
+ struct libmnt_fs *n = mnt_new_fs();
if (!n)
return NULL;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, source)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, source)))
goto err;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, target)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, target)))
goto err;
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, fstype)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, fstype)))
goto err;
if (fs->vfs_optstr) {
@@ -182,7 +182,7 @@ mnt_fs *mnt_copy_mtab_fs(const mnt_fs *fs)
n->user_optstr = p;
}
- if (cpy_str_at_offset(n, fs, offsetof(struct _mnt_fs, fs_optstr)))
+ if (cpy_str_at_offset(n, fs, offsetof(struct libmnt_fs, fs_optstr)))
goto err;
n->freq = fs->freq;
@@ -198,25 +198,25 @@ err:
/**
* mnt_fs_get_userdata:
- * @fs: mnt_file instance
+ * @fs: struct libmnt_file instance
*
* Returns: private data set by mnt_fs_set_userdata() or NULL.
*/
-void *mnt_fs_get_userdata(mnt_fs *fs)
+void *mnt_fs_get_userdata(struct libmnt_fs *fs)
{
return fs ? fs->userdata : NULL;
}
/**
* mnt_fs_set_userdata:
- * @fs: mnt_file instance
+ * @fs: struct libmnt_file instance
* @data: user data
*
* The "userdata" are library independent data.
*
* Returns: 0 or negative number in case of error (if @fs is NULL).
*/
-int mnt_fs_set_userdata(mnt_fs *fs, void *data)
+int mnt_fs_set_userdata(struct libmnt_fs *fs, void *data)
{
if (!fs)
return -EINVAL;
@@ -226,7 +226,7 @@ int mnt_fs_set_userdata(mnt_fs *fs, void *data)
/**
* mnt_fs_get_srcpath:
- * @fs: mnt_file (fstab/mtab/mountinfo) fs
+ * @fs: struct libmnt_file (fstab/mtab/mountinfo) fs
*
* The mount "source path" is:
* - a directory for 'bind' mounts (in fstab or mtab only)
@@ -237,7 +237,7 @@ int mnt_fs_set_userdata(mnt_fs *fs, void *data)
* Returns: mount source path or NULL in case of error or when the path
* is not defined.
*/
-const char *mnt_fs_get_srcpath(mnt_fs *fs)
+const char *mnt_fs_get_srcpath(struct libmnt_fs *fs)
{
assert(fs);
if (!fs)
@@ -251,18 +251,18 @@ const char *mnt_fs_get_srcpath(mnt_fs *fs)
/**
* mnt_fs_get_source:
- * @fs: mnt_file (fstab/mtab/mountinfo) fs
+ * @fs: struct libmnt_file (fstab/mtab/mountinfo) fs
*
* Returns: mount source. Note that the source could be unparsed TAG
* (LABEL/UUID). See also mnt_fs_get_srcpath() and mnt_fs_get_tag().
*/
-const char *mnt_fs_get_source(mnt_fs *fs)
+const char *mnt_fs_get_source(struct libmnt_fs *fs)
{
return fs ? fs->source : NULL;
}
-/* Used by parser mnt_file ONLY (@source has to be allocated) */
-int __mnt_fs_set_source_ptr(mnt_fs *fs, char *source)
+/* Used by parser struct libmnt_file ONLY (@source has to be allocated) */
+int __mnt_fs_set_source_ptr(struct libmnt_fs *fs, char *source)
{
char *t = NULL, *v = NULL;
@@ -297,7 +297,7 @@ int __mnt_fs_set_source_ptr(mnt_fs *fs, char *source)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_set_source(mnt_fs *fs, const char *source)
+int mnt_fs_set_source(struct libmnt_fs *fs, const char *source)
{
char *p;
int rc;
@@ -330,7 +330,7 @@ int mnt_fs_set_source(mnt_fs *fs, const char *source)
* <informalexample>
* <programlisting>
* char *src;
- * mnt_fs *fs = mnt_tab_find_target(tb, "/home", MNT_ITER_FORWARD);
+ * struct libmnt_fs *fs = mnt_table_find_target(tb, "/home", MNT_ITER_FORWARD);
*
* if (!fs)
* goto err;
@@ -347,7 +347,7 @@ int mnt_fs_set_source(mnt_fs *fs, const char *source)
*
* Returns: 0 on success or negative number in case that a TAG is not defined.
*/
-int mnt_fs_get_tag(mnt_fs *fs, const char **name, const char **value)
+int mnt_fs_get_tag(struct libmnt_fs *fs, const char **name, const char **value)
{
if (fs == NULL || !fs->tagname)
return -EINVAL;
@@ -364,7 +364,7 @@ int mnt_fs_get_tag(mnt_fs *fs, const char **name, const char **value)
*
* Returns: pointer to mountpoint path or NULL
*/
-const char *mnt_fs_get_target(mnt_fs *fs)
+const char *mnt_fs_get_target(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->target : NULL;
@@ -379,7 +379,7 @@ const char *mnt_fs_get_target(mnt_fs *fs)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_set_target(mnt_fs *fs, const char *target)
+int mnt_fs_set_target(struct libmnt_fs *fs, const char *target)
{
char *p;
@@ -402,14 +402,14 @@ int mnt_fs_set_target(mnt_fs *fs, const char *target)
*
* Returns: pointer to filesystem type.
*/
-const char *mnt_fs_get_fstype(mnt_fs *fs)
+const char *mnt_fs_get_fstype(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->fstype : NULL;
}
-/* Used by mnt_file parser only */
-int __mnt_fs_set_fstype_ptr(mnt_fs *fs, char *fstype)
+/* Used by struct libmnt_file parser only */
+int __mnt_fs_set_fstype_ptr(struct libmnt_fs *fs, char *fstype)
{
assert(fs);
@@ -441,7 +441,7 @@ int __mnt_fs_set_fstype_ptr(mnt_fs *fs, char *fstype)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_set_fstype(mnt_fs *fs, const char *fstype)
+int mnt_fs_set_fstype(struct libmnt_fs *fs, const char *fstype)
{
char *p = NULL;
int rc;
@@ -522,7 +522,7 @@ static char *merge_optstr(const char *vfs, const char *fs)
*
* Returns: pointer to string (can be freed by free(3)) or NULL in case of error.
*/
-char *mnt_fs_strdup_options(mnt_fs *fs)
+char *mnt_fs_strdup_options(struct libmnt_fs *fs)
{
char *res;
@@ -551,7 +551,7 @@ char *mnt_fs_strdup_options(mnt_fs *fs)
*
* Returns: 0 on success, or negative number icase of error.
*/
-int mnt_fs_set_options(mnt_fs *fs, const char *optstr)
+int mnt_fs_set_options(struct libmnt_fs *fs, const char *optstr)
{
char *v = NULL, *f = NULL, *u = NULL;
@@ -587,7 +587,7 @@ int mnt_fs_set_options(mnt_fs *fs, const char *optstr)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_append_options(mnt_fs *fs, const char *optstr)
+int mnt_fs_append_options(struct libmnt_fs *fs, const char *optstr)
{
char *v = NULL, *f = NULL, *u = NULL;
int rc;
@@ -622,7 +622,7 @@ int mnt_fs_append_options(mnt_fs *fs, const char *optstr)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_prepend_options(mnt_fs *fs, const char *optstr)
+int mnt_fs_prepend_options(struct libmnt_fs *fs, const char *optstr)
{
char *v = NULL, *f = NULL, *u = NULL;
int rc;
@@ -651,7 +651,7 @@ int mnt_fs_prepend_options(mnt_fs *fs, const char *optstr)
*
* Returns: pointer to superblock (fs-depend) mount option string or NULL.
*/
-const char *mnt_fs_get_fs_options(mnt_fs *fs)
+const char *mnt_fs_get_fs_options(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->fs_optstr : NULL;
@@ -666,7 +666,7 @@ const char *mnt_fs_get_fs_options(mnt_fs *fs)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_set_fs_options(mnt_fs *fs, const char *optstr)
+int mnt_fs_set_fs_options(struct libmnt_fs *fs, const char *optstr)
{
char *p = NULL;
@@ -693,7 +693,7 @@ int mnt_fs_set_fs_options(mnt_fs *fs, const char *optstr)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_append_fs_options(mnt_fs *fs, const char *optstr)
+int mnt_fs_append_fs_options(struct libmnt_fs *fs, const char *optstr)
{
if (!fs)
return -EINVAL;
@@ -712,7 +712,7 @@ int mnt_fs_append_fs_options(mnt_fs *fs, const char *optstr)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_prepend_fs_options(mnt_fs *fs, const char *optstr)
+int mnt_fs_prepend_fs_options(struct libmnt_fs *fs, const char *optstr)
{
if (!fs)
return -EINVAL;
@@ -728,7 +728,7 @@ int mnt_fs_prepend_fs_options(mnt_fs *fs, const char *optstr)
*
* Returns: pointer to fs-independent (VFS) mount option string or NULL.
*/
-const char *mnt_fs_get_vfs_options(mnt_fs *fs)
+const char *mnt_fs_get_vfs_options(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->vfs_optstr : NULL;
@@ -743,7 +743,7 @@ const char *mnt_fs_get_vfs_options(mnt_fs *fs)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_set_vfs_options(mnt_fs *fs, const char *optstr)
+int mnt_fs_set_vfs_options(struct libmnt_fs *fs, const char *optstr)
{
char *p = NULL;
@@ -770,7 +770,7 @@ int mnt_fs_set_vfs_options(mnt_fs *fs, const char *optstr)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_append_vfs_options(mnt_fs *fs, const char *optstr)
+int mnt_fs_append_vfs_options(struct libmnt_fs *fs, const char *optstr)
{
if (!fs)
return -EINVAL;
@@ -789,7 +789,7 @@ int mnt_fs_append_vfs_options(mnt_fs *fs, const char *optstr)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_prepend_vfs_options(mnt_fs *fs, const char *optstr)
+int mnt_fs_prepend_vfs_options(struct libmnt_fs *fs, const char *optstr)
{
if (!fs)
return -EINVAL;
@@ -799,19 +799,19 @@ int mnt_fs_prepend_vfs_options(mnt_fs *fs, const char *optstr)
}
/**
- * mnt_fs_get_userspace_options:
+ * mnt_fs_get_user_options:
* @fs: fstab/mtab entry pointer
*
* Returns: pointer to userspace mount option string or NULL.
*/
-const char *mnt_fs_get_userspace_options(mnt_fs *fs)
+const char *mnt_fs_get_user_options(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->user_optstr : NULL;
}
/**
- * mnt_fs_set_userspace_options:
+ * mnt_fs_set_user_options:
* @fs: fstab/mtab/mountinfo entry
* @optstr: options string
*
@@ -819,7 +819,7 @@ const char *mnt_fs_get_userspace_options(mnt_fs *fs)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_set_userspace_options(mnt_fs *fs, const char *optstr)
+int mnt_fs_set_user_options(struct libmnt_fs *fs, const char *optstr)
{
char *p = NULL;
@@ -837,7 +837,7 @@ int mnt_fs_set_userspace_options(mnt_fs *fs, const char *optstr)
}
/**
- * mnt_fs_append_userspace_options:
+ * mnt_fs_append_user_options:
* @fs: fstab/mtab/mountinfo entry
* @optstr: options string
*
@@ -846,7 +846,7 @@ int mnt_fs_set_userspace_options(mnt_fs *fs, const char *optstr)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_append_userspace_options(mnt_fs *fs, const char *optstr)
+int mnt_fs_append_user_options(struct libmnt_fs *fs, const char *optstr)
{
if (!fs)
return -EINVAL;
@@ -856,7 +856,7 @@ int mnt_fs_append_userspace_options(mnt_fs *fs, const char *optstr)
}
/**
- * mnt_fs_prepend_userspace_options:
+ * mnt_fs_prepend_user_options:
* @fs: fstab/mtab/mountinfo entry
* @optstr: options string
*
@@ -865,7 +865,7 @@ int mnt_fs_append_userspace_options(mnt_fs *fs, const char *optstr)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_prepend_userspace_options(mnt_fs *fs, const char *optstr)
+int mnt_fs_prepend_user_options(struct libmnt_fs *fs, const char *optstr)
{
if (!fs)
return -EINVAL;
@@ -881,7 +881,7 @@ int mnt_fs_prepend_userspace_options(mnt_fs *fs, const char *optstr)
*
* Returns: pointer to attributes string or NULL.
*/
-const char *mnt_fs_get_attributes(mnt_fs *fs)
+const char *mnt_fs_get_attributes(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->attrs : NULL;
@@ -902,7 +902,7 @@ const char *mnt_fs_get_attributes(mnt_fs *fs)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_set_attributes(mnt_fs *fs, const char *optstr)
+int mnt_fs_set_attributes(struct libmnt_fs *fs, const char *optstr)
{
char *p = NULL;
@@ -928,7 +928,7 @@ int mnt_fs_set_attributes(mnt_fs *fs, const char *optstr)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_append_attributes(mnt_fs *fs, const char *optstr)
+int mnt_fs_append_attributes(struct libmnt_fs *fs, const char *optstr)
{
if (!fs)
return -EINVAL;
@@ -946,7 +946,7 @@ int mnt_fs_append_attributes(mnt_fs *fs, const char *optstr)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_prepend_attributes(mnt_fs *fs, const char *optstr)
+int mnt_fs_prepend_attributes(struct libmnt_fs *fs, const char *optstr)
{
if (!fs)
return -EINVAL;
@@ -962,7 +962,7 @@ int mnt_fs_prepend_attributes(mnt_fs *fs, const char *optstr)
*
* Returns: dump frequency in days.
*/
-int mnt_fs_get_freq(mnt_fs *fs)
+int mnt_fs_get_freq(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->freq : 0;
@@ -975,7 +975,7 @@ int mnt_fs_get_freq(mnt_fs *fs)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_set_freq(mnt_fs *fs, int freq)
+int mnt_fs_set_freq(struct libmnt_fs *fs, int freq)
{
assert(fs);
if (!fs)
@@ -990,7 +990,7 @@ int mnt_fs_set_freq(mnt_fs *fs, int freq)
*
* Returns: "pass number on parallel fsck".
*/
-int mnt_fs_get_passno(mnt_fs *fs)
+int mnt_fs_get_passno(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->passno: 0;
@@ -1003,7 +1003,7 @@ int mnt_fs_get_passno(mnt_fs *fs)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_set_passno(mnt_fs *fs, int passno)
+int mnt_fs_set_passno(struct libmnt_fs *fs, int passno)
{
assert(fs);
if (!fs)
@@ -1018,7 +1018,7 @@ int mnt_fs_set_passno(mnt_fs *fs, int passno)
*
* Returns: root of the mount within the filesystem or NULL
*/
-const char *mnt_fs_get_root(mnt_fs *fs)
+const char *mnt_fs_get_root(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->root : NULL;
@@ -1031,7 +1031,7 @@ const char *mnt_fs_get_root(mnt_fs *fs)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_set_root(mnt_fs *fs, const char *root)
+int mnt_fs_set_root(struct libmnt_fs *fs, const char *root)
{
char *p = NULL;
@@ -1054,7 +1054,7 @@ int mnt_fs_set_root(mnt_fs *fs, const char *root)
*
* Returns: full path that was used for mount(2) on MS_BIND
*/
-const char *mnt_fs_get_bindsrc(mnt_fs *fs)
+const char *mnt_fs_get_bindsrc(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->bindsrc : NULL;
@@ -1067,7 +1067,7 @@ const char *mnt_fs_get_bindsrc(mnt_fs *fs)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_set_bindsrc(mnt_fs *fs, const char *src)
+int mnt_fs_set_bindsrc(struct libmnt_fs *fs, const char *src)
{
char *p = NULL;
@@ -1090,7 +1090,7 @@ int mnt_fs_set_bindsrc(mnt_fs *fs, const char *src)
*
* Returns: mount ID (unique identifier of the mount) or negative number in case of error.
*/
-int mnt_fs_get_id(mnt_fs *fs)
+int mnt_fs_get_id(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->id : -EINVAL;
@@ -1102,7 +1102,7 @@ int mnt_fs_get_id(mnt_fs *fs)
*
* Returns: parent mount ID or negative number in case of error.
*/
-int mnt_fs_get_parent_id(mnt_fs *fs)
+int mnt_fs_get_parent_id(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->parent : -EINVAL;
@@ -1114,7 +1114,7 @@ int mnt_fs_get_parent_id(mnt_fs *fs)
*
* Returns: value of st_dev for files on filesystem or 0 in case of error.
*/
-dev_t mnt_fs_get_devno(mnt_fs *fs)
+dev_t mnt_fs_get_devno(struct libmnt_fs *fs)
{
assert(fs);
return fs ? fs->devno : 0;
@@ -1129,7 +1129,7 @@ dev_t mnt_fs_get_devno(mnt_fs *fs)
*
* Returns: 0 on success, 1 when not found the @name or negative number in case of error.
*/
-int mnt_fs_get_option(mnt_fs *fs, const char *name,
+int mnt_fs_get_option(struct libmnt_fs *fs, const char *name,
char **value, size_t *valsz)
{
char rc = 1;
@@ -1152,7 +1152,7 @@ int mnt_fs_get_option(mnt_fs *fs, const char *name,
*
* Returns: 0 on success, 1 when not found the @name or negative number in case of error.
*/
-int mnt_fs_get_attribute(mnt_fs *fs, const char *name,
+int mnt_fs_get_attribute(struct libmnt_fs *fs, const char *name,
char **value, size_t *valsz)
{
char rc = 1;
@@ -1177,7 +1177,7 @@ int mnt_fs_get_attribute(mnt_fs *fs, const char *name,
*
* Returns: 1 if @fs target is equal to @target else 0.
*/
-int mnt_fs_match_target(mnt_fs *fs, const char *target, mnt_cache *cache)
+int mnt_fs_match_target(struct libmnt_fs *fs, const char *target, struct libmnt_cache *cache)
{
int rc = 0;
@@ -1219,7 +1219,7 @@ int mnt_fs_match_target(mnt_fs *fs, const char *target, mnt_cache *cache)
*
* Returns: 1 if @fs source is equal to @source else 0.
*/
-int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache)
+int mnt_fs_match_source(struct libmnt_fs *fs, const char *source, struct libmnt_cache *cache)
{
char *cn;
const char *src, *t, *v;
@@ -1288,7 +1288,7 @@ int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache)
* Returns: 1 if @fs type is matching to @types else 0. The function returns
* 0 when types is NULL.
*/
-int mnt_fs_match_fstype(mnt_fs *fs, const char *types)
+int mnt_fs_match_fstype(struct libmnt_fs *fs, const char *types)
{
return mnt_match_fstype(fs->fstype, types);
}
@@ -1303,7 +1303,7 @@ int mnt_fs_match_fstype(mnt_fs *fs, const char *types)
* Returns: 1 if @fs type is matching to @options else 0. The function returns
* 0 when types is NULL.
*/
-int mnt_fs_match_options(mnt_fs *fs, const char *options)
+int mnt_fs_match_options(struct libmnt_fs *fs, const char *options)
{
char *o = mnt_fs_strdup_options(fs);
int rc = 0;
@@ -1321,7 +1321,7 @@ int mnt_fs_match_options(mnt_fs *fs, const char *options)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_fs_print_debug(mnt_fs *fs, FILE *file)
+int mnt_fs_print_debug(struct libmnt_fs *fs, FILE *file)
{
if (!fs)
return -EINVAL;
@@ -1334,8 +1334,8 @@ int mnt_fs_print_debug(mnt_fs *fs, FILE *file)
fprintf(file, "VFS-optstr: %s\n", mnt_fs_get_vfs_options(fs));
if (mnt_fs_get_fs_options(fs))
fprintf(file, "FS-opstr: %s\n", mnt_fs_get_fs_options(fs));
- if (mnt_fs_get_userspace_options(fs))
- fprintf(file, "user-optstr: %s\n", mnt_fs_get_userspace_options(fs));
+ if (mnt_fs_get_user_options(fs))
+ fprintf(file, "user-optstr: %s\n", mnt_fs_get_user_options(fs));
if (mnt_fs_get_attributes(fs))
fprintf(file, "attributes: %s\n", mnt_fs_get_attributes(fs));
@@ -1385,7 +1385,7 @@ void mnt_free_mntent(struct mntent *mnt)
*
* Returns: 0 on success and negative number in case of error.
*/
-int mnt_fs_to_mntent(mnt_fs *fs, struct mntent **mnt)
+int mnt_fs_to_mntent(struct libmnt_fs *fs, struct mntent **mnt)
{
int rc;
struct mntent *m;
diff --git a/shlibs/mount/src/iter.c b/shlibs/mount/src/iter.c
index cb74eeca..99fedd17 100644
--- a/shlibs/mount/src/iter.c
+++ b/shlibs/mount/src/iter.c
@@ -25,9 +25,9 @@
*
* Returns: newly allocated generic libmount iterator.
*/
-mnt_iter *mnt_new_iter(int direction)
+struct libmnt_iter *mnt_new_iter(int direction)
{
- mnt_iter *itr = calloc(1, sizeof(struct _mnt_iter));
+ struct libmnt_iter *itr = calloc(1, sizeof(*itr));
if (!itr)
return NULL;
itr->direction = direction;
@@ -40,7 +40,7 @@ mnt_iter *mnt_new_iter(int direction)
*
* Deallocates iterator.
*/
-void mnt_free_iter(mnt_iter *itr)
+void mnt_free_iter(struct libmnt_iter *itr)
{
free(itr);
}
@@ -52,7 +52,7 @@ void mnt_free_iter(mnt_iter *itr)
*
* Resets iterator.
*/
-void mnt_reset_iter(mnt_iter *itr, int direction)
+void mnt_reset_iter(struct libmnt_iter *itr, int direction)
{
assert(itr);
@@ -60,7 +60,7 @@ void mnt_reset_iter(mnt_iter *itr, int direction)
direction = itr->direction;
if (itr) {
- memset(itr, 0, sizeof(struct _mnt_iter));
+ memset(itr, 0, sizeof(*itr));
itr->direction = direction;
}
}
@@ -71,7 +71,7 @@ void mnt_reset_iter(mnt_iter *itr, int direction)
*
* Returns: MNT_INTER_{FOR,BACK}WARD or negative number in case of error.
*/
-int mnt_iter_get_direction(mnt_iter *itr)
+int mnt_iter_get_direction(struct libmnt_iter *itr)
{
assert(itr);
return itr ? itr->direction : -EINVAL;
diff --git a/shlibs/mount/src/libmount.h.in b/shlibs/mount/src/libmount.h.in
index 819bdddf..86a61885 100644
--- a/shlibs/mount/src/libmount.h.in
+++ b/shlibs/mount/src/libmount.h.in
@@ -36,32 +36,32 @@ extern "C" {
#define LIBMOUNT_VERSION "@LIBMOUNT_VERSION@"
/**
- * mnt_cache:
+ * libmnt_cache:
*
* Stores canonicalized paths and evaluated tags
*/
-typedef struct _mnt_cache mnt_cache;
+struct libmnt_cache;
/**
- * mnt_lock:
+ * libmnt_lock:
*
* Stores information about locked file (e.g. /etc/mtab)
*/
-typedef struct _mnt_lock mnt_lock;
+struct libmnt_lock;
/**
- * mnt_iter:
+ * libmnt_iter:
*
* Generic iterator (stores state about lists)
*/
-typedef struct _mnt_iter mnt_iter;
+struct libmnt_iter;
/**
- * mnt_optmap:
+ * libmnt_optmap:
*
* Mount options description (map)
*/
-struct mnt_optmap
+struct libmnt_optmap
{
const char *name; /* option name[=%<type>] (e.g. "loop[=%s]") */
int id; /* option ID or MS_* flags (e.g MS_RDONLY) */
@@ -75,32 +75,32 @@ struct mnt_optmap
#define MNT_NOMTAB (1 << 2) /* skip in the mtab option string */
/**
- * mnt_fs:
+ * libmnt_fs:
*
* Parsed fstab/mtab/mountinfo entry
*/
-typedef struct _mnt_fs mnt_fs;
+struct libmnt_fs;
/**
- * mnt_tab:
+ * libmnt_table:
*
- * List of mnt_fs entries (parsed fstab/mtab/mountinfo)
+ * List of struct libmnt_fs entries (parsed fstab/mtab/mountinfo)
*/
-typedef struct _mnt_tab mnt_tab;
+struct libmnt_table;
/**
- * mnt_update
+ * libmnt_update
*
* /etc/mtab or /dev/.mount/utab update description
*/
-typedef struct _mnt_update mnt_update;
+struct libmnt_update;
/**
- * mnt_context
+ * libmnt_context
*
* Mount/umount status
*/
-typedef struct _mnt_context mnt_context;
+struct libmnt_context;
/*
* Actions
@@ -129,19 +129,23 @@ extern const char *mnt_get_mtab_path(void);
extern int mnt_has_regular_mtab(const char **mtab, int *writable);
/* cache.c */
-extern mnt_cache *mnt_new_cache(void);
-extern void mnt_free_cache(mnt_cache *cache);
-extern int mnt_cache_read_tags(mnt_cache *cache, const char *devname);
-extern int mnt_cache_device_has_tag(mnt_cache *cache, const char *devname,
- const char *token, const char *value);
+extern struct libmnt_cache *mnt_new_cache(void);
+extern void mnt_free_cache(struct libmnt_cache *cache);
+extern int mnt_cache_read_tags(struct libmnt_cache *cache, const char *devname);
+extern int mnt_cache_device_has_tag(struct libmnt_cache *cache,
+ const char *devname,
+ const char *token,
+ const char *value);
-extern char *mnt_cache_find_tag_value(mnt_cache *cache,
+extern char *mnt_cache_find_tag_value(struct libmnt_cache *cache,
const char *devname, const char *token);
-extern char *mnt_get_fstype(const char *devname, int *ambi, mnt_cache *cache);
-extern char *mnt_resolve_path(const char *path, mnt_cache *cache);
-extern char *mnt_resolve_tag(const char *token, const char *value, mnt_cache *cache);
-extern char *mnt_resolve_spec(const char *spec, mnt_cache *cache);
+extern char *mnt_get_fstype(const char *devname, int *ambi,
+ struct libmnt_cache *cache);
+extern char *mnt_resolve_path(const char *path, struct libmnt_cache *cache);
+extern char *mnt_resolve_tag(const char *token, const char *value,
+ struct libmnt_cache *cache);
+extern char *mnt_resolve_spec(const char *spec, struct libmnt_cache *cache);
/* optstr.c */
extern int mnt_optstr_next_option(char **optstr, char **name, size_t *namesz,
@@ -161,12 +165,12 @@ extern int mnt_split_optstr(const char *optstr,
int ignore_user, int ignore_vfs);
extern int mnt_optstr_get_options(const char *optstr, char **subset,
- const struct mnt_optmap *map, int ignore);
+ const struct libmnt_optmap *map, int ignore);
extern int mnt_optstr_get_flags(const char *optstr, unsigned long *flags,
- const struct mnt_optmap *map);
+ const struct libmnt_optmap *map);
extern int mnt_optstr_apply_flags(char **optstr, unsigned long flags,
- const struct mnt_optmap *map);
+ const struct libmnt_optmap *map);
/* iter.c */
enum {
@@ -174,139 +178,150 @@ enum {
MNT_ITER_FORWARD = 0,
MNT_ITER_BACKWARD
};
-extern mnt_iter *mnt_new_iter(int direction);
-extern void mnt_free_iter(mnt_iter *itr);
-extern void mnt_reset_iter(mnt_iter *itr, int direction);
-extern int mnt_iter_get_direction(mnt_iter *itr);
+extern struct libmnt_iter *mnt_new_iter(int direction);
+extern void mnt_free_iter(struct libmnt_iter *itr);
+extern void mnt_reset_iter(struct libmnt_iter *itr, int direction);
+extern int mnt_iter_get_direction(struct libmnt_iter *itr);
/* optmap.c */
enum {
MNT_LINUX_MAP = 1,
MNT_USERSPACE_MAP
};
-extern const struct mnt_optmap *mnt_get_builtin_optmap(int id);
+extern const struct libmnt_optmap *mnt_get_builtin_optmap(int id);
/* lock.c */
-extern mnt_lock *mnt_new_lock(const char *datafile, pid_t id);
-extern void mnt_free_lock(mnt_lock *ml);
-extern void mnt_unlock_file(mnt_lock *ml);
-extern int mnt_lock_file(mnt_lock *ml);
+extern struct libmnt_lock *mnt_new_lock(const char *datafile, pid_t id);
+extern void mnt_free_lock(struct libmnt_lock *ml);
+extern void mnt_unlock_file(struct libmnt_lock *ml);
+extern int mnt_lock_file(struct libmnt_lock *ml);
/* fs.c */
-extern mnt_fs *mnt_new_fs(void);
-extern void mnt_free_fs(mnt_fs *fs);
-extern mnt_fs *mnt_copy_fs(const mnt_fs *fs);
-extern void *mnt_fs_get_userdata(mnt_fs *fs);
-extern int mnt_fs_set_userdata(mnt_fs *fs, void *data);
-extern const char *mnt_fs_get_source(mnt_fs *fs);
-extern int mnt_fs_set_source(mnt_fs *fs, const char *source);
-extern const char *mnt_fs_get_srcpath(mnt_fs *fs);
-extern int mnt_fs_get_tag(mnt_fs *fs, const char **name, const char **value);
-extern const char *mnt_fs_get_target(mnt_fs *fs);
-extern int mnt_fs_set_target(mnt_fs *fs, const char *target);
-extern const char *mnt_fs_get_fstype(mnt_fs *fs);
-extern int mnt_fs_set_fstype(mnt_fs *fs, const char *fstype);
-
-extern char *mnt_fs_strdup_options(mnt_fs *fs);
-extern int mnt_fs_set_options(mnt_fs *fs, const char *optstr);
-
-extern int mnt_fs_get_option(mnt_fs *fs, const char *name,
+extern struct libmnt_fs *mnt_new_fs(void);
+extern void mnt_free_fs(struct libmnt_fs *fs);
+extern struct libmnt_fs *mnt_copy_fs(const struct libmnt_fs *fs);
+extern void *mnt_fs_get_userdata(struct libmnt_fs *fs);
+extern int mnt_fs_set_userdata(struct libmnt_fs *fs, void *data);
+extern const char *mnt_fs_get_source(struct libmnt_fs *fs);
+extern int mnt_fs_set_source(struct libmnt_fs *fs, const char *source);
+extern const char *mnt_fs_get_srcpath(struct libmnt_fs *fs);
+extern int mnt_fs_get_tag(struct libmnt_fs *fs, const char **name,
+ const char **value);
+extern const char *mnt_fs_get_target(struct libmnt_fs *fs);
+extern int mnt_fs_set_target(struct libmnt_fs *fs, const char *target);
+extern const char *mnt_fs_get_fstype(struct libmnt_fs *fs);
+extern int mnt_fs_set_fstype(struct libmnt_fs *fs, const char *fstype);
+
+extern char *mnt_fs_strdup_options(struct libmnt_fs *fs);
+extern int mnt_fs_set_options(struct libmnt_fs *fs, const char *optstr);
+
+extern int mnt_fs_get_option(struct libmnt_fs *fs, const char *name,
char **value, size_t *valsz);
-extern int mnt_fs_append_options(mnt_fs *fs, const char *optstr);
-extern int mnt_fs_prepend_options(mnt_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);
-extern const char *mnt_fs_get_fs_options(mnt_fs *fs);
-extern int mnt_fs_set_fs_options(mnt_fs *fs, const char *optstr);
-extern int mnt_fs_append_fs_options(mnt_fs *fs, const char *optstr);
-extern int mnt_fs_prepend_fs_options(mnt_fs *fs, const char *optstr);
+extern const char *mnt_fs_get_fs_options(struct libmnt_fs *fs);
+extern int mnt_fs_set_fs_options(struct libmnt_fs *fs, const char *optstr);
+extern int mnt_fs_append_fs_options(struct libmnt_fs *fs, const char *optstr);
+extern int mnt_fs_prepend_fs_options(struct libmnt_fs *fs, const char *optstr);
-extern const char *mnt_fs_get_vfs_options(mnt_fs *fs);
-extern int mnt_fs_set_vfs_options(mnt_fs *fs, const char *optstr);
-extern int mnt_fs_append_vfs_options(mnt_fs *fs, const char *optstr);
-extern int mnt_fs_prepend_vfs_options(mnt_fs *fs, const char *optstr);
+extern const char *mnt_fs_get_vfs_options(struct libmnt_fs *fs);
+extern int mnt_fs_set_vfs_options(struct libmnt_fs *fs, const char *optstr);
+extern int mnt_fs_append_vfs_options(struct libmnt_fs *fs, const char *optstr);
+extern int mnt_fs_prepend_vfs_options(struct libmnt_fs *fs, const char *optstr);
-extern const char *mnt_fs_get_userspace_options(mnt_fs *fs);
-extern int mnt_fs_set_userspace_options(mnt_fs *fs, const char *optstr);
-extern int mnt_fs_append_userspace_options(mnt_fs *fs, const char *optstr);
-extern int mnt_fs_prepend_userspace_options(mnt_fs *fs, const char *optstr);
+extern const char *mnt_fs_get_user_options(struct libmnt_fs *fs);
+extern int mnt_fs_set_user_options(struct libmnt_fs *fs, const char *optstr);
+extern int mnt_fs_append_user_options(struct libmnt_fs *fs, const char *optstr);
+extern int mnt_fs_prepend_user_options(struct libmnt_fs *fs, const char *optstr);
-extern const char *mnt_fs_get_attributes(mnt_fs *fs);
-extern int mnt_fs_set_attributes(mnt_fs *fs, const char *optstr);
-extern int mnt_fs_get_attribute(mnt_fs *fs, const char *name,
+extern const char *mnt_fs_get_attributes(struct libmnt_fs *fs);
+extern int mnt_fs_set_attributes(struct libmnt_fs *fs, const char *optstr);
+extern int mnt_fs_get_attribute(struct libmnt_fs *fs, const char *name,
char **value, size_t *valsz);
-extern int mnt_fs_append_attributes(mnt_fs *fs, const char *optstr);
-extern int mnt_fs_prepend_attributes(mnt_fs *fs, const char *optstr);
-
-extern int mnt_fs_get_freq(mnt_fs *fs);
-extern int mnt_fs_set_freq(mnt_fs *fs, int freq);
-extern int mnt_fs_get_passno(mnt_fs *fs);
-extern int mnt_fs_set_passno(mnt_fs *fs, int passno);
-extern const char *mnt_fs_get_root(mnt_fs *fs);
-extern int mnt_fs_set_root(mnt_fs *fs, const char *root);
-extern const char *mnt_fs_get_bindsrc(mnt_fs *fs);
-extern int mnt_fs_set_bindsrc(mnt_fs *fs, const char *src);
-extern int mnt_fs_get_id(mnt_fs *fs);
-extern int mnt_fs_get_parent_id(mnt_fs *fs);
-extern dev_t mnt_fs_get_devno(mnt_fs *fs);
-
-extern int mnt_fs_match_target(mnt_fs *fs, const char *target, mnt_cache *cache);
-extern int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache);
-extern int mnt_fs_match_fstype(mnt_fs *fs, const char *types);
-extern int mnt_fs_match_options(mnt_fs *fs, const char *options);
-extern int mnt_fs_print_debug(mnt_fs *fs, FILE *file);
+extern int mnt_fs_append_attributes(struct libmnt_fs *fs, const char *optstr);
+extern int mnt_fs_prepend_attributes(struct libmnt_fs *fs, const char *optstr);
+
+extern int mnt_fs_get_freq(struct libmnt_fs *fs);
+extern int mnt_fs_set_freq(struct libmnt_fs *fs, int freq);
+extern int mnt_fs_get_passno(struct libmnt_fs *fs);
+extern int mnt_fs_set_passno(struct libmnt_fs *fs, int passno);
+extern const char *mnt_fs_get_root(struct libmnt_fs *fs);
+extern int mnt_fs_set_root(struct libmnt_fs *fs, const char *root);
+extern const char *mnt_fs_get_bindsrc(struct libmnt_fs *fs);
+extern int mnt_fs_set_bindsrc(struct libmnt_fs *fs, const char *src);
+extern int mnt_fs_get_id(struct libmnt_fs *fs);
+extern int mnt_fs_get_parent_id(struct libmnt_fs *fs);
+extern dev_t mnt_fs_get_devno(struct libmnt_fs *fs);
+
+extern int mnt_fs_match_target(struct libmnt_fs *fs, const char *target,
+ struct libmnt_cache *cache);
+extern int mnt_fs_match_source(struct libmnt_fs *fs, const char *source,
+ struct libmnt_cache *cache);
+extern int mnt_fs_match_fstype(struct libmnt_fs *fs, const char *types);
+extern int mnt_fs_match_options(struct libmnt_fs *fs, const char *options);
+extern int mnt_fs_print_debug(struct libmnt_fs *fs, FILE *file);
extern void mnt_free_mntent(struct mntent *mnt);
-extern int mnt_fs_to_mntent(mnt_fs *fs, struct mntent **mnt);
+extern int mnt_fs_to_mntent(struct libmnt_fs *fs, struct mntent **mnt);
/* tab-parse.c */
-extern mnt_tab *mnt_new_tab_from_file(const char *filename);
-extern mnt_tab *mnt_new_tab_from_dir(const char *dirname);
-extern int mnt_tab_parse_stream(mnt_tab *tb, FILE *f, const char *filename);
-extern int mnt_tab_parse_file(mnt_tab *tb, const char *filename);
-extern int mnt_tab_parse_fstab(mnt_tab *tb, const char *filename);
-extern int mnt_tab_parse_mtab(mnt_tab *tb, const char *filename);
-extern int mnt_tab_set_parser_errcb(mnt_tab *tb,
- int (*cb)(mnt_tab *tb, const char *filename, int line));
+extern struct libmnt_table *mnt_new_table_from_file(const char *filename);
+extern struct libmnt_table *mnt_new_table_from_dir(const char *dirname);
+extern int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f,
+ const char *filename);
+extern int mnt_table_parse_file(struct libmnt_table *tb, const char *filename);
+extern int mnt_table_parse_fstab(struct libmnt_table *tb, const char *filename);
+extern int mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename);
+extern int mnt_table_set_parser_errcb(struct libmnt_table *tb,
+ int (*cb)(struct libmnt_table *tb, const char *filename, int line));
/* tab.c */
-extern mnt_tab *mnt_new_tab(void);
-extern void mnt_free_tab(mnt_tab *tb);
-extern int mnt_tab_get_nents(mnt_tab *tb);
-extern int mnt_tab_set_cache(mnt_tab *tb, mnt_cache *mpc);
-extern mnt_cache *mnt_tab_get_cache(mnt_tab *tb);
-extern const char *mnt_tab_get_name(mnt_tab *tb);
-extern int mnt_tab_add_fs(mnt_tab *tb, mnt_fs *fs);
-extern int mnt_tab_remove_fs(mnt_tab *tb, mnt_fs *fs);
-extern int mnt_tab_next_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs **fs);
-extern int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr,
- mnt_fs *parent, mnt_fs **chld);
-extern int mnt_tab_get_root_fs(mnt_tab *tb, mnt_fs **root);
-extern int mnt_tab_set_iter(mnt_tab *tb, mnt_iter *itr, mnt_fs *fs);
-
-extern mnt_fs *mnt_tab_find_target(mnt_tab *tb, const char *path, int direction);
-extern mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction);
-extern mnt_fs *mnt_tab_find_tag(mnt_tab *tb, const char *tag,
+extern struct libmnt_table *mnt_new_table(void);
+extern void mnt_free_table(struct libmnt_table *tb);
+extern int mnt_table_get_nents(struct libmnt_table *tb);
+extern int mnt_table_set_cache(struct libmnt_table *tb, struct libmnt_cache *mpc);
+extern struct libmnt_cache *mnt_table_get_cache(struct libmnt_table *tb);
+extern const char *mnt_table_get_name(struct libmnt_table *tb);
+extern int mnt_table_add_fs(struct libmnt_table *tb, struct libmnt_fs *fs);
+extern int mnt_table_remove_fs(struct libmnt_table *tb, struct libmnt_fs *fs);
+extern int mnt_table_next_fs(struct libmnt_table *tb, struct libmnt_iter *itr,
+ struct libmnt_fs **fs);
+extern int mnt_table_next_child_fs(struct libmnt_table *tb, struct libmnt_iter *itr,
+ struct libmnt_fs *parent, struct libmnt_fs **chld);
+extern int mnt_table_get_root_fs(struct libmnt_table *tb, struct libmnt_fs **root);
+extern int mnt_table_set_iter(struct libmnt_table *tb, struct libmnt_iter *itr,
+ struct libmnt_fs *fs);
+
+extern struct libmnt_fs *mnt_table_find_target(struct libmnt_table *tb,
+ const char *path, int direction);
+extern struct libmnt_fs *mnt_table_find_srcpath(struct libmnt_table *tb,
+ const char *path, int direction);
+extern struct libmnt_fs *mnt_table_find_tag(struct libmnt_table *tb, const char *tag,
const char *val, int direction);
-extern mnt_fs *mnt_tab_find_source(mnt_tab *tb, const char *source, int direction);
-extern mnt_fs *mnt_tab_find_pair(mnt_tab *tb, const char *source,
+extern struct libmnt_fs *mnt_table_find_source(struct libmnt_table *tb,
+ const char *source, int direction);
+extern struct libmnt_fs *mnt_table_find_pair(struct libmnt_table *tb,
+ const char *source,
const char *target, int direction);
-extern int mnt_tab_find_next_fs(mnt_tab *tb, mnt_iter *itr,
- int (*match_func)(mnt_fs *, void *), void *userdata,
- mnt_fs **fs);
+extern int mnt_table_find_next_fs(struct libmnt_table *tb,
+ struct libmnt_iter *itr,
+ int (*match_func)(struct libmnt_fs *, void *), void *userdata,
+ struct libmnt_fs **fs);
/* tab_update.c */
-extern mnt_update *mnt_new_update(void);
-extern void mnt_free_update(mnt_update *upd);
-extern int mnt_update_is_ready(mnt_update *upd);
-extern int mnt_update_set_fs(mnt_update *upd, unsigned long mountflags,
- const char *target, mnt_fs *fs);
-extern int mnt_update_tab(mnt_update *upd, mnt_lock *lc);
-extern unsigned long mnt_update_get_mountflags(mnt_update *upd);
-extern int mnt_update_force_rdonly(mnt_update *upd, int rdonly);
-extern const char *mnt_update_get_filename(mnt_update *upd);
-extern mnt_fs *mnt_update_get_fs(mnt_update *upd);
+extern struct libmnt_update *mnt_new_update(void);
+extern void mnt_free_update(struct libmnt_update *upd);
+extern int mnt_update_is_ready(struct libmnt_update *upd);
+extern int mnt_update_set_fs(struct libmnt_update *upd, unsigned long mflags,
+ const char *target, struct libmnt_fs *fs);
+extern int mnt_update_table(struct libmnt_update *upd, struct libmnt_lock *lc);
+extern unsigned long mnt_update_get_mflags(struct libmnt_update *upd);
+extern int mnt_update_force_rdonly(struct libmnt_update *upd, int rdonly);
+extern const char *mnt_update_get_filename(struct libmnt_update *upd);
+extern struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd);
/* context.c */
@@ -328,69 +343,82 @@ enum {
MNT_OMODE_USER = (MNT_OMODE_REPLACE | MNT_OMODE_FORCE | MNT_OMODE_FSTAB)
};
-extern mnt_context *mnt_new_context(void);
-extern void mnt_free_context(mnt_context *cxt);
-extern int mnt_reset_context(mnt_context *cxt);
-extern int mnt_context_is_restricted(mnt_context *cxt);
-
-extern int mnt_context_init_helper(mnt_context *cxt, int flags)
-extern int mnt_context_mounthelper_setopt(mnt_context *cxt, int c, char *arg);
-
-extern int mnt_context_set_optsmode(mnt_context *cxt, int mode);
-extern int mnt_context_disable_canonicalize(mnt_context *cxt, int disable);
-extern int mnt_context_enable_lazy(mnt_context *cxt, int enable);
-extern int mnt_context_enable_rdonly_umount(mnt_context *cxt, int enable);
-extern int mnt_context_disable_helpers(mnt_context *cxt, int disable);
-extern int mnt_context_enable_sloppy(mnt_context *cxt, int enable);
-extern int mnt_context_enable_fake(mnt_context *cxt, int enable);
-extern int mnt_context_disable_mtab(mnt_context *cxt, int disable);
-extern int mnt_context_enable_force(mnt_context *cxt, int enable);
-extern int mnt_context_enable_verbose(mnt_context *cxt, int enable);
-extern int mnt_context_enable_loopdel(mnt_context *cxt, int enable);
-
-extern int mnt_context_get_optsmode(mnt_context *cxt);
-extern int mnt_context_is_lazy(mnt_context *cxt);
-extern int mnt_context_is_rdonly_umount(mnt_context *cxt);
-extern int mnt_context_is_sloppy(mnt_context *cxt);
-extern int mnt_context_is_fake(mnt_context *cxt);
-extern int mnt_context_is_nomtab(mnt_context *cxt);
-extern int mnt_context_is_force(mnt_context *cxt);
-extern int mnt_context_is_verbose(mnt_context *cxt);
-
-extern int mnt_context_set_fs(mnt_context *cxt, mnt_fs *fs);
-extern mnt_fs *mnt_context_get_fs(mnt_context *cxt);
-extern int mnt_context_set_source(mnt_context *cxt, const char *source);
-extern int mnt_context_set_target(mnt_context *cxt, const char *target);
-extern int mnt_context_set_fstype(mnt_context *cxt, const char *fstype);
-extern int mnt_context_set_options(mnt_context *cxt, const char *optstr);
-extern int mnt_context_append_options(mnt_context *cxt, const char *optstr);
-extern int mnt_context_set_fstype_pattern(mnt_context *cxt, const char *pattern);
-extern int mnt_context_set_options_pattern(mnt_context *cxt, const char *pattern);
-
-extern int mnt_context_set_fstab(mnt_context *cxt, mnt_tab *tb);
-extern int mnt_context_get_fstab(mnt_context *cxt, mnt_tab **tb);
-extern int mnt_context_get_mtab(mnt_context *cxt, mnt_tab **tb);
-extern int mnt_context_set_cache(mnt_context *cxt, mnt_cache *cache);
-extern mnt_cache *mnt_context_get_cache(mnt_context *cxt);
-extern mnt_lock *mnt_context_get_lock(mnt_context *cxt);
-
-extern int mnt_context_set_mountflags(mnt_context *cxt, unsigned long flags);
-extern int mnt_context_get_mountflags(mnt_context *cxt, unsigned long *flags);
-extern int mnt_context_set_userspace_mountflags(mnt_context *cxt, unsigned long flags);
-extern int mnt_context_get_userspace_mountflags(mnt_context *cxt, unsigned long *flags);
-
-extern int mnt_context_set_mountdata(mnt_context *cxt, void *data);
-extern int mnt_context_apply_fstab(mnt_context *cxt);
-extern int mnt_context_get_status(mnt_context *cxt);
-extern int mnt_context_strerror(mnt_context *cxt, char *buf, size_t bufsiz);
-
-extern int mnt_mount_context(mnt_context *cxt);
-
-extern int mnt_context_prepare_mount(mnt_context *cxt);
-extern int mnt_context_do_mount(mnt_context *cxt);
-extern int mnt_context_finalize_mount(mnt_context *cxt);
-
-extern int mnt_context_do_umount(mnt_context *cxt);
+extern struct libmnt_context *mnt_new_context(void);
+extern void mnt_free_context(struct libmnt_context *cxt);
+extern int mnt_reset_context(struct libmnt_context *cxt);
+extern int mnt_context_is_restricted(struct libmnt_context *cxt);
+
+extern int mnt_context_init_helper(struct libmnt_context *cxt, int flags);
+extern int mnt_context_mounthelper_setopt(struct libmnt_context *cxt, int c,
+ char *arg);
+
+extern int mnt_context_set_optsmode(struct libmnt_context *cxt, int mode);
+extern int mnt_context_disable_canonicalize(struct libmnt_context *cxt, int disable);
+extern int mnt_context_enable_lazy(struct libmnt_context *cxt, int enable);
+extern int mnt_context_enable_rdonly_umount(struct libmnt_context *cxt, int enable);
+extern int mnt_context_disable_helpers(struct libmnt_context *cxt, int disable);
+extern int mnt_context_enable_sloppy(struct libmnt_context *cxt, int enable);
+extern int mnt_context_enable_fake(struct libmnt_context *cxt, int enable);
+extern int mnt_context_disable_mtab(struct libmnt_context *cxt, int disable);
+extern int mnt_context_enable_force(struct libmnt_context *cxt, int enable);
+extern int mnt_context_enable_verbose(struct libmnt_context *cxt, int enable);
+extern int mnt_context_enable_loopdel(struct libmnt_context *cxt, int enable);
+
+extern int mnt_context_get_optsmode(struct libmnt_context *cxt);
+extern int mnt_context_is_lazy(struct libmnt_context *cxt);
+extern int mnt_context_is_rdonly_umount(struct libmnt_context *cxt);
+extern int mnt_context_is_sloppy(struct libmnt_context *cxt);
+extern int mnt_context_is_fake(struct libmnt_context *cxt);
+extern int mnt_context_is_nomtab(struct libmnt_context *cxt);
+extern int mnt_context_is_force(struct libmnt_context *cxt);
+extern int mnt_context_is_verbose(struct libmnt_context *cxt);
+
+extern int mnt_context_set_fs(struct libmnt_context *cxt, struct libmnt_fs *fs);
+extern struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt);
+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 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);
+extern int mnt_context_set_fstype_pattern(struct libmnt_context *cxt,
+ const char *pattern);
+extern int mnt_context_set_options_pattern(struct libmnt_context *cxt,
+ const char *pattern);
+
+extern int mnt_context_set_fstab(struct libmnt_context *cxt,
+ struct libmnt_table *tb);
+extern int mnt_context_get_fstab(struct libmnt_context *cxt,
+ struct libmnt_table **tb);
+extern int mnt_context_get_mtab(struct libmnt_context *cxt,
+ struct libmnt_table **tb);
+extern int mnt_context_set_cache(struct libmnt_context *cxt,
+ struct libmnt_cache *cache);
+extern struct libmnt_cache *mnt_context_get_cache(struct libmnt_context *cxt);
+extern struct libmnt_lock *mnt_context_get_lock(struct libmnt_context *cxt);
+
+extern int mnt_context_set_mflags(struct libmnt_context *cxt,
+ unsigned long flags);
+extern int mnt_context_get_mflags(struct libmnt_context *cxt,
+ unsigned long *flags);
+extern int mnt_context_set_user_mflags(struct libmnt_context *cxt,
+ unsigned long flags);
+extern int mnt_context_get_user_mflags(struct libmnt_context *cxt,
+ unsigned long *flags);
+
+extern int mnt_context_set_mountdata(struct libmnt_context *cxt, void *data);
+extern int mnt_context_apply_fstab(struct libmnt_context *cxt);
+extern int mnt_context_get_status(struct libmnt_context *cxt);
+extern int mnt_context_strerror(struct libmnt_context *cxt, char *buf,
+ size_t bufsiz);
+
+extern int mnt_mount_context(struct libmnt_context *cxt);
+
+extern int mnt_context_prepare_mount(struct libmnt_context *cxt);
+extern int mnt_context_do_mount(struct libmnt_context *cxt);
+extern int mnt_context_finalize_mount(struct libmnt_context *cxt);
+
+extern int mnt_context_do_umount(struct libmnt_context *cxt);
/*
* mount(8) userspace options masks (MNT_MAP_USERSPACE map)
diff --git a/shlibs/mount/src/lock.c b/shlibs/mount/src/lock.c
index 4ba59fe4..ef7498d9 100644
--- a/shlibs/mount/src/lock.c
+++ b/shlibs/mount/src/lock.c
@@ -35,7 +35,7 @@
/*
* lock handler
*/
-struct _mnt_lock {
+struct libmnt_lock {
char *lockfile; /* path to lock file (e.g. /etc/mtab~) */
char *linkfile; /* path to link file (e.g. /etc/mtab~.<id>) */
int lockfile_fd; /* lock file descriptor */
@@ -50,9 +50,9 @@ struct _mnt_lock {
*
* Returns: newly allocated lock handler or NULL on case of error.
*/
-mnt_lock *mnt_new_lock(const char *datafile, pid_t id)
+struct libmnt_lock *mnt_new_lock(const char *datafile, pid_t id)
{
- mnt_lock *ml = NULL;
+ struct libmnt_lock *ml = NULL;
char *lo = NULL, *ln = NULL;
/* lockfile */
@@ -67,7 +67,7 @@ mnt_lock *mnt_new_lock(const char *datafile, pid_t id)
ln = NULL;
goto err;
}
- ml = calloc(1, sizeof(struct _mnt_lock) );
+ ml = calloc(1, sizeof(*ml) );
if (!ml)
goto err;
@@ -87,11 +87,11 @@ err:
/**
* mnt_free_lock:
- * @ml: mnt_lock handler
+ * @ml: struct libmnt_lock handler
*
* Deallocates mnt_lock.
*/
-void mnt_free_lock(mnt_lock *ml)
+void mnt_free_lock(struct libmnt_lock *ml)
{
if (!ml)
return;
@@ -104,7 +104,7 @@ void mnt_free_lock(mnt_lock *ml)
/*
* Returns path to lockfile.
*/
-static const char *mnt_lock_get_lockfile(mnt_lock *ml)
+static const char *mnt_lock_get_lockfile(struct libmnt_lock *ml)
{
return ml ? ml->lockfile : NULL;
}
@@ -115,7 +115,7 @@ static const char *mnt_lock_get_lockfile(mnt_lock *ml)
*
* Returns: unique (per process/thread) path to linkfile.
*/
-static const char *mnt_lock_get_linkfile(mnt_lock *ml)
+static const char *mnt_lock_get_linkfile(struct libmnt_lock *ml)
{
return ml ? ml->linkfile : NULL;
}
@@ -131,7 +131,7 @@ static void mnt_lockalrm_handler(int sig)
*
* Returns: 0 on success, 1 on timeout, -errno on error.
*/
-static int mnt_wait_lock(mnt_lock *ml, struct flock *fl, time_t maxtime)
+static int mnt_wait_lock(struct libmnt_lock *ml, struct flock *fl, time_t maxtime)
{
struct timeval now;
struct sigaction sa, osa;
@@ -220,7 +220,7 @@ static int mnt_wait_lock(mnt_lock *ml, struct flock *fl, time_t maxtime)
* Unlocks the file. The function could be called independently on the
* lock status (for example from exit(3)).
*/
-void mnt_unlock_file(mnt_lock *ml)
+void mnt_unlock_file(struct libmnt_lock *ml)
{
if (!ml)
return;
@@ -257,7 +257,7 @@ void mnt_unlock_file(mnt_lock *ml)
/**
* mnt_lock_file
- * @ml: pointer to mnt_lock instance
+ * @ml: pointer to struct libmnt_lock instance
*
* Creates lock file (e.g. /etc/mtab~). Note that this function uses
* alarm().
@@ -276,7 +276,7 @@ void mnt_unlock_file(mnt_lock *ml)
*
* <informalexample>
* <programlisting>
- * mnt_lock *ml;
+ * struct libmnt_lock *ml;
*
* void unlock_fallback(void)
* {
@@ -317,7 +317,7 @@ void mnt_unlock_file(mnt_lock *ml)
* Returns: 0 on success or negative number in case of error (-ETIMEOUT is case
* of stale lock file).
*/
-int mnt_lock_file(mnt_lock *ml)
+int mnt_lock_file(struct libmnt_lock *ml)
{
int i, rc = -1;
struct timespec waittime;
@@ -431,7 +431,7 @@ failed:
#ifdef TEST_PROGRAM
#include <err.h>
-mnt_lock *lock;
+struct libmnt_lock *lock;
/*
* read number from @filename, increment the number and
@@ -476,7 +476,7 @@ void sig_handler(int sig)
errx(EXIT_FAILURE, "\n%d: catch signal: %s\n", getpid(), strsignal(sig));
}
-int test_lock(struct mtest *ts, int argc, char *argv[])
+int test_lock(struct libmnt_test *ts, int argc, char *argv[])
{
time_t synctime = 0;
unsigned int usecs;
@@ -567,7 +567,7 @@ int test_lock(struct mtest *ts, int argc, char *argv[])
*/
int main(int argc, char *argv[])
{
- struct mtest tss[] = {
+ struct libmnt_test tss[] = {
{ "--lock", test_lock, " [--synctime <time_t>] [--verbose] <datafile> <loops> "
"increment a number in datafile" },
{ NULL }
diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym
index 1a9ebb02..34174ec5 100644
--- a/shlibs/mount/src/mount.sym
+++ b/shlibs/mount/src/mount.sym
@@ -27,11 +27,11 @@ global:
mnt_context_get_fs;
mnt_context_get_fstab;
mnt_context_get_lock;
- mnt_context_get_mountflags;
+ mnt_context_get_mflags;
mnt_context_get_mtab;
mnt_context_get_optsmode;
mnt_context_get_status;
- mnt_context_get_userspace_mountflags;
+ mnt_context_get_user_mflags;
mnt_context_init_helper;
mnt_context_is_fake;
mnt_context_is_force;
@@ -49,13 +49,13 @@ global:
mnt_context_set_fstype;
mnt_context_set_fstype_pattern;
mnt_context_set_mountdata;
- mnt_context_set_mountflags;
+ mnt_context_set_mflags;
mnt_context_set_options;
mnt_context_set_options_pattern;
mnt_context_set_optsmode;
mnt_context_set_source;
mnt_context_set_target;
- mnt_context_set_userspace_mountflags;
+ mnt_context_set_user_mflags;
mnt_context_strerror;
mnt_copy_fs;
mnt_free_cache;
@@ -64,12 +64,12 @@ global:
mnt_free_iter;
mnt_free_lock;
mnt_free_mntent;
- mnt_free_tab;
+ mnt_free_table;
mnt_free_update;
mnt_fs_append_attributes;
mnt_fs_append_fs_options;
mnt_fs_append_options;
- mnt_fs_append_userspace_options;
+ mnt_fs_append_user_options;
mnt_fs_append_vfs_options;
mnt_fs_get_attribute;
mnt_fs_get_attributes;
@@ -88,7 +88,7 @@ global:
mnt_fs_get_tag;
mnt_fs_get_target;
mnt_fs_get_userdata;
- mnt_fs_get_userspace_options;
+ mnt_fs_get_user_options;
mnt_fs_get_vfs_options;
mnt_fs_match_fstype;
mnt_fs_match_options;
@@ -97,7 +97,7 @@ global:
mnt_fs_prepend_attributes;
mnt_fs_prepend_fs_options;
mnt_fs_prepend_options;
- mnt_fs_prepend_userspace_options;
+ mnt_fs_prepend_user_options;
mnt_fs_prepend_vfs_options;
mnt_fs_print_debug;
mnt_fs_set_attributes;
@@ -111,7 +111,7 @@ global:
mnt_fs_set_source;
mnt_fs_set_target;
mnt_fs_set_userdata;
- mnt_fs_set_userspace_options;
+ mnt_fs_set_user_options;
mnt_fs_set_vfs_options;
mnt_fs_strdup_options;
mnt_fs_to_mntent;
@@ -135,9 +135,9 @@ global:
mnt_new_fs;
mnt_new_iter;
mnt_new_lock;
- mnt_new_tab;
- mnt_new_tab_from_dir;
- mnt_new_tab_from_file;
+ mnt_new_table;
+ mnt_new_table_from_dir;
+ mnt_new_table_from_file;
mnt_new_update;
mnt_optstr_append_option;
mnt_optstr_apply_flags;
@@ -155,36 +155,36 @@ global:
mnt_resolve_spec;
mnt_resolve_tag;
mnt_split_optstr;
- mnt_tab_add_fs;
- mnt_tab_find_next_fs;
- mnt_tab_find_pair;
- mnt_tab_find_source;
- mnt_tab_find_srcpath;
- mnt_tab_find_tag;
- mnt_tab_find_target;
- mnt_tab_get_cache;
- mnt_tab_get_name;
- mnt_tab_get_nents;
- mnt_tab_get_root_fs;
- mnt_tab_next_child_fs;
- mnt_tab_next_fs;
- mnt_tab_parse_file;
- mnt_tab_parse_fstab;
- mnt_tab_parse_mtab;
- mnt_tab_parse_stream;
- mnt_tab_remove_fs;
- mnt_tab_set_cache;
- mnt_tab_set_iter;
- mnt_tab_set_parser_errcb;
+ mnt_table_add_fs;
+ mnt_table_find_next_fs;
+ mnt_table_find_pair;
+ mnt_table_find_source;
+ mnt_table_find_srcpath;
+ mnt_table_find_tag;
+ mnt_table_find_target;
+ mnt_table_get_cache;
+ mnt_table_get_name;
+ mnt_table_get_nents;
+ mnt_table_get_root_fs;
+ mnt_table_next_child_fs;
+ mnt_table_next_fs;
+ mnt_table_parse_file;
+ mnt_table_parse_fstab;
+ mnt_table_parse_mtab;
+ mnt_table_parse_stream;
+ mnt_table_remove_fs;
+ mnt_table_set_cache;
+ mnt_table_set_iter;
+ mnt_table_set_parser_errcb;
mnt_unlock_file;
mnt_unmangle;
mnt_update_force_rdonly;
mnt_update_get_filename;
mnt_update_get_fs;
- mnt_update_get_mountflags;
+ mnt_update_get_mflags;
mnt_update_is_ready;
mnt_update_set_fs;
- mnt_update_tab;
+ mnt_update_table;
local:
*;
};
diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h
index 5b8c89c5..879d58c6 100644
--- a/shlibs/mount/src/mountP.h
+++ b/shlibs/mount/src/mountP.h
@@ -97,14 +97,14 @@ mnt_debug_h(void *handler, const char *mesg, ...)
#define MNT_UTAB_HEADER "# libmount utab file\n"
#ifdef TEST_PROGRAM
-struct mtest {
+struct libmnt_test {
const char *name;
- int (*body)(struct mtest *ts, int argc, char *argv[]);
+ int (*body)(struct libmnt_test *ts, int argc, char *argv[]);
const char *usage;
};
/* test.c */
-extern int mnt_run_test(struct mtest *tests, int argc, char *argv[]);
+extern int mnt_run_test(struct libmnt_test *tests, int argc, char *argv[]);
#endif
/* utils.c */
@@ -128,7 +128,7 @@ extern void mnt_free_filesystems(char **filesystems);
/*
* Generic iterator
*/
-struct _mnt_iter {
+struct libmnt_iter {
struct list_head *p; /* current position */
struct list_head *head; /* start position */
int direction; /* MNT_ITER_{FOR,BACK}WARD */
@@ -156,7 +156,7 @@ struct _mnt_iter {
* This struct represents one entry in mtab/fstab/mountinfo file.
* (note that fstab[1] means the first column from fstab, and so on...)
*/
-struct _mnt_fs {
+struct libmnt_fs {
struct list_head ents;
int id; /* mountinfo[1]: ID */
@@ -197,18 +197,19 @@ struct _mnt_fs {
/*
* mtab/fstab/mountinfo file
*/
-struct _mnt_tab {
+struct libmnt_table {
int fmt; /* MNT_FMT_* file format */
int nents; /* number of valid entries */
- mnt_cache *cache; /* canonicalized paths/tags cache */
+ struct libmnt_cache *cache; /* canonicalized paths/tags cache */
- int (*errcb)(mnt_tab *tb, const char *filename, int line);
+ int (*errcb)(struct libmnt_table *tb,
+ const char *filename, int line);
- struct list_head ents; /* list of entries (mentry) */
+ struct list_head ents; /* list of entries (libmnt_fs) */
};
-extern mnt_tab *__mnt_new_tab_from_file(const char *filename, int fmt);
+extern struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt);
/*
* Tab file format
@@ -225,7 +226,7 @@ enum {
/*
* Mount context -- high-level API
*/
-struct _mnt_context
+struct libmnt_context
{
int action; /* MNT_ACT_{MOUNT,UMOUNT} */
int restricted; /* root or not? */
@@ -233,10 +234,11 @@ struct _mnt_context
char *fstype_pattern; /* for mnt_match_fstype() */
char *optstr_pattern; /* for mnt_match_options() */
- mnt_fs *fs; /* filesystem description (type, mountpopint, device, ...) */
+ struct libmnt_fs *fs; /* filesystem description (type, mountpopint, device, ...) */
+
+ struct libmnt_table *fstab; /* fstab (or mtab for some remounts) entires */
+ struct libmnt_table *mtab; /* mtab entries */
- mnt_tab *fstab; /* fstab (or mtab for some remounts) entires */
- mnt_tab *mtab; /* mtab entries */
int optsmode; /* fstab optstr mode MNT_OPTSMODE_{AUTO,FORCE,IGNORE} */
unsigned long mountflags; /* final mount(2) flags */
@@ -244,9 +246,9 @@ struct _mnt_context
unsigned long user_mountflags; /* MNT_MS_* (loop=, user=, ...) */
- mnt_cache *cache; /* paths cache */
- mnt_lock *lock; /* mtab lock */
- mnt_update *update;/* mtab/utab update */
+ struct libmnt_cache *cache; /* paths cache */
+ struct libmnt_lock *lock; /* mtab lock */
+ struct libmnt_update *update;/* mtab/utab update */
const char *mtab_path; /* writable mtab */
int mtab_writable; /* ismtab writeable */
@@ -293,9 +295,11 @@ struct _mnt_context
#define MNT_FL_DEFAULT 0
/* optmap.c */
-extern const struct mnt_optmap *mnt_optmap_get_entry(struct mnt_optmap const **maps,
+extern const struct libmnt_optmap *mnt_optmap_get_entry(
+ struct libmnt_optmap const **maps,
int nmaps, const char *name,
- size_t namelen, const struct mnt_optmap **mapent);
+ size_t namelen,
+ const struct libmnt_optmap **mapent);
/* optstr.c */
extern int mnt_optstr_remove_option_at(char **optstr, char *begin, char *end);
@@ -305,22 +309,24 @@ extern int mnt_optstr_fix_secontext(char **optstr, char *value, size_t valsz, ch
extern int mnt_optstr_fix_user(char **optstr);
/* fs.c */
-extern mnt_fs *mnt_copy_mtab_fs(const mnt_fs *fs);
-extern int __mnt_fs_set_source_ptr(mnt_fs *fs, char *source);
-extern int __mnt_fs_set_fstype_ptr(mnt_fs *fs, char *fstype);
+extern struct libmnt_fs *mnt_copy_mtab_fs(const struct libmnt_fs *fs);
+extern int __mnt_fs_set_source_ptr(struct libmnt_fs *fs, char *source);
+extern int __mnt_fs_set_fstype_ptr(struct libmnt_fs *fs, char *fstype);
/* context.c */
-extern int mnt_context_prepare_srcpath(mnt_context *cxt);
-extern int mnt_context_prepare_target(mnt_context *cxt);
-extern int mnt_context_guess_fstype(mnt_context *cxt);
-extern int mnt_context_prepare_helper(mnt_context *cxt, const char *name, const char *type);
-extern int mnt_context_prepare_update(mnt_context *cxt);
-extern mnt_fs *mnt_context_get_fs(mnt_context *cxt);
-extern int mnt_context_merge_mountflags(mnt_context *cxt);
-extern int mnt_context_update_tabs(mnt_context *cxt);
+extern int mnt_context_prepare_srcpath(struct libmnt_context *cxt);
+extern int mnt_context_prepare_target(struct libmnt_context *cxt);
+extern int mnt_context_guess_fstype(struct libmnt_context *cxt);
+extern int mnt_context_prepare_helper(struct libmnt_context *cxt,
+ const char *name, const char *type);
+extern int mnt_context_prepare_update(struct libmnt_context *cxt);
+extern struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt);
+extern int mnt_context_merge_mflags(struct libmnt_context *cxt);
+extern int mnt_context_update_tabs(struct libmnt_context *cxt);
/* tab_update.c */
-extern mnt_fs *mnt_update_get_fs(mnt_update *upd);
-extern int mnt_update_set_filename(mnt_update *upd, const char *filename, int userspace_only);
+extern struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd);
+extern int mnt_update_set_filename(struct libmnt_update *upd,
+ const char *filename, int userspace_only);
#endif /* _LIBMOUNT_PRIVATE_H */
diff --git a/shlibs/mount/src/optmap.c b/shlibs/mount/src/optmap.c
index 307a5d4b..368f2a64 100644
--- a/shlibs/mount/src/optmap.c
+++ b/shlibs/mount/src/optmap.c
@@ -39,7 +39,7 @@
* #define MY_MS_FOO (1 << 1)
* #define MY_MS_BAR (1 << 2)
*
- * mnt_optmap myoptions[] = {
+ * libmnt_optmap myoptions[] = {
* { "foo", MY_MS_FOO },
* { "nofoo", MY_MS_FOO | MNT_INVERT },
* { "bar=", MY_MS_BAR },
@@ -68,7 +68,7 @@
/*
* fs-independent mount flags (built-in MNT_LINUX_MAP)
*/
-static const struct mnt_optmap linux_flags_map[] =
+static const struct libmnt_optmap linux_flags_map[] =
{
{ "ro", MS_RDONLY }, /* read-only */
{ "rw", MS_RDONLY, MNT_INVERT }, /* read-write */
@@ -126,7 +126,7 @@ static const struct mnt_optmap linux_flags_map[] =
*
* TODO: offset=, sizelimit=, encryption=, vfs=
*/
-static const struct mnt_optmap userspace_opts_map[] =
+static const struct libmnt_optmap userspace_opts_map[] =
{
{ "defaults", 0, 0 }, /* default options */
@@ -170,7 +170,7 @@ static const struct mnt_optmap userspace_opts_map[] =
*
* Returns: static built-in libmount map.
*/
-const struct mnt_optmap *mnt_get_builtin_optmap(int id)
+const struct libmnt_optmap *mnt_get_builtin_optmap(int id)
{
assert(id);
@@ -185,12 +185,12 @@ const struct mnt_optmap *mnt_get_builtin_optmap(int id)
* Lookups for the @name in @maps and returns a map and in @mapent
* returns the map entry
*/
-const struct mnt_optmap *mnt_optmap_get_entry(
- struct mnt_optmap const **maps,
+const struct libmnt_optmap *mnt_optmap_get_entry(
+ struct libmnt_optmap const **maps,
int nmaps,
const char *name,
size_t namelen,
- const struct mnt_optmap **mapent)
+ const struct libmnt_optmap **mapent)
{
int i;
@@ -203,8 +203,8 @@ const struct mnt_optmap *mnt_optmap_get_entry(
*mapent = NULL;
for (i = 0; i < nmaps; i++) {
- const struct mnt_optmap *map = maps[i];
- const struct mnt_optmap *ent;
+ const struct libmnt_optmap *map = maps[i];
+ const struct libmnt_optmap *ent;
const char *p;
for (ent = map; ent && ent->name; ent++) {
diff --git a/shlibs/mount/src/optstr.c b/shlibs/mount/src/optstr.c
index 8689dfb6..9c8aa62e 100644
--- a/shlibs/mount/src/optstr.c
+++ b/shlibs/mount/src/optstr.c
@@ -33,7 +33,7 @@
/*
* Option location
*/
-struct mnt_optloc {
+struct libmnt_optloc {
char *begin;
char *end;
char *value;
@@ -41,7 +41,7 @@ struct mnt_optloc {
size_t namesz;
};
-#define mnt_init_optloc(_ol) (memset((_ol), 0, sizeof(struct mnt_optloc)))
+#define mnt_init_optloc(_ol) (memset((_ol), 0, sizeof(struct libmnt_optloc)))
/*
* Parses the first option from @optstr. The @optstr pointer is set to begin of
@@ -117,7 +117,7 @@ error:
* Returns negative number on parse error, 1 when not found and 0 on success.
*/
static int mnt_optstr_locate_option(char *optstr, const char *name,
- struct mnt_optloc *ol)
+ struct libmnt_optloc *ol)
{
char *n;
size_t namesz, nsz;
@@ -276,7 +276,7 @@ int mnt_optstr_prepend_option(char **optstr, const char *name, const char *value
int mnt_optstr_get_option(char *optstr, const char *name,
char **value, size_t *valsz)
{
- struct mnt_optloc ol;
+ struct libmnt_optloc ol;
int rc;
mnt_init_optloc(&ol);
@@ -371,7 +371,7 @@ static int insert_value(char **str, char *pos, const char *substr, char **next)
*/
int mnt_optstr_set_option(char **optstr, const char *name, const char *value)
{
- struct mnt_optloc ol;
+ struct libmnt_optloc ol;
char *nameend;
int rc = 1;
@@ -418,7 +418,7 @@ int mnt_optstr_set_option(char **optstr, const char *name, const char *value)
*/
int mnt_optstr_remove_option(char **optstr, const char *name)
{
- struct mnt_optloc ol;
+ struct libmnt_optloc ol;
int rc;
mnt_init_optloc(&ol);
@@ -452,11 +452,12 @@ int mnt_optstr_remove_option(char **optstr, const char *name)
*
* Returns: 0 on success, or negative number in case of error.
*/
-int mnt_split_optstr(const char *optstr, char **user, char **vfs, char **fs, int ignore_user, int ignore_vfs)
+int mnt_split_optstr(const char *optstr, char **user, char **vfs,
+ char **fs, int ignore_user, int ignore_vfs)
{
char *name, *val, *str = (char *) optstr;
size_t namesz, valsz;
- struct mnt_optmap const *maps[2];
+ struct libmnt_optmap const *maps[2];
assert(optstr);
@@ -475,8 +476,8 @@ int mnt_split_optstr(const char *optstr, char **user, char **vfs, char **fs, int
while(!mnt_optstr_next_option(&str, &name, &namesz, &val, &valsz)) {
int rc = 0;
- const struct mnt_optmap *ent;
- const struct mnt_optmap *m =
+ const struct libmnt_optmap *ent;
+ const struct libmnt_optmap *m =
mnt_optmap_get_entry(maps, 2, name, namesz, &ent);
if (ent && !ent->id)
@@ -528,9 +529,9 @@ int mnt_split_optstr(const char *optstr, char **user, char **vfs, char **fs, int
* Returns: 0 on success, or negative number in case of error.
*/
int mnt_optstr_get_options(const char *optstr, char **subset,
- const struct mnt_optmap *map, int ignore)
+ const struct libmnt_optmap *map, int ignore)
{
- struct mnt_optmap const *maps[1];
+ struct libmnt_optmap const *maps[1];
char *name, *val, *str = (char *) optstr;
size_t namesz, valsz;
@@ -542,7 +543,7 @@ int mnt_optstr_get_options(const char *optstr, char **subset,
while(!mnt_optstr_next_option(&str, &name, &namesz, &val, &valsz)) {
int rc = 0;
- const struct mnt_optmap *ent;
+ const struct libmnt_optmap *ent;
mnt_optmap_get_entry(maps, 1, name, namesz, &ent);
@@ -582,9 +583,9 @@ int mnt_optstr_get_options(const char *optstr, char **subset,
* Returns: 0 on success or negative number in case of error
*/
int mnt_optstr_get_flags(const char *optstr, unsigned long *flags,
- const struct mnt_optmap *map)
+ const struct libmnt_optmap *map)
{
- struct mnt_optmap const *maps[1];
+ struct libmnt_optmap const *maps[1];
char *name, *str = (char *) optstr;
size_t namesz = 0;
@@ -596,7 +597,7 @@ int mnt_optstr_get_flags(const char *optstr, unsigned long *flags,
maps[0] = map;
while(!mnt_optstr_next_option(&str, &name, &namesz, NULL, NULL)) {
- const struct mnt_optmap *ent;
+ const struct libmnt_optmap *ent;
if (mnt_optmap_get_entry(maps, 1, name, namesz, &ent)) {
if (!ent->id)
@@ -624,9 +625,9 @@ int mnt_optstr_get_flags(const char *optstr, unsigned long *flags,
* Returns: 0 on success or negative number in case of error.
*/
int mnt_optstr_apply_flags(char **optstr, unsigned long flags,
- const struct mnt_optmap *map)
+ const struct libmnt_optmap *map)
{
- struct mnt_optmap const *maps[1];
+ struct libmnt_optmap const *maps[1];
char *name, *next, *val;
size_t namesz = 0, valsz = 0;
unsigned long fl;
@@ -675,7 +676,7 @@ int mnt_optstr_apply_flags(char **optstr, unsigned long flags,
*/
while(!mnt_optstr_next_option(&next, &name, &namesz,
&val, &valsz)) {
- const struct mnt_optmap *ent;
+ const struct libmnt_optmap *ent;
if (mnt_optmap_get_entry(maps, 1, name, namesz, &ent)) {
/*
@@ -703,7 +704,7 @@ int mnt_optstr_apply_flags(char **optstr, unsigned long flags,
/* add missing options */
if (fl) {
- const struct mnt_optmap *ent;
+ const struct libmnt_optmap *ent;
char *p;
for (ent = map; ent && ent->name; ent++) {
@@ -929,7 +930,7 @@ int mnt_optstr_fix_gid(char **optstr, char *value, size_t valsz, char **next)
int mnt_optstr_fix_user(char **optstr)
{
char *username;
- struct mnt_optloc ol;
+ struct libmnt_optloc ol;
int rc = 0;
DBG(CXT, mnt_debug("fixing user"));
@@ -958,7 +959,7 @@ int mnt_optstr_fix_user(char **optstr)
#ifdef TEST_PROGRAM
-int test_append(struct mtest *ts, int argc, char *argv[])
+int test_append(struct libmnt_test *ts, int argc, char *argv[])
{
const char *value = NULL, *name;
char *optstr;
@@ -978,7 +979,7 @@ int test_append(struct mtest *ts, int argc, char *argv[])
return rc;
}
-int test_prepend(struct mtest *ts, int argc, char *argv[])
+int test_prepend(struct libmnt_test *ts, int argc, char *argv[])
{
const char *value = NULL, *name;
char *optstr;
@@ -998,7 +999,7 @@ int test_prepend(struct mtest *ts, int argc, char *argv[])
return rc;
}
-int test_split(struct mtest *ts, int argc, char *argv[])
+int test_split(struct libmnt_test *ts, int argc, char *argv[])
{
char *optstr, *user = NULL, *fs = NULL, *vfs = NULL;
int rc;
@@ -1022,7 +1023,7 @@ int test_split(struct mtest *ts, int argc, char *argv[])
return rc;
}
-int test_flags(struct mtest *ts, int argc, char *argv[])
+int test_flags(struct libmnt_test *ts, int argc, char *argv[])
{
char *optstr;
int rc;
@@ -1048,7 +1049,7 @@ int test_flags(struct mtest *ts, int argc, char *argv[])
return rc;
}
-int test_apply(struct mtest *ts, int argc, char *argv[])
+int test_apply(struct libmnt_test *ts, int argc, char *argv[])
{
char *optstr;
int rc, map;
@@ -1078,7 +1079,7 @@ int test_apply(struct mtest *ts, int argc, char *argv[])
return rc;
}
-int test_set(struct mtest *ts, int argc, char *argv[])
+int test_set(struct libmnt_test *ts, int argc, char *argv[])
{
const char *value = NULL, *name;
char *optstr;
@@ -1099,7 +1100,7 @@ int test_set(struct mtest *ts, int argc, char *argv[])
return rc;
}
-int test_get(struct mtest *ts, int argc, char *argv[])
+int test_get(struct libmnt_test *ts, int argc, char *argv[])
{
char *optstr;
const char *name;
@@ -1128,7 +1129,7 @@ int test_get(struct mtest *ts, int argc, char *argv[])
return rc;
}
-int test_remove(struct mtest *ts, int argc, char *argv[])
+int test_remove(struct libmnt_test *ts, int argc, char *argv[])
{
const char *name;
char *optstr;
@@ -1145,7 +1146,7 @@ int test_remove(struct mtest *ts, int argc, char *argv[])
return rc;
}
-int test_fix(struct mtest *ts, int argc, char *argv[])
+int test_fix(struct libmnt_test *ts, int argc, char *argv[])
{
char *optstr;
int rc = 0;
@@ -1182,7 +1183,7 @@ int test_fix(struct mtest *ts, int argc, char *argv[])
int main(int argc, char *argv[])
{
- struct mtest tss[] = {
+ struct libmnt_test tss[] = {
{ "--append", test_append, "<optstr> <name> [<value>] append value to optstr" },
{ "--prepend",test_prepend,"<optstr> <name> [<value>] prepend value to optstr" },
{ "--set", test_set, "<optstr> <name> [<value>] (un)set value" },
diff --git a/shlibs/mount/src/tab.c b/shlibs/mount/src/tab.c
index 6f845e21..ab411768 100644
--- a/shlibs/mount/src/tab.c
+++ b/shlibs/mount/src/tab.c
@@ -11,7 +11,7 @@
* @short_description: container for entries from fstab/mtab/mountinfo
*
*
- * Note that mnt_tab_find_* functions are mount(8) compatible. These functions
+ * Note that mnt_table_find_* functions are mount(8) compatible. These functions
* try to found an entry in more iterations where the first attempt is always
* based on comparison with unmodified (non-canonicalized or un-evaluated)
* paths or tags. For example fstab with two entries:
@@ -25,19 +25,19 @@
* where both lines are used for the *same* device, then
* <informalexample>
* <programlisting>
- * mnt_tab_find_source(tb, "/dev/foo", &fs);
+ * mnt_table_find_source(tb, "/dev/foo", &fs);
* </programlisting>
* </informalexample>
* will returns the second line, and
* <informalexample>
* <programlisting>
- * mnt_tab_find_source(tb, "LABEL=foo", &fs);
+ * mnt_table_find_source(tb, "LABEL=foo", &fs);
* </programlisting>
* </informalexample>
* will returns the first entry, and
* <informalexample>
* <programlisting>
- * mnt_tab_find_source(tb, "UUID=anyuuid", &fs);
+ * mnt_table_find_source(tb, "UUID=anyuuid", &fs);
* </programlisting>
* </informalexample>
* will returns the first entry (if UUID matches with the device).
@@ -58,20 +58,20 @@
#include "c.h"
/**
- * mnt_new_tab:
+ * mnt_new_table:
*
- * The tab is a container for mnt_fs entries that usually represents a fstab,
+ * The tab is a container for struct libmnt_fs entries that usually represents a fstab,
* mtab or mountinfo file from your system.
*
- * See also mnt_tab_parse_file().
+ * See also mnt_table_parse_file().
*
* Returns: newly allocated tab struct.
*/
-mnt_tab *mnt_new_tab(void)
+struct libmnt_table *mnt_new_table(void)
{
- mnt_tab *tb = NULL;
+ struct libmnt_table *tb = NULL;
- tb = calloc(1, sizeof(struct _mnt_tab));
+ tb = calloc(1, sizeof(*tb));
if (!tb)
return NULL;
@@ -82,12 +82,12 @@ mnt_tab *mnt_new_tab(void)
}
/**
- * mnt_free_tab:
+ * mnt_free_table:
* @tb: tab pointer
*
* Deallocates tab struct and all entries.
*/
-void mnt_free_tab(mnt_tab *tb)
+void mnt_free_table(struct libmnt_table *tb)
{
if (!tb)
return;
@@ -95,7 +95,8 @@ void mnt_free_tab(mnt_tab *tb)
DBG(TAB, mnt_debug_h(tb, "free"));
while (!list_empty(&tb->ents)) {
- mnt_fs *fs = list_entry(tb->ents.next, mnt_fs, ents);
+ struct libmnt_fs *fs = list_entry(tb->ents.next,
+ struct libmnt_fs, ents);
mnt_free_fs(fs);
}
@@ -103,24 +104,24 @@ void mnt_free_tab(mnt_tab *tb)
}
/**
- * mnt_tab_get_nents:
+ * mnt_table_get_nents:
* @tb: pointer to tab
*
* Returns: number of valid entries in tab.
*/
-int mnt_tab_get_nents(mnt_tab *tb)
+int mnt_table_get_nents(struct libmnt_table *tb)
{
assert(tb);
return tb ? tb->nents : 0;
}
/**
- * mnt_tab_set_cache:
+ * mnt_table_set_cache:
* @tb: pointer to tab
- * @mpc: pointer to mnt_cache instance
+ * @mpc: pointer to struct libmnt_cache instance
*
* Setups a cache for canonicalized paths and evaluated tags (LABEL/UUID). The
- * cache is recommended for mnt_tab_find_*() functions.
+ * cache is recommended for mnt_table_find_*() functions.
*
* The cache could be shared between more tabs. Be careful when you share the
* same cache between more threads -- currently the cache does not provide any
@@ -130,7 +131,7 @@ int mnt_tab_get_nents(mnt_tab *tb)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_tab_set_cache(mnt_tab *tb, mnt_cache *mpc)
+int mnt_table_set_cache(struct libmnt_table *tb, struct libmnt_cache *mpc)
{
assert(tb);
if (!tb)
@@ -140,19 +141,19 @@ int mnt_tab_set_cache(mnt_tab *tb, mnt_cache *mpc)
}
/**
- * mnt_tab_get_cache:
+ * mnt_table_get_cache:
* @tb: pointer to tab
*
- * Returns: pointer to mnt_cache instance or NULL.
+ * Returns: pointer to struct libmnt_cache instance or NULL.
*/
-mnt_cache *mnt_tab_get_cache(mnt_tab *tb)
+struct libmnt_cache *mnt_table_get_cache(struct libmnt_table *tb)
{
assert(tb);
return tb ? tb->cache : NULL;
}
/**
- * mnt_tab_add_fs:
+ * mnt_table_add_fs:
* @tb: tab pointer
* @fs: new entry
*
@@ -160,7 +161,7 @@ mnt_cache *mnt_tab_get_cache(mnt_tab *tb)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_tab_add_fs(mnt_tab *tb, mnt_fs *fs)
+int mnt_table_add_fs(struct libmnt_table *tb, struct libmnt_fs *fs)
{
assert(tb);
assert(fs);
@@ -177,13 +178,13 @@ int mnt_tab_add_fs(mnt_tab *tb, mnt_fs *fs)
}
/**
- * mnt_tab_remove_fs:
+ * mnt_table_remove_fs:
* @tb: tab pointer
* @fs: new entry
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_tab_remove_fs(mnt_tab *tb, mnt_fs *fs)
+int mnt_table_remove_fs(struct libmnt_table *tb, struct libmnt_fs *fs)
{
assert(tb);
assert(fs);
@@ -196,16 +197,16 @@ int mnt_tab_remove_fs(mnt_tab *tb, mnt_fs *fs)
}
/**
- * mnt_tab_get_root_fs:
+ * mnt_table_get_root_fs:
* @tb: mountinfo file (/proc/self/mountinfo)
* @root: returns pointer to the root filesystem (/)
*
* Returns: 0 on success or -1 case of error.
*/
-int mnt_tab_get_root_fs(mnt_tab *tb, mnt_fs **root)
+int mnt_table_get_root_fs(struct libmnt_table *tb, struct libmnt_fs **root)
{
- mnt_iter itr;
- mnt_fs *fs;
+ struct libmnt_iter itr;
+ struct libmnt_fs *fs;
int root_id = 0;
assert(tb);
@@ -217,7 +218,7 @@ int mnt_tab_get_root_fs(mnt_tab *tb, mnt_fs **root)
DBG(TAB, mnt_debug_h(tb, "lookup root fs"));
mnt_reset_iter(&itr, MNT_ITER_FORWARD);
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
int id = mnt_fs_get_parent_id(fs);
if (!id)
break; /* @tab is not mountinfo file? */
@@ -232,7 +233,7 @@ int mnt_tab_get_root_fs(mnt_tab *tb, mnt_fs **root)
}
/**
- * mnt_tab_next_child_fs:
+ * mnt_table_next_child_fs:
* @tb: mountinfo file (/proc/self/mountinfo)
* @itr: iterator
* @parent: parental FS
@@ -243,10 +244,10 @@ int mnt_tab_get_root_fs(mnt_tab *tb, mnt_fs **root)
*
* Returns: 0 on success, negative number in case of error or 1 at end of list.
*/
-int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr,
- mnt_fs *parent, mnt_fs **chld)
+int mnt_table_next_child_fs(struct libmnt_table *tb, struct libmnt_iter *itr,
+ struct libmnt_fs *parent, struct libmnt_fs **chld)
{
- mnt_fs *fs;
+ struct libmnt_fs *fs;
int parent_id, lastchld_id = 0, chld_id = 0;
if (!tb || !itr || !parent)
@@ -261,14 +262,14 @@ int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr,
/* get ID of the previously returned child */
if (itr->head && itr->p != itr->head) {
- MNT_ITER_ITERATE(itr, fs, struct _mnt_fs, ents);
+ MNT_ITER_ITERATE(itr, fs, struct libmnt_fs, ents);
lastchld_id = mnt_fs_get_id(fs);
}
*chld = NULL;
mnt_reset_iter(itr, MNT_ITER_FORWARD);
- while(mnt_tab_next_fs(tb, itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, itr, &fs) == 0) {
int id;
if (mnt_fs_get_parent_id(fs) != parent_id)
@@ -287,13 +288,13 @@ int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr,
return 1; /* end of iterator */
/* set the iterator to the @chld for the next call */
- mnt_tab_set_iter(tb, itr, *chld);
+ mnt_table_set_iter(tb, itr, *chld);
return 0;
}
/**
- * mnt_tab_next_fs:
+ * mnt_table_next_fs:
* @tb: tab pointer
* @itr: iterator
* @fs: returns the next tab entry
@@ -303,23 +304,17 @@ int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr,
* Example:
* <informalexample>
* <programlisting>
- * mnt_fs *fs;
- * mnt_tab *tb = mnt_new_tab("/etc/fstab");
- * mnt_iter *itr = mnt_new_iter(MNT_ITER_BACKWARD);
- *
- * mnt_tab_parse_file(tb);
- *
- * while(mnt_tab_next_fs(tb, itr, &fs) == 0) {
+ * while(mnt_table_next_fs(tb, itr, &fs) == 0) {
* const char *dir = mnt_fs_get_target(fs);
* printf("mount point: %s\n", dir);
* }
- * mnt_free_tab(fi);
+ * mnt_free_table(fi);
* </programlisting>
* </informalexample>
*
* lists all mountpoints from fstab in backward order.
*/
-int mnt_tab_next_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs **fs)
+int mnt_table_next_fs(struct libmnt_table *tb, struct libmnt_iter *itr, struct libmnt_fs **fs)
{
int rc = 1;
@@ -334,7 +329,7 @@ int mnt_tab_next_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs **fs)
if (!itr->head)
MNT_ITER_INIT(itr, &tb->ents);
if (itr->p != itr->head) {
- MNT_ITER_ITERATE(itr, *fs, struct _mnt_fs, ents);
+ MNT_ITER_ITERATE(itr, *fs, struct libmnt_fs, ents);
rc = 0;
}
@@ -342,7 +337,7 @@ int mnt_tab_next_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs **fs)
}
/**
- * mnt_tab_find_next_fs:
+ * mnt_table_find_next_fs:
* @tb: table
* @itr: iterator
* @match_func: function returns 1 or 0
@@ -353,9 +348,9 @@ int mnt_tab_next_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs **fs)
*
* Returns: negative number in case of error, 1 at end of table or 0 o success.
*/
-int mnt_tab_find_next_fs(mnt_tab *tb, mnt_iter *itr,
- int (*match_func)(mnt_fs *, void *), void *userdata,
- mnt_fs **fs)
+int mnt_table_find_next_fs(struct libmnt_table *tb, struct libmnt_iter *itr,
+ int (*match_func)(struct libmnt_fs *, void *), void *userdata,
+ struct libmnt_fs **fs)
{
if (!tb || !itr || !fs || !match_func)
return -EINVAL;
@@ -367,7 +362,7 @@ int mnt_tab_find_next_fs(mnt_tab *tb, mnt_iter *itr,
do {
if (itr->p != itr->head)
- MNT_ITER_ITERATE(itr, *fs, struct _mnt_fs, ents);
+ MNT_ITER_ITERATE(itr, *fs, struct libmnt_fs, ents);
else
break; /* end */
@@ -380,7 +375,7 @@ int mnt_tab_find_next_fs(mnt_tab *tb, mnt_iter *itr,
}
/**
- * mnt_tab_set_iter:
+ * mnt_table_set_iter:
* @tb: tab pointer
* @itr: iterator
* @fs: tab entry
@@ -389,7 +384,7 @@ int mnt_tab_find_next_fs(mnt_tab *tb, mnt_iter *itr,
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_tab_set_iter(mnt_tab *tb, mnt_iter *itr, mnt_fs *fs)
+int mnt_table_set_iter(struct libmnt_table *tb, struct libmnt_iter *itr, struct libmnt_fs *fs)
{
assert(tb);
assert(itr);
@@ -405,7 +400,7 @@ int mnt_tab_set_iter(mnt_tab *tb, mnt_iter *itr, mnt_fs *fs)
}
/**
- * mnt_tab_find_target:
+ * mnt_table_find_target:
* @tb: tab pointer
* @path: mountpoint directory
* @direction: MNT_ITER_{FORWARD,BACKWARD}
@@ -413,14 +408,14 @@ int mnt_tab_set_iter(mnt_tab *tb, mnt_iter *itr, mnt_fs *fs)
* Try to lookup an entry in given tab, possible are three iterations, first
* with @path, second with realpath(@path) and third with realpath(@path)
* against realpath(fs->target). The 2nd and 3rd iterations are not performed
- * when @tb cache is not set (see mnt_tab_set_cache()).
+ * when @tb cache is not set (see mnt_table_set_cache()).
*
* Returns: a tab entry or NULL.
*/
-mnt_fs *mnt_tab_find_target(mnt_tab *tb, const char *path, int direction)
+struct libmnt_fs *mnt_table_find_target(struct libmnt_table *tb, const char *path, int direction)
{
- mnt_iter itr;
- mnt_fs *fs = NULL;
+ struct libmnt_iter itr;
+ struct libmnt_fs *fs = NULL;
char *cn;
assert(tb);
@@ -433,23 +428,23 @@ mnt_fs *mnt_tab_find_target(mnt_tab *tb, const char *path, int direction)
/* native @target */
mnt_reset_iter(&itr, direction);
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0)
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0)
if (fs->target && strcmp(fs->target, path) == 0)
return fs;
if (!tb->cache || !(cn = mnt_resolve_path(path, tb->cache)))
return NULL;
- /* canonicalized paths in mnt_tab */
+ /* canonicalized paths in struct libmnt_table */
mnt_reset_iter(&itr, direction);
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
if (fs->target && strcmp(fs->target, cn) == 0)
return fs;
}
- /* non-canonicaled path in mnt_tab */
+ /* non-canonicaled path in struct libmnt_table */
mnt_reset_iter(&itr, direction);
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
char *p;
if (!fs->target || !(fs->flags & MNT_FS_SWAP) ||
@@ -464,7 +459,7 @@ mnt_fs *mnt_tab_find_target(mnt_tab *tb, const char *path, int direction)
}
/**
- * mnt_tab_find_srcpath:
+ * mnt_table_find_srcpath:
* @tb: tab pointer
* @path: source path (devname or dirname)
* @direction: MNT_ITER_{FORWARD,BACKWARD}
@@ -474,14 +469,14 @@ mnt_fs *mnt_tab_find_target(mnt_tab *tb, const char *path, int direction)
* from @path and fourth with realpath(@path) against realpath(entry->srcpath).
*
* The 2nd, 3rd and 4th iterations are not performed when @tb cache is not
- * set (see mnt_tab_set_cache()).
+ * set (see mnt_table_set_cache()).
*
* Returns: a tab entry or NULL.
*/
-mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction)
+struct libmnt_fs *mnt_table_find_srcpath(struct libmnt_table *tb, const char *path, int direction)
{
- mnt_iter itr;
- mnt_fs *fs = NULL;
+ struct libmnt_iter itr;
+ struct libmnt_fs *fs = NULL;
int ntags = 0;
char *cn;
const char *p;
@@ -493,7 +488,7 @@ mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction)
/* native paths */
mnt_reset_iter(&itr, direction);
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
p = mnt_fs_get_srcpath(fs);
if (p && strcmp(p, path) == 0)
return fs;
@@ -505,10 +500,10 @@ mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction)
if (!tb->cache || !(cn = mnt_resolve_path(path, tb->cache)))
return NULL;
- /* canonicalized paths in mnt_tab */
- if (ntags < mnt_tab_get_nents(tb)) {
+ /* canonicalized paths in struct libmnt_table */
+ if (ntags < mnt_table_get_nents(tb)) {
mnt_reset_iter(&itr, direction);
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
p = mnt_fs_get_srcpath(fs);
if (p && strcmp(p, cn) == 0)
return fs;
@@ -523,7 +518,7 @@ mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction)
if (rc == 0) {
/* @path's TAGs are in the cache */
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
const char *t, *v;
if (mnt_fs_get_tag(fs, &t, &v))
@@ -536,7 +531,7 @@ mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction)
/* @path is unaccessible, try evaluate all TAGs in @tb
* by udev symlinks -- this could be expensive on systems
* with huge fstab/mtab */
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
const char *t, *v, *x;
if (mnt_fs_get_tag(fs, &t, &v))
continue;
@@ -547,10 +542,10 @@ mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction)
}
}
- /* non-canonicalized paths in mnt_tab */
- if (ntags <= mnt_tab_get_nents(tb)) {
+ /* non-canonicalized paths in struct libmnt_table */
+ if (ntags <= mnt_table_get_nents(tb)) {
mnt_reset_iter(&itr, direction);
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
if (fs->flags & (MNT_FS_NET | MNT_FS_PSEUDO))
continue;
p = mnt_fs_get_srcpath(fs);
@@ -566,7 +561,7 @@ mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction)
/**
- * mnt_tab_find_tag:
+ * mnt_table_find_tag:
* @tb: tab pointer
* @tag: tag name (e.g "LABEL", "UUID", ...)
* @val: tag value
@@ -574,16 +569,16 @@ mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction)
*
* Try to lookup an entry in given tab, first attempt is lookup by @tag and
* @val, for the second attempt the tag is evaluated (converted to the device
- * name) and mnt_tab_find_srcpath() is preformed. The second attempt is not
- * performed when @tb cache is not set (see mnt_tab_set_cache()).
+ * name) and mnt_table_find_srcpath() is preformed. The second attempt is not
+ * performed when @tb cache is not set (see mnt_table_set_cache()).
* Returns: a tab entry or NULL.
*/
-mnt_fs *mnt_tab_find_tag(mnt_tab *tb, const char *tag,
+struct libmnt_fs *mnt_table_find_tag(struct libmnt_table *tb, const char *tag,
const char *val, int direction)
{
- mnt_iter itr;
- mnt_fs *fs = NULL;
+ struct libmnt_iter itr;
+ struct libmnt_fs *fs = NULL;
assert(tb);
assert(tag);
@@ -596,7 +591,7 @@ mnt_fs *mnt_tab_find_tag(mnt_tab *tb, const char *tag,
/* look up by TAG */
mnt_reset_iter(&itr, direction);
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
if (fs->tagname && fs->tagval &&
strcmp(fs->tagname, tag) == 0 &&
strcmp(fs->tagval, val) == 0)
@@ -607,26 +602,26 @@ mnt_fs *mnt_tab_find_tag(mnt_tab *tb, const char *tag,
/* look up by device name */
char *cn = mnt_resolve_tag(tag, val, tb->cache);
if (cn)
- return mnt_tab_find_srcpath(tb, cn, direction);
+ return mnt_table_find_srcpath(tb, cn, direction);
}
return NULL;
}
/**
- * mnt_tab_find_source:
+ * mnt_table_find_source:
* @tb: tab pointer
* @source: TAG or path
* @direction: MNT_ITER_{FORWARD,BACKWARD}
*
- * This is high-level API for mnt_tab_find_{srcpath,tag}. You needn't to care
+ * This is high-level API for mnt_table_find_{srcpath,tag}. You needn't to care
* about @source format (device, LABEL, UUID, ...). This function parses @source
- * and calls mnt_tab_find_tag() or mnt_tab_find_srcpath().
+ * and calls mnt_table_find_tag() or mnt_table_find_srcpath().
*
* Returns: a tab entry or NULL.
*/
-mnt_fs *mnt_tab_find_source(mnt_tab *tb, const char *source, int direction)
+struct libmnt_fs *mnt_table_find_source(struct libmnt_table *tb, const char *source, int direction)
{
- mnt_fs *fs = NULL;
+ struct libmnt_fs *fs = NULL;
assert(tb);
assert(source);
@@ -641,19 +636,19 @@ mnt_fs *mnt_tab_find_source(mnt_tab *tb, const char *source, int direction)
if (blkid_parse_tag_string(source, &tag, &val) == 0) {
- fs = mnt_tab_find_tag(tb, tag, val, direction);
+ fs = mnt_table_find_tag(tb, tag, val, direction);
free(tag);
free(val);
}
} else
- fs = mnt_tab_find_srcpath(tb, source, direction);
+ fs = mnt_table_find_srcpath(tb, source, direction);
return fs;
}
/**
- * mnt_tab_find_pair
+ * mnt_table_find_pair
* @tb: tab pointer
* @source: TAG or path
* @target: mountpoint
@@ -661,15 +656,15 @@ mnt_fs *mnt_tab_find_source(mnt_tab *tb, const char *source, int direction)
*
* This function is implemented by mnt_fs_match_source() and
* mnt_fs_match_target() functions. It means that this is more expensive that
- * others mnt_tab_find_* function, because every @tab entry is fully evaluated.
+ * others mnt_table_find_* function, because every @tab entry is fully evaluated.
*
* Returns: a tab entry or NULL.
*/
-mnt_fs *mnt_tab_find_pair(mnt_tab *tb, const char *source,
+struct libmnt_fs *mnt_table_find_pair(struct libmnt_table *tb, const char *source,
const char *target, int direction)
{
- mnt_fs *fs = NULL;
- mnt_iter itr;
+ struct libmnt_fs *fs = NULL;
+ struct libmnt_iter itr;
assert(tb);
assert(source);
@@ -681,7 +676,7 @@ mnt_fs *mnt_tab_find_pair(mnt_tab *tb, const char *source,
DBG(TAB, mnt_debug_h(tb, "lookup SOURCE: %s TARGET: %s", source, target));
mnt_reset_iter(&itr, direction);
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
if (mnt_fs_match_target(fs, target, tb->cache) &&
mnt_fs_match_source(fs, source, tb->cache))
@@ -693,45 +688,45 @@ mnt_fs *mnt_tab_find_pair(mnt_tab *tb, const char *source,
#ifdef TEST_PROGRAM
-static int parser_errcb(mnt_tab *tb, const char *filename, int line)
+static int parser_errcb(struct libmnt_table *tb, const char *filename, int line)
{
fprintf(stderr, "%s:%d: parse error\n", filename, line);
return 1; /* all errors are recoverable -- this is default */
}
-mnt_tab *create_tab(const char *file)
+struct libmnt_table *create_table(const char *file)
{
- mnt_tab *tb;
+ struct libmnt_table *tb;
if (!file)
return NULL;
- tb = mnt_new_tab();
+ tb = mnt_new_table();
if (!tb)
goto err;
- mnt_tab_set_parser_errcb(tb, parser_errcb);
+ mnt_table_set_parser_errcb(tb, parser_errcb);
- if (mnt_tab_parse_file(tb, file) != 0)
+ if (mnt_table_parse_file(tb, file) != 0)
goto err;
return tb;
err:
fprintf(stderr, "%s: parsing failed\n", file);
- mnt_free_tab(tb);
+ mnt_free_table(tb);
return NULL;
}
-int test_copy_fs(struct mtest *ts, int argc, char *argv[])
+int test_copy_fs(struct libmnt_test *ts, int argc, char *argv[])
{
- mnt_tab *tb;
- mnt_fs *fs;
+ struct libmnt_table *tb;
+ struct libmnt_fs *fs;
int rc = -1;
- tb = create_tab(argv[1]);
+ tb = create_table(argv[1]);
if (!tb)
return -1;
- fs = mnt_tab_find_target(tb, "/", MNT_ITER_FORWARD);
+ fs = mnt_table_find_target(tb, "/", MNT_ITER_FORWARD);
if (!fs)
goto done;
@@ -747,18 +742,18 @@ int test_copy_fs(struct mtest *ts, int argc, char *argv[])
mnt_free_fs(fs);
rc = 0;
done:
- mnt_free_tab(tb);
+ mnt_free_table(tb);
return rc;
}
-int test_parse(struct mtest *ts, int argc, char *argv[])
+int test_parse(struct libmnt_test *ts, int argc, char *argv[])
{
- mnt_tab *tb = NULL;
- mnt_iter *itr = NULL;
- mnt_fs *fs;
+ struct libmnt_table *tb = NULL;
+ struct libmnt_iter *itr = NULL;
+ struct libmnt_fs *fs;
int rc = -1;
- tb = create_tab(argv[1]);
+ tb = create_table(argv[1]);
if (!tb)
return -1;
@@ -766,20 +761,20 @@ int test_parse(struct mtest *ts, int argc, char *argv[])
if (!itr)
goto done;
- while(mnt_tab_next_fs(tb, itr, &fs) == 0)
+ while(mnt_table_next_fs(tb, itr, &fs) == 0)
mnt_fs_print_debug(fs, stdout);
rc = 0;
done:
mnt_free_iter(itr);
- mnt_free_tab(tb);
+ mnt_free_table(tb);
return rc;
}
-int test_find(struct mtest *ts, int argc, char *argv[], int dr)
+int test_find(struct libmnt_test *ts, int argc, char *argv[], int dr)
{
- mnt_tab *tb;
- mnt_fs *fs = NULL;
- mnt_cache *mpc = NULL;
+ struct libmnt_table *tb;
+ struct libmnt_fs *fs = NULL;
+ struct libmnt_cache *mpc = NULL;
const char *file, *find, *what;
int rc = -1;
@@ -790,7 +785,7 @@ int test_find(struct mtest *ts, int argc, char *argv[], int dr)
file = argv[1], find = argv[2], what = argv[3];
- tb = create_tab(file);
+ tb = create_table(file);
if (!tb)
goto done;
@@ -798,12 +793,12 @@ int test_find(struct mtest *ts, int argc, char *argv[], int dr)
mpc = mnt_new_cache();
if (!mpc)
goto done;
- mnt_tab_set_cache(tb, mpc);
+ mnt_table_set_cache(tb, mpc);
if (strcasecmp(find, "source") == 0)
- fs = mnt_tab_find_source(tb, what, dr);
+ fs = mnt_table_find_source(tb, what, dr);
else if (strcasecmp(find, "target") == 0)
- fs = mnt_tab_find_target(tb, what, dr);
+ fs = mnt_table_find_target(tb, what, dr);
if (!fs)
fprintf(stderr, "%s: not found %s '%s'\n", file, find, what);
@@ -812,45 +807,45 @@ int test_find(struct mtest *ts, int argc, char *argv[], int dr)
rc = 0;
}
done:
- mnt_free_tab(tb);
+ mnt_free_table(tb);
mnt_free_cache(mpc);
return rc;
}
-int test_find_bw(struct mtest *ts, int argc, char *argv[])
+int test_find_bw(struct libmnt_test *ts, int argc, char *argv[])
{
return test_find(ts, argc, argv, MNT_ITER_BACKWARD);
}
-int test_find_fw(struct mtest *ts, int argc, char *argv[])
+int test_find_fw(struct libmnt_test *ts, int argc, char *argv[])
{
return test_find(ts, argc, argv, MNT_ITER_FORWARD);
}
-int test_find_pair(struct mtest *ts, int argc, char *argv[])
+int test_find_pair(struct libmnt_test *ts, int argc, char *argv[])
{
- mnt_tab *tb;
- mnt_fs *fs;
+ struct libmnt_table *tb;
+ struct libmnt_fs *fs;
int rc = -1;
- tb = create_tab(argv[1]);
+ tb = create_table(argv[1]);
if (!tb)
return -1;
- fs = mnt_tab_find_pair(tb, argv[2], argv[3], MNT_ITER_FORWARD);
+ fs = mnt_table_find_pair(tb, argv[2], argv[3], MNT_ITER_FORWARD);
if (!fs)
goto done;
mnt_fs_print_debug(fs, stdout);
rc = 0;
done:
- mnt_free_tab(tb);
+ mnt_free_table(tb);
return rc;
}
int main(int argc, char *argv[])
{
- struct mtest tss[] = {
+ struct libmnt_test tss[] = {
{ "--parse", test_parse, "<file> parse and print tab" },
{ "--find-forward", test_find_fw, "<file> <source|target> <string>" },
{ "--find-backward", test_find_bw, "<file> <source|target> <string>" },
diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c
index e202bc9c..42b108ff 100644
--- a/shlibs/mount/src/tab_parse.c
+++ b/shlibs/mount/src/tab_parse.c
@@ -55,7 +55,7 @@ static int next_number(char **s, int *num)
/*
* Parses one line from {fs,m}tab
*/
-static int mnt_parse_tab_line(mnt_fs *fs, char *s)
+static int mnt_parse_table_line(struct libmnt_fs *fs, char *s)
{
int rc, n = 0;
char *src, *fstype, *optstr;
@@ -111,7 +111,7 @@ static int mnt_parse_tab_line(mnt_fs *fs, char *s)
/*
* Parses one line from mountinfo file
*/
-static int mnt_parse_mountinfo_line(mnt_fs *fs, char *s)
+static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
{
int rc;
unsigned int maj, min;
@@ -173,7 +173,7 @@ static int mnt_parse_mountinfo_line(mnt_fs *fs, char *s)
/*
* Parses one line from utab file
*/
-static int mnt_parse_utab_line(mnt_fs *fs, const char *s)
+static int mnt_parse_utab_line(struct libmnt_fs *fs, const char *s)
{
const char *p = s;
@@ -244,7 +244,7 @@ enomem:
*
* mountinfo: "<number> <number> ... "
*/
-static int guess_tab_format(char *line)
+static int guess_table_format(char *line)
{
unsigned int a, b;
@@ -256,7 +256,7 @@ static int guess_tab_format(char *line)
/*
* Read and parse the next line from {fs,m}tab or mountinfo
*/
-static int mnt_tab_parse_next(mnt_tab *tb, FILE *f, mnt_fs *fs,
+static int mnt_table_parse_next(struct libmnt_table *tb, FILE *f, struct libmnt_fs *fs,
const char *filename, int *nlines)
{
char buf[BUFSIZ];
@@ -293,10 +293,10 @@ static int mnt_tab_parse_next(mnt_tab *tb, FILE *f, mnt_fs *fs,
} while (*s == '\0' || *s == '#');
if (tb->fmt == MNT_FMT_GUESS)
- tb->fmt = guess_tab_format(s);
+ tb->fmt = guess_table_format(s);
if (tb->fmt == MNT_FMT_FSTAB) {
- if (mnt_parse_tab_line(fs, s) != 0)
+ if (mnt_parse_table_line(fs, s) != 0)
goto err;
} else if (tb->fmt == MNT_FMT_MOUNTINFO) {
@@ -318,20 +318,20 @@ err:
tb->fmt == MNT_FMT_FSTAB ? "fstab" : "utab"));
/* by default all errors are recoverable, otherwise behavior depends on
- * errcb() function. See mnt_tab_set_parser_errcb().
+ * errcb() function. See mnt_table_set_parser_errcb().
*/
return tb->errcb ? tb->errcb(tb, filename, *nlines) : 1;
}
/**
- * mnt_tab_parse_stream:
+ * mnt_table_parse_stream:
* @tb: tab pointer
* @f: file stream
* @filename: filename used for debug and error messages
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_tab_parse_stream(mnt_tab *tb, FILE *f, const char *filename)
+int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f, const char *filename)
{
int nlines = 0;
int rc = -1;
@@ -343,14 +343,14 @@ int mnt_tab_parse_stream(mnt_tab *tb, FILE *f, const char *filename)
DBG(TAB, mnt_debug_h(tb, "%s: start parsing", filename));
while (!feof(f)) {
- mnt_fs *fs = mnt_new_fs();
+ struct libmnt_fs *fs = mnt_new_fs();
if (!fs)
goto err;
- rc = mnt_tab_parse_next(tb, f, fs, filename, &nlines);
+ rc = mnt_table_parse_next(tb, f, fs, filename, &nlines);
if (!rc)
- rc = mnt_tab_add_fs(tb, fs);
+ rc = mnt_table_add_fs(tb, fs);
if (rc) {
mnt_free_fs(fs);
if (rc == 1)
@@ -369,18 +369,18 @@ err:
}
/**
- * mnt_tab_parse_file:
+ * mnt_table_parse_file:
* @tb: tab pointer
* @filename: file
*
* Parses whole table (e.g. /etc/mtab) and appends new records to the @tab.
*
* The libmount parser ignores broken (syntax error) lines, these lines are
- * reported to caller by errcb() function (see mnt_tab_set_parser_errcb()).
+ * reported to caller by errcb() function (see mnt_table_set_parser_errcb()).
*
* Returns: 0 on success, negative number in case of error.
*/
-int mnt_tab_parse_file(mnt_tab *tb, const char *filename)
+int mnt_table_parse_file(struct libmnt_table *tb, const char *filename)
{
FILE *f;
int rc;
@@ -393,7 +393,7 @@ int mnt_tab_parse_file(mnt_tab *tb, const char *filename)
f = fopen(filename, "r");
if (f) {
- rc = mnt_tab_parse_stream(tb, f, filename);
+ rc = mnt_table_parse_stream(tb, f, filename);
fclose(f);
} else
return -errno;
@@ -401,7 +401,7 @@ int mnt_tab_parse_file(mnt_tab *tb, const char *filename)
return rc;
}
-static int mnt_tab_parse_dir(mnt_tab *tb, const char *dirname)
+static int mnt_table_parse_dir(struct libmnt_table *tb, const char *dirname)
{
int n = 0, i;
DIR *dir = NULL;
@@ -447,7 +447,7 @@ static int mnt_tab_parse_dir(mnt_tab *tb, const char *dirname)
f = fopen_at(dirfd(dir), _PATH_MNTTAB_DIR,
d->d_name, O_RDONLY, "r");
if (f) {
- mnt_tab_parse_stream(tb, f, d->d_name);
+ mnt_table_parse_stream(tb, f, d->d_name);
fclose(f);
}
}
@@ -460,9 +460,9 @@ static int mnt_tab_parse_dir(mnt_tab *tb, const char *dirname)
return 0;
}
-mnt_tab *__mnt_new_tab_from_file(const char *filename, int fmt)
+struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt)
{
- mnt_tab *tb;
+ struct libmnt_table *tb;
struct stat st;
assert(filename);
@@ -471,11 +471,11 @@ mnt_tab *__mnt_new_tab_from_file(const char *filename, int fmt)
return NULL;
if (stat(filename, &st))
return NULL;
- tb = mnt_new_tab();
+ tb = mnt_new_table();
if (tb) {
tb->fmt = fmt;
- if (mnt_tab_parse_file(tb, filename) != 0) {
- mnt_free_tab(tb);
+ if (mnt_table_parse_file(tb, filename) != 0) {
+ mnt_free_table(tb);
tb = NULL;
}
}
@@ -483,49 +483,49 @@ mnt_tab *__mnt_new_tab_from_file(const char *filename, int fmt)
}
/**
- * mnt_new_tab_from_file:
+ * mnt_new_table_from_file:
* @filename: /etc/{m,fs}tab or /proc/self/mountinfo path
*
- * Same as mnt_new_tab() + mnt_tab_parse_file(). Use this function for private
+ * Same as mnt_new_table() + mnt_table_parse_file(). Use this function for private
* files only. This function does not allow to use error callback, so you
* cannot provide any feedback to end-users about broken records in files (e.g.
* fstab).
*
* Returns: newly allocated tab on success and NULL in case of error.
*/
-mnt_tab *mnt_new_tab_from_file(const char *filename)
+struct libmnt_table *mnt_new_table_from_file(const char *filename)
{
- return __mnt_new_tab_from_file(filename, MNT_FMT_GUESS);
+ return __mnt_new_table_from_file(filename, MNT_FMT_GUESS);
}
/**
- * mnt_new_tab_from_dir
+ * mnt_new_table_from_dir
* @dirname: for example /etc/fstab.d
*
* Returns: newly allocated tab on success and NULL in case of error.
*/
-mnt_tab *mnt_new_tab_from_dir(const char *dirname)
+struct libmnt_table *mnt_new_table_from_dir(const char *dirname)
{
- mnt_tab *tb;
+ struct libmnt_table *tb;
assert(dirname);
if (!dirname)
return NULL;
- tb = mnt_new_tab();
- if (tb && mnt_tab_parse_dir(tb, dirname) != 0) {
- mnt_free_tab(tb);
+ tb = mnt_new_table();
+ if (tb && mnt_table_parse_dir(tb, dirname) != 0) {
+ mnt_free_table(tb);
tb = NULL;
}
return tb;
}
/**
- * mnt_tab_set_parser_errcb:
+ * mnt_table_set_parser_errcb:
* @tb: pointer to table
* @cb: pointer to callback function
*
- * The error callback function is called by table parser (mnt_tab_parse_file())
+ * The error callback function is called by table parser (mnt_table_parse_file())
* in case of syntax error. The callback function could be used for errors
* evaluation, libmount will continue/stop parsing according to callback return
* codes:
@@ -536,8 +536,8 @@ mnt_tab *mnt_new_tab_from_dir(const char *dirname)
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_tab_set_parser_errcb(mnt_tab *tb,
- int (*cb)(mnt_tab *tb, const char *filename, int line))
+int mnt_table_set_parser_errcb(struct libmnt_table *tb,
+ int (*cb)(struct libmnt_table *tb, const char *filename, int line))
{
assert(tb);
tb->errcb = cb;
@@ -545,7 +545,7 @@ int mnt_tab_set_parser_errcb(mnt_tab *tb,
}
/**
- * mnt_tab_parse_fstab:
+ * mnt_table_parse_fstab:
* @tb: table
* @filename: overwrites default (/etc/fstab or $LIBMOUNT_FSTAB) or NULL
*
@@ -558,11 +558,11 @@ int mnt_tab_set_parser_errcb(mnt_tab *tb,
* - files that starts with "." are ignored (e.g. ".10foo.fstab")
* - files without the ".fstab" extension are ignored
*
- * See also mnt_tab_set_parser_errcb().
+ * See also mnt_table_set_parser_errcb().
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_tab_parse_fstab(mnt_tab *tb, const char *filename)
+int mnt_table_parse_fstab(struct libmnt_table *tb, const char *filename)
{
FILE *f;
@@ -577,7 +577,7 @@ int mnt_tab_parse_fstab(mnt_tab *tb, const char *filename)
f = fopen(filename, "r");
if (f) {
- int rc = mnt_tab_parse_stream(tb, f, filename);
+ int rc = mnt_table_parse_stream(tb, f, filename);
fclose(f);
if (rc)
@@ -589,23 +589,23 @@ int mnt_tab_parse_fstab(mnt_tab *tb, const char *filename)
}
if (!access(_PATH_MNTTAB_DIR, R_OK))
- return mnt_tab_parse_dir(tb, _PATH_MNTTAB_DIR);
+ return mnt_table_parse_dir(tb, _PATH_MNTTAB_DIR);
return 0;
}
/*
* This function uses @uf to found corresponding record in @tb, then the record
- * from @tb is updated (userspace specific mount options are added).
+ * from @tb is updated (user specific mount options are added).
*
- * Note that @uf must contain only userspace specific mount options instead of
+ * Note that @uf must contain only user specific mount options instead of
* VFS options (note that FS options are ignored).
*
* Returns modified filesystem (from @tb) or NULL.
*/
-static mnt_fs *mnt_tab_merge_userspace_fs(mnt_tab *tb, mnt_fs *uf)
+static struct libmnt_fs *mnt_table_merge_user_fs(struct libmnt_table *tb, struct libmnt_fs *uf)
{
- mnt_fs *fs;
- mnt_iter itr;
+ struct libmnt_fs *fs;
+ struct libmnt_iter itr;
const char *optstr, *src, *target, *root, *attrs;
assert(tb);
@@ -613,11 +613,11 @@ static mnt_fs *mnt_tab_merge_userspace_fs(mnt_tab *tb, mnt_fs *uf)
if (!tb || !uf)
return NULL;
- DBG(TAB, mnt_debug_h(tb, "merging userspace fs"));
+ DBG(TAB, mnt_debug_h(tb, "merging user fs"));
src = mnt_fs_get_srcpath(uf);
target = mnt_fs_get_target(uf);
- optstr = mnt_fs_get_userspace_options(uf);
+ optstr = mnt_fs_get_user_options(uf);
attrs = mnt_fs_get_attributes(uf);
root = mnt_fs_get_root(uf);
@@ -626,7 +626,7 @@ static mnt_fs *mnt_tab_merge_userspace_fs(mnt_tab *tb, mnt_fs *uf)
mnt_reset_iter(&itr, MNT_ITER_BACKWARD);
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
const char *s = mnt_fs_get_srcpath(fs),
*t = mnt_fs_get_target(fs),
*r = mnt_fs_get_root(fs);
@@ -637,8 +637,8 @@ static mnt_fs *mnt_tab_merge_userspace_fs(mnt_tab *tb, mnt_fs *uf)
}
if (fs) {
- DBG(TAB, mnt_debug_h(tb, "found fs -- appending userspace optstr"));
- mnt_fs_append_userspace_options(fs, optstr);
+ DBG(TAB, mnt_debug_h(tb, "found fs -- appending user optstr"));
+ mnt_fs_append_user_options(fs, optstr);
mnt_fs_append_attributes(fs, attrs);
mnt_fs_set_bindsrc(fs, mnt_fs_get_bindsrc(uf));
@@ -649,18 +649,18 @@ static mnt_fs *mnt_tab_merge_userspace_fs(mnt_tab *tb, mnt_fs *uf)
}
/**
- * mnt_tab_parse_mtab:
+ * mnt_table_parse_mtab:
* @tb: table
* @filename: overwrites default (/etc/mtab or $LIBMOUNT_MTAB) or NULL
*
* This function parses /etc/mtab or /proc/self/mountinfo +
* /dev/.mount/utabs or /proc/mounts.
*
- * See also mnt_tab_set_parser_errcb().
+ * See also mnt_table_set_parser_errcb().
*
* Returns: 0 on success or negative number in case of error.
*/
-int mnt_tab_parse_mtab(mnt_tab *tb, const char *filename)
+int mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename)
{
int rc;
const char *utab = NULL;
@@ -669,7 +669,7 @@ int mnt_tab_parse_mtab(mnt_tab *tb, const char *filename)
DBG(TAB, mnt_debug_h(tb, "force %s usage", filename));
- rc = mnt_tab_parse_file(tb, filename);
+ rc = mnt_table_parse_file(tb, filename);
if (!rc)
return 0;
filename = NULL; /* failed */
@@ -680,31 +680,31 @@ int mnt_tab_parse_mtab(mnt_tab *tb, const char *filename)
* -- read kernel information from /proc/self/mountinfo
*/
tb->fmt = MNT_FMT_MOUNTINFO;
- rc = mnt_tab_parse_file(tb, _PATH_PROC_MOUNTINFO);
+ rc = mnt_table_parse_file(tb, _PATH_PROC_MOUNTINFO);
if (rc) {
/* hmm, old kernel? ...try /proc/mounts */
tb->fmt = MNT_FMT_MTAB;
- return mnt_tab_parse_file(tb, _PATH_PROC_MOUNTS);
+ return mnt_table_parse_file(tb, _PATH_PROC_MOUNTS);
}
/*
- * try to read userspace specific information from /dev/.mount/utabs
+ * try to read user specific information from /dev/.mount/utabs
*/
utab = mnt_get_utab_path();
if (utab) {
- mnt_tab *u_tb = __mnt_new_tab_from_file(utab, MNT_FMT_UTAB);
+ struct libmnt_table *u_tb = __mnt_new_table_from_file(utab, MNT_FMT_UTAB);
if (u_tb) {
- mnt_fs *u_fs;
- mnt_iter itr;
+ struct libmnt_fs *u_fs;
+ struct libmnt_iter itr;
mnt_reset_iter(&itr, MNT_ITER_BACKWARD);
- /* merge userspace options into mountinfo from kernel */
- while(mnt_tab_next_fs(u_tb, &itr, &u_fs) == 0)
- mnt_tab_merge_userspace_fs(tb, u_fs);
+ /* merge user options into mountinfo from kernel */
+ while(mnt_table_next_fs(u_tb, &itr, &u_fs) == 0)
+ mnt_table_merge_user_fs(tb, u_fs);
- mnt_free_tab(u_tb);
+ mnt_free_table(u_tb);
}
}
return 0;
diff --git a/shlibs/mount/src/tab_update.c b/shlibs/mount/src/tab_update.c
index fffdd20c..60a628a4 100644
--- a/shlibs/mount/src/tab_update.c
+++ b/shlibs/mount/src/tab_update.c
@@ -10,12 +10,12 @@
* @title: mtab managment
* @short_description: userspace mount information management.
*
- * The mnt_update provides abstraction to manage mount options in userspace independently on
+ * The struct libmnt_update provides abstraction to manage mount options in userspace independently on
* system configuration. This low-level API works on system with and without /etc/mtab. On
* systems without the regular /etc/mtab file are userspace mount options (e.g. user=)
* stored to the /dev/.mount/utab file.
*
- * It's recommended to use high-level mnt_context API.
+ * It's recommended to use high-level struct libmnt_context API.
*/
#include <stdio.h>
@@ -33,28 +33,28 @@
#include "mangle.h"
#include "pathnames.h"
-struct _mnt_update {
+struct libmnt_update {
char *target;
- mnt_fs *fs;
+ struct libmnt_fs *fs;
char *filename;
unsigned long mountflags;
int userspace_only;
int ready;
};
-static int utab_new_entry(mnt_fs *fs, unsigned long mountflags, mnt_fs **ent);
-static int set_fs_root(mnt_fs *result, mnt_fs *fs, unsigned long mountflags);
+static int utab_new_entry(struct libmnt_fs *fs, unsigned long mountflags, struct libmnt_fs **ent);
+static int set_fs_root(struct libmnt_fs *result, struct libmnt_fs *fs, unsigned long mountflags);
/**
* mnt_new_update:
*
* Returns: newly allocated update handler
*/
-mnt_update *mnt_new_update(void)
+struct libmnt_update *mnt_new_update(void)
{
- mnt_update *upd;
+ struct libmnt_update *upd;
- upd = calloc(1, sizeof(struct _mnt_update));
+ upd = calloc(1, sizeof(*upd));
if (!upd)
return NULL;
@@ -67,9 +67,9 @@ mnt_update *mnt_new_update(void)
* mnt_free_update:
* @upd: update
*
- * Deallocates mnt_update handler.
+ * Deallocates struct libmnt_update handler.
*/
-void mnt_free_update(mnt_update *upd)
+void mnt_free_update(struct libmnt_update *upd)
{
if (!upd)
return;
@@ -85,7 +85,7 @@ void mnt_free_update(mnt_update *upd)
/*
* Returns 0 on success, 1 if not file available, -1 in case of error.
*/
-int mnt_update_set_filename(mnt_update *upd, const char *filename, int userspace_only)
+int mnt_update_set_filename(struct libmnt_update *upd, const char *filename, int userspace_only)
{
const char *path = NULL;
int rw = 0;
@@ -132,7 +132,7 @@ int mnt_update_set_filename(mnt_update *upd, const char *filename, int userspace
*
* Returns: pointer to filename that will be updated or NULL in case of error.
*/
-const char *mnt_update_get_filename(mnt_update *upd)
+const char *mnt_update_get_filename(struct libmnt_update *upd)
{
return upd && !upd->userspace_only ? upd->filename : NULL;
}
@@ -144,7 +144,7 @@ const char *mnt_update_get_filename(mnt_update *upd)
* Returns: 1 if entry described by @upd is successfully prepared and will be
* written to mtab/utab file.
*/
-int mnt_update_is_ready(mnt_update *upd)
+int mnt_update_is_ready(struct libmnt_update *upd)
{
return upd ? upd->ready : FALSE;
}
@@ -158,8 +158,8 @@ int mnt_update_is_ready(mnt_update *upd)
*
* Returns: -1 in case on error, 0 on success, 1 if update is unnecessary.
*/
-int mnt_update_set_fs(mnt_update *upd, unsigned long mountflags,
- const char *target, mnt_fs *fs)
+int mnt_update_set_fs(struct libmnt_update *upd, unsigned long mountflags,
+ const char *target, struct libmnt_fs *fs)
{
int rc;
@@ -227,18 +227,18 @@ int mnt_update_set_fs(mnt_update *upd, unsigned long mountflags,
*
* Returns: update filesystem entry or NULL
*/
-mnt_fs *mnt_update_get_fs(mnt_update *upd)
+struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd)
{
return upd ? upd->fs : NULL;
}
/**
- * mnt_update_get_mountflags:
+ * mnt_update_get_mflags:
* @upd: update
*
* Returns: mount flags as was set by mnt_update_set_fs()
*/
-unsigned long mnt_update_get_mountflags(mnt_update *upd)
+unsigned long mnt_update_get_mflags(struct libmnt_update *upd)
{
return upd ? upd->mountflags : 0;
}
@@ -250,7 +250,7 @@ unsigned long mnt_update_get_mountflags(mnt_update *upd)
*
* Returns: 0 on success and negative number in case of error.
*/
-int mnt_update_force_rdonly(mnt_update *upd, int rdonly)
+int mnt_update_force_rdonly(struct libmnt_update *upd, int rdonly)
{
int rc = 0;
@@ -290,7 +290,7 @@ int mnt_update_force_rdonly(mnt_update *upd, int rdonly)
* Returns: 0 on success, negative number on error, 1 if utabs update is
* unnecessary.
*/
-static int utab_new_entry(mnt_fs *fs, unsigned long mountflags, mnt_fs **ent)
+static int utab_new_entry(struct libmnt_fs *fs, unsigned long mountflags, struct libmnt_fs **ent)
{
int rc = 0;
const char *o = NULL, *a = NULL;
@@ -306,7 +306,7 @@ static int utab_new_entry(mnt_fs *fs, unsigned long mountflags, mnt_fs **ent)
DBG(UPDATE, mnt_debug("prepare utab entry"));
- o = mnt_fs_get_userspace_options(fs);
+ o = mnt_fs_get_user_options(fs);
a = mnt_fs_get_attributes(fs);
if (o) {
@@ -330,7 +330,7 @@ static int utab_new_entry(mnt_fs *fs, unsigned long mountflags, mnt_fs **ent)
goto err;
}
- rc = mnt_fs_set_userspace_options(*ent, u);
+ rc = mnt_fs_set_user_options(*ent, u);
if (rc)
goto err;
rc = mnt_fs_set_attributes(*ent, a);
@@ -353,11 +353,11 @@ err:
return rc;
}
-static int set_fs_root(mnt_fs *result, mnt_fs *fs, unsigned long mountflags)
+static int set_fs_root(struct libmnt_fs *result, struct libmnt_fs *fs, unsigned long mountflags)
{
char *root = NULL, *mnt = NULL;
const char *fstype;
- mnt_tab *tb = NULL;
+ struct libmnt_table *tb = NULL;
int rc = -ENOMEM;
assert(fs);
@@ -372,7 +372,7 @@ static int set_fs_root(mnt_fs *result, mnt_fs *fs, unsigned long mountflags)
*/
if (mountflags & MS_BIND) {
const char *src, *src_root;
- mnt_fs *src_fs;
+ struct libmnt_fs *src_fs;
DBG(UPDATE, mnt_debug("setting FS root: bind"));
@@ -389,12 +389,12 @@ static int set_fs_root(mnt_fs *result, mnt_fs *fs, unsigned long mountflags)
}
root = mnt_get_fs_root(src, mnt);
- tb = __mnt_new_tab_from_file(_PATH_PROC_MOUNTINFO, MNT_FMT_MOUNTINFO);
+ tb = __mnt_new_table_from_file(_PATH_PROC_MOUNTINFO, MNT_FMT_MOUNTINFO);
if (!tb) {
DBG(UPDATE, mnt_debug("failed to parse mountinfo -- using default"));
goto dflt;
}
- src_fs = mnt_tab_find_target(tb, mnt, MNT_ITER_BACKWARD);
+ src_fs = mnt_table_find_target(tb, mnt, MNT_ITER_BACKWARD);
if (!src_fs) {
DBG(UPDATE, mnt_debug("not found '%s' in mountinfo -- using default", mnt));
goto dflt;
@@ -451,7 +451,7 @@ static int set_fs_root(mnt_fs *result, mnt_fs *fs, unsigned long mountflags)
*(root + sz) = '\0';
}
dflt:
- mnt_free_tab(tb);
+ mnt_free_table(tb);
if (!root) {
root = strdup("/");
if (!root)
@@ -470,7 +470,7 @@ err:
}
/* mtab and fstab update */
-static int fprintf_mtab_fs(FILE *f, mnt_fs *fs)
+static int fprintf_mtab_fs(FILE *f, struct libmnt_fs *fs)
{
char *o;
char *m1, *m2, *m3, *m4;
@@ -505,7 +505,7 @@ static int fprintf_mtab_fs(FILE *f, mnt_fs *fs)
return rc;
}
-static int fprintf_utab_fs(FILE *f, mnt_fs *fs)
+static int fprintf_utab_fs(FILE *f, struct libmnt_fs *fs)
{
char *p;
@@ -540,7 +540,7 @@ static int fprintf_utab_fs(FILE *f, mnt_fs *fs)
fprintf(f, "ATTRS=%s ", p);
free(p);
}
- p = mangle(mnt_fs_get_userspace_options(fs));
+ p = mangle(mnt_fs_get_user_options(fs));
if (p) {
fprintf(f, "OPTS=%s", p);
free(p);
@@ -550,7 +550,7 @@ static int fprintf_utab_fs(FILE *f, mnt_fs *fs)
return 0;
}
-static int update_tab(mnt_update *upd, mnt_tab *tb)
+static int update_table(struct libmnt_update *upd, struct libmnt_table *tb)
{
FILE *f;
int rc, fd;
@@ -568,12 +568,12 @@ static int update_tab(mnt_update *upd, mnt_tab *tb)
f = fdopen(fd, "w");
if (f) {
struct stat st;
- mnt_iter itr;
- mnt_fs *fs;
+ struct libmnt_iter itr;
+ struct libmnt_fs *fs;
int fd;
mnt_reset_iter(&itr, MNT_ITER_FORWARD);
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
if (upd->userspace_only)
fprintf_utab_fs(f, fs);
else
@@ -632,7 +632,7 @@ static void utab_unlock(int fd)
}
}
-static int update_add_entry(mnt_update *upd, mnt_lock *lc)
+static int update_add_entry(struct libmnt_update *upd, struct libmnt_lock *lc)
{
FILE *f;
int rc = 0, u_lc = -1;
@@ -664,9 +664,9 @@ static int update_add_entry(mnt_update *upd, mnt_lock *lc)
return rc;
}
-static int update_remove_entry(mnt_update *upd, mnt_lock *lc)
+static int update_remove_entry(struct libmnt_update *upd, struct libmnt_lock *lc)
{
- mnt_tab *tb;
+ struct libmnt_table *tb;
int rc = 0, u_lc = -1;
assert(upd);
@@ -679,16 +679,16 @@ static int update_remove_entry(mnt_update *upd, mnt_lock *lc)
else if (upd->userspace_only)
u_lc = utab_lock(upd->filename);
- tb = __mnt_new_tab_from_file(upd->filename,
+ tb = __mnt_new_table_from_file(upd->filename,
upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);
if (tb) {
- mnt_fs *rem = mnt_tab_find_target(tb, upd->target, MNT_ITER_BACKWARD);
+ struct libmnt_fs *rem = mnt_table_find_target(tb, upd->target, MNT_ITER_BACKWARD);
if (rem) {
- mnt_tab_remove_fs(tb, rem);
- rc = update_tab(upd, tb);
+ mnt_table_remove_fs(tb, rem);
+ rc = update_table(upd, tb);
mnt_free_fs(rem);
}
- mnt_free_tab(tb);
+ mnt_free_table(tb);
}
if (lc)
mnt_unlock_file(lc);
@@ -697,9 +697,9 @@ static int update_remove_entry(mnt_update *upd, mnt_lock *lc)
return rc;
}
-static int update_modify_target(mnt_update *upd, mnt_lock *lc)
+static int update_modify_target(struct libmnt_update *upd, struct libmnt_lock *lc)
{
- mnt_tab *tb = NULL;
+ struct libmnt_table *tb = NULL;
int rc = 0, u_lc = -1;
DBG(UPDATE, mnt_debug_h(upd, "%s: modify target", upd->filename));
@@ -709,17 +709,17 @@ static int update_modify_target(mnt_update *upd, mnt_lock *lc)
else if (upd->userspace_only)
u_lc = utab_lock(upd->filename);
- tb = __mnt_new_tab_from_file(upd->filename,
+ tb = __mnt_new_table_from_file(upd->filename,
upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);
if (tb) {
- mnt_fs *cur = mnt_tab_find_target(tb,
+ struct libmnt_fs *cur = mnt_table_find_target(tb,
mnt_fs_get_srcpath(upd->fs), MNT_ITER_BACKWARD);
if (cur) {
rc = mnt_fs_set_target(cur, mnt_fs_get_target(upd->fs));
if (!rc)
- rc = update_tab(upd, tb);
+ rc = update_table(upd, tb);
}
- mnt_free_tab(tb);
+ mnt_free_table(tb);
}
if (lc)
mnt_unlock_file(lc);
@@ -728,11 +728,11 @@ static int update_modify_target(mnt_update *upd, mnt_lock *lc)
return rc;
}
-static int update_modify_options(mnt_update *upd, mnt_lock *lc)
+static int update_modify_options(struct libmnt_update *upd, struct libmnt_lock *lc)
{
- mnt_tab *tb = NULL;
+ struct libmnt_table *tb = NULL;
int rc = 0, u_lc = -1;
- mnt_fs *fs;
+ struct libmnt_fs *fs;
assert(upd);
assert(upd->fs);
@@ -746,10 +746,10 @@ static int update_modify_options(mnt_update *upd, mnt_lock *lc)
else if (upd->userspace_only)
u_lc = utab_lock(upd->filename);
- tb = __mnt_new_tab_from_file(upd->filename,
+ tb = __mnt_new_table_from_file(upd->filename,
upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);
if (tb) {
- mnt_fs *cur = mnt_tab_find_target(tb,
+ struct libmnt_fs *cur = mnt_table_find_target(tb,
mnt_fs_get_target(fs),
MNT_ITER_BACKWARD);
if (cur) {
@@ -760,12 +760,12 @@ static int update_modify_options(mnt_update *upd, mnt_lock *lc)
if (!rc && !upd->userspace_only)
rc = mnt_fs_set_fs_options(cur, mnt_fs_get_fs_options(fs));
if (!rc)
- rc = mnt_fs_set_userspace_options(cur,
- mnt_fs_get_userspace_options(fs));
+ rc = mnt_fs_set_user_options(cur,
+ mnt_fs_get_user_options(fs));
if (!rc)
- rc = update_tab(upd, tb);
+ rc = update_table(upd, tb);
}
- mnt_free_tab(tb);
+ mnt_free_table(tb);
}
if (lc)
@@ -776,7 +776,7 @@ static int update_modify_options(mnt_update *upd, mnt_lock *lc)
}
/**
- * mnt_update_tab:
+ * mnt_update_table:
* @upd: update
* @lc: lock
*
@@ -784,7 +784,7 @@ static int update_modify_options(mnt_update *upd, mnt_lock *lc)
*
* Returns: 0 on success, negative number on error.
*/
-int mnt_update_tab(mnt_update *upd, mnt_lock *lc)
+int mnt_update_table(struct libmnt_update *upd, struct libmnt_lock *lc)
{
int rc = -EINVAL;
@@ -817,7 +817,7 @@ int mnt_update_tab(mnt_update *upd, mnt_lock *lc)
#ifdef TEST_PROGRAM
-mnt_lock *lock;
+struct libmnt_lock *lock;
static void lock_fallback(void)
{
@@ -825,10 +825,10 @@ static void lock_fallback(void)
mnt_unlock_file(lock);
}
-static int update(const char *target, mnt_fs *fs, unsigned long mountflags)
+static int update(const char *target, struct libmnt_fs *fs, unsigned long mountflags)
{
int rc;
- mnt_update *upd;
+ struct libmnt_update *upd;
const char *filename;
DBG(UPDATE, mnt_debug("update test"));
@@ -856,14 +856,14 @@ static int update(const char *target, mnt_fs *fs, unsigned long mountflags)
if (lock)
atexit(lock_fallback);
}
- rc = mnt_update_tab(upd, lock);
+ rc = mnt_update_table(upd, lock);
done:
return rc;
}
-static int test_add(struct mtest *ts, int argc, char *argv[])
+static int test_add(struct libmnt_test *ts, int argc, char *argv[])
{
- mnt_fs *fs = mnt_new_fs();
+ struct libmnt_fs *fs = mnt_new_fs();
int rc;
if (argc < 5 || !fs)
@@ -878,16 +878,16 @@ static int test_add(struct mtest *ts, int argc, char *argv[])
return rc;
}
-static int test_remove(struct mtest *ts, int argc, char *argv[])
+static int test_remove(struct libmnt_test *ts, int argc, char *argv[])
{
if (argc < 2)
return -1;
return update(argv[1], NULL, 0);
}
-static int test_move(struct mtest *ts, int argc, char *argv[])
+static int test_move(struct libmnt_test *ts, int argc, char *argv[])
{
- mnt_fs *fs = mnt_new_fs();
+ struct libmnt_fs *fs = mnt_new_fs();
int rc;
if (argc < 3)
@@ -901,9 +901,9 @@ static int test_move(struct mtest *ts, int argc, char *argv[])
return rc;
}
-static int test_remount(struct mtest *ts, int argc, char *argv[])
+static int test_remount(struct libmnt_test *ts, int argc, char *argv[])
{
- mnt_fs *fs = mnt_new_fs();
+ struct libmnt_fs *fs = mnt_new_fs();
int rc;
if (argc < 3)
@@ -918,7 +918,7 @@ static int test_remount(struct mtest *ts, int argc, char *argv[])
int main(int argc, char *argv[])
{
- struct mtest tss[] = {
+ struct libmnt_test tss[] = {
{ "--add", test_add, "<src> <target> <type> <options> add line to mtab" },
{ "--remove", test_remove, "<target> MS_REMOUNT mtab change" },
{ "--move", test_move, "<old_target> <target> MS_MOVE mtab change" },
diff --git a/shlibs/mount/src/test.c b/shlibs/mount/src/test.c
index ac2ab175..2da00b40 100644
--- a/shlibs/mount/src/test.c
+++ b/shlibs/mount/src/test.c
@@ -17,10 +17,10 @@
#include "mountP.h"
-int mnt_run_test(struct mtest *tests, int argc, char *argv[])
+int mnt_run_test(struct libmnt_test *tests, int argc, char *argv[])
{
int rc = -1;
- struct mtest *ts;
+ struct libmnt_test *ts;
assert(tests);
assert(argc);
diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c
index 48c37de3..c9e171cc 100644
--- a/shlibs/mount/src/utils.c
+++ b/shlibs/mount/src/utils.c
@@ -723,7 +723,7 @@ char *mnt_get_fs_root(const char *path, const char *mnt)
}
#ifdef TEST_PROGRAM
-int test_match_fstype(struct mtest *ts, int argc, char *argv[])
+int test_match_fstype(struct libmnt_test *ts, int argc, char *argv[])
{
char *type = argv[1];
char *pattern = argv[2];
@@ -732,7 +732,7 @@ int test_match_fstype(struct mtest *ts, int argc, char *argv[])
return 0;
}
-int test_match_options(struct mtest *ts, int argc, char *argv[])
+int test_match_options(struct libmnt_test *ts, int argc, char *argv[])
{
char *optstr = argv[1];
char *pattern = argv[2];
@@ -741,7 +741,7 @@ int test_match_options(struct mtest *ts, int argc, char *argv[])
return 0;
}
-int test_startswith(struct mtest *ts, int argc, char *argv[])
+int test_startswith(struct libmnt_test *ts, int argc, char *argv[])
{
char *optstr = argv[1];
char *pattern = argv[2];
@@ -750,7 +750,7 @@ int test_startswith(struct mtest *ts, int argc, char *argv[])
return 0;
}
-int test_endswith(struct mtest *ts, int argc, char *argv[])
+int test_endswith(struct libmnt_test *ts, int argc, char *argv[])
{
char *optstr = argv[1];
char *pattern = argv[2];
@@ -759,7 +759,7 @@ int test_endswith(struct mtest *ts, int argc, char *argv[])
return 0;
}
-int test_mountpoint(struct mtest *ts, int argc, char *argv[])
+int test_mountpoint(struct libmnt_test *ts, int argc, char *argv[])
{
char *path = canonicalize_path(argv[1]),
*mnt = path ? mnt_get_mountpoint(path) : NULL;
@@ -770,7 +770,7 @@ int test_mountpoint(struct mtest *ts, int argc, char *argv[])
return 0;
}
-int test_fsroot(struct mtest *ts, int argc, char *argv[])
+int test_fsroot(struct libmnt_test *ts, int argc, char *argv[])
{
char *path = canonicalize_path(argv[1]),
*mnt = path ? mnt_get_fs_root(path, NULL) : NULL;
@@ -781,7 +781,7 @@ int test_fsroot(struct mtest *ts, int argc, char *argv[])
return 0;
}
-int test_filesystems(struct mtest *ts, int argc, char *argv[])
+int test_filesystems(struct libmnt_test *ts, int argc, char *argv[])
{
char **filesystems = NULL;
int rc;
@@ -798,7 +798,7 @@ int test_filesystems(struct mtest *ts, int argc, char *argv[])
int main(int argc, char *argv[])
{
- struct mtest tss[] = {
+ struct libmnt_test tss[] = {
{ "--match-fstype", test_match_fstype, "<type> <pattern> FS types matching" },
{ "--match-options", test_match_options, "<options> <pattern> options matching" },
{ "--filesystems", test_filesystems, "[<pattern>] list /{etc,proc}/filesystems" },
diff --git a/shlibs/mount/src/version.c b/shlibs/mount/src/version.c
index d00a1686..a3b6d0bc 100644
--- a/shlibs/mount/src/version.c
+++ b/shlibs/mount/src/version.c
@@ -58,7 +58,7 @@ int mnt_get_library_version(const char **ver_string)
}
#ifdef TEST_PROGRAM
-int test_version(struct mtest *ts, int argc, char *argv[])
+int test_version(struct libmnt_test *ts, int argc, char *argv[])
{
const char *ver;
@@ -76,7 +76,7 @@ int test_version(struct mtest *ts, int argc, char *argv[])
int main(int argc, char *argv[])
{
- struct mtest ts[] = {
+ struct libmnt_test ts[] = {
{ "--print", test_version, "print versions" },
{ NULL }
};