From: VMware, Inc <> Date: Mon, 26 Jul 2010 19:22:34 +0000 (-0700) Subject: Changes in shared code that don't affect open-vm-tools functionality. X-Git-Tag: 2010.07.25-280253~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cf34910f4b90df9552319ee9c3a960ebbdf08727;p=thirdparty%2Fopen-vm-tools.git Changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/include/vm_basic_asm.h b/open-vm-tools/lib/include/vm_basic_asm.h index e92eddfe8..6a34163bb 100644 --- a/open-vm-tools/lib/include/vm_basic_asm.h +++ b/open-vm-tools/lib/include/vm_basic_asm.h @@ -598,6 +598,21 @@ uint32set(void *dst, uint32 val, size_t count) #endif +/* + *----------------------------------------------------------------------------- + * + * Bswap16 -- + * + * Swap the 2 bytes of "v" as follows: 32 -> 23. + * + *----------------------------------------------------------------------------- + */ + +static INLINE uint16 +Bswap16(uint16 v) +{ + return ((v >> 8) & 0x00ff) | ((v << 8) & 0xff00); +} /* *----------------------------------------------------------------------------- * diff --git a/open-vm-tools/lib/include/wiper.h b/open-vm-tools/lib/include/wiper.h index eae4d370e..d25004232 100644 --- a/open-vm-tools/lib/include/wiper.h +++ b/open-vm-tools/lib/include/wiper.h @@ -56,6 +56,12 @@ typedef struct WiperPartition { /* Type of the partition */ WiperPartition_Type type; + + /* + * Clients should specifically set this flag to TRUE to enable free space + * reclamation using unmaps. + */ + Bool attemptUnmaps; /* * NULL if type is not PARTITION_UNSUPPORTED, otherwise describes diff --git a/open-vm-tools/lib/wiper/wiperCommon.c b/open-vm-tools/lib/wiper/wiperCommon.c index 90b0ea8ed..cd3c0fb09 100644 --- a/open-vm-tools/lib/wiper/wiperCommon.c +++ b/open-vm-tools/lib/wiper/wiperCommon.c @@ -55,6 +55,7 @@ WiperSinglePartition_Allocate(void) memset(p->mountPoint, 0, sizeof p->mountPoint); p->type = PARTITION_UNSUPPORTED; p->comment = NULL; + p->attemptUnmaps = FALSE; DblLnkLst_Init(&p->link); } diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c index 65894f0aa..b2ae99f38 100644 --- a/open-vm-tools/services/plugins/vix/vixTools.c +++ b/open-vm-tools/services/plugins/vix/vixTools.c @@ -1933,11 +1933,15 @@ VixToolsCreateTempFile(VixCommandRequestHeader *requestMsg, // IN } /* - * Just close() the file, since we're not going to use it. + * Just close() the file, since we're not going to use it. But, when we + * create a temporary directory, VixToolsGetTempFile() sets 'fd' to 0 on + * success. On windows, close() shouldn't be called for invalid fd values. + * So, call close() only if 'fd' is valid. */ - - if (close(fd) < 0) { - Debug("Unable to close a file, errno is %d.\n", errno); + if (fd > 0) { + if (close(fd) < 0) { + Debug("Unable to close a file, errno is %d.\n", errno); + } } *result = filePathName; @@ -4134,6 +4138,14 @@ VixToolsGetTempFile(VixCommandRequestHeader *requestMsg, // IN free(directoryPath); directoryPath = NULL; err = VixToolsGetUserTmpDir(userToken, &directoryPath); + } else { + /* + * Initially, when 'err' variable is defined, it is initialized to + * VIX_E_FAIL. At this point in the code, user has already specified + * the directory path in which the temporary file has to be created. + * This is completely fine. So, just set 'err' to VIX_OK. + */ + err = VIX_OK; } /*