]> git.proxmox.com Git - mirror_spl-debian.git/blobdiff - include/linux/file_compat.h
Linux 2.6.35 compat: filp_fsync() dropped 'stuct dentry *'
[mirror_spl-debian.git] / include / linux / file_compat.h
index d30e90356dc48f7df08db1df159151493ef709a7..b03373ebdc39c4ca40b951946e45f1cf00a65991 100644 (file)
 #include <linux/fdtable.h>
 #endif
 
+static inline struct file *
+spl_filp_open(const char *name, int flags, int mode, int *err)
+{
+        struct file *filp = NULL;
+        int rc;
+
+        filp = filp_open(name, flags, mode);
+        if (IS_ERR(filp)) {
+                rc = PTR_ERR(filp);
+                if (err)
+                        *err = rc;
+                filp = NULL;
+        }
+        return filp;
+}
+
+#define spl_filp_close(f)              filp_close(f, NULL)
+#define spl_filp_poff(f)               (&(f)->f_pos)
+#define spl_filp_write(fp, b, s, p)    (fp)->f_op->write((fp), (b), (s), p)
+
+#ifdef HAVE_3ARGS_FILE_FSYNC
+#define spl_filp_fsync(fp, sync)       (fp)->f_op->fsync((fp), \
+                                       (fp)->f_dentry, sync)
+#else
+#define spl_filp_fsync(fp, sync)       (fp)->f_op->fsync((fp), sync)
+#endif
+
 #endif /* SPL_FILE_COMPAT_H */