aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/9p/9p.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/9p/9p.h')
-rw-r--r--include/net/9p/9p.h83
1 files changed, 72 insertions, 11 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 */