2 * include/net/9p/client.h
4 * 9P Client Definitions
6 * Copyright (C) 2008 by Eric Van Hensbergen <ericvh@gmail.com>
7 * Copyright (C) 2007 by Latchesar Ionkov <lucho@ionkov.net>
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.
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.
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
26 #ifndef NET_9P_CLIENT_H
27 #define NET_9P_CLIENT_H
30 * enum p9_trans_status - different states of underlying transports
31 * @Connected: transport is connected and healthy
32 * @Disconnected: transport has been disconnected
33 * @Hung: transport is connected by wedged
35 * This enumeration details the various states a transport
36 * instatiation can be in.
39 enum p9_trans_status {
46 * struct p9_client - per client instance state
47 * @lock: protect @fidlist
48 * @msize: maximum data size negotiated by protocol
49 * @dotu: extension flags negotiated by protocol
50 * @trans_mod: module API instantiated with this client
51 * @trans: tranport instance state and API
52 * @conn: connection state information used by trans_fd
53 * @fidpool: fid handle accounting for session
54 * @fidlist: List of active fid handles
56 * The client structure is used to keep track of various per-client
57 * state that has been instantiated.
59 * Bugs: duplicated data and potentially unnecessary elements.
63 spinlock_t lock; /* protect client structure */
66 struct p9_trans_module *trans_mod;
67 enum p9_trans_status status;
71 struct p9_idpool *fidpool;
72 struct list_head fidlist;
76 * struct p9_fid - file system entity handle
77 * @clnt: back pointer to instantiating &p9_client
78 * @fid: numeric identifier for this handle
79 * @mode: current mode of this fid (enum?)
80 * @qid: the &p9_qid server identifier this handle points to
81 * @iounit: the server reported maximum transaction size for this file
82 * @uid: the numeric uid of the local user who owns this handle
83 * @aux: transport specific information (unused?)
84 * @rdir_fpos: tracks offset of file position when reading directory contents
85 * @rdir_pos: (unused?)
86 * @rdir_fcall: holds response of last directory read request
87 * @flist: per-client-instance fid tracking
88 * @dlist: per-dentry fid tracking
90 * TODO: This needs lots of explanation.
94 struct p9_client *clnt;
104 struct p9_fcall *rdir_fcall;
105 struct list_head flist;
106 struct list_head dlist; /* list of all fids attached to a dentry */
109 struct p9_client *p9_client_create(const char *dev_name, char *options);
110 void p9_client_destroy(struct p9_client *clnt);
111 void p9_client_disconnect(struct p9_client *clnt);
112 struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
113 char *uname, u32 n_uname, char *aname);
114 struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname,
115 u32 n_uname, char *aname);
116 struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
118 int p9_client_open(struct p9_fid *fid, int mode);
119 int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
121 int p9_client_clunk(struct p9_fid *fid);
122 int p9_client_remove(struct p9_fid *fid);
123 int p9_client_read(struct p9_fid *fid, char *data, u64 offset, u32 count);
124 int p9_client_readn(struct p9_fid *fid, char *data, u64 offset, u32 count);
125 int p9_client_write(struct p9_fid *fid, char *data, u64 offset, u32 count);
126 int p9_client_uread(struct p9_fid *fid, char __user *data, u64 offset,
128 int p9_client_uwrite(struct p9_fid *fid, const char __user *data, u64 offset,
130 struct p9_stat *p9_client_stat(struct p9_fid *fid);
131 int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst);
132 struct p9_stat *p9_client_dirread(struct p9_fid *fid, u64 offset);
134 #endif /* NET_9P_CLIENT_H */