From fc23dc60471c4ca22353197e4fe7c8cd4fbc16f9 Mon Sep 17 00:00:00 2001 From: rd235 Date: Thu, 4 Jul 2013 15:53:30 +0000 Subject: [PATCH] Linux >= 3.9 compatibility issue fixed: hlist_for_each_entry has 3 args now git-svn-id: https://svn.code.sf.net/p/vde/svn/trunk@561 d37a7db1-d92d-0410-89df-f68f52f87b57 --- ipn/af_ipn.c | 21 ++++++++++++++++++--- ipn/kvde_switch/ipn_hash.c | 24 ++++++++++++++++++++---- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/ipn/af_ipn.c b/ipn/af_ipn.c index d153539..62a0579 100644 --- a/ipn/af_ipn.c +++ b/ipn/af_ipn.c @@ -59,6 +59,9 @@ MODULE_DESCRIPTION("IPN Kernel Module"); #if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) #define IPN_PRE310 #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) +#define IPN_PRE390 +#endif /*extension of RCV_SHUTDOWN defined in include/net/sock.h * when the bit is set recv fails */ @@ -135,10 +138,16 @@ static inline void ipn_remove_network(struct ipn_network *ipnn) static struct ipn_network *ipn_find_network_byinode(struct inode *i) { struct ipn_network *ipnn; +#ifdef PRE390 struct hlist_node *node; hlist_for_each_entry(ipnn, node, - &ipn_network_table[i->i_ino & (IPN_HASH_SIZE - 1)], hnode) { + &ipn_network_table[i->i_ino & (IPN_HASH_SIZE - 1)], hnode) +#else + hlist_for_each_entry(ipnn, + &ipn_network_table[i->i_ino & (IPN_HASH_SIZE - 1)], hnode) +#endif + { struct dentry *dentry = ipnn->dentry; if(dentry && dentry->d_inode == i) @@ -151,11 +160,17 @@ struct ipn_network *ipn_find_network_byfun( int (*fun)(struct ipn_network *,void *),void *funarg) { struct ipn_network *ipnn; - struct hlist_node *node; int ipn_table_scan; for (ipn_table_scan=0;ipn_table_scanmask); int found=0; spin_lock(&vdeh->hashlock); +#ifdef PRE390 + struct hlist_node *node; hlist_for_each_entry(elem, node, - &vdeh->hashtable[hashvalue], hashnode) { + &vdeh->hashtable[hashvalue], hashnode) +#else + hlist_for_each_entry(elem, + &vdeh->hashtable[hashvalue], hashnode) +#endif + { if (elem->key[0]==key[0] && elem->key[1]==key[1] && elem->key[2]==key[2] && elem->key[3]==vlan) { found=1; @@ -224,7 +234,6 @@ void ipn_hash_add(struct ipn_hash *vdeh,u16 *key,u16 vlan,int port) int ipn_hash_find(struct ipn_hash *vdeh,u16 *key,u16 vlan) { struct ipn_hash_elem *elem; - struct hlist_node *node; int rv=-1; int hashvalue=hashfun(key,vlan,vdeh->mask); @@ -232,8 +241,15 @@ int ipn_hash_find(struct ipn_hash *vdeh,u16 *key,u16 vlan) #ifdef IPN_DEBUG printk("SEARCH HASH %x %x %x %x \n", key[0], key[1], key[2], vlan); #endif +#ifdef PRE390 + struct hlist_node *node; hlist_for_each_entry(elem, node, - &vdeh->hashtable[hashvalue], hashnode) { + &vdeh->hashtable[hashvalue], hashnode) +#else + hlist_for_each_entry(elem, + &vdeh->hashtable[hashvalue], hashnode) +#endif + { if (elem->key[0]==key[0] && elem->key[1]==key[1] && elem->key[2]==key[2] && elem->key[3]==vlan) { rv=elem->port; -- 2.11.4.GIT