Move internal error APIs into virterror_internal.h & drop leading __ prefix

This commit is contained in:
Daniel P. Berrange 2008-11-04 22:30:33 +00:00
parent 78439117bc
commit d714b2afae
45 changed files with 255 additions and 189 deletions

View File

@ -1,3 +1,27 @@
Tue Nov 4 22:20:31 UTC 2008 Daniel P. Berrange <berrange@redhat.com>
Move internal error API declarations into their own file
* src/Makefile.am, src/virterror_internal.h: Add file for
internal error reporting APIs.
* src/internal.c: Remove virRaiseError/virReportError API
declarations
* src/conf.c, src/domain_conf.c, src/hash.c,
src/libvirt.c, src/lxc_conf.c, src/lxc_conf.h,
src/lxc_container.c, src/lxc_controller.c, src/lxc_driver.c,
src/network_conf.c, src/network_driver.c, src/nodeinfo.c,
src/openvz_conf.c, src/openvz_conf.h, src/openvz_driver.c,
src/proxy_internal.c, src/qemu_conf.c, src/qemu_conf.h,
src/qemu_driver.c, src/qparams.c, src/remote_internal.c,
src/sexpr.c, src/stats_linux.c, src/storage_backend.c,
src/storage_backend_disk.c, src/storage_backend_fs.c,
src/storage_backend_iscsi.c, src/storage_backend_logical.c,
src/storage_conf.c, src/storage_conf.h, src/storage_driver.c,
src/test.c, src/util.c, src/virterror.c, src/xen_internal.c,
src/xen_unified.c, src/xend_internal.c, src/xm_internal.c,
src/xml.c, src/xmlrpc.c, src/xs_internal.c: Add includes
of new virterror_internal.h file where required, and remove
leading __ from virRaiseError api calls
Tue Nov 4 22:14:31 UTC 2008 Daniel P. Berrange <berrange@redhat.com> Tue Nov 4 22:14:31 UTC 2008 Daniel P. Berrange <berrange@redhat.com>
Support passing UUID and ID to qemu/xenner Support passing UUID and ID to qemu/xenner

View File

@ -50,7 +50,7 @@ GENERIC_LIB_SOURCES = \
stats_linux.c stats_linux.h \ stats_linux.c stats_linux.h \
uuid.c uuid.h \ uuid.c uuid.h \
util.c util.h \ util.c util.h \
virterror.c \ virterror.c virterror_internal.h \
xml.c xml.h xml.c xml.h
# Domain driver generic impl APIs # Domain driver generic impl APIs
@ -149,7 +149,7 @@ libvirt_la_SOURCES = \
driver.h \ driver.h \
hash.c hash.h \ hash.c hash.h \
internal.h \ internal.h \
libvirt.c \ libvirt.c libvirt_internal.h \
$(GENERIC_LIB_SOURCES) \ $(GENERIC_LIB_SOURCES) \
$(DOMAIN_CONF_SOURCES) \ $(DOMAIN_CONF_SOURCES) \
$(NETWORK_CONF_SOURCES) \ $(NETWORK_CONF_SOURCES) \

View File

@ -18,7 +18,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include "internal.h" #include "virterror_internal.h"
#include "buf.h" #include "buf.h"
#include "conf.h" #include "conf.h"
#include "util.h" #include "util.h"
@ -96,13 +96,13 @@ virConfError(virConfParserCtxtPtr ctxt,
/* Construct the string 'filename:line: info' if we have that. */ /* Construct the string 'filename:line: info' if we have that. */
if (ctxt && ctxt->filename) { if (ctxt && ctxt->filename) {
__virRaiseError(NULL, NULL, NULL, VIR_FROM_CONF, error, VIR_ERR_ERROR, virRaiseError(NULL, NULL, NULL, VIR_FROM_CONF, error, VIR_ERR_ERROR,
info, ctxt->filename, NULL, info, ctxt->filename, NULL,
ctxt->line, 0, ctxt->line, 0,
"%s:%d: %s", ctxt->filename, ctxt->line, info); "%s:%d: %s", ctxt->filename, ctxt->line, info);
} else { } else {
format = __virErrorMsg(error, info); format = virErrorMsg(error, info);
__virRaiseError(NULL, NULL, NULL, VIR_FROM_CONF, error, VIR_ERR_ERROR, virRaiseError(NULL, NULL, NULL, VIR_FROM_CONF, error, VIR_ERR_ERROR,
info, NULL, NULL, info, NULL, NULL,
ctxt ? ctxt->line : 0, 0, ctxt ? ctxt->line : 0, 0,
format, info); format, info);

View File

@ -29,8 +29,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <dirent.h> #include <dirent.h>
#include "internal.h" #include "virterror_internal.h"
#include "domain_conf.h" #include "domain_conf.h"
#include "memory.h" #include "memory.h"
#include "verify.h" #include "verify.h"
@ -142,7 +141,7 @@ VIR_ENUM_IMPL(virDomainHostdevSubsys, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST,
"pci") "pci")
#define virDomainReportError(conn, code, fmt...) \ #define virDomainReportError(conn, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_DOMAIN, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_DOMAIN, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
virDomainObjPtr virDomainFindByID(const virDomainObjListPtr doms, virDomainObjPtr virDomainFindByID(const virDomainObjListPtr doms,

View File

@ -23,7 +23,8 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <libxml/threads.h> #include <libxml/threads.h>
#include "internal.h"
#include "virterror_internal.h"
#include "hash.h" #include "hash.h"
#include "memory.h" #include "memory.h"
@ -32,7 +33,7 @@
/* #define DEBUG_GROW */ /* #define DEBUG_GROW */
#define virHashError(conn, code, fmt...) \ #define virHashError(conn, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
/* /*
@ -732,8 +733,8 @@ virReleaseConnect(virConnectPtr conn) {
virHashFree(conn->storageVols, (virHashDeallocator) virStorageVolFreeName); virHashFree(conn->storageVols, (virHashDeallocator) virStorageVolFreeName);
virResetError(&conn->err); virResetError(&conn->err);
if (__lastErr.conn == conn) if (virLastErr.conn == conn)
__lastErr.conn = NULL; virLastErr.conn = NULL;
VIR_FREE(conn->name); VIR_FREE(conn->name);
@ -862,8 +863,8 @@ virReleaseDomain(virDomainPtr domain) {
if (conn->err.dom == domain) if (conn->err.dom == domain)
conn->err.dom = NULL; conn->err.dom = NULL;
if (__lastErr.dom == domain) if (virLastErr.dom == domain)
__lastErr.dom = NULL; virLastErr.dom = NULL;
domain->magic = -1; domain->magic = -1;
domain->id = -1; domain->id = -1;
VIR_FREE(domain->name); VIR_FREE(domain->name);
@ -998,8 +999,8 @@ virReleaseNetwork(virNetworkPtr network) {
if (conn->err.net == network) if (conn->err.net == network)
conn->err.net = NULL; conn->err.net = NULL;
if (__lastErr.net == network) if (virLastErr.net == network)
__lastErr.net = NULL; virLastErr.net = NULL;
network->magic = -1; network->magic = -1;
VIR_FREE(network->name); VIR_FREE(network->name);

View File

@ -295,30 +295,6 @@ struct _virStorageVol {
}; };
/************************************************************************
* *
* API for error handling *
* *
************************************************************************/
extern virError __lastErr;
void __virRaiseError(virConnectPtr conn,
virDomainPtr dom,
virNetworkPtr net,
int domain,
int code,
virErrorLevel level,
const char *str1,
const char *str2,
const char *str3,
int int1, int int2, const char *msg, ...)
ATTRIBUTE_FORMAT(printf, 12, 13);
const char *__virErrorMsg(virErrorNumber error, const char *info);
void __virReportErrorHelper(virConnectPtr conn, int domcode, int errcode,
const char *filename ATTRIBUTE_UNUSED,
const char *funcname ATTRIBUTE_UNUSED,
long long linenr ATTRIBUTE_UNUSED,
const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 7, 8);
/************************************************************************ /************************************************************************
* * * *

View File

@ -31,7 +31,7 @@
#include <winsock2.h> #include <winsock2.h>
#endif #endif
#include "internal.h" #include "virterror_internal.h"
#include "driver.h" #include "driver.h"
#include "uuid.h" #include "uuid.h"
@ -325,9 +325,9 @@ virLibConnError(virConnectPtr conn, virErrorNumber error, const char *info)
if (error == VIR_ERR_OK) if (error == VIR_ERR_OK)
return; return;
errmsg = __virErrorMsg(error, info); errmsg = virErrorMsg(error, info);
__virRaiseError(conn, NULL, NULL, VIR_FROM_NONE, error, VIR_ERR_ERROR, virRaiseError(conn, NULL, NULL, VIR_FROM_NONE, error, VIR_ERR_ERROR,
errmsg, info, NULL, 0, 0, errmsg, info); errmsg, info, NULL, 0, 0, errmsg, info);
} }
/** /**
@ -346,9 +346,9 @@ virLibConnWarning(virConnectPtr conn, virErrorNumber error, const char *info)
if (error == VIR_ERR_OK) if (error == VIR_ERR_OK)
return; return;
errmsg = __virErrorMsg(error, info); errmsg = virErrorMsg(error, info);
__virRaiseError(conn, NULL, NULL, VIR_FROM_NONE, error, VIR_ERR_WARNING, virRaiseError(conn, NULL, NULL, VIR_FROM_NONE, error, VIR_ERR_WARNING,
errmsg, info, NULL, 0, 0, errmsg, info); errmsg, info, NULL, 0, 0, errmsg, info);
} }
/** /**
@ -369,12 +369,12 @@ virLibDomainError(virDomainPtr domain, virErrorNumber error,
if (error == VIR_ERR_OK) if (error == VIR_ERR_OK)
return; return;
errmsg = __virErrorMsg(error, info); errmsg = virErrorMsg(error, info);
if (error != VIR_ERR_INVALID_DOMAIN) { if (error != VIR_ERR_INVALID_DOMAIN) {
conn = domain->conn; conn = domain->conn;
} }
__virRaiseError(conn, domain, NULL, VIR_FROM_DOM, error, VIR_ERR_ERROR, virRaiseError(conn, domain, NULL, VIR_FROM_DOM, error, VIR_ERR_ERROR,
errmsg, info, NULL, 0, 0, errmsg, info); errmsg, info, NULL, 0, 0, errmsg, info);
} }
/** /**
@ -395,12 +395,12 @@ virLibNetworkError(virNetworkPtr network, virErrorNumber error,
if (error == VIR_ERR_OK) if (error == VIR_ERR_OK)
return; return;
errmsg = __virErrorMsg(error, info); errmsg = virErrorMsg(error, info);
if (error != VIR_ERR_INVALID_NETWORK) { if (error != VIR_ERR_INVALID_NETWORK) {
conn = network->conn; conn = network->conn;
} }
__virRaiseError(conn, NULL, network, VIR_FROM_NET, error, VIR_ERR_ERROR, virRaiseError(conn, NULL, network, VIR_FROM_NET, error, VIR_ERR_ERROR,
errmsg, info, NULL, 0, 0, errmsg, info); errmsg, info, NULL, 0, 0, errmsg, info);
} }
/** /**
@ -421,12 +421,12 @@ virLibStoragePoolError(virStoragePoolPtr pool, virErrorNumber error,
if (error == VIR_ERR_OK) if (error == VIR_ERR_OK)
return; return;
errmsg = __virErrorMsg(error, info); errmsg = virErrorMsg(error, info);
if (error != VIR_ERR_INVALID_STORAGE_POOL) if (error != VIR_ERR_INVALID_STORAGE_POOL)
conn = pool->conn; conn = pool->conn;
__virRaiseError(conn, NULL, NULL, VIR_FROM_STORAGE, error, VIR_ERR_ERROR, virRaiseError(conn, NULL, NULL, VIR_FROM_STORAGE, error, VIR_ERR_ERROR,
errmsg, info, NULL, 0, 0, errmsg, info); errmsg, info, NULL, 0, 0, errmsg, info);
} }
/** /**
@ -447,12 +447,12 @@ virLibStorageVolError(virStorageVolPtr vol, virErrorNumber error,
if (error == VIR_ERR_OK) if (error == VIR_ERR_OK)
return; return;
errmsg = __virErrorMsg(error, info); errmsg = virErrorMsg(error, info);
if (error != VIR_ERR_INVALID_STORAGE_VOL) if (error != VIR_ERR_INVALID_STORAGE_VOL)
conn = vol->conn; conn = vol->conn;
__virRaiseError(conn, NULL, NULL, VIR_FROM_STORAGE, error, VIR_ERR_ERROR, virRaiseError(conn, NULL, NULL, VIR_FROM_STORAGE, error, VIR_ERR_ERROR,
errmsg, info, NULL, 0, 0, errmsg, info); errmsg, info, NULL, 0, 0, errmsg, info);
} }
/** /**
@ -855,13 +855,13 @@ failed:
/* If no global error was set, copy any error set /* If no global error was set, copy any error set
in the connection object we're about to dispose of */ in the connection object we're about to dispose of */
if (__lastErr.code == VIR_ERR_OK) { if (virLastErr.code == VIR_ERR_OK) {
memcpy(&__lastErr, &ret->err, sizeof(ret->err)); memcpy(&virLastErr, &ret->err, sizeof(ret->err));
memset(&ret->err, 0, sizeof(ret->err)); memset(&ret->err, 0, sizeof(ret->err));
} }
/* Still no error set, then raise a generic error */ /* Still no error set, then raise a generic error */
if (__lastErr.code == VIR_ERR_OK) if (virLastErr.code == VIR_ERR_OK)
virLibConnError (NULL, VIR_ERR_INTERNAL_ERROR, virLibConnError (NULL, VIR_ERR_INTERNAL_ERROR,
_("unable to open connection")); _("unable to open connection"));

View File

@ -27,6 +27,7 @@
#include <sys/utsname.h> #include <sys/utsname.h>
#include "virterror_internal.h"
#include "lxc_conf.h" #include "lxc_conf.h"
/* Functions */ /* Functions */

View File

@ -50,7 +50,7 @@ int lxcLoadDriverConfig(lxc_driver_t *driver);
virCapsPtr lxcCapsInit(void); virCapsPtr lxcCapsInit(void);
#define lxcError(conn, dom, code, fmt...) \ #define lxcError(conn, dom, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_LXC, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_LXC, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
#endif /* LXC_CONF_H */ #endif /* LXC_CONF_H */

View File

@ -41,6 +41,7 @@
/* For MS_MOVE */ /* For MS_MOVE */
#include <linux/fs.h> #include <linux/fs.h>
#include "virterror_internal.h"
#include "lxc_container.h" #include "lxc_container.h"
#include "util.h" #include "util.h"
#include "memory.h" #include "memory.h"

View File

@ -34,7 +34,7 @@
#include <signal.h> #include <signal.h>
#include <getopt.h> #include <getopt.h>
#include "internal.h" #include "virterror_internal.h"
#include "util.h" #include "util.h"
#include "lxc_conf.h" #include "lxc_conf.h"

View File

@ -35,7 +35,7 @@
#include <unistd.h> #include <unistd.h>
#include <wait.h> #include <wait.h>
#include "internal.h" #include "virterror_internal.h"
#include "lxc_conf.h" #include "lxc_conf.h"
#include "lxc_container.h" #include "lxc_container.h"
#include "lxc_driver.h" #include "lxc_driver.h"

View File

@ -33,8 +33,7 @@
#include <string.h> #include <string.h>
#include <dirent.h> #include <dirent.h>
#include "internal.h" #include "virterror_internal.h"
#include "network_conf.h" #include "network_conf.h"
#include "memory.h" #include "memory.h"
#include "xml.h" #include "xml.h"
@ -50,7 +49,7 @@ VIR_ENUM_IMPL(virNetworkForward,
"none", "nat", "route" ) "none", "nat", "route" )
#define virNetworkReportError(conn, code, fmt...) \ #define virNetworkReportError(conn, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_NETWORK, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_NETWORK, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets, virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets,

View File

@ -44,6 +44,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "virterror_internal.h"
#include "network_driver.h" #include "network_driver.h"
#include "network_conf.h" #include "network_conf.h"
#include "driver.h" #include "driver.h"
@ -73,7 +74,7 @@ static int networkShutdown(void);
#define networkLog(level, msg...) fprintf(stderr, msg) #define networkLog(level, msg...) fprintf(stderr, msg)
#define networkReportError(conn, dom, net, code, fmt...) \ #define networkReportError(conn, dom, net, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)

View File

@ -33,7 +33,7 @@
#include <sys/utsname.h> #include <sys/utsname.h>
#endif #endif
#include "internal.h" #include "virterror_internal.h"
#include "nodeinfo.h" #include "nodeinfo.h"
#include "physmem.h" #include "physmem.h"
#include "util.h" #include "util.h"
@ -63,7 +63,7 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr n
while (*buf && c_isspace(*buf)) while (*buf && c_isspace(*buf))
buf++; buf++;
if (*buf != ':') { if (*buf != ':') {
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR, virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
"parsing cpuinfo processor"); "parsing cpuinfo processor");
return -1; return -1;
@ -76,7 +76,7 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr n
while (*buf && c_isspace(*buf)) while (*buf && c_isspace(*buf))
buf++; buf++;
if (*buf != ':' || !buf[1]) { if (*buf != ':' || !buf[1]) {
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR, virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
"parsing cpuinfo cpu MHz"); "parsing cpuinfo cpu MHz");
return -1; return -1;
@ -92,7 +92,7 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr n
while (*buf && c_isspace(*buf)) while (*buf && c_isspace(*buf))
buf++; buf++;
if (*buf != ':' || !buf[1]) { if (*buf != ':' || !buf[1]) {
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR, virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
"parsing cpuinfo cpu cores %c", *buf); "parsing cpuinfo cpu cores %c", *buf);
return -1; return -1;
@ -105,7 +105,7 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr n
} }
if (!nodeinfo->cpus) { if (!nodeinfo->cpus) {
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR, virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
"no cpus found"); "no cpus found");
return -1; return -1;
@ -129,7 +129,7 @@ int virNodeInfoPopulate(virConnectPtr conn,
struct utsname info; struct utsname info;
if (uname(&info) < 0) { if (uname(&info) < 0) {
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR, virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
"cannot extract machine type %s", strerror(errno)); "cannot extract machine type %s", strerror(errno));
return -1; return -1;
@ -148,7 +148,7 @@ int virNodeInfoPopulate(virConnectPtr conn,
int ret; int ret;
FILE *cpuinfo = fopen(CPUINFO_PATH, "r"); FILE *cpuinfo = fopen(CPUINFO_PATH, "r");
if (!cpuinfo) { if (!cpuinfo) {
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR, virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
"cannot open %s %s", CPUINFO_PATH, strerror(errno)); "cannot open %s %s", CPUINFO_PATH, strerror(errno));
return -1; return -1;
@ -165,7 +165,7 @@ int virNodeInfoPopulate(virConnectPtr conn,
} }
#else #else
/* XXX Solaris will need an impl later if they port QEMU driver */ /* XXX Solaris will need an impl later if they port QEMU driver */
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR, virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
"%s:%s not implemented on this platform\n", __FILE__, __FUNCTION__); "%s:%s not implemented on this platform\n", __FILE__, __FUNCTION__);
return -1; return -1;

View File

@ -43,6 +43,7 @@
#include <sys/utsname.h> #include <sys/utsname.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "virterror_internal.h"
#include "openvz_conf.h" #include "openvz_conf.h"
#include "uuid.h" #include "uuid.h"
#include "buf.h" #include "buf.h"

View File

@ -42,7 +42,7 @@ enum { OPENVZ_WARN, OPENVZ_ERR };
fprintf(stderr, "\n"); } fprintf(stderr, "\n"); }
#define openvzError(conn, code, fmt...) \ #define openvzError(conn, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_OPENVZ, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_OPENVZ, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)

View File

@ -47,7 +47,7 @@
#include <stdio.h> #include <stdio.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "internal.h" #include "virterror_internal.h"
#include "openvz_driver.h" #include "openvz_driver.h"
#include "event.h" #include "event.h"
#include "buf.h" #include "buf.h"

View File

@ -21,7 +21,8 @@
#include <sys/un.h> #include <sys/un.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <string.h> #include <string.h>
#include "internal.h"
#include "virterror_internal.h"
#include "driver.h" #include "driver.h"
#include "proxy_internal.h" #include "proxy_internal.h"
#include "util.h" #include "util.h"
@ -93,7 +94,7 @@ struct xenUnifiedDriver xenProxyDriver = {
************************************************************************/ ************************************************************************/
#define virProxyError(conn, code, fmt...) \ #define virProxyError(conn, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_PROXY, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_PROXY, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
/************************************************************************ /************************************************************************

View File

@ -40,6 +40,7 @@
#include <numa.h> #include <numa.h>
#endif #endif
#include "virterror_internal.h"
#include "qemu_conf.h" #include "qemu_conf.h"
#include "uuid.h" #include "uuid.h"
#include "buf.h" #include "buf.h"

View File

@ -72,7 +72,7 @@ struct qemud_driver {
#define qemudReportError(conn, dom, net, code, fmt...) \ #define qemudReportError(conn, dom, net, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)

View File

@ -52,6 +52,7 @@
#include <sched.h> #include <sched.h>
#endif #endif
#include "virterror_internal.h"
#include "qemu_driver.h" #include "qemu_driver.h"
#include "qemu_conf.h" #include "qemu_conf.h"
#include "c-ctype.h" #include "c-ctype.h"

View File

@ -26,12 +26,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include "virterror_internal.h"
#include "buf.h" #include "buf.h"
#include "memory.h" #include "memory.h"
#include "qparams.h" #include "qparams.h"
#define qparam_report_oom(void) \ #define qparam_report_oom(void) \
__virReportErrorHelper(NULL, VIR_FROM_NONE, VIR_ERR_NO_MEMORY, \ virReportErrorHelper(NULL, VIR_FROM_NONE, VIR_ERR_NO_MEMORY, \
__FILE__, __FUNCTION__, __LINE__, NULL) __FILE__, __FUNCTION__, __LINE__, NULL)
struct qparam_set * struct qparam_set *

View File

@ -73,7 +73,7 @@
# define AI_ADDRCONFIG 0 # define AI_ADDRCONFIG 0
#endif #endif
#include "internal.h" #include "virterror_internal.h"
#include "driver.h" #include "driver.h"
#include "buf.h" #include "buf.h"
#include "qparams.h" #include "qparams.h"
@ -3675,7 +3675,7 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
} else if (STRCASEEQ(authtype, "polkit")) { } else if (STRCASEEQ(authtype, "polkit")) {
want = REMOTE_AUTH_POLKIT; want = REMOTE_AUTH_POLKIT;
} else { } else {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 0, 0,
_("unknown authentication type %s"), authtype); _("unknown authentication type %s"), authtype);
@ -3686,7 +3686,7 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
type = want; type = want;
} }
if (type == REMOTE_AUTH_NONE) { if (type == REMOTE_AUTH_NONE) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("requested authentication type %s rejected"), _("requested authentication type %s rejected"),
authtype); authtype);
@ -3726,7 +3726,7 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
break; break;
default: default:
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 0, 0,
_("unsupported authentication type %d"), _("unsupported authentication type %d"),
@ -3756,7 +3756,7 @@ static char *addrToString(struct sockaddr_storage *sa, socklen_t salen)
host, sizeof(host), host, sizeof(host),
port, sizeof(port), port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV)) != 0) { NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
__virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_NO_MEMORY, VIR_ERR_ERROR, VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 0, 0,
_("Cannot resolve address %d: %s"), _("Cannot resolve address %d: %s"),
@ -3765,7 +3765,7 @@ static char *addrToString(struct sockaddr_storage *sa, socklen_t salen)
} }
if (VIR_ALLOC_N(addr, strlen(host) + 1 + strlen(port) + 1) < 0) { if (VIR_ALLOC_N(addr, strlen(host) + 1 + strlen(port) + 1) < 0) {
__virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_NO_MEMORY, VIR_ERR_ERROR, VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 0, 0,
"address"); "address");
@ -3975,7 +3975,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
/* Sets up the SASL library as a whole */ /* Sets up the SASL library as a whole */
err = sasl_client_init(NULL); err = sasl_client_init(NULL);
if (err != SASL_OK) { if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("failed to initialize SASL library: %d (%s)"), _("failed to initialize SASL library: %d (%s)"),
err, sasl_errstring(err, NULL, NULL)); err, sasl_errstring(err, NULL, NULL));
@ -3985,7 +3985,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
/* Get local address in form IPADDR:PORT */ /* Get local address in form IPADDR:PORT */
salen = sizeof(sa); salen = sizeof(sa);
if (getsockname(priv->sock, (struct sockaddr*)&sa, &salen) < 0) { if (getsockname(priv->sock, (struct sockaddr*)&sa, &salen) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("failed to get sock address %d (%s)"), _("failed to get sock address %d (%s)"),
errno, strerror(errno)); errno, strerror(errno));
@ -3997,7 +3997,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
/* Get remote address in form IPADDR:PORT */ /* Get remote address in form IPADDR:PORT */
salen = sizeof(sa); salen = sizeof(sa);
if (getpeername(priv->sock, (struct sockaddr*)&sa, &salen) < 0) { if (getpeername(priv->sock, (struct sockaddr*)&sa, &salen) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("failed to get peer address %d (%s)"), _("failed to get peer address %d (%s)"),
errno, strerror(errno)); errno, strerror(errno));
@ -4023,7 +4023,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
&saslconn); &saslconn);
if (err != SASL_OK) { if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("Failed to create SASL client context: %d (%s)"), _("Failed to create SASL client context: %d (%s)"),
err, sasl_errstring(err, NULL, NULL)); err, sasl_errstring(err, NULL, NULL));
@ -4036,7 +4036,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
cipher = gnutls_cipher_get(priv->session); cipher = gnutls_cipher_get(priv->session);
if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) { if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
"%s", _("invalid cipher size for TLS session")); "%s", _("invalid cipher size for TLS session"));
goto cleanup; goto cleanup;
@ -4046,7 +4046,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
DEBUG("Setting external SSF %d", ssf); DEBUG("Setting external SSF %d", ssf);
err = sasl_setprop(saslconn, SASL_SSF_EXTERNAL, &ssf); err = sasl_setprop(saslconn, SASL_SSF_EXTERNAL, &ssf);
if (err != SASL_OK) { if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("cannot set external SSF %d (%s)"), _("cannot set external SSF %d (%s)"),
err, sasl_errstring(err, NULL, NULL)); err, sasl_errstring(err, NULL, NULL));
@ -4065,7 +4065,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
err = sasl_setprop(saslconn, SASL_SEC_PROPS, &secprops); err = sasl_setprop(saslconn, SASL_SEC_PROPS, &secprops);
if (err != SASL_OK) { if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("cannot set security props %d (%s)"), _("cannot set security props %d (%s)"),
err, sasl_errstring(err, NULL, NULL)); err, sasl_errstring(err, NULL, NULL));
@ -4083,7 +4083,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
mechlist = iret.mechlist; mechlist = iret.mechlist;
if (wantmech) { if (wantmech) {
if (strstr(mechlist, wantmech) == NULL) { if (strstr(mechlist, wantmech) == NULL) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 0, 0,
_("SASL mechanism %s not supported by server"), _("SASL mechanism %s not supported by server"),
@ -4103,7 +4103,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
&clientoutlen, &clientoutlen,
&mech); &mech);
if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) { if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("Failed to start SASL negotiation: %d (%s)"), _("Failed to start SASL negotiation: %d (%s)"),
err, sasl_errdetail(saslconn)); err, sasl_errdetail(saslconn));
@ -4120,7 +4120,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
} }
if ((ncred = if ((ncred =
remoteAuthMakeCredentials(interact, &cred)) < 0) { remoteAuthMakeCredentials(interact, &cred)) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 0, 0,
"%s", _("Failed to make auth credentials")); "%s", _("Failed to make auth credentials"));
@ -4137,7 +4137,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
} else { } else {
msg = "No authentication callback available"; msg = "No authentication callback available";
} }
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL,
0, 0, "%s", msg); 0, 0, "%s", msg);
goto cleanup; goto cleanup;
@ -4145,7 +4145,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
VIR_FREE(iret.mechlist); VIR_FREE(iret.mechlist);
if (clientoutlen > REMOTE_AUTH_SASL_DATA_MAX) { if (clientoutlen > REMOTE_AUTH_SASL_DATA_MAX) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("SASL negotiation data too long: %d bytes"), _("SASL negotiation data too long: %d bytes"),
clientoutlen); clientoutlen);
@ -4185,7 +4185,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
&clientout, &clientout,
&clientoutlen); &clientoutlen);
if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) { if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("Failed SASL step: %d (%s)"), _("Failed SASL step: %d (%s)"),
err, sasl_errdetail(saslconn)); err, sasl_errdetail(saslconn));
@ -4199,7 +4199,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
cred = NULL; cred = NULL;
} }
if ((ncred = remoteAuthMakeCredentials(interact, &cred)) < 0) { if ((ncred = remoteAuthMakeCredentials(interact, &cred)) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
"%s", _("Failed to make auth credentials")); "%s", _("Failed to make auth credentials"));
goto cleanup; goto cleanup;
@ -4214,7 +4214,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
} else { } else {
msg = "No authentication callback available"; msg = "No authentication callback available";
} }
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL,
0, 0, "%s", msg); 0, 0, "%s", msg);
goto cleanup; goto cleanup;
@ -4262,7 +4262,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (!priv->uses_tls) { if (!priv->uses_tls) {
err = sasl_getprop(saslconn, SASL_SSF, &val); err = sasl_getprop(saslconn, SASL_SSF, &val);
if (err != SASL_OK) { if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("cannot query SASL ssf on connection %d (%s)"), _("cannot query SASL ssf on connection %d (%s)"),
err, sasl_errstring(err, NULL, NULL)); err, sasl_errstring(err, NULL, NULL));
@ -4271,7 +4271,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
ssf = *(const int *)val; ssf = *(const int *)val;
DEBUG("SASL SSF value %d", ssf); DEBUG("SASL SSF value %d", ssf);
if (ssf < 56) { /* 56 == DES level, good for Kerberos */ if (ssf < 56) { /* 56 == DES level, good for Kerberos */
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("negotiation SSF %d was not strong enough"), ssf); _("negotiation SSF %d was not strong enough"), ssf);
goto cleanup; goto cleanup;
@ -4325,7 +4325,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
if (allowcb) { if (allowcb) {
/* Run the authentication callback */ /* Run the authentication callback */
if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) { if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
"%s", _("Failed to collect auth credentials")); "%s", _("Failed to collect auth credentials"));
return -1; return -1;
@ -4509,7 +4509,7 @@ retry_read:
/* Check program, version, etc. are what we expect. */ /* Check program, version, etc. are what we expect. */
if (hdr.prog != REMOTE_PROGRAM) { if (hdr.prog != REMOTE_PROGRAM) {
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
NULL, NULL, VIR_FROM_REMOTE, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("unknown program (received %x, expected %x)"), _("unknown program (received %x, expected %x)"),
@ -4517,7 +4517,7 @@ retry_read:
return -1; return -1;
} }
if (hdr.vers != REMOTE_PROTOCOL_VERSION) { if (hdr.vers != REMOTE_PROTOCOL_VERSION) {
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
NULL, NULL, VIR_FROM_REMOTE, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("unknown protocol version (received %x, expected %x)"), _("unknown protocol version (received %x, expected %x)"),
@ -4540,7 +4540,7 @@ retry_read:
goto retry_read; goto retry_read;
} }
if (hdr.proc != proc_nr) { if (hdr.proc != proc_nr) {
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
NULL, NULL, VIR_FROM_REMOTE, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("unknown procedure (received %x, expected %x)"), _("unknown procedure (received %x, expected %x)"),
@ -4548,7 +4548,7 @@ retry_read:
return -1; return -1;
} }
if (hdr.direction != REMOTE_REPLY) { if (hdr.direction != REMOTE_REPLY) {
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
NULL, NULL, VIR_FROM_REMOTE, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("unknown direction (received %x, expected %x)"), _("unknown direction (received %x, expected %x)"),
@ -4556,7 +4556,7 @@ retry_read:
return -1; return -1;
} }
if (hdr.serial != serial) { if (hdr.serial != serial) {
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("unknown serial (received %x, expected %x)"), _("unknown serial (received %x, expected %x)"),
hdr.serial, serial); hdr.serial, serial);
@ -4599,7 +4599,7 @@ retry_read:
return -1; return -1;
default: default:
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("unknown status (received %x)"), _("unknown status (received %x)"),
hdr.status); hdr.status);
@ -4809,8 +4809,8 @@ error (virConnectPtr conn, virErrorNumber code, const char *info)
{ {
const char *errmsg; const char *errmsg;
errmsg = __virErrorMsg (code, info); errmsg = virErrorMsg (code, info);
__virRaiseError (conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (conn, NULL, NULL, VIR_FROM_REMOTE,
code, VIR_ERR_ERROR, errmsg, info, NULL, 0, 0, code, VIR_ERR_ERROR, errmsg, info, NULL, 0, 0,
errmsg, info); errmsg, info);
} }
@ -4832,8 +4832,8 @@ errorf (virConnectPtr conn, virErrorNumber code, const char *fmt, ...)
errorMessage[0] = '\0'; errorMessage[0] = '\0';
} }
errmsg = __virErrorMsg (code, errorMessage); errmsg = virErrorMsg (code, errorMessage);
__virRaiseError (conn, NULL, NULL, VIR_FROM_REMOTE, virRaiseError (conn, NULL, NULL, VIR_FROM_REMOTE,
code, VIR_ERR_ERROR, code, VIR_ERR_ERROR,
errmsg, errorMessage, NULL, -1, -1, errmsg, errorMessage, NULL, -1, -1,
errmsg, errorMessage); errmsg, errorMessage);
@ -4850,7 +4850,7 @@ server_error (virConnectPtr conn, remote_error *err)
dom = err->dom ? get_nonnull_domain (conn, *err->dom) : NULL; dom = err->dom ? get_nonnull_domain (conn, *err->dom) : NULL;
net = err->net ? get_nonnull_network (conn, *err->net) : NULL; net = err->net ? get_nonnull_network (conn, *err->net) : NULL;
__virRaiseError (conn, dom, net, virRaiseError (conn, dom, net,
err->domain, err->code, err->level, err->domain, err->code, err->level,
err->str1 ? *err->str1 : NULL, err->str1 ? *err->str1 : NULL,
err->str2 ? *err->str2 : NULL, err->str2 ? *err->str2 : NULL,
@ -4866,7 +4866,7 @@ server_error (virConnectPtr conn, remote_error *err)
/* get_nonnull_domain and get_nonnull_network turn an on-wire /* get_nonnull_domain and get_nonnull_network turn an on-wire
* (name, uuid) pair into virDomainPtr or virNetworkPtr object. * (name, uuid) pair into virDomainPtr or virNetworkPtr object.
* These can return NULL if underlying memory allocations fail, * These can return NULL if underlying memory allocations fail,
* but if they do then virterror has been set. * but if they do then virterror_internal.has been set.
*/ */
static virDomainPtr static virDomainPtr
get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain) get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain)

View File

@ -18,13 +18,13 @@
#include "c-ctype.h" #include "c-ctype.h"
#include <errno.h> #include <errno.h>
#include "internal.h" #include "virterror_internal.h"
#include "sexpr.h" #include "sexpr.h"
#include "util.h" #include "util.h"
#include "memory.h" #include "memory.h"
#define virSexprError(code, fmt...) \ #define virSexprError(code, fmt...) \
__virReportErrorHelper(NULL, VIR_FROM_SEXPR, code, __FILE__, \ virReportErrorHelper(NULL, VIR_FROM_SEXPR, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
/** /**

View File

@ -24,7 +24,7 @@
#include <xs.h> #include <xs.h>
#endif #endif
#include "internal.h" #include "virterror_internal.h"
#include "util.h" #include "util.h"
#include "xen_unified.h" #include "xen_unified.h"
#include "stats_linux.h" #include "stats_linux.h"
@ -48,13 +48,13 @@ statsErrorFunc (virConnectPtr conn,
char fullinfo[1000]; char fullinfo[1000];
const char *errmsg; const char *errmsg;
errmsg = __virErrorMsg(error, info); errmsg = virErrorMsg(error, info);
if (func != NULL) { if (func != NULL) {
snprintf(fullinfo, sizeof (fullinfo) - 1, "%s: %s", func, info); snprintf(fullinfo, sizeof (fullinfo) - 1, "%s: %s", func, info);
fullinfo[sizeof (fullinfo) - 1] = 0; fullinfo[sizeof (fullinfo) - 1] = 0;
info = fullinfo; info = fullinfo;
} }
__virRaiseError(conn, NULL, NULL, VIR_FROM_STATS_LINUX, error, virRaiseError(conn, NULL, NULL, VIR_FROM_STATS_LINUX, error,
VIR_ERR_ERROR, VIR_ERR_ERROR,
errmsg, info, NULL, value, 0, errmsg, info, errmsg, info, NULL, value, 0, errmsg, info,
value); value);

View File

@ -41,7 +41,7 @@
#include <selinux/selinux.h> #include <selinux/selinux.h>
#endif #endif
#include "internal.h" #include "virterror_internal.h"
#include "util.h" #include "util.h"
#include "memory.h" #include "memory.h"

View File

@ -25,7 +25,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include "internal.h" #include "virterror_internal.h"
#include "storage_backend_disk.h" #include "storage_backend_disk.h"
#include "util.h" #include "util.h"
#include "memory.h" #include "memory.h"

View File

@ -40,7 +40,7 @@
#include <libxml/tree.h> #include <libxml/tree.h>
#include <libxml/xpath.h> #include <libxml/xpath.h>
#include "internal.h" #include "virterror_internal.h"
#include "storage_backend_fs.h" #include "storage_backend_fs.h"
#include "storage_conf.h" #include "storage_conf.h"
#include "util.h" #include "util.h"

View File

@ -34,7 +34,7 @@
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
#include "internal.h" #include "virterror_internal.h"
#include "storage_backend_iscsi.h" #include "storage_backend_iscsi.h"
#include "util.h" #include "util.h"
#include "memory.h" #include "memory.h"

View File

@ -31,7 +31,7 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include "internal.h" #include "virterror_internal.h"
#include "storage_backend_logical.h" #include "storage_backend_logical.h"
#include "storage_conf.h" #include "storage_conf.h"
#include "util.h" #include "util.h"

View File

@ -38,7 +38,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include "internal.h" #include "virterror_internal.h"
#include "storage_conf.h" #include "storage_conf.h"
#include "storage_backend.h" #include "storage_backend.h"
#include "xml.h" #include "xml.h"

View File

@ -262,7 +262,7 @@ static inline int virStoragePoolObjIsActive(virStoragePoolObjPtr pool) {
} }
#define virStorageReportError(conn, code, fmt...) \ #define virStorageReportError(conn, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_STORAGE, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_STORAGE, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
int virStoragePoolLoadAllConfigs(virConnectPtr conn, int virStoragePoolLoadAllConfigs(virConnectPtr conn,

View File

@ -32,7 +32,7 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include "internal.h" #include "virterror_internal.h"
#include "driver.h" #include "driver.h"
#include "util.h" #include "util.h"
#include "storage_driver.h" #include "storage_driver.h"

View File

@ -31,6 +31,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <libxml/xmlsave.h> #include <libxml/xmlsave.h>
#include "virterror_internal.h"
#include "test.h" #include "test.h"
#include "buf.h" #include "buf.h"
#include "util.h" #include "util.h"
@ -161,7 +163,7 @@ static const virNodeInfo defaultNodeInfo = {
} \ } \
#define testError(conn, code, fmt...) \ #define testError(conn, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_TEST, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_TEST, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
static virCapsPtr static virCapsPtr

View File

@ -47,7 +47,7 @@
#include <paths.h> #include <paths.h>
#endif #endif
#include "internal.h" #include "virterror_internal.h"
#include "event.h" #include "event.h"
#include "buf.h" #include "buf.h"
#include "util.h" #include "util.h"
@ -67,7 +67,7 @@
#ifndef PROXY #ifndef PROXY
#define ReportError(conn, code, fmt...) \ #define ReportError(conn, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
int virFileStripSuffix(char *str, int virFileStripSuffix(char *str,

View File

@ -15,18 +15,17 @@
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include "internal.h" #include "virterror_internal.h"
#include "libvirt/virterror.h"
virError __lastErr = /* the last error */ virError virLastErr = /* the last error */
{ .code = 0, .domain = 0, .message = NULL, .level = VIR_ERR_NONE, { .code = 0, .domain = 0, .message = NULL, .level = VIR_ERR_NONE,
.conn = NULL, .dom = NULL, .str1 = NULL, .str2 = NULL, .str3 = NULL, .conn = NULL, .dom = NULL, .str1 = NULL, .str2 = NULL, .str3 = NULL,
.int1 = 0, .int2 = 0, .net = NULL }; .int1 = 0, .int2 = 0, .net = NULL };
static virErrorFunc virErrorHandler = NULL; /* global error handler */ virErrorFunc virErrorHandler = NULL; /* global error handler */
static void *virUserData = NULL; /* associated data */ void *virUserData = NULL; /* associated data */
/* /*
* Macro used to format the message as a string in __virRaiseError * Macro used to format the message as a string in virRaiseError
* and borrowed from libxml2. * and borrowed from libxml2.
*/ */
#define VIR_GET_VAR_STR(msg, str) { \ #define VIR_GET_VAR_STR(msg, str) { \
@ -74,9 +73,9 @@ static void *virUserData = NULL; /* associated data */
virErrorPtr virErrorPtr
virGetLastError(void) virGetLastError(void)
{ {
if (__lastErr.code == VIR_ERR_OK) if (virLastErr.code == VIR_ERR_OK)
return (NULL); return (NULL);
return (&__lastErr); return (&virLastErr);
} }
/* /*
@ -94,10 +93,10 @@ virCopyLastError(virErrorPtr to)
{ {
if (to == NULL) if (to == NULL)
return (-1); return (-1);
if (__lastErr.code == VIR_ERR_OK) if (virLastErr.code == VIR_ERR_OK)
return (0); return (0);
memcpy(to, &__lastErr, sizeof(virError)); memcpy(to, &virLastErr, sizeof(virError));
return (__lastErr.code); return (virLastErr.code);
} }
/** /**
@ -126,7 +125,7 @@ virResetError(virErrorPtr err)
void void
virResetLastError(void) virResetLastError(void)
{ {
virResetError(&__lastErr); virResetError(&virLastErr);
} }
/** /**
@ -331,7 +330,7 @@ virDefaultErrorFunc(virErrorPtr err)
} }
/** /**
* __virRaiseError: * virRaiseError:
* @conn: the connection to the hypervisor if available * @conn: the connection to the hypervisor if available
* @dom: the domain if available * @dom: the domain if available
* @net: the network if available * @net: the network if available
@ -350,12 +349,12 @@ virDefaultErrorFunc(virErrorPtr err)
* immediately if a callback is found and store it for later handling. * immediately if a callback is found and store it for later handling.
*/ */
void void
__virRaiseError(virConnectPtr conn, virDomainPtr dom, virNetworkPtr net, virRaiseError(virConnectPtr conn, virDomainPtr dom, virNetworkPtr net,
int domain, int code, virErrorLevel level, int domain, int code, virErrorLevel level,
const char *str1, const char *str2, const char *str3, const char *str1, const char *str2, const char *str3,
int int1, int int2, const char *msg, ...) int int1, int int2, const char *msg, ...)
{ {
virErrorPtr to = &__lastErr; virErrorPtr to = &virLastErr;
void *userData = virUserData; void *userData = virUserData;
virErrorFunc handler = virErrorHandler; virErrorFunc handler = virErrorHandler;
char *str; char *str;
@ -414,7 +413,7 @@ __virRaiseError(virConnectPtr conn, virDomainPtr dom, virNetworkPtr net,
} }
/** /**
* __virErrorMsg: * virErrorMsg:
* @error: the virErrorNumber * @error: the virErrorNumber
* @info: usually the first parameter string * @info: usually the first parameter string
* *
@ -424,7 +423,7 @@ __virRaiseError(virConnectPtr conn, virDomainPtr dom, virNetworkPtr net,
* Returns the constant string associated to @error * Returns the constant string associated to @error
*/ */
const char * const char *
__virErrorMsg(virErrorNumber error, const char *info) virErrorMsg(virErrorNumber error, const char *info)
{ {
const char *errmsg = NULL; const char *errmsg = NULL;
@ -724,7 +723,7 @@ __virErrorMsg(virErrorNumber error, const char *info)
} }
/** /**
* __virReportErrorHelper * virReportErrorHelper
* *
* @conn: the connection to the hypervisor if available * @conn: the connection to the hypervisor if available
* @dom: the domain if available * @dom: the domain if available
@ -740,11 +739,11 @@ __virErrorMsg(virErrorNumber error, const char *info)
* Helper function to do most of the grunt work for individual driver * Helper function to do most of the grunt work for individual driver
* ReportError * ReportError
*/ */
void __virReportErrorHelper(virConnectPtr conn, int domcode, int errcode, void virReportErrorHelper(virConnectPtr conn, int domcode, int errcode,
const char *filename ATTRIBUTE_UNUSED, const char *filename ATTRIBUTE_UNUSED,
const char *funcname ATTRIBUTE_UNUSED, const char *funcname ATTRIBUTE_UNUSED,
long long linenr ATTRIBUTE_UNUSED, long long linenr ATTRIBUTE_UNUSED,
const char *fmt, ...) const char *fmt, ...)
{ {
va_list args; va_list args;
char errorMessage[1024]; char errorMessage[1024];
@ -758,8 +757,8 @@ void __virReportErrorHelper(virConnectPtr conn, int domcode, int errcode,
errorMessage[0] = '\0'; errorMessage[0] = '\0';
} }
virerr = __virErrorMsg(errcode, (errorMessage[0] ? errorMessage : NULL)); virerr = virErrorMsg(errcode, (errorMessage[0] ? errorMessage : NULL));
__virRaiseError(conn, NULL, NULL, domcode, errcode, VIR_ERR_ERROR, virRaiseError(conn, NULL, NULL, domcode, errcode, VIR_ERR_ERROR,
virerr, errorMessage, NULL, -1, -1, virerr, errorMessage); virerr, errorMessage, NULL, -1, -1, virerr, errorMessage);
} }

56
src/virterror_internal.h Normal file
View File

@ -0,0 +1,56 @@
/*
* virterror.h: internal error handling
*
* Copyright (C) 2006-2008 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __VIRT_ERROR_H_
#define __VIRT_ERROR_H_
#include "internal.h"
extern virError virLastErr;
extern virErrorFunc virErrorHandler;
extern void *virUserData;
/************************************************************************
* *
* API for error handling *
* *
************************************************************************/
void virRaiseError(virConnectPtr conn,
virDomainPtr dom,
virNetworkPtr net,
int domain,
int code,
virErrorLevel level,
const char *str1,
const char *str2,
const char *str3,
int int1, int int2, const char *msg, ...)
ATTRIBUTE_FORMAT(printf, 12, 13);
const char *virErrorMsg(virErrorNumber error, const char *info);
void virReportErrorHelper(virConnectPtr conn, int domcode, int errcode,
const char *filename ATTRIBUTE_UNUSED,
const char *funcname ATTRIBUTE_UNUSED,
long long linenr ATTRIBUTE_UNUSED,
const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 7, 8);
#endif

View File

@ -26,11 +26,6 @@
#include <errno.h> #include <errno.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include "xs_internal.h"
#include "stats_linux.h"
#include "xend_internal.h"
#include "util.h"
/* required for dom0_getdomaininfo_t */ /* required for dom0_getdomaininfo_t */
#include <xen/dom0_ops.h> #include <xen/dom0_ops.h>
#include <xen/version.h> #include <xen/version.h>
@ -45,6 +40,14 @@
/* required for shutdown flags */ /* required for shutdown flags */
#include <xen/sched.h> #include <xen/sched.h>
#include "virterror_internal.h"
#include "driver.h"
#include "util.h"
#include "xen_unified.h"
#include "xen_internal.h"
#include "xs_internal.h"
#include "stats_linux.h"
#include "xend_internal.h"
#include "buf.h" #include "buf.h"
#include "capabilities.h" #include "capabilities.h"
#include "memory.h" #include "memory.h"
@ -653,10 +656,6 @@ struct xen_op_v2_dom {
}; };
typedef struct xen_op_v2_dom xen_op_v2_dom; typedef struct xen_op_v2_dom xen_op_v2_dom;
#include "internal.h"
#include "driver.h"
#include "xen_unified.h"
#include "xen_internal.h"
#ifdef __linux__ #ifdef __linux__
#define XEN_HYPERVISOR_SOCKET "/proc/xen/privcmd" #define XEN_HYPERVISOR_SOCKET "/proc/xen/privcmd"
@ -720,7 +719,7 @@ struct xenUnifiedDriver xenHypervisorDriver = {
#define virXenError(conn, code, fmt...) \ #define virXenError(conn, code, fmt...) \
if (in_init == 0) \ if (in_init == 0) \
__virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
#ifndef PROXY #ifndef PROXY
@ -747,15 +746,15 @@ virXenErrorFunc(virConnectPtr conn,
return; return;
errmsg = __virErrorMsg(error, info); errmsg =virErrorMsg(error, info);
if (func != NULL) { if (func != NULL) {
snprintf(fullinfo, 999, "%s: %s", func, info); snprintf(fullinfo, 999, "%s: %s", func, info);
fullinfo[999] = 0; fullinfo[999] = 0;
__virRaiseError(conn, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR, virRaiseError(conn, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
errmsg, fullinfo, NULL, value, 0, errmsg, fullinfo, errmsg, fullinfo, NULL, value, 0, errmsg, fullinfo,
value); value);
} else { } else {
__virRaiseError(conn, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR, virRaiseError(conn, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
errmsg, info, NULL, value, 0, errmsg, info, errmsg, info, NULL, value, 0, errmsg, info,
value); value);
} }

View File

@ -27,7 +27,7 @@
#include <xen/dom0_ops.h> #include <xen/dom0_ops.h>
#include <libxml/uri.h> #include <libxml/uri.h>
#include "internal.h" #include "virterror_internal.h"
#include "xen_unified.h" #include "xen_unified.h"
@ -59,7 +59,7 @@ static struct xenUnifiedDriver *drivers[XEN_UNIFIED_NR_DRIVERS] = {
}; };
#define xenUnifiedError(conn, code, fmt...) \ #define xenUnifiedError(conn, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
/* /*

View File

@ -32,6 +32,7 @@
#include <libxml/uri.h> #include <libxml/uri.h>
#include <errno.h> #include <errno.h>
#include "virterror_internal.h"
#include "xend_internal.h" #include "xend_internal.h"
#include "driver.h" #include "driver.h"
#include "util.h" #include "util.h"
@ -105,7 +106,7 @@ virDomainXMLDevID(virDomainPtr domain,
#endif #endif
#define virXendError(conn, code, fmt...) \ #define virXendError(conn, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_XEND, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_XEND, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
#define virXendErrorInt(conn, code, ival) \ #define virXendErrorInt(conn, code, ival) \

View File

@ -35,6 +35,7 @@
#include <stdint.h> #include <stdint.h>
#include <xen/dom0_ops.h> #include <xen/dom0_ops.h>
#include "virterror_internal.h"
#include "xm_internal.h" #include "xm_internal.h"
#include "xen_unified.h" #include "xen_unified.h"
#include "xend_internal.h" #include "xend_internal.h"
@ -123,7 +124,7 @@ struct xenUnifiedDriver xenXMDriver = {
}; };
#define xenXMError(conn, code, fmt...) \ #define xenXMError(conn, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_XENXM, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_XENXM, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
int int

View File

@ -16,14 +16,15 @@
#include <stdarg.h> #include <stdarg.h>
#include <limits.h> #include <limits.h>
#include <math.h> /* for isnan() */ #include <math.h> /* for isnan() */
#include "internal.h"
#include "virterror_internal.h"
#include "xml.h" #include "xml.h"
#include "buf.h" #include "buf.h"
#include "util.h" #include "util.h"
#include "memory.h" #include "memory.h"
#define virXMLError(conn, code, fmt...) \ #define virXMLError(conn, code, fmt...) \
__virReportErrorHelper(conn, VIR_FROM_XML, code, __FILE__, \ virReportErrorHelper(conn, VIR_FROM_XML, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)

View File

@ -11,7 +11,7 @@
#include <config.h> #include <config.h>
#include "xmlrpc.h" #include "xmlrpc.h"
#include "internal.h" #include "virterror_internal.h"
#include "memory.h" #include "memory.h"
#include <libxml/nanohttp.h> #include <libxml/nanohttp.h>
@ -41,8 +41,8 @@ static void xmlRpcError(virErrorNumber error, const char *info, int value)
if (error == VIR_ERR_OK) if (error == VIR_ERR_OK)
return; return;
errmsg = __virErrorMsg(error, info); errmsg = virErrorMsg(error, info);
__virRaiseError(NULL, NULL, NULL, VIR_FROM_RPC, error, VIR_ERR_ERROR, virRaiseError(NULL, NULL, NULL, VIR_FROM_RPC, error, VIR_ERR_ERROR,
errmsg, info, NULL, value, 0, errmsg, info, value); errmsg, info, NULL, value, 0, errmsg, info, value);
} }

View File

@ -26,7 +26,7 @@
#include <xs.h> #include <xs.h>
#include "internal.h" #include "virterror_internal.h"
#include "driver.h" #include "driver.h"
#include "xen_unified.h" #include "xen_unified.h"
#include "xs_internal.h" #include "xs_internal.h"
@ -88,7 +88,7 @@ struct xenUnifiedDriver xenStoreDriver = {
#endif /* ! PROXY */ #endif /* ! PROXY */
#define virXenStoreError(conn, code, fmt...) \ #define virXenStoreError(conn, code, fmt...) \
__virReportErrorHelper(NULL, VIR_FROM_XENSTORE, code, __FILE__, \ virReportErrorHelper(NULL, VIR_FROM_XENSTORE, code, __FILE__, \
__FUNCTION__, __LINE__, fmt) __FUNCTION__, __LINE__, fmt)
/************************************************************************ /************************************************************************