]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
HGFS: fix compilation issues on SLES11SP2
authorVMware, Inc <>
Tue, 13 Mar 2012 20:01:24 +0000 (13:01 -0700)
committerDmitry Torokhov <dtor@vmware.com>
Wed, 14 Mar 2012 16:04:57 +0000 (09:04 -0700)
"warning: initialization from incompatible pointer type"

fsync() method was originally changed in Linux v3.1, but SUSE backported
it to their 3.0 kernels.

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/modules/linux/shared/autoconf/file_operations_fsync.c [new file with mode: 0644]
open-vm-tools/modules/linux/vmhgfs/Makefile.kernel
open-vm-tools/modules/linux/vmhgfs/file.c

diff --git a/open-vm-tools/modules/linux/shared/autoconf/file_operations_fsync.c b/open-vm-tools/modules/linux/shared/autoconf/file_operations_fsync.c
new file mode 100644 (file)
index 0000000..47a7815
--- /dev/null
@@ -0,0 +1,47 @@
+/*********************************************************
+ * Copyright (C) 2011 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ *********************************************************/
+
+/*
+ * Linux v3.1 added 2 params to fsync for fine-grained locking control.
+ * But SLES11 SP2 has backported the change to its 3.0 kernel,
+ * so we can't rely solely on kernel version to determine number of
+ * arguments.
+ */
+
+#include "compat_version.h"
+#include "compat_autoconf.h"
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
+#   error This compile test intentionally fails.
+#else
+
+#include <linux/fs.h>
+#include <linux/types.h>  /* loff_t */
+
+static int TestFsync(struct file *file,
+                     loff_t start, loff_t end,
+                      int datasync)
+{
+   return 0;
+}
+
+struct file_operations testFO = {
+   .fsync = TestFsync,
+};
+
+#endif
index 8f59cfa953107dc44b8013f17582de4345b2d218..a8a2caab702dbb35b4f78947441d48ed9d413e3d 100644 (file)
@@ -27,6 +27,7 @@ EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
 
 EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/cachector.c, -DVMW_KMEMCR_CTOR_HAS_3_ARGS, )
 EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/cachector1.c, -DVMW_KMEMCR_CTOR_HAS_2_ARGS, )
+EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/file_operations_fsync.c, -DVMW_FSYNC_31, )
 
 # Note: These tests are inverted
 EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/getsb1.c,, -DVMW_GETSB_2618)
index 2c3942cc5ae1c79edc453be13ff6f2a1951166b8..5a5926329ce030cb9b63e9eafde0ee35cfc2e8c3 100644 (file)
@@ -83,7 +83,7 @@ static loff_t HgfsSeek(struct file *file,
 static int HgfsFsync(struct file *file,
 #if defined VMW_FSYNC_OLD
                      struct dentry *dentry,
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
+#elif defined VMW_FSYNC_31
                      loff_t start,
                      loff_t end,
 #endif
@@ -992,7 +992,7 @@ static int
 HgfsFsync(struct file *file,           // IN: File we operate on
 #if defined VMW_FSYNC_OLD
           struct dentry *dentry,        // IN: Dentry for this file
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
+#elif defined VMW_FSYNC_31
           loff_t start,                 // IN: start of range to sync
           loff_t end,                   // IN: end of range to sync
 #endif