MOL module patch for 2.6.12 and +

Nicolas DET <[email protected]>
Newsgroups gmane.linux.ports.ppc.mol.general
Message-ID <[email protected]>
Hello!

You can find enclosed or here:
http://arrakin.homedns.org/~nicolas/mol-0.9.70_sk_alloc_2.6.12.diff
A patch for MOL module.

Since 2.6.12, the API of sk_alloc & some friends changed. As a result, you
have to adapt the code using thoses func.

I only modified the sheep driver, and it works 'well' using the kernel
2.6.13.
Could anyon review this patch ?
Could it be included in upcomming MOL ?

Your sincerly
-- 
Nicolas DET
MorphOS & Linux developer

_______________________________________________
mol-general mailing list
[email protected]
http://lists.maconlinux.org/mailman/listinfo/mol-general
mol-0.9.70_sk_alloc_2.6.12.diff (application/octet-stream, 1.7 KB)
--- mol-0.9.70_orig/src/netdriver/sheep.c	2005-08-31 08:29:13.057462496 +0200
+++ mol-0.9.70_nico/src/netdriver/sheep.c	2005-08-31 08:31:30.701537416 +0200
@@ -80,7 +80,13 @@
  */
 
 #ifdef LINUX_26
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
+#define compat_sk_alloc(a,b,c)  sk_alloc( (a), (b), &mol_proto, 1 )
+#else
 #define compat_sk_alloc(a,b,c)	sk_alloc( (a), (b), (c), NULL )
+#endif
+
 #define skt_set_dead(skt)	do {} while(0)
 #define wmem_alloc		sk_wmem_alloc
 #else
@@ -242,6 +248,15 @@
 /************************************************************************/
 /*	misc device ops							*/
 /************************************************************************/
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
+static struct proto mol_proto =
+{
+	.name     = "MOL",
+	.owner     = THIS_MODULE,
+	.obj_size    = sizeof(struct sock)
+};
+#endif
+
 
 static int 
 sheep_net_open( struct inode *inode, struct file *f )
@@ -250,6 +265,13 @@
 	struct SheepVars *v;
 	D(bug("sheep_net: open\n"));
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
+	if (proto_register(&mol_proto,0) < 0)
+	{
+		printk(KERN_INFO "Unable to register cluster protocol type\n");
+		return -1;
+	}
+#endif
 	// Must be opened with read permissions
 	if( (f->f_flags & O_ACCMODE) == O_WRONLY )
 		return -EPERM;
@@ -257,6 +279,7 @@
 	// Allocate private variables
 	if( !(v=(struct SheepVars *)f->private_data=kmalloc(sizeof(*v), GFP_USER)) )
 		return -ENOMEM;
+
 	memset( v, 0, sizeof(*v) );
 	memcpy( v->fake_addr, fake_addr_, 6 );
 
@@ -286,6 +309,10 @@
 	while( (skb=skb_dequeue(&v->queue)) )
 		kfree_skb(skb);
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
+	proto_unregister(&mol_proto);
+#endif
+
 	// Free private variables
 	kfree(v);
 	return 0;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.