#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fcntl.h>
#include <linux/net.h>
#include <linux/in.h>
#include <linux/inet.h>
#include <linux/udp.h>
#include <linux/tcp.h>
#include <linux/unistd.h>
#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/file.h>
#include <linux/freezer.h>
#include <linux/bvec.h>
#include <net/sock.h>
#include <net/checksum.h>
#include <net/ip.h>
#include <net/ipv6.h>
#include <net/udp.h>
#include <net/tcp.h>
#include <net/tcp_states.h>
#include <net/tls_prot.h>
#include <net/handshake.h>
#include <linux/uaccess.h>
#include <linux/highmem.h>
#include <asm/ioctls.h>
#include <linux/key.h>
#include <linux/sunrpc/types.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/xdr.h>
#include <linux/sunrpc/msg_prot.h>
#include <linux/sunrpc/svcsock.h>
#include <linux/sunrpc/stats.h>
#include <linux/sunrpc/xprt.h>
#include <trace/events/sock.h>
#include <trace/events/sunrpc.h>
#include "socklib.h"
#include "sunrpc.h"
#define RPCDBG_FACILITY …
enum { … };
static struct svc_sock *svc_setup_socket(struct svc_serv *, struct socket *,
int flags);
static int svc_udp_recvfrom(struct svc_rqst *);
static int svc_udp_sendto(struct svc_rqst *);
static void svc_sock_detach(struct svc_xprt *);
static void svc_tcp_sock_detach(struct svc_xprt *);
static void svc_sock_free(struct svc_xprt *);
static struct svc_xprt *svc_create_socket(struct svc_serv *, int,
struct net *, struct sockaddr *,
int, int);
#ifdef CONFIG_DEBUG_LOCK_ALLOC
static struct lock_class_key svc_key[2];
static struct lock_class_key svc_slock_key[2];
static void svc_reclassify_socket(struct socket *sock)
{ … }
#else
static void svc_reclassify_socket(struct socket *sock)
{
}
#endif
static void svc_tcp_release_ctxt(struct svc_xprt *xprt, void *ctxt)
{ … }
static void svc_udp_release_ctxt(struct svc_xprt *xprt, void *ctxt)
{ … }
svc_pktinfo_u;
#define SVC_PKTINFO_SPACE …
static void svc_set_cmsg_data(struct svc_rqst *rqstp, struct cmsghdr *cmh)
{ … }
static int svc_sock_result_payload(struct svc_rqst *rqstp, unsigned int offset,
unsigned int length)
{ … }
static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining)
{ … }
static int
svc_tcp_sock_process_cmsg(struct socket *sock, struct msghdr *msg,
struct cmsghdr *cmsg, int ret)
{ … }
static int
svc_tcp_sock_recv_cmsg(struct svc_sock *svsk, struct msghdr *msg)
{ … }
#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
static void svc_flush_bvec(const struct bio_vec *bvec, size_t size, size_t seek)
{
struct bvec_iter bi = {
.bi_size = size + seek,
};
struct bio_vec bv;
bvec_iter_advance(bvec, &bi, seek & PAGE_MASK);
for_each_bvec(bv, bvec, bi, bi)
flush_dcache_page(bv.bv_page);
}
#else
static inline void svc_flush_bvec(const struct bio_vec *bvec, size_t size,
size_t seek)
{ … }
#endif
static ssize_t svc_tcp_read_msg(struct svc_rqst *rqstp, size_t buflen,
size_t seek)
{ … }
static void svc_sock_setbufsize(struct svc_sock *svsk, unsigned int nreqs)
{ … }
static void svc_sock_secure_port(struct svc_rqst *rqstp)
{ … }
static void svc_data_ready(struct sock *sk)
{ … }
static void svc_write_space(struct sock *sk)
{ … }
static int svc_tcp_has_wspace(struct svc_xprt *xprt)
{ … }
static void svc_tcp_kill_temp_xprt(struct svc_xprt *xprt)
{ … }
static void svc_tcp_handshake_done(void *data, int status, key_serial_t peerid)
{ … }
static void svc_tcp_handshake(struct svc_xprt *xprt)
{ … }
static int svc_udp_get_dest_address4(struct svc_rqst *rqstp,
struct cmsghdr *cmh)
{ … }
static int svc_udp_get_dest_address6(struct svc_rqst *rqstp,
struct cmsghdr *cmh)
{ … }
static int svc_udp_get_dest_address(struct svc_rqst *rqstp,
struct cmsghdr *cmh)
{ … }
static int svc_udp_recvfrom(struct svc_rqst *rqstp)
{ … }
static int svc_udp_sendto(struct svc_rqst *rqstp)
{ … }
static int svc_udp_has_wspace(struct svc_xprt *xprt)
{ … }
static struct svc_xprt *svc_udp_accept(struct svc_xprt *xprt)
{ … }
static void svc_udp_kill_temp_xprt(struct svc_xprt *xprt)
{ … }
static struct svc_xprt *svc_udp_create(struct svc_serv *serv,
struct net *net,
struct sockaddr *sa, int salen,
int flags)
{ … }
static const struct svc_xprt_ops svc_udp_ops = …;
static struct svc_xprt_class svc_udp_class = …;
static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv)
{ … }
static void svc_tcp_listen_data_ready(struct sock *sk)
{ … }
static void svc_tcp_state_change(struct sock *sk)
{ … }
static struct svc_xprt *svc_tcp_accept(struct svc_xprt *xprt)
{ … }
static size_t svc_tcp_restore_pages(struct svc_sock *svsk,
struct svc_rqst *rqstp)
{ … }
static void svc_tcp_save_pages(struct svc_sock *svsk, struct svc_rqst *rqstp)
{ … }
static void svc_tcp_clear_pages(struct svc_sock *svsk)
{ … }
static ssize_t svc_tcp_read_marker(struct svc_sock *svsk,
struct svc_rqst *rqstp)
{ … }
static int receive_cb_reply(struct svc_sock *svsk, struct svc_rqst *rqstp)
{ … }
static void svc_tcp_fragment_received(struct svc_sock *svsk)
{ … }
static int svc_tcp_recvfrom(struct svc_rqst *rqstp)
{ … }
static int svc_tcp_sendmsg(struct svc_sock *svsk, struct svc_rqst *rqstp,
rpc_fraghdr marker, unsigned int *sentp)
{ … }
static int svc_tcp_sendto(struct svc_rqst *rqstp)
{ … }
static struct svc_xprt *svc_tcp_create(struct svc_serv *serv,
struct net *net,
struct sockaddr *sa, int salen,
int flags)
{ … }
static const struct svc_xprt_ops svc_tcp_ops = …;
static struct svc_xprt_class svc_tcp_class = …;
void svc_init_xprt_sock(void)
{ … }
void svc_cleanup_xprt_sock(void)
{ … }
static void svc_tcp_init(struct svc_sock *svsk, struct svc_serv *serv)
{ … }
void svc_sock_update_bufs(struct svc_serv *serv)
{ … }
EXPORT_SYMBOL_GPL(…);
static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
struct socket *sock,
int flags)
{ … }
int svc_addsock(struct svc_serv *serv, struct net *net, const int fd,
char *name_return, const size_t len, const struct cred *cred)
{ … }
EXPORT_SYMBOL_GPL(…);
static struct svc_xprt *svc_create_socket(struct svc_serv *serv,
int protocol,
struct net *net,
struct sockaddr *sin, int len,
int flags)
{ … }
static void svc_sock_detach(struct svc_xprt *xprt)
{ … }
static void svc_tcp_sock_detach(struct svc_xprt *xprt)
{ … }
static void svc_sock_free(struct svc_xprt *xprt)
{ … }