blob: f337da7a0eec1c4c6be93307172ba5e9f7511b70 [file] [log] [blame]
Eric Van Hensbergen9e82cf62005-09-09 13:04:20 -07001/*
2 * V9FS definitions.
3 *
4 * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
5 * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to:
19 * Free Software Foundation
20 * 51 Franklin Street, Fifth Floor
21 * Boston, MA 02111-1301 USA
22 *
23 */
24
25/*
26 * Idpool structure provides lock and id management
27 *
28 */
29
30struct v9fs_idpool {
31 struct semaphore lock;
32 struct idr pool;
33};
34
35/*
36 * Session structure provides information for an opened session
37 *
38 */
39
40struct v9fs_session_info {
41 /* options */
42 unsigned int maxdata;
43 unsigned char extended; /* set to 1 if we are using UNIX extensions */
44 unsigned char nodev; /* set to 1 if no disable device mapping */
45 unsigned short port; /* port to connect to */
46 unsigned short debug; /* debug level */
47 unsigned short proto; /* protocol to use */
48 unsigned int afid; /* authentication fid */
49 unsigned int rfdno; /* read file descriptor number */
50 unsigned int wfdno; /* write file descriptor number */
51
52
53 char *name; /* user name to mount as */
54 char *remotename; /* name of remote hierarchy being mounted */
55 unsigned int uid; /* default uid/muid for legacy support */
56 unsigned int gid; /* default gid for legacy support */
57
58 /* book keeping */
59 struct v9fs_idpool fidpool; /* The FID pool for file descriptors */
Eric Van Hensbergen9e82cf62005-09-09 13:04:20 -070060
Eric Van Hensbergen9e82cf62005-09-09 13:04:20 -070061 struct v9fs_transport *transport;
Latchesar Ionkov3cf64292006-01-08 01:04:58 -080062 struct v9fs_mux_data *mux;
Eric Van Hensbergen9e82cf62005-09-09 13:04:20 -070063
64 int inprogress; /* session in progress => true */
65 int shutdown; /* session shutting down. no more attaches. */
66 unsigned char session_hung;
Latchesar Ionkov3cf64292006-01-08 01:04:58 -080067 struct dentry *debugfs_dir;
Eric Van Hensbergen9e82cf62005-09-09 13:04:20 -070068};
69
70/* possible values of ->proto */
71enum {
72 PROTO_TCP,
73 PROTO_UNIX,
74 PROTO_FD,
75};
76
Latchesar Ionkov3cf64292006-01-08 01:04:58 -080077extern struct dentry *v9fs_debugfs_root;
78
Eric Van Hensbergen9e82cf62005-09-09 13:04:20 -070079int v9fs_session_init(struct v9fs_session_info *, const char *, char *);
80struct v9fs_session_info *v9fs_inode2v9ses(struct inode *);
81void v9fs_session_close(struct v9fs_session_info *v9ses);
82int v9fs_get_idpool(struct v9fs_idpool *p);
83void v9fs_put_idpool(int id, struct v9fs_idpool *p);
Latchesar Ionkov3cf64292006-01-08 01:04:58 -080084int v9fs_check_idpool(int id, struct v9fs_idpool *p);
Eric Van Hensbergen322b3292005-09-09 13:04:23 -070085void v9fs_session_cancel(struct v9fs_session_info *v9ses);
Eric Van Hensbergen9e82cf62005-09-09 13:04:20 -070086
87#define V9FS_MAGIC 0x01021997
88
89/* other default globals */
90#define V9FS_PORT 564
91#define V9FS_DEFUSER "nobody"
92#define V9FS_DEFANAME ""
93
94/* inital pool sizes for fids and tags */
95#define V9FS_START_FIDS 8192
96#define V9FS_START_TIDS 256