]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Use two new inline functions to replace most of the uses of
authorOliver Kurth <okurth@vmware.com>
Sun, 21 Jul 2019 00:15:19 +0000 (17:15 -0700)
committerOliver Kurth <okurth@vmware.com>
Sun, 21 Jul 2019 00:15:19 +0000 (17:15 -0700)
HGFS_LARGE_IO_MAX and HGFS_LARGE_PACKET_MAX macros.

In preparation to bump up HGFS_LARGE_IO_MAX and HGFS_LARGE_PACKET_MAX,
replace most uses of the two macro constants with inline functions that
can return either the new limits or the older defaults based on the
configuration.

13 files changed:
open-vm-tools/lib/hgfsBd/hgfsBd.c
open-vm-tools/lib/hgfsServer/hgfsServerParameters.c
open-vm-tools/lib/include/hgfs.h
open-vm-tools/vmhgfs-fuse/bdhandler.c
open-vm-tools/vmhgfs-fuse/dir.c
open-vm-tools/vmhgfs-fuse/file.c
open-vm-tools/vmhgfs-fuse/filesystem.c
open-vm-tools/vmhgfs-fuse/fsutil.c
open-vm-tools/vmhgfs-fuse/link.c
open-vm-tools/vmhgfs-fuse/request.c
open-vm-tools/vmhgfs-fuse/session.c
open-vm-tools/vmhgfs-fuse/transport.c
open-vm-tools/vmhgfs-fuse/vmhgfs_version.h

index c7e039bed0841f84788175f032ef545320def943..0b8617acb84c457a7b36dbc7e9bf93933b052da3 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 1998-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2016,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
@@ -136,7 +136,7 @@ HgfsBd_GetBuf(void)
 char *
 HgfsBd_GetLargeBuf(void)
 {
-   return HgfsBdGetBufInt(HGFS_LARGE_PACKET_MAX);
+   return HgfsBdGetBufInt(HgfsLargePacketMax(FALSE));
 }
 
 
@@ -279,7 +279,7 @@ HgfsBd_Dispatch(RpcOut *out,            // IN: Channel to send on
       return -1;
    }
 
-   ASSERT(replyLen <= HGFS_LARGE_PACKET_MAX);
+   ASSERT(replyLen <= HgfsLargePacketMax(TRUE));
    *packetOut = reply;
    *packetSize = replyLen;
 
@@ -324,7 +324,7 @@ HgfsBd_Enabled(RpcOut *out,         // IN: RPCI Channel
                          HGFS_CLIENT_CMD_LEN,
                          &rpcStatus, &replyPacket, &replyLen);
    if (success && rpcStatus) {
-      ASSERT(replyLen <= HGFS_LARGE_PACKET_MAX);
+      ASSERT(replyLen <= HgfsLargePacketMax(TRUE));
    }
 
    return success && rpcStatus;
index 942b1b82aaa1a7ee2fa33dd9b81377757d281937..e5686b473f3b7e7e38b647b8a513644d96365c25 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2010-2018 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-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
@@ -149,7 +149,7 @@ HgfsValidateReplySize(char const *packetIn,
 
    if (HGFS_OP_NEW_HEADER != request->op) {
       if (HGFS_OP_READ_V3 == op) {
-         result = packetSize <= HGFS_LARGE_PACKET_MAX;
+         result = packetSize <= HgfsLargePacketMax(FALSE);
       } else {
          result = packetSize <= HGFS_PACKET_MAX;
       }
index b32ce1057018e00e7798b8153743fd31c2dd80a4..df658bb87df99c607228b705ea7333aadebf2bab 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 1998-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2016,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 "includeCheck.h"
 #include "vm_assert.h"
 
+/* Page size for HGFS packet (4K). */
+#define HGFS_PAGE_SIZE 4096
+
+/*
+ * Maximum allowed header size in bytes.
+ */
+#define HGFS_HEADER_SIZE_MAX 2048
+
 /*
  * 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
 
+/* Maximum number of bytes to read or write to a hgfs server in a single packet. */
+#define HGFS_IO_MAX HGFS_PAGE_SIZE
+
 /*
  * Maximum allowed packet size in bytes. All hgfs code should be made
  * safe with respect to this limit.
  */
 #define HGFS_PACKET_MAX 6144
 
+/* Maximum number of bytes to read or write to a V3 server in a single hgfs packet. */
+#define HGFS_LARGE_IO_MAX (HGFS_PAGE_SIZE * HGFS_LARGE_IO_MAX_PAGES)
+
 /*
  * The HGFS_LARGE_PACKET_MAX size is used to allow guests to make
  * read / write requests of sizes larger than HGFS_PACKET_MAX. The larger size
  * can only be used with server operations that are specified to be large packet
  * capable in hgfsProto.h.
  */
-#define HGFS_LARGE_PACKET_MAX ((4096 * HGFS_LARGE_IO_MAX_PAGES) + 2048)
+#define HGFS_LARGE_PACKET_MAX (HGFS_LARGE_IO_MAX + HGFS_HEADER_SIZE_MAX)
 
-/* Maximum number of bytes to read or write to a hgfs server in a single packet. */
-#define HGFS_IO_MAX 4096
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * HgfsLargeIoMax --
+ *
+ *    Gets the maximum number of bytes to read or write to a V3 server in a
+ *    single hgfs packet.
+ *    By default, a caller should pass useLegacy=FALSE to get its value with the
+ *    control of feature switch. Passing useLegacy=TRUE means you want to
+ *    directly use the legacy value.
+ *
+ * Results:
+ *    Returns the maximum number of bytes to read or write to a V3 server in a
+ *    single hgfs packet.
+ *
+ * Side effects:
+ *    None.
+ *
+ *-----------------------------------------------------------------------------
+ */
 
-/* Maximum number of bytes to read or write to a V3 server in a single hgfs packet. */
-#define HGFS_LARGE_IO_MAX (HGFS_LARGE_IO_MAX_PAGES * 4096)
+static INLINE size_t HgfsLargeIoMax(Bool useLegacy) // IN
+{
+   if (useLegacy) {
+      // TODO: Return the legacy value
+   }
+   return HGFS_LARGE_IO_MAX;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * HgfsLargePacketMax --
+ *
+ *    Gets the maximum number of bytes to allow guests to make read / write
+ *    requests.
+ *    By default, a caller should pass useLegacy=FALSE to get its value with the
+ *    control of feature switch. Passing useLegacy=TRUE means you want to
+ *    directly use the legacy value.
+ *
+ * Results:
+ *    Returns the maximum number of bytes to allow guests to make read / write
+ *    requests.
+ *
+ * Side effects:
+ *    None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static INLINE size_t HgfsLargePacketMax(Bool useLegacy) // IN
+{
+   if (useLegacy) {
+      // TODO: Return the legacy value
+   }
+   return HGFS_LARGE_PACKET_MAX;
+}
 
 /*
  * File type
index 968e52af86500a69d51f770a1da04d8565f24ac3..12a74ad7600e5ee3c55da1f6e2cf190b9a15d5fc 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2013 VMware, Inc. All rights reserved.
+ * Copyright (C) 2013,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
@@ -166,7 +166,7 @@ HgfsBdChannelSend(HgfsTransportChannel *channel, // IN: Channel
 
    ASSERT(req);
    ASSERT(req->state == HGFS_REQ_STATE_UNSENT);
-   ASSERT(req->payloadSize <= HGFS_LARGE_PACKET_MAX);
+   ASSERT(req->payloadSize <= HgfsLargePacketMax(FALSE));
 
    pthread_mutex_lock(&channel->connLock);
 
index e71b7afd845bd2ce8129be48cb7f840202401404..44fda2e476616bba8f85c45f2125c3cc7bd22449 100644 (file)
@@ -71,7 +71,7 @@ HgfsPackDirOpenRequest(const char *path,    // IN: Path of the dir to open
       reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
-                                HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+                                HgfsLargePacketMax(FALSE) - (reqSize - 1),
                                 requestV3->dirName.name);
       if (result < 0) {
          LOG(4, ("CP conversion failed\n"));
@@ -92,7 +92,7 @@ HgfsPackDirOpenRequest(const char *path,    // IN: Path of the dir to open
       reqSize = sizeof *request;
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
-                                HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+                                HgfsLargePacketMax(FALSE) - (reqSize - 1),
                                 request->dirName.name);
       if (result < 0) {
          LOG(4, ("CP conversion failed\n"));
@@ -638,7 +638,7 @@ HgfsPackCreateDirRequest(const char *path,
       requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
-                                HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+                                HgfsLargePacketMax(FALSE) - (reqSize - 1),
                                 requestV3->fileName.name);
       if (result < 0) {
          LOG(4, ("CP conversion failed.\n"));
@@ -666,7 +666,7 @@ HgfsPackCreateDirRequest(const char *path,
 
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
-                                HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+                                HgfsLargePacketMax(FALSE) - (reqSize - 1),
                                 requestV2->fileName.name);
       if (result < 0) {
          LOG(4, ("CP conversion failed.\n"));
@@ -692,7 +692,7 @@ HgfsPackCreateDirRequest(const char *path,
       reqSize = sizeof *request;
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
-                                HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+                                HgfsLargePacketMax(FALSE) - (reqSize - 1),
                                 request->fileName.name);
       if (result < 0) {
          LOG(4, ("CP conversion failed.\n"));
@@ -867,7 +867,7 @@ HgfsDelete(const char* path,       // IN: Path to file
       request->hints = 0;
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
-                                HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
+                                HGFS_NAME_BUFFER_SIZET(HgfsLargePacketMax(FALSE), reqSize),
                                 request->fileName.name);
       if (result < 0) {
          LOG(4, ("CP conversion failed.\n"));
@@ -889,7 +889,7 @@ HgfsDelete(const char* path,       // IN: Path to file
       reqSize = sizeof *request;
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
-                                HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
+                                HGFS_NAME_BUFFER_SIZET(HgfsLargePacketMax(FALSE), reqSize),
                                 request->fileName.name);
       if (result < 0) {
          LOG(4, ("CP conversion failed.\n"));
index 0b6c48bcec90a10e2981b2fd59d257aab6e5642f..2ca2d95d21ab8008ec209275371347f86eb72013 100644 (file)
@@ -92,7 +92,7 @@ HgfsPackOpenRequest(const char *path,          // IN: Path to file
 
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
-                                HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+                                HgfsLargePacketMax(FALSE) - (reqSize - 1),
                                 requestV3->fileName.name);
       if (result < 0) {
          LOG(4, ("CP conversion failed.\n"));
@@ -136,7 +136,7 @@ HgfsPackOpenRequest(const char *path,          // IN: Path to file
 
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
-                                HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+                                HgfsLargePacketMax(FALSE) - (reqSize - 1),
                                 requestV2->fileName.name);
       if (result < 0) {
          LOG(4, ("CP conversion failed.\n"));
@@ -170,7 +170,7 @@ HgfsPackOpenRequest(const char *path,          // IN: Path to file
 
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
-                                HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+                                HgfsLargePacketMax(FALSE) - (reqSize - 1),
                                 request->fileName.name);
       if (result < 0) {
          LOG(4, ("CP conversion failed.\n"));
@@ -694,8 +694,8 @@ HgfsRead(struct fuse_file_info *fi,  // IN:  File info struct
            fi->fh, count, offset));
 
     do {
-      nextCount = (remainingCount > HGFS_LARGE_IO_MAX) ?
-                                     HGFS_LARGE_IO_MAX : remainingCount;
+      nextCount = (remainingCount > HgfsLargeIoMax(FALSE)) ?
+                                     HgfsLargeIoMax(FALSE) : remainingCount;
       LOG(4, ("Issue DoRead(0x%"FMT64"x 0x%"FMTSZ"x bytes @ 0x%"FMT64"x)\n",
               fi->fh, nextCount, curOffset));
       result = HgfsDoRead(fi->fh, buffer, nextCount, curOffset);
@@ -880,8 +880,8 @@ HgfsWrite(struct fuse_file_info *fi,  // IN: File info structure
            fi->fh, count, offset));
 
    do {
-      nextCount = (remainingCount > HGFS_LARGE_IO_MAX) ?
-                                     HGFS_LARGE_IO_MAX : remainingCount;
+      nextCount = (remainingCount > HgfsLargeIoMax(FALSE)) ?
+                                     HgfsLargeIoMax(FALSE) : remainingCount;
 
       LOG(4, ("Issue DoWrite(0x%"FMT64"x 0x%"FMTSZ"x bytes @ 0x%"FMT64"x)\n",
               fi->fh, nextCount, curOffset));
@@ -958,7 +958,7 @@ retry:
       reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
       /* Convert old name to CP format. */
       result = CPName_ConvertTo(from,
-                                HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
+                                HGFS_NAME_BUFFER_SIZET(HgfsLargePacketMax(FALSE), reqSize),
                                 requestV3->oldName.name);
       if (result < 0) {
          LOG(4, ("oldName CP conversion failed\n"));
@@ -974,7 +974,7 @@ retry:
       reqSize = sizeof *request;
       /* Convert old name to CP format. */
       result = CPName_ConvertTo(from,
-                                HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
+                                HGFS_NAME_BUFFER_SIZET(HgfsLargePacketMax(FALSE), reqSize),
                                 request->oldName.name);
       if (result < 0) {
          LOG(4, ("oldName CP conversion failed\n"));
@@ -1004,7 +1004,7 @@ retry:
 
       /* Convert new name to CP format. */
       result = CPName_ConvertTo(to,
-                                HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize) - result,
+                                HGFS_NAME_BUFFER_SIZET(HgfsLargePacketMax(FALSE), reqSize) - result,
                                 newNameP->name);
       if (result < 0) {
          LOG(4, ("newName CP conversion failed\n"));
@@ -1026,7 +1026,7 @@ retry:
 
       /* Convert new name to CP format. */
       result = CPName_ConvertTo(to,
-                                HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize) - result,
+                                HGFS_NAME_BUFFER_SIZET(HgfsLargePacketMax(FALSE), reqSize) - result,
                                 newNameP->name);
       if (result < 0) {
          LOG(4, ("newName CP conversion failed\n"));
@@ -1170,7 +1170,7 @@ HgfsPackSetattrRequest(const char *path,   // IN:  path to file
       requestV3->fileName.flags = 0;
       requestV3->reserved = 0;
       reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
-      reqBufferSize = HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize);
+      reqBufferSize = HGFS_NAME_BUFFER_SIZET(HgfsLargePacketMax(FALSE), reqSize);
       result = CPName_ConvertTo(path,
                                 reqBufferSize,
                                 requestV3->fileName.name);
@@ -1228,7 +1228,7 @@ HgfsPackSetattrRequest(const char *path,   // IN:  path to file
       requestV2->hints = 0;
 
       reqSize = sizeof *requestV2;
-      reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV2);
+      reqBufferSize = HGFS_NAME_BUFFER_SIZE(HgfsLargePacketMax(FALSE), requestV2);
       result = CPName_ConvertTo(path,
                                 reqBufferSize,
                                 requestV2->fileName.name);
@@ -1278,7 +1278,7 @@ HgfsPackSetattrRequest(const char *path,   // IN:  path to file
       update = &request->update;
 
       reqSize = sizeof *request;
-      reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, request);
+      reqBufferSize = HGFS_NAME_BUFFER_SIZE(HgfsLargePacketMax(FALSE), request);
       result = CPName_ConvertTo(path,
                                 reqBufferSize,
                                 request->fileName.name);
index fd5a0066b635570f3e94e433d937f3e24542f7cb..96a3ce0d933bdc5b94250112c2c4d6aeae2dc6f6 100644 (file)
@@ -140,7 +140,7 @@ HgfsPackQueryVolumeRequest(const char *path,        // IN: File pointer for this
       requestSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
-                                HGFS_LARGE_PACKET_MAX - (requestSize - 1),
+                                HgfsLargePacketMax(FALSE) - (requestSize - 1),
                                 requestV3->fileName.name);
       if (result < 0) {
          LOG(4, ("CP conversion failed.\n"));
@@ -159,7 +159,7 @@ HgfsPackQueryVolumeRequest(const char *path,        // IN: File pointer for this
       requestSize = sizeof *request;
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
-                                HGFS_LARGE_PACKET_MAX - (requestSize - 1),
+                                HgfsLargePacketMax(FALSE) - (requestSize - 1),
                                 request->fileName.name);
       if (result < 0) {
          LOG(4, ("CP conversion failed.\n"));
index 4363ea36bda810db352994505e77e15eeb11ea15..fe4e4e83a4da5af26da35ee29cf5c96ccdcc0158 100644 (file)
@@ -113,7 +113,7 @@ HgfsUnpackGetattrReply(HgfsReq *req,        // IN: Reply packet
       length = replyV3->symlinkTarget.length;
 
       /* Skip the symlinkTarget if it's too long. */
-      if (length > HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX,
+      if (length > HGFS_NAME_BUFFER_SIZET(HgfsLargePacketMax(FALSE),
                                           sizeof *replyV3 + sizeof (HgfsReply))) {
          LOG(4, ("symlink target name too long, ignoring\n"));
          return -ENAMETOOLONG;
@@ -125,7 +125,7 @@ HgfsUnpackGetattrReply(HgfsReq *req,        // IN: Reply packet
       length = replyV2->symlinkTarget.length;
 
       /* Skip the symlinkTarget if it's too long. */
-      if (length > HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, replyV2)) {
+      if (length > HGFS_NAME_BUFFER_SIZE(HgfsLargePacketMax(FALSE), replyV2)) {
          LOG(4, ("symlink target name too long, ignoring\n"));
          return -ENAMETOOLONG;
       }
@@ -208,7 +208,7 @@ HgfsPackGetattrRequest(HgfsReq *req,            // IN/OUT: Request buffer
 
       requestV3->reserved = 0;
       reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
-      reqBufferSize = HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize);
+      reqBufferSize = HGFS_NAME_BUFFER_SIZET(HgfsLargePacketMax(FALSE), reqSize);
 
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
@@ -232,7 +232,7 @@ HgfsPackGetattrRequest(HgfsReq *req,            // IN/OUT: Request buffer
       requestV2 = (HgfsRequestGetattrV2 *)(HGFS_REQ_PAYLOAD(req));
       requestV2->hints = 0;
       reqSize = sizeof *requestV2;
-      reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV2);
+      reqBufferSize = HGFS_NAME_BUFFER_SIZE(HgfsLargePacketMax(FALSE), requestV2);
 
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
@@ -252,7 +252,7 @@ HgfsPackGetattrRequest(HgfsReq *req,            // IN/OUT: Request buffer
       HgfsRequestGetattr *requestV1;
       requestV1 = (HgfsRequestGetattr *)(HGFS_REQ_PAYLOAD(req));
       reqSize = sizeof *requestV1;
-      reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV1);
+      reqBufferSize = HGFS_NAME_BUFFER_SIZE(HgfsLargePacketMax(FALSE), requestV1);
 
       /* Convert to CP name. */
       result = CPName_ConvertTo(path,
index 777eb76ea5ddb94a4c5bec7ca615d5b6513763f9..3a6fc912c4d9ecf3ceafba65725f1d754a6e06a8 100644 (file)
@@ -69,7 +69,7 @@ HgfsPackSymlinkCreateRequest(const char* symlink,     // IN: path of the link
       requestSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
       /* Convert symlink name to CP format. */
       result = CPName_ConvertTo(symlink,
-                                HGFS_LARGE_PACKET_MAX - (requestSize - 1),
+                                HgfsLargePacketMax(FALSE) - (requestSize - 1),
                                 requestV3->symlinkName.name);
       if (result < 0) {
          LOG(4, ("SymlinkName CP conversion failed.\n"));
@@ -79,7 +79,7 @@ HgfsPackSymlinkCreateRequest(const char* symlink,     // IN: path of the link
       requestSize += result;
 
       /* Copy target name into request packet. */
-      if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) {
+      if (targetNameBytes > HgfsLargePacketMax(FALSE) - (requestSize - 1)) {
          LOG(4, ("Target name is too long.\n"));
          return -EINVAL;
       }
@@ -104,7 +104,7 @@ HgfsPackSymlinkCreateRequest(const char* symlink,     // IN: path of the link
       requestSize = sizeof *request;
       /* Convert symlink name to CP format. */
       result = CPName_ConvertTo(symlink,
-                                HGFS_LARGE_PACKET_MAX - (requestSize - 1),
+                                HgfsLargePacketMax(FALSE) - (requestSize - 1),
                                 request->symlinkName.name);
       if (result < 0) {
          LOG(4, ("SymlinkName CP conversion failed.\n"));
@@ -114,7 +114,7 @@ HgfsPackSymlinkCreateRequest(const char* symlink,     // IN: path of the link
       requestSize += result;
 
       /* Copy target name into request packet. */
-      if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) {
+      if (targetNameBytes > HgfsLargePacketMax(FALSE) - (requestSize - 1)) {
          LOG(4, ("Target name is too long.\n"));
          return -EINVAL;
       }
index 491cec90ca3a3ca5edd75ceedcfe108d689858bf..9481ccd86f28ed078a946e247a2af64c430d672a 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2013 VMware, Inc. All rights reserved.
+ * Copyright (C) 2013,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
@@ -311,7 +311,7 @@ HgfsSendRequest(HgfsReq *req)       // IN/OUT: Outgoing request
    int ret;
 
    ASSERT(req);
-   ASSERT(req->payloadSize <= HGFS_LARGE_PACKET_MAX);
+   ASSERT(req->payloadSize <= HgfsLargePacketMax(FALSE));
 
    req->state = HGFS_REQ_STATE_UNSENT;
 
@@ -437,7 +437,7 @@ HgfsCompleteReq(HgfsReq *req,       // IN: Request
 {
    ASSERT(req);
    ASSERT(reply);
-   ASSERT(replySize <= HGFS_LARGE_PACKET_MAX);
+   ASSERT(replySize <= HgfsLargePacketMax(FALSE));
 
    memcpy(HGFS_REQ_PAYLOAD(req), reply, replySize);
    req->payloadSize = replySize;
index 3fba65dbd4bca15a70184235fcf41441882f5646..e4c156574ce1064c7079142b29aedc186f97108c 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2015-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2015-2016,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
@@ -52,7 +52,7 @@ HgfsPackCreateSessionRequest(HgfsOp opUsed, // IN: Op to be used
       HgfsRequestCreateSessionV4 *requestV4 = HgfsGetRequestPayload(req);
 
       requestV4->numCapabilities = 0;
-      requestV4->maxPacketSize = HGFS_LARGE_PACKET_MAX;
+      requestV4->maxPacketSize = HgfsLargePacketMax(FALSE);
       requestV4->reserved = 0;
 
       req->payloadSize = sizeof(*requestV4) + HgfsGetRequestHeaderSize();
index 9f3f4325bc3e1ec453623a975811fadfd859cdd3..22fa5a0700b4ee67931207fb9abd7f90afb166da 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2013 VMware, Inc. All rights reserved.
+ * Copyright (C) 2013,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
@@ -324,7 +324,7 @@ HgfsTransportSendRequest(HgfsReq *req)   // IN: Request to send
    int ret;
    ASSERT(req);
    ASSERT(req->state == HGFS_REQ_STATE_UNSENT);
-   ASSERT(req->payloadSize <= HGFS_LARGE_PACKET_MAX);
+   ASSERT(req->payloadSize <= HgfsLargePacketMax(FALSE));
 
    pthread_mutex_lock(&gHgfsActiveChannelLock);
 
index f23d5d0958787cfefe09e1177837376bc0315d91..030b6916a0a09fb2a1cdca49af6ef3e8e341a826 100644 (file)
@@ -25,8 +25,8 @@
 #ifndef _VMHGFS_VERSION_H_
 #define _VMHGFS_VERSION_H_
 
-#define VMHGFS_DRIVER_VERSION          1.6.9.0
-#define VMHGFS_DRIVER_VERSION_COMMAS   1,6,9,0
-#define VMHGFS_DRIVER_VERSION_STRING   "1.6.9.0"
+#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"
 
 #endif /* _VMHGFS_VERSION_H_ */