diff options
Diffstat (limited to 'net/dccp/probe.c')
-rw-r--r-- | net/dccp/probe.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/net/dccp/probe.c b/net/dccp/probe.c index dc328425fa20..6230ceb0823e 100644 --- a/net/dccp/probe.c +++ b/net/dccp/probe.c | |||
@@ -43,7 +43,7 @@ static int bufsize = 64 * 1024; | |||
43 | static const char procname[] = "dccpprobe"; | 43 | static const char procname[] = "dccpprobe"; |
44 | 44 | ||
45 | static struct { | 45 | static struct { |
46 | struct kfifo *fifo; | 46 | struct kfifo fifo; |
47 | spinlock_t lock; | 47 | spinlock_t lock; |
48 | wait_queue_head_t wait; | 48 | wait_queue_head_t wait; |
49 | struct timespec tstart; | 49 | struct timespec tstart; |
@@ -67,7 +67,7 @@ static void printl(const char *fmt, ...) | |||
67 | len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args); | 67 | len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args); |
68 | va_end(args); | 68 | va_end(args); |
69 | 69 | ||
70 | kfifo_put(dccpw.fifo, tbuf, len); | 70 | kfifo_put(&dccpw.fifo, tbuf, len); |
71 | wake_up(&dccpw.wait); | 71 | wake_up(&dccpw.wait); |
72 | } | 72 | } |
73 | 73 | ||
@@ -109,7 +109,7 @@ static struct jprobe dccp_send_probe = { | |||
109 | 109 | ||
110 | static int dccpprobe_open(struct inode *inode, struct file *file) | 110 | static int dccpprobe_open(struct inode *inode, struct file *file) |
111 | { | 111 | { |
112 | kfifo_reset(dccpw.fifo); | 112 | kfifo_reset(&dccpw.fifo); |
113 | getnstimeofday(&dccpw.tstart); | 113 | getnstimeofday(&dccpw.tstart); |
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
@@ -131,11 +131,11 @@ static ssize_t dccpprobe_read(struct file *file, char __user *buf, | |||
131 | return -ENOMEM; | 131 | return -ENOMEM; |
132 | 132 | ||
133 | error = wait_event_interruptible(dccpw.wait, | 133 | error = wait_event_interruptible(dccpw.wait, |
134 | __kfifo_len(dccpw.fifo) != 0); | 134 | __kfifo_len(&dccpw.fifo) != 0); |
135 | if (error) | 135 | if (error) |
136 | goto out_free; | 136 | goto out_free; |
137 | 137 | ||
138 | cnt = kfifo_get(dccpw.fifo, tbuf, len); | 138 | cnt = kfifo_get(&dccpw.fifo, tbuf, len); |
139 | error = copy_to_user(buf, tbuf, cnt) ? -EFAULT : 0; | 139 | error = copy_to_user(buf, tbuf, cnt) ? -EFAULT : 0; |
140 | 140 | ||
141 | out_free: | 141 | out_free: |
@@ -156,10 +156,8 @@ static __init int dccpprobe_init(void) | |||
156 | 156 | ||
157 | init_waitqueue_head(&dccpw.wait); | 157 | init_waitqueue_head(&dccpw.wait); |
158 | spin_lock_init(&dccpw.lock); | 158 | spin_lock_init(&dccpw.lock); |
159 | dccpw.fifo = kfifo_alloc(bufsize, GFP_KERNEL, &dccpw.lock); | 159 | if (kfifo_alloc(&dccpw.fifo, bufsize, GFP_KERNEL, &dccpw.lock)) |
160 | if (IS_ERR(dccpw.fifo)) | 160 | return ret; |
161 | return PTR_ERR(dccpw.fifo); | ||
162 | |||
163 | if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops)) | 161 | if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops)) |
164 | goto err0; | 162 | goto err0; |
165 | 163 | ||
@@ -172,14 +170,14 @@ static __init int dccpprobe_init(void) | |||
172 | err1: | 170 | err1: |
173 | proc_net_remove(&init_net, procname); | 171 | proc_net_remove(&init_net, procname); |
174 | err0: | 172 | err0: |
175 | kfifo_free(dccpw.fifo); | 173 | kfifo_free(&dccpw.fifo); |
176 | return ret; | 174 | return ret; |
177 | } | 175 | } |
178 | module_init(dccpprobe_init); | 176 | module_init(dccpprobe_init); |
179 | 177 | ||
180 | static __exit void dccpprobe_exit(void) | 178 | static __exit void dccpprobe_exit(void) |
181 | { | 179 | { |
182 | kfifo_free(dccpw.fifo); | 180 | kfifo_free(&dccpw.fifo); |
183 | proc_net_remove(&init_net, procname); | 181 | proc_net_remove(&init_net, procname); |
184 | unregister_jprobe(&dccp_send_probe); | 182 | unregister_jprobe(&dccp_send_probe); |
185 | 183 | ||