compat: Added macros and header fixes to support RHEL7.3
authorVladimir Sokolovsky <vlad@mellanox.com>
Wed, 16 Nov 2016 16:25:16 +0000 (18:25 +0200)
committerVladimir Sokolovsky <vlad@mellanox.com>
Wed, 16 Nov 2016 16:25:16 +0000 (18:25 +0200)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
config/rdma.m4
include/linux/compat-3.11.h
include/linux/compat-4.0.h

index cc10449..cb97890 100644 (file)
@@ -3415,6 +3415,7 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
        AC_MSG_CHECKING([if nelems is atomic_t in struct rhashtable])
        LB_LINUX_TRY_COMPILE([
                #include <linux/atomic.h>
+               #include <linux/poison.h>
                #include <linux/rhashtable.h>
        ],[
                struct rhashtable *ht;
@@ -3452,6 +3453,49 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([if ethtool.h enum ethtool_link_mode_bit_indices has ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT])
+       LB_LINUX_TRY_COMPILE([
+               #include <uapi/linux/ethtool.h>
+       ],[
+               enum ethtool_link_mode_bit_indices x = ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT, 1,
+                         [ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if include/net/flow_dissector.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/flow_dissector.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NET_FLOW_DISSECTOR_H, 1,
+                         [include/net/flow_dissector.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if include/linux/dcache.h has d_inode])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/dcache.h>
+       ],[
+               struct inode *inode = d_inode(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_D_INODE, 1,
+                       [d_inode is defined in dcache.h])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
 ])
 #
 # COMPAT_CONFIG_HEADERS
index 981ac86..18e3247 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/version.h>
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0))
+#include <linux/netdevice.h>
 
 #ifndef AF_IB
 #define AF_IB          27      /* Native InfiniBand address    */
index 9aae4ad..50e13a3 100644 (file)
@@ -5,6 +5,7 @@
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0))
 
+#include "../../compat/config.h"
 #include <linux/dcache.h>
 
 /**
  * This is the helper normal filesystems should use to get at their own inodes
  * in their own dentries and ignore the layering superimposed upon them.
  */
+#ifndef HAVE_D_INODE
 static inline struct inode *d_inode(const struct dentry *dentry)
 {
        return dentry->d_inode;
 }
+#endif
 
 #define debugfs_create_file_size LINUX_BACKPORT(debugfs_create_file_size)