xref: /linux/fs/9p/v9fs.h (revision 42e8c509cfa3d92b3dcbfe95edf6be00e5d4b0eb)
19e82cf6aSEric Van Hensbergen /*
29e82cf6aSEric Van Hensbergen  * V9FS definitions.
39e82cf6aSEric Van Hensbergen  *
49e82cf6aSEric Van Hensbergen  *  Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
59e82cf6aSEric Van Hensbergen  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
69e82cf6aSEric Van Hensbergen  *
79e82cf6aSEric Van Hensbergen  *  This program is free software; you can redistribute it and/or modify
8*42e8c509SEric Van Hensbergen  *  it under the terms of the GNU General Public License version 2
9*42e8c509SEric Van Hensbergen  *  as published by the Free Software Foundation.
109e82cf6aSEric Van Hensbergen  *
119e82cf6aSEric Van Hensbergen  *  This program is distributed in the hope that it will be useful,
129e82cf6aSEric Van Hensbergen  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
139e82cf6aSEric Van Hensbergen  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
149e82cf6aSEric Van Hensbergen  *  GNU General Public License for more details.
159e82cf6aSEric Van Hensbergen  *
169e82cf6aSEric Van Hensbergen  *  You should have received a copy of the GNU General Public License
179e82cf6aSEric Van Hensbergen  *  along with this program; if not, write to:
189e82cf6aSEric Van Hensbergen  *  Free Software Foundation
199e82cf6aSEric Van Hensbergen  *  51 Franklin Street, Fifth Floor
209e82cf6aSEric Van Hensbergen  *  Boston, MA  02111-1301  USA
219e82cf6aSEric Van Hensbergen  *
229e82cf6aSEric Van Hensbergen  */
239e82cf6aSEric Van Hensbergen 
249e82cf6aSEric Van Hensbergen /*
259e82cf6aSEric Van Hensbergen   * Idpool structure provides lock and id management
269e82cf6aSEric Van Hensbergen   *
279e82cf6aSEric Van Hensbergen   */
289e82cf6aSEric Van Hensbergen 
299e82cf6aSEric Van Hensbergen struct v9fs_idpool {
309e82cf6aSEric Van Hensbergen 	struct semaphore lock;
319e82cf6aSEric Van Hensbergen 	struct idr pool;
329e82cf6aSEric Van Hensbergen };
339e82cf6aSEric Van Hensbergen 
349e82cf6aSEric Van Hensbergen /*
359e82cf6aSEric Van Hensbergen   * Session structure provides information for an opened session
369e82cf6aSEric Van Hensbergen   *
379e82cf6aSEric Van Hensbergen   */
389e82cf6aSEric Van Hensbergen 
399e82cf6aSEric Van Hensbergen struct v9fs_session_info {
409e82cf6aSEric Van Hensbergen 	/* options */
419e82cf6aSEric Van Hensbergen 	unsigned int maxdata;
429e82cf6aSEric Van Hensbergen 	unsigned char extended;	/* set to 1 if we are using UNIX extensions */
439e82cf6aSEric Van Hensbergen 	unsigned char nodev;	/* set to 1 if no disable device mapping */
449e82cf6aSEric Van Hensbergen 	unsigned short port;	/* port to connect to */
459e82cf6aSEric Van Hensbergen 	unsigned short debug;	/* debug level */
469e82cf6aSEric Van Hensbergen 	unsigned short proto;	/* protocol to use */
479e82cf6aSEric Van Hensbergen 	unsigned int afid;	/* authentication fid */
489e82cf6aSEric Van Hensbergen 	unsigned int rfdno;	/* read file descriptor number */
499e82cf6aSEric Van Hensbergen 	unsigned int wfdno;	/* write file descriptor number */
509e82cf6aSEric Van Hensbergen 
519e82cf6aSEric Van Hensbergen 
529e82cf6aSEric Van Hensbergen 	char *name;		/* user name to mount as */
539e82cf6aSEric Van Hensbergen 	char *remotename;	/* name of remote hierarchy being mounted */
549e82cf6aSEric Van Hensbergen 	unsigned int uid;	/* default uid/muid for legacy support */
559e82cf6aSEric Van Hensbergen 	unsigned int gid;	/* default gid for legacy support */
569e82cf6aSEric Van Hensbergen 
579e82cf6aSEric Van Hensbergen 	/* book keeping */
589e82cf6aSEric Van Hensbergen 	struct v9fs_idpool fidpool;	/* The FID pool for file descriptors */
599e82cf6aSEric Van Hensbergen 
609e82cf6aSEric Van Hensbergen 	struct v9fs_transport *transport;
613cf6429aSLatchesar Ionkov 	struct v9fs_mux_data *mux;
629e82cf6aSEric Van Hensbergen 
639e82cf6aSEric Van Hensbergen 	int inprogress;		/* session in progress => true */
649e82cf6aSEric Van Hensbergen 	int shutdown;		/* session shutting down. no more attaches. */
659e82cf6aSEric Van Hensbergen 	unsigned char session_hung;
663cf6429aSLatchesar Ionkov 	struct dentry *debugfs_dir;
679e82cf6aSEric Van Hensbergen };
689e82cf6aSEric Van Hensbergen 
699e82cf6aSEric Van Hensbergen /* possible values of ->proto */
709e82cf6aSEric Van Hensbergen enum {
719e82cf6aSEric Van Hensbergen 	PROTO_TCP,
729e82cf6aSEric Van Hensbergen 	PROTO_UNIX,
739e82cf6aSEric Van Hensbergen 	PROTO_FD,
749e82cf6aSEric Van Hensbergen };
759e82cf6aSEric Van Hensbergen 
763cf6429aSLatchesar Ionkov extern struct dentry *v9fs_debugfs_root;
773cf6429aSLatchesar Ionkov 
789e82cf6aSEric Van Hensbergen int v9fs_session_init(struct v9fs_session_info *, const char *, char *);
799e82cf6aSEric Van Hensbergen struct v9fs_session_info *v9fs_inode2v9ses(struct inode *);
809e82cf6aSEric Van Hensbergen void v9fs_session_close(struct v9fs_session_info *v9ses);
819e82cf6aSEric Van Hensbergen int v9fs_get_idpool(struct v9fs_idpool *p);
829e82cf6aSEric Van Hensbergen void v9fs_put_idpool(int id, struct v9fs_idpool *p);
833cf6429aSLatchesar Ionkov int v9fs_check_idpool(int id, struct v9fs_idpool *p);
84322b329aSEric Van Hensbergen void v9fs_session_cancel(struct v9fs_session_info *v9ses);
859e82cf6aSEric Van Hensbergen 
869e82cf6aSEric Van Hensbergen #define V9FS_MAGIC 0x01021997
879e82cf6aSEric Van Hensbergen 
889e82cf6aSEric Van Hensbergen /* other default globals */
899e82cf6aSEric Van Hensbergen #define V9FS_PORT		564
909e82cf6aSEric Van Hensbergen #define V9FS_DEFUSER	"nobody"
919e82cf6aSEric Van Hensbergen #define V9FS_DEFANAME	""
929e82cf6aSEric Van Hensbergen 
93