aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_utils.c
diff options
context:
space:
mode:
authorKamala Narasimhan <kamala.narasimhan@citrix.com>2011-02-15 19:59:37 +0000
committerKamala Narasimhan <kamala.narasimhan@citrix.com>2011-02-15 19:59:37 +0000
commit546a7640451fc359212ba23bc2d6a9497e1ed6d9 (patch)
tree74ca2514207c377da35f3068557784f4b99526c1 /tools/libxl/libxl_utils.c
parenta7fd96dfbd3cfe5509420c28ec47e8229a773b76 (diff)
downloadxen-546a7640451fc359212ba23bc2d6a9497e1ed6d9.tar.gz
xen-546a7640451fc359212ba23bc2d6a9497e1ed6d9.tar.bz2
xen-546a7640451fc359212ba23bc2d6a9497e1ed6d9.zip
libxl: disk specification interface change
Currently we pile all the backend and format information pertaining to disk option in a single enum. This check-in separates the two and uses two enums, one for disk format and another for disk backend. This helps clearly differentiate between disk format and backend within the implementation and also helps cleanup the code in this area in preparation for the impending parser revamping to be done post 4.1. Along with separating format and backend, this check-in also removes unwanted types and renames variables in the disk interface and fixes the code affected by the interface changes. In specific, here are the disk interface changes made - In libxl_device_disk structure physpath was renamed to pdev_path, virtpath was renamed to vdev, phystype was removed and replaced with backend and format enums. Also previously a single enum libxl_disk_phystype held the values for qcow, qcow2, vhd, aio, file, phy, empty and that got refactored into two enums, libxl_disk_format to hold unknown, qcow, qcow2, vhd, raw, empty and libxl_disk_backend to hold unknown, phy, tap and qdisk. Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_utils.c')
-rw-r--r--tools/libxl/libxl_utils.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index a44f8af3e4..d13ae65821 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -275,15 +275,15 @@ out:
return rc;
}
-int libxl_string_to_phystype(libxl_ctx *ctx, char *s, libxl_disk_phystype *phystype)
+int libxl_string_to_backend(libxl_ctx *ctx, char *s, libxl_disk_backend *backend)
{
char *p;
int rc = 0;
if (!strcmp(s, "phy")) {
- *phystype = PHYSTYPE_PHY;
+ *backend = DISK_BACKEND_PHY;
} else if (!strcmp(s, "file")) {
- *phystype = PHYSTYPE_FILE;
+ *backend = DISK_BACKEND_TAP;
} else if (!strcmp(s, "tap")) {
p = strchr(s, ':');
if (!p) {
@@ -291,14 +291,12 @@ int libxl_string_to_phystype(libxl_ctx *ctx, char *s, libxl_disk_phystype *physt
goto out;
}
p++;
- if (!strcmp(p, "aio")) {
- *phystype = PHYSTYPE_AIO;
- } else if (!strcmp(p, "vhd")) {
- *phystype = PHYSTYPE_VHD;
+ if (!strcmp(p, "vhd")) {
+ *backend = DISK_BACKEND_TAP;
} else if (!strcmp(p, "qcow")) {
- *phystype = PHYSTYPE_QCOW;
+ *backend = DISK_BACKEND_QDISK;
} else if (!strcmp(p, "qcow2")) {
- *phystype = PHYSTYPE_QCOW2;
+ *backend = DISK_BACKEND_QDISK;
}
}
out:
@@ -553,10 +551,10 @@ int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
disk->backend_domid = strtoul(val, NULL, 10);
disk->domid = domid;
be_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend", diskpath));
- disk->physpath = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/params", be_path));
+ disk->pdev_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/params", be_path));
val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/type", be_path));
- libxl_string_to_phystype(ctx, val, &(disk->phystype));
- disk->virtpath = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev", be_path));
+ libxl_string_to_backend(ctx, val, &(disk->backend));
+ disk->vdev = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev", be_path));
val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/removable", be_path));
disk->unpluggable = !strcmp(val, "1");
val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mode", be_path));