diff options
author | John Heffner <jheffner@psc.edu> | 2007-09-12 04:44:19 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:01 -0400 |
commit | d2e9117c7aa9544d910634e17e3519fd67155229 (patch) | |
tree | 531507ed5d2031fa80775036fec1b57584a236cb | |
parent | 02b3d34631831a19ee691516e233756b270eac6d (diff) |
[NET]: Change type of owner in sock_lock_t to int, rename
The type of owner in sock_lock_t is currently (struct sock_iocb *),
presumably for historical reasons. It is never used as this type, only
tested as NULL or set to (void *)1. For clarity, this changes it to type
int, and renames to owned, to avoid any possible type casting errors.
Signed-off-by: John Heffner <jheffner@psc.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/sock.h | 7 | ||||
-rw-r--r-- | net/core/sock.c | 6 |
2 files changed, 6 insertions, 7 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 802c670ba820..5ed9fa42b6e8 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -76,10 +76,9 @@ | |||
76 | * between user contexts and software interrupt processing, whereas the | 76 | * between user contexts and software interrupt processing, whereas the |
77 | * mini-semaphore synchronizes multiple users amongst themselves. | 77 | * mini-semaphore synchronizes multiple users amongst themselves. |
78 | */ | 78 | */ |
79 | struct sock_iocb; | ||
80 | typedef struct { | 79 | typedef struct { |
81 | spinlock_t slock; | 80 | spinlock_t slock; |
82 | struct sock_iocb *owner; | 81 | int owned; |
83 | wait_queue_head_t wq; | 82 | wait_queue_head_t wq; |
84 | /* | 83 | /* |
85 | * We express the mutex-alike socket_lock semantics | 84 | * We express the mutex-alike socket_lock semantics |
@@ -737,7 +736,7 @@ static inline int sk_stream_wmem_schedule(struct sock *sk, int size) | |||
737 | * Since ~2.3.5 it is also exclusive sleep lock serializing | 736 | * Since ~2.3.5 it is also exclusive sleep lock serializing |
738 | * accesses from user process context. | 737 | * accesses from user process context. |
739 | */ | 738 | */ |
740 | #define sock_owned_by_user(sk) ((sk)->sk_lock.owner) | 739 | #define sock_owned_by_user(sk) ((sk)->sk_lock.owned) |
741 | 740 | ||
742 | /* | 741 | /* |
743 | * Macro so as to not evaluate some arguments when | 742 | * Macro so as to not evaluate some arguments when |
@@ -748,7 +747,7 @@ static inline int sk_stream_wmem_schedule(struct sock *sk, int size) | |||
748 | */ | 747 | */ |
749 | #define sock_lock_init_class_and_name(sk, sname, skey, name, key) \ | 748 | #define sock_lock_init_class_and_name(sk, sname, skey, name, key) \ |
750 | do { \ | 749 | do { \ |
751 | sk->sk_lock.owner = NULL; \ | 750 | sk->sk_lock.owned = 0; \ |
752 | init_waitqueue_head(&sk->sk_lock.wq); \ | 751 | init_waitqueue_head(&sk->sk_lock.wq); \ |
753 | spin_lock_init(&(sk)->sk_lock.slock); \ | 752 | spin_lock_init(&(sk)->sk_lock.slock); \ |
754 | debug_check_no_locks_freed((void *)&(sk)->sk_lock, \ | 753 | debug_check_no_locks_freed((void *)&(sk)->sk_lock, \ |
diff --git a/net/core/sock.c b/net/core/sock.c index 190de61cd648..beb924c248e8 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1585,9 +1585,9 @@ void fastcall lock_sock_nested(struct sock *sk, int subclass) | |||
1585 | { | 1585 | { |
1586 | might_sleep(); | 1586 | might_sleep(); |
1587 | spin_lock_bh(&sk->sk_lock.slock); | 1587 | spin_lock_bh(&sk->sk_lock.slock); |
1588 | if (sk->sk_lock.owner) | 1588 | if (sk->sk_lock.owned) |
1589 | __lock_sock(sk); | 1589 | __lock_sock(sk); |
1590 | sk->sk_lock.owner = (void *)1; | 1590 | sk->sk_lock.owned = 1; |
1591 | spin_unlock(&sk->sk_lock.slock); | 1591 | spin_unlock(&sk->sk_lock.slock); |
1592 | /* | 1592 | /* |
1593 | * The sk_lock has mutex_lock() semantics here: | 1593 | * The sk_lock has mutex_lock() semantics here: |
@@ -1608,7 +1608,7 @@ void fastcall release_sock(struct sock *sk) | |||
1608 | spin_lock_bh(&sk->sk_lock.slock); | 1608 | spin_lock_bh(&sk->sk_lock.slock); |
1609 | if (sk->sk_backlog.tail) | 1609 | if (sk->sk_backlog.tail) |
1610 | __release_sock(sk); | 1610 | __release_sock(sk); |
1611 | sk->sk_lock.owner = NULL; | 1611 | sk->sk_lock.owned = 0; |
1612 | if (waitqueue_active(&sk->sk_lock.wq)) | 1612 | if (waitqueue_active(&sk->sk_lock.wq)) |
1613 | wake_up(&sk->sk_lock.wq); | 1613 | wake_up(&sk->sk_lock.wq); |
1614 | spin_unlock_bh(&sk->sk_lock.slock); | 1614 | spin_unlock_bh(&sk->sk_lock.slock); |