From: VMware, Inc <> Date: Mon, 22 Mar 2010 22:18:50 +0000 (-0700) Subject: Changes in shared code that don't affect open-vm-tools functionality. X-Git-Tag: 2010.03.20-243334~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0f5404f27c3eefe0c298a9eab9cf1e1a45f7cee;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/loglevel_user.h b/open-vm-tools/lib/include/loglevel_user.h index cf11862bd..0b0114d12 100644 --- a/open-vm-tools/lib/include/loglevel_user.h +++ b/open-vm-tools/lib/include/loglevel_user.h @@ -233,6 +233,7 @@ LOGLEVEL_VAR(syncWaitQ), \ LOGLEVEL_VAR(sg), /* lib/sg */ \ LOGLEVEL_VAR(wrapLib), \ + LOGLEVEL_VAR(digestlib) \ LOGLEVEL_EXTENSION_DECLARE(LOGLEVEL_USER); diff --git a/open-vm-tools/lib/include/random.h b/open-vm-tools/lib/include/random.h index c3cf0578b..6c94dfb56 100644 --- a/open-vm-tools/lib/include/random.h +++ b/open-vm-tools/lib/include/random.h @@ -44,4 +44,7 @@ Random_QuickSeed(uint32 seed); // IN uint32 Random_Quick(void *context); +int +FastRand(int seed); + #endif /* __RANDOM_H__ */ diff --git a/open-vm-tools/lib/include/region.h b/open-vm-tools/lib/include/region.h index acbf65782..582b1548b 100644 --- a/open-vm-tools/lib/include/region.h +++ b/open-vm-tools/lib/include/region.h @@ -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) diff --git a/open-vm-tools/lib/misc/random.c b/open-vm-tools/lib/misc/random.c index 850c17810..abe027785 100644 --- a/open-vm-tools/lib/misc/random.c +++ b/open-vm-tools/lib/misc/random.c @@ -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; +} diff --git a/open-vm-tools/lib/region/region.c b/open-vm-tools/lib/region/region.c index 97942d995..f2ad043ea 100644 --- a/open-vm-tools/lib/region/region.c +++ b/open-vm-tools/lib/region/region.c @@ -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 @@ -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 diff --git a/open-vm-tools/modules/linux/pvscsi/scsi_defs.h b/open-vm-tools/modules/linux/pvscsi/scsi_defs.h index bfe409ca2..d672e410d 100644 --- a/open-vm-tools/modules/linux/pvscsi/scsi_defs.h +++ b/open-vm-tools/modules/linux/pvscsi/scsi_defs.h @@ -233,6 +233,8 @@ #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 { diff --git a/open-vm-tools/modules/linux/shared/vmci_kernel_if.h b/open-vm-tools/modules/linux/shared/vmci_kernel_if.h index e39da083f..304648125 100644 --- a/open-vm-tools/modules/linux/shared/vmci_kernel_if.h +++ b/open-vm-tools/modules/linux/shared/vmci_kernel_if.h @@ -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); diff --git a/open-vm-tools/modules/linux/vsock/linux/vmciContext.h b/open-vm-tools/modules/linux/vsock/linux/vmciContext.h index 602bcc755..da0e2140d 100644 --- a/open-vm-tools/modules/linux/vsock/linux/vmciContext.h +++ b/open-vm-tools/modules/linux/vsock/linux/vmciContext.h @@ -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,