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

[libvirt] [PATCH 5/5] vz: cleanup: define vz format of uuids



vz puts uuids into curly braces. Simply introduce new contstant to reflect this
and get rid of magic +2 in code.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy virtuozzo com>
---
 src/vz/vz_sdk.c   | 12 ++++++------
 src/vz/vz_utils.h |  3 +++
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 559f149..02daf62 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -276,7 +276,7 @@ prlsdkConnect(vzDriverPtr driver)
     PRL_HANDLE job = PRL_INVALID_HANDLE;
     PRL_HANDLE result = PRL_INVALID_HANDLE;
     PRL_HANDLE response = PRL_INVALID_HANDLE;
-    char session_uuid[VIR_UUID_STRING_BUFLEN + 2];
+    char session_uuid[VIR_UUID_STRING_BRACED_BUFLEN];
 
     pret = PrlSrv_Create(&driver->server);
     prlsdkCheckRetExit(pret, -1);
@@ -359,7 +359,7 @@ prlsdkUUIDFormat(const unsigned char *uuid, char *uuidstr)
 static PRL_HANDLE
 prlsdkSdkDomainLookupByUUID(vzDriverPtr driver, const unsigned char *uuid)
 {
-    char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+    char uuidstr[VIR_UUID_STRING_BRACED_BUFLEN];
     PRL_HANDLE sdkdom = PRL_INVALID_HANDLE;
 
     prlsdkUUIDFormat(uuid, uuidstr);
@@ -404,7 +404,7 @@ prlsdkGetDomainIds(PRL_HANDLE sdkdom,
                    char **name,
                    unsigned char *uuid)
 {
-    char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+    char uuidstr[VIR_UUID_STRING_BRACED_BUFLEN];
     PRL_RESULT pret;
 
     if (name && !(*name = prlsdkGetStringParamVar(PrlVmCfg_GetName, sdkdom)))
@@ -1893,7 +1893,7 @@ prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
     vzDriverPtr driver = opaque;
     PRL_RESULT pret = PRL_ERR_FAILURE;
     PRL_HANDLE_TYPE handleType;
-    char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+    char uuidstr[VIR_UUID_STRING_BRACED_BUFLEN];
     unsigned char uuid[VIR_UUID_BUFLEN];
     PRL_EVENT_TYPE prlEventType;
 
@@ -3572,7 +3572,7 @@ prlsdkDoApplyConfig(vzDriverPtr driver,
 {
     PRL_RESULT pret;
     size_t i;
-    char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+    char uuidstr[VIR_UUID_STRING_BRACED_BUFLEN];
     char *mask = NULL;
 
     if (prlsdkCheckUnsupportedParams(sdkdom, def) < 0)
@@ -4314,7 +4314,7 @@ int prlsdkMigrate(virDomainObjPtr dom, virURIPtr uri,
     int ret = -1;
     vzDomObjPtr privdom = dom->privateData;
     PRL_HANDLE job = PRL_INVALID_HANDLE;
-    char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+    char uuidstr[VIR_UUID_STRING_BRACED_BUFLEN];
     PRL_UINT32 vzflags = PRLSDK_MIGRATION_FLAGS;
 
     if (flags & VIR_MIGRATE_PAUSED)
diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h
index f8a3bb3..b8418cf 100644
--- a/src/vz/vz_utils.h
+++ b/src/vz/vz_utils.h
@@ -60,6 +60,9 @@ struct _vzCapabilities {
 typedef struct _vzCapabilities vzCapabilities;
 typedef struct _vzCapabilities *vzCapabilitiesPtr;
 
+/* +2 to keep enclosing { and } */
+# define VIR_UUID_STRING_BRACED_BUFLEN (VIR_UUID_STRING_BUFLEN + 2)
+
 struct _vzDriver {
     virObjectLockable parent;
 
-- 
1.8.3.1


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