net: Allow fib_rule_unregister to batch
[safe/jmp/linux-2.6] / net / decnet / dn_neigh.c
index e851b14..794b5bf 100644 (file)
@@ -59,7 +59,7 @@ static int dn_phase3_output(struct sk_buff *);
 /*
  * For talking to broadcast devices: Ethernet & PPP
  */
-static struct neigh_ops dn_long_ops = {
+static const struct neigh_ops dn_long_ops = {
        .family =               AF_DECnet,
        .error_report =         dn_long_error_report,
        .output =               dn_long_output,
@@ -71,7 +71,7 @@ static struct neigh_ops dn_long_ops = {
 /*
  * For talking to pointopoint and multidrop devices: DDCMP and X.25
  */
-static struct neigh_ops dn_short_ops = {
+static const struct neigh_ops dn_short_ops = {
        .family =               AF_DECnet,
        .error_report =         dn_short_error_report,
        .output =               dn_short_output,
@@ -83,7 +83,7 @@ static struct neigh_ops dn_short_ops = {
 /*
  * For talking to DECnet phase III nodes
  */
-static struct neigh_ops dn_phase3_ops = {
+static const struct neigh_ops dn_phase3_ops = {
        .family =               AF_DECnet,
        .error_report =         dn_short_error_report, /* Can use short version here */
        .output =               dn_phase3_output,
@@ -204,7 +204,7 @@ static void dn_short_error_report(struct neighbour *neigh, struct sk_buff *skb)
 
 static int dn_neigh_output_packet(struct sk_buff *skb)
 {
-       struct dst_entry *dst = skb->dst;
+       struct dst_entry *dst = skb_dst(skb);
        struct dn_route *rt = (struct dn_route *)dst;
        struct neighbour *neigh = dst->neighbour;
        struct net_device *dev = neigh->dev;
@@ -224,7 +224,7 @@ static int dn_neigh_output_packet(struct sk_buff *skb)
 
 static int dn_long_output(struct sk_buff *skb)
 {
-       struct dst_entry *dst = skb->dst;
+       struct dst_entry *dst = skb_dst(skb);
        struct neighbour *neigh = dst->neighbour;
        struct net_device *dev = neigh->dev;
        int headroom = dev->hard_header_len + sizeof(struct dn_long_packet) + 3;
@@ -250,7 +250,7 @@ static int dn_long_output(struct sk_buff *skb)
        data = skb_push(skb, sizeof(struct dn_long_packet) + 3);
        lp = (struct dn_long_packet *)(data+3);
 
-       *((__le16 *)data) = dn_htons(skb->len - 2);
+       *((__le16 *)data) = cpu_to_le16(skb->len - 2);
        *(data + 2) = 1 | DN_RT_F_PF; /* Padding */
 
        lp->msgflg   = DN_RT_PKT_LONG|(cb->rt_flags&(DN_RT_F_IE|DN_RT_F_RQR|DN_RT_F_RTS));
@@ -270,7 +270,7 @@ static int dn_long_output(struct sk_buff *skb)
 
 static int dn_short_output(struct sk_buff *skb)
 {
-       struct dst_entry *dst = skb->dst;
+       struct dst_entry *dst = skb_dst(skb);
        struct neighbour *neigh = dst->neighbour;
        struct net_device *dev = neigh->dev;
        int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2;
@@ -294,7 +294,7 @@ static int dn_short_output(struct sk_buff *skb)
        }
 
        data = skb_push(skb, sizeof(struct dn_short_packet) + 2);
-       *((__le16 *)data) = dn_htons(skb->len - 2);
+       *((__le16 *)data) = cpu_to_le16(skb->len - 2);
        sp = (struct dn_short_packet *)(data+2);
 
        sp->msgflg     = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS));
@@ -313,7 +313,7 @@ static int dn_short_output(struct sk_buff *skb)
  */
 static int dn_phase3_output(struct sk_buff *skb)
 {
-       struct dst_entry *dst = skb->dst;
+       struct dst_entry *dst = skb_dst(skb);
        struct neighbour *neigh = dst->neighbour;
        struct net_device *dev = neigh->dev;
        int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2;
@@ -336,12 +336,12 @@ static int dn_phase3_output(struct sk_buff *skb)
        }
 
        data = skb_push(skb, sizeof(struct dn_short_packet) + 2);
-       *((__le16 *)data) = dn_htons(skb->len - 2);
+       *((__le16 *)data) = cpu_to_le16(skb->len - 2);
        sp = (struct dn_short_packet *)(data + 2);
 
        sp->msgflg   = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS));
-       sp->dstnode  = cb->dst & dn_htons(0x03ff);
-       sp->srcnode  = cb->src & dn_htons(0x03ff);
+       sp->dstnode  = cb->dst & cpu_to_le16(0x03ff);
+       sp->srcnode  = cb->src & cpu_to_le16(0x03ff);
        sp->forward  = cb->hops & 0x3f;
 
        skb_reset_network_header(skb);
@@ -394,7 +394,7 @@ int dn_neigh_router_hello(struct sk_buff *skb)
                        if (neigh->dev->type == ARPHRD_ETHER)
                                memcpy(neigh->ha, &eth_hdr(skb)->h_source, ETH_ALEN);
 
-                       dn->blksize  = dn_ntohs(msg->blksize);
+                       dn->blksize  = le16_to_cpu(msg->blksize);
                        dn->priority = msg->priority;
 
                        dn->flags &= ~DN_NDFLAG_P3;
@@ -410,7 +410,7 @@ int dn_neigh_router_hello(struct sk_buff *skb)
                }
 
                /* Only use routers in our area */
-               if ((dn_ntohs(src)>>10) == (dn_ntohs((decnet_address))>>10)) {
+               if ((le16_to_cpu(src)>>10) == (le16_to_cpu((decnet_address))>>10)) {
                        if (!dn_db->router) {
                                dn_db->router = neigh_clone(neigh);
                        } else {
@@ -453,7 +453,7 @@ int dn_neigh_endnode_hello(struct sk_buff *skb)
                        if (neigh->dev->type == ARPHRD_ETHER)
                                memcpy(neigh->ha, &eth_hdr(skb)->h_source, ETH_ALEN);
                        dn->flags   &= ~(DN_NDFLAG_R1 | DN_NDFLAG_R2);
-                       dn->blksize  = dn_ntohs(msg->blksize);
+                       dn->blksize  = le16_to_cpu(msg->blksize);
                        dn->priority = 0;
                }
 
@@ -543,7 +543,7 @@ static inline void dn_neigh_format_entry(struct seq_file *seq,
 
        read_lock(&n->lock);
        seq_printf(seq, "%-7s %s%s%s   %02x    %02d  %07ld %-8s\n",
-                  dn_addr2asc(dn_ntohs(dn->addr), buf),
+                  dn_addr2asc(le16_to_cpu(dn->addr), buf),
                   (dn->flags&DN_NDFLAG_R1) ? "1" : "-",
                   (dn->flags&DN_NDFLAG_R2) ? "2" : "-",
                   (dn->flags&DN_NDFLAG_P3) ? "3" : "-",
@@ -580,8 +580,8 @@ static const struct seq_operations dn_neigh_seq_ops = {
 
 static int dn_neigh_seq_open(struct inode *inode, struct file *file)
 {
-       return seq_open_private(file, &dn_neigh_seq_ops,
-                       sizeof(struct neigh_seq_state));
+       return seq_open_net(inode, file, &dn_neigh_seq_ops,
+                           sizeof(struct neigh_seq_state));
 }
 
 static const struct file_operations dn_neigh_seq_fops = {
@@ -589,7 +589,7 @@ static const struct file_operations dn_neigh_seq_fops = {
        .open           = dn_neigh_seq_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = seq_release_private,
+       .release        = seq_release_net,
 };
 
 #endif