]> xenbits.xensource.com Git - xen.git/commitdiff
libxl/libxl_internal.c: used LOG*D functions
authorCedric Bosdonnat <cbosdonnat@suse.com>
Fri, 2 Dec 2016 15:08:25 +0000 (16:08 +0100)
committerWei Liu <wei.liu2@citrix.com>
Sat, 3 Dec 2016 15:57:34 +0000 (15:57 +0000)
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl_internal.c

index c270a24dc04deda21a02a26ba0bfa22d4eb55c35..d288215089ea9e0bede15ce386d899fb8dc43074 100644 (file)
@@ -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;
     }