Revision: 561
          http://sourceforge.net/p/vde/svn/561
Author:   rd235
Date:     2013-07-04 15:53:30 +0000 (Thu, 04 Jul 2013)
Log Message:
-----------
Linux >= 3.9 compatibility issue fixed: hlist_for_each_entry has 3 args now

Modified Paths:
--------------
    trunk/ipn/af_ipn.c
    trunk/ipn/kvde_switch/ipn_hash.c

Modified: trunk/ipn/af_ipn.c
===================================================================
--- trunk/ipn/af_ipn.c  2013-05-26 19:12:24 UTC (rev 560)
+++ trunk/ipn/af_ipn.c  2013-07-04 15:53:30 UTC (rev 561)
@@ -59,6 +59,9 @@
 #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 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 @@
                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_scan<IPN_HASH_SIZE;ipn_table_scan++) {
-               hlist_for_each_entry(ipnn, node, 
&ipn_network_table[ipn_table_scan], hnode) {
+#ifdef PRE390
+               struct hlist_node *node;
+               hlist_for_each_entry(ipnn, node, 
&ipn_network_table[ipn_table_scan], hnode)
+#else
+               hlist_for_each_entry(ipnn, &ipn_network_table[ipn_table_scan], 
hnode)
+#endif
+
+               {
                        if(fun(ipnn,funarg))
                                return ipnn;
                }

Modified: trunk/ipn/kvde_switch/ipn_hash.c
===================================================================
--- trunk/ipn/kvde_switch/ipn_hash.c    2013-05-26 19:12:24 UTC (rev 560)
+++ trunk/ipn/kvde_switch/ipn_hash.c    2013-07-04 15:53:30 UTC (rev 561)
@@ -32,6 +32,10 @@
 MODULE_AUTHOR("VIEW-OS TEAM");
 MODULE_DESCRIPTION("Ethernet hash table Kernel Module");
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
+#define IPN_PRE390
+#endif
+
 #undef IPN_DEBUG
 
 static struct kmem_cache *ipn_hash_elem_cache;
@@ -182,12 +186,18 @@
 void ipn_hash_add(struct ipn_hash *vdeh,u16 *key,u16 vlan,int port)
 {
        struct ipn_hash_elem *elem=NULL;
-       struct hlist_node *node;
        int hashvalue=hashfun(key,vlan,vdeh->mask);
        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 @@
 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 @@
 #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;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
vde-users mailing list
vde-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vde-users

Reply via email to