diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-11-08 17:07:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-08 17:07:07 -0500 |
commit | e56c57d0d3fdbbdf583d3af96bfb803b8dfa713e (patch) | |
tree | f415160c8fd39efebfc49d41493cc5b964503482 /net/core/sock.c | |
parent | 9ecd04bc04af7df98b3a93c571e31b6ef6a90681 (diff) |
net: rename sk_clone to sk_clone_lock
Make clear that sk_clone() and inet_csk_clone() return a locked socket.
Add _lock() prefix and kerneldoc.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r-- | net/core/sock.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 4ed7b1d12f5e..2de9dc295956 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1204,7 +1204,14 @@ void sk_release_kernel(struct sock *sk) | |||
1204 | } | 1204 | } |
1205 | EXPORT_SYMBOL(sk_release_kernel); | 1205 | EXPORT_SYMBOL(sk_release_kernel); |
1206 | 1206 | ||
1207 | struct sock *sk_clone(const struct sock *sk, const gfp_t priority) | 1207 | /** |
1208 | * sk_clone_lock - clone a socket, and lock its clone | ||
1209 | * @sk: the socket to clone | ||
1210 | * @priority: for allocation (%GFP_KERNEL, %GFP_ATOMIC, etc) | ||
1211 | * | ||
1212 | * Caller must unlock socket even in error path (bh_unlock_sock(newsk)) | ||
1213 | */ | ||
1214 | struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) | ||
1208 | { | 1215 | { |
1209 | struct sock *newsk; | 1216 | struct sock *newsk; |
1210 | 1217 | ||
@@ -1297,7 +1304,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority) | |||
1297 | out: | 1304 | out: |
1298 | return newsk; | 1305 | return newsk; |
1299 | } | 1306 | } |
1300 | EXPORT_SYMBOL_GPL(sk_clone); | 1307 | EXPORT_SYMBOL_GPL(sk_clone_lock); |
1301 | 1308 | ||
1302 | void sk_setup_caps(struct sock *sk, struct dst_entry *dst) | 1309 | void sk_setup_caps(struct sock *sk, struct dst_entry *dst) |
1303 | { | 1310 | { |