[Openswan Users] KLIPS module compile error

Giovani Moda - MR Informática giovani at mrinformatica.com.br
Wed Apr 27 11:39:36 CEST 2005


Hey,

I've found this in a forum. I don't really know if it has something to do 
with this error, but it appears to me that has been some changes in how 
sk_alloc works in these new kernels.

Take a look:

-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Hi everybody,

the 26th of March 2005 Arnaldo Carvalho de Melo commited a quite big change 
to
sk_alloc:

ChangeSet 1.2181.42.2 2005/03/26 20:04:49 acme at xxxxxxxxxxxxxxxxxxxxxx
  [NET] make all protos partially use sk_prot

  sk_alloc_slab becomes proto_register, that receives a struct proto not 
necessarily
  completely filled, but at least with the proto name, owner and obj_size 
(aka proto
  specific sock size), with this we can remove the struct sock sk_owner and 
sk_slab,
  using sk->sk_prot->{owner,slab} instead.

  This patch also makes sk_set_owner not necessary anymore, as at sk_alloc 
time we
  have now access to the struct proto onwer and slab members, so we can bump 
the
  module refcount exactly at sock allocation time.

  Another nice "side effect" is that this patch removes the generic 
sk_cachep slab
  cache, making the only last two protocols that used it use just kmalloc, 
informing
  a struct proto obj_size equal to sizeof(struct sock).

  Ah, almost forgot that with this patch it is very easy to use a slab 
cache, as it is
  now created at proto_register time, and all protocols need to use 
proto_register,
  so its just a matter of switching the second parameter of proto_register 
to '1', heck,
  this can be done even at module load time with some small additional 
patch.

  Another optimization that will be possible in the future is to move the 
sk_protocol
  and sk_type struct sock members to struct proto, but this has to wait for 
all protocols
  to move completely to sk_prot.

  This changeset also introduces /proc/net/protocols, that lists the 
registered protocols
  details, some may seem excessive, but I'd like to keep them while working 
on further
  struct sock hierarchy work and also to realize which protocols are old 
ones, i.e. that
  still use struct proto_ops, etc, yeah, this is a bit of an exaggeration, 
as all protos
  still use struct proto_ops, but in time the idea is to move all to use 
sk->sk_prot and
  make the proto_ops infrastructure be shared among all protos, reducing one 
level of
  indirection.

  Signed-off-by: Arnaldo Carvalho de Melo <acme at xxxxxxxxxxxxxxxx>
  Signed-off-by: David S. Miller <davem at xxxxxxxxxxxxx>

The same change needs to be propagated to cman-kernel (probably more,
but i am working on one module at a time).
Here is a preliminary patch that works for me.

Please review before applying.

Signed-off-by: Fabio M. Di Nitto <fabbione at xxxxxxxxxx>

Index: cnxman.c
===================================================================
RCS file: /cvs/cluster/cluster/cman-kernel/src/cnxman.c,v
retrieving revision 1.55
diff -u -r1.55 cnxman.c
- --- cnxman.c	5 Apr 2005 13:43:09 -0000	1.55
+++ cnxman.c	16 Apr 2005 08:20:42 -0000
@@ -66,8 +66,8 @@
 extern void cman_set_realtime(struct task_struct *tsk, int prio);

 static struct proto_ops cl_proto_ops;
+static struct proto cl_proto;
 static struct sock *master_sock;
- -static kmem_cache_t *cluster_sk_cachep;

 /* Pointer to the pseudo node that maintains quorum in a 2node system */
 struct cluster_node *quorum_device = NULL;
@@ -918,14 +918,14 @@
 	return;
 }

- -static struct sock *cl_alloc_sock(struct socket *sock, int gfp)
+static struct sock *cl_alloc_sock(struct socket *sock, int gfp, int 
protocol)
 {
 	struct sock *sk;
 	struct cluster_sock *c;

 	if ((sk =
- -	     sk_alloc(AF_CLUSTER, gfp, sizeof (struct cluster_sock),
- -		      cluster_sk_cachep)) == NULL)
+	     sk_alloc(AF_CLUSTER, gpf, &cl_proto,
+		      1)) == NULL)
 		goto no_sock;

 	if (sock) {
@@ -937,6 +937,7 @@
 	sk->sk_no_check = 1;
 	sk->sk_family = PF_CLUSTER;
 	sk->sk_allocation = gfp;
+	sk->sk_protocol = protocol;

 	c = cluster_sk(sk);
 	c->port = 0;
@@ -1031,7 +1032,7 @@
 	if (!atomic_read(&cnxman_running) && protocol != CLPROTO_MASTER)
 		return -ENETDOWN;

- -	if ((sk = cl_alloc_sock(sock, GFP_KERNEL)) == NULL)
+	if ((sk = cl_alloc_sock(sock, GFP_KERNEL, protocol)) == NULL)
 		return -ENOBUFS;

 	sk->sk_protocol = protocol;
@@ -4155,6 +4156,12 @@
 	.owner       = THIS_MODULE,
 };

+static struct proto cl_proto = {
+	.name	     = "CMAN",
+	.owner	     = THIS_MODULE,
+	.obj_size    = sizeof(struct cluster_sock)
+};
+
 #ifdef MODULE
 MODULE_DESCRIPTION("Cluster Connection and Service Manager");
 MODULE_AUTHOR("Red Hat, Inc");
@@ -4166,19 +4173,14 @@
 	printk("CMAN %s (built %s %s) installed\n",
 	       CMAN_RELEASE_NAME, __DATE__, __TIME__);

- -	if (sock_register(&cl_family_ops)) {
- -		printk(KERN_INFO "Unable to register cluster socket type\n");
+	if (proto_register(&cl_proto,0) < 0) {
+		printk(KERN_INFO "Unable to register cluster protocol type\n");
 		return -1;
 	}

- -	/* allocate our sock slab cache */
- -	cluster_sk_cachep = kmem_cache_create("cluster_sock",
- -					      sizeof (struct cluster_sock), 0,
- -					      SLAB_HWCACHE_ALIGN, 0, 0);
- -	if (!cluster_sk_cachep) {
- -		printk(KERN_CRIT
- -		       "cluster_init: Cannot create cluster_sock SLAB cache\n");
- -		sock_unregister(AF_CLUSTER);
+	if (sock_register(&cl_family_ops)) {
+		proto_unregister(&cl_proto);
+		printk(KERN_INFO "Unable to register cluster socket type\n");
 		return -1;
 	}

@@ -4234,7 +4236,7 @@
 	cnxman_ioctl32_exit();
 #endif
 	sock_unregister(AF_CLUSTER);
- -	kmem_cache_destroy(cluster_sk_cachep);
+	proto_unregister(&cl_proto);
 }

 module_init(cluster_init); 



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.10.3 - Release Date: 25/04/2005



More information about the Users mailing list