aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/9p
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/net/9p
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/net/9p')
-rw-r--r--include/net/9p/9p.h83
-rw-r--r--include/net/9p/client.h15
-rw-r--r--include/net/9p/transport.h12
3 files changed, 91 insertions, 19 deletions
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index a8de812ccbc8..008711e8e78f 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -86,6 +86,8 @@ do { \
86 86
87/** 87/**
88 * enum p9_msg_t - 9P message types 88 * enum p9_msg_t - 9P message types
89 * @P9_TLERROR: not used
90 * @P9_RLERROR: response for any failed request for 9P2000.L
89 * @P9_TSTATFS: file system status request 91 * @P9_TSTATFS: file system status request
90 * @P9_RSTATFS: file system status response 92 * @P9_RSTATFS: file system status response
91 * @P9_TSYMLINK: make symlink request 93 * @P9_TSYMLINK: make symlink request
@@ -117,7 +119,7 @@ do { \
117 * @P9_TREAD: request to transfer data from a file or directory 119 * @P9_TREAD: request to transfer data from a file or directory
118 * @P9_RREAD: response with data requested 120 * @P9_RREAD: response with data requested
119 * @P9_TWRITE: reuqest to transfer data to a file 121 * @P9_TWRITE: reuqest to transfer data to a file
120 * @P9_RWRITE: response with out much data was transfered to file 122 * @P9_RWRITE: response with out much data was transferred to file
121 * @P9_TCLUNK: forget about a handle to an entity within the file system 123 * @P9_TCLUNK: forget about a handle to an entity within the file system
122 * @P9_RCLUNK: response when server has forgotten about the handle 124 * @P9_RCLUNK: response when server has forgotten about the handle
123 * @P9_TREMOVE: request to remove an entity from the hierarchy 125 * @P9_TREMOVE: request to remove an entity from the hierarchy
@@ -137,6 +139,8 @@ do { \
137 */ 139 */
138 140
139enum p9_msg_t { 141enum p9_msg_t {
142 P9_TLERROR = 6,
143 P9_RLERROR,
140 P9_TSTATFS = 8, 144 P9_TSTATFS = 8,
141 P9_RSTATFS, 145 P9_RSTATFS,
142 P9_TLOPEN = 12, 146 P9_TLOPEN = 12,
@@ -149,6 +153,8 @@ enum p9_msg_t {
149 P9_RMKNOD, 153 P9_RMKNOD,
150 P9_TRENAME = 20, 154 P9_TRENAME = 20,
151 P9_RRENAME, 155 P9_RRENAME,
156 P9_TREADLINK = 22,
157 P9_RREADLINK,
152 P9_TGETATTR = 24, 158 P9_TGETATTR = 24,
153 P9_RGETATTR, 159 P9_RGETATTR,
154 P9_TSETATTR = 26, 160 P9_TSETATTR = 26,
@@ -159,6 +165,12 @@ enum p9_msg_t {
159 P9_RXATTRCREATE, 165 P9_RXATTRCREATE,
160 P9_TREADDIR = 40, 166 P9_TREADDIR = 40,
161 P9_RREADDIR, 167 P9_RREADDIR,
168 P9_TFSYNC = 50,
169 P9_RFSYNC,
170 P9_TLOCK = 52,
171 P9_RLOCK,
172 P9_TGETLOCK = 54,
173 P9_RGETLOCK,
162 P9_TLINK = 70, 174 P9_TLINK = 70,
163 P9_RLINK, 175 P9_RLINK,
164 P9_TMKDIR = 72, 176 P9_TMKDIR = 72,
@@ -229,10 +241,10 @@ enum p9_open_mode_t {
229 241
230/** 242/**
231 * enum p9_perm_t - 9P permissions 243 * enum p9_perm_t - 9P permissions
232 * @P9_DMDIR: mode bite for directories 244 * @P9_DMDIR: mode bit for directories
233 * @P9_DMAPPEND: mode bit for is append-only 245 * @P9_DMAPPEND: mode bit for is append-only
234 * @P9_DMEXCL: mode bit for excluse use (only one open handle allowed) 246 * @P9_DMEXCL: mode bit for excluse use (only one open handle allowed)
235 * @P9_DMMOUNT: mode bite for mount points 247 * @P9_DMMOUNT: mode bit for mount points
236 * @P9_DMAUTH: mode bit for authentication file 248 * @P9_DMAUTH: mode bit for authentication file
237 * @P9_DMTMP: mode bit for non-backed-up files 249 * @P9_DMTMP: mode bit for non-backed-up files
238 * @P9_DMSYMLINK: mode bit for symbolic links (9P2000.u) 250 * @P9_DMSYMLINK: mode bit for symbolic links (9P2000.u)
@@ -280,7 +292,7 @@ enum p9_perm_t {
280 * 292 *
281 * QID types are a subset of permissions - they are primarily 293 * QID types are a subset of permissions - they are primarily
282 * used to differentiate semantics for a file system entity via 294 * used to differentiate semantics for a file system entity via
283 * a jump-table. Their value is also the most signifigant 16 bits 295 * a jump-table. Their value is also the most significant 16 bits
284 * of the permission_t 296 * of the permission_t
285 * 297 *
286 * See Also: http://plan9.bell-labs.com/magic/man2html/2/stat 298 * See Also: http://plan9.bell-labs.com/magic/man2html/2/stat
@@ -350,10 +362,10 @@ struct p9_qid {
350}; 362};
351 363
352/** 364/**
353 * struct p9_stat - file system metadata information 365 * struct p9_wstat - file system metadata information
354 * @size: length prefix for this stat structure instance 366 * @size: length prefix for this stat structure instance
355 * @type: the type of the server (equivilent to a major number) 367 * @type: the type of the server (equivalent to a major number)
356 * @dev: the sub-type of the server (equivilent to a minor number) 368 * @dev: the sub-type of the server (equivalent to a minor number)
357 * @qid: unique id from the server of type &p9_qid 369 * @qid: unique id from the server of type &p9_qid
358 * @mode: Plan 9 format permissions of type &p9_perm_t 370 * @mode: Plan 9 format permissions of type &p9_perm_t
359 * @atime: Last access/read time 371 * @atime: Last access/read time
@@ -458,6 +470,48 @@ struct p9_iattr_dotl {
458 u64 mtime_nsec; 470 u64 mtime_nsec;
459}; 471};
460 472
473#define P9_LOCK_SUCCESS 0
474#define P9_LOCK_BLOCKED 1
475#define P9_LOCK_ERROR 2
476#define P9_LOCK_GRACE 3
477
478#define P9_LOCK_FLAGS_BLOCK 1
479#define P9_LOCK_FLAGS_RECLAIM 2
480
481/* struct p9_flock: POSIX lock structure
482 * @type - type of lock
483 * @flags - lock flags
484 * @start - starting offset of the lock
485 * @length - number of bytes
486 * @proc_id - process id which wants to take lock
487 * @client_id - client id
488 */
489
490struct p9_flock {
491 u8 type;
492 u32 flags;
493 u64 start;
494 u64 length;
495 u32 proc_id;
496 char *client_id;
497};
498
499/* struct p9_getlock: getlock structure
500 * @type - type of lock
501 * @start - starting offset of the lock
502 * @length - number of bytes
503 * @proc_id - process id which wants to take lock
504 * @client_id - client id
505 */
506
507struct p9_getlock {
508 u8 type;
509 u64 start;
510 u64 length;
511 u32 proc_id;
512 char *client_id;
513};
514
461/* Structures for Protocol Operations */ 515/* Structures for Protocol Operations */
462struct p9_tstatfs { 516struct p9_tstatfs {
463 u32 fid; 517 u32 fid;
@@ -633,8 +687,12 @@ struct p9_rwstat {
633 * @size: prefixed length of the structure 687 * @size: prefixed length of the structure
634 * @id: protocol operating identifier of type &p9_msg_t 688 * @id: protocol operating identifier of type &p9_msg_t
635 * @tag: transaction id of the request 689 * @tag: transaction id of the request
636 * @offset: used by marshalling routines to track currentposition in buffer 690 * @offset: used by marshalling routines to track current position in buffer
637 * @capacity: used by marshalling routines to track total capacity 691 * @capacity: used by marshalling routines to track total malloc'd capacity
692 * @pubuf: Payload user buffer given by the caller
693 * @pkbuf: Payload kernel buffer given by the caller
694 * @pbuf_size: pubuf/pkbuf(only one will be !NULL) size to be read/write.
695 * @private: For transport layer's use.
638 * @sdata: payload 696 * @sdata: payload
639 * 697 *
640 * &p9_fcall represents the structure for all 9P RPC 698 * &p9_fcall represents the structure for all 9P RPC
@@ -651,8 +709,12 @@ struct p9_fcall {
651 709
652 size_t offset; 710 size_t offset;
653 size_t capacity; 711 size_t capacity;
712 char __user *pubuf;
713 char *pkbuf;
714 size_t pbuf_size;
715 void *private;
654 716
655 uint8_t *sdata; 717 u8 *sdata;
656}; 718};
657 719
658struct p9_idpool; 720struct p9_idpool;
@@ -666,7 +728,6 @@ void p9_idpool_put(int id, struct p9_idpool *p);
666int p9_idpool_check(int id, struct p9_idpool *p); 728int p9_idpool_check(int id, struct p9_idpool *p);
667 729
668int p9_error_init(void); 730int p9_error_init(void);
669int p9_errstr2errno(char *, int);
670int p9_trans_fd_init(void); 731int p9_trans_fd_init(void);
671void p9_trans_fd_exit(void); 732void p9_trans_fd_exit(void);
672#endif /* NET_9P_H */ 733#endif /* NET_9P_H */
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index d1aa2cfb30f0..d26d5e98a173 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -60,7 +60,7 @@ enum p9_trans_status {
60}; 60};
61 61
62/** 62/**
63 * enum p9_req_status_t - virtio request status 63 * enum p9_req_status_t - status of a request
64 * @REQ_STATUS_IDLE: request slot unused 64 * @REQ_STATUS_IDLE: request slot unused
65 * @REQ_STATUS_ALLOC: request has been allocated but not sent 65 * @REQ_STATUS_ALLOC: request has been allocated but not sent
66 * @REQ_STATUS_UNSENT: request waiting to be sent 66 * @REQ_STATUS_UNSENT: request waiting to be sent
@@ -101,7 +101,7 @@ enum p9_req_status_t {
101 * Transport use an array to track outstanding requests 101 * Transport use an array to track outstanding requests
102 * instead of a list. While this may incurr overhead during initial 102 * instead of a list. While this may incurr overhead during initial
103 * allocation or expansion, it makes request lookup much easier as the 103 * allocation or expansion, it makes request lookup much easier as the
104 * tag id is a index into an array. (We use tag+1 so that we can accomodate 104 * tag id is a index into an array. (We use tag+1 so that we can accommodate
105 * the -1 tag for the T_VERSION request). 105 * the -1 tag for the T_VERSION request).
106 * This also has the nice effect of only having to allocate wait_queues 106 * This also has the nice effect of only having to allocate wait_queues
107 * once, instead of constantly allocating and freeing them. Its possible 107 * once, instead of constantly allocating and freeing them. Its possible
@@ -212,17 +212,14 @@ struct p9_dirent {
212 212
213int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); 213int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb);
214int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name); 214int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name);
215int p9_client_version(struct p9_client *);
216struct p9_client *p9_client_create(const char *dev_name, char *options); 215struct p9_client *p9_client_create(const char *dev_name, char *options);
217void p9_client_destroy(struct p9_client *clnt); 216void p9_client_destroy(struct p9_client *clnt);
218void p9_client_disconnect(struct p9_client *clnt); 217void p9_client_disconnect(struct p9_client *clnt);
219void p9_client_begin_disconnect(struct p9_client *clnt); 218void p9_client_begin_disconnect(struct p9_client *clnt);
220struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, 219struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
221 char *uname, u32 n_uname, char *aname); 220 char *uname, u32 n_uname, char *aname);
222struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname, 221struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname,
223 u32 n_uname, char *aname); 222 char **wnames, int clone);
224struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
225 int clone);
226int p9_client_open(struct p9_fid *fid, int mode); 223int p9_client_open(struct p9_fid *fid, int mode);
227int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, 224int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
228 char *extension); 225 char *extension);
@@ -232,6 +229,7 @@ int p9_client_symlink(struct p9_fid *fid, char *name, char *symname, gid_t gid,
232int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode, 229int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
233 gid_t gid, struct p9_qid *qid); 230 gid_t gid, struct p9_qid *qid);
234int p9_client_clunk(struct p9_fid *fid); 231int p9_client_clunk(struct p9_fid *fid);
232int p9_client_fsync(struct p9_fid *fid, int datasync);
235int p9_client_remove(struct p9_fid *fid); 233int p9_client_remove(struct p9_fid *fid);
236int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, 234int p9_client_read(struct p9_fid *fid, char *data, char __user *udata,
237 u64 offset, u32 count); 235 u64 offset, u32 count);
@@ -251,6 +249,8 @@ int p9_client_mknod_dotl(struct p9_fid *oldfid, char *name, int mode,
251 dev_t rdev, gid_t gid, struct p9_qid *); 249 dev_t rdev, gid_t gid, struct p9_qid *);
252int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode, 250int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode,
253 gid_t gid, struct p9_qid *); 251 gid_t gid, struct p9_qid *);
252int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status);
253int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *fl);
254struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); 254struct p9_req_t *p9_tag_lookup(struct p9_client *, u16);
255void p9_client_cb(struct p9_client *c, struct p9_req_t *req); 255void p9_client_cb(struct p9_client *c, struct p9_req_t *req);
256 256
@@ -262,5 +262,6 @@ int p9_is_proto_dotu(struct p9_client *clnt);
262int p9_is_proto_dotl(struct p9_client *clnt); 262int p9_is_proto_dotl(struct p9_client *clnt);
263struct p9_fid *p9_client_xattrwalk(struct p9_fid *, const char *, u64 *); 263struct p9_fid *p9_client_xattrwalk(struct p9_fid *, const char *, u64 *);
264int p9_client_xattrcreate(struct p9_fid *, const char *, u64, int); 264int p9_client_xattrcreate(struct p9_fid *, const char *, u64, int);
265int p9_client_readlink(struct p9_fid *fid, char **target);
265 266
266#endif /* NET_9P_CLIENT_H */ 267#endif /* NET_9P_CLIENT_H */
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 6d5886efb102..d8549fb9c742 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -26,13 +26,22 @@
26#ifndef NET_9P_TRANSPORT_H 26#ifndef NET_9P_TRANSPORT_H
27#define NET_9P_TRANSPORT_H 27#define NET_9P_TRANSPORT_H
28 28
29#define P9_TRANS_PREF_PAYLOAD_MASK 0x1
30
31/* Default. Add Payload to PDU before sending it down to transport layer */
32#define P9_TRANS_PREF_PAYLOAD_DEF 0x0
33/* Send pay load separately to transport layer along with PDU.*/
34#define P9_TRANS_PREF_PAYLOAD_SEP 0x1
35
29/** 36/**
30 * struct p9_trans_module - transport module interface 37 * struct p9_trans_module - transport module interface
31 * @list: used to maintain a list of currently available transports 38 * @list: used to maintain a list of currently available transports
32 * @name: the human-readable name of the transport 39 * @name: the human-readable name of the transport
33 * @maxsize: transport provided maximum packet size 40 * @maxsize: transport provided maximum packet size
41 * @pref: Preferences of this transport
34 * @def: set if this transport should be considered the default 42 * @def: set if this transport should be considered the default
35 * @create: member function to create a new connection on this transport 43 * @create: member function to create a new connection on this transport
44 * @close: member function to discard a connection on this transport
36 * @request: member function to issue a request to the transport 45 * @request: member function to issue a request to the transport
37 * @cancel: member function to cancel a request (if it hasn't been sent) 46 * @cancel: member function to cancel a request (if it hasn't been sent)
38 * 47 *
@@ -40,13 +49,14 @@
40 * transport module with the 9P core network module and used by the client 49 * transport module with the 9P core network module and used by the client
41 * to instantiate a new connection on a transport. 50 * to instantiate a new connection on a transport.
42 * 51 *
43 * BUGS: the transport module list isn't protected. 52 * The transport module list is protected by v9fs_trans_lock.
44 */ 53 */
45 54
46struct p9_trans_module { 55struct p9_trans_module {
47 struct list_head list; 56 struct list_head list;
48 char *name; /* name of transport */ 57 char *name; /* name of transport */
49 int maxsize; /* max message size of transport */ 58 int maxsize; /* max message size of transport */
59 int pref; /* Preferences of this transport */
50 int def; /* this transport should be default */ 60 int def; /* this transport should be default */
51 struct module *owner; 61 struct module *owner;
52 int (*create)(struct p9_client *, const char *, char *); 62 int (*create)(struct p9_client *, const char *, char *);