From: Benjamin LaHaise <bcrl@xxxxxxxxxx>
Date: Mon, 7 Oct 2002 17:55:51 -0400
We define this:
+#define sock_is_locked(sk) (NULL != (sk)->lock.owner)
But call:
+ (int)is_sock_locked(sk));
+ if (!is_sock_locked(sk))
...
- if (sk->lock.users != 0) {
+ if (is_sock_locked(sk)) {
And it's not a lock, it is a user ownership indication.
I'd therefore prefer "sock_owned_by_user" or similar.
Next:
+#define async_lock_sock(iocb, __sk, list) \
+({ int ret = 0; \
+ spin_lock_bh(&((__sk)->lock.slock)); \
+ if ((__sk)->lock.owner != NULL) \
+ ret = __async_lock_sock((iocb), (__sk), (list)); \
+ else \
+ (__sk)->lock.owner = (iocb); \
+ spin_unlock_bh(&((__sk)->lock.slock)); \
+ ret; \
+})
+
How does this work? Is there some protocol that treats (void *)1
specially inside of __async_lock_sock()? Where are this semantics
defined?
Please clean up the {is_sock,sock_is}_locked() stuff and define
how async_lock_sock works wrt. the owner pointer.
|