diff mbox

[v2,19/35] libxl/libxl_internal.c: used LOG*D functions

Message ID 20161117173617.6697-20-cbosdonnat@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Cedric Bosdonnat Nov. 17, 2016, 5:36 p.m. UTC
From: Cedric Bosdonnat <cbosdonnat@suse.com>

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
---
 tools/libxl/libxl_internal.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
diff mbox

Patch

diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
index c270a24..d288215 100644
--- a/tools/libxl/libxl_internal.c
+++ b/tools/libxl/libxl_internal.c
@@ -380,7 +380,7 @@  int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid)
     }
 
     if (libxl_device_model_version_from_string(dm_version, &value) < 0) {
-        LOG(ERROR, "fatal: %s contain a wrong value (%s)", path, dm_version);
+        LOGD(ERROR, domid, "fatal: %s contain a wrong value (%s)", path, dm_version);
         return -1;
     }
     return value;
@@ -407,7 +407,8 @@  libxl__domain_userdata_lock *libxl__lock_domain_userdata(libxl__gc *gc,
         libxl__carefd_begin();
         fd = open(lockfile, O_RDWR|O_CREAT, 0666);
         if (fd < 0)
-            LOGE(ERROR, "cannot open lockfile %s, errno=%d", lockfile, errno);
+            LOGED(ERROR, domid,
+                  "cannot open lockfile %s, errno=%d", lockfile, errno);
         lock->carefd = libxl__carefd_opened(CTX, fd);
         if (fd < 0) goto out;
 
@@ -421,21 +422,21 @@  libxl__domain_userdata_lock *libxl__lock_domain_userdata(libxl__gc *gc,
                 continue;
             default:
                 /* All other errno: EBADF, EINVAL, ENOLCK, EWOULDBLOCK */
-                LOGE(ERROR,
-                     "unexpected error while trying to lock %s, fd=%d, errno=%d",
-                     lockfile, fd, errno);
+                LOGED(ERROR, domid,
+                      "unexpected error while trying to lock %s, fd=%d, errno=%d",
+                      lockfile, fd, errno);
                 goto out;
             }
         }
 
         if (fstat(fd, &fstab)) {
-            LOGE(ERROR, "cannot fstat %s, fd=%d, errno=%d",
-                 lockfile, fd, errno);
+            LOGED(ERROR, domid, "cannot fstat %s, fd=%d, errno=%d",
+                  lockfile, fd, errno);
             goto out;
         }
         if (stat(lockfile, &stab)) {
             if (errno != ENOENT) {
-                LOGE(ERROR, "cannot stat %s, errno=%d", lockfile, errno);
+                LOGED(ERROR, domid, "cannot stat %s, errno=%d", lockfile, errno);
                 goto out;
             }
         } else {
@@ -489,8 +490,8 @@  int libxl__get_domain_configuration(libxl__gc *gc, uint32_t domid,
 
     rc = libxl__userdata_retrieve(gc, domid, "libxl-json", &data, &len);
     if (rc) {
-        LOGEV(ERROR, rc,
-              "failed to retrieve domain configuration for domain %d", domid);
+        LOGEVD(ERROR, rc, domid,
+              "failed to retrieve domain configuration");
         rc = ERROR_FAIL;
         goto out;
     }
@@ -515,9 +516,8 @@  int libxl__set_domain_configuration(libxl__gc *gc, uint32_t domid,
 
     d_config_json = libxl_domain_config_to_json(CTX, d_config);
     if (!d_config_json) {
-        LOGE(ERROR,
-             "failed to convert domain configuration to JSON for domain %d",
-             domid);
+        LOGED(ERROR, domid,
+              "failed to convert domain configuration to JSON");
         rc = ERROR_FAIL;
         goto out;
     }
@@ -526,8 +526,7 @@  int libxl__set_domain_configuration(libxl__gc *gc, uint32_t domid,
                                (const uint8_t *)d_config_json,
                                strlen(d_config_json) + 1 /* include '\0' */);
     if (rc) {
-        LOGEV(ERROR, rc, "failed to store domain configuration for domain %d",
-              domid);
+        LOGEVD(ERROR, rc, domid, "failed to store domain configuration");
         rc = ERROR_FAIL;
         goto out;
     }