From: Oliver Kurth Date: Fri, 2 Aug 2019 18:07:21 +0000 (-0700) Subject: Changes to common source files not directly applicable to open-vm-tools. X-Git-Tag: stable-11.1.0~280 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbb691ef3e64507ed1b4fddbc055eac01d3cac16;p=thirdparty%2Fopen-vm-tools.git Changes to common source files not directly applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/include/hgfs.h b/open-vm-tools/lib/include/hgfs.h index df658bb87..ca97444fa 100644 --- a/open-vm-tools/lib/include/hgfs.h +++ b/open-vm-tools/lib/include/hgfs.h @@ -45,12 +45,17 @@ #ifndef _HGFS_H_ -# define _HGFS_H_ +#define _HGFS_H_ #define INCLUDE_ALLOW_USERLEVEL #define INCLUDE_ALLOW_MODULE #define INCLUDE_ALLOW_DISTRIBUTE #include "includeCheck.h" +#ifdef VMX86_TOOLS +# include "rpcvmx.h" +#else +# include "config.h" +#endif #include "vm_assert.h" /* Page size for HGFS packet (4K). */ @@ -65,7 +70,7 @@ * Maximum number of pages to transfer to/from the HGFS server for V3 protocol * operations that support large requests/replies, e.g. reads and writes. */ -#define HGFS_LARGE_IO_MAX_PAGES 15 +#define HGFS_LARGE_IO_MAX_PAGES 127 /* Maximum number of bytes to read or write to a hgfs server in a single packet. */ #define HGFS_IO_MAX HGFS_PAGE_SIZE @@ -87,6 +92,18 @@ */ #define HGFS_LARGE_PACKET_MAX (HGFS_LARGE_IO_MAX + HGFS_HEADER_SIZE_MAX) +/* + * Legacy definitions for HGFS_LARGE_IO_MAX_PAGES, HGFS_LARGE_IO_MAX and + * HGFS_LARGE_PACKET_MAX. They are used both in Windows client and hgFileCopy + * library for performing vmrun CopyFileFromHostToGuest/GuestToHost. + */ +#define HGFS_LEGACY_LARGE_IO_MAX_PAGES 15 +#define HGFS_LEGACY_LARGE_IO_MAX (HGFS_PAGE_SIZE * HGFS_LEGACY_LARGE_IO_MAX_PAGES) +#define HGFS_LEGACY_LARGE_PACKET_MAX (HGFS_LEGACY_LARGE_IO_MAX + HGFS_HEADER_SIZE_MAX) + +static size_t gHgfsLargeIoMax = 0; +static size_t gHgfsLargePacketMax = 0; + /* *----------------------------------------------------------------------------- * @@ -111,9 +128,21 @@ static INLINE size_t HgfsLargeIoMax(Bool useLegacy) // IN { if (useLegacy) { - // TODO: Return the legacy value + return HGFS_LEGACY_LARGE_IO_MAX; } - return HGFS_LARGE_IO_MAX; + if (gHgfsLargeIoMax > 0) { + return gHgfsLargeIoMax; + } +#ifdef VMX86_TOOLS + if (!RpcVMX_ConfigGetBool(FALSE, "hgfs.packetSize.large")) { +#else + if (!Config_GetBool(FALSE, "hgfs.packetSize.large")) { +#endif + gHgfsLargeIoMax = HGFS_LEGACY_LARGE_IO_MAX; + } else { + gHgfsLargeIoMax = HGFS_LARGE_IO_MAX; + } + return gHgfsLargeIoMax; } /* @@ -140,9 +169,21 @@ static INLINE size_t HgfsLargeIoMax(Bool useLegacy) // IN static INLINE size_t HgfsLargePacketMax(Bool useLegacy) // IN { if (useLegacy) { - // TODO: Return the legacy value + return HGFS_LEGACY_LARGE_PACKET_MAX; + } + if (gHgfsLargePacketMax > 0) { + return gHgfsLargePacketMax; + } +#ifdef VMX86_TOOLS + if (!RpcVMX_ConfigGetBool(FALSE, "hgfs.packetSize.large")) { +#else + if (!Config_GetBool(FALSE, "hgfs.packetSize.large")) { +#endif + gHgfsLargePacketMax = HGFS_LEGACY_LARGE_PACKET_MAX; + } else { + gHgfsLargePacketMax = HGFS_LARGE_PACKET_MAX; } - return HGFS_LARGE_PACKET_MAX; + return gHgfsLargePacketMax; } /* diff --git a/open-vm-tools/lib/rpcVmx/rpcvmx.c b/open-vm-tools/lib/rpcVmx/rpcvmx.c index c820c4832..98642a794 100644 --- a/open-vm-tools/lib/rpcVmx/rpcvmx.c +++ b/open-vm-tools/lib/rpcVmx/rpcvmx.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2004-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2004-2018,2019 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -16,16 +16,20 @@ * *********************************************************/ -#include -#include -#include -#include +#if defined(__KERNEL__) || defined(_KERNEL) || defined(KERNEL) +# include "kernelStubs.h" +#else +# include +# include +# include +# include +# include "str.h" +#endif #include "guest_msg_def.h" #include "message.h" #include "rpcout.h" #include "rpcvmx.h" -#include "str.h" typedef struct { @@ -212,7 +216,15 @@ RpcVMX_ConfigGetString(const char *defval, const char *var) * We have to dup the default, because of our contract: values we * return must always be freed by the caller. */ +#if defined(__KERNEL__) || defined(_KERNEL) || defined(KERNEL) +# ifdef __APPLE__ + value = STRDUP(defval, M_TEMP); +# else value = strdup(defval); +# endif +#else + value = strdup(defval); +#endif } } diff --git a/open-vm-tools/modules/shared/vmmemctl/kernelStubs.h b/open-vm-tools/modules/shared/vmmemctl/kernelStubs.h index 188c2576b..4c7b6a2fb 100644 --- a/open-vm-tools/modules/shared/vmmemctl/kernelStubs.h +++ b/open-vm-tools/modules/shared/vmmemctl/kernelStubs.h @@ -158,6 +158,13 @@ char *strdup(const char *source); # endif +# ifdef __APPLE__ /* if (__APPLE__) { */ +# define Str_Strcasecmp(s1, s2) strcasecmp(s1, s2) +# define M_TEMP 80 /* misc temporary data buffers */ +char *STRDUP(const char *, int); +int atoi(const char *); +#endif + /* Shared between Linux and Apple kernel stubs. */ void *malloc(size_t size); void free(void *mem); diff --git a/open-vm-tools/modules/solaris/vmhgfs/kernelStubs.h b/open-vm-tools/modules/solaris/vmhgfs/kernelStubs.h index deb56c666..6baf61b78 100644 --- a/open-vm-tools/modules/solaris/vmhgfs/kernelStubs.h +++ b/open-vm-tools/modules/solaris/vmhgfs/kernelStubs.h @@ -117,6 +117,13 @@ char *strdup(const char *source); # endif +# ifdef __APPLE__ /* if (__APPLE__) { */ +# define Str_Strcasecmp(s1, s2) strcasecmp(s1, s2) +# define M_TEMP 80 /* misc temporary data buffers */ +char *STRDUP(const char *, int); +int atoi(const char *); +#endif + /* Shared between Linux and Apple kernel stubs. */ void *malloc(size_t size); void free(void *mem); diff --git a/open-vm-tools/vmhgfs-fuse/vmhgfs_version.h b/open-vm-tools/vmhgfs-fuse/vmhgfs_version.h index 030b6916a..dc4961bf0 100644 --- a/open-vm-tools/vmhgfs-fuse/vmhgfs_version.h +++ b/open-vm-tools/vmhgfs-fuse/vmhgfs_version.h @@ -25,8 +25,8 @@ #ifndef _VMHGFS_VERSION_H_ #define _VMHGFS_VERSION_H_ -#define VMHGFS_DRIVER_VERSION 1.6.10.0 -#define VMHGFS_DRIVER_VERSION_COMMAS 1,6,10,0 -#define VMHGFS_DRIVER_VERSION_STRING "1.6.10.0" +#define VMHGFS_DRIVER_VERSION 1.6.11.0 +#define VMHGFS_DRIVER_VERSION_COMMAS 1,6,11,0 +#define VMHGFS_DRIVER_VERSION_STRING "1.6.11.0" #endif /* _VMHGFS_VERSION_H_ */