2017-11-01 15:07:57 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-16 15:20:36 -07:00
|
|
|
/*
|
|
|
|
|
* linux/include/linux/sunrpc/svcsock.h
|
|
|
|
|
*
|
|
|
|
|
* RPC server socket I/O.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef SUNRPC_SVCSOCK_H
|
|
|
|
|
#define SUNRPC_SVCSOCK_H
|
|
|
|
|
|
|
|
|
|
#include <linux/sunrpc/svc.h>
|
2007-12-30 21:07:17 -06:00
|
|
|
#include <linux/sunrpc/svc_xprt.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* RPC server socket.
|
|
|
|
|
*/
|
|
|
|
|
struct svc_sock {
|
2007-12-30 21:07:17 -06:00
|
|
|
struct svc_xprt sk_xprt;
|
2005-04-16 15:20:36 -07:00
|
|
|
struct socket * sk_sock; /* berkeley socket layer */
|
|
|
|
|
struct sock * sk_sk; /* INET layer */
|
|
|
|
|
|
|
|
|
|
/* We keep the old state_change and data_ready CB's here */
|
|
|
|
|
void (*sk_ostate)(struct sock *);
|
2014-04-11 16:15:36 -04:00
|
|
|
void (*sk_odata)(struct sock *);
|
2005-04-16 15:20:36 -07:00
|
|
|
void (*sk_owspace)(struct sock *);
|
|
|
|
|
|
|
|
|
|
/* private TCP part */
|
2012-12-03 16:45:35 -05:00
|
|
|
/* On-the-wire fragment header: */
|
2020-03-17 14:12:15 -04:00
|
|
|
__be32 sk_marker;
|
2012-12-03 16:45:35 -05:00
|
|
|
/* As we receive a record, this includes the length received so
|
|
|
|
|
* far (including the fragment header): */
|
|
|
|
|
u32 sk_tcplen;
|
|
|
|
|
/* Total length of the data (not including fragment headers)
|
|
|
|
|
* received so far in the fragments making up this rpc: */
|
|
|
|
|
u32 sk_datalen;
|
|
|
|
|
|
2023-07-19 14:31:09 -04:00
|
|
|
struct page_frag_cache sk_frag_cache;
|
|
|
|
|
|
2023-04-20 13:56:24 -04:00
|
|
|
struct completion sk_handshake_done;
|
|
|
|
|
|
2025-04-28 15:36:55 -04:00
|
|
|
/* received data */
|
|
|
|
|
unsigned long sk_maxpages;
|
|
|
|
|
struct page * sk_pages[] __counted_by(sk_maxpages);
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
2012-12-03 16:11:13 -05:00
|
|
|
static inline u32 svc_sock_reclen(struct svc_sock *svsk)
|
|
|
|
|
{
|
2020-03-17 14:12:15 -04:00
|
|
|
return be32_to_cpu(svsk->sk_marker) & RPC_FRAGMENT_SIZE_MASK;
|
2012-12-03 16:11:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline u32 svc_sock_final_rec(struct svc_sock *svsk)
|
|
|
|
|
{
|
2020-03-17 14:12:15 -04:00
|
|
|
return be32_to_cpu(svsk->sk_marker) & RPC_LAST_STREAM_FRAGMENT;
|
2012-12-03 16:11:13 -05:00
|
|
|
}
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
/*
|
|
|
|
|
* Function prototypes.
|
|
|
|
|
*/
|
2023-07-18 16:38:08 +10:00
|
|
|
void svc_recv(struct svc_rqst *rqstp);
|
2023-04-03 13:53:07 -04:00
|
|
|
void svc_send(struct svc_rqst *rqstp);
|
2023-05-29 14:35:55 +03:00
|
|
|
int svc_addsock(struct svc_serv *serv, struct net *net,
|
|
|
|
|
const int fd, char *name_return, const size_t len,
|
|
|
|
|
const struct cred *cred);
|
2007-12-30 21:07:17 -06:00
|
|
|
void svc_init_xprt_sock(void);
|
|
|
|
|
void svc_cleanup_xprt_sock(void);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-02-12 00:53:28 -08:00
|
|
|
/*
|
|
|
|
|
* svc_makesock socket characteristics
|
|
|
|
|
*/
|
|
|
|
|
#define SVC_SOCK_DEFAULTS (0U)
|
|
|
|
|
#define SVC_SOCK_ANONYMOUS (1U << 0) /* don't register with pmap */
|
|
|
|
|
#define SVC_SOCK_TEMPORARY (1U << 1) /* flag socket as temporary */
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#endif /* SUNRPC_SVCSOCK_H */
|