#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);
+}
/*
*-----------------------------------------------------------------------------
*
/* 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
memset(p->mountPoint, 0, sizeof p->mountPoint);
p->type = PARTITION_UNSUPPORTED;
p->comment = NULL;
+ p->attemptUnmaps = FALSE;
DblLnkLst_Init(&p->link);
}
}
/*
- * 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;
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;
}
/*