소스 검색

VSOCK: move __vsock_in_bound/connected_table() to af_vsock.h

The vsock_diag.ko module will need to check socket table membership.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Stefan Hajnoczi 7 년 전
부모
커밋
bf359b8127
2개의 변경된 파일12개의 추가작업 그리고 10개의 파일을 삭제
  1. 12 0
      include/net/af_vsock.h
  2. 0 10
      net/vmw_vsock/af_vsock.c

+ 12 - 0
include/net/af_vsock.h

@@ -180,6 +180,18 @@ const struct vsock_transport *vsock_core_get_transport(void);
 
 
 /**** UTILS ****/
 /**** 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_release_pending(struct sock *pending);
 void vsock_add_pending(struct sock *listener, struct sock *pending);
 void vsock_add_pending(struct sock *listener, struct sock *pending);
 void vsock_remove_pending(struct sock *listener, struct sock *pending);
 void vsock_remove_pending(struct sock *listener, struct sock *pending);

+ 0 - 10
net/vmw_vsock/af_vsock.c

@@ -250,16 +250,6 @@ static struct sock *__vsock_find_connected_socket(struct sockaddr_vm *src,
 	return NULL;
 	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)
 static void vsock_insert_unbound(struct vsock_sock *vsk)
 {
 {
 	spin_lock_bh(&vsock_table_lock);
 	spin_lock_bh(&vsock_table_lock);