summaryrefslogtreecommitdiffstats
path: root/libmount/src/mountP.h
diff options
context:
space:
mode:
authorKarel Zak2017-04-27 14:01:26 +0200
committerKarel Zak2017-04-27 14:10:23 +0200
commitea848180dd344ec2859b5ca329d9b1375ddde1ac (patch)
tree3891525fa351a694f83fc19d17c048d0771f0722 /libmount/src/mountP.h
parentlibmount: support MS_RDONLY on write-protected devices (diff)
downloadkernel-qcow2-util-linux-ea848180dd344ec2859b5ca329d9b1375ddde1ac.tar.gz
kernel-qcow2-util-linux-ea848180dd344ec2859b5ca329d9b1375ddde1ac.tar.xz
kernel-qcow2-util-linux-ea848180dd344ec2859b5ca329d9b1375ddde1ac.zip
libmount: add mnt_context_get_excode()
It's pretty complex task to make mount(8) and umount(8) return code and generate error message. It seems better to do that in the libmount rather than force all library users to duplicate mount(8) mk_exit_code() functions. It also means that all the messages will be translated only once. Changes: * all error messages are printed by warn() * no more multi-line messages * all messages prefixed by mount target (mountpoint) * library provides mount(8) compatible MNT_EX_* codes Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1429531 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/mountP.h')
-rw-r--r--libmount/src/mountP.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h
index 42957ecb9..e01de337d 100644
--- a/libmount/src/mountP.h
+++ b/libmount/src/mountP.h
@@ -50,6 +50,18 @@ UL_DEBUG_DECLARE_MASK(libmount);
#define ON_DBG(m, x) __UL_DBG_CALL(libmount, MNT_DEBUG_, m, x)
#define DBG_FLUSH __UL_DBG_FLUSH(libmount, MNT_DEBUG_)
+/*
+ * NLS -- the library has to be independent on main program, so define
+ * UL_TEXTDOMAIN_EXPLICIT before you include nls.h.
+ *
+ * Now we use util-linux.po (=PACKAGE), rather than maintain the texts
+ * in the separate libmount.po file.
+ */
+#define LIBMOUNT_TEXTDOMAIN PACKAGE
+#define UL_TEXTDOMAIN_EXPLICIT LIBMOUNT_TEXTDOMAIN
+#include "nls.h"
+
+
/* extension for files in the directory */
#define MNT_MNTTABDIR_EXT ".fstab"
@@ -313,6 +325,8 @@ struct libmnt_context
int syscall_status; /* 1: not called yet, 0: success, <0: -errno */
+
+ unsigned int enabled_textdomain : 1; /* bindtextdomain() called */
};
/* flags */
@@ -410,6 +424,10 @@ extern int mnt_context_set_tabfilter(struct libmnt_context *cxt,
int (*fltr)(struct libmnt_fs *, void *),
void *data);
+extern int mnt_context_get_generic_excode(int rc, char *buf, size_t bufsz, char *fmt, ...);
+extern int mnt_context_get_mount_excode(struct libmnt_context *cxt, int mntrc, char *buf, size_t bufsz);
+extern int mnt_context_get_umount_excode(struct libmnt_context *cxt, int mntrc, char *buf, size_t bufsz);
+
/* tab_update.c */
extern int mnt_update_set_filename(struct libmnt_update *upd,
const char *filename, int userspace_only);