block: fix duplicate headers for /proc/partitions
[safe/jmp/linux-2.6] / net / atm / lec.c
index 1a8c4c6..5799fb5 100644 (file)
@@ -65,36 +65,36 @@ static int lec_close(struct net_device *dev);
 static struct net_device_stats *lec_get_stats(struct net_device *dev);
 static void lec_init(struct net_device *dev);
 static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
-                                         unsigned char *mac_addr);
+                                         const unsigned char *mac_addr);
 static int lec_arp_remove(struct lec_priv *priv,
                          struct lec_arp_table *to_remove);
 /* LANE2 functions */
-static void lane2_associate_ind(struct net_device *dev, u8 *mac_address,
-                               u8 *tlvs, u32 sizeoftlvs);
-static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force,
+static void lane2_associate_ind(struct net_device *dev, const u8 *mac_address,
+                               const u8 *tlvs, u32 sizeoftlvs);
+static int lane2_resolve(struct net_device *dev, const u8 *dst_mac, int force,
                         u8 **tlvs, u32 *sizeoftlvs);
-static int lane2_associate_req(struct net_device *dev, u8 *lan_dst,
-                              u8 *tlvs, u32 sizeoftlvs);
+static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst,
+                              const u8 *tlvs, u32 sizeoftlvs);
 
-static int lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr,
+static int lec_addr_delete(struct lec_priv *priv, const unsigned char *atm_addr,
                           unsigned long permanent);
 static void lec_arp_check_empties(struct lec_priv *priv,
                                  struct atm_vcc *vcc, struct sk_buff *skb);
 static void lec_arp_destroy(struct lec_priv *priv);
 static void lec_arp_init(struct lec_priv *priv);
 static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
-                                      unsigned char *mac_to_find,
+                                      const unsigned char *mac_to_find,
                                       int is_rdesc,
                                       struct lec_arp_table **ret_entry);
-static void lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr,
-                          unsigned char *atm_addr, unsigned long remoteflag,
+static void lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr,
+                          const unsigned char *atm_addr, unsigned long remoteflag,
                           unsigned int targetless_le_arp);
 static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id);
 static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc);
 static void lec_set_flush_tran_id(struct lec_priv *priv,
-                                 unsigned char *atm_addr,
+                                 const unsigned char *atm_addr,
                                  unsigned long tran_id);
-static void lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data,
+static void lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data,
                          struct atm_vcc *vcc,
                          void (*old_push) (struct atm_vcc *vcc,
                                            struct sk_buff *skb));
@@ -266,7 +266,6 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
        char buf[300];
        int i = 0;
 #endif /* DUMP_PACKETS >0 */
-       DECLARE_MAC_BUF(mac);
 
        pr_debug("lec_start_xmit called\n");
        if (!priv->lecd) {
@@ -374,15 +373,19 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
                if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) {
                        pr_debug("%s:lec_start_xmit: queuing packet, ",
                                dev->name);
-                       pr_debug("MAC address %s\n",
-                                print_mac(mac, lec_h->h_dest));
+                       pr_debug("MAC address " MAC_FMT "\n",
+                                lec_h->h_dest[0], lec_h->h_dest[1],
+                                lec_h->h_dest[2], lec_h->h_dest[3],
+                                lec_h->h_dest[4], lec_h->h_dest[5]);
                        skb_queue_tail(&entry->tx_wait, skb);
                } else {
                        pr_debug
                            ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ",
                             dev->name);
-                       pr_debug("MAC address %s\n",
-                                print_mac(mac, lec_h->h_dest));
+                       pr_debug("MAC address " MAC_FMT "\n",
+                                lec_h->h_dest[0], lec_h->h_dest[1],
+                                lec_h->h_dest[2], lec_h->h_dest[3],
+                                lec_h->h_dest[4], lec_h->h_dest[5]);
                        priv->stats.tx_dropped++;
                        dev_kfree_skb(skb);
                }
@@ -394,8 +397,10 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) {
                pr_debug("lec.c: emptying tx queue, ");
-               pr_debug("MAC address %s\n",
-                        print_mac(mac, lec_h->h_dest));
+               pr_debug("MAC address " MAC_FMT "\n",
+                        lec_h->h_dest[0], lec_h->h_dest[1],
+                        lec_h->h_dest[2], lec_h->h_dest[3],
+                        lec_h->h_dest[4], lec_h->h_dest[5]);
                lec_send(vcc, skb2, priv);
        }
 
@@ -449,7 +454,6 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
        struct lec_arp_table *entry;
        int i;
        char *tmp;              /* FIXME */
-       DECLARE_MAC_BUF(mac);
 
        atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
        mesg = (struct atmlec_msg *)skb->data;
@@ -536,9 +540,14 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
                        struct net_bridge_fdb_entry *f;
 
                        pr_debug
-                           ("%s: bridge zeppelin asks about %s\n",
+                           ("%s: bridge zeppelin asks about " MAC_FMT "\n",
                             dev->name,
-                            print_mac(mac, mesg->content.proxy.mac_addr));
+                            mesg->content.proxy.mac_addr[0],
+                            mesg->content.proxy.mac_addr[1],
+                            mesg->content.proxy.mac_addr[2],
+                            mesg->content.proxy.mac_addr[3],
+                            mesg->content.proxy.mac_addr[4],
+                            mesg->content.proxy.mac_addr[5]);
 
                        if (br_fdb_get_hook == NULL || dev->br_port == NULL)
                                break;
@@ -625,7 +634,7 @@ static struct atm_dev lecatm_dev = {
  */
 static int
 send_to_lecd(struct lec_priv *priv, atmlec_msg_type type,
-            unsigned char *mac_addr, unsigned char *atm_addr,
+            const unsigned char *mac_addr, const unsigned char *atm_addr,
             struct sk_buff *data)
 {
        struct sock *sk;
@@ -696,10 +705,9 @@ static void lec_init(struct net_device *dev)
        dev->set_multicast_list = lec_set_multicast_list;
        dev->do_ioctl = NULL;
        printk("%s: Initialized!\n", dev->name);
-       return;
 }
 
-static unsigned char lec_ctrl_magic[] = {
+static const unsigned char lec_ctrl_magic[] = {
        0xff,
        0x00,
        0x01,
@@ -1014,7 +1022,7 @@ static void *lec_tbl_walk(struct lec_state *state, struct hlist_head *tbl,
 
        if (!e)
                e = tbl->first;
-       if (e == (void *)1) {
+       if (e == SEQ_START_TOKEN) {
                e = tbl->first;
                --*l;
        }
@@ -1116,9 +1124,9 @@ static void *lec_seq_start(struct seq_file *seq, loff_t *pos)
        state->locked = NULL;
        state->arp_table = 0;
        state->misc_table = 0;
-       state->node = (void *)1;
+       state->node = SEQ_START_TOKEN;
 
-       return *pos ? lec_get_idx(state, *pos) : (void *)1;
+       return *pos ? lec_get_idx(state, *pos) : SEQ_START_TOKEN;
 }
 
 static void lec_seq_stop(struct seq_file *seq, void *v)
@@ -1147,7 +1155,7 @@ static int lec_seq_show(struct seq_file *seq, void *v)
            "                          Status            Flags "
            "VPI/VCI Recv VPI/VCI\n";
 
-       if (v == (void *)1)
+       if (v == SEQ_START_TOKEN)
                seq_puts(seq, lec_banner);
        else {
                struct lec_state *state = seq->private;
@@ -1169,32 +1177,7 @@ static const struct seq_operations lec_seq_ops = {
 
 static int lec_seq_open(struct inode *inode, struct file *file)
 {
-       struct lec_state *state;
-       struct seq_file *seq;
-       int rc = -EAGAIN;
-
-       state = kmalloc(sizeof(*state), GFP_KERNEL);
-       if (!state) {
-               rc = -ENOMEM;
-               goto out;
-       }
-
-       rc = seq_open(file, &lec_seq_ops);
-       if (rc)
-               goto out_kfree;
-       seq = file->private_data;
-       seq->private = state;
-out:
-       return rc;
-
-out_kfree:
-       kfree(state);
-       goto out;
-}
-
-static int lec_seq_release(struct inode *inode, struct file *file)
-{
-       return seq_release_private(inode, file);
+       return seq_open_private(file, &lec_seq_ops, sizeof(struct lec_state));
 }
 
 static const struct file_operations lec_seq_fops = {
@@ -1202,7 +1185,7 @@ static const struct file_operations lec_seq_fops = {
        .open = lec_seq_open,
        .read = seq_read,
        .llseek = seq_lseek,
-       .release = lec_seq_release,
+       .release = seq_release_private,
 };
 #endif
 
@@ -1249,9 +1232,11 @@ static int __init lane_module_init(void)
 #ifdef CONFIG_PROC_FS
        struct proc_dir_entry *p;
 
-       p = create_proc_entry("lec", S_IRUGO, atm_proc_root);
-       if (p)
-               p->proc_fops = &lec_seq_fops;
+       p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops);
+       if (!p) {
+               printk(KERN_ERR "Unable to initialize /proc/net/atm/lec\n");
+               return -ENOMEM;
+       }
 #endif
 
        register_atm_ioctl(&lane_ioctl_ops);
@@ -1290,7 +1275,7 @@ module_exit(lane_module_cleanup);
  * lec will be used.
  * If dst_mac == NULL, targetless LE_ARP will be sent
  */
-static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force,
+static int lane2_resolve(struct net_device *dev, const u8 *dst_mac, int force,
                         u8 **tlvs, u32 *sizeoftlvs)
 {
        unsigned long flags;
@@ -1336,8 +1321,8 @@ static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force,
  * Returns 1 for success, 0 for failure (out of memory)
  *
  */
-static int lane2_associate_req(struct net_device *dev, u8 *lan_dst,
-                              u8 *tlvs, u32 sizeoftlvs)
+static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst,
+                              const u8 *tlvs, u32 sizeoftlvs)
 {
        int retval;
        struct sk_buff *skb;
@@ -1372,8 +1357,8 @@ static int lane2_associate_req(struct net_device *dev, u8 *lan_dst,
  * LANE2: 3.1.5, LE_ASSOCIATE.indication
  *
  */
-static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr,
-                               u8 *tlvs, u32 sizeoftlvs)
+static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr,
+                               const u8 *tlvs, u32 sizeoftlvs)
 {
 #if 0
        int i = 0;
@@ -1758,7 +1743,7 @@ static void lec_arp_destroy(struct lec_priv *priv)
  * Find entry by mac_address
  */
 static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
-                                         unsigned char *mac_addr)
+                                         const unsigned char *mac_addr)
 {
        struct hlist_node *node;
        struct hlist_head *head;
@@ -1778,7 +1763,7 @@ static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
 }
 
 static struct lec_arp_table *make_entry(struct lec_priv *priv,
-                                       unsigned char *mac_addr)
+                                       const unsigned char *mac_addr)
 {
        struct lec_arp_table *to_return;
 
@@ -1935,7 +1920,7 @@ restart:
  *
  */
 static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
-                                      unsigned char *mac_to_find, int is_rdesc,
+                                      const unsigned char *mac_to_find, int is_rdesc,
                                       struct lec_arp_table **ret_entry)
 {
        unsigned long flags;
@@ -2031,7 +2016,7 @@ out:
 }
 
 static int
-lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr,
+lec_addr_delete(struct lec_priv *priv, const unsigned char *atm_addr,
                unsigned long permanent)
 {
        unsigned long flags;
@@ -2061,8 +2046,8 @@ lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr,
  * Notifies:  Response to arp_request (atm_addr != NULL)
  */
 static void
-lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr,
-              unsigned char *atm_addr, unsigned long remoteflag,
+lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr,
+              const unsigned char *atm_addr, unsigned long remoteflag,
               unsigned int targetless_le_arp)
 {
        unsigned long flags;
@@ -2162,7 +2147,7 @@ out:
  * Notifies: Vcc setup ready
  */
 static void
-lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data,
+lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data,
              struct atm_vcc *vcc,
              void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb))
 {
@@ -2350,7 +2335,7 @@ restart:
 
 static void
 lec_set_flush_tran_id(struct lec_priv *priv,
-                     unsigned char *atm_addr, unsigned long tran_id)
+                     const unsigned char *atm_addr, unsigned long tran_id)
 {
        unsigned long flags;
        struct hlist_node *node;