]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes in shared code that don't affect open-vm-tools functionality.
authorVMware, Inc <>
Mon, 26 Jul 2010 19:22:34 +0000 (12:22 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Mon, 26 Jul 2010 19:22:34 +0000 (12:22 -0700)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/include/vm_basic_asm.h
open-vm-tools/lib/include/wiper.h
open-vm-tools/lib/wiper/wiperCommon.c
open-vm-tools/services/plugins/vix/vixTools.c

index e92eddfe843dd07346e0f571e591247004b0014e..6a34163bb432a937749c6bb62b3ef803beae0d49 100644 (file)
@@ -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);
+}
 /*
  *-----------------------------------------------------------------------------
  *
index eae4d370eebcda1ccefc4fa698eafcd535ca6e82..d25004232bd20501ef1a3a249a1b385ef4e3603d 100644 (file)
@@ -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
index 90b0ea8ed70c16372d9666aa2c598f41af16cb15..cd3c0fb0949aad02e7a948ca2d1d665e4181bfac 100644 (file)
@@ -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);
    }
 
index 65894f0aaddc63630731860bb16f64403106af3b..b2ae99f384b90b89947d4dc3d74b0f76b967b418 100644 (file)
@@ -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;
       }
 
       /*