Skip to content

Commit 075e8bd

Browse files
Eric Sandeenmartinetd
authored andcommitted
9p: create a v9fs_context structure to hold parsed options
This patch creates a new v9fs_context structure which includes new p9_session_opts and p9_client_opts structures, as well as re-using the existing p9_fd_opts and p9_rdma_opts to store options during parsing. The new structure will be used in the next commit to pass all parsed options to the appropriate transports. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Message-ID: <20251010214222.1347785-4-sandeen@redhat.com> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
1 parent c44393d commit 075e8bd

2 files changed

Lines changed: 90 additions & 32 deletions

File tree

include/net/9p/client.h

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,96 @@ struct p9_client {
132132
char name[__NEW_UTS_LEN + 1];
133133
};
134134

135+
/**
136+
* struct p9_fd_opts - holds client options during parsing
137+
* @msize: maximum data size negotiated by protocol
138+
* @prot-Oversion: 9P protocol version to use
139+
* @trans_mod: module API instantiated with this client
140+
*
141+
* These parsed options get transferred into client in
142+
* apply_client_options()
143+
*/
144+
struct p9_client_opts {
145+
unsigned int msize;
146+
unsigned char proto_version;
147+
struct p9_trans_module *trans_mod;
148+
};
149+
150+
/**
151+
* struct p9_fd_opts - per-transport options for fd transport
152+
* @rfd: file descriptor for reading (trans=fd)
153+
* @wfd: file descriptor for writing (trans=fd)
154+
* @port: port to connect to (trans=tcp)
155+
* @privport: port is privileged
156+
*/
157+
struct p9_fd_opts {
158+
int rfd;
159+
int wfd;
160+
u16 port;
161+
bool privport;
162+
};
163+
164+
/**
165+
* struct p9_rdma_opts - Collection of mount options for rdma transport
166+
* @port: port of connection
167+
* @privport: Whether a privileged port may be used
168+
* @sq_depth: The requested depth of the SQ. This really doesn't need
169+
* to be any deeper than the number of threads used in the client
170+
* @rq_depth: The depth of the RQ. Should be greater than or equal to SQ depth
171+
* @timeout: Time to wait in msecs for CM events
172+
*/
173+
struct p9_rdma_opts {
174+
short port;
175+
bool privport;
176+
int sq_depth;
177+
int rq_depth;
178+
long timeout;
179+
};
180+
181+
/**
182+
* struct p9_session_opts - holds parsed options for v9fs_session_info
183+
* @flags: session options of type &p9_session_flags
184+
* @nodev: set to 1 to disable device mapping
185+
* @debug: debug level
186+
* @afid: authentication handle
187+
* @cache: cache mode of type &p9_cache_bits
188+
* @cachetag: the tag of the cache associated with this session
189+
* @uname: string user name to mount hierarchy as
190+
* @aname: mount specifier for remote hierarchy
191+
* @dfltuid: default numeric userid to mount hierarchy as
192+
* @dfltgid: default numeric groupid to mount hierarchy as
193+
* @uid: if %V9FS_ACCESS_SINGLE, the numeric uid which mounted the hierarchy
194+
* @session_lock_timeout: retry interval for blocking locks
195+
*
196+
* This strucure holds options which are parsed and will be transferred
197+
* to the v9fs_session_info structure when mounted, and therefore largely
198+
* duplicates struct v9fs_session_info.
199+
*/
200+
struct p9_session_opts {
201+
unsigned int flags;
202+
unsigned char nodev;
203+
unsigned short debug;
204+
unsigned int afid;
205+
unsigned int cache;
206+
#ifdef CONFIG_9P_FSCACHE
207+
char *cachetag;
208+
#endif
209+
char *uname;
210+
char *aname;
211+
kuid_t dfltuid;
212+
kgid_t dfltgid;
213+
kuid_t uid;
214+
long session_lock_timeout;
215+
};
216+
217+
/* Used by mount API to store parsed mount options */
218+
struct v9fs_context {
219+
struct p9_client_opts client_opts;
220+
struct p9_fd_opts fd_opts;
221+
struct p9_rdma_opts rdma_opts;
222+
struct p9_session_opts session_opts;
223+
};
224+
135225
/**
136226
* struct p9_fid - file system entity handle
137227
* @clnt: back pointer to instantiating &p9_client

include/net/9p/transport.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,6 @@
2121
#define P9_RDMA_RQ_DEPTH 32
2222
#define P9_RDMA_TIMEOUT 30000 /* 30 seconds */
2323

24-
/**
25-
* struct p9_fd_opts - per-transport options for fd transport
26-
* @rfd: file descriptor for reading (trans=fd)
27-
* @wfd: file descriptor for writing (trans=fd)
28-
* @port: port to connect to (trans=tcp)
29-
* @privport: port is privileged
30-
*/
31-
32-
struct p9_fd_opts {
33-
int rfd;
34-
int wfd;
35-
u16 port;
36-
bool privport;
37-
};
38-
39-
/**
40-
* struct p9_rdma_opts - Collection of mount options for rdma transport
41-
* @port: port of connection
42-
* @privport: Whether a privileged port may be used
43-
* @sq_depth: The requested depth of the SQ. This really doesn't need
44-
* to be any deeper than the number of threads used in the client
45-
* @rq_depth: The depth of the RQ. Should be greater than or equal to SQ depth
46-
* @timeout: Time to wait in msecs for CM events
47-
*/
48-
struct p9_rdma_opts {
49-
short port;
50-
bool privport;
51-
int sq_depth;
52-
int rq_depth;
53-
long timeout;
54-
};
55-
5624
/**
5725
* struct p9_trans_module - transport module interface
5826
* @list: used to maintain a list of currently available transports

0 commit comments

Comments
 (0)