Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Transport Definition
0004  *
0005  *  Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net>
0006  *  Copyright (C) 2004-2008 by Eric Van Hensbergen <ericvh@gmail.com>
0007  */
0008 
0009 #ifndef NET_9P_TRANSPORT_H
0010 #define NET_9P_TRANSPORT_H
0011 
0012 #include <linux/module.h>
0013 
0014 #define P9_DEF_MIN_RESVPORT (665U)
0015 #define P9_DEF_MAX_RESVPORT (1023U)
0016 
0017 /**
0018  * struct p9_trans_module - transport module interface
0019  * @list: used to maintain a list of currently available transports
0020  * @name: the human-readable name of the transport
0021  * @maxsize: transport provided maximum packet size
0022  * @def: set if this transport should be considered the default
0023  * @create: member function to create a new connection on this transport
0024  * @close: member function to discard a connection on this transport
0025  * @request: member function to issue a request to the transport
0026  * @cancel: member function to cancel a request (if it hasn't been sent)
0027  * @cancelled: member function to notify that a cancelled request will not
0028  *             receive a reply
0029  *
0030  * This is the basic API for a transport module which is registered by the
0031  * transport module with the 9P core network module and used by the client
0032  * to instantiate a new connection on a transport.
0033  *
0034  * The transport module list is protected by v9fs_trans_lock.
0035  */
0036 
0037 struct p9_trans_module {
0038     struct list_head list;
0039     char *name;     /* name of transport */
0040     int maxsize;        /* max message size of transport */
0041     int def;        /* this transport should be default */
0042     struct module *owner;
0043     int (*create)(struct p9_client *client,
0044               const char *devname, char *args);
0045     void (*close)(struct p9_client *client);
0046     int (*request)(struct p9_client *client, struct p9_req_t *req);
0047     int (*cancel)(struct p9_client *client, struct p9_req_t *req);
0048     int (*cancelled)(struct p9_client *client, struct p9_req_t *req);
0049     int (*zc_request)(struct p9_client *client, struct p9_req_t *req,
0050               struct iov_iter *uidata, struct iov_iter *uodata,
0051               int inlen, int outlen, int in_hdr_len);
0052     int (*show_options)(struct seq_file *m, struct p9_client *client);
0053 };
0054 
0055 void v9fs_register_trans(struct p9_trans_module *m);
0056 void v9fs_unregister_trans(struct p9_trans_module *m);
0057 struct p9_trans_module *v9fs_get_trans_by_name(const char *s);
0058 struct p9_trans_module *v9fs_get_default_trans(void);
0059 void v9fs_put_trans(struct p9_trans_module *m);
0060 
0061 #define MODULE_ALIAS_9P(transport) \
0062     MODULE_ALIAS("9p-" transport)
0063 
0064 #endif /* NET_9P_TRANSPORT_H */