Merge branch 'pandora-27-omap1' into rev2
[pandora-kernel.git] / net / decnet / dn_neigh.c
index ff0ebe9..1ca13b1 100644 (file)
@@ -3,7 +3,7 @@
  *              operating system.  DECnet is implemented using the  BSD Socket
  *              interface as the means of communication with the user level.
  *
- *              DECnet Neighbour Functions (Adjacency Database and 
+ *              DECnet Neighbour Functions (Adjacency Database and
  *                                                        On-Ethernet Cache)
  *
  * Author:      Steve Whitehouse <SteveW@ACM.org>
@@ -38,6 +38,7 @@
 #include <linux/rcupdate.h>
 #include <linux/jhash.h>
 #include <asm/atomic.h>
+#include <net/net_namespace.h>
 #include <net/neighbour.h>
 #include <net/dst.h>
 #include <net/flow.h>
@@ -210,7 +211,8 @@ static int dn_neigh_output_packet(struct sk_buff *skb)
        char mac_addr[ETH_ALEN];
 
        dn_dn2eth(mac_addr, rt->rt_local_src);
-       if (!dev->hard_header || dev->hard_header(skb, dev, ntohs(skb->protocol), neigh->ha, mac_addr, skb->len) >= 0)
+       if (dev_hard_header(skb, dev, ntohs(skb->protocol), neigh->ha,
+                           mac_addr, skb->len) >= 0)
                return neigh->ops->queue_xmit(skb);
 
        if (net_ratelimit())
@@ -261,7 +263,7 @@ static int dn_long_output(struct sk_buff *skb)
        lp->s_class  = 0;
        lp->pt       = 0;
 
-       skb->nh.raw = skb->data;
+       skb_reset_network_header(skb);
 
        return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);
 }
@@ -277,19 +279,19 @@ static int dn_short_output(struct sk_buff *skb)
        struct dn_skb_cb *cb = DN_SKB_CB(skb);
 
 
-        if (skb_headroom(skb) < headroom) {
-                struct sk_buff *skb2 = skb_realloc_headroom(skb, headroom);
-                if (skb2 == NULL) {
+       if (skb_headroom(skb) < headroom) {
+               struct sk_buff *skb2 = skb_realloc_headroom(skb, headroom);
+               if (skb2 == NULL) {
                        if (net_ratelimit())
-                               printk(KERN_CRIT "dn_short_output: no memory\n");
-                        kfree_skb(skb);
-                        return -ENOBUFS;
-                }
-                kfree_skb(skb);
-                skb = skb2;
+                               printk(KERN_CRIT "dn_short_output: no memory\n");
+                       kfree_skb(skb);
+                       return -ENOBUFS;
+               }
+               kfree_skb(skb);
+               skb = skb2;
                if (net_ratelimit())
-                       printk(KERN_INFO "dn_short_output: Increasing headroom\n");
-        }
+                       printk(KERN_INFO "dn_short_output: Increasing headroom\n");
+       }
 
        data = skb_push(skb, sizeof(struct dn_short_packet) + 2);
        *((__le16 *)data) = dn_htons(skb->len - 2);
@@ -300,7 +302,7 @@ static int dn_short_output(struct sk_buff *skb)
        sp->srcnode    = cb->src;
        sp->forward    = cb->hops & 0x3f;
 
-       skb->nh.raw = skb->data;
+       skb_reset_network_header(skb);
 
        return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);
 }
@@ -342,7 +344,7 @@ static int dn_phase3_output(struct sk_buff *skb)
        sp->srcnode  = cb->src & dn_htons(0x03ff);
        sp->forward  = cb->hops & 0x3f;
 
-       skb->nh.raw = skb->data;
+       skb_reset_network_header(skb);
 
        return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);
 }
@@ -569,7 +571,7 @@ static void *dn_neigh_seq_start(struct seq_file *seq, loff_t *pos)
                               NEIGH_SEQ_NEIGH_ONLY);
 }
 
-static struct seq_operations dn_neigh_seq_ops = {
+static const struct seq_operations dn_neigh_seq_ops = {
        .start = dn_neigh_seq_start,
        .next  = neigh_seq_next,
        .stop  = neigh_seq_stop,
@@ -578,33 +580,16 @@ static struct seq_operations dn_neigh_seq_ops = {
 
 static int dn_neigh_seq_open(struct inode *inode, struct file *file)
 {
-       struct seq_file *seq;
-       int rc = -ENOMEM;
-       struct neigh_seq_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
-
-       if (!s)
-               goto out;
-
-       rc = seq_open(file, &dn_neigh_seq_ops);
-       if (rc)
-               goto out_kfree;
-
-       seq          = file->private_data;
-       seq->private = s;
-       memset(s, 0, sizeof(*s));
-out:
-       return rc;
-out_kfree:
-       kfree(s);
-       goto out;
+       return seq_open_net(inode, file, &dn_neigh_seq_ops,
+                           sizeof(struct neigh_seq_state));
 }
 
-static struct file_operations dn_neigh_seq_fops = {
+static const struct file_operations dn_neigh_seq_fops = {
        .owner          = THIS_MODULE,
        .open           = dn_neigh_seq_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = seq_release_private,
+       .release        = seq_release_net,
 };
 
 #endif
@@ -612,11 +597,11 @@ static struct file_operations dn_neigh_seq_fops = {
 void __init dn_neigh_init(void)
 {
        neigh_table_init(&dn_neigh_table);
-       proc_net_fops_create("decnet_neigh", S_IRUGO, &dn_neigh_seq_fops);
+       proc_net_fops_create(&init_net, "decnet_neigh", S_IRUGO, &dn_neigh_seq_fops);
 }
 
 void __exit dn_neigh_cleanup(void)
 {
-       proc_net_remove("decnet_neigh");
+       proc_net_remove(&init_net, "decnet_neigh");
        neigh_table_clear(&dn_neigh_table);
 }