--- /dev/null
+/*********************************************************
+ * 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
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)
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
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