diff options
Diffstat (limited to 'include/net/9p/client.h')
| -rw-r--r-- | include/net/9p/client.h | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index fb00b329f0d3..d1aa2cfb30f0 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
| @@ -29,6 +29,19 @@ | |||
| 29 | /* Number of requests per row */ | 29 | /* Number of requests per row */ |
| 30 | #define P9_ROW_MAXTAG 255 | 30 | #define P9_ROW_MAXTAG 255 |
| 31 | 31 | ||
| 32 | /** enum p9_proto_versions - 9P protocol versions | ||
| 33 | * @p9_proto_legacy: 9P Legacy mode, pre-9P2000.u | ||
| 34 | * @p9_proto_2000u: 9P2000.u extension | ||
| 35 | * @p9_proto_2000L: 9P2000.L extension | ||
| 36 | */ | ||
| 37 | |||
| 38 | enum p9_proto_versions{ | ||
| 39 | p9_proto_legacy = 0, | ||
| 40 | p9_proto_2000u = 1, | ||
| 41 | p9_proto_2000L = 2, | ||
| 42 | }; | ||
| 43 | |||
| 44 | |||
| 32 | /** | 45 | /** |
| 33 | * enum p9_trans_status - different states of underlying transports | 46 | * enum p9_trans_status - different states of underlying transports |
| 34 | * @Connected: transport is connected and healthy | 47 | * @Connected: transport is connected and healthy |
| @@ -41,6 +54,7 @@ | |||
| 41 | 54 | ||
| 42 | enum p9_trans_status { | 55 | enum p9_trans_status { |
| 43 | Connected, | 56 | Connected, |
| 57 | BeginDisconnect, | ||
| 44 | Disconnected, | 58 | Disconnected, |
| 45 | Hung, | 59 | Hung, |
| 46 | }; | 60 | }; |
| @@ -111,6 +125,7 @@ struct p9_req_t { | |||
| 111 | * @lock: protect @fidlist | 125 | * @lock: protect @fidlist |
| 112 | * @msize: maximum data size negotiated by protocol | 126 | * @msize: maximum data size negotiated by protocol |
| 113 | * @dotu: extension flags negotiated by protocol | 127 | * @dotu: extension flags negotiated by protocol |
| 128 | * @proto_version: 9P protocol version to use | ||
| 114 | * @trans_mod: module API instantiated with this client | 129 | * @trans_mod: module API instantiated with this client |
| 115 | * @trans: tranport instance state and API | 130 | * @trans: tranport instance state and API |
| 116 | * @conn: connection state information used by trans_fd | 131 | * @conn: connection state information used by trans_fd |
| @@ -137,7 +152,7 @@ struct p9_req_t { | |||
| 137 | struct p9_client { | 152 | struct p9_client { |
| 138 | spinlock_t lock; /* protect client structure */ | 153 | spinlock_t lock; /* protect client structure */ |
| 139 | int msize; | 154 | int msize; |
| 140 | unsigned char dotu; | 155 | unsigned char proto_version; |
| 141 | struct p9_trans_module *trans_mod; | 156 | struct p9_trans_module *trans_mod; |
| 142 | enum p9_trans_status status; | 157 | enum p9_trans_status status; |
| 143 | void *trans; | 158 | void *trans; |
| @@ -180,10 +195,28 @@ struct p9_fid { | |||
| 180 | struct list_head dlist; /* list of all fids attached to a dentry */ | 195 | struct list_head dlist; /* list of all fids attached to a dentry */ |
| 181 | }; | 196 | }; |
| 182 | 197 | ||
| 198 | /** | ||
| 199 | * struct p9_dirent - directory entry structure | ||
| 200 | * @qid: The p9 server qid for this dirent | ||
| 201 | * @d_off: offset to the next dirent | ||
| 202 | * @d_type: type of file | ||
| 203 | * @d_name: file name | ||
| 204 | */ | ||
| 205 | |||
| 206 | struct p9_dirent { | ||
| 207 | struct p9_qid qid; | ||
| 208 | u64 d_off; | ||
| 209 | unsigned char d_type; | ||
| 210 | char d_name[256]; | ||
| 211 | }; | ||
| 212 | |||
| 213 | int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); | ||
| 214 | int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name); | ||
| 183 | int p9_client_version(struct p9_client *); | 215 | int p9_client_version(struct p9_client *); |
| 184 | struct p9_client *p9_client_create(const char *dev_name, char *options); | 216 | struct p9_client *p9_client_create(const char *dev_name, char *options); |
| 185 | void p9_client_destroy(struct p9_client *clnt); | 217 | void p9_client_destroy(struct p9_client *clnt); |
| 186 | void p9_client_disconnect(struct p9_client *clnt); | 218 | void p9_client_disconnect(struct p9_client *clnt); |
| 219 | void p9_client_begin_disconnect(struct p9_client *clnt); | ||
| 187 | struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, | 220 | struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, |
| 188 | char *uname, u32 n_uname, char *aname); | 221 | char *uname, u32 n_uname, char *aname); |
| 189 | struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname, | 222 | struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname, |
| @@ -193,15 +226,31 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, | |||
| 193 | int p9_client_open(struct p9_fid *fid, int mode); | 226 | int p9_client_open(struct p9_fid *fid, int mode); |
| 194 | int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, | 227 | int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, |
| 195 | char *extension); | 228 | char *extension); |
| 229 | int p9_client_link(struct p9_fid *fid, struct p9_fid *oldfid, char *newname); | ||
| 230 | int p9_client_symlink(struct p9_fid *fid, char *name, char *symname, gid_t gid, | ||
| 231 | struct p9_qid *qid); | ||
| 232 | int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode, | ||
| 233 | gid_t gid, struct p9_qid *qid); | ||
| 196 | int p9_client_clunk(struct p9_fid *fid); | 234 | int p9_client_clunk(struct p9_fid *fid); |
| 197 | int p9_client_remove(struct p9_fid *fid); | 235 | int p9_client_remove(struct p9_fid *fid); |
| 198 | int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, | 236 | int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, |
| 199 | u64 offset, u32 count); | 237 | u64 offset, u32 count); |
| 200 | int p9_client_write(struct p9_fid *fid, char *data, const char __user *udata, | 238 | int p9_client_write(struct p9_fid *fid, char *data, const char __user *udata, |
| 201 | u64 offset, u32 count); | 239 | u64 offset, u32 count); |
| 240 | int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset); | ||
| 241 | int p9dirent_read(char *buf, int len, struct p9_dirent *dirent, | ||
| 242 | int proto_version); | ||
| 202 | struct p9_wstat *p9_client_stat(struct p9_fid *fid); | 243 | struct p9_wstat *p9_client_stat(struct p9_fid *fid); |
| 203 | int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst); | 244 | int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst); |
| 245 | int p9_client_setattr(struct p9_fid *fid, struct p9_iattr_dotl *attr); | ||
| 246 | |||
| 247 | struct p9_stat_dotl *p9_client_getattr_dotl(struct p9_fid *fid, | ||
| 248 | u64 request_mask); | ||
| 204 | 249 | ||
| 250 | int p9_client_mknod_dotl(struct p9_fid *oldfid, char *name, int mode, | ||
| 251 | dev_t rdev, gid_t gid, struct p9_qid *); | ||
| 252 | int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode, | ||
| 253 | gid_t gid, struct p9_qid *); | ||
| 205 | struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); | 254 | struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); |
| 206 | void p9_client_cb(struct p9_client *c, struct p9_req_t *req); | 255 | void p9_client_cb(struct p9_client *c, struct p9_req_t *req); |
| 207 | 256 | ||
| @@ -209,5 +258,9 @@ int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int); | |||
| 209 | int p9stat_read(char *, int, struct p9_wstat *, int); | 258 | int p9stat_read(char *, int, struct p9_wstat *, int); |
| 210 | void p9stat_free(struct p9_wstat *); | 259 | void p9stat_free(struct p9_wstat *); |
| 211 | 260 | ||
| 261 | int p9_is_proto_dotu(struct p9_client *clnt); | ||
| 262 | int p9_is_proto_dotl(struct p9_client *clnt); | ||
| 263 | struct p9_fid *p9_client_xattrwalk(struct p9_fid *, const char *, u64 *); | ||
| 264 | int p9_client_xattrcreate(struct p9_fid *, const char *, u64, int); | ||
| 212 | 265 | ||
| 213 | #endif /* NET_9P_CLIENT_H */ | 266 | #endif /* NET_9P_CLIENT_H */ |
