sockets: remove unused KPIs to manipulate sockets

These KPIs were added in dd0e6c383a and through 15 years had zero use.
They slightly remind what IfAPI does for struct ifnet.  But IfAPI does
that for the sake of large collection of NIC drivers not being aware of
struct ifnet.  For the sockets it is unclear what could be a large
collection of externally written kernel modules that need extensively use
sockets and not be aware of their internals at the same time. This
isolation of a structure knowledge requires a lot of work, and just
throwing in a few KPIs isn't helpful.

Reviewed by:		kib, olce, markj
Differential Revision:	https://reviews.freebsd.org/D44311
This commit is contained in:
Gleb Smirnoff 2024-03-18 08:50:30 -07:00
parent 027fda80fe
commit d62c4607e8
5 changed files with 3 additions and 131 deletions

View File

@ -4254,34 +4254,6 @@ sotoxsocket(struct socket *so, struct xsocket *xso)
}
}
struct sockbuf *
so_sockbuf_rcv(struct socket *so)
{
return (&so->so_rcv);
}
struct sockbuf *
so_sockbuf_snd(struct socket *so)
{
return (&so->so_snd);
}
int
so_state_get(const struct socket *so)
{
return (so->so_state);
}
void
so_state_set(struct socket *so, int val)
{
so->so_state = val;
}
int
so_options_get(const struct socket *so)
{
@ -4309,76 +4281,3 @@ so_error_set(struct socket *so, int val)
so->so_error = val;
}
int
so_linger_get(const struct socket *so)
{
return (so->so_linger);
}
void
so_linger_set(struct socket *so, int val)
{
KASSERT(val >= 0 && val <= USHRT_MAX && val <= (INT_MAX / hz),
("%s: val %d out of range", __func__, val));
so->so_linger = val;
}
struct protosw *
so_protosw_get(const struct socket *so)
{
return (so->so_proto);
}
void
so_protosw_set(struct socket *so, struct protosw *val)
{
so->so_proto = val;
}
void
so_sorwakeup(struct socket *so)
{
sorwakeup(so);
}
void
so_sowwakeup(struct socket *so)
{
sowwakeup(so);
}
void
so_sorwakeup_locked(struct socket *so)
{
sorwakeup_locked(so);
}
void
so_sowwakeup_locked(struct socket *so)
{
sowwakeup_locked(so);
}
void
so_lock(struct socket *so)
{
SOCK_LOCK(so);
}
void
so_unlock(struct socket *so)
{
SOCK_UNLOCK(so);
}

View File

@ -2847,13 +2847,6 @@ inp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp,
*fp = inp->inp_fport;
}
struct inpcb *
so_sotoinpcb(struct socket *so)
{
return (sotoinpcb(so));
}
/*
* Create an external-format (``xinpcb'') structure using the information in
* the kernel-format in_pcb structure pointed to by inp. This is done to

View File

@ -79,6 +79,7 @@ struct tcp_fastopen_ccache {
uint32_t secret;
};
struct tcpcb;
#ifdef TCP_RFC7413
void tcp_fastopen_init(void);
void tcp_fastopen_destroy(void);

View File

@ -38,6 +38,8 @@
extern int registered_toedevs;
struct tcpcb;
int tcp_offload_connect(struct socket *, struct sockaddr *);
void tcp_offload_listen_start(struct tcpcb *);
void tcp_offload_listen_stop(struct tcpcb *);

View File

@ -713,33 +713,10 @@ __END_DECLS
#ifdef _KERNEL
struct socket;
struct inpcb *so_sotoinpcb(struct socket *so);
struct sockbuf *so_sockbuf_snd(struct socket *);
struct sockbuf *so_sockbuf_rcv(struct socket *);
int so_state_get(const struct socket *);
void so_state_set(struct socket *, int);
int so_options_get(const struct socket *);
void so_options_set(struct socket *, int);
int so_error_get(const struct socket *);
void so_error_set(struct socket *, int);
int so_linger_get(const struct socket *);
void so_linger_set(struct socket *, int);
struct protosw *so_protosw_get(const struct socket *);
void so_protosw_set(struct socket *, struct protosw *);
void so_sorwakeup_locked(struct socket *so);
void so_sowwakeup_locked(struct socket *so);
void so_sorwakeup(struct socket *so);
void so_sowwakeup(struct socket *so);
void so_lock(struct socket *so);
void so_unlock(struct socket *so);
#endif /* _KERNEL */
#endif /* !_SYS_SOCKET_H_ */