From: John Wolfe Date: Mon, 7 Feb 2022 17:40:00 +0000 (-0800) Subject: Common source file change not applicable to open-vm-tools. X-Git-Tag: stable-12.1.0~150 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e79bc1414f31a07a9fb74c624b8b435546e0212;p=thirdparty%2Fopen-vm-tools.git Common source file change not applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/file/fileIOPosix.c b/open-vm-tools/lib/file/fileIOPosix.c index 82c0aa18e..492a4bf4a 100644 --- a/open-vm-tools/lib/file/fileIOPosix.c +++ b/open-vm-tools/lib/file/fileIOPosix.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 1998-2021 VMware, Inc. All rights reserved. + * Copyright (C) 1998-2022 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 @@ -102,6 +102,11 @@ #include #endif +#ifdef VMX86_SERVER +#include "fs_public.h" +#include +#endif + /* * fallocate() is only supported since the glibc-2.8 and * linux kernel-2.6.23. Presently the glibc in our toolchain is 2.3. @@ -2288,7 +2293,16 @@ Bool FileIO_SupportsFileSize(const FileIODescriptor *fd, // IN: uint64 requestedSize) // IN: { -#if defined(__linux__) +#ifdef VMX86_SERVER + // PR 93215: Use VMkernel-specific logic. + uint64 maxFileSize; + if (ioctl(fd->posix, IOCTLCMD_VMFS_GET_MAX_FILE_SIZE, &maxFileSize) == -1) { + Log(LGPFX" %s: Could not get max file size for fd: %d, error: %s\n", + __func__, fd->posix, Err_Errno2String(errno)); + return FALSE; + } + return requestedSize <= maxFileSize; +#elif defined(__linux__) /* * Linux makes test on seek(), so we can do simple non-intrusive test. * Verified to work on 2.2.x, 2.4.x and 2.6.x, with ext2, ext3, smbfs,