[2/1] connector/CBUS: new messaging subsystem. Revision number next.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some nlmsg alignment cleanups. Documentation module cleanups.

Thanks, Thomas.

Signed-off-by: Evgeniy Polyakov <[email protected]>

* looking for [email protected]/connector--main--0--patch-47 to compare with
* comparing to [email protected]/connector--main--0--patch-47
M  cn_test.c
M  connector.c

* modified files

--- orig/Documentation/connector/cn_test.c
+++ mod/Documentation/connector/cn_test.c
@@ -55,14 +55,14 @@
 	
 	size = NLMSG_SPACE(size0);
 
-	skb = alloc_skb(size, GFP_ATOMIC);
+	skb = alloc_skb(size, GFP_KERNEL);
 	if (!skb) {
 		printk(KERN_ERR "Failed to allocate new skb with size=%u.\n", size);
 
 		return -ENOMEM;
 	}
 
-	nlh = NLMSG_PUT(skb, 0, 0x123, NLMSG_DONE, size - sizeof(*nlh));
+	nlh = NLMSG_PUT(skb, 0, 0x123, NLMSG_DONE, size0);
 
 	msg = (struct cn_msg *)NLMSG_DATA(nlh);
 
@@ -104,7 +104,6 @@
 	req->range = 10;
 	
 	NETLINK_CB(skb).dst_groups = ctl->group;
-	//netlink_broadcast(nls, skb, 0, ctl->group, GFP_ATOMIC);
 	netlink_unicast(nls, skb, 0, 0);
 
 	printk(KERN_INFO "Request was sent. Group=0x%x.\n", ctl->group);
@@ -124,8 +123,7 @@
 	char data[32];
 
 	m = kmalloc(sizeof(*m) + sizeof(data), GFP_ATOMIC);
-	if (m)
-	{
+	if (m) {
 		memset(m, 0, sizeof(*m) + sizeof(data));
 
 		memcpy(&m->id, &cn_test_id, sizeof(m->id));
@@ -136,8 +134,8 @@
 
 		memcpy(m+1, data, m->len);
 		
-		cbus_insert(m);
-		//cn_netlink_send(m, 0);
+		cbus_insert(m, GFP_ATOMIC);
+		//cn_netlink_send(m, 0, GFP_ATOMIC);
 		kfree(m);
 	}
 


--- orig/drivers/connector/connector.c
+++ mod/drivers/connector/connector.c
@@ -100,15 +100,15 @@
 	else
 		groups = __groups;
 
-	size = NLMSG_SPACE(sizeof(*msg) + msg->len);
+	size = sizeof(*msg) + msg->len;
 
-	skb = alloc_skb(size, gfp_mask);
+	skb = alloc_skb(NLMSG_SPACE(size), gfp_mask);
 	if (!skb) {
-		printk(KERN_ERR "Failed to allocate new skb with size=%u.\n", size);
+		printk(KERN_ERR "Failed to allocate new skb with size=%u.\n", NLMSG_SPACE(size));
 		return -ENOMEM;
 	}
 
-	nlh = NLMSG_PUT(skb, 0, msg->seq, NLMSG_DONE, size - NLMSG_ALIGN(sizeof(*nlh)));
+	nlh = NLMSG_PUT(skb, 0, msg->seq, NLMSG_DONE, size);
 
 	data = (struct cn_msg *)NLMSG_DATA(nlh);
 





	Evgeniy Polyakov

Only failure makes us experts. -- Theo de Raadt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux