#include <linux/stddef.h> /* for NULL */
#include <net/sock.h>
-/*
- * Between 2.5.70 and 2.5.71 all sock members were renamed from XXX to sk_XXX.
- */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 71)
-# define compat_sk_backlog_rcv backlog_rcv
-# define compat_sk_destruct destruct
-# define compat_sk_shutdown shutdown
-# define compat_sk_receive_queue receive_queue
-# define compat_sk_sleep sleep
-# define compat_sk_err err
-# define compat_sk_state_change state_change
-# define compat_sk_data_ready data_ready
-# define compat_sk_write_space write_space
-# define compat_sk_error_report error_report
-# define compat_sk_type type
-# define compat_sk_refcnt refcnt
-# define compat_sk_state state
-# define compat_sk_error_report error_report
-# define compat_sk_socket socket
-# define compat_sk_ack_backlog ack_backlog
-# define compat_sk_max_ack_backlog max_ack_backlog
-# define compat_sk_user_data user_data
-# define compat_sk_rcvtimeo rcvtimeo
-#else
-# define compat_sk_backlog_rcv sk_backlog_rcv
-# define compat_sk_destruct sk_destruct
-# define compat_sk_shutdown sk_shutdown
-# define compat_sk_receive_queue sk_receive_queue
-# define compat_sk_sleep sk_sleep
-# define compat_sk_err sk_err
-# define compat_sk_state_change sk_state_change
-# define compat_sk_data_ready sk_data_ready
-# define compat_sk_write_space sk_write_space
-# define compat_sk_error_report sk_error_report
-# define compat_sk_type sk_type
-# define compat_sk_refcnt sk_refcnt
-# define compat_sk_state sk_state
-# define compat_sk_error_report sk_error_report
-# define compat_sk_socket sk_socket
-# define compat_sk_ack_backlog sk_ack_backlog
-# define compat_sk_max_ack_backlog sk_max_ack_backlog
-# define compat_sk_user_data sk_user_data
-# define compat_sk_rcvtimeo sk_rcvtimeo
-#endif
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
static inline wait_queue_head_t *sk_sleep(struct sock *sk)
{
- return sk->compat_sk_sleep;
+ return sk->sk_sleep;
}
#endif
-/*
- * Prior to 2.5.65, struct sock contained individual fields for certain
- * socket flags including SOCK_DONE. Between 2.5.65 and 2.5.71 these were
- * replaced with a bitmask but the generic bit test functions were used.
- * In 2.5.71, these were replaced with socket specific functions.
- */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 71)
-# define compat_sock_test_done(sk) sock_flag(sk, SOCK_DONE)
-# define compat_sock_set_done(sk) sock_set_flag(sk, SOCK_DONE)
-# define compat_sock_reset_done(sk) sock_reset_flag(sk, SOCK_DONE)
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 65)
-# define compat_sock_test_done(sk) test_bit(SOCK_DONE, &(sk)->flags)
-# define compat_sock_set_done(sk) __set_bit(SOCK_DONE, &(sk)->flags)
-# define compat_sock_reset_done(sk) __clear_bit(SOCK_DONE, &(sk)->flags)
-#else
-# define compat_sock_test_done(sk) (sk)->done
-# define compat_sock_set_done(sk) ((sk)->done = 1)
-# define compat_sock_reset_done(sk) ((sk)->done = 0)
-#endif
-
/*
* Prior to 2.6.24, there was no sock network namespace member. In 2.6.26, it
# define compat_sock_net(sk) sk->sk_net
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 42)
-# define compat_sock_owned_by_user(sk) ((sk)->lock.users != 0)
-#else
-# define compat_sock_owned_by_user(sk) sock_owned_by_user(sk)
-#endif
-
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
#ifndef CONFIG_FILTER
} else { \
skb->dev = NULL; \
bh_lock_sock(sk); \
- if (!compat_sock_owned_by_user(sk)) { \
- rc = (sk)->compat_sk_backlog_rcv(sk, skb); \
+ if (!sock_owned_by_user(sk)) { \
+ rc = (sk)->sk_backlog_rcv(sk, skb); \
} else { \
sk_add_backlog(sk, skb); \
} \
# define compat_sk_receive_skb(sk, skb, nested) sk_receive_skb(sk, skb, nested)
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 72)
-/*
- * Before 2.5.72, the helper socket functions for hlist management did not
- * exist, so we use the sklist_ functions instead. These are not ideal since
- * they grab a system-wide sklist lock despite not needing it since we provide
- * our own list.
- */
-#define compat_sk_next next /* for when we find out it became sk_next */
-# define compat_sklist_table struct sock *
-/* This isn't really used in the iterator, but we need something. */
-# define compat_sklist_table_entry struct sock
-# define compat_sk_for_each(sk, node, list) \
- for (sk = *(list), node = NULL; sk != NULL; sk = (sk)->compat_sk_next)
-# define compat_sk_add_node(sk, list) sklist_insert_socket(list, sk)
-# define compat_sk_del_node_init(sk, list) sklist_remove_socket(list, sk)
-#else
-# define compat_sklist_table struct hlist_head
-# define compat_sklist_table_entry struct hlist_node
-# define compat_sk_for_each(sk, node, list) sk_for_each(sk, node, list)
-# define compat_sk_add_node(sk, list) sk_add_node(sk, list)
-# define compat_sk_del_node_init(sk, list) sk_del_node_init(sk)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 6)
-# define compat_sock_create_kern sock_create
-#else
-# define compat_sock_create_kern sock_create_kern
-#endif
-
#endif /* __COMPAT_SOCK_H__ */
sk = (struct sock *)data;
ASSERT(sk);
- /* XXX Figure out why sk->compat_sk_socket can be NULL. */
- ASSERT(sk->compat_sk_socket ? sk->compat_sk_socket->type == SOCK_DGRAM : 1);
+ /* XXX Figure out why sk->sk_socket can be NULL. */
+ ASSERT(sk->sk_socket ? sk->sk_socket->type == SOCK_DGRAM : 1);
size = VMCI_DG_SIZE(dg);
*/
bh_lock_sock(sk);
- if (!compat_sock_owned_by_user(sk) && sk->compat_sk_state == SS_CONNECTED) {
+ if (!sock_owned_by_user(sk) && sk->sk_state == SS_CONNECTED) {
NOTIFYCALL(vsk, handleNotifyPkt, sk, pkt, TRUE, &dst, &src, &bhProcessPkt);
}
if (!VMCI_HANDLE_INVALID(vsk->qpHandle)) {
ASSERT(vsk->qpair);
- compat_sock_set_done(sk);
+ sock_set_flag(sk, SOCK_DONE);
/* On a detach the peer will not be sending or receiving anymore. */
vsk->peerShutdown = SHUTDOWN_MASK;
* queue.
*/
if (VSockVmciStreamHasData(vsk) <= 0) {
- sk->compat_sk_state = SS_UNCONNECTED;
+ sk->sk_state = SS_UNCONNECTED;
}
- sk->compat_sk_state_change(sk);
+ sk->sk_state_change(sk);
}
}
goto out;
}
- listener->compat_sk_ack_backlog--;
+ listener->sk_ack_backlog--;
/*
* We need to remove ourself from the global connected sockets list so
VSockVmciRemoveConnected(sk);
}
- sk->compat_sk_state = SS_FREE;
+ sk->sk_state = SS_FREE;
out:
release_sock(sk);
lock_sock(sk);
- switch (sk->compat_sk_state) {
+ switch (sk->sk_state) {
case SS_LISTEN:
err = VSockVmciRecvListen(sk, pkt);
break;
ASSERT(sk);
ASSERT(pkt);
- ASSERT(sk->compat_sk_state == SS_LISTEN);
+ ASSERT(sk->sk_state == SS_LISTEN);
vsk = vsock_sk(sk);
err = 0;
pending = VSockVmciGetPending(sk, pkt);
if (pending) {
lock_sock(pending);
- switch (pending->compat_sk_state) {
+ switch (pending->sk_state) {
case SS_CONNECTING:
err = VSockVmciRecvConnectingServer(sk, pending, pkt);
break;
* a reset. Otherwise we create and initialize a child socket and reply
* with a connection negotiation.
*/
- if (sk->compat_sk_ack_backlog >= sk->compat_sk_max_ack_backlog) {
+ if (sk->sk_ack_backlog >= sk->sk_max_ack_backlog) {
VSOCK_REPLY_RESET(pkt);
return -ECONNREFUSED;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
- pending = __VSockVmciCreate(NULL, sk, GFP_KERNEL, sk->compat_sk_type);
+ pending = __VSockVmciCreate(NULL, sk, GFP_KERNEL, sk->sk_type);
#else
pending = __VSockVmciCreate(compat_sock_net(sk), NULL, sk, GFP_KERNEL,
- sk->compat_sk_type);
+ sk->sk_type);
#endif
if (!pending) {
VSOCK_SEND_RESET(sk, pkt);
}
VSockVmciAddPending(sk, pending);
- sk->compat_sk_ack_backlog++;
+ sk->sk_ack_backlog++;
- pending->compat_sk_state = SS_CONNECTING;
+ pending->sk_state = SS_CONNECTING;
vpending->produceSize = vpending->consumeSize = qpSize;
vpending->queuePairSize = qpSize;
ASSERT(listener);
ASSERT(pkt);
- ASSERT(listener->compat_sk_state == SS_LISTEN);
- ASSERT(pending->compat_sk_state == SS_CONNECTING);
+ ASSERT(listener->sk_state == SS_LISTEN);
+ ASSERT(pending->sk_state == SS_CONNECTING);
vpending = vsock_sk(pending);
detachSubId = VMCI_INVALID_ID;
* if a reset comes before the connection is accepted, the socket will be
* valid until it is removed from the queue.
*/
- pending->compat_sk_state = SS_CONNECTED;
+ pending->sk_state = SS_CONNECTED;
VSockVmciInsertConnected(vsockConnectedSocketsVsk(vpending), pending);
* Callers of accept() will be be waiting on the listening socket, not the
* pending socket.
*/
- listener->compat_sk_state_change(listener);
+ listener->sk_state_change(listener);
return 0;
destroy:
- pending->compat_sk_err = skerr;
- pending->compat_sk_state = SS_UNCONNECTED;
+ pending->sk_err = skerr;
+ pending->sk_state = SS_UNCONNECTED;
/*
* As long as we drop our reference, all necessary cleanup will handle when
* the cleanup function drops its reference and our destruct implementation
ASSERT(sk);
ASSERT(pkt);
- ASSERT(sk->compat_sk_state == SS_CONNECTING);
+ ASSERT(sk->sk_state == SS_CONNECTING);
vsk = vsock_sk(sk);
* Also place the socket in the connected table for accounting (it can
* already be found since it's in the bound table).
*/
- sk->compat_sk_state = SS_CONNECTED;
- sk->compat_sk_socket->state = SS_CONNECTED;
+ sk->sk_state = SS_CONNECTED;
+ sk->sk_socket->state = SS_CONNECTED;
VSockVmciInsertConnected(vsockConnectedSocketsVsk(vsk), sk);
- sk->compat_sk_state_change(sk);
+ sk->sk_state_change(sk);
break;
case VSOCK_PACKET_TYPE_NEGOTIATE:
destroy:
VSOCK_SEND_RESET(sk, pkt);
- sk->compat_sk_state = SS_UNCONNECTED;
- sk->compat_sk_err = skerr;
- sk->compat_sk_error_report(sk);
+ sk->sk_state = SS_UNCONNECTED;
+ sk->sk_err = skerr;
+ sk->sk_error_report(sk);
return err;
}
ASSERT(sk);
ASSERT(pkt);
- ASSERT(sk->compat_sk_state == SS_CONNECTED);
+ ASSERT(sk->sk_state == SS_CONNECTED);
/*
* In cases where we are closing the connection, it's sufficient to mark
vsk = vsock_sk(sk);
vsk->peerShutdown |= pkt->u.mode;
- sk->compat_sk_state_change(sk);
+ sk->sk_state_change(sk);
}
break;
* off the queuepair. Always treat a RST pkt in connected mode
* like a clean shutdown.
*/
- compat_sock_set_done(sk);
+ sock_set_flag(sk, SOCK_DONE);
vsk->peerShutdown = SHUTDOWN_MASK;
if (VSockVmciStreamHasData(vsk) <= 0) {
- sk->compat_sk_state = SS_DISCONNECTING;
+ sk->sk_state = SS_DISCONNECTING;
}
- sk->compat_sk_state_change(sk);
+ sk->sk_state_change(sk);
break;
default:
* New sockets for connection establishment won't have socket structures
* yet; if one exists, ensure it is of the proper type.
*/
- ASSERT(sk->compat_sk_socket ?
- sk->compat_sk_socket->type == SOCK_STREAM :
+ ASSERT(sk->sk_socket ?
+ sk->sk_socket->type == SOCK_STREAM :
1);
vsk = vsock_sk(sk);
int err;
ASSERT(sk);
- ASSERT(sk->compat_sk_socket);
+ ASSERT(sk->sk_socket);
ASSERT(addr);
vsk = vsock_sk(sk);
newAddr.svm_cid = addr->svm_cid;
- switch (sk->compat_sk_socket->type) {
+ switch (sk->sk_socket->type) {
case SOCK_STREAM: {
spin_lock_bh(&vsockTableLock);
* table for easy lookup by its address. The unbound list is simply an
* extra entry at the end of the hash table, a trick used by AF_UNIX.
*/
- if (sk->compat_sk_socket->type == SOCK_STREAM) {
+ if (sk->sk_socket->type == SOCK_STREAM) {
__VSockVmciRemoveBound(sk);
__VSockVmciInsertBound(vsockBoundSockets(&vsk->localAddr), sk);
spin_unlock_bh(&vsockTableLock);
return 0;
out:
- if (sk->compat_sk_socket->type == SOCK_STREAM) {
+ if (sk->sk_socket->type == SOCK_STREAM) {
spin_unlock_bh(&vsockTableLock);
}
return err;
sock_init_data(sock, sk);
/*
- * sk->compat_sk_type is normally set in sock_init_data, but only if
+ * sk->sk_type is normally set in sock_init_data, but only if
* sock is non-NULL. We make sure that our sockets always have a type
* by setting it here if needed.
*/
if (!sock) {
- sk->compat_sk_type = type;
+ sk->sk_type = type;
}
vsk = vsock_sk(sk);
VSockAddr_Init(&vsk->localAddr, VMADDR_CID_ANY, VMADDR_PORT_ANY);
VSockAddr_Init(&vsk->remoteAddr, VMADDR_CID_ANY, VMADDR_PORT_ANY);
- sk->compat_sk_destruct = VSockVmciSkDestruct;
- sk->compat_sk_backlog_rcv = VSockVmciQueueRcvSkb;
- sk->compat_sk_state = SS_UNCONNECTED;
- compat_sock_reset_done(sk);
+ sk->sk_destruct = VSockVmciSkDestruct;
+ sk->sk_backlog_rcv = VSockVmciQueueRcvSkb;
+ sk->sk_state = SS_UNCONNECTED;
+ sock_reset_flag(sk, SOCK_DONE);
INIT_LIST_HEAD(&vsk->boundTable);
INIT_LIST_HEAD(&vsk->connectedTable);
lock_sock(sk);
sock_orphan(sk);
- sk->compat_sk_shutdown = SHUTDOWN_MASK;
+ sk->sk_shutdown = SHUTDOWN_MASK;
- while ((skb = skb_dequeue(&sk->compat_sk_receive_queue))) {
+ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
kfree_skb(skb);
}
err = -EALREADY;
break;
default:
- ASSERT(sk->compat_sk_state == SS_FREE ||
- sk->compat_sk_state == SS_UNCONNECTED);
+ ASSERT(sk->sk_state == SS_FREE ||
+ sk->sk_state == SS_UNCONNECTED);
if (VSockAddr_Cast(addr, addrLen, &remoteAddr) != 0) {
err = -EINVAL;
goto out;
vsk->localAddr.svm_cid = VMCI_GetContextID();
}
- sk->compat_sk_state = SS_CONNECTING;
+ sk->sk_state = SS_CONNECTING;
if (VSockVmciOldProtoOverride(&oldPktProto) && oldPktProto) {
err = VSOCK_SEND_CONN_REQUEST(sk, vsk->queuePairSize);
if (err < 0) {
- sk->compat_sk_state = SS_UNCONNECTED;
+ sk->sk_state = SS_UNCONNECTED;
goto out;
}
} else {
err = VSOCK_SEND_CONN_REQUEST2(sk, vsk->queuePairSize,
supportedProtoVersions);
if (err < 0) {
- sk->compat_sk_state = SS_UNCONNECTED;
+ sk->sk_state = SS_UNCONNECTED;
goto out;
}
timeout = sock_sndtimeo(sk, flags & O_NONBLOCK);
compat_init_prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
- while (sk->compat_sk_state != SS_CONNECTED && sk->compat_sk_err == 0) {
+ while (sk->sk_state != SS_CONNECTED && sk->sk_err == 0) {
if (timeout == 0) {
/*
* If we're not going to block, skip ahead to preserve error code set
compat_cont_prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
}
- if (sk->compat_sk_err) {
- err = -sk->compat_sk_err;
+ if (sk->sk_err) {
+ err = -sk->sk_err;
goto outWaitError;
} else {
- ASSERT(sk->compat_sk_state == SS_CONNECTED);
+ ASSERT(sk->sk_state == SS_CONNECTED);
err = 0;
}
return err;
outWaitError:
- sk->compat_sk_state = SS_UNCONNECTED;
+ sk->sk_state = SS_UNCONNECTED;
sock->state = SS_UNCONNECTED;
goto outWait;
}
goto out;
}
- if (listener->compat_sk_state != SS_LISTEN) {
+ if (listener->sk_state != SS_LISTEN) {
err = -EINVAL;
goto out;
}
compat_init_prepare_to_wait(sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
while ((connected = VSockVmciDequeueAccept(listener)) == NULL &&
- listener->compat_sk_err == 0) {
+ listener->sk_err == 0) {
release_sock(listener);
timeout = schedule_timeout(timeout);
lock_sock(listener);
compat_cont_prepare_to_wait(sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
}
- if (listener->compat_sk_err) {
- err = -listener->compat_sk_err;
+ if (listener->sk_err) {
+ err = -listener->sk_err;
}
if (connected) {
- listener->compat_sk_ack_backlog--;
+ listener->sk_ack_backlog--;
lock_sock(connected);
vconnected = vsock_sk(connected);
poll_wait(file, sk_sleep(sk), wait);
mask = 0;
- if (sk->compat_sk_err) {
+ if (sk->sk_err) {
/* Signify that there has been an error on this socket. */
mask |= POLLERR;
}
* INET sockets treat local write shutdown and peer write shutdown
* as a case of POLLHUP set.
*/
- if ((sk->compat_sk_shutdown == SHUTDOWN_MASK) ||
- ((sk->compat_sk_shutdown & SEND_SHUTDOWN) &&
+ if ((sk->sk_shutdown == SHUTDOWN_MASK) ||
+ ((sk->sk_shutdown & SEND_SHUTDOWN) &&
(vsk->peerShutdown & SEND_SHUTDOWN))) {
mask |= POLLHUP;
}
/* POLLRDHUP wasn't added until 2.6.17. */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17)
- if (sk->compat_sk_shutdown & RCV_SHUTDOWN ||
+ if (sk->sk_shutdown & RCV_SHUTDOWN ||
vsk->peerShutdown & SEND_SHUTDOWN) {
mask |= POLLRDHUP;
}
* For datagram sockets we can read if there is something in the queue
* and write as long as the socket isn't shutdown for sending.
*/
- if (!skb_queue_empty(&sk->compat_sk_receive_queue) ||
- (sk->compat_sk_shutdown & RCV_SHUTDOWN)) {
+ if (!skb_queue_empty(&sk->sk_receive_queue) ||
+ (sk->sk_shutdown & RCV_SHUTDOWN)) {
mask |= POLLIN | POLLRDNORM;
}
- if (!(sk->compat_sk_shutdown & SEND_SHUTDOWN)) {
+ if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
}
} else if (sock->type == SOCK_STREAM) {
/*
* Listening sockets that have connections in their accept queue can be read.
*/
- if (sk->compat_sk_state == SS_LISTEN && !VSockVmciIsAcceptQueueEmpty(sk)) {
+ if (sk->sk_state == SS_LISTEN && !VSockVmciIsAcceptQueueEmpty(sk)) {
mask |= POLLIN | POLLRDNORM;
}
* If there is something in the queue then we can read.
*/
if (!VMCI_HANDLE_INVALID(vsk->qpHandle) &&
- !(sk->compat_sk_shutdown & RCV_SHUTDOWN)) {
+ !(sk->sk_shutdown & RCV_SHUTDOWN)) {
Bool dataReadyNow = FALSE;
int32 ret = 0;
NOTIFYCALLRET(vsk, ret, pollIn, sk, 1, &dataReadyNow);
* Sockets whose connections have been close, reset, or terminated should also
* be considered read, and we check the shutdown flag for that.
*/
- if (sk->compat_sk_shutdown & RCV_SHUTDOWN ||
+ if (sk->sk_shutdown & RCV_SHUTDOWN ||
vsk->peerShutdown & SEND_SHUTDOWN) {
mask |= POLLIN | POLLRDNORM;
}
/*
* Connected sockets that can produce data can be written.
*/
- if (sk->compat_sk_state == SS_CONNECTED) {
- if (!(sk->compat_sk_shutdown & SEND_SHUTDOWN)) {
+ if (sk->sk_state == SS_CONNECTED) {
+ if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {
Bool spaceAvailNow = FALSE;
int32 ret = 0;
* Simulate INET socket poll behaviors, which sets POLLOUT|POLLWRNORM when
* peer is closed and nothing to read, but local send is not shutdown.
*/
- if (sk->compat_sk_state == SS_UNCONNECTED) {
- if (!(sk->compat_sk_shutdown & SEND_SHUTDOWN)) {
+ if (sk->sk_state == SS_UNCONNECTED) {
+ if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {
mask |= POLLOUT | POLLWRNORM;
}
}
goto out;
}
- sk->compat_sk_max_ack_backlog = backlog;
- sk->compat_sk_state = SS_LISTEN;
+ sk->sk_max_ack_backlog = backlog;
+ sk->sk_state = SS_LISTEN;
err = 0;
mode = mode & (RCV_SHUTDOWN | SEND_SHUTDOWN);
if (mode) {
lock_sock(sk);
- sk->compat_sk_shutdown |= mode;
- sk->compat_sk_state_change(sk);
+ sk->sk_shutdown |= mode;
+ sk->sk_state_change(sk);
release_sock(sk);
}
- if (sk->compat_sk_type == SOCK_STREAM && mode) {
- compat_sock_reset_done(sk);
+ if (sk->sk_type == SOCK_STREAM && mode) {
+ sock_reset_flag(sk, SOCK_DONE);
VSOCK_SEND_SHUTDOWN(sk, mode);
}
/* Callers should not provide a destination with stream sockets. */
if (msg->msg_namelen) {
- err = sk->compat_sk_state == SS_CONNECTED ? -EISCONN : -EOPNOTSUPP;
+ err = sk->sk_state == SS_CONNECTED ? -EISCONN : -EOPNOTSUPP;
goto out;
}
/* Send data only if both sides are not shutdown in the direction. */
- if (sk->compat_sk_shutdown & SEND_SHUTDOWN ||
+ if (sk->sk_shutdown & SEND_SHUTDOWN ||
vsk->peerShutdown & RCV_SHUTDOWN) {
err = -EPIPE;
goto out;
}
- if (sk->compat_sk_state != SS_CONNECTED ||
+ if (sk->sk_state != SS_CONNECTED ||
!VSockAddr_Bound(&vsk->localAddr)) {
err = -ENOTCONN;
goto out;
retries = 0;
while (VSockVmciStreamHasSpace(vsk) == 0 &&
- sk->compat_sk_err == 0 &&
- !(sk->compat_sk_shutdown & SEND_SHUTDOWN) &&
+ sk->sk_err == 0 &&
+ !(sk->sk_shutdown & SEND_SHUTDOWN) &&
!(vsk->peerShutdown & RCV_SHUTDOWN)) {
/* Don't wait for non-blocking sockets. */
* These checks occur both as part of and after the loop conditional
* since we need to check before and after sleeping.
*/
- if (sk->compat_sk_err) {
- err = -sk->compat_sk_err;
+ if (sk->sk_err) {
+ err = -sk->sk_err;
goto outWait;
- } else if ((sk->compat_sk_shutdown & SEND_SHUTDOWN) ||
+ } else if ((sk->sk_shutdown & SEND_SHUTDOWN) ||
(vsk->peerShutdown & RCV_SHUTDOWN)) {
err = -EPIPE;
goto outWait;
lock_sock(sk);
- if (sk->compat_sk_state != SS_CONNECTED) {
+ if (sk->sk_state != SS_CONNECTED) {
/*
* Recvmsg is supposed to return 0 if a peer performs an orderly shutdown.
* Differentiate between that case and when a peer has not connected or a
* local shutdown occured with the SOCK_DONE flag.
*/
- if (compat_sock_test_done(sk)) {
+ if (sock_flag(sk, SOCK_DONE)) {
err = 0;
} else {
err = -ENOTCONN;
* We don't check peerShutdown flag here since peer may actually shut down,
* but there can be data in the VMCI queue that local socket can receive.
*/
- if (sk->compat_sk_shutdown & RCV_SHUTDOWN) {
+ if (sk->sk_shutdown & RCV_SHUTDOWN) {
err = 0;
goto out;
}
compat_init_prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
while ((ready = VSockVmciStreamHasData(vsk)) < target &&
- sk->compat_sk_err == 0 &&
- !(sk->compat_sk_shutdown & RCV_SHUTDOWN) &&
+ sk->sk_err == 0 &&
+ !(sk->sk_shutdown & RCV_SHUTDOWN) &&
!(vsk->peerShutdown & SEND_SHUTDOWN)) {
if (ready < 0) {
compat_cont_prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
}
- if (sk->compat_sk_err) {
- err = -sk->compat_sk_err;
+ if (sk->sk_err) {
+ err = -sk->sk_err;
goto outWait;
- } else if (sk->compat_sk_shutdown & RCV_SHUTDOWN) {
+ } else if (sk->sk_shutdown & RCV_SHUTDOWN) {
err = 0;
goto outWait;
} else if ((vsk->peerShutdown & SEND_SHUTDOWN) &&
*/
if (vsk->peerShutdown & SEND_SHUTDOWN) {
if (VSockVmciStreamHasData(vsk) <= 0) {
- sk->compat_sk_state = SS_UNCONNECTED;
- compat_sock_set_done(sk);
- sk->compat_sk_state_change(sk);
+ sk->sk_state = SS_UNCONNECTED;
+ sock_set_flag(sk, SOCK_DONE);
+ sk->sk_state_change(sk);
}
}
}