]> 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, 22 Mar 2010 22:18:50 +0000 (15:18 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Mon, 22 Mar 2010 22:18:50 +0000 (15:18 -0700)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/include/loglevel_user.h
open-vm-tools/lib/include/random.h
open-vm-tools/lib/include/region.h
open-vm-tools/lib/misc/random.c
open-vm-tools/lib/region/region.c
open-vm-tools/modules/linux/pvscsi/scsi_defs.h
open-vm-tools/modules/linux/shared/vmci_kernel_if.h
open-vm-tools/modules/linux/vsock/linux/vmciContext.h

index cf11862bd452dc19605057a554ca3f84a2830e46..0b0114d12ec5072187b2051d5ee7774748c01468 100644 (file)
    LOGLEVEL_VAR(syncWaitQ), \
    LOGLEVEL_VAR(sg), /* lib/sg */ \
    LOGLEVEL_VAR(wrapLib),  \
+   LOGLEVEL_VAR(digestlib) \
 
 LOGLEVEL_EXTENSION_DECLARE(LOGLEVEL_USER);
 
index c3cf0578bde08adcddf828c7353e1228539bd8ee..6c94dfb565747a167f509818db68aefcc58cc708 100644 (file)
@@ -44,4 +44,7 @@ Random_QuickSeed(uint32 seed); // IN
 uint32
 Random_Quick(void *context);
 
+int
+FastRand(int seed);
+
 #endif /* __RANDOM_H__ */
index acbf65782410bc3e14c5a3db3eb0ea8efe965180..582b1548b6117c3c9b304a7d9e9e261cd885aa81 100644 (file)
@@ -68,11 +68,13 @@ SOFTWARE.
  *                               and MAXSHORT with winnt.h
  *      04/03/2007 shelleygong  - use int instead of short for data
  *                                inside the region
- * 02/12/2010 michael - Since coordinates are kept as ints, coordinate values
- *    shouldn't be clamped to the range of short. I removed R_{MIN,MAX}SHORT
- *    and changed clamping to be in the range R_MININT..R_MAXINT instead.
- *    Since some code does "n < R_MININT" and "n > R_MAXINT", R_MININT must be
- *    greater than INT_MIN and R_MAXINT must be less than INT_MAX.
+ *      02/12/2010 michael - Since coordinates are kept as ints, coordinate values
+ *      shouldn't be clamped to the range of short. I removed R_{MIN,MAX}SHORT
+ *      and changed clamping to be in the range R_MININT..R_MAXINT instead.
+ *      Since some code does "n < R_MININT" and "n > R_MAXINT", R_MININT must be
+ *      greater than INT_MIN and R_MAXINT must be less than INT_MAX.
+ *      03/08/2010 amarp        - Move xalloc macro outside the header because of
+ *                                boost conflict with macro
  */
 
 #ifndef __REGION_H__
@@ -101,7 +103,6 @@ SOFTWARE.
 
 #define CT_YXBANDED 18
 
-#define xalloc(n)        malloc(n)
 #define xrealloc(ptr, n) realloc((ptr), (n))
 #define xfree(ptr)       free(ptr)
 
index 850c17810b5502e590eaeb9c15befe41441c348c..abe02778553bdef945431590ef9c3f2979e28d42 100644 (file)
@@ -284,3 +284,36 @@ Random_Quick(void *context)  // IN/OUT:
    return y;
 }
 
+
+/**
+ *----------------------------------------------------------------------
+ *
+ * FastRand --
+ *
+ *      Lifted from Util_FastRand() in
+ *      /vmkernel-main/bora/vmcore/vmm/main/util_monitor.c The header
+ *      comment of Util_FastRand(): Generates the next random number in the
+ *      pseudo-random sequence defined by the multiplicative linear
+ *      congruential generator S' = 16807 * S mod (2^31 - 1).  This is the
+ *      ACM "minimal standard random number generator".  Based on method
+ *      described by D.G. Carta in CACM, January 1990.  Usage: provide
+ *      previous random number as the seed for next one.
+ *
+ * Results:
+ *      A random integrer number is returned.
+ *
+ * Side Effects:
+ *      None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+FastRand(int seed)
+{
+   uint64 product    = 33614 * (uint64)seed;
+   uint32 product_lo = (uint32)(product & 0xffffffff) >> 1;
+   uint32 product_hi = product >> 32;
+   int32  test       = product_lo + product_hi;
+   return test > 0 ? test : (test & 0x7fffffff) + 1;
+}
index 97942d99569dcca9aef038ee113d7b6f0a4180bc..f2ad043ea2e028b92f83dddbe2484641a8acb86a 100644 (file)
@@ -106,11 +106,14 @@ Equipment Corporation.
  *                               and MAXSHORT with winnt.h
  *      04/03/2007 shelleygong  - use int instead of short for data
  *                                inside the region *
- * 02/12/2010 michael - Since coordinates are kept as ints, coordinate values
- *    shouldn't be clamped to the range of short. I removed R_{MIN,MAX}SHORT
- *    and changed clamping to be in the range R_MININT..R_MAXINT instead.
- *    Since some code does "n < R_MININT" and "n > R_MAXINT", R_MININT must be
- *    greater than INT_MIN and R_MAXINT must be less than INT_MAX.
+ *      02/12/2010 michael - Since coordinates are kept as ints, coordinate
+ *      values shouldn't be clamped to the range of short. I removed R_{MIN,MAX}SHORT
+ *      and changed clamping to be in the range R_MININT..R_MAXINT instead.
+ *      Since some code does "n < R_MININT" and "n > R_MAXINT", R_MININT must be
+ *      greater than INT_MIN and R_MAXINT must be less than INT_MAX.
+ *
+ *      03/08/2010 amarp        - xalloc conflicts with boost macros. Move it
+ *                                out of the header into the implementation
  */
 
 #include <stdlib.h>
@@ -123,6 +126,7 @@ void miSetExtents(RegionPtr pReg);
 int miFindMaxBand(RegionPtr prgn);
 
 #define good(reg) ASSERT(miValidRegion(reg))
+#define xalloc(n) malloc(n)
 
 /*
  * The functions in this file implement the Region abstraction used extensively
index bfe409ca2bcab25faa8ce25065842ea59e1650ac..d672e410dbcd7ce393947145e581624adea8494a 100644 (file)
 #define SCSI_ASC_LU_NOT_READY_ASCQ_MANUAL_INTERVENTION_REQUIRED   0x03
 #define SCSI_ASC_LU_NOT_READY_ASCQ_TARGET_PORT_IN_TRANSITION      0x0a  // an ascq
 #define SCSI_ASC_LU_NOT_READY_ASCQ_TARGET_PORT_IN_STANDBY_MODE    0x0b  // an ascq
+#define SCSI_ASC_COPY_FAILED                                   0x0d
+#define SCSI_ASC_COPY_FAILED_ASCQ_UNREACHABLE                  0x02
 #define SCSI_ASC_LU_NOT_READY_ASCQ_SPACE_ALLOCATION_IN_PROGRESS   0x14  // an ascq
 #define SCSI_ASC_LU_NO_RESPONSE_TO_SELECTION                   0x05  // logical unit doesn't respond to selection
 #define SCSI_ASC_NO_REFERENCE_POSITION_FOUND                   0x06
@@ -474,6 +476,7 @@ typedef struct {
 #define SCSI_INQ_PAGE_0x00 0x00
 #define SCSI_INQ_PAGE_0x80 0x80
 #define SCSI_INQ_PAGE_0x83 0x83
+#define SCSI_INQ_PAGE_0xB1 0xb1
 
 /*
  * The following structures define the Page format supported by the
@@ -598,6 +601,36 @@ struct SCSI2InqPage83ResponseDescriptor {
 #include "vmware_pack_end.h"
 SCSI2InqPage83ResponseDescriptor;
 
+#define SCSI_INQ_PAGE_B1_LEN                   64
+
+// Inquiry page 0xB1: Medium Rotation Rate
+#define SCSI_ROTATION_RATE_NOT_REPORTED        0x0
+#define SCSI_ROTATION_RATE_NON_ROTATING_MEDIUM 0x1
+
+// Inquiry page 0xB1: Form Factor
+#define SCSI_FORM_FACTOR_NOT_REPORTED          0x0
+
+/*
+ * Format of INQUIRY EVPD Page B1 response
+ * SBC3-r18, Section 6.5.3 table 138 Page 178
+ */
+typedef
+#include "vmware_pack_begin.h"
+struct SCSIInqPageB1ResponseHeader {
+   uint8  devClass     :5,
+         pQual         :3;
+   uint8  pageCode;
+   uint8  reserved1;
+   uint8  pageLength;
+   uint16 mediumRotationRate;
+   uint8  reserved2;
+   uint8  formFactor:4,
+          reserved3:4;
+   uint8  reserved4[56];
+}
+#include "vmware_pack_end.h"
+SCSIInqPageB1ResponseHeader;
+
 typedef
 #include "vmware_pack_begin.h"
 struct SCSIInquiryVPDResponseHeader {
index e39da083ffced472c16c2e27d34b29c188a4d02c..3046481257bcef3471dd7ac1a6139f2d69934e36 100644 (file)
@@ -229,7 +229,9 @@ int VMCIHost_ContextToHostVmID(VMCIHost *hostContext, VMCIHostVmID *hostVmID);
 void VMCIHost_SetActiveHnd(VMCIHost *hostContext, uintptr_t eventHnd);
 Bool VMCIHost_RemoveHnd(VMCIHost *hostContext, uintptr_t eventHnd);
 Bool VMCIHost_IsActiveHnd(VMCIHost *hostContext, uintptr_t eventHnd);
+void VMCIHost_SetInactiveHnd(VMCIHost *hostContext, uintptr_t eventHnd);
 uint32 VMCIHost_NumHnds(VMCIHost *hostContext);
+uintptr_t VMCIHost_GetActiveHnd(VMCIHost *hostContext);
 #endif
 
 void *VMCI_AllocKernelMem(size_t size, int flags);
index 602bcc7559267628d5e80dfb383e706340584d0f..da0e2140dc393889dc9167a0f65dda52f52a2851 100644 (file)
@@ -54,9 +54,12 @@ void VMCIContext_SetFSRState(VMCIContext *context,
                              uintptr_t eventHnd,
                              Bool isLocked);
 VMCIContext *VMCIContext_FindAndUpdateSrcFSR(VMCIId migrateCid,
-                                             uintptr_t eventHnd);
+                                             uintptr_t eventHnd,
+                                             uintptr_t *srcEventHnd);
 Bool VMCIContext_IsActiveHnd(VMCIContext *context,
                              uintptr_t eventHnd);
+void VMCIContext_SetInactiveHnd(VMCIContext *context,
+                                uintptr_t eventHnd);
 Bool VMCIContext_RemoveHnd(VMCIContext *context,
                            uintptr_t eventHnd,
                            uint32 *numOld,