Skip to contentSkip to conversation

libxl: fix parse_backend_path and device_backend_path to be mutual

PATCH In review Roger Pau Monne 2 participants 2 messages Jan 13, 2012 – Jan 26, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: fix parse_backend_path and device_backend_path to be mutual

# HG changeset patch
# User Roger Pau Monne <[email protected]>
# Date 1326454799 -3600
# Node ID 58c924a72ab7af658a888ff39411229a9e6a12f6
# Parent 887a3229fd7a50c04981e29709bc7210dafef38f
libxl: fix parse_backend_path and device_backend_path to be mutual

Currently if libxl__parse_backend_path is used and then you try to get the original path again with libxl__device_backend_path the result is wrong. This patch fixes the issue, so transformation from path to libxl__device and back is reciprocal.

tools/libxl/libxl_device.c +3 -4
diff -r 887a3229fd7a -r 58c924a72ab7 tools/libxl/libxl_device.c
@@ -54,12 +54,11 @@ int libxl__parse_backend_path(libxl__gc 
 {
     /* /local/domain/<domid>/backend/<kind>/<domid>/<devid> */
     char strkind[16]; /* Longest is actually "console" */
-    uint32_t domain;
-    int rc = sscanf(path, "/local/domain/%d/backend/%15[^/]/%d/%d",
+    int rc = sscanf(path, "/local/domain/%d/backend/%15[^/]/%u/%d",
                     &dev->backend_domid,
                     strkind,
-                    &domain,
-                    &dev->backend_devid);
+                    &dev->domid,
+                    &dev->devid);
 
     if (rc != 4)
         return ERROR_FAIL;