Skip to contentSkip to conversation

patch's for vmware 2.0.4 for use with linux-2.4.8 kernel

PATCH New Jason Thomas 1 participant 1 message Aug 16, 2001

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 patch's for vmware 2.0.4 for use with linux-2.4.8 kernel

attached are two very small patches for those that want them. they make vmware's kernel modules compile with 2.4.8. Its not all my work, its a combination of what was posted a while back and my work.

Signature · 4 lines
Jason Thomas                           Phone:  +61 2 6257 7111
System Administrator  -  UID 0         Fax:    +61 2 6257 7311
tSA Consulting Group Pty. Ltd.         Mobile: 0418 29 66 81
1 Hall Street Lyneham ACT 2602         http://www.topic.com.au/
bridge.c +16 -4
diff -ru vmnet-only.orig/bridge.c vmnet-only/bridge.c
@@ -19,7 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/version.h>
 #include <linux/sched.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 #ifdef KERNEL_2_1
 #include <linux/poll.h>
 #include <asm/uaccess.h>
@@ -44,7 +44,7 @@
 #include "vnetInt.h"
 
 
-#define VNET_BRIDGE_HISTORY    8
+#define VNET_BRIDGE_HISTORY    48
 
 typedef struct VNetBridge VNetBridge;
 
@@ -58,6 +58,7 @@
    Bool                     savedPromisc;
    struct sk_buff          *history[VNET_BRIDGE_HISTORY];
    VNetPort                 port;
+   spinlock_t		    historyLock;
 };
 
 
@@ -130,6 +131,7 @@
       goto out;
    }
    memset(bridge, 0, sizeof *bridge);
+   spin_lock_init(&bridge->historyLock);
    memcpy(bridge->name, devName, sizeof bridge->name);
 
    /*
@@ -391,6 +393,8 @@
 	 unsigned long flags;
 	 int i;
 	 SKB_INCREF(clone);
+	 
+	 spin_lock_irqsave(&bridge->historyLock, flags);
 	 // XXX need to lock history
 	 for (i = 0; i < VNET_BRIDGE_HISTORY; i++) {
 	    if (bridge->history[i] == NULL) {
@@ -417,11 +421,15 @@
 	    for (i = 0; i < VNET_BRIDGE_HISTORY; i++) {
 	       struct sk_buff *s = bridge->history[i];
 	       bridge->history[i] = NULL;
-	       KFREE_SKB(s, FREE_WRITE);
+	       if (s) {
+	       	  spin_unlock_irqrestore(&bridge->historyLock, flags);
+		  KFREE_SKB(s, FREE_WRITE);
+		  spin_lock_irqsave(&bridge->historyLock, flags);
+	       }
 	    }
 	    bridge->history[0] = clone;
 	 }
-         
+         spin_unlock_irqrestore(&bridge->historyLock, flags);
 	 clone->dev = dev;
 	 clone->protocol = eth_type_trans(clone, dev);
 	 save_flags(flags);
@@ -773,6 +781,7 @@
 {
    VNetBridge *bridge = *(VNetBridge**)&((struct sock *)pt->data)->protinfo;
    int i;
+   unsigned long flags;
 
    if (bridge->dev == NULL) {
       LOG(3, (KERN_DEBUG "bridge-%s: received %d closed\n",
@@ -782,11 +791,13 @@
    }
 
    // XXX need to lock history
+   spin_lock_irqsave(&bridge->historyLock, flags);
    for (i = 0; i < VNET_BRIDGE_HISTORY; i++) {
       struct sk_buff *s = bridge->history[i];
       if (s != NULL &&
 	  (s == skb || SKB_IS_CLONE_OF(skb, s))) {
 	 bridge->history[i] = NULL;
+	 spin_unlock_irqrestore(&bridge->historyLock, flags);
 	 KFREE_SKB(s, FREE_WRITE);
 	 LOG(3, (KERN_DEBUG "bridge-%s: receive %d self %d\n",
 		 bridge->name, (int) skb->len, i));
@@ -795,6 +806,7 @@
 	 return 0;
       }
    }
+   spin_unlock_irqrestore(&bridge->historyLock, flags);
 
 #  if LOGLEVEL >= 4
    {
driver.c +1 -1
diff -ru vmnet-only.orig/driver.c vmnet-only/driver.c
@@ -20,7 +20,7 @@
 #include <linux/module.h>
 #include <linux/version.h>
 #include <linux/sched.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 #ifdef KERNEL_2_1
 #include <linux/poll.h>
 #include <asm/uaccess.h>
hub.c +1 -1
diff -ru vmnet-only.orig/hub.c vmnet-only/hub.c
@@ -19,7 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/version.h>
 #include <linux/sched.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 #ifdef KERNEL_2_1
 #include <linux/poll.h>
 #include <asm/uaccess.h>
netif.c +1 -1
diff -ru vmnet-only.orig/netif.c vmnet-only/netif.c
@@ -19,7 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/version.h>
 #include <linux/sched.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 #ifdef KERNEL_2_1
 #include <linux/poll.h>
 #include <asm/uaccess.h>
procfs.c +1 -1
diff -ru vmnet-only.orig/procfs.c vmnet-only/procfs.c
@@ -19,7 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/version.h>
 #include <linux/sched.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 #ifdef KERNEL_2_1
 #include <linux/poll.h>
 #include <asm/uaccess.h>
userif.c +1 -1
diff -ru vmnet-only.orig/userif.c vmnet-only/userif.c
@@ -19,7 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/version.h>
 #include <linux/sched.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 #ifdef KERNEL_2_1
 #include <linux/poll.h>
 #include <asm/uaccess.h>
linux/driver.c +3 -2
diff -ru vmmon-only.orig/linux/driver.c vmmon-only/linux/driver.c
@@ -9,6 +9,7 @@
 #endif 
 
 #include "driver-config.h"
+#include "hostif.h"
 
 #ifdef KERNEL_2_1
 #define EXPORT_SYMTAB
@@ -19,7 +20,7 @@
 #include <linux/module.h>
 #include <linux/version.h>
 #include <linux/sched.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 
 #ifdef __SMP__
 #include <linux/smp.h>
@@ -925,7 +926,7 @@
 	  current->fsuid == current->uid &&
           current->egid == current->gid &&
 	  current->fsgid == current->gid) {
-	 current->dumpable = 1;
+	 current->mm->dumpable = 1;
       }
       break;
 
linux/hostif.c +1 -1
diff -ru vmmon-only.orig/linux/hostif.c vmmon-only/linux/hostif.c
@@ -22,7 +22,7 @@
 #include <linux/binfmts.h>
 #include <linux/fs.h>
 #include <linux/mm.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 
 #ifdef KERNEL_2_1
 #  ifdef KERNEL_2_3_25