]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/llc/llc_proc.c
mmc_block: use proper sg iterators
[linux-2.6-omap-h63xx.git] / net / llc / llc_proc.c
index bd531cb235a70c6ea22de33b935307ca04aeea24..48212c0a961ca2f5f73d77a239203c4a206562dc 100644 (file)
  * See the GNU General Public License for more details.
  */
 
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/proc_fs.h>
 #include <linux/errno.h>
 #include <linux/seq_file.h>
+#include <net/net_namespace.h>
 #include <net/sock.h>
 #include <net/llc.h>
 #include <net/llc_c_ac.h>
 #include <net/llc_c_st.h>
 #include <net/llc_conn.h>
 
-static void llc_ui_format_mac(struct seq_file *seq, unsigned char *mac)
+static void llc_ui_format_mac(struct seq_file *seq, u8 *addr)
 {
-       seq_printf(seq, "%02X:%02X:%02X:%02X:%02X:%02X",
-                  mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+       DECLARE_MAC_BUF(mac);
+       seq_printf(seq, "%s", print_mac(mac, addr));
 }
 
 static struct sock *llc_get_sk_idx(loff_t pos)
@@ -128,8 +128,10 @@ static int llc_seq_socket_show(struct seq_file *seq, void *v)
 
        if (llc->dev)
                llc_ui_format_mac(seq, llc->dev->dev_addr);
-       else
-               seq_printf(seq, "00:00:00:00:00:00");
+       else {
+               u8 addr[6] = {0,0,0,0,0,0};
+               llc_ui_format_mac(seq, addr);
+       }
        seq_printf(seq, "@%02X ", llc->sap->laddr.lsap);
        llc_ui_format_mac(seq, llc->daddr.mac);
        seq_printf(seq, "@%02X %8d %8d %2d %3d %4d\n", llc->daddr.lsap,
@@ -143,18 +145,18 @@ out:
 }
 
 static char *llc_conn_state_names[] = {
-       [LLC_CONN_STATE_ADM] =        "adm", 
-       [LLC_CONN_STATE_SETUP] =      "setup", 
+       [LLC_CONN_STATE_ADM] =        "adm",
+       [LLC_CONN_STATE_SETUP] =      "setup",
        [LLC_CONN_STATE_NORMAL] =     "normal",
-       [LLC_CONN_STATE_BUSY] =       "busy", 
-       [LLC_CONN_STATE_REJ] =        "rej", 
-       [LLC_CONN_STATE_AWAIT] =      "await", 
+       [LLC_CONN_STATE_BUSY] =       "busy",
+       [LLC_CONN_STATE_REJ] =        "rej",
+       [LLC_CONN_STATE_AWAIT] =      "await",
        [LLC_CONN_STATE_AWAIT_BUSY] = "await_busy",
        [LLC_CONN_STATE_AWAIT_REJ] =  "await_rej",
        [LLC_CONN_STATE_D_CONN] =     "d_conn",
-       [LLC_CONN_STATE_RESET] =      "reset", 
-       [LLC_CONN_STATE_ERROR] =      "error", 
-       [LLC_CONN_STATE_TEMP] =       "temp", 
+       [LLC_CONN_STATE_RESET] =      "reset",
+       [LLC_CONN_STATE_ERROR] =      "error",
+       [LLC_CONN_STATE_TEMP] =       "temp",
 };
 
 static int llc_seq_core_show(struct seq_file *seq, void *v)
@@ -185,14 +187,14 @@ out:
        return 0;
 }
 
-static struct seq_operations llc_seq_socket_ops = {
+static const struct seq_operations llc_seq_socket_ops = {
        .start  = llc_seq_start,
        .next   = llc_seq_next,
        .stop   = llc_seq_stop,
        .show   = llc_seq_socket_show,
 };
 
-static struct seq_operations llc_seq_core_ops = {
+static const struct seq_operations llc_seq_core_ops = {
        .start  = llc_seq_start,
        .next   = llc_seq_next,
        .stop   = llc_seq_stop,
@@ -209,7 +211,7 @@ static int llc_seq_core_open(struct inode *inode, struct file *file)
        return seq_open(file, &llc_seq_core_ops);
 }
 
-static struct file_operations llc_seq_socket_fops = {
+static const struct file_operations llc_seq_socket_fops = {
        .owner          = THIS_MODULE,
        .open           = llc_seq_socket_open,
        .read           = seq_read,
@@ -217,7 +219,7 @@ static struct file_operations llc_seq_socket_fops = {
        .release        = seq_release,
 };
 
-static struct file_operations llc_seq_core_fops = {
+static const struct file_operations llc_seq_core_fops = {
        .owner          = THIS_MODULE,
        .open           = llc_seq_core_open,
        .read           = seq_read,
@@ -232,30 +234,26 @@ int __init llc_proc_init(void)
        int rc = -ENOMEM;
        struct proc_dir_entry *p;
 
-       llc_proc_dir = proc_mkdir("llc", proc_net);
+       llc_proc_dir = proc_mkdir("llc", init_net.proc_net);
        if (!llc_proc_dir)
                goto out;
        llc_proc_dir->owner = THIS_MODULE;
 
-       p = create_proc_entry("socket", S_IRUGO, llc_proc_dir);
+       p = proc_create("socket", S_IRUGO, llc_proc_dir, &llc_seq_socket_fops);
        if (!p)
                goto out_socket;
 
-       p->proc_fops = &llc_seq_socket_fops;
-
-       p = create_proc_entry("core", S_IRUGO, llc_proc_dir);
+       p = proc_create("core", S_IRUGO, llc_proc_dir, &llc_seq_core_fops);
        if (!p)
                goto out_core;
 
-       p->proc_fops = &llc_seq_core_fops;
-
        rc = 0;
 out:
        return rc;
 out_core:
        remove_proc_entry("socket", llc_proc_dir);
 out_socket:
-       remove_proc_entry("llc", proc_net);
+       remove_proc_entry("llc", init_net.proc_net);
        goto out;
 }
 
@@ -263,5 +261,5 @@ void llc_proc_exit(void)
 {
        remove_proc_entry("socket", llc_proc_dir);
        remove_proc_entry("core", llc_proc_dir);
-       remove_proc_entry("llc", proc_net);
+       remove_proc_entry("llc", init_net.proc_net);
 }