Whamcloud - gitweb
LU-9183 ptlrpc: handle posix_acl: xattr representation cleanups
[fs/lustre-release.git] / lustre / include / lustre_compat.h
index 4229fa5..8eff04d 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/namei.h>
 #include <linux/pagemap.h>
 #include <linux/bio.h>
+#include <linux/xattr.h>
 
 #include <libcfs/libcfs.h>
 #include <lustre_patchless_compat.h>
@@ -158,7 +159,7 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
 #ifdef HAVE_BVEC_ITER
 #define bio_idx(bio)                   (bio->bi_iter.bi_idx)
 #define bio_set_sector(bio, sector)    (bio->bi_iter.bi_sector = sector)
-#define bvl_to_page(bvl)               (bvl.bv_page)
+#define bvl_to_page(bvl)               (bvl->bv_page)
 #else
 #define bio_idx(bio)                   (bio->bi_idx)
 #define bio_set_sector(bio, sector)    (bio->bi_sector = sector)
@@ -178,6 +179,14 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
 #define queue_max_hw_segments(rq)         queue_max_segments(rq)
 #endif
 
+#ifdef HAVE_BLK_PLUG
+#define DECLARE_PLUG(plug)     struct blk_plug plug
+#else /* !HAVE_BLK_PLUG */
+#define DECLARE_PLUG(name)
+#define blk_start_plug(plug)   do {} while (0)
+#define blk_finish_plug(plug)  do {} while (0)
+#endif
+
 #ifdef HAVE_KMAP_ATOMIC_HAS_1ARG
 #define ll_kmap_atomic(a, b)   kmap_atomic(a)
 #define ll_kunmap_atomic(a, b) kunmap_atomic(a)
@@ -413,4 +422,24 @@ static inline void truncate_inode_pages_final(struct address_space *map)
 #endif
 #endif
 
+#ifdef HAVE_PID_NS_FOR_CHILDREN
+# define ll_task_pid_ns(task)  ((task)->nsproxy->pid_ns_for_children)
+#else
+# define ll_task_pid_ns(task)  ((task)->nsproxy->pid_ns)
+#endif
+
+#ifdef HAVE_FULL_NAME_HASH_3ARGS
+# define ll_full_name_hash(salt, name, len) full_name_hash(salt, name, len)
+#else
+# define ll_full_name_hash(salt, name, len) full_name_hash(name, len)
+#endif
+
+#ifdef HAVE_STRUCT_POSIX_ACL_XATTR
+# define posix_acl_xattr_header struct posix_acl_xattr_header
+# define posix_acl_xattr_entry  struct posix_acl_xattr_entry
+# define GET_POSIX_ACL_XATTR_ENTRY(head) ((void *)((head) + 1))
+#else
+# define GET_POSIX_ACL_XATTR_ENTRY(head) ((head)->a_entries)
+#endif
+
 #endif /* _LUSTRE_COMPAT_H */