summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src
diff options
context:
space:
mode:
authorKarel Zak2011-01-04 00:43:56 +0100
committerKarel Zak2011-01-04 00:43:56 +0100
commit0f32f1e2fca10124952ca8d83d08f56f79b669c0 (patch)
tree14f98dfd57bd6c239c3835ab3a98f0602280f4b9 /shlibs/mount/src
parentmount: use verbose info for HAVE_LIBMOUNT_MOUNT only (diff)
downloadkernel-qcow2-util-linux-0f32f1e2fca10124952ca8d83d08f56f79b669c0.tar.gz
kernel-qcow2-util-linux-0f32f1e2fca10124952ca8d83d08f56f79b669c0.tar.xz
kernel-qcow2-util-linux-0f32f1e2fca10124952ca8d83d08f56f79b669c0.zip
libmount: cleanup API and docs
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src')
-rw-r--r--shlibs/mount/src/context.c37
-rw-r--r--shlibs/mount/src/context_mount.c4
-rw-r--r--shlibs/mount/src/context_umount.c2
-rw-r--r--shlibs/mount/src/fs.c7
-rw-r--r--shlibs/mount/src/lock.c18
-rw-r--r--shlibs/mount/src/mount.h.in45
-rw-r--r--shlibs/mount/src/mount.sym5
-rw-r--r--shlibs/mount/src/mountP.h10
-rw-r--r--shlibs/mount/src/optmap.c118
-rw-r--r--shlibs/mount/src/optstr.c11
-rw-r--r--shlibs/mount/src/tab.c6
-rw-r--r--shlibs/mount/src/tab_parse.c2
-rw-r--r--shlibs/mount/src/tab_update.c12
-rw-r--r--shlibs/mount/src/utils.c2
14 files changed, 95 insertions, 184 deletions
diff --git a/shlibs/mount/src/context.c b/shlibs/mount/src/context.c
index 7eda42fff..deeb606cc 100644
--- a/shlibs/mount/src/context.c
+++ b/shlibs/mount/src/context.c
@@ -5,6 +5,32 @@
* GNU Lesser General Public License.
*/
+/**
+ * SECTION: context
+ * @title: Mount/umount context
+ * @short_description: high-level API to mount/umount devices.
+ *
+ * <informalexample>
+ * <programlisting>
+ * mnt_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_target(cxt, "/mnt/foo");
+ *
+ * if (!mnt_context_do_mount(cxt))
+ * printf("successfully mounted\n");
+ * mnt_free_context(cxt);
+ *
+ * </programlisting>
+ * </informalexample>
+ *
+ * This code is similar to:
+ *
+ * mount -o aaa,bbb,ccc=CCC,noatime,noexec /mnt/foo
+ *
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -313,7 +339,7 @@ int mnt_context_enable_force(mnt_context *cxt, int enable)
* @cxt: mount context
* @enable: TRUE or FALSE
*
- * Enable/disable verbose output (see also mnt_context_mount_strerror()).
+ * Enable/disable verbose output (TODO: not implemented yet)
*
* Returns: 0 on success, negative number in case of error.
*/
@@ -414,7 +440,7 @@ int mnt_context_set_target(mnt_context *cxt, const char *target)
* @fstype: filesystem type
*
* Note that the @fstype has to be the real FS type. For comma-separated list of
- * filesystems or for "no<fs>" notation use mnt_context_set_fstype_pattern().
+ * filesystems or for "nofs" notation use mnt_context_set_fstype_pattern().
*
* Returns: 0 on success, negative number in case of error.
*/
@@ -428,7 +454,7 @@ int mnt_context_set_fstype(mnt_context *cxt, const char *fstype)
/**
* mnt_context_set_options:
* @cxt: mount context
- * @options: comma delimited mount options
+ * @optstr: comma delimited mount options
*
* Returns: 0 on success, negative number in case of error.
*/
@@ -659,9 +685,6 @@ mnt_cache *mnt_context_get_cache(mnt_context *cxt)
* remove the lock file when interrupted by signal. It means that properly written
* mount(8)-like application has to call mnt_unlock_file() from a signal handler.
*
- * See also mnt_unlock_file(), mnt_context_disable_lock() and
- * mnt_context_disable_mtab().
- *
* This function returns NULL if mtab file is not writable or nolock or nomtab
* flags is enabled.
*
@@ -1281,7 +1304,7 @@ err:
* mnt_context_get_status:
* @cxt: mount context
*
- * Returns: 1 if mount.<type> or mount(2) syscall was successfull or 0.
+ * Returns: 1 if /sbin/mount.type or mount(2) syscall was successfull or 0.
*/
int mnt_context_get_status(mnt_context *cxt)
{
diff --git a/shlibs/mount/src/context_mount.c b/shlibs/mount/src/context_mount.c
index 41673bc0f..574a8142f 100644
--- a/shlibs/mount/src/context_mount.c
+++ b/shlibs/mount/src/context_mount.c
@@ -417,12 +417,12 @@ static int do_mount_by_pattern(mnt_context *cxt, const char *pattern)
* mnt_context_do_mount:
* @cxt: mount context
*
- * Mount filesystem by mount(2) or fork()+exec(/sbin/mount.<type>).
+ * Mount filesystem by mount(2) or fork()+exec(/sbin/mount.type).
*
* See also mnt_context_disable_helpers().
*
* Returns: 0 on success, and negative number in case of error. WARNING: error
- * does not mean that mount(2) syscall or mount.<type> helper wasn't
+ * does not mean that mount(2) syscall or mount.type helper wasn't
* sucessfully called. Check mnt_context_get_status() after error!
*/
int mnt_context_do_mount(mnt_context *cxt)
diff --git a/shlibs/mount/src/context_umount.c b/shlibs/mount/src/context_umount.c
index eeb7f2666..9bbdc29af 100644
--- a/shlibs/mount/src/context_umount.c
+++ b/shlibs/mount/src/context_umount.c
@@ -444,7 +444,7 @@ static int do_umount(mnt_context *cxt)
* mnt_context_do_umount:
* @cxt: mount context
*
- * Umount filesystem by umount(2) or fork()+exec(/sbin/umount.<type>).
+ * Umount filesystem by umount(2) or fork()+exec(/sbin/umount.type).
*
* See also mnt_context_disable_helpers().
*
diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c
index 21e02f3df..9078f406c 100644
--- a/shlibs/mount/src/fs.c
+++ b/shlibs/mount/src/fs.c
@@ -145,10 +145,7 @@ err:
return NULL;
}
-/**
- * mnt_copy_mtab_fs:
- * @fs: filesystem
- *
+/*
* This function copies all @fs description except information that does not
* belong to /etc/mtab (e.g. VFS and userspace mount options with MNT_NOMTAB
* mask).
@@ -213,6 +210,7 @@ void *mnt_fs_get_userdata(mnt_fs *fs)
/**
* mnt_fs_set_userdata:
* @fs: mnt_file instance
+ * @data: user data
*
* The "userdata" are library independent data.
*
@@ -546,6 +544,7 @@ char *mnt_fs_strdup_options(mnt_fs *fs)
/**
* mnt_fs_set_options:
* @fs: fstab/mtab/mountinfo entry pointer
+ * @optstr: options string
*
* Splits @optstr to VFS, FS and userspace mount options and update relevat
* parts of @fs.
diff --git a/shlibs/mount/src/lock.c b/shlibs/mount/src/lock.c
index b4fa7f7d1..4ba59fe47 100644
--- a/shlibs/mount/src/lock.c
+++ b/shlibs/mount/src/lock.c
@@ -45,7 +45,7 @@ struct _mnt_lock {
/**
* mnt_new_lock:
- * @dataname: the file that should be covered by the lock
+ * @datafile: the file that should be covered by the lock
* @id: unique linkfile identifier or 0 (default is getpid())
*
* Returns: newly allocated lock handler or NULL on case of error.
@@ -101,27 +101,21 @@ void mnt_free_lock(mnt_lock *ml)
free(ml);
}
-/**
- * mnt_lock_get_lockfile:
- * @ml: mnt_lock handler
- *
- * Returns: path to lockfile.
+/*
+ * Returns path to lockfile.
*/
-const char *mnt_lock_get_lockfile(mnt_lock *ml)
+static const char *mnt_lock_get_lockfile(mnt_lock *ml)
{
return ml ? ml->lockfile : NULL;
}
-/**
- * mnt_lock_get_linkfile:
- * @ml: mnt_lock handler
- *
+/*
* Note that the filename is generated by mnt_new_lock() and depends on
* getpid() or 'id' argument of the mnt_new_lock() function.
*
* Returns: unique (per process/thread) path to linkfile.
*/
-const char *mnt_lock_get_linkfile(mnt_lock *ml)
+static const char *mnt_lock_get_linkfile(mnt_lock *ml)
{
return ml ? ml->linkfile : NULL;
}
diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in
index 3b1b5ca48..7710192a0 100644
--- a/shlibs/mount/src/mount.h.in
+++ b/shlibs/mount/src/mount.h.in
@@ -126,10 +126,6 @@ extern int mnt_match_fstype(const char *type, const char *pattern);
extern int mnt_match_options(const char *optstr, const char *pattern);
extern const char *mnt_get_fstab_path(void);
extern const char *mnt_get_mtab_path(void);
-
-extern int mnt_get_filesystems(char ***filesystems, const char *pattern);
-extern void mnt_free_filesystems(char **filesystems);
-
extern int mnt_has_regular_mtab(const char **mtab, int *writable);
/* cache.c */
@@ -162,7 +158,7 @@ extern int mnt_optstr_remove_option(char **optstr, const char *name);
extern int mnt_split_optstr(const char *optstr,
char **user, char **vfs, char **fs,
- int ifnore_user, int ignore_vfs);
+ int ignore_user, int ignore_vfs);
extern int mnt_optstr_get_options(const char *optstr, char **subset,
const struct mnt_optmap *map, int ignore);
@@ -179,8 +175,8 @@ enum {
MNT_ITER_BACKWARD
};
extern mnt_iter *mnt_new_iter(int direction);
-extern void mnt_free_iter(mnt_iter *mi);
-extern void mnt_reset_iter(mnt_iter *mi, 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);
/* optmap.c */
@@ -193,33 +189,28 @@ extern const struct mnt_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 const char *mnt_lock_get_lockfile(mnt_lock *ml);
-extern const char *mnt_lock_get_linkfile(mnt_lock *ml);
-
extern void mnt_unlock_file(mnt_lock *ml);
extern int mnt_lock_file(mnt_lock *ml);
/* fs.c */
extern mnt_fs *mnt_new_fs(void);
-extern void mnt_free_fs(mnt_fs *ent);
+extern void mnt_free_fs(mnt_fs *fs);
extern mnt_fs *mnt_copy_fs(const mnt_fs *fs);
-extern mnt_fs *mnt_copy_mtab_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 *ent);
-extern int mnt_fs_set_source(mnt_fs *ent, const char *source);
-extern const char *mnt_fs_get_srcpath(mnt_fs *ent);
-extern int mnt_fs_get_tag(mnt_fs *ent, const char **name, const char **value);
-extern const char *mnt_fs_get_target(mnt_fs *ent);
-extern int mnt_fs_set_target(mnt_fs *ent, const char *target);
-extern const char *mnt_fs_get_fstype(mnt_fs *ent);
-extern int mnt_fs_set_fstype(mnt_fs *ent, const char *fstype);
+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 *ent, const char *name,
+extern int mnt_fs_get_option(mnt_fs *fs, const char *name,
char **value, size_t *valsz);
extern int mnt_fs_append_options(mnt_fs *fs, const char *optstr);
@@ -247,10 +238,10 @@ extern int mnt_fs_get_attribute(mnt_fs *fs, const char *name,
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 *ent);
-extern int mnt_fs_set_freq(mnt_fs *ent, int freq);
-extern int mnt_fs_get_passno(mnt_fs *ent);
-extern int mnt_fs_set_passno(mnt_fs *ent, int passno);
+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);
@@ -263,7 +254,7 @@ 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 *ent, FILE *file);
+extern int mnt_fs_print_debug(mnt_fs *fs, FILE *file);
extern void mnt_free_mntent(struct mntent *mnt);
extern int mnt_fs_to_mntent(mnt_fs *fs, struct mntent **mnt);
diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym
index a62615e8e..673f8c80a 100644
--- a/shlibs/mount/src/mount.sym
+++ b/shlibs/mount/src/mount.sym
@@ -46,10 +46,8 @@ global:
mnt_context_set_userspace_mountflags;
mnt_context_strerror;
mnt_copy_fs;
- mnt_copy_mtab_fs;
mnt_free_cache;
mnt_free_context;
- mnt_free_filesystems;
mnt_free_fs;
mnt_free_iter;
mnt_free_lock;
@@ -107,7 +105,6 @@ global:
mnt_fs_to_mntent;
mnt_fstype_is_netfs;
mnt_fstype_is_pseudofs;
- mnt_get_filesystems;
mnt_get_fstab_path;
mnt_get_fstype;
mnt_get_library_version;
@@ -116,8 +113,6 @@ global:
mnt_init_debug;
mnt_iter_get_direction;
mnt_lock_file;
- mnt_lock_get_linkfile;
- mnt_lock_get_lockfile;
mnt_mangle;
mnt_match_fstype;
mnt_match_options;
diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h
index 351bd3c57..f9e3a3f7d 100644
--- a/shlibs/mount/src/mountP.h
+++ b/shlibs/mount/src/mountP.h
@@ -123,6 +123,9 @@ extern int mnt_open_uniq_filename(const char *filename, char **name, int flags);
extern int mnt_has_regular_utab(const char **utab, int *writable);
extern const char *mnt_get_utab_path(void);
+extern int mnt_get_filesystems(char ***filesystems, const char *pattern);
+extern void mnt_free_filesystems(char **filesystems);
+
/*
* Generic iterator
*/
@@ -292,10 +295,6 @@ struct _mnt_context
extern const struct mnt_optmap *mnt_optmap_get_entry(struct mnt_optmap const **maps,
int nmaps, const char *name,
size_t namelen, const struct mnt_optmap **mapent);
-extern int mnt_optmap_enum_to_number(const struct mnt_optmap *mapent,
- const char *rawdata, size_t len);
-extern const char *mnt_optmap_get_type(const struct mnt_optmap *mapent);
-extern int mnt_optmap_require_value(const struct mnt_optmap *mapent);
/* optstr.c */
extern int mnt_optstr_remove_option_at(char **optstr, char *begin, char *end);
@@ -305,10 +304,9 @@ 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 int __mnt_fs_set_optstr_ptr(mnt_fs *fs, char *optstr, int split);
-extern int __mnt_fs_set_optstr(mnt_fs *fs, const char *optstr, int split);
/* context.c */
extern int mnt_context_prepare_srcpath(mnt_context *cxt);
diff --git a/shlibs/mount/src/optmap.c b/shlibs/mount/src/optmap.c
index 38256b09d..307a5d4b6 100644
--- a/shlibs/mount/src/optmap.c
+++ b/shlibs/mount/src/optmap.c
@@ -16,37 +16,21 @@
*
* @mountdata: (usully a comma separated string of options)
*
- * The libmount uses options-map(s) to describe mount options. The number of
- * maps is unlimited. The libmount options parser could be easily extended
- * (e.g. by mnt_optls_add_map()) to work with new options.
+ * The libmount uses options-map(s) to describe mount options.
*
* The option description (map entry) includes:
*
- * @name: and argument type (e.g. "loop[=%s]")
+ * @name: and argument name
*
* @id: (in the map unique identifier or a mountflags, e.g MS_RDONLY)
*
* @mask: (MNT_INVERT, MNT_NOMTAB)
*
- * The option argument type is defined by:
+ * The option argument value is defined by:
*
- * "=type" -- required argument
+ * "=" -- required argument, e.g "comment="
*
- * "[=type]" -- optional argument
- *
- * where the 'type' is sscanf() format string or
- *
- * {item0,item1,...} -- enum (mnt_option_get_number() converts the value
- * to 0..N number)
- *
- * The options argument format is used for parsing only. The library internally
- * stores the option argument as a string. The conversion to the data type is
- * on-demant by mnt_option_get_value_*() functions.
- *
- * The library checks options argument according to 'type' format for simple
- * formats only:
- *
- * %s, %d, %ld, %lld, %u, %lu, %llu, %x, %o and {enum}
+ * "[=]" -- optional argument, e.g. "loop[=]"
*
* Example:
*
@@ -58,7 +42,7 @@
* mnt_optmap myoptions[] = {
* { "foo", MY_MS_FOO },
* { "nofoo", MY_MS_FOO | MNT_INVERT },
- * { "bar=%s",MY_MS_BAR },
+ * { "bar=", MY_MS_BAR },
* { NULL }
* };
* </programlisting>
@@ -149,7 +133,7 @@ static const struct mnt_optmap userspace_opts_map[] =
{ "auto", MNT_MS_NOAUTO, MNT_INVERT | MNT_NOMTAB }, /* Can be mounted using -a */
{ "noauto", MNT_MS_NOAUTO, MNT_NOMTAB }, /* Can only be mounted explicitly */
- { "user[=%s]", MNT_MS_USER }, /* Allow ordinary user to mount (mtab) */
+ { "user[=]", MNT_MS_USER }, /* Allow ordinary user to mount (mtab) */
{ "nouser", MNT_MS_USER, MNT_INVERT | MNT_NOMTAB }, /* Forbid ordinary user to mount */
{ "users", MNT_MS_USERS, MNT_NOMTAB }, /* Allow ordinary users to mount */
@@ -163,13 +147,13 @@ static const struct mnt_optmap userspace_opts_map[] =
{ "_netdev", MNT_MS_NETDEV }, /* Device requires network */
- { "comment=%s", MNT_MS_COMMENT, MNT_NOMTAB }, /* fstab comment only */
+ { "comment=", MNT_MS_COMMENT, MNT_NOMTAB }, /* fstab comment only */
- { "loop[=%s]", MNT_MS_LOOP }, /* use the loop device */
+ { "loop[=]", MNT_MS_LOOP }, /* use the loop device */
{ "nofail", MNT_MS_NOFAIL, MNT_NOMTAB }, /* Do not fail if ENOENT on dev */
- { "uhelper=%s", MNT_MS_UHELPER }, /* /sbin/umount.<helper> */
+ { "uhelper=", MNT_MS_UHELPER }, /* /sbin/umount.<helper> */
{ NULL, 0, 0 }
};
@@ -237,85 +221,3 @@ const struct mnt_optmap *mnt_optmap_get_entry(
return NULL;
}
-
-/*
- * Converts @rawdata to number according to enum definition in the @mapent.
- */
-int mnt_optmap_enum_to_number(const struct mnt_optmap *mapent,
- const char *rawdata, size_t len)
-{
- const char *p, *end = NULL, *begin = NULL;
- int n = -1;
-
- if (!rawdata || !*rawdata || !mapent || !len)
- return -EINVAL;
-
- p = strrchr(mapent->name, '=');
- if (!p || *(p + 1) == '{')
- return -EINVAL; /* value unexpected or not "enum" */
- p += 2;
- if (!*p || *(p + 1) == '}')
- return -EINVAL; /* hmm... option <type> is "={" or "={}" */
-
- /* we cannot use strstr(), @rawdata is not terminated */
- for (; p && *p; p++) {
- if (!begin)
- begin = p; /* begin of the item */
- if (*p == ',')
- end = p; /* terminate the item */
- if (*(p + 1) == '}')
- end = p + 1; /* end of enum definition */
- if (!begin || !end)
- continue;
- if (end <= begin)
- return -EINVAL;
- n++;
- if (len == end - begin && strncasecmp(begin, rawdata, len) == 0)
- return n;
- p = end;
- }
-
- return -1;
-}
-
-/*
- * Returns data type defined in the @mapent.
- */
-const char *mnt_optmap_get_type(const struct mnt_optmap *mapent)
-{
- char *type;
-
- assert(mapent);
- assert(mapent->name);
-
- type = strrchr(mapent->name, '=');
- if (!type)
- return NULL; /* value is unexpected */
- if (type == mapent->name)
- return NULL; /* wrong format of type definition */
- type++;
- if (*type != '%' && *type != '{')
- return NULL; /* wrong format of type definition */
- return type ? : NULL;
-}
-
-/*
- * Does the option (that is described by @mntent) require any value? (e.g.
- * uid=<foo>)
- */
-int mnt_optmap_require_value(const struct mnt_optmap *mapent)
-{
- char *type;
-
- assert(mapent);
- assert(mapent->name);
-
- type = strchr(mapent->name, '=');
- if (!type)
- return 0; /* value is unexpected */
- if (type == mapent->name)
- return 0; /* wrong format of type definition */
- if (*(type - 1) == '[')
- return 0; /* optional */
- return 1;
-}
diff --git a/shlibs/mount/src/optstr.c b/shlibs/mount/src/optstr.c
index 7c41f6857..8894dfba6 100644
--- a/shlibs/mount/src/optstr.c
+++ b/shlibs/mount/src/optstr.c
@@ -454,8 +454,7 @@ 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;
@@ -569,6 +568,7 @@ int mnt_optstr_get_options(const char *optstr, char **subset,
* mnt_optstr_get_flags:
* @optstr: string with comma separated list of options
* @flags: returns mount flags
+ * @map: options map
*
* Returns in @flags IDs of options from @optstr as defined in the @map.
*
@@ -583,7 +583,6 @@ 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)
{
@@ -615,7 +614,7 @@ int mnt_optstr_get_flags(const char *optstr, unsigned long *flags,
}
/**
- * mnt_optstr_apply_mountflags:
+ * mnt_optstr_apply_flags:
* @optstr: string with comma separated list of options
* @flags: returns mount flags
* @map: options map
@@ -717,9 +716,9 @@ int mnt_optstr_apply_flags(char **optstr, unsigned long flags,
p = strchr(ent->name, '=');
if (p) {
if (*(p - 1) == '[')
- p--; /* name[=%s] */
+ p--; /* name[=] */
else
- continue; /* name=%s */
+ continue; /* name= */
p = strndup(ent->name, p - ent->name);
if (!p) {
diff --git a/shlibs/mount/src/tab.c b/shlibs/mount/src/tab.c
index 94683c192..6f845e21c 100644
--- a/shlibs/mount/src/tab.c
+++ b/shlibs/mount/src/tab.c
@@ -7,7 +7,7 @@
/**
* SECTION: tab
- * @title: FS container
+ * @title: Table of filesystems
* @short_description: container for entries from fstab/mtab/mountinfo
*
*
@@ -300,7 +300,7 @@ int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr,
*
* Returns: 0 on success, negative number in case of error or 1 at end of list.
*
- * Example (list all mountpoints from fstab in backward order):
+ * Example:
* <informalexample>
* <programlisting>
* mnt_fs *fs;
@@ -316,6 +316,8 @@ int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr,
* mnt_free_tab(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)
{
diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c
index 335f703aa..e202bc9c6 100644
--- a/shlibs/mount/src/tab_parse.c
+++ b/shlibs/mount/src/tab_parse.c
@@ -522,7 +522,7 @@ mnt_tab *mnt_new_tab_from_dir(const char *dirname)
/**
* mnt_tab_set_parser_errcb:
- * @tab: pointer to table
+ * @tb: pointer to table
* @cb: pointer to callback function
*
* The error callback function is called by table parser (mnt_tab_parse_file())
diff --git a/shlibs/mount/src/tab_update.c b/shlibs/mount/src/tab_update.c
index 9638f47c9..cf32baf15 100644
--- a/shlibs/mount/src/tab_update.c
+++ b/shlibs/mount/src/tab_update.c
@@ -7,8 +7,15 @@
/**
* SECTION: update
- * @title: mtab (fstab) managment
- * @short_description: userspace mount information management
+ * @title: mtab managment
+ * @short_description: userspace mount information management.
+ *
+ * The mnt_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.
*/
#include <stdio.h>
@@ -770,6 +777,7 @@ static int update_modify_options(mnt_update *upd, mnt_lock *lc)
/**
* mnt_update_tab:
+ * @upd: update
* @lc: lock
*
* High-level API to update /etc/mtab (or private /dev/.mount/utab file).
diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c
index c97144dcb..99708333a 100644
--- a/shlibs/mount/src/utils.c
+++ b/shlibs/mount/src/utils.c
@@ -613,7 +613,7 @@ const char *mnt_get_fstab_path(void)
* mnt_get_mtab_path:
*
* This function returns *default* location of the mtab file. The result does
- * not have to be writable. See also mnt_get_writable_mtab_path().
+ * not have to be writable. See also mnt_has_regular_mtab().
*
* Returns: path to /etc/mtab or $LIBMOUNT_MTAB.
*/