Linux 2.6.16.38-rc1
[linux/fpc-iii.git] / fs / 9p / v9fs.h
blobf337da7a0eec1c4c6be93307172ba5e9f7511b70
1 /*
2 * V9FS definitions.
4 * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
5 * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
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.
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.
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
26 * Idpool structure provides lock and id management
30 struct v9fs_idpool {
31 struct semaphore lock;
32 struct idr pool;
36 * Session structure provides information for an opened session
40 struct 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 */
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 */
58 /* book keeping */
59 struct v9fs_idpool fidpool; /* The FID pool for file descriptors */
61 struct v9fs_transport *transport;
62 struct v9fs_mux_data *mux;
64 int inprogress; /* session in progress => true */
65 int shutdown; /* session shutting down. no more attaches. */
66 unsigned char session_hung;
67 struct dentry *debugfs_dir;
70 /* possible values of ->proto */
71 enum {
72 PROTO_TCP,
73 PROTO_UNIX,
74 PROTO_FD,
77 extern struct dentry *v9fs_debugfs_root;
79 int v9fs_session_init(struct v9fs_session_info *, const char *, char *);
80 struct v9fs_session_info *v9fs_inode2v9ses(struct inode *);
81 void v9fs_session_close(struct v9fs_session_info *v9ses);
82 int v9fs_get_idpool(struct v9fs_idpool *p);
83 void v9fs_put_idpool(int id, struct v9fs_idpool *p);
84 int v9fs_check_idpool(int id, struct v9fs_idpool *p);
85 void v9fs_session_cancel(struct v9fs_session_info *v9ses);
87 #define V9FS_MAGIC 0x01021997
89 /* other default globals */
90 #define V9FS_PORT 564
91 #define V9FS_DEFUSER "nobody"
92 #define V9FS_DEFANAME ""
94 /* inital pool sizes for fids and tags */
95 #define V9FS_START_FIDS 8192
96 #define V9FS_START_TIDS 256