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