1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * include/net/9p/transport.h 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Transport Definition 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> 8*4882a593Smuzhiyun * Copyright (C) 2004-2008 by Eric Van Hensbergen <ericvh@gmail.com> 9*4882a593Smuzhiyun */ 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun #ifndef NET_9P_TRANSPORT_H 12*4882a593Smuzhiyun #define NET_9P_TRANSPORT_H 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun #define P9_DEF_MIN_RESVPORT (665U) 15*4882a593Smuzhiyun #define P9_DEF_MAX_RESVPORT (1023U) 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun /** 18*4882a593Smuzhiyun * struct p9_trans_module - transport module interface 19*4882a593Smuzhiyun * @list: used to maintain a list of currently available transports 20*4882a593Smuzhiyun * @name: the human-readable name of the transport 21*4882a593Smuzhiyun * @maxsize: transport provided maximum packet size 22*4882a593Smuzhiyun * @def: set if this transport should be considered the default 23*4882a593Smuzhiyun * @create: member function to create a new connection on this transport 24*4882a593Smuzhiyun * @close: member function to discard a connection on this transport 25*4882a593Smuzhiyun * @request: member function to issue a request to the transport 26*4882a593Smuzhiyun * @cancel: member function to cancel a request (if it hasn't been sent) 27*4882a593Smuzhiyun * @cancelled: member function to notify that a cancelled request will not 28*4882a593Smuzhiyun * receive a reply 29*4882a593Smuzhiyun * 30*4882a593Smuzhiyun * This is the basic API for a transport module which is registered by the 31*4882a593Smuzhiyun * transport module with the 9P core network module and used by the client 32*4882a593Smuzhiyun * to instantiate a new connection on a transport. 33*4882a593Smuzhiyun * 34*4882a593Smuzhiyun * The transport module list is protected by v9fs_trans_lock. 35*4882a593Smuzhiyun */ 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun struct p9_trans_module { 38*4882a593Smuzhiyun struct list_head list; 39*4882a593Smuzhiyun char *name; /* name of transport */ 40*4882a593Smuzhiyun int maxsize; /* max message size of transport */ 41*4882a593Smuzhiyun int def; /* this transport should be default */ 42*4882a593Smuzhiyun struct module *owner; 43*4882a593Smuzhiyun int (*create)(struct p9_client *, const char *, char *); 44*4882a593Smuzhiyun void (*close) (struct p9_client *); 45*4882a593Smuzhiyun int (*request) (struct p9_client *, struct p9_req_t *req); 46*4882a593Smuzhiyun int (*cancel) (struct p9_client *, struct p9_req_t *req); 47*4882a593Smuzhiyun int (*cancelled)(struct p9_client *, struct p9_req_t *req); 48*4882a593Smuzhiyun int (*zc_request)(struct p9_client *, struct p9_req_t *, 49*4882a593Smuzhiyun struct iov_iter *, struct iov_iter *, int , int, int); 50*4882a593Smuzhiyun int (*show_options)(struct seq_file *, struct p9_client *); 51*4882a593Smuzhiyun }; 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun void v9fs_register_trans(struct p9_trans_module *m); 54*4882a593Smuzhiyun void v9fs_unregister_trans(struct p9_trans_module *m); 55*4882a593Smuzhiyun struct p9_trans_module *v9fs_get_trans_by_name(char *s); 56*4882a593Smuzhiyun struct p9_trans_module *v9fs_get_default_trans(void); 57*4882a593Smuzhiyun void v9fs_put_trans(struct p9_trans_module *m); 58*4882a593Smuzhiyun #endif /* NET_9P_TRANSPORT_H */ 59