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>
This commit is contained in:
Nikolay Shirokovskiy 2016-05-18 11:11:08 +03:00 committed by Maxim Nestratov
parent 0ec30a24b8
commit 2d3940907d
2 changed files with 9 additions and 6 deletions

View File

@ -276,7 +276,7 @@ prlsdkConnect(vzDriverPtr driver)
PRL_HANDLE job = PRL_INVALID_HANDLE; PRL_HANDLE job = PRL_INVALID_HANDLE;
PRL_HANDLE result = PRL_INVALID_HANDLE; PRL_HANDLE result = PRL_INVALID_HANDLE;
PRL_HANDLE response = 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); pret = PrlSrv_Create(&driver->server);
prlsdkCheckRetExit(pret, -1); prlsdkCheckRetExit(pret, -1);
@ -359,7 +359,7 @@ prlsdkUUIDFormat(const unsigned char *uuid, char *uuidstr)
static PRL_HANDLE static PRL_HANDLE
prlsdkSdkDomainLookupByUUID(vzDriverPtr driver, const unsigned char *uuid) 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; PRL_HANDLE sdkdom = PRL_INVALID_HANDLE;
prlsdkUUIDFormat(uuid, uuidstr); prlsdkUUIDFormat(uuid, uuidstr);
@ -404,7 +404,7 @@ prlsdkGetDomainIds(PRL_HANDLE sdkdom,
char **name, char **name,
unsigned char *uuid) unsigned char *uuid)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN + 2]; char uuidstr[VIR_UUID_STRING_BRACED_BUFLEN];
PRL_RESULT pret; PRL_RESULT pret;
if (name && !(*name = prlsdkGetStringParamVar(PrlVmCfg_GetName, sdkdom))) if (name && !(*name = prlsdkGetStringParamVar(PrlVmCfg_GetName, sdkdom)))
@ -1893,7 +1893,7 @@ prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
vzDriverPtr driver = opaque; vzDriverPtr driver = opaque;
PRL_RESULT pret = PRL_ERR_FAILURE; PRL_RESULT pret = PRL_ERR_FAILURE;
PRL_HANDLE_TYPE handleType; PRL_HANDLE_TYPE handleType;
char uuidstr[VIR_UUID_STRING_BUFLEN + 2]; char uuidstr[VIR_UUID_STRING_BRACED_BUFLEN];
unsigned char uuid[VIR_UUID_BUFLEN]; unsigned char uuid[VIR_UUID_BUFLEN];
PRL_EVENT_TYPE prlEventType; PRL_EVENT_TYPE prlEventType;
@ -3572,7 +3572,7 @@ prlsdkDoApplyConfig(vzDriverPtr driver,
{ {
PRL_RESULT pret; PRL_RESULT pret;
size_t i; size_t i;
char uuidstr[VIR_UUID_STRING_BUFLEN + 2]; char uuidstr[VIR_UUID_STRING_BRACED_BUFLEN];
char *mask = NULL; char *mask = NULL;
if (prlsdkCheckUnsupportedParams(sdkdom, def) < 0) if (prlsdkCheckUnsupportedParams(sdkdom, def) < 0)
@ -4479,7 +4479,7 @@ int prlsdkMigrate(virDomainObjPtr dom, virURIPtr uri,
int ret = -1; int ret = -1;
vzDomObjPtr privdom = dom->privateData; vzDomObjPtr privdom = dom->privateData;
PRL_HANDLE job = PRL_INVALID_HANDLE; 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; PRL_UINT32 vzflags = PRLSDK_MIGRATION_FLAGS;
if (flags & VIR_MIGRATE_PAUSED) if (flags & VIR_MIGRATE_PAUSED)

View File

@ -61,6 +61,9 @@ struct _vzCapabilities {
typedef struct _vzCapabilities vzCapabilities; typedef struct _vzCapabilities vzCapabilities;
typedef struct _vzCapabilities *vzCapabilitiesPtr; typedef struct _vzCapabilities *vzCapabilitiesPtr;
/* +2 to keep enclosing { and } */
# define VIR_UUID_STRING_BRACED_BUFLEN (VIR_UUID_STRING_BUFLEN + 2)
struct _vzDriver { struct _vzDriver {
virObjectLockable parent; virObjectLockable parent;