MIPS: Lasat: Convert to proc_fops / seq_file
[safe/jmp/linux-2.6] / net / sunrpc / sysctl.c
index 0f8c439..e65dcc6 100644 (file)
@@ -56,32 +56,22 @@ rpc_unregister_sysctl(void)
        }
 }
 
-static int proc_do_xprt(ctl_table *table, int write, struct file *file,
+static int proc_do_xprt(ctl_table *table, int write,
                        void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        char tmpbuf[256];
-       int len;
+       size_t len;
+
        if ((*ppos && !write) || !*lenp) {
                *lenp = 0;
                return 0;
        }
-       if (write)
-               return -EINVAL;
-       else {
-               len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
-               if (!access_ok(VERIFY_WRITE, buffer, len))
-                       return -EFAULT;
-
-               if (__copy_to_user(buffer, tmpbuf, len))
-                       return -EFAULT;
-       }
-       *lenp -= len;
-       *ppos += len;
-       return 0;
+       len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
+       return simple_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
 }
 
 static int
-proc_dodebug(ctl_table *table, int write, struct file *file,
+proc_dodebug(ctl_table *table, int write,
                                void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        char            tmpbuf[20], c, *s;
@@ -149,46 +139,45 @@ static ctl_table debug_table[] = {
                .data           = &rpc_debug,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dodebug
+               .proc_handler   = proc_dodebug
        },
        {
                .procname       = "nfs_debug",
                .data           = &nfs_debug,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dodebug
+               .proc_handler   = proc_dodebug
        },
        {
                .procname       = "nfsd_debug",
                .data           = &nfsd_debug,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dodebug
+               .proc_handler   = proc_dodebug
        },
        {
                .procname       = "nlm_debug",
                .data           = &nlm_debug,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dodebug
+               .proc_handler   = proc_dodebug
        },
        {
                .procname       = "transports",
                .maxlen         = 256,
                .mode           = 0444,
-               .proc_handler   = &proc_do_xprt,
+               .proc_handler   = proc_do_xprt,
        },
-       { .ctl_name = 0 }
+       { }
 };
 
 static ctl_table sunrpc_table[] = {
        {
-               .ctl_name       = CTL_SUNRPC,
                .procname       = "sunrpc",
                .mode           = 0555,
                .child          = debug_table
        },
-       { .ctl_name = 0 }
+       { }
 };
 
 #endif