]> Pileus Git - ~andy/linux/blobdiff - net/dccp/probe.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[~andy/linux] / net / dccp / probe.c
index 43a3adb027e7593ba9b15b366f3ae7d1b7843325..0bcdc92502794867b7254bc338044555b6493245 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/module.h>
 #include <linux/kfifo.h>
 #include <linux/vmalloc.h>
+#include <net/net_namespace.h>
 
 #include "dccp.h"
 #include "ccid.h"
@@ -45,29 +46,24 @@ struct {
        struct kfifo      *fifo;
        spinlock_t        lock;
        wait_queue_head_t wait;
-       struct timeval    tstart;
+       struct timespec   tstart;
 } dccpw;
 
 static void printl(const char *fmt, ...)
 {
        va_list args;
        int len;
-       struct timeval now;
+       struct timespec now;
        char tbuf[256];
 
        va_start(args, fmt);
-       do_gettimeofday(&now);
+       getnstimeofday(&now);
 
-       now.tv_sec -= dccpw.tstart.tv_sec;
-       now.tv_usec -= dccpw.tstart.tv_usec;
-       if (now.tv_usec < 0) {
-               --now.tv_sec;
-               now.tv_usec += 1000000;
-       }
+       now = timespec_sub(now, dccpw.tstart);
 
        len = sprintf(tbuf, "%lu.%06lu ",
                      (unsigned long) now.tv_sec,
-                     (unsigned long) now.tv_usec);
+                     (unsigned long) now.tv_nsec / NSEC_PER_USEC);
        len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args);
        va_end(args);
 
@@ -112,13 +108,13 @@ static struct jprobe dccp_send_probe = {
        .kp     = {
                .symbol_name = "dccp_sendmsg",
        },
-       .entry  = JPROBE_ENTRY(jdccp_sendmsg),
+       .entry  = jdccp_sendmsg,
 };
 
 static int dccpprobe_open(struct inode *inode, struct file *file)
 {
        kfifo_reset(dccpw.fifo);
-       do_gettimeofday(&dccpw.tstart);
+       getnstimeofday(&dccpw.tstart);
        return 0;
 }
 
@@ -144,7 +140,7 @@ static ssize_t dccpprobe_read(struct file *file, char __user *buf,
                goto out_free;
 
        cnt = kfifo_get(dccpw.fifo, tbuf, len);
-       error = copy_to_user(buf, tbuf, cnt);
+       error = copy_to_user(buf, tbuf, cnt) ? -EFAULT : 0;
 
 out_free:
        vfree(tbuf);
@@ -168,7 +164,7 @@ static __init int dccpprobe_init(void)
        if (IS_ERR(dccpw.fifo))
                return PTR_ERR(dccpw.fifo);
 
-       if (!proc_net_fops_create(procname, S_IRUSR, &dccpprobe_fops))
+       if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops))
                goto err0;
 
        ret = register_jprobe(&dccp_send_probe);
@@ -178,7 +174,7 @@ static __init int dccpprobe_init(void)
        pr_info("DCCP watch registered (port=%d)\n", port);
        return 0;
 err1:
-       proc_net_remove(procname);
+       proc_net_remove(&init_net, procname);
 err0:
        kfifo_free(dccpw.fifo);
        return ret;
@@ -188,7 +184,7 @@ module_init(dccpprobe_init);
 static __exit void dccpprobe_exit(void)
 {
        kfifo_free(dccpw.fifo);
-       proc_net_remove(procname);
+       proc_net_remove(&init_net, procname);
        unregister_jprobe(&dccp_send_probe);
 
 }