From: VMware, Inc <> Date: Thu, 24 Feb 2011 21:34:31 +0000 (-0800) Subject: Changes in shared code that don't affect open-vm-tools functionality. X-Git-Tag: 2011.02.23-368700~66 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=628850dded6baca82c57f459489ba3bed36ca964;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/file/file.c b/open-vm-tools/lib/file/file.c index 8590132e3..1a83f8b8c 100644 --- a/open-vm-tools/lib/file/file.c +++ b/open-vm-tools/lib/file/file.c @@ -1658,6 +1658,178 @@ File_CopyFromNameToName(ConstUnicode srcName, // IN: return success; } + +/* + *----------------------------------------------------------------------------- + * + * FileCopyTree -- + * + * Recursively copies all files from a source path to a destination, + * optionally overwriting any files. This does the actual work + * for File_CopyTree. + * + * Results: + * TRUE on success + * FALSE on failure: Error messages are appended. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +static Bool +FileCopyTree(ConstUnicode srcName, // IN: + ConstUnicode dstName, // IN: + Bool overwriteExisting, // IN: + Bool followSymlinks) // IN: +{ + int err; + Bool success = TRUE; + int numFiles; + int i; + Unicode *fileList = NULL; + + numFiles = File_ListDirectory(srcName, &fileList); + + if (numFiles == -1) { + err = Err_Errno(); + Msg_Append(MSGID(File.CopyTree.walk.failure) + "Unable to access '%s' when copying files.\n\n", + UTF8(srcName)); + Err_SetErrno(err); + + return FALSE; + } + + File_EnsureDirectory(dstName); + + for (i = 0; i < numFiles && success; i++) { + struct stat sb; + Unicode name; + Unicode srcFilename; + + name = Unicode_Alloc(fileList[i], STRING_ENCODING_DEFAULT); + srcFilename = File_PathJoin(srcName, name); + + if (followSymlinks) { + success = (Posix_Stat(srcFilename, &sb) == 0); + } else { + success = (Posix_Lstat(srcFilename, &sb) == 0); + } + + if (success) { + Unicode dstFilename = File_PathJoin(dstName, name); + + switch (sb.st_mode & S_IFMT) { + case S_IFDIR: + success = FileCopyTree(srcFilename, dstFilename, overwriteExisting, + followSymlinks); + break; + +#if !defined(_WIN32) + case S_IFLNK: + if (Posix_Symlink(Posix_ReadLink(srcFilename), dstFilename) != 0) { + err = Err_Errno(); + Msg_Append(MSGID(File.CopyTree.symlink.failure) + "Unable to symlink '%s' to '%s': %s\n\n", + UTF8(Posix_ReadLink(srcFilename)), + UTF8(dstFilename), + Err_Errno2String(err)); + Err_SetErrno(err); + success = FALSE; + } + break; +#endif + + default: + if (!File_Copy(srcFilename, dstFilename, overwriteExisting)) { + err = Err_Errno(); + Msg_Append(MSGID(File.CopyTree.copy.failure) + "Unable to copy '%s' to '%s': %s\n\n", + UTF8(srcFilename), UTF8(dstFilename), + Err_Errno2String(err)); + Err_SetErrno(err); + success = FALSE; + } + + break; + } + + Unicode_Free(dstFilename); + } else { + err = Err_Errno(); + Msg_Append(MSGID(File.CopyTree.stat.failure) + "Unable to get information on '%s' when copying files.\n\n", + UTF8(srcFilename)); + Err_SetErrno(err); + } + + Unicode_Free(srcFilename); + Unicode_Free(name); + } + + for (i = 0; i < numFiles; i++) { + Unicode_Free(fileList[i]); + } + + free(fileList); + + return success; +} + + +/* + *----------------------------------------------------------------------------- + * + * File_CopyTree -- + * + * Recursively copies all files from a source path to a destination, + * optionally overwriting any files. + * + * Results: + * TRUE on success + * FALSE on failure: Error messages are appended. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +Bool +File_CopyTree(ConstUnicode srcName, // IN: + ConstUnicode dstName, // IN: + Bool overwriteExisting, // IN: + Bool followSymlinks) // IN: +{ + int err; + + ASSERT(srcName); + ASSERT(dstName); + + if (!File_IsDirectory(srcName)) { + err = Err_Errno(); + Msg_Append(MSGID(File.CopyTree.source.notDirectory) + "The source path '%s' is not a directory.\n\n", + UTF8(srcName)); + Err_SetErrno(err); + return FALSE; + } + + if (!File_IsDirectory(dstName)) { + err = Err_Errno(); + Msg_Append(MSGID(File.CopyTree.dest.notDirectory) + "The destination path '%s' is not a directory.\n\n", + UTF8(dstName)); + Err_SetErrno(err); + return FALSE; + } + + return FileCopyTree(srcName, dstName, overwriteExisting, followSymlinks); +} + + /* *---------------------------------------------------------------------- * diff --git a/open-vm-tools/lib/include/file.h b/open-vm-tools/lib/include/file.h index 0b90e5756..ea08dd8a2 100644 --- a/open-vm-tools/lib/include/file.h +++ b/open-vm-tools/lib/include/file.h @@ -48,9 +48,9 @@ extern "C"{ # endif # if defined(__FreeBSD__) # include // PATH_MAX -# else +# else # include // PATH_MAX -# endif +# endif #define FILE_MAXPATH PATH_MAX #endif @@ -137,12 +137,12 @@ int File_UnlinkDelayed(ConstUnicode pathName); int File_UnlinkNoFollow(ConstUnicode pathName); void File_SplitName(ConstUnicode pathName, - Unicode *volume, - Unicode *dir, + Unicode *volume, + Unicode *dir, Unicode *base); -void File_GetPathName(ConstUnicode fullPath, - Unicode *pathName, +void File_GetPathName(ConstUnicode fullPath, + Unicode *pathName, Unicode *base); Unicode File_StripSlashes(ConstUnicode path); @@ -247,34 +247,39 @@ char *File_MapPathPrefix(const char *oldPath, const char **newPrefixes, size_t numPrefixes); -Bool File_CopyFromFdToFd(FileIODescriptor src, +Bool File_CopyFromFdToFd(FileIODescriptor src, FileIODescriptor dst); -FileIOResult File_CreatePrompt(FileIODescriptor *file, - ConstUnicode pathName, - int access, +FileIOResult File_CreatePrompt(FileIODescriptor *file, + ConstUnicode pathName, + int access, int prompt); -Bool File_CopyFromFd(FileIODescriptor src, - ConstUnicode dstName, +Bool File_CopyFromFd(FileIODescriptor src, + ConstUnicode dstName, Bool overwriteExisting); -Bool File_Copy(ConstUnicode srcName, - ConstUnicode dstName, +Bool File_Copy(ConstUnicode srcName, + ConstUnicode dstName, Bool overwriteExisting); -Bool File_CopyFromFdToName(FileIODescriptor src, - ConstUnicode dstName, +Bool File_CopyFromFdToName(FileIODescriptor src, + ConstUnicode dstName, int dstDispose); -Bool File_CopyFromNameToName(ConstUnicode srcName, - ConstUnicode dstName, +Bool File_CopyFromNameToName(ConstUnicode srcName, + ConstUnicode dstName, int dstDispose); -Bool File_Replace(ConstUnicode oldFile, +Bool File_CopyTree(ConstUnicode srcName, + ConstUnicode dstName, + Bool overwriteExisting, + Bool followSymlinks); + +Bool File_Replace(ConstUnicode oldFile, ConstUnicode newFile); -Bool File_Move(ConstUnicode oldFile, +Bool File_Move(ConstUnicode oldFile, ConstUnicode newFile, Bool *asRename); @@ -292,8 +297,8 @@ int64 File_GetSizeAlternate(ConstUnicode pathName); /* file change notification module */ typedef void (*CbFunction)(void *clientData); -typedef void (*NotifyCallback)(ConstUnicode pathName, - int err, +typedef void (*NotifyCallback)(ConstUnicode pathName, + int err, void *data); typedef void (*PollTimeout) (CbFunction f, @@ -303,26 +308,26 @@ typedef void (*PollTimeout) (CbFunction f, typedef void (*PollRemoveTimeout) (CbFunction f, void *clientData); -void File_PollInit(PollTimeout pt, +void File_PollInit(PollTimeout pt, PollRemoveTimeout prt); void File_PollExit(void); void File_PollImpersonateOnCheck(Bool check); -Bool File_PollAddFile(ConstUnicode pathName, - uint32 pollPeriod, - NotifyCallback callback, - void *data, +Bool File_PollAddFile(ConstUnicode pathName, + uint32 pollPeriod, + NotifyCallback callback, + void *data, Bool fPeriodic); Bool File_PollAddDirFile(ConstUnicode pathName, - uint32 pollPeriod, + uint32 pollPeriod, NotifyCallback callback, - void *data, + void *data, Bool fPeriodic); -Bool File_PollRemoveFile(ConstUnicode pathName, +Bool File_PollRemoveFile(ConstUnicode pathName, uint32 pollPeriod, NotifyCallback callback); diff --git a/open-vm-tools/lib/include/imageUtilTypes.h b/open-vm-tools/lib/include/imageUtilTypes.h index 306ad5173..77c87c808 100644 --- a/open-vm-tools/lib/include/imageUtilTypes.h +++ b/open-vm-tools/lib/include/imageUtilTypes.h @@ -49,7 +49,8 @@ typedef struct { * 'depth' is the color depth (in bits per pixel) used for the image. 'bpp' * is the number of bits actually consumed per pixel in memory. (For * example, an image that uses 5 bits for each of R, G, B has depth=15 and - * bpp=16. It's always true that depth <= bpp. + * bpp=16. If an image has an alpha channel, the alpha bits are counted in + * 'bpp' but not in 'depth'.) It's always true that depth <= bpp. * * Also see the comment to Raster_ConvertPixels. */ diff --git a/open-vm-tools/lib/include/vm_product.h b/open-vm-tools/lib/include/vm_product.h index fbacf0cfc..7b484eb0d 100644 --- a/open-vm-tools/lib/include/vm_product.h +++ b/open-vm-tools/lib/include/vm_product.h @@ -174,8 +174,8 @@ /* * VMRC ActiveX CLSIDs and ProgIDs */ -#define PRODUCT_VMRC_PLUGIN_GUID_EMBEDDED 0567856D-8D8E-43ad-9241-7772F392B3A3 -#define PRODUCT_VMRC_PLUGIN_GUID_TYPELIB AFAD9CB7-273F-4f59-8C78-D8AF13845222 +#define PRODUCT_VMRC_PLUGIN_GUID_EMBEDDED 291BA977-564B-4626-B868-A968FB8D4591 +#define PRODUCT_VMRC_PLUGIN_GUID_TYPELIB 70ABCAB7-6B45-4555-ABFC-8BC686E5ACFE #define PRODUCT_VMRC_PLUGIN_PROGID_EMBEDDED_BASE "VMware.VMwareRemoteConsole" #define PRODUCT_VMRC_PLUGIN_PROGID_EMBEDDED PRODUCT_VMRC_PLUGIN_PROGID_EMBEDDED_BASE "." \ XSTR(VMRC_PLUGIN_VERSION_BASE) @@ -192,18 +192,7 @@ #endif #define PRODUCT_VMRC_PLUGIN_CURRENT_MIMETYPE \ - "application/x-vmware-vmrc;version=" VMRC_PLUGIN_VERSION - -/* - * previously shipped plugin mimetypes (updated as we ship them) - * - * XXX It is important that the mimetypes be listed in strictly decreasing - * order by version. Server 2.0 Web Access (WBC) only checks the first VMRC - * mimetype for compatibility, and others might make the same mistake in - * the future. - */ -#define PRODUCT_VMRC_PLUGIN_PREVIOUS_MIMETYPES \ - "application/x-vmware-vmrc;version=4.0.0.0" + "application/x-vmware-vmrc-2011" /* * legacy plugin mimetypes (currently unused but here for reference) @@ -223,8 +212,7 @@ * NB: See above for constraints on the ordering of this list. */ #define PRODUCT_VMRC_PLUGIN_MIMETYPES \ - PRODUCT_VMRC_PLUGIN_CURRENT_MIMETYPE PRODUCT_VMRC_MIMETYPE_SEPARATOR \ - PRODUCT_VMRC_PLUGIN_PREVIOUS_MIMETYPES PRODUCT_VMRC_MIMETYPE_TERMINATOR + PRODUCT_VMRC_PLUGIN_CURRENT_MIMETYPE PRODUCT_VMRC_MIMETYPE_TERMINATOR /* * VMware USB Arbitration Service version definitions diff --git a/open-vm-tools/lib/include/vm_tools_version.h b/open-vm-tools/lib/include/vm_tools_version.h index 5b6288c95..620db56be 100644 --- a/open-vm-tools/lib/include/vm_tools_version.h +++ b/open-vm-tools/lib/include/vm_tools_version.h @@ -64,7 +64,20 @@ #ifndef RC_INVOKED typedef uint32 ToolsVersion; - +typedef struct { + uint8 major; + uint8 minor; + uint8 base; +} ToolsVersionComponents; + +static INLINE void +TOOLS_VERSION_UINT_TO_COMPONENTS(const ToolsVersion toolsVersion, // IN + ToolsVersionComponents *comps) // IN/OUT +{ + comps->major = (toolsVersion >> 10) & 0x1f; /* Keep lowest 5 bits after shift. */ + comps->minor = (toolsVersion >> 5) & 0x1f; + comps->base = toolsVersion & 0x1f; +} #endif /* @@ -103,16 +116,16 @@ typedef uint32 ToolsVersion; #define TOOLS_VERSION_UINT(MJR, MNR, BASE) (((MJR) << 10) + ((MNR) << 5) + (BASE)) + /* * Allocate 5 bits to each sub-version in the dotted tools version. This * should take care of us for any reasonable usage: 32 x 32 x 32. - * This macro takes the base variant appended with _V suffix and + * This macro takes the base variant appended with _V suffix and * constructs the version number defines for the version. * It then passes the version numbers into the UINT construct macro above. */ #define TOOLS_VERSION_TO_UINT(BASE_VARIANT_VER) \ - TOOLS_VERSION_UINT(BASE_VARIANT_VER##_MJR,BASE_VARIANT_VER##_MNR,BASE_VARIANT_VER##_BASE) - + TOOLS_VERSION_UINT(BASE_VARIANT_VER##_MJR,BASE_VARIANT_VER##_MNR,BASE_VARIANT_VER##_BASE) /* @@ -132,11 +145,11 @@ typedef uint32 ToolsVersion; #define TOOLS_VERSION_WS30 4 #define TOOLS_VERSION_WS31_BETA 5 -/* +/* * Versions:- * For non-RC compiled variant: * Define each version component pass to macro with BASENAME+SUFFIX (_V). - * Where BASENAME describes the version and append + * Where BASENAME describes the version and append * the appropriate suffix:_V * For RC and non-RC define BASENAME_V and append _MJR or _MNR or _BASE. * Set each version number accordingly. diff --git a/open-vm-tools/lib/include/vm_version.h b/open-vm-tools/lib/include/vm_version.h index fbadf8a00..d33028663 100644 --- a/open-vm-tools/lib/include/vm_version.h +++ b/open-vm-tools/lib/include/vm_version.h @@ -278,7 +278,8 @@ #define USB_ARBITRATOR_VERSION_MAJOR 8 #define USB_ARBITRATOR_VERSION_MINOR 2 -#define USB_ARBITRATOR_VERSION_Z 6 +#define USB_ARBITRATOR_VERSION_Z 23 + #define USB_ARBITRATOR_VERSION_BASE USB_ARBITRATOR_VERSION_MAJOR.\ USB_ARBITRATOR_VERSION_MINOR @@ -293,7 +294,7 @@ * USB Arbitrator Component version. This version is used by the linux * installer. See USB_ARBITRATOR_COMPONENT_VERSION_NUMBER in mk/defs-onetime.mk */ -#define USB_ARBITRATOR_COMPONENT_VERSION_NUMBER "8.2.6" +#define USB_ARBITRATOR_COMPONENT_VERSION_NUMBER "8.2.23" #ifdef VMX86_VPX #define VIM_API_TYPE "VirtualCenter" @@ -397,7 +398,7 @@ # define PRODUCT_LICENSE_VERSION "1.0" # elif defined(VMX86_DESKTOP) # if defined(__APPLE__) -# define PRODUCT_LICENSE_VERSION "3.0" +# define PRODUCT_LICENSE_VERSION "4.0+" # else # define PRODUCT_LICENSE_VERSION "8.0+" # endif diff --git a/open-vm-tools/services/plugins/dndcp/dndGuest/guestDnDCPMgr.cc b/open-vm-tools/services/plugins/dndcp/dndGuest/guestDnDCPMgr.cc index 65cd1a062..e86aa76a1 100644 --- a/open-vm-tools/services/plugins/dndcp/dndGuest/guestDnDCPMgr.cc +++ b/open-vm-tools/services/plugins/dndcp/dndGuest/guestDnDCPMgr.cc @@ -179,10 +179,10 @@ GuestDnDCPMgr::GetTransport(void) "addr", NULL); } - if (!brokerAddr) { + /* We are executing in the simulator, so hardcode the brokerAddr. */ - brokerAddr = "tcp:host=127.0.0.1,port=5672,family=ipv4"; + brokerAddr = "tcp:host=127.0.0.1,port=8672,family=ipv4"; } mTransport = new DnDCPTransportVMCF(brokerAddr, NULL, false); #else