From a5de4460732106b81bac2e1b16969590c94ed139 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <707b9b97153063374d2530e72c49b1499fc21af9.1367947969.git.minovotn@redhat.com> References: <707b9b97153063374d2530e72c49b1499fc21af9.1367947969.git.minovotn@redhat.com> From: Michal Novotny Date: Tue, 7 May 2013 18:38:16 +0200 Subject: [PATCH 048/114] Revert "reimplement error_setg() and error_setg_errno() for RHEL-6" This reverts commit b4e0d7063a49cc2835f9f6e168dc1d4a70215519. Reverting as asked by Laszlo in message <51892739.2030807@redhat.com> because of the ordering issue (most likely) related to supersed testing. Signed-off-by: Michal Novotny --- error.c | 43 ------------------------------------------- error.h | 15 +++------------ qerror.c | 4 ---- qerror.h | 3 --- 4 files changed, 3 insertions(+), 62 deletions(-) diff --git a/error.c b/error.c index 50b1290..acf54f3 100644 --- a/error.c +++ b/error.c @@ -14,7 +14,6 @@ #include "qemu-objects.h" #include "qerror.h" #include -#include struct Error { @@ -42,48 +41,6 @@ void error_set(Error **errp, const char *fmt, ...) *errp = err; } -/* RHEL-6 note: - * - * The following function, error_vsetg_errno(), and the implementation of - * error_setg_errno() and error_setg() below, are RHEL-6 only compatibility - * code. The RHEL-6 Error object is incompatible with that of upstream, but the - * structure is not externally visible. - */ -static void error_vsetg_errno(Error **errp, int os_errno, const char *fmt, - va_list ap) -{ - char *msg; - - msg = g_strdup_vprintf(fmt, ap); - if (os_errno != 0) { - char *msg2; - - msg2 = g_strdup_printf("%s: %s", msg, strerror(os_errno)); - free(msg); - msg = msg2; - } - error_set(errp, QERR_GENERIC_ERROR, msg); - free(msg); -} - -void error_setg_errno(Error **errp, int os_errno, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - error_vsetg_errno(errp, os_errno, fmt, ap); - va_end(ap); -} - -void error_setg(Error **errp, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - error_vsetg_errno(errp, 0, fmt, ap); - va_end(ap); -} - bool error_is_set(Error **errp) { return (errp && *errp); diff --git a/error.h b/error.h index 1f736c9..003c855 100644 --- a/error.h +++ b/error.h @@ -21,23 +21,14 @@ typedef struct Error Error; /** - * Set an indirect pointer to an error given a printf-style JSON format - * parameter. Currently, qerror.h defines these error formats. This function - * is not meant to be used outside of QEMU. + * Set an indirect pointer to an error given a printf-style format parameter. + * Currently, qerror.h defines these error formats. This function is not + * meant to be used outside of QEMU. */ void error_set(Error **err, const char *fmt, ...) __attribute__((format(printf, 2, 3))); /** - * Wrapper functions for error_set(): the format string is raw printf-style, - * and the output is always flattened into a QERR_GENERIC_ERROR. - */ -void error_setg_errno(Error **errp, int os_errno, const char *fmt, ...) - __attribute__((format(printf, 3, 4))); -void error_setg(Error **errp, const char *fmt, ...) - __attribute__((format(printf, 2, 3))); - -/** * Returns true if an indirect pointer to an error is pointing to a valid * error object. */ diff --git a/qerror.c b/qerror.c index cc26e61..407263c 100644 --- a/qerror.c +++ b/qerror.c @@ -258,10 +258,6 @@ static const QErrorStringTable qerror_table[] = { .desc = "An undefined error has ocurred", }, { - .error_fmt = QERR_GENERIC_ERROR, - .desc = "%(message)", - }, - { .error_fmt = QERR_UNSUPPORTED, .desc = "this feature or command is not currently supported", }, diff --git a/qerror.h b/qerror.h index d3acc94..ae7b5a5 100644 --- a/qerror.h +++ b/qerror.h @@ -217,9 +217,6 @@ QError *qobject_to_qerror(const QObject *obj); #define QERR_UNDEFINED_ERROR \ "{ 'class': 'UndefinedError', 'data': {} }" -#define QERR_GENERIC_ERROR \ - "{ 'class': 'GenericError', 'data': { 'message': %s } }" - #define QERR_UNSUPPORTED \ "{ 'class': 'Unsupported', 'data': {} }" -- 1.7.11.7