# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1303133864 -3600
# Node ID 9bd4a7c6a75a947198d88ef3755103e3d5ac0daf
# Parent c0fdb5f1b76c8fd141208f8df15816a6d04fc5d4
tools: libxl: move all enum values into the libxl namespace
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
diff -r c0fdb5f1b76c -r 9bd4a7c6a75a tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Mon Apr 18 14:37:20 2011 +0100
+++ b/tools/libxl/libxl.c Mon Apr 18 14:37:44 2011 +0100
@@ -695,15 +695,15 @@ int libxl_event_get_disk_eject_info(libx
"/local/domain/%d/backend/%" TOSTRING(BACKEND_STRING_SIZE)
"[a-z]/%*d/%*d",
&disk->backend_domid, backend_type);
if (!strcmp(backend_type, "tap") || !strcmp(backend_type, "vbd")) {
- disk->backend = DISK_BACKEND_TAP;
+ disk->backend = LIBXL_DISK_BACKEND_TAP;
} else if (!strcmp(backend_type, "qdisk")) {
- disk->backend = DISK_BACKEND_QDISK;
+ disk->backend = LIBXL_DISK_BACKEND_QDISK;
} else {
- disk->backend = DISK_BACKEND_UNKNOWN;
+ disk->backend = LIBXL_DISK_BACKEND_UNKNOWN;
}
disk->pdev_path = strdup("");
- disk->format = DISK_FORMAT_EMPTY;
+ disk->format = LIBXL_DISK_FORMAT_EMPTY;
/* this value is returned to the user: do not free right away */
disk->vdev = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/dev",
backend), NULL);
disk->unpluggable = 1;
@@ -908,7 +908,7 @@ static int validate_virtual_disk(libxl__
struct stat stat_buf;
char *delimiter;
- if (disk->format == DISK_FORMAT_EMPTY) {
+ if (disk->format == LIBXL_DISK_FORMAT_EMPTY) {
if (disk->is_cdrom)
return 0;
LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Empty disk %s is not a CDROM
device\n",
@@ -916,11 +916,11 @@ static int validate_virtual_disk(libxl__
return ERROR_INVAL;
}
- if (disk->format == DISK_FORMAT_RAW) {
+ if (disk->format == LIBXL_DISK_FORMAT_RAW) {
delimiter = strchr(file_name, ':');
if (delimiter) {
if (!strncmp(file_name, "vhd:", sizeof("vhd:")-1)) {
- disk->format = DISK_FORMAT_VHD;
+ disk->format = LIBXL_DISK_FORMAT_VHD;
file_name = ++delimiter;
}
}
@@ -930,7 +930,7 @@ static int validate_virtual_disk(libxl__
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to stat %s",
file_name);
return ERROR_INVAL;
}
- if (disk->backend == DISK_BACKEND_PHY) {
+ if (disk->backend == LIBXL_DISK_BACKEND_PHY) {
if ( !(S_ISBLK(stat_buf.st_mode)) ) {
LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual disk %s is not a block
device!\n",
file_name);
@@ -984,19 +984,20 @@ int libxl_device_disk_add(libxl_ctx *ctx
device.kind = DEVICE_VBD;
/* If blktap is not available then fallback to qdisk */
- if (disk->backend == DISK_BACKEND_TAP && !libxl__blktap_enabled(&gc))
- disk->backend = DISK_BACKEND_QDISK;
+ if (disk->backend == LIBXL_DISK_BACKEND_TAP && !libxl__blktap_enabled(&gc))
+ disk->backend = LIBXL_DISK_BACKEND_QDISK;
/*
* blktap cannot handle empty disks (aka cdroms). Fall back to
* qdisk because qemu-xen creates the disk based on the xenstore
* entries.
*/
- if (disk->backend == DISK_BACKEND_TAP && disk->format == DISK_FORMAT_EMPTY)
- disk->backend == DISK_BACKEND_QDISK;
+ if (disk->backend == LIBXL_DISK_BACKEND_TAP &&
+ disk->format == LIBXL_DISK_FORMAT_EMPTY)
+ disk->backend == LIBXL_DISK_BACKEND_QDISK;
switch (disk->backend) {
- case DISK_BACKEND_PHY:
+ case LIBXL_DISK_BACKEND_PHY:
dev = disk->pdev_path;
do_backend_phy:
libxl__device_physdisk_major_minor(dev, &major, &minor);
@@ -1008,7 +1009,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
device.backend_kind = DEVICE_VBD;
break;
- case DISK_BACKEND_TAP:
+ case LIBXL_DISK_BACKEND_TAP:
dev = libxl__blktap_devpath(&gc, disk->pdev_path, disk->format);
if (!dev) {
rc = ERROR_FAIL;
@@ -1021,8 +1022,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
/* now create a phy device to export the device to the guest */
goto do_backend_phy;
-
- case DISK_BACKEND_QDISK:
+ case LIBXL_DISK_BACKEND_QDISK:
flexarray_append(back, "params");
flexarray_append(back, libxl__sprintf(&gc, "%s:%s",
libxl__device_disk_string_of_format(disk->format),
disk->pdev_path));
@@ -1091,13 +1091,13 @@ int libxl_device_disk_del(libxl_ctx *ctx
device.backend_devid = devid;
switch (disk->backend) {
- case DISK_BACKEND_PHY:
+ case LIBXL_DISK_BACKEND_PHY:
device.backend_kind = DEVICE_VBD;
break;
- case DISK_BACKEND_TAP:
+ case LIBXL_DISK_BACKEND_TAP:
device.backend_kind = DEVICE_VBD;
break;
- case DISK_BACKEND_QDISK:
+ case LIBXL_DISK_BACKEND_QDISK:
device.backend_kind = DEVICE_QDISK;
break;
default:
@@ -1124,8 +1124,8 @@ char * libxl_device_disk_local_attach(li
char *ret = NULL;
switch (disk->backend) {
- case DISK_BACKEND_PHY:
- if (disk->format != DISK_FORMAT_RAW) {
+ case LIBXL_DISK_BACKEND_PHY:
+ if (disk->format != LIBXL_DISK_FORMAT_RAW) {
LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "physical block device must"
" be raw");
break;
@@ -1134,13 +1134,14 @@ char * libxl_device_disk_local_attach(li
disk->pdev_path);
dev = disk->pdev_path;
break;
- case DISK_BACKEND_TAP:
- if (disk->format == DISK_FORMAT_VHD || disk->format ==
DISK_FORMAT_RAW)
+ case LIBXL_DISK_BACKEND_TAP:
+ if (disk->format == LIBXL_DISK_FORMAT_VHD ||
+ disk->format == LIBXL_DISK_FORMAT_RAW)
{
if (libxl__blktap_enabled(&gc))
dev = libxl__blktap_devpath(&gc, disk->pdev_path,
disk->format);
else {
- if (disk->format != DISK_FORMAT_RAW) {
+ if (disk->format != LIBXL_DISK_FORMAT_RAW) {
LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "tapdisk2 is
required"
" to open a vhd disk");
break;
@@ -1152,8 +1153,8 @@ char * libxl_device_disk_local_attach(li
}
}
break;
- } else if (disk->format == DISK_FORMAT_QCOW ||
- disk->format == DISK_FORMAT_QCOW2) {
+ } else if (disk->format == LIBXL_DISK_FORMAT_QCOW ||
+ disk->format == LIBXL_DISK_FORMAT_QCOW2) {
LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot locally attach a
qcow or qcow2 disk image");
break;
} else {
@@ -1161,8 +1162,8 @@ char * libxl_device_disk_local_attach(li
"type: %d", disk->backend);
break;
}
- case DISK_BACKEND_QDISK:
- if (disk->format != DISK_FORMAT_RAW) {
+ case LIBXL_DISK_BACKEND_QDISK:
+ if (disk->format != LIBXL_DISK_FORMAT_RAW) {
LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot locally attach a
qdisk "
"image if the format is not raw");
break;
@@ -1171,7 +1172,7 @@ char * libxl_device_disk_local_attach(li
disk->pdev_path);
dev = disk->pdev_path;
break;
- case DISK_BACKEND_UNKNOWN:
+ case LIBXL_DISK_BACKEND_UNKNOWN:
default:
LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend "
"type: %d", disk->backend);
@@ -1222,7 +1223,7 @@ int libxl_device_nic_init(libxl_device_n
if ( asprintf(&nic_info->script, "%s/vif-bridge",
libxl_xen_script_dir_path()) < 0 )
return ERROR_FAIL;
- nic_info->nictype = NICTYPE_IOEMU;
+ nic_info->nictype = LIBXL_NICTYPE_IOEMU;
return 0;
}
@@ -1585,7 +1586,7 @@ static unsigned int libxl__append_disk_l
pdisk->readwrite = 0;
type = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc,
"%s/device-type", libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc,
"%s/%s/frontend", be_path, *dir))));
pdisk->is_cdrom = !strcmp(type, "cdrom");
- pdisk->format = DISK_FORMAT_UNKNOWN;
+ pdisk->format = LIBXL_DISK_FORMAT_UNKNOWN;
}
}
@@ -1650,7 +1651,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u
if (!disk->pdev_path) {
disk->pdev_path = strdup("");
- disk->format = DISK_FORMAT_EMPTY;
+ disk->format = LIBXL_DISK_FORMAT_EMPTY;
}
disks = libxl_device_disk_list(ctx, domid, &num);
for (i = 0; i < num; i++) {
@@ -2170,10 +2171,10 @@ int libxl_button_press(libxl_ctx *ctx, u
int rc = -1;
switch (button) {
- case POWER_BUTTON:
+ case LIBXL_BUTTON_POWER:
rc = xc_domain_send_trigger(ctx->xch, domid,
XEN_DOMCTL_SENDTRIGGER_POWER, 0);
break;
- case SLEEP_BUTTON:
+ case LIBXL_BUTTON_SLEEP:
rc = xc_domain_send_trigger(ctx->xch, domid,
XEN_DOMCTL_SENDTRIGGER_SLEEP, 0);
break;
default:
diff -r c0fdb5f1b76c -r 9bd4a7c6a75a tools/libxl/libxl.h
--- a/tools/libxl/libxl.h Mon Apr 18 14:37:20 2011 +0100
+++ b/tools/libxl/libxl.h Mon Apr 18 14:37:44 2011 +0100
@@ -162,8 +162,8 @@ typedef struct {
void libxl_cpuarray_destroy(libxl_cpuarray *array);
typedef enum {
- XENFV = 1,
- XENPV,
+ LIBXL_QEMU_MACHINE_TYPE_FV = 1,
+ LIBXL_QEMU_MACHINE_TYPE_PV,
} libxl_qemu_machine_type;
typedef enum libxl_device_model_version {
@@ -184,24 +184,24 @@ typedef enum {
} libxl_console_consback;
typedef enum {
- DISK_FORMAT_UNKNOWN = 0,
- DISK_FORMAT_QCOW,
- DISK_FORMAT_QCOW2,
- DISK_FORMAT_VHD,
- DISK_FORMAT_RAW,
- DISK_FORMAT_EMPTY,
+ LIBXL_DISK_FORMAT_UNKNOWN = 0,
+ LIBXL_DISK_FORMAT_QCOW,
+ LIBXL_DISK_FORMAT_QCOW2,
+ LIBXL_DISK_FORMAT_VHD,
+ LIBXL_DISK_FORMAT_RAW,
+ LIBXL_DISK_FORMAT_EMPTY,
} libxl_disk_format;
typedef enum {
- DISK_BACKEND_UNKNOWN = 0,
- DISK_BACKEND_PHY,
- DISK_BACKEND_TAP,
- DISK_BACKEND_QDISK,
+ LIBXL_DISK_BACKEND_UNKNOWN = 0,
+ LIBXL_DISK_BACKEND_PHY,
+ LIBXL_DISK_BACKEND_TAP,
+ LIBXL_DISK_BACKEND_QDISK,
} libxl_disk_backend;
typedef enum {
- NICTYPE_IOEMU = 1,
- NICTYPE_VIF,
+ LIBXL_NICTYPE_IOEMU = 1,
+ LIBXL_NICTYPE_VIF,
} libxl_nic_type;
typedef struct {
@@ -495,8 +495,8 @@ int libxl_userdata_retrieve(libxl_ctx *c
*/
typedef enum {
- POWER_BUTTON,
- SLEEP_BUTTON
+ LIBXL_BUTTON_POWER,
+ LIBXL_BUTTON_SLEEP
} libxl_button;
int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button);
diff -r c0fdb5f1b76c -r 9bd4a7c6a75a tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c Mon Apr 18 14:37:20 2011 +0100
+++ b/tools/libxl/libxl_device.c Mon Apr 18 14:37:44 2011 +0100
@@ -121,11 +121,11 @@ out:
char *libxl__device_disk_string_of_format(libxl_disk_format format)
{
switch (format) {
- case DISK_FORMAT_QCOW: return "qcow";
- case DISK_FORMAT_QCOW2: return "qcow2";
- case DISK_FORMAT_VHD: return "vhd";
- case DISK_FORMAT_RAW:
- case DISK_FORMAT_EMPTY: return "aio";
+ case LIBXL_DISK_FORMAT_QCOW: return "qcow";
+ case LIBXL_DISK_FORMAT_QCOW2: return "qcow2";
+ case LIBXL_DISK_FORMAT_VHD: return "vhd";
+ case LIBXL_DISK_FORMAT_RAW:
+ case LIBXL_DISK_FORMAT_EMPTY: return "aio";
default: return NULL;
}
}
@@ -133,9 +133,9 @@ char *libxl__device_disk_string_of_forma
char *libxl__device_disk_string_of_backend(libxl_disk_backend backend)
{
switch (backend) {
- case DISK_BACKEND_QDISK: return "qdisk";
- case DISK_BACKEND_TAP: return "phy";
- case DISK_BACKEND_PHY: return "phy";
+ case LIBXL_DISK_BACKEND_QDISK: return "qdisk";
+ case LIBXL_DISK_BACKEND_TAP: return "phy";
+ case LIBXL_DISK_BACKEND_PHY: return "phy";
default: return NULL;
}
}
diff -r c0fdb5f1b76c -r 9bd4a7c6a75a tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c Mon Apr 18 14:37:20 2011 +0100
+++ b/tools/libxl/libxl_dm.c Mon Apr 18 14:37:44 2011 +0100
@@ -140,7 +140,7 @@ static char ** libxl__build_device_model
if (info->serial) {
flexarray_vappend(dm_args, "-serial", info->serial, NULL);
}
- if (info->type == XENFV) {
+ if (info->type == LIBXL_QEMU_MACHINE_TYPE_FV) {
int ioemu_vifs = 0;
if (info->videoram) {
@@ -172,7 +172,7 @@ static char ** libxl__build_device_model
flexarray_vappend(dm_args, "-vcpu_avail", libxl__sprintf(gc,
"0x%x", info->vcpu_avail), NULL);
}
for (i = 0; i < num_vifs; i++) {
- if (vifs[i].nictype == NICTYPE_IOEMU) {
+ if (vifs[i].nictype == LIBXL_NICTYPE_IOEMU) {
char *smac = libxl__sprintf(gc,
"%02x:%02x:%02x:%02x:%02x:%02x",
vifs[i].mac[0], vifs[i].mac[1],
vifs[i].mac[2],
vifs[i].mac[3], vifs[i].mac[4],
vifs[i].mac[5]);
@@ -204,10 +204,14 @@ static char ** libxl__build_device_model
for (i = 0; info->extra && info->extra[i] != NULL; i++)
flexarray_append(dm_args, info->extra[i]);
flexarray_append(dm_args, "-M");
- if (info->type == XENPV)
+ switch (info->type) {
+ case LIBXL_QEMU_MACHINE_TYPE_PV:
flexarray_append(dm_args, "xenpv");
- else
+ break;
+ case LIBXL_QEMU_MACHINE_TYPE_FV:
flexarray_append(dm_args, "xenfv");
+ break;
+ }
flexarray_append(dm_args, NULL);
return (char **) flexarray_contents(dm_args);
}
@@ -215,11 +219,11 @@ static char ** libxl__build_device_model
static const char *qemu_disk_format_string(libxl_disk_format format)
{
switch (format) {
- case DISK_FORMAT_QCOW: return "qcow";
- case DISK_FORMAT_QCOW2: return "qcow2";
- case DISK_FORMAT_VHD: return "vpc";
- case DISK_FORMAT_RAW: return "raw";
- case DISK_FORMAT_EMPTY: return NULL;
+ case LIBXL_DISK_FORMAT_QCOW: return "qcow";
+ case LIBXL_DISK_FORMAT_QCOW2: return "qcow2";
+ case LIBXL_DISK_FORMAT_VHD: return "vpc";
+ case LIBXL_DISK_FORMAT_RAW: return "raw";
+ case LIBXL_DISK_FORMAT_EMPTY: return NULL;
default: return NULL;
}
}
@@ -241,7 +245,7 @@ static char ** libxl__build_device_model
flexarray_vappend(dm_args, dm,
"-xen-domid", libxl__sprintf(gc, "%d", info->domid),
NULL);
- if (info->type == XENPV) {
+ if (info->type == LIBXL_QEMU_MACHINE_TYPE_PV) {
flexarray_append(dm_args, "-xen-attach");
}
@@ -279,7 +283,7 @@ static char ** libxl__build_device_model
flexarray_append(dm_args, "-sdl");
}
- if (info->type == XENPV && !info->nographic) {
+ if (info->type == LIBXL_QEMU_MACHINE_TYPE_PV && !info->nographic) {
flexarray_vappend(dm_args, "-vga", "xenfb", NULL);
}
@@ -292,7 +296,7 @@ static char ** libxl__build_device_model
if (info->serial) {
flexarray_vappend(dm_args, "-serial", info->serial, NULL);
}
- if (info->type == XENFV) {
+ if (info->type == LIBXL_QEMU_MACHINE_TYPE_FV) {
int ioemu_vifs = 0;
if (info->stdvga) {
@@ -322,7 +326,7 @@ static char ** libxl__build_device_model
flexarray_append(dm_args, libxl__sprintf(gc, "%d",
info->vcpus));
}
for (i = 0; i < num_vifs; i++) {
- if (vifs[i].nictype == NICTYPE_IOEMU) {
+ if (vifs[i].nictype == LIBXL_NICTYPE_IOEMU) {
char *smac = libxl__sprintf(gc,
"%02x:%02x:%02x:%02x:%02x:%02x",
vifs[i].mac[0], vifs[i].mac[1],
vifs[i].mac[2],
vifs[i].mac[3], vifs[i].mac[4],
vifs[i].mac[5]);
@@ -357,16 +361,20 @@ static char ** libxl__build_device_model
for (i = 0; info->extra && info->extra[i] != NULL; i++)
flexarray_append(dm_args, info->extra[i]);
flexarray_append(dm_args, "-M");
- if (info->type == XENPV)
+ switch (info->type) {
+ case LIBXL_QEMU_MACHINE_TYPE_PV:
flexarray_append(dm_args, "xenpv");
- else
+ break;
+ case LIBXL_QEMU_MACHINE_TYPE_FV:
flexarray_append(dm_args, "xenfv");
+ break;
+ }
/* RAM Size */
flexarray_append(dm_args, "-m");
flexarray_append(dm_args, libxl__sprintf(gc, "%d", info->target_ram));
- if (info->type == XENFV) {
+ if (info->type == LIBXL_QEMU_MACHINE_TYPE_FV) {
for (i; i < num_disks; i++) {
int disk, part;
int dev_number =
@@ -381,7 +389,7 @@ static char ** libxl__build_device_model
}
if (disks[i].is_cdrom) {
- if (disks[i].format == DISK_FORMAT_EMPTY)
+ if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY)
drive = libxl__sprintf
(gc, "if=ide,index=%d,media=cdrom", disk);
else
@@ -389,7 +397,7 @@ static char ** libxl__build_device_model
(gc, "file=%s,if=ide,index=%d,media=cdrom,format=%s",
disks[i].pdev_path, disk, format);
} else {
- if (disks[i].format == DISK_FORMAT_EMPTY) {
+ if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY) {
LIBXL__LOG(ctx, LIBXL__LOG_WARNING, "cannot support"
" empty disk format for %s", disks[i].vdev);
continue;
@@ -921,7 +929,7 @@ static int libxl__build_xenpv_qemu_args(
info->dom_name = libxl_domid_to_name(ctx, domid);
info->device_model_version =
LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
info->device_model = NULL;
- info->type = XENPV;
+ info->type = LIBXL_QEMU_MACHINE_TYPE_PV;
return 0;
}
@@ -953,7 +961,7 @@ int libxl__need_xenpv_qemu(libxl__gc *gc
int blktap_enabled = -1;
for (i = 0; i < nr_disks; i++) {
switch (disks[i].backend) {
- case DISK_BACKEND_TAP:
+ case LIBXL_DISK_BACKEND_TAP:
if (blktap_enabled == -1)
blktap_enabled = libxl__blktap_enabled(gc);
if (!blktap_enabled) {
@@ -962,12 +970,12 @@ int libxl__need_xenpv_qemu(libxl__gc *gc
}
break;
- case DISK_BACKEND_QDISK:
+ case LIBXL_DISK_BACKEND_QDISK:
ret = 1;
goto out;
- case DISK_BACKEND_PHY:
- case DISK_BACKEND_UNKNOWN:
+ case LIBXL_DISK_BACKEND_PHY:
+ case LIBXL_DISK_BACKEND_UNKNOWN:
break;
}
}
diff -r c0fdb5f1b76c -r 9bd4a7c6a75a tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Mon Apr 18 14:37:20 2011 +0100
+++ b/tools/libxl/libxl_utils.c Mon Apr 18 14:37:44 2011 +0100
@@ -283,9 +283,9 @@ int libxl_string_to_backend(libxl_ctx *c
int rc = 0;
if (!strcmp(s, "phy")) {
- *backend = DISK_BACKEND_PHY;
+ *backend = LIBXL_DISK_BACKEND_PHY;
} else if (!strcmp(s, "file")) {
- *backend = DISK_BACKEND_TAP;
+ *backend = LIBXL_DISK_BACKEND_TAP;
} else if (!strcmp(s, "tap")) {
p = strchr(s, ':');
if (!p) {
@@ -294,11 +294,11 @@ int libxl_string_to_backend(libxl_ctx *c
}
p++;
if (!strcmp(p, "vhd")) {
- *backend = DISK_BACKEND_TAP;
+ *backend = LIBXL_DISK_BACKEND_TAP;
} else if (!strcmp(p, "qcow")) {
- *backend = DISK_BACKEND_QDISK;
+ *backend = LIBXL_DISK_BACKEND_QDISK;
} else if (!strcmp(p, "qcow2")) {
- *backend = DISK_BACKEND_QDISK;
+ *backend = LIBXL_DISK_BACKEND_QDISK;
}
}
out:
diff -r c0fdb5f1b76c -r 9bd4a7c6a75a tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Mon Apr 18 14:37:20 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c Mon Apr 18 14:37:44 2011 +0100
@@ -481,12 +481,12 @@ static int parse_disk_config(libxl_devic
*p = '\0';
if ( !strcmp(tok, "phy") ) {
state = DSTATE_PHYSPATH;
- disk->format = DISK_FORMAT_RAW;
- disk->backend = DISK_BACKEND_PHY;
+ disk->format = LIBXL_DISK_FORMAT_RAW;
+ disk->backend = LIBXL_DISK_BACKEND_PHY;
}else if ( !strcmp(tok, "file") ) {
state = DSTATE_PHYSPATH;
- disk->format = DISK_FORMAT_RAW;
- disk->backend = DISK_BACKEND_TAP;
+ disk->format = LIBXL_DISK_FORMAT_RAW;
+ disk->backend = LIBXL_DISK_BACKEND_TAP;
}else if ((!strcmp(tok, "tap")) ||
(!strcmp(tok, "tap2"))) {
state = DSTATE_TAP;
@@ -497,16 +497,16 @@ static int parse_disk_config(libxl_devic
tok = p + 1;
} else if (*p == ',') {
state = DSTATE_VIRTPATH;
- disk->format = DISK_FORMAT_EMPTY;
- disk->backend = DISK_BACKEND_TAP;
+ disk->format = LIBXL_DISK_FORMAT_EMPTY;
+ disk->backend = LIBXL_DISK_BACKEND_TAP;
disk->pdev_path = strdup("");
tok = p + 1;
}
break;
case DSTATE_TAP:
if (*p == ',') {
- disk->format = DISK_FORMAT_RAW;
- disk->backend = DISK_BACKEND_TAP;
+ disk->format = LIBXL_DISK_FORMAT_RAW;
+ disk->backend = LIBXL_DISK_BACKEND_TAP;
state = DSTATE_PHYSPATH;
} else if ( *p == ':' ) {
*p = '\0';
@@ -515,17 +515,17 @@ static int parse_disk_config(libxl_devic
break;
}
if (!strcmp(tok, "vhd")) {
- disk->format = DISK_FORMAT_VHD;
- disk->backend = DISK_BACKEND_TAP;
+ disk->format = LIBXL_DISK_FORMAT_VHD;
+ disk->backend = LIBXL_DISK_BACKEND_TAP;
}else if ( !strcmp(tok, "qcow") ) {
- disk->format = DISK_FORMAT_QCOW;
- disk->backend = DISK_BACKEND_QDISK;
+ disk->format = LIBXL_DISK_FORMAT_QCOW;
+ disk->backend = LIBXL_DISK_BACKEND_QDISK;
}else if ( !strcmp(tok, "qcow2") ) {
- disk->format = DISK_FORMAT_QCOW2;
- disk->backend = DISK_BACKEND_QDISK;
+ disk->format = LIBXL_DISK_FORMAT_QCOW2;
+ disk->backend = LIBXL_DISK_BACKEND_QDISK;
}else if (!strcmp(tok, "raw")) {
- disk->format = DISK_FORMAT_RAW;
- disk->backend = DISK_BACKEND_TAP;
+ disk->format = LIBXL_DISK_FORMAT_RAW;
+ disk->backend = LIBXL_DISK_BACKEND_TAP;
}
else {
fprintf(stderr, "Unknown tapdisk type: %s\n", tok);
@@ -874,9 +874,9 @@ static void parse_config_data(const char
nic->bridge = strdup(p2 + 1);
} else if (!strcmp(p, "type")) {
if (!strcmp(p2 + 1, "ioemu"))
- nic->nictype = NICTYPE_IOEMU;
+ nic->nictype = LIBXL_NICTYPE_IOEMU;
else
- nic->nictype = NICTYPE_VIF;
+ nic->nictype = LIBXL_NICTYPE_VIF;
} else if (!strcmp(p, "ip")) {
free(nic->ip);
nic->ip = strdup(p2 + 1);
@@ -1147,7 +1147,9 @@ skip_vfb:
}
}
- dm_info->type = c_info->hvm ? XENFV : XENPV;
+ dm_info->type = c_info->hvm ?
+ LIBXL_QEMU_MACHINE_TYPE_FV :
+ LIBXL_QEMU_MACHINE_TYPE_PV;
xlu_cfg_destroy(config);
}
@@ -3336,9 +3338,9 @@ static void button_press(const char *p,
find_domain(p);
if (!strcmp(b, "power")) {
- button = POWER_BUTTON;
+ button = LIBXL_BUTTON_POWER;
} else if (!strcmp(b, "sleep")) {
- button = SLEEP_BUTTON;
+ button = LIBXL_BUTTON_SLEEP;
} else {
fprintf(stderr, "%s is an invalid button identifier\n", b);
exit(2);
@@ -4250,9 +4252,9 @@ int main_networkattach(int argc, char **
for (argv += optind+1, argc -= optind+1; argc > 0; ++argv, --argc) {
if (!strncmp("type=", *argv, 5)) {
if (!strncmp("vif", (*argv) + 5, 4)) {
- nic.nictype = NICTYPE_VIF;
+ nic.nictype = LIBXL_NICTYPE_VIF;
} else if (!strncmp("ioemu", (*argv) + 5, 5)) {
- nic.nictype = NICTYPE_IOEMU;
+ nic.nictype = LIBXL_NICTYPE_IOEMU;
} else {
fprintf(stderr, "Invalid parameter `type'.\n");
return 1;
@@ -4421,22 +4423,22 @@ int main_blockattach(int argc, char **ar
tok = strtok(argv[optind+1], ":");
if (!strcmp(tok, "phy")) {
- disk.backend = DISK_BACKEND_PHY;
+ disk.backend = LIBXL_DISK_BACKEND_PHY;
} else if (!strcmp(tok, "file")) {
- disk.backend = DISK_BACKEND_TAP;
+ disk.backend = LIBXL_DISK_BACKEND_TAP;
} else if (!strcmp(tok, "tap")) {
tok = strtok(NULL, ":");
if (!strcmp(tok, "aio")) {
- disk.backend = DISK_BACKEND_TAP;
+ disk.backend = LIBXL_DISK_BACKEND_TAP;
} else if (!strcmp(tok, "vhd")) {
- disk.format = DISK_FORMAT_VHD;
- disk.backend = DISK_BACKEND_TAP;
+ disk.format = LIBXL_DISK_FORMAT_VHD;
+ disk.backend = LIBXL_DISK_BACKEND_TAP;
} else if (!strcmp(tok, "qcow")) {
- disk.format = DISK_FORMAT_QCOW;
- disk.backend = DISK_BACKEND_QDISK;
+ disk.format = LIBXL_DISK_FORMAT_QCOW;
+ disk.backend = LIBXL_DISK_BACKEND_QDISK;
} else if (!strcmp(tok, "qcow2")) {
- disk.format = DISK_FORMAT_QCOW2;
- disk.backend = DISK_BACKEND_QDISK;
+ disk.format = LIBXL_DISK_FORMAT_QCOW2;
+ disk.backend = LIBXL_DISK_BACKEND_QDISK;
} else {
fprintf(stderr, "Error: `%s' is not a valid disk image.\n", tok);
return 1;
diff -r c0fdb5f1b76c -r 9bd4a7c6a75a tools/ocaml/libs/xl/xl_stubs.c
--- a/tools/ocaml/libs/xl/xl_stubs.c Mon Apr 18 14:37:20 2011 +0100
+++ b/tools/ocaml/libs/xl/xl_stubs.c Mon Apr 18 14:37:44 2011 +0100
@@ -224,7 +224,7 @@ static int device_nic_val(caml_gc *gc, l
c_val->bridge = dup_String_val(gc, Field(v, 5));
c_val->ifname = dup_String_val(gc, Field(v, 6));
c_val->script = dup_String_val(gc, Field(v, 7));
- c_val->nictype = (Int_val(Field(v, 8))) + NICTYPE_IOEMU;
+ c_val->nictype = (Int_val(Field(v, 8))) + LIBXL_NICTYPE_IOEMU;
out:
CAMLreturn(ret);
@@ -610,7 +610,7 @@ value stub_xl_button_press(value domid,
INIT_STRUCT();
INIT_CTX();
- ret = libxl_button_press(ctx, Int_val(domid), Int_val(button) +
POWER_BUTTON);
+ ret = libxl_button_press(ctx, Int_val(domid), Int_val(button) +
LIBXL_BUTTON_POWER);
if (ret != 0)
failwith_xl("button_press", &lg);
FREE_CTX();
diff -r c0fdb5f1b76c -r 9bd4a7c6a75a tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c Mon Apr 18 14:37:20 2011 +0100
+++ b/tools/python/xen/lowlevel/xl/xl.c Mon Apr 18 14:37:44 2011 +0100
@@ -769,8 +769,8 @@ PyMODINIT_FUNC initxl(void)
_INT_CONST(m, SHUTDOWN_crash);
_INT_CONST(m, SHUTDOWN_watchdog);
- _INT_CONST(m, XENFV);
- _INT_CONST(m, XENPV);
+ _INT_CONST_LIBXL(m, QEMU_MACHINE_TYPE_FV);
+ _INT_CONST_LIBXL(m, QEMU_MACHINE_TYPE_PV);
_INT_CONST_LIBXL(m, CONSTYPE_SERIAL);
_INT_CONST_LIBXL(m, CONSTYPE_PV);
@@ -778,26 +778,26 @@ PyMODINIT_FUNC initxl(void)
_INT_CONST_LIBXL(m, CONSBACK_XENCONSOLED);
_INT_CONST_LIBXL(m, CONSBACK_IOEMU);
- _INT_CONST(m, DISK_FORMAT_UNKNOWN);
- _INT_CONST(m, DISK_FORMAT_QCOW);
- _INT_CONST(m, DISK_FORMAT_QCOW2);
- _INT_CONST(m, DISK_FORMAT_VHD);
- _INT_CONST(m, DISK_FORMAT_RAW);
- _INT_CONST(m, DISK_FORMAT_EMPTY);
+ _INT_CONST_LIBXL(m, DISK_FORMAT_UNKNOWN);
+ _INT_CONST_LIBXL(m, DISK_FORMAT_QCOW);
+ _INT_CONST_LIBXL(m, DISK_FORMAT_QCOW2);
+ _INT_CONST_LIBXL(m, DISK_FORMAT_VHD);
+ _INT_CONST_LIBXL(m, DISK_FORMAT_RAW);
+ _INT_CONST_LIBXL(m, DISK_FORMAT_EMPTY);
- _INT_CONST(m, DISK_BACKEND_UNKNOWN);
- _INT_CONST(m, DISK_BACKEND_PHY);
- _INT_CONST(m, DISK_BACKEND_TAP);
- _INT_CONST(m, DISK_BACKEND_QDISK);
+ _INT_CONST_LIBXL(m, DISK_BACKEND_UNKNOWN);
+ _INT_CONST_LIBXL(m, DISK_BACKEND_PHY);
+ _INT_CONST_LIBXL(m, DISK_BACKEND_TAP);
+ _INT_CONST_LIBXL(m, DISK_BACKEND_QDISK);
- _INT_CONST(m, NICTYPE_IOEMU);
- _INT_CONST(m, NICTYPE_VIF);
+ _INT_CONST_LIBXL(m, NICTYPE_IOEMU);
+ _INT_CONST_LIBXL(m, NICTYPE_VIF);
_INT_CONST_LIBXL(m, EVENT_DOMAIN_DEATH);
_INT_CONST_LIBXL(m, EVENT_DISK_EJECT);
- _INT_CONST(m, POWER_BUTTON);
- _INT_CONST(m, SLEEP_BUTTON);
+ _INT_CONST_LIBXL(m, BUTTON_POWER);
+ _INT_CONST_LIBXL(m, BUTTON_SLEEP);
genwrap__init(m);
}
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|