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.h119
1 files changed, 21 insertions, 98 deletions
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index fb163e2e0de6..d2c60c73619d 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -27,8 +27,6 @@
27#ifndef NET_9P_H 27#ifndef NET_9P_H
28#define NET_9P_H 28#define NET_9P_H
29 29
30#ifdef CONFIG_NET_9P_DEBUG
31
32/** 30/**
33 * enum p9_debug_flags - bits for mount time debug parameter 31 * enum p9_debug_flags - bits for mount time debug parameter
34 * @P9_DEBUG_ERROR: more verbose error messages including original error string 32 * @P9_DEBUG_ERROR: more verbose error messages including original error string
@@ -39,6 +37,7 @@
39 * @P9_DEBUG_TRANS: transport tracing 37 * @P9_DEBUG_TRANS: transport tracing
40 * @P9_DEBUG_SLABS: memory management tracing 38 * @P9_DEBUG_SLABS: memory management tracing
41 * @P9_DEBUG_FCALL: verbose dump of protocol messages 39 * @P9_DEBUG_FCALL: verbose dump of protocol messages
40 * @P9_DEBUG_FID: fid allocation/deallocation tracking
42 * 41 *
43 * These flags are passed at mount time to turn on various levels of 42 * These flags are passed at mount time to turn on various levels of
44 * verbosity and tracing which will be output to the system logs. 43 * verbosity and tracing which will be output to the system logs.
@@ -53,24 +52,27 @@ enum p9_debug_flags {
53 P9_DEBUG_TRANS = (1<<6), 52 P9_DEBUG_TRANS = (1<<6),
54 P9_DEBUG_SLABS = (1<<7), 53 P9_DEBUG_SLABS = (1<<7),
55 P9_DEBUG_FCALL = (1<<8), 54 P9_DEBUG_FCALL = (1<<8),
55 P9_DEBUG_FID = (1<<9),
56 P9_DEBUG_PKT = (1<<10),
56}; 57};
57 58
58extern unsigned int p9_debug_level; 59extern unsigned int p9_debug_level;
59 60
61#ifdef CONFIG_NET_9P_DEBUG
60#define P9_DPRINTK(level, format, arg...) \ 62#define P9_DPRINTK(level, format, arg...) \
61do { \ 63do { \
62 if ((p9_debug_level & level) == level) \ 64 if ((p9_debug_level & level) == level) {\
63 printk(KERN_NOTICE "-- %s (%d): " \ 65 if (level == P9_DEBUG_9P) \
64 format , __func__, task_pid_nr(current) , ## arg); \ 66 printk(KERN_NOTICE "(%8.8d) " \
67 format , task_pid_nr(current) , ## arg); \
68 else \
69 printk(KERN_NOTICE "-- %s (%d): " \
70 format , __func__, task_pid_nr(current) , ## arg); \
71 } \
65} while (0) 72} while (0)
66 73
67#define PRINT_FCALL_ERROR(s, fcall) P9_DPRINTK(P9_DEBUG_ERROR, \
68 "%s: %.*s\n", s, fcall?fcall->params.rerror.error.len:0, \
69 fcall?fcall->params.rerror.error.str:"");
70
71#else 74#else
72#define P9_DPRINTK(level, format, arg...) do { } while (0) 75#define P9_DPRINTK(level, format, arg...) do { } while (0)
73#define PRINT_FCALL_ERROR(s, fcall) do { } while (0)
74#endif 76#endif
75 77
76#define P9_EPRINTK(level, format, arg...) \ 78#define P9_EPRINTK(level, format, arg...) \
@@ -325,33 +327,6 @@ struct p9_qid {
325 * See Also: http://plan9.bell-labs.com/magic/man2html/2/stat 327 * See Also: http://plan9.bell-labs.com/magic/man2html/2/stat
326 */ 328 */
327 329
328struct p9_stat {
329 u16 size;
330 u16 type;
331 u32 dev;
332 struct p9_qid qid;
333 u32 mode;
334 u32 atime;
335 u32 mtime;
336 u64 length;
337 struct p9_str name;
338 struct p9_str uid;
339 struct p9_str gid;
340 struct p9_str muid;
341 struct p9_str extension; /* 9p2000.u extensions */
342 u32 n_uid; /* 9p2000.u extensions */
343 u32 n_gid; /* 9p2000.u extensions */
344 u32 n_muid; /* 9p2000.u extensions */
345};
346
347/*
348 * file metadata (stat) structure used to create Twstat message
349 * The is identical to &p9_stat, but the strings don't point to
350 * the same memory block and should be freed separately
351 *
352 * See Also: http://plan9.bell-labs.com/magic/man2html/2/stat
353 */
354
355struct p9_wstat { 330struct p9_wstat {
356 u16 size; 331 u16 size;
357 u16 type; 332 u16 type;
@@ -493,12 +468,12 @@ struct p9_tstat {
493}; 468};
494 469
495struct p9_rstat { 470struct p9_rstat {
496 struct p9_stat stat; 471 struct p9_wstat stat;
497}; 472};
498 473
499struct p9_twstat { 474struct p9_twstat {
500 u32 fid; 475 u32 fid;
501 struct p9_stat stat; 476 struct p9_wstat stat;
502}; 477};
503 478
504struct p9_rwstat { 479struct p9_rwstat {
@@ -509,8 +484,9 @@ struct p9_rwstat {
509 * @size: prefixed length of the structure 484 * @size: prefixed length of the structure
510 * @id: protocol operating identifier of type &p9_msg_t 485 * @id: protocol operating identifier of type &p9_msg_t
511 * @tag: transaction id of the request 486 * @tag: transaction id of the request
487 * @offset: used by marshalling routines to track currentposition in buffer
488 * @capacity: used by marshalling routines to track total capacity
512 * @sdata: payload 489 * @sdata: payload
513 * @params: per-operation parameters
514 * 490 *
515 * &p9_fcall represents the structure for all 9P RPC 491 * &p9_fcall represents the structure for all 9P RPC
516 * transactions. Requests are packaged into fcalls, and reponses 492 * transactions. Requests are packaged into fcalls, and reponses
@@ -523,68 +499,15 @@ struct p9_fcall {
523 u32 size; 499 u32 size;
524 u8 id; 500 u8 id;
525 u16 tag; 501 u16 tag;
526 void *sdata; 502
527 503 size_t offset;
528 union { 504 size_t capacity;
529 struct p9_tversion tversion; 505
530 struct p9_rversion rversion; 506 uint8_t *sdata;
531 struct p9_tauth tauth;
532 struct p9_rauth rauth;
533 struct p9_rerror rerror;
534 struct p9_tflush tflush;
535 struct p9_rflush rflush;
536 struct p9_tattach tattach;
537 struct p9_rattach rattach;
538 struct p9_twalk twalk;
539 struct p9_rwalk rwalk;
540 struct p9_topen topen;
541 struct p9_ropen ropen;
542 struct p9_tcreate tcreate;
543 struct p9_rcreate rcreate;
544 struct p9_tread tread;
545 struct p9_rread rread;
546 struct p9_twrite twrite;
547 struct p9_rwrite rwrite;
548 struct p9_tclunk tclunk;
549 struct p9_rclunk rclunk;
550 struct p9_tremove tremove;
551 struct p9_rremove rremove;
552 struct p9_tstat tstat;
553 struct p9_rstat rstat;
554 struct p9_twstat twstat;
555 struct p9_rwstat rwstat;
556 } params;
557}; 507};
558 508
559struct p9_idpool; 509struct p9_idpool;
560 510
561int p9_deserialize_stat(void *buf, u32 buflen, struct p9_stat *stat,
562 int dotu);
563int p9_deserialize_fcall(void *buf, u32 buflen, struct p9_fcall *fc, int dotu);
564void p9_set_tag(struct p9_fcall *fc, u16 tag);
565struct p9_fcall *p9_create_tversion(u32 msize, char *version);
566struct p9_fcall *p9_create_tattach(u32 fid, u32 afid, char *uname,
567 char *aname, u32 n_uname, int dotu);
568struct p9_fcall *p9_create_tauth(u32 afid, char *uname, char *aname,
569 u32 n_uname, int dotu);
570struct p9_fcall *p9_create_tflush(u16 oldtag);
571struct p9_fcall *p9_create_twalk(u32 fid, u32 newfid, u16 nwname,
572 char **wnames);
573struct p9_fcall *p9_create_topen(u32 fid, u8 mode);
574struct p9_fcall *p9_create_tcreate(u32 fid, char *name, u32 perm, u8 mode,
575 char *extension, int dotu);
576struct p9_fcall *p9_create_tread(u32 fid, u64 offset, u32 count);
577struct p9_fcall *p9_create_twrite(u32 fid, u64 offset, u32 count,
578 const char *data);
579struct p9_fcall *p9_create_twrite_u(u32 fid, u64 offset, u32 count,
580 const char __user *data);
581struct p9_fcall *p9_create_tclunk(u32 fid);
582struct p9_fcall *p9_create_tremove(u32 fid);
583struct p9_fcall *p9_create_tstat(u32 fid);
584struct p9_fcall *p9_create_twstat(u32 fid, struct p9_wstat *wstat,
585 int dotu);
586
587int p9_printfcall(char *buf, int buflen, struct p9_fcall *fc, int dotu);
588int p9_errstr2errno(char *errstr, int len); 511int p9_errstr2errno(char *errstr, int len);
589 512
590struct p9_idpool *p9_idpool_create(void); 513struct p9_idpool *p9_idpool_create(void);