include/linux/sunrpc/svc_xprt.h

Source file repositories/reference/linux-study-clean/include/linux/sunrpc/svc_xprt.h

File Facts

System
Linux kernel
Corpus path
include/linux/sunrpc/svc_xprt.h
Extension
.h
Size
8414 bytes
Lines
273
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct svc_xprt_ops {
	struct svc_xprt	*(*xpo_create)(struct svc_serv *,
				       struct net *net,
				       struct sockaddr *, int,
				       int);
	struct svc_xprt	*(*xpo_accept)(struct svc_xprt *);
	int		(*xpo_has_wspace)(struct svc_xprt *);
	int		(*xpo_recvfrom)(struct svc_rqst *);
	int		(*xpo_sendto)(struct svc_rqst *);
	int		(*xpo_result_payload)(struct svc_rqst *, unsigned int,
					      unsigned int);
	void		(*xpo_release_ctxt)(struct svc_xprt *xprt, void *ctxt);
	void		(*xpo_detach)(struct svc_xprt *);
	void		(*xpo_free)(struct svc_xprt *);
	void		(*xpo_kill_temp_xprt)(struct svc_xprt *);
	void		(*xpo_handshake)(struct svc_xprt *xprt);
};

struct svc_xprt_class {
	const char		*xcl_name;
	struct module		*xcl_owner;
	const struct svc_xprt_ops *xcl_ops;
	struct list_head	xcl_list;
	u32			xcl_max_payload;
	int			xcl_ident;
};

/*
 * This is embedded in an object that wants a callback before deleting
 * an xprt; intended for use by NFSv4.1, which needs to know when a
 * client's tcp connection (and hence possibly a backchannel) goes away.
 */
struct svc_xpt_user {
	struct list_head list;
	void (*callback)(struct svc_xpt_user *);
};

struct svc_xprt {
	struct svc_xprt_class	*xpt_class;
	const struct svc_xprt_ops *xpt_ops;
	struct kref		xpt_ref;
	ktime_t			xpt_qtime;
	struct list_head	xpt_list;
	struct lwq_node		xpt_ready;
	unsigned long		xpt_flags;

	struct svc_serv		*xpt_server;	/* service for transport */
	atomic_t    	    	xpt_reserved;	/* space on outq that is rsvd */
	atomic_t		xpt_nr_rqsts;	/* Number of requests */
	struct mutex		xpt_mutex;	/* to serialize sending data */
	spinlock_t		xpt_lock;	/* protects sk_deferred
						 * and xpt_auth_cache */
	void			*xpt_auth_cache;/* auth cache */
	struct list_head	xpt_deferred;	/* deferred requests that need
						 * to be revisted */
	struct sockaddr_storage	xpt_local;	/* local address */
	size_t			xpt_locallen;	/* length of address */
	struct sockaddr_storage	xpt_remote;	/* remote peer's address */
	size_t			xpt_remotelen;	/* length of address */
	char			xpt_remotebuf[INET6_ADDRSTRLEN + 10];
	struct list_head	xpt_users;	/* callbacks on free */

	struct net		*xpt_net;
	netns_tracker		ns_tracker;
	const struct cred	*xpt_cred;
	struct rpc_xprt		*xpt_bc_xprt;	/* NFSv4.1 backchannel */
	struct rpc_xprt_switch	*xpt_bc_xps;	/* NFSv4.1 backchannel */
};

/* flag bits for xpt_flags */
enum {
	XPT_BUSY,		/* enqueued/receiving */
	XPT_CONN,		/* conn pending */
	XPT_CLOSE,		/* dead or dying */
	XPT_DATA,		/* data pending */
	XPT_TEMP,		/* connected transport */
	XPT_DEAD,		/* transport closed */
	XPT_CHNGBUF,		/* need to change snd/rcv buf sizes */
	XPT_DEFERRED,		/* deferred request pending */
	XPT_OLD,		/* used for xprt aging mark+sweep */
	XPT_LISTENER,		/* listening endpoint */
	XPT_CACHE_AUTH,		/* cache auth info */
	XPT_LOCAL,		/* connection from loopback interface */
	XPT_KILL_TEMP,		/* call xpo_kill_temp_xprt before closing */
	XPT_CONG_CTRL,		/* has congestion control */
	XPT_HANDSHAKE,		/* xprt requests a handshake */
	XPT_TLS_SESSION,	/* transport-layer security established */
	XPT_PEER_AUTH,		/* peer has been authenticated */
	XPT_PEER_VALID,		/* peer has presented a filehandle that
				 * it has access to.  It is NOT counted

Annotation

Implementation Notes