diff options
author | rwatson <rwatson@FreeBSD.org> | 2006-07-11 23:18:28 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2006-07-11 23:18:28 +0000 |
commit | 2137fc50e63deaaa5b157d30cad71e58e711f606 (patch) | |
tree | 929b63820e4c3cfe7ce25a1c573b885f1b5ce22d /sys | |
parent | b7a5696a9bda1d0dfd383a3ac205be5a490d5ccb (diff) | |
download | FreeBSD-src-2137fc50e63deaaa5b157d30cad71e58e711f606.zip FreeBSD-src-2137fc50e63deaaa5b157d30cad71e58e711f606.tar.gz |
Several protocol switch functions (pru_abort, pru_detach, pru_sosetlabel)
return void, so don't implement no-op versions of these functions.
Instead, consistently check if those switch pointers are NULL before
invoking them.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/uipc_domain.c | 4 | ||||
-rw-r--r-- | sys/kern/uipc_sockbuf.c | 22 | ||||
-rw-r--r-- | sys/kern/uipc_socket.c | 6 | ||||
-rw-r--r-- | sys/kern/uipc_socket2.c | 22 | ||||
-rw-r--r-- | sys/sys/protosw.h | 3 |
5 files changed, 4 insertions, 53 deletions
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index 6adb336..28cddce 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -80,14 +80,12 @@ MTX_SYSINIT(domain, &dom_mtx, "domain list", MTX_DEF); * All functions return EOPNOTSUPP. */ struct pr_usrreqs nousrreqs = { - .pru_abort = pru_abort_notsupp, .pru_accept = pru_accept_notsupp, .pru_attach = pru_attach_notsupp, .pru_bind = pru_bind_notsupp, .pru_connect = pru_connect_notsupp, .pru_connect2 = pru_connect2_notsupp, .pru_control = pru_control_notsupp, - .pru_detach = pru_detach_notsupp, .pru_disconnect = pru_disconnect_notsupp, .pru_listen = pru_listen_notsupp, .pru_peeraddr = pru_peeraddr_notsupp, @@ -100,7 +98,6 @@ struct pr_usrreqs nousrreqs = { .pru_sosend = pru_sosend_notsupp, .pru_soreceive = pru_soreceive_notsupp, .pru_sopoll = pru_sopoll_notsupp, - .pru_sosetlabel = pru_sosetlabel_null }; static void @@ -125,7 +122,6 @@ protosw_init(struct protosw *pr) DEFAULT(pu->pru_sosend, sosend); DEFAULT(pu->pru_soreceive, soreceive); DEFAULT(pu->pru_sopoll, sopoll); - DEFAULT(pu->pru_sosetlabel, pru_sosetlabel_null); #undef DEFAULT if (pr->pr_init) (*pr->pr_init)(); diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index a77a6a1..14fd05a 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -1128,12 +1128,6 @@ sbcreatecontrol(p, size, type, level) * Some routines that return EOPNOTSUPP for entry points that are not * supported by a protocol. Fill in as needed. */ -void -pru_abort_notsupp(struct socket *so) -{ - -} - int pru_accept_notsupp(struct socket *so, struct sockaddr **nam) { @@ -1171,12 +1165,6 @@ pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data, return EOPNOTSUPP; } -void -pru_detach_notsupp(struct socket *so) -{ - -} - int pru_disconnect_notsupp(struct socket *so) { @@ -1260,16 +1248,6 @@ pru_sopoll_notsupp(struct socket *so, int events, struct ucred *cred, } /* - * For protocol types that don't keep cached copies of labels in their - * pcbs, provide a null sosetlabel that does a NOOP. - */ -void -pru_sosetlabel_null(struct socket *so) -{ - -} - -/* * Make a copy of a sockaddr in a malloced buffer of type M_SONAME. */ struct sockaddr * diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 879fa32..c275869 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -653,7 +653,8 @@ soclose(so) } drop: - (*so->so_proto->pr_usrreqs->pru_detach)(so); + if (*so->so_proto->pr_usrreqs->pru_detach != NULL) + (*so->so_proto->pr_usrreqs->pru_detach)(so); ACCEPT_LOCK(); SOCK_LOCK(so); KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF")); @@ -696,7 +697,8 @@ soabort(so) KASSERT((so->so_state & SQ_COMP) == 0, ("soabort: SQ_COMP")); KASSERT((so->so_state & SQ_INCOMP) == 0, ("soabort: SQ_INCOMP")); - (*so->so_proto->pr_usrreqs->pru_abort)(so); + if (*so->so_proto->pr_usrreqs->pru_abort != NULL) + (*so->so_proto->pr_usrreqs->pru_abort)(so); ACCEPT_LOCK(); SOCK_LOCK(so); sofree(so); diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index a77a6a1..14fd05a 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1128,12 +1128,6 @@ sbcreatecontrol(p, size, type, level) * Some routines that return EOPNOTSUPP for entry points that are not * supported by a protocol. Fill in as needed. */ -void -pru_abort_notsupp(struct socket *so) -{ - -} - int pru_accept_notsupp(struct socket *so, struct sockaddr **nam) { @@ -1171,12 +1165,6 @@ pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data, return EOPNOTSUPP; } -void -pru_detach_notsupp(struct socket *so) -{ - -} - int pru_disconnect_notsupp(struct socket *so) { @@ -1260,16 +1248,6 @@ pru_sopoll_notsupp(struct socket *so, int events, struct ucred *cred, } /* - * For protocol types that don't keep cached copies of labels in their - * pcbs, provide a null sosetlabel that does a NOOP. - */ -void -pru_sosetlabel_null(struct socket *so) -{ - -} - -/* * Make a copy of a sockaddr in a malloced buffer of type M_SONAME. */ struct sockaddr * diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h index e6bdec4..a0bc968 100644 --- a/sys/sys/protosw.h +++ b/sys/sys/protosw.h @@ -249,7 +249,6 @@ struct pr_usrreqs { /* * All nonvoid pru_*() functions below return EOPNOTSUPP. */ -void pru_abort_notsupp(struct socket *so); int pru_accept_notsupp(struct socket *so, struct sockaddr **nam); int pru_attach_notsupp(struct socket *so, int proto, struct thread *td); int pru_bind_notsupp(struct socket *so, struct sockaddr *nam, @@ -259,7 +258,6 @@ int pru_connect_notsupp(struct socket *so, struct sockaddr *nam, int pru_connect2_notsupp(struct socket *so1, struct socket *so2); int pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td); -void pru_detach_notsupp(struct socket *so); int pru_disconnect_notsupp(struct socket *so); int pru_listen_notsupp(struct socket *so, int backlog, struct thread *td); int pru_peeraddr_notsupp(struct socket *so, struct sockaddr **nam); @@ -278,7 +276,6 @@ int pru_soreceive_notsupp(struct socket *so, struct sockaddr **paddr, int *flagsp); int pru_sopoll_notsupp(struct socket *so, int events, struct ucred *cred, struct thread *td); -void pru_sosetlabel_null(struct socket *so); #endif /* _KERNEL */ |