From: Stefan Hajnoczi <stefanha@redhat.com>
To: netdev@vger.kernel.org
Cc: "David S . Miller" <davem@davemloft.net>,
Jorgen Hansen <jhansen@vmware.com>,
Dexuan Cui <decui@microsoft.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PATCH v2 2/5] VSOCK: move __vsock_in_bound/connected_table() to af_vsock.h
Date: Wed, 4 Oct 2017 12:37:13 -0400 [thread overview]
Message-ID: <20171004163716.3964-3-stefanha@redhat.com> (raw)
In-Reply-To: <20171004163716.3964-1-stefanha@redhat.com>
The vsock_diag.ko module will need to check socket table membership.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
include/net/af_vsock.h | 12 ++++++++++++
net/vmw_vsock/af_vsock.c | 10 ----------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
index 30cba806e344..3dd217718a2f 100644
--- a/include/net/af_vsock.h
+++ b/include/net/af_vsock.h
@@ -180,6 +180,18 @@ const struct vsock_transport *vsock_core_get_transport(void);
/**** UTILS ****/
+/* vsock_table_lock must be held */
+static inline bool __vsock_in_bound_table(struct vsock_sock *vsk)
+{
+ return !list_empty(&vsk->bound_table);
+}
+
+/* vsock_table_lock must be held */
+static inline bool __vsock_in_connected_table(struct vsock_sock *vsk)
+{
+ return !list_empty(&vsk->connected_table);
+}
+
void vsock_release_pending(struct sock *pending);
void vsock_add_pending(struct sock *listener, struct sock *pending);
void vsock_remove_pending(struct sock *listener, struct sock *pending);
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 9afe4da8c67d..9b179a0081b3 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -250,16 +250,6 @@ static struct sock *__vsock_find_connected_socket(struct sockaddr_vm *src,
return NULL;
}
-static bool __vsock_in_bound_table(struct vsock_sock *vsk)
-{
- return !list_empty(&vsk->bound_table);
-}
-
-static bool __vsock_in_connected_table(struct vsock_sock *vsk)
-{
- return !list_empty(&vsk->connected_table);
-}
-
static void vsock_insert_unbound(struct vsock_sock *vsk)
{
spin_lock_bh(&vsock_table_lock);
--
2.13.6
next prev parent reply other threads:[~2017-10-04 16:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-04 16:37 [PATCH v2 0/5] VSOCK: add sock_diag interface Stefan Hajnoczi
2017-10-04 16:37 ` [PATCH v2 1/5] VSOCK: export socket tables for " Stefan Hajnoczi
2017-10-04 16:37 ` Stefan Hajnoczi [this message]
2017-10-04 16:37 ` [PATCH v2 3/5] VSOCK: use TCP state constants for sk_state Stefan Hajnoczi
2017-10-04 16:37 ` [PATCH v2 4/5] VSOCK: add sock_diag interface Stefan Hajnoczi
2017-10-04 22:58 ` David Miller
2017-10-04 16:37 ` [PATCH v2 5/5] VSOCK: add tools/testing/vsock/vsock_diag_test Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171004163716.3964-3-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=jhansen@vmware.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.