}
+/*
+ *----------------------------------------------------------------------
+ *
+ * HgfsMaxIOSize --
+ *
+ * Get the maximum IO size based on the agreed maximum packet size.
+ *
+ * Results:
+ * The maximum IO size.
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+static uint32
+HgfsMaxIOSize(void)
+{
+ uint32 maxIOSize = gState->maxPacketSize - HGFS_HEADER_SIZE_MAX;
+
+ if (maxIOSize > 0 && maxIOSize < HgfsLargeIoMax(FALSE)) {
+ return maxIOSize;
+ }
+ return HgfsLargeIoMax(FALSE);
+}
+
+
/*
*----------------------------------------------------------------------
*
char *buffer = buf;
loff_t curOffset = offset;
size_t nextCount, remainingCount = count;
+ uint32 maxIOSize = HgfsMaxIOSize();
ASSERT(NULL != fi);
ASSERT(NULL != buf);
fi->fh, count, offset));
do {
- nextCount = (remainingCount > HgfsLargeIoMax(FALSE)) ?
- HgfsLargeIoMax(FALSE) : remainingCount;
+ nextCount = (remainingCount > maxIOSize) ? maxIOSize : 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);
loff_t curOffset = offset;
size_t nextCount, remainingCount = count;
ssize_t bytesWritten = 0;
+ uint32 maxIOSize = HgfsMaxIOSize();
ASSERT(NULL != buf);
ASSERT(NULL != fi);
fi->fh, count, offset));
do {
- nextCount = (remainingCount > HgfsLargeIoMax(FALSE)) ?
- HgfsLargeIoMax(FALSE) : remainingCount;
-
+ nextCount = (remainingCount > maxIOSize) ? maxIOSize : remainingCount;
LOG(4, ("Issue DoWrite(0x%"FMT64"x 0x%"FMTSZ"x bytes @ 0x%"FMT64"x)\n",
fi->fh, nextCount, curOffset));
/*********************************************************
- * 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
Bool sessionEnabled;
uint64 sessionId;
uint8 headerVersion;
+ uint32 maxPacketSize;
/*
* When mount a subdirectory of hgfs shared directory, basePath holds
* the prefix to the root. e.g. 'mount.vmhgfs .host:/shared/sub /hgfs',
uint64 sessionId = HGFS_INVALID_SESSION_ID;
uint8 headerVersion = HGFS_HEADER_VERSION_1;
Bool sessionIdPresent = FALSE;
+ uint32 maxPacketSize = HgfsLargePacketMax(TRUE);
uint32 information;
HgfsHandle requestId;
*/
sessionId = createSessionReply->sessionId;
sessionIdPresent = TRUE;
+ maxPacketSize = createSessionReply->maxPacketSize;
}
out:
gState->sessionId = sessionId;
gState->headerVersion = headerVersion;
gState->sessionEnabled = sessionIdPresent;
+ gState->maxPacketSize = maxPacketSize;
LOG(4, ("Exit(%d)\n", status));
return status;
out:
gState->sessionId = HGFS_INVALID_SESSION_ID;
gState->sessionEnabled = FALSE;
+ gState->maxPacketSize = HgfsLargePacketMax(TRUE);
LOG(4, ("Exit(%d)\n", status));
return status;
#ifndef _VMHGFS_VERSION_H_
#define _VMHGFS_VERSION_H_
-#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"
+#define VMHGFS_DRIVER_VERSION 1.6.12.0
+#define VMHGFS_DRIVER_VERSION_COMMAS 1,6,12,0
+#define VMHGFS_DRIVER_VERSION_STRING "1.6.12.0"
#endif /* _VMHGFS_VERSION_H_ */