diff options
author | David S. Miller <davem@davemloft.net> | 2010-01-23 01:45:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-23 01:45:46 -0500 |
commit | 6be325719b3e54624397e413efd4b33a997e55a3 (patch) | |
tree | 57f321a56794cab2222e179b16731e0d76a4a68a /net/dccp | |
parent | 26d92f9276a56d55511a427fb70bd70886af647a (diff) | |
parent | 92dcffb916d309aa01778bf8963a6932e4014d07 (diff) |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Diffstat (limited to 'net/dccp')
-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 6fcfe8745043..bace1d8cbcfd 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_in_locked(&dccpw.fifo, tbuf, len, &dccpw.lock); |
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_out_locked(&dccpw.fifo, tbuf, len, &dccpw.lock); |
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)) |
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 | ||
@@ -173,14 +171,14 @@ static __init int dccpprobe_init(void) | |||
173 | err1: | 171 | err1: |
174 | proc_net_remove(&init_net, procname); | 172 | proc_net_remove(&init_net, procname); |
175 | err0: | 173 | err0: |
176 | kfifo_free(dccpw.fifo); | 174 | kfifo_free(&dccpw.fifo); |
177 | return ret; | 175 | return ret; |
178 | } | 176 | } |
179 | module_init(dccpprobe_init); | 177 | module_init(dccpprobe_init); |
180 | 178 | ||
181 | static __exit void dccpprobe_exit(void) | 179 | static __exit void dccpprobe_exit(void) |
182 | { | 180 | { |
183 | kfifo_free(dccpw.fifo); | 181 | kfifo_free(&dccpw.fifo); |
184 | proc_net_remove(&init_net, procname); | 182 | proc_net_remove(&init_net, procname); |
185 | unregister_jprobe(&dccp_send_probe); | 183 | unregister_jprobe(&dccp_send_probe); |
186 | 184 | ||