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

Re: [Xen-devel] [PATCH] libxl: Enable -Wshadow



On Fri, 2012-09-14 at 15:42 +0100, Ian Jackson wrote:
> If we're doing -Wshadow then macros which introduce local variables
> like this should give them names qualified somehow for the macro.

Done, v2 below.

Since I was touching every line I fixed the line length in those macros
too.

8<------------------------------------------------------

# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1347636539 -3600
# Node ID 6aacce1d8650e4fec5ddc524fd9a779e05434b26
# Parent  0547430886c507989dd9091ef5f1e2d089a50351
libxl: Enable -Wshadow.

It was convenient to invent $(CFLAGS_LIBXL) to do this.

Various renamings to avoid shadowing standard functions:
  - index(3)
  - listen(2)
  - link(2)
  - abort(3)
  - abs(3)

Reduced the scope of some variables to avoid conflicts.

Change to libxc is due to the nested hypercall buf macros in
set_xen_guest_handle (used in libxl) using the same local private vars.

Build tested only.

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

diff -r 0547430886c5 -r 6aacce1d8650 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Fri Sep 14 11:00:40 2012 +0100
+++ b/tools/libxc/xenctrl.h     Fri Sep 14 16:28:59 2012 +0100
@@ -235,11 +235,13 @@ typedef struct xc_hypercall_buffer xc_hy
 /*
  * Returns the hypercall_buffer associated with a variable.
  */
-#define HYPERCALL_BUFFER(_name)                                                
              \
-    ({  xc_hypercall_buffer_t _val1;                                           
              \
-        typeof(XC__HYPERCALL_BUFFER_NAME(_name)) *_val2 = 
&XC__HYPERCALL_BUFFER_NAME(_name); \
-        (void)(&_val1 == _val2);                                               
              \
-        (_val2)->param_shadow ? (_val2)->param_shadow : (_val2);               
              \
+#define HYPERCALL_BUFFER(_name)                                 \
+    ({  xc_hypercall_buffer_t _hcbuf_buf1;                      \
+        typeof(XC__HYPERCALL_BUFFER_NAME(_name)) *_hcbuf_buf2 = \
+                &XC__HYPERCALL_BUFFER_NAME(_name);              \
+        (void)(&_hcbuf_buf1 == _hcbuf_buf2);                    \
+        (_hcbuf_buf2)->param_shadow ?                           \
+                (_hcbuf_buf2)->param_shadow : (_hcbuf_buf2);    \
      })
 
 #define HYPERCALL_BUFFER_INIT_NO_BOUNCE .dir = 0, .sz = 0, .ubuf = (void *)-1
@@ -273,11 +275,12 @@ typedef struct xc_hypercall_buffer xc_hy
  * Get the hypercall buffer data pointer in a form suitable for use
  * directly as a hypercall argument.
  */
-#define HYPERCALL_BUFFER_AS_ARG(_name)                                         
    \
-    ({  xc_hypercall_buffer_t _val1;                                           
    \
-        typeof(XC__HYPERCALL_BUFFER_NAME(_name)) *_val2 = 
HYPERCALL_BUFFER(_name); \
-        (void)(&_val1 == _val2);                                               
    \
-        (unsigned long)(_val2)->hbuf;                                          
    \
+#define HYPERCALL_BUFFER_AS_ARG(_name)                          \
+    ({  xc_hypercall_buffer_t _hcbuf_arg1;                      \
+        typeof(XC__HYPERCALL_BUFFER_NAME(_name)) *_hcbuf_arg2 = \
+                HYPERCALL_BUFFER(_name);                        \
+        (void)(&_hcbuf_arg1 == _hcbuf_arg2);                    \
+        (unsigned long)(_hcbuf_arg2)->hbuf;                     \
      })
 
 /*
@@ -285,12 +288,13 @@ typedef struct xc_hypercall_buffer xc_hy
  * data pointer has been correctly allocated.
  */
 #undef set_xen_guest_handle
-#define set_xen_guest_handle(_hnd, _val)                                       
  \
-    do {                                                                       
  \
-        xc_hypercall_buffer_t _val1;                                           
  \
-        typeof(XC__HYPERCALL_BUFFER_NAME(_val)) *_val2 = 
HYPERCALL_BUFFER(_val); \
-        (void) (&_val1 == _val2);                                              
   \
-        set_xen_guest_handle_raw(_hnd, (_val2)->hbuf);                         
  \
+#define set_xen_guest_handle(_hnd, _val)                        \
+    do {                                                        \
+        xc_hypercall_buffer_t _hcbuf_hnd1;                      \
+        typeof(XC__HYPERCALL_BUFFER_NAME(_val)) *_hcbuf_hnd2 =  \
+                HYPERCALL_BUFFER(_val);                         \
+        (void) (&_hcbuf_hnd1 == _hcbuf_hnd2);                   \
+        set_xen_guest_handle_raw(_hnd, (_hcbuf_hnd2)->hbuf);    \
     } while (0)
 
 /* Use with set_xen_guest_handle in place of NULL */
diff -r 0547430886c5 -r 6aacce1d8650 tools/libxl/Makefile
--- a/tools/libxl/Makefile      Fri Sep 14 11:00:40 2012 +0100
+++ b/tools/libxl/Makefile      Fri Sep 14 16:28:59 2012 +0100
@@ -22,6 +22,12 @@ endif
 LIBXL_LIBS =
 LIBXL_LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) 
$(LDLIBS_libblktapctl) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS)
 
+CFLAGS_LIBXL += $(CFLAGS_libxenctrl)
+CFLAGS_LIBXL += $(CFLAGS_libxenguest)
+CFLAGS_LIBXL += $(CFLAGS_libxenstore)
+CFLAGS_LIBXL += $(CFLAGS_libblktapctl) 
+CFLAGS_LIBXL += -Wshadow
+
 CFLAGS += $(PTHREAD_CFLAGS)
 LDFLAGS += $(PTHREAD_LDFLAGS)
 LIBXL_LIBS += $(PTHREAD_LIBS)
@@ -71,7 +77,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_c
                        libxl_qmp.o libxl_event.o libxl_fork.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
-$(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) 
$(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) -include $(XEN_ROOT)/tools/config.h
+$(LIBXL_OBJS): CFLAGS += $(CFLAGS_LIBXL) -include $(XEN_ROOT)/tools/config.h
 
 AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h _paths.h \
        _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
diff -r 0547430886c5 -r 6aacce1d8650 tools/libxl/flexarray.c
--- a/tools/libxl/flexarray.c   Fri Sep 14 11:00:40 2012 +0100
+++ b/tools/libxl/flexarray.c   Fri Sep 14 16:28:59 2012 +0100
@@ -48,19 +48,19 @@ int flexarray_grow(flexarray_t *array, i
     return 0;
 }
 
-int flexarray_set(flexarray_t *array, unsigned int index, void *ptr)
+int flexarray_set(flexarray_t *array, unsigned int idx, void *ptr)
 {
-    if (index >= array->size) {
+    if (idx >= array->size) {
         int newsize;
         if (!array->autogrow)
             return 1;
-        newsize = (array->size * 2 < index) ? index + 1 : array->size * 2;
+        newsize = (array->size * 2 < idx) ? idx + 1 : array->size * 2;
         if (flexarray_grow(array, newsize - array->size))
             return 2;
     }
-    if ( index + 1 > array->count )
-        array->count = index + 1;
-    array->data[index] = ptr;
+    if ( idx + 1 > array->count )
+        array->count = idx + 1;
+    array->data[idx] = ptr;
     return 0;
 }
 
@@ -92,11 +92,11 @@ int flexarray_vappend(flexarray_t *array
     return ret;
 }
 
-int flexarray_get(flexarray_t *array, int index, void **ptr)
+int flexarray_get(flexarray_t *array, int idx, void **ptr)
 {
-    if (index >= array->size)
+    if (idx >= array->size)
         return 1;
-    *ptr = array->data[index];
+    *ptr = array->data[idx];
     return 0;
 }
 
diff -r 0547430886c5 -r 6aacce1d8650 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Fri Sep 14 11:00:40 2012 +0100
+++ b/tools/libxl/libxl.c       Fri Sep 14 16:28:59 2012 +0100
@@ -665,7 +665,7 @@ out:
 libxl_vminfo * libxl_list_vm(libxl_ctx *ctx, int *nb_vm_out)
 {
     libxl_vminfo *ptr;
-    int index, i, ret;
+    int idx, i, ret;
     xc_domaininfo_t info[1024];
     int size = 1024;
 
@@ -678,15 +678,15 @@ libxl_vminfo * libxl_list_vm(libxl_ctx *
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "geting domain info list");
         return NULL;
     }
-    for (index = i = 0; i < ret; i++) {
+    for (idx = i = 0; i < ret; i++) {
         if (libxl_is_stubdom(ctx, info[i].domain, NULL))
             continue;
-        memcpy(&(ptr[index].uuid), info[i].handle, 
sizeof(xen_domain_handle_t));
-        ptr[index].domid = info[i].domain;
-
-        index++;
-    }
-    *nb_vm_out = index;
+        memcpy(&(ptr[idx].uuid), info[i].handle, sizeof(xen_domain_handle_t));
+        ptr[idx].domid = info[i].domain;
+
+        idx++;
+    }
+    *nb_vm_out = idx;
     return ptr;
 }
 
@@ -3354,7 +3354,7 @@ int libxl_set_memory_target(libxl_ctx *c
         int32_t target_memkb, int relative, int enforce)
 {
     GC_INIT(ctx);
-    int rc = 1, abort = 0;
+    int rc = 1, abort_transaction = 0;
     uint32_t memorykb = 0, videoram = 0;
     uint32_t current_target_memkb = 0, new_target_memkb = 0;
     char *memmax, *endptr, *videoram_s = NULL, *target = NULL;
@@ -3373,7 +3373,7 @@ retry_transaction:
         xs_transaction_end(ctx->xsh, t, 1);
         rc = libxl__fill_dom0_memory_info(gc, &current_target_memkb);
         if (rc < 0) {
-            abort = 1;
+            abort_transaction = 1;
             goto out;
         }
         goto retry_transaction;
@@ -3381,7 +3381,7 @@ retry_transaction:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
                 "cannot get target memory info from %s/memory/target\n",
                 dompath);
-        abort = 1;
+        abort_transaction = 1;
         goto out;
     } else {
         current_target_memkb = strtoul(target, &endptr, 10);
@@ -3389,7 +3389,7 @@ retry_transaction:
             LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
                     "invalid memory target %s from %s/memory/target\n",
                     target, dompath);
-            abort = 1;
+            abort_transaction = 1;
             goto out;
         }
     }
@@ -3399,7 +3399,7 @@ retry_transaction:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
                 "cannot get memory info from %s/memory/static-max\n",
                 dompath);
-        abort = 1;
+        abort_transaction = 1;
         goto out;
     }
     memorykb = strtoul(memmax, &endptr, 10);
@@ -3407,7 +3407,7 @@ retry_transaction:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
                 "invalid max memory %s from %s/memory/static-max\n",
                 memmax, dompath);
-        abort = 1;
+        abort_transaction = 1;
         goto out;
     }
 
@@ -3422,7 +3422,7 @@ retry_transaction:
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                 "memory_dynamic_max must be less than or equal to"
                 " memory_static_max\n");
-        abort = 1;
+        abort_transaction = 1;
         goto out;
     }
 
@@ -3430,7 +3430,7 @@ retry_transaction:
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                 "new target %d for dom0 is below the minimum threshold\n",
                  new_target_memkb);
-        abort = 1;
+        abort_transaction = 1;
         goto out;
     }
     videoram_s = libxl__xs_read(gc, t, libxl__sprintf(gc,
@@ -3445,7 +3445,7 @@ retry_transaction:
             LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
                     "xc_domain_setmaxmem domid=%d memkb=%d failed "
                     "rc=%d\n", domid, memorykb + LIBXL_MAXMEM_CONSTANT, rc);
-            abort = 1;
+            abort_transaction = 1;
             goto out;
         }
     }
@@ -3458,7 +3458,7 @@ retry_transaction:
                 "xc_domain_set_pod_target domid=%d, memkb=%d "
                 "failed rc=%d\n", domid, new_target_memkb / 4,
                 rc);
-        abort = 1;
+        abort_transaction = 1;
         goto out;
     }
 
@@ -3466,7 +3466,7 @@ retry_transaction:
                 dompath), "%"PRIu32, new_target_memkb);
     rc = xc_domain_getinfolist(ctx->xch, domid, 1, &info);
     if (rc != 1 || info.domain != domid) {
-        abort = 1;
+        abort_transaction = 1;
         goto out;
     }
     xcinfo2xlinfo(&info, &ptr);
@@ -3475,7 +3475,8 @@ retry_transaction:
             "%"PRIu32, new_target_memkb / 1024);
 
 out:
-    if (!xs_transaction_end(ctx->xsh, t, abort) && !abort)
+    if (!xs_transaction_end(ctx->xsh, t, abort_transaction)
+        && !abort_transaction)
         if (errno == EAGAIN)
             goto retry_transaction;
 
diff -r 0547430886c5 -r 6aacce1d8650 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Fri Sep 14 11:00:40 2012 +0100
+++ b/tools/libxl/libxl_dm.c    Fri Sep 14 16:28:59 2012 +0100
@@ -379,7 +379,7 @@ static char ** libxl__build_device_model
     }
     if (vnc) {
         int display = 0;
-        const char *listen = "127.0.0.1";
+        const char *addr = "127.0.0.1";
         char *vncarg = NULL;
 
         flexarray_append(dm_args, "-vnc");
@@ -387,16 +387,16 @@ static char ** libxl__build_device_model
         if (vnc->display) {
             display = vnc->display;
             if (vnc->listen && strchr(vnc->listen, ':') == NULL) {
-                listen = vnc->listen;
+                addr = vnc->listen;
             }
         } else if (vnc->listen) {
-            listen = vnc->listen;
+            addr = vnc->listen;
         }
 
-        if (strchr(listen, ':') != NULL)
-            vncarg = libxl__sprintf(gc, "%s", listen);
+        if (strchr(addr, ':') != NULL)
+            vncarg = libxl__sprintf(gc, "%s", addr);
         else
-            vncarg = libxl__sprintf(gc, "%s:%d", listen, display);
+            vncarg = libxl__sprintf(gc, "%s:%d", addr, display);
         if (vnc->passwd && vnc->passwd[0]) {
             vncarg = libxl__sprintf(gc, "%s,password", vncarg);
         }
diff -r 0547430886c5 -r 6aacce1d8650 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c Fri Sep 14 11:00:40 2012 +0100
+++ b/tools/libxl/libxl_event.c Fri Sep 14 16:28:59 2012 +0100
@@ -167,15 +167,15 @@ static void time_insert_finite(libxl__gc
 }
 
 static int time_register_finite(libxl__gc *gc, libxl__ev_time *ev,
-                                struct timeval abs)
+                                struct timeval absolute)
 {
     int rc;
 
-    rc = OSEVENT_HOOK(timeout_register, &ev->for_app_reg, abs, ev);
+    rc = OSEVENT_HOOK(timeout_register, &ev->for_app_reg, absolute, ev);
     if (rc) return rc;
 
     ev->infinite = 0;
-    ev->abs = abs;
+    ev->abs = absolute;
     time_insert_finite(gc, ev);
 
     return 0;
@@ -202,16 +202,16 @@ static void time_done_debug(libxl__gc *g
 
 int libxl__ev_time_register_abs(libxl__gc *gc, libxl__ev_time *ev,
                                 libxl__ev_time_callback *func,
-                                struct timeval abs)
+                                struct timeval absolute)
 {
     int rc;
 
     CTX_LOCK;
 
     DBG("ev_time=%p register abs=%lu.%06lu",
-        ev, (unsigned long)abs.tv_sec, (unsigned long)abs.tv_usec);
+        ev, (unsigned long)absolute.tv_sec, (unsigned long)absolute.tv_usec);
 
-    rc = time_register_finite(gc, ev, abs);
+    rc = time_register_finite(gc, ev, absolute);
     if (rc) goto out;
 
     ev->func = func;
@@ -228,7 +228,7 @@ int libxl__ev_time_register_rel(libxl__g
                                 libxl__ev_time_callback *func,
                                 int milliseconds /* as for poll(2) */)
 {
-    struct timeval abs;
+    struct timeval absolute;
     int rc;
 
     CTX_LOCK;
@@ -238,10 +238,10 @@ int libxl__ev_time_register_rel(libxl__g
     if (milliseconds < 0) {
         ev->infinite = 1;
     } else {
-        rc = time_rel_to_abs(gc, milliseconds, &abs);
+        rc = time_rel_to_abs(gc, milliseconds, &absolute);
         if (rc) goto out;
 
-        rc = time_register_finite(gc, ev, abs);
+        rc = time_register_finite(gc, ev, absolute);
         if (rc) goto out;
     }
 
@@ -255,26 +255,26 @@ int libxl__ev_time_register_rel(libxl__g
 }
 
 int libxl__ev_time_modify_abs(libxl__gc *gc, libxl__ev_time *ev,
-                              struct timeval abs)
+                              struct timeval absolute)
 {
     int rc;
 
     CTX_LOCK;
 
     DBG("ev_time=%p modify abs==%lu.%06lu",
-        ev, (unsigned long)abs.tv_sec, (unsigned long)abs.tv_usec);
+        ev, (unsigned long)absolute.tv_sec, (unsigned long)absolute.tv_usec);
 
     assert(libxl__ev_time_isregistered(ev));
 
     if (ev->infinite) {
-        rc = time_register_finite(gc, ev, abs);
+        rc = time_register_finite(gc, ev, absolute);
         if (rc) goto out;
     } else {
-        rc = OSEVENT_HOOK(timeout_modify, &ev->for_app_reg, abs);
+        rc = OSEVENT_HOOK(timeout_modify, &ev->for_app_reg, absolute);
         if (rc) goto out;
 
         LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry);
-        ev->abs = abs;
+        ev->abs = absolute;
         time_insert_finite(gc, ev);
     }
 
@@ -288,7 +288,7 @@ int libxl__ev_time_modify_abs(libxl__gc 
 int libxl__ev_time_modify_rel(libxl__gc *gc, libxl__ev_time *ev,
                               int milliseconds)
 {
-    struct timeval abs;
+    struct timeval absolute;
     int rc;
 
     CTX_LOCK;
@@ -304,10 +304,10 @@ int libxl__ev_time_modify_rel(libxl__gc 
         goto out;
     }
 
-    rc = time_rel_to_abs(gc, milliseconds, &abs);
+    rc = time_rel_to_abs(gc, milliseconds, &absolute);
     if (rc) goto out;
 
-    rc = libxl__ev_time_modify_abs(gc, ev, abs);
+    rc = libxl__ev_time_modify_abs(gc, ev, absolute);
     if (rc) goto out;
 
     rc = 0;
diff -r 0547430886c5 -r 6aacce1d8650 tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c  Fri Sep 14 11:00:40 2012 +0100
+++ b/tools/libxl/libxl_exec.c  Fri Sep 14 16:28:59 2012 +0100
@@ -35,7 +35,7 @@ static void check_open_fds(const char *w
 #ifdef __linux__
         size_t len;
         char path[PATH_MAX];
-        char link[PATH_MAX+1];
+        char linkpath[PATH_MAX+1];
 #endif
         flags = fcntl(i, F_GETFD);
         if ( flags == -1 ) {
@@ -52,11 +52,11 @@ static void check_open_fds(const char *w
 
 #ifdef __linux__
         snprintf(path, PATH_MAX, "/proc/%d/fd/%d", getpid(), i);
-        len = readlink(path, link, PATH_MAX);
+        len = readlink(path, linkpath, PATH_MAX);
         if (len > 0) {
-            link[len] = '\0';
+            linkpath[len] = '\0';
             fprintf(stderr, "libxl: execing %s: fd %d is open to %s with flags 
%#x\n",
-                    what, i, link, flags);
+                    what, i, linkpath, flags);
         } else
 #endif
             fprintf(stderr, "libxl: execing %s: fd %d is open with flags 
%#x\n",
diff -r 0547430886c5 -r 6aacce1d8650 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c  Fri Sep 14 11:00:40 2012 +0100
+++ b/tools/libxl/libxl_json.c  Fri Sep 14 16:28:59 2012 +0100
@@ -275,7 +275,7 @@ static int json_object_append_to(libxl__
 
 void libxl__json_object_free(libxl__gc *gc, libxl__json_object *obj)
 {
-    int index = 0;
+    int idx = 0;
 
     if (obj == NULL)
         return;
@@ -287,8 +287,8 @@ void libxl__json_object_free(libxl__gc *
     case JSON_MAP: {
         libxl__json_map_node *node = NULL;
 
-        for (index = 0; index < obj->u.map->count; index++) {
-            if (flexarray_get(obj->u.map, index, (void**)&node) != 0)
+        for (idx = 0; idx < obj->u.map->count; idx++) {
+            if (flexarray_get(obj->u.map, idx, (void**)&node) != 0)
                 break;
             libxl__json_object_free(gc, node->obj);
             free(node->map_key);
@@ -302,8 +302,8 @@ void libxl__json_object_free(libxl__gc *
         libxl__json_object *node = NULL;
         break;
 
-        for (index = 0; index < obj->u.array->count; index++) {
-            if (flexarray_get(obj->u.array, index, (void**)&node) != 0)
+        for (idx = 0; idx < obj->u.array->count; idx++) {
+            if (flexarray_get(obj->u.array, idx, (void**)&node) != 0)
                 break;
             libxl__json_object_free(gc, node);
             node = NULL;
@@ -359,14 +359,14 @@ const libxl__json_object *libxl__json_ma
                                           libxl__json_node_type expected_type)
 {
     flexarray_t *maps = NULL;
-    int index = 0;
+    int idx = 0;
 
     if (libxl__json_object_is_map(o)) {
         libxl__json_map_node *node = NULL;
 
         maps = o->u.map;
-        for (index = 0; index < maps->count; index++) {
-            if (flexarray_get(maps, index, (void**)&node) != 0)
+        for (idx = 0; idx < maps->count; idx++) {
+            if (flexarray_get(maps, idx, (void**)&node) != 0)
                 return NULL;
             if (strcmp(key, node->map_key) == 0) {
                 if (expected_type == JSON_ANY
diff -r 0547430886c5 -r 6aacce1d8650 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c   Fri Sep 14 11:00:40 2012 +0100
+++ b/tools/libxl/libxl_pci.c   Fri Sep 14 16:28:59 2012 +0100
@@ -167,7 +167,6 @@ static int libxl__device_pci_remove_xens
     char *be_path, *num_devs_path, *num_devs, *xsdev, *tmp, *tmppath;
     int num, i, j;
     xs_transaction_t t;
-    unsigned int domain = 0, bus = 0, dev = 0, func = 0;
 
     be_path = libxl__sprintf(gc, "%s/backend/pci/%d/0", 
libxl__xs_get_dompath(gc, 0), domid);
     num_devs_path = libxl__sprintf(gc, "%s/num_devs", be_path);
@@ -188,6 +187,7 @@ static int libxl__device_pci_remove_xens
     }
 
     for (i = 0; i < num; i++) {
+        unsigned int domain = 0, bus = 0, dev = 0, func = 0;
         xsdev = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/dev-%d", 
be_path, i));
         sscanf(xsdev, PCI_BDF, &domain, &bus, &dev, &func);
         if (domain == pcidev->domain && bus == pcidev->bus &&
diff -r 0547430886c5 -r 6aacce1d8650 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c   Fri Sep 14 11:00:40 2012 +0100
+++ b/tools/libxl/libxl_qmp.c   Fri Sep 14 16:28:59 2012 +0100
@@ -171,7 +171,7 @@ static int qmp_register_vnc_callback(lib
 {
     GC_INIT(qmp->ctx);
     const libxl__json_object *obj;
-    const char *listen, *port;
+    const char *addr, *port;
     int rc = -1;
 
     if (!libxl__json_object_is_map(o)) {
@@ -184,17 +184,17 @@ static int qmp_register_vnc_callback(lib
     }
 
     obj = libxl__json_map_get("host", o, JSON_STRING);
-    listen = libxl__json_object_get_string(obj);
+    addr = libxl__json_object_get_string(obj);
     obj = libxl__json_map_get("service", o, JSON_STRING);
     port = libxl__json_object_get_string(obj);
 
-    if (!listen || !port) {
+    if (!addr || !port) {
         LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
                    "Failed to retreive VNC connect information.");
         goto out;
     }
 
-    rc = qmp_write_domain_console_item(gc, qmp->domid, "vnc-listen", listen);
+    rc = qmp_write_domain_console_item(gc, qmp->domid, "vnc-listen", addr);
     if (!rc)
         rc = qmp_write_domain_console_item(gc, qmp->domid, "vnc-port", port);
 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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