]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes to common source files not directly applicable to open-vm-tools.
authorOliver Kurth <okurth@vmware.com>
Fri, 2 Aug 2019 18:07:21 +0000 (11:07 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 2 Aug 2019 18:07:21 +0000 (11:07 -0700)
open-vm-tools/lib/include/hgfs.h
open-vm-tools/lib/rpcVmx/rpcvmx.c
open-vm-tools/modules/shared/vmmemctl/kernelStubs.h
open-vm-tools/modules/solaris/vmhgfs/kernelStubs.h
open-vm-tools/vmhgfs-fuse/vmhgfs_version.h

index df658bb87df99c607228b705ea7333aadebf2bab..ca97444fac75b06a83ae9fbacefcb79dd8c7aed6 100644 (file)
 
 
 #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
  */
 #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;
+
 /*
  *-----------------------------------------------------------------------------
  *
 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;
 }
 
 /*
index c820c48328b6a03a4a3a103bba38ae5ca979c179..98642a7941d8f2a1f2f1e1ae202f9ea397014f80 100644 (file)
@@ -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
  *
  *********************************************************/
 
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
+#if defined(__KERNEL__) || defined(_KERNEL) || defined(KERNEL)
+#   include "kernelStubs.h"
+#else
+#   include <stdio.h>
+#   include <stdarg.h>
+#   include <string.h>
+#   include <stdlib.h>
+#   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
       }
    }
 
index 188c2576b5b5c315a04b77ea14e568cefda39735..4c7b6a2fb9064d7eb7d7dd015df414e24e66a1eb 100644 (file)
 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);
index deb56c6667fffb4d9f3b617f5c6a8cadb725ca39..6baf61b7872eff379f4aa724eedded10554f2d35 100644 (file)
 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);
index 030b6916a0a09fb2a1cdca49af6ef3e8e341a826..dc4961bf069afd33526d374def3746063c5d9d6d 100644 (file)
@@ -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_ */