[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2 of 4] libxl: move all enum values into the libxl namespace



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1300969249 0
# Node ID 0af1e680ea5642c63e6467660190975d57f417e7
# Parent  8a90d1a20afe38c1e0da84d5d120cb312d29d62b
libxl: move all enum values into the libxl namespace

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 8a90d1a20afe -r 0af1e680ea56 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Mar 24 12:20:49 2011 +0000
+++ b/tools/libxl/libxl.c       Thu Mar 24 12:20:49 2011 +0000
@@ -694,16 +694,16 @@ 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->domid = domid;
     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,14 +908,14 @@ 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)
         return 0;
 
-    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;
             }
         }
@@ -925,7 +925,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);
@@ -980,7 +980,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
     device.kind = DEVICE_VBD;
 
     switch (disk->backend) {
-        case DISK_BACKEND_PHY: 
+        case LIBXL_DISK_BACKEND_PHY: 
             libxl__device_physdisk_major_minor(disk->pdev_path, &major, 
&minor);
             flexarray_append(back, "physical-device");
             flexarray_append(back, libxl__sprintf(&gc, "%x:%x", major, minor));
@@ -990,8 +990,8 @@ int libxl_device_disk_add(libxl_ctx *ctx
 
             device.backend_kind = DEVICE_VBD;
             break;
-        case DISK_BACKEND_TAP:
-            if (libxl__blktap_enabled(&gc) && disk->format != 
DISK_FORMAT_EMPTY) {
+        case LIBXL_DISK_BACKEND_TAP:
+            if (libxl__blktap_enabled(&gc) && disk->format != 
LIBXL_DISK_FORMAT_EMPTY) {
                 const char *dev = libxl__blktap_devpath(&gc,
                                                disk->pdev_path, disk->format);
                 if (!dev) {
@@ -1012,13 +1012,13 @@ int libxl_device_disk_add(libxl_ctx *ctx
 
                 break;
             }
-        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));
 
             if (libxl__blktap_enabled(&gc) && 
-                 disk->backend != DISK_BACKEND_QDISK)
+                 disk->backend != LIBXL_DISK_BACKEND_QDISK)
                 device.backend_kind = DEVICE_TAP;
             else
                 device.backend_kind = DEVICE_QDISK;
@@ -1085,7 +1085,7 @@ int libxl_device_disk_del(libxl_ctx *ctx
     device.backend_domid    = disk->backend_domid;
     device.backend_devid    = devid;
     device.backend_kind     =
-        (disk->backend == DISK_BACKEND_PHY) ? DEVICE_VBD : DEVICE_TAP;
+        (disk->backend == LIBXL_DISK_BACKEND_PHY) ? DEVICE_VBD : DEVICE_TAP;
     device.domid            = disk->domid;
     device.devid            = devid;
     device.kind             = DEVICE_VBD;
@@ -1103,8 +1103,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;
@@ -1113,13 +1113,13 @@ 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;
@@ -1131,8 +1131,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 {
@@ -1140,8 +1140,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;
@@ -1150,7 +1150,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);
@@ -1202,7 +1202,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;
 }
 
@@ -1851,7 +1851,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++) {
@@ -2372,10 +2372,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 8a90d1a20afe -r 0af1e680ea56 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Thu Mar 24 12:20:49 2011 +0000
+++ b/tools/libxl/libxl.h       Thu Mar 24 12:20:49 2011 +0000
@@ -162,8 +162,8 @@ void libxl_cpuarray_destroy(libxl_cpuarr
 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 {
@@ -177,24 +177,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 {
@@ -487,8 +487,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 8a90d1a20afe -r 0af1e680ea56 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Thu Mar 24 12:20:49 2011 +0000
+++ b/tools/libxl/libxl_device.c        Thu Mar 24 12:20:49 2011 +0000
@@ -123,11 +123,11 @@ char *libxl__device_disk_string_of_forma
 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; 
     }
 }
@@ -135,9 +135,9 @@ char *libxl__device_disk_string_of_backe
 char *libxl__device_disk_string_of_backend(libxl_disk_backend backend)
 {
     switch (backend) {
-        case DISK_BACKEND_QDISK: return "qdisk";
-        case DISK_BACKEND_TAP: return "tap";
-        case DISK_BACKEND_PHY: return "phy";
+        case LIBXL_DISK_BACKEND_QDISK: return "qdisk";
+        case LIBXL_DISK_BACKEND_TAP: return "tap";
+        case LIBXL_DISK_BACKEND_PHY: return "phy";
         default: return NULL;
     }
 }
diff -r 8a90d1a20afe -r 0af1e680ea56 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Thu Mar 24 12:20:49 2011 +0000
+++ b/tools/libxl/libxl_dm.c    Thu Mar 24 12:20:49 2011 +0000
@@ -98,7 +98,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) {
@@ -130,7 +130,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]);
@@ -162,10 +162,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);
 }
@@ -186,7 +190,7 @@ static char ** libxl__build_device_model
     flexarray_vappend(dm_args, libxl__strdup(gc, info->device_model),
                         "-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");
     }
 
@@ -224,7 +228,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);
     }
 
@@ -237,7 +241,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) {
@@ -267,7 +271,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]);
@@ -302,16 +306,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) {
         disks = libxl_device_disk_list(libxl__gc_owner(gc), info->domid, &nb);
         for (i; i < nb; i++) {
             if (disks[i].is_cdrom) {
@@ -795,7 +803,7 @@ static int libxl__build_xenpv_qemu_args(
     info->domid = domid;
     info->dom_name = libxl_domid_to_name(ctx, domid);
     info->device_model = libxl__abs_path(gc, "qemu-dm", libxl_libexec_path());
-    info->type = XENPV;
+    info->type = LIBXL_QEMU_MACHINE_TYPE_PV;
     return 0;
 }
 
@@ -827,7 +835,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) {
@@ -836,12 +844,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 8a90d1a20afe -r 0af1e680ea56 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Thu Mar 24 12:20:49 2011 +0000
+++ b/tools/libxl/libxl_utils.c Thu Mar 24 12:20:49 2011 +0000
@@ -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 8a90d1a20afe -r 0af1e680ea56 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Mar 24 12:20:49 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Mar 24 12:20:49 2011 +0000
@@ -479,12 +479,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;
@@ -495,16 +495,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';
@@ -513,17 +513,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);
@@ -862,9 +862,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);
@@ -1155,7 +1155,7 @@ 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);
 }
@@ -3345,9 +3345,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);
@@ -4259,9 +4259,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;
@@ -4427,22 +4427,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 8a90d1a20afe -r 0af1e680ea56 tools/ocaml/libs/xl/xl_stubs.c
--- a/tools/ocaml/libs/xl/xl_stubs.c    Thu Mar 24 12:20:49 2011 +0000
+++ b/tools/ocaml/libs/xl/xl_stubs.c    Thu Mar 24 12:20:49 2011 +0000
@@ -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);
@@ -594,7 +594,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 8a90d1a20afe -r 0af1e680ea56 tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c Thu Mar 24 12:20:49 2011 +0000
+++ b/tools/python/xen/lowlevel/xl/xl.c Thu Mar 24 12:20:49 2011 +0000
@@ -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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.