]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Common source file change not applicable to open-vm-tools.
authorJohn Wolfe <jwolfe@vmware.com>
Mon, 7 Feb 2022 17:40:00 +0000 (09:40 -0800)
committerJohn Wolfe <jwolfe@vmware.com>
Mon, 7 Feb 2022 17:40:00 +0000 (09:40 -0800)
open-vm-tools/lib/file/fileIOPosix.c

index 82c0aa18e39603e4b9515848ebab938e673c63ba..492a4bf4a322372606909e5b09716b137b77176f 100644 (file)
@@ -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
 #include <sys/fcntl.h>
 #endif
 
+#ifdef VMX86_SERVER
+#include "fs_public.h"
+#include <sys/ioctl.h>
+#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,