blob: e52f93d9ac5fca1dccdbe66a256b2d1b241f1e75 [file] [log] [blame]
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -05001/*
2 * include/net/9p/client.h
3 *
4 * 9P Client Definitions
5 *
Eric Van Hensbergen8a0dc952008-02-06 19:25:03 -06006 * Copyright (C) 2008 by Eric Van Hensbergen <ericvh@gmail.com>
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -05007 * Copyright (C) 2007 by Latchesar Ionkov <lucho@ionkov.net>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2
11 * as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to:
20 * Free Software Foundation
21 * 51 Franklin Street, Fifth Floor
22 * Boston, MA 02111-1301 USA
23 *
24 */
25
26#ifndef NET_9P_CLIENT_H
27#define NET_9P_CLIENT_H
28
29struct p9_client {
30 spinlock_t lock; /* protect client structure */
31 int msize;
32 unsigned char dotu;
Eric Van Hensbergen8a0dc952008-02-06 19:25:03 -060033 struct p9_trans_module *trans_mod;
Eric Van Hensbergena80d9232007-10-17 14:31:07 -050034 struct p9_trans *trans;
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -050035 struct p9_conn *conn;
36
37 struct p9_idpool *fidpool;
38 struct list_head fidlist;
39};
40
41struct p9_fid {
42 struct p9_client *clnt;
43 u32 fid;
44 int mode;
45 struct p9_qid qid;
46 u32 iounit;
47 uid_t uid;
48 void *aux;
49
50 int rdir_fpos;
51 int rdir_pos;
52 struct p9_fcall *rdir_fcall;
53 struct list_head flist;
54 struct list_head dlist; /* list of all fids attached to a dentry */
55};
56
Eric Van Hensbergen8a0dc952008-02-06 19:25:03 -060057struct p9_client *p9_client_create(const char *dev_name, char *options);
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -050058void p9_client_destroy(struct p9_client *clnt);
59void p9_client_disconnect(struct p9_client *clnt);
60struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
Latchesar Ionkovba176742007-10-17 14:31:07 -050061 char *uname, u32 n_uname, char *aname);
62struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname,
63 u32 n_uname, char *aname);
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -050064struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
65 int clone);
66int p9_client_open(struct p9_fid *fid, int mode);
67int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
68 char *extension);
69int p9_client_clunk(struct p9_fid *fid);
70int p9_client_remove(struct p9_fid *fid);
71int p9_client_read(struct p9_fid *fid, char *data, u64 offset, u32 count);
72int p9_client_readn(struct p9_fid *fid, char *data, u64 offset, u32 count);
73int p9_client_write(struct p9_fid *fid, char *data, u64 offset, u32 count);
74int p9_client_uread(struct p9_fid *fid, char __user *data, u64 offset,
75 u32 count);
76int p9_client_uwrite(struct p9_fid *fid, const char __user *data, u64 offset,
77 u32 count);
78struct p9_stat *p9_client_stat(struct p9_fid *fid);
79int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst);
80struct p9_stat *p9_client_dirread(struct p9_fid *fid, u64 offset);
81
82#endif /* NET_9P_CLIENT_H */