FreeBSD/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
/*
 * Attempt to close a SDP socket, marking it as dropped, and freeing
 * the socket if we hold the only reference.
 */
Attempt to close a SDP socket, marking it as dropped, and freeing
the socket if we hold the only reference.
Attempt to close a SDP socket marking it as dropped and freeing the socket if we hold the only reference .
static struct sdp_sock *
sdp_closed(struct sdp_sock *ssk)
{
	struct socket *so;
	SDP_WLOCK_ASSERT(ssk);
	ssk->flags |= SDP_DROPPED;
	so = ssk->socket;
	soisdisconnected(so);
	if (ssk->flags & SDP_SOCKREF) {
		KASSERT(so->so_state & SS_PROTOREF,
		    ("sdp_closed: !SS_PROTOREF"));
		ssk->flags &= ~SDP_SOCKREF;
		SDP_WUNLOCK(ssk);
		ACCEPT_LOCK();
		SOCK_LOCK(so);
		so->so_state &= ~SS_PROTOREF;
		sofree(so);
		return (NULL);
	}
	return (ssk);
}
static struct sdp_sock * sdp_closed ( struct sdp_sock * ssk ) { struct socket * so ; SDP_WLOCK_ASSERT ( ssk ) ; ssk -> flags |= SDP_DROPPED ; so = ssk -> socket ; soisdisconnected ( so ) ; if ( ssk -> flags & SDP_SOCKREF ) { KASSERT ( so -> so_state & SS_PROTOREF , ( " " ) ) ; ssk -> flags &= ~ SDP_SOCKREF ; SDP_WUNLOCK ( ssk ) ; ACCEPT_LOCK ( ) ; SOCK_LOCK ( so ) ; so -> so_state &= ~ SS_PROTOREF ; sofree ( so ) ; return ( NULL ) ; } return ( ssk ) ; }
Attempt to close a SDP socket, marking it as dropped, and freeing
 the socket if we hold the only reference.
Attempt to close a SDP socket marking it as dropped and freeing the socket if we hold the only reference .