From 9e0809911c54d6693e413a7b1198c338aef2c0de Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Thu, 25 Jun 2009 15:02:10 +0000 Subject: [PATCH] fix UML driver logging macros * src/uml_driver.c: fix UML driver logging macros, patch by Amy Griffis * AUTHORS: adding Amy Griffis Daniel --- AUTHORS | 1 + ChangeLog | 6 ++++++ src/uml_driver.c | 28 +++++++++++----------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/AUTHORS b/AUTHORS index 25fc26ffcc..7c3104ab88 100644 --- a/AUTHORS +++ b/AUTHORS @@ -74,6 +74,7 @@ Patches have also been contributed by: Doug Goldstein Javier Fontan Federico Simoncelli + Amy Griffis [....send patches to get your name here....] diff --git a/ChangeLog b/ChangeLog index 314042004f..372fc5d93e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Jun 25 16:57:40 CEST 2009 Daniel Veillard + + * src/uml_driver.c: fix UML driver logging macros, patch by Amy + Griffis + * AUTHORS: adding Amy Griffis + Thu Jun 25 16:50:54 CEST 2009 Daniel Veillard * src/node_device_conf.c: fix a leak, patch by Dave Allan diff --git a/src/uml_driver.c b/src/uml_driver.c index 7949d4fcb0..70ca899512 100644 --- a/src/uml_driver.c +++ b/src/uml_driver.c @@ -66,9 +66,6 @@ static int umlShutdown(void); -#define umlLog(level, msg, ...) \ - virLogMessage(__FILE__, level, __func__, __LINE__, 0, msg, __VA_ARGS__) - static void umlDriverLock(struct uml_driver *driver) { virMutexLock(&driver->lock); @@ -95,8 +92,7 @@ static int umlSetCloseExec(int fd) { goto error; return 0; error: - umlLog(VIR_LOG_ERROR, - "%s", _("Failed to set close-on-exec file descriptor flag\n")); + VIR_ERROR0(_("Failed to set close-on-exec file descriptor flag")); return -1; } @@ -136,7 +132,7 @@ umlAutostartConfigs(struct uml_driver *driver) { !virDomainIsActive(driver->domains.objs[i]) && umlStartVMDaemon(conn, driver, driver->domains.objs[i]) < 0) { virErrorPtr err = virGetLastError(); - umlLog(VIR_LOG_ERROR, _("Failed to autostart VM '%s': %s\n"), + VIR_ERROR(_("Failed to autostart VM '%s': %s"), driver->domains.objs[i]->def->name, err->message); } } @@ -368,13 +364,13 @@ umlStartup(int privileged) { if ((uml_driver->inotifyFD = inotify_init()) < 0) { - umlLog(VIR_LOG_ERROR, "%s", _("cannot initialize inotify")); + VIR_ERROR0(_("cannot initialize inotify")); goto error; } if (virFileMakePath(uml_driver->monitorDir) < 0) { char ebuf[1024]; - umlLog(VIR_LOG_ERROR, _("Failed to create monitor directory %s: %s"), + VIR_ERROR(_("Failed to create monitor directory %s: %s"), uml_driver->monitorDir, virStrerror(errno, ebuf, sizeof ebuf)); goto error; } @@ -407,8 +403,7 @@ umlStartup(int privileged) { return 0; out_of_memory: - umlLog (VIR_LOG_ERROR, - "%s", _("umlStartup: out of memory\n")); + VIR_ERROR0(_("umlStartup: out of memory")); error: VIR_FREE(userdir); @@ -825,25 +820,25 @@ static int umlStartVMDaemon(virConnectPtr conn, tmp = progenv; while (*tmp) { if (safewrite(logfd, *tmp, strlen(*tmp)) < 0) - umlLog(VIR_LOG_WARN, _("Unable to write envv to logfile: %s\n"), + VIR_WARN(_("Unable to write envv to logfile: %s"), virStrerror(errno, ebuf, sizeof ebuf)); if (safewrite(logfd, " ", 1) < 0) - umlLog(VIR_LOG_WARN, _("Unable to write envv to logfile: %s\n"), + VIR_WARN(_("Unable to write envv to logfile: %s"), virStrerror(errno, ebuf, sizeof ebuf)); tmp++; } tmp = argv; while (*tmp) { if (safewrite(logfd, *tmp, strlen(*tmp)) < 0) - umlLog(VIR_LOG_WARN, _("Unable to write argv to logfile: %s\n"), + VIR_WARN(_("Unable to write argv to logfile: %s"), virStrerror(errno, ebuf, sizeof ebuf)); if (safewrite(logfd, " ", 1) < 0) - umlLog(VIR_LOG_WARN, _("Unable to write argv to logfile: %s\n"), + VIR_WARN(_("Unable to write argv to logfile: %s"), virStrerror(errno, ebuf, sizeof ebuf)); tmp++; } if (safewrite(logfd, "\n", 1) < 0) - umlLog(VIR_LOG_WARN, _("Unable to write argv to logfile: %s\n"), + VIR_WARN(_("Unable to write argv to logfile: %s"), virStrerror(errno, ebuf, sizeof ebuf)); vm->monitor = -1; @@ -888,8 +883,7 @@ static void umlShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED, vm->monitor = -1; if ((ret = waitpid(vm->pid, NULL, 0)) != vm->pid) { - umlLog(VIR_LOG_WARN, - _("Got unexpected pid %d != %d\n"), + VIR_WARN(_("Got unexpected pid %d != %d"), ret, vm->pid); }