]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ecryptfs/netlink.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[linux-2.6-omap-h63xx.git] / fs / ecryptfs / netlink.c
index e3aa2253c8508e1b316a0b3a32e04472cdb51712..9aa345121e09cf2bf2f600259f95a03557f85de3 100644 (file)
@@ -97,7 +97,7 @@ out:
  */
 static int ecryptfs_process_nl_response(struct sk_buff *skb)
 {
-       struct nlmsghdr *nlh = (struct nlmsghdr*)skb->data;
+       struct nlmsghdr *nlh = nlmsg_hdr(skb);
        struct ecryptfs_message *msg = NLMSG_DATA(nlh);
        int rc;
 
@@ -165,23 +165,11 @@ static int ecryptfs_process_nl_quit(struct sk_buff *skb)
  * it to its desired netlink context element and wake up the process
  * that is waiting for a response.
  */
-static void ecryptfs_receive_nl_message(struct sock *sk, int len)
+static void ecryptfs_receive_nl_message(struct sk_buff *skb)
 {
-       struct sk_buff *skb;
        struct nlmsghdr *nlh;
-       int rc = 0;     /* skb_recv_datagram requires this */
 
-receive:
-       skb = skb_recv_datagram(sk, 0, 0, &rc);
-       if (rc == -EINTR)
-               goto receive;
-       else if (rc < 0) {
-               ecryptfs_printk(KERN_ERR, "Error occurred while "
-                               "receiving eCryptfs netlink message; "
-                               "rc = [%d]\n", rc);
-               return;
-       }
-       nlh = (struct nlmsghdr *)skb->data;
+       nlh = nlmsg_hdr(skb);
        if (!NLMSG_OK(nlh, skb->len)) {
                ecryptfs_printk(KERN_ERR, "Received corrupt netlink "
                                "message\n");
@@ -227,9 +215,9 @@ int ecryptfs_init_netlink(void)
 {
        int rc;
 
-       ecryptfs_nl_sock = netlink_kernel_create(NETLINK_ECRYPTFS, 0,
+       ecryptfs_nl_sock = netlink_kernel_create(&init_net, NETLINK_ECRYPTFS, 0,
                                                 ecryptfs_receive_nl_message,
-                                                THIS_MODULE);
+                                                NULL, THIS_MODULE);
        if (!ecryptfs_nl_sock) {
                rc = -EIO;
                ecryptfs_printk(KERN_ERR, "Failed to create netlink socket\n");