From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: [PATCH v6 04/18] libxl: libxl_uuid_copy now takes a ctx argument Date: Mon, 9 Jun 2014 13:43:15 +0100 Message-ID: <1402317809-26833-5-git-send-email-wei.liu2@citrix.com> References: <1402317809-26833-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1402317809-26833-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Wei Liu , ian.jackson@eu.citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org Make it consistent with existing libxl functions like libxl_bitmap_copy etc. Signed-off-by: Wei Liu --- tools/libxl/libxl.c | 2 +- tools/libxl/libxl.h | 12 +++++++++++- tools/libxl/libxl_create.c | 2 +- tools/libxl/libxl_utils.c | 2 +- tools/libxl/libxl_uuid.c | 8 +++++--- tools/libxl/libxl_uuid.h | 7 ++++++- 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 5f320ca..0ce9153 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -2006,7 +2006,7 @@ int libxl_devid_to_device_vtpm(libxl_ctx *ctx, if(devid == vtpms[i].devid) { vtpm->backend_domid = vtpms[i].backend_domid; vtpm->devid = vtpms[i].devid; - libxl_uuid_copy(&vtpm->uuid, &vtpms[i].uuid); + libxl_uuid_copy(ctx, &vtpm->uuid, &vtpms[i].uuid); rc = 0; break; } diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 20aa875..d14f25f 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -319,13 +319,15 @@ #include +typedef struct libxl__ctx libxl_ctx; + #include #include <_libxl_list.h> /* API compatibility. */ #ifdef LIBXL_API_VERSION #if LIBXL_API_VERSION != 0x040200 && LIBXL_API_VERSION != 0x040300 && \ - LIBXL_API_VERSION != 0x040400 + LIBXL_API_VERSION != 0x040400 && LIBXL_API_VERSION != 0x040500 #error Unknown LIBXL_API_VERSION #endif #endif @@ -513,6 +515,14 @@ #endif /* + * LIBXL_HAVE_UUID_COPY_CTX_PARAM + * + * If this is defined, libxl_uuid_copy has changed to take a libxl_ctx + * structure. + */ +#define LIBXL_HAVE_UUID_COPY_CTX_PARAM 1 + +/* * LIBXL_HAVE_SSID_LABEL * * If this is defined, then libxl IDL contains string of XSM security diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index fe3bdd2..da1517c 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -479,7 +479,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info, *domid = -1; /* Ultimately, handle is an array of 16 uint8_t, same as uuid */ - libxl_uuid_copy((libxl_uuid *)handle, &info->uuid); + libxl_uuid_copy(ctx, (libxl_uuid *)handle, &info->uuid); ret = xc_domain_create(ctx->xch, info->ssidref, handle, flags, domid); if (ret < 0) { diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index 476921e..16b734e 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -536,7 +536,7 @@ int libxl_uuid_to_device_vtpm(libxl_ctx *ctx, uint32_t domid, if(!libxl_uuid_compare(uuid, &vtpms[i].uuid)) { vtpm->backend_domid = vtpms[i].backend_domid; vtpm->devid = vtpms[i].devid; - libxl_uuid_copy(&vtpm->uuid, &vtpms[i].uuid); + libxl_uuid_copy(ctx, &vtpm->uuid, &vtpms[i].uuid); rc = 0; break; } diff --git a/tools/libxl/libxl_uuid.c b/tools/libxl/libxl_uuid.c index ecc29c7..cb8546a 100644 --- a/tools/libxl/libxl_uuid.c +++ b/tools/libxl/libxl_uuid.c @@ -14,7 +14,7 @@ #include "libxl_osdeps.h" /* must come before any other headers */ -#include +#include #include "libxl_internal.h" @@ -35,7 +35,8 @@ int libxl_uuid_from_string(libxl_uuid *uuid, const char *in) return uuid_parse(in, uuid->uuid); } -void libxl_uuid_copy(libxl_uuid *dst, const libxl_uuid *src) +void libxl_uuid_copy(libxl_ctx *ctx_opt, libxl_uuid *dst, + const libxl_uuid *src) { uuid_copy(dst->uuid, src->uuid); } @@ -82,7 +83,8 @@ int libxl_uuid_from_string(libxl_uuid *uuid, const char *in) } #undef LIBXL__UUID_PTRS -void libxl_uuid_copy(libxl_uuid *dst, const libxl_uuid *src) +void libxl_uuid_copy(libxl_ctx *ctx_opt, libxl_uuid *dst, + const libxl_uuid *src) { memcpy(dst->uuid, src->uuid, sizeof(dst->uuid)); } diff --git a/tools/libxl/libxl_uuid.h b/tools/libxl/libxl_uuid.h index 93c65a7..e68bfc1 100644 --- a/tools/libxl/libxl_uuid.h +++ b/tools/libxl/libxl_uuid.h @@ -56,7 +56,12 @@ typedef struct { int libxl_uuid_is_nil(libxl_uuid *uuid); void libxl_uuid_generate(libxl_uuid *uuid); int libxl_uuid_from_string(libxl_uuid *uuid, const char *in); -void libxl_uuid_copy(libxl_uuid *dst, const libxl_uuid *src); +void libxl_uuid_copy(libxl_ctx *ctx_opt, libxl_uuid *dst, + const libxl_uuid *src); +#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x040500 +void libxl_uuid_copy(dst, src) libxl_uuid_copy(NULL, dst, src) +#endif + void libxl_uuid_clear(libxl_uuid *uuid); int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2); uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid); -- 1.7.10.4