diff options
author | Eric Van Hensbergen <ericvh@ericvh-desktop.(none)> | 2008-03-05 08:08:09 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@opteron.9grid.us> | 2008-05-14 20:23:25 -0400 |
commit | ee443996a35c1e04f210cafd43d5a98d41e46085 (patch) | |
tree | 58ee72b69a02d9dbb3a98e402a4561baba0eb9a8 /net/9p/trans_fd.c | |
parent | b32a09db4fb9a87246ba4e7726a979ac4709ad97 (diff) |
9p: Documentation updates
The kernel-doc comments of much of the 9p system have been in disarray since
reorganization. This patch fixes those problems, adds additional documentation
and a template book which collects the 9p information.
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p/trans_fd.c')
-rw-r--r-- | net/9p/trans_fd.c | 146 |
1 files changed, 124 insertions, 22 deletions
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index f624dff76852..c6eda999fa7d 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c | |||
@@ -47,12 +47,29 @@ | |||
47 | #define SCHED_TIMEOUT 10 | 47 | #define SCHED_TIMEOUT 10 |
48 | #define MAXPOLLWADDR 2 | 48 | #define MAXPOLLWADDR 2 |
49 | 49 | ||
50 | /** | ||
51 | * struct p9_fd_opts - per-transport options | ||
52 | * @rfd: file descriptor for reading (trans=fd) | ||
53 | * @wfd: file descriptor for writing (trans=fd) | ||
54 | * @port: port to connect to (trans=tcp) | ||
55 | * | ||
56 | */ | ||
57 | |||
50 | struct p9_fd_opts { | 58 | struct p9_fd_opts { |
51 | int rfd; | 59 | int rfd; |
52 | int wfd; | 60 | int wfd; |
53 | u16 port; | 61 | u16 port; |
54 | }; | 62 | }; |
55 | 63 | ||
64 | |||
65 | /** | ||
66 | * struct p9_trans_fd - transport state | ||
67 | * @rd: reference to file to read from | ||
68 | * @wr: reference of file to write to | ||
69 | * @conn: connection state reference | ||
70 | * | ||
71 | */ | ||
72 | |||
56 | struct p9_trans_fd { | 73 | struct p9_trans_fd { |
57 | struct file *rd; | 74 | struct file *rd; |
58 | struct file *wr; | 75 | struct file *wr; |
@@ -90,10 +107,24 @@ enum { | |||
90 | }; | 107 | }; |
91 | 108 | ||
92 | struct p9_req; | 109 | struct p9_req; |
93 | |||
94 | typedef void (*p9_conn_req_callback)(struct p9_req *req, void *a); | 110 | typedef void (*p9_conn_req_callback)(struct p9_req *req, void *a); |
111 | |||
112 | /** | ||
113 | * struct p9_req - fd mux encoding of an rpc transaction | ||
114 | * @lock: protects req_list | ||
115 | * @tag: numeric tag for rpc transaction | ||
116 | * @tcall: request &p9_fcall structure | ||
117 | * @rcall: response &p9_fcall structure | ||
118 | * @err: error state | ||
119 | * @cb: callback for when response is received | ||
120 | * @cba: argument to pass to callback | ||
121 | * @flush: flag to indicate RPC has been flushed | ||
122 | * @req_list: list link for higher level objects to chain requests | ||
123 | * | ||
124 | */ | ||
125 | |||
95 | struct p9_req { | 126 | struct p9_req { |
96 | spinlock_t lock; /* protect request structure */ | 127 | spinlock_t lock; |
97 | int tag; | 128 | int tag; |
98 | struct p9_fcall *tcall; | 129 | struct p9_fcall *tcall; |
99 | struct p9_fcall *rcall; | 130 | struct p9_fcall *rcall; |
@@ -104,7 +135,39 @@ struct p9_req { | |||
104 | struct list_head req_list; | 135 | struct list_head req_list; |
105 | }; | 136 | }; |
106 | 137 | ||
107 | struct p9_mux_poll_task; | 138 | struct p9_mux_poll_task { |
139 | struct task_struct *task; | ||
140 | struct list_head mux_list; | ||
141 | int muxnum; | ||
142 | }; | ||
143 | |||
144 | /** | ||
145 | * struct p9_conn - fd mux connection state information | ||
146 | * @lock: protects mux_list (?) | ||
147 | * @mux_list: list link for mux to manage multiple connections (?) | ||
148 | * @poll_task: task polling on this connection | ||
149 | * @msize: maximum size for connection (dup) | ||
150 | * @extended: 9p2000.u flag (dup) | ||
151 | * @trans: reference to transport instance for this connection | ||
152 | * @tagpool: id accounting for transactions | ||
153 | * @err: error state | ||
154 | * @equeue: event wait_q (?) | ||
155 | * @req_list: accounting for requests which have been sent | ||
156 | * @unsent_req_list: accounting for requests that haven't been sent | ||
157 | * @rcall: current response &p9_fcall structure | ||
158 | * @rpos: read position in current frame | ||
159 | * @rbuf: current read buffer | ||
160 | * @wpos: write position for current frame | ||
161 | * @wsize: amount of data to write for current frame | ||
162 | * @wbuf: current write buffer | ||
163 | * @poll_wait: array of wait_q's for various worker threads | ||
164 | * @poll_waddr: ???? | ||
165 | * @pt: poll state | ||
166 | * @rq: current read work | ||
167 | * @wq: current write work | ||
168 | * @wsched: ???? | ||
169 | * | ||
170 | */ | ||
108 | 171 | ||
109 | struct p9_conn { | 172 | struct p9_conn { |
110 | spinlock_t lock; /* protect lock structure */ | 173 | spinlock_t lock; /* protect lock structure */ |
@@ -132,11 +195,16 @@ struct p9_conn { | |||
132 | unsigned long wsched; | 195 | unsigned long wsched; |
133 | }; | 196 | }; |
134 | 197 | ||
135 | struct p9_mux_poll_task { | 198 | /** |
136 | struct task_struct *task; | 199 | * struct p9_mux_rpc - fd mux rpc accounting structure |
137 | struct list_head mux_list; | 200 | * @m: connection this request was issued on |
138 | int muxnum; | 201 | * @err: error state |
139 | }; | 202 | * @tcall: request &p9_fcall |
203 | * @rcall: response &p9_fcall | ||
204 | * @wqueue: wait queue that client is blocked on for this rpc | ||
205 | * | ||
206 | * Bug: isn't this information duplicated elsewhere like &p9_req | ||
207 | */ | ||
140 | 208 | ||
141 | struct p9_mux_rpc { | 209 | struct p9_mux_rpc { |
142 | struct p9_conn *m; | 210 | struct p9_conn *m; |
@@ -207,10 +275,12 @@ static void p9_mux_put_tag(struct p9_conn *m, u16 tag) | |||
207 | 275 | ||
208 | /** | 276 | /** |
209 | * p9_mux_calc_poll_procs - calculates the number of polling procs | 277 | * p9_mux_calc_poll_procs - calculates the number of polling procs |
210 | * based on the number of mounted v9fs filesystems. | 278 | * @muxnum: number of mounts |
211 | * | 279 | * |
280 | * Calculation is based on the number of mounted v9fs filesystems. | ||
212 | * The current implementation returns sqrt of the number of mounts. | 281 | * The current implementation returns sqrt of the number of mounts. |
213 | */ | 282 | */ |
283 | |||
214 | static int p9_mux_calc_poll_procs(int muxnum) | 284 | static int p9_mux_calc_poll_procs(int muxnum) |
215 | { | 285 | { |
216 | int n; | 286 | int n; |
@@ -331,12 +401,11 @@ static void p9_mux_poll_stop(struct p9_conn *m) | |||
331 | 401 | ||
332 | /** | 402 | /** |
333 | * p9_conn_create - allocate and initialize the per-session mux data | 403 | * p9_conn_create - allocate and initialize the per-session mux data |
334 | * Creates the polling task if this is the first session. | 404 | * @trans: transport structure |
335 | * | 405 | * |
336 | * @trans - transport structure | 406 | * Note: Creates the polling task if this is the first session. |
337 | * @msize - maximum message size | ||
338 | * @extended - extended flag | ||
339 | */ | 407 | */ |
408 | |||
340 | static struct p9_conn *p9_conn_create(struct p9_trans *trans) | 409 | static struct p9_conn *p9_conn_create(struct p9_trans *trans) |
341 | { | 410 | { |
342 | int i, n; | 411 | int i, n; |
@@ -406,7 +475,10 @@ static struct p9_conn *p9_conn_create(struct p9_trans *trans) | |||
406 | 475 | ||
407 | /** | 476 | /** |
408 | * p9_mux_destroy - cancels all pending requests and frees mux resources | 477 | * p9_mux_destroy - cancels all pending requests and frees mux resources |
478 | * @m: mux to destroy | ||
479 | * | ||
409 | */ | 480 | */ |
481 | |||
410 | static void p9_conn_destroy(struct p9_conn *m) | 482 | static void p9_conn_destroy(struct p9_conn *m) |
411 | { | 483 | { |
412 | P9_DPRINTK(P9_DEBUG_MUX, "mux %p prev %p next %p\n", m, | 484 | P9_DPRINTK(P9_DEBUG_MUX, "mux %p prev %p next %p\n", m, |
@@ -429,9 +501,14 @@ static void p9_conn_destroy(struct p9_conn *m) | |||
429 | } | 501 | } |
430 | 502 | ||
431 | /** | 503 | /** |
432 | * p9_pollwait - called by files poll operation to add v9fs-poll task | 504 | * p9_pollwait - add poll task to the wait queue |
433 | * to files wait queue | 505 | * @filp: file pointer being polled |
506 | * @wait_address: wait_q to block on | ||
507 | * @p: poll state | ||
508 | * | ||
509 | * called by files poll operation to add v9fs-poll task to files wait queue | ||
434 | */ | 510 | */ |
511 | |||
435 | static void | 512 | static void |
436 | p9_pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p) | 513 | p9_pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p) |
437 | { | 514 | { |
@@ -462,7 +539,10 @@ p9_pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p) | |||
462 | 539 | ||
463 | /** | 540 | /** |
464 | * p9_poll_mux - polls a mux and schedules read or write works if necessary | 541 | * p9_poll_mux - polls a mux and schedules read or write works if necessary |
542 | * @m: connection to poll | ||
543 | * | ||
465 | */ | 544 | */ |
545 | |||
466 | static void p9_poll_mux(struct p9_conn *m) | 546 | static void p9_poll_mux(struct p9_conn *m) |
467 | { | 547 | { |
468 | int n; | 548 | int n; |
@@ -499,9 +579,14 @@ static void p9_poll_mux(struct p9_conn *m) | |||
499 | } | 579 | } |
500 | 580 | ||
501 | /** | 581 | /** |
502 | * p9_poll_proc - polls all v9fs transports for new events and queues | 582 | * p9_poll_proc - poll worker thread |
503 | * the appropriate work to the work queue | 583 | * @a: thread state and arguments |
584 | * | ||
585 | * polls all v9fs transports for new events and queues the appropriate | ||
586 | * work to the work queue | ||
587 | * | ||
504 | */ | 588 | */ |
589 | |||
505 | static int p9_poll_proc(void *a) | 590 | static int p9_poll_proc(void *a) |
506 | { | 591 | { |
507 | struct p9_conn *m, *mtmp; | 592 | struct p9_conn *m, *mtmp; |
@@ -527,7 +612,10 @@ static int p9_poll_proc(void *a) | |||
527 | 612 | ||
528 | /** | 613 | /** |
529 | * p9_write_work - called when a transport can send some data | 614 | * p9_write_work - called when a transport can send some data |
615 | * @work: container for work to be done | ||
616 | * | ||
530 | */ | 617 | */ |
618 | |||
531 | static void p9_write_work(struct work_struct *work) | 619 | static void p9_write_work(struct work_struct *work) |
532 | { | 620 | { |
533 | int n, err; | 621 | int n, err; |
@@ -638,7 +726,10 @@ static void process_request(struct p9_conn *m, struct p9_req *req) | |||
638 | 726 | ||
639 | /** | 727 | /** |
640 | * p9_read_work - called when there is some data to be read from a transport | 728 | * p9_read_work - called when there is some data to be read from a transport |
729 | * @work: container of work to be done | ||
730 | * | ||
641 | */ | 731 | */ |
732 | |||
642 | static void p9_read_work(struct work_struct *work) | 733 | static void p9_read_work(struct work_struct *work) |
643 | { | 734 | { |
644 | int n, err; | 735 | int n, err; |
@@ -793,7 +884,9 @@ error: | |||
793 | * @tc: request to be sent | 884 | * @tc: request to be sent |
794 | * @cb: callback function to call when response is received | 885 | * @cb: callback function to call when response is received |
795 | * @cba: parameter to pass to the callback function | 886 | * @cba: parameter to pass to the callback function |
887 | * | ||
796 | */ | 888 | */ |
889 | |||
797 | static struct p9_req *p9_send_request(struct p9_conn *m, | 890 | static struct p9_req *p9_send_request(struct p9_conn *m, |
798 | struct p9_fcall *tc, | 891 | struct p9_fcall *tc, |
799 | p9_conn_req_callback cb, void *cba) | 892 | p9_conn_req_callback cb, void *cba) |
@@ -961,10 +1054,12 @@ p9_conn_rpc_cb(struct p9_req *req, void *a) | |||
961 | /** | 1054 | /** |
962 | * p9_fd_rpc- sends 9P request and waits until a response is available. | 1055 | * p9_fd_rpc- sends 9P request and waits until a response is available. |
963 | * The function can be interrupted. | 1056 | * The function can be interrupted. |
964 | * @m: mux data | 1057 | * @t: transport data |
965 | * @tc: request to be sent | 1058 | * @tc: request to be sent |
966 | * @rc: pointer where a pointer to the response is stored | 1059 | * @rc: pointer where a pointer to the response is stored |
1060 | * | ||
967 | */ | 1061 | */ |
1062 | |||
968 | int | 1063 | int |
969 | p9_fd_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc) | 1064 | p9_fd_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc) |
970 | { | 1065 | { |
@@ -1041,8 +1136,10 @@ p9_fd_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc) | |||
1041 | * @m: mux data | 1136 | * @m: mux data |
1042 | * @tc: request to be sent | 1137 | * @tc: request to be sent |
1043 | * @cb: callback function to be called when response arrives | 1138 | * @cb: callback function to be called when response arrives |
1044 | * @cba: value to pass to the callback function | 1139 | * @a: value to pass to the callback function |
1140 | * | ||
1045 | */ | 1141 | */ |
1142 | |||
1046 | int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc, | 1143 | int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc, |
1047 | p9_conn_req_callback cb, void *a) | 1144 | p9_conn_req_callback cb, void *a) |
1048 | { | 1145 | { |
@@ -1065,7 +1162,9 @@ int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc, | |||
1065 | * p9_conn_cancel - cancel all pending requests with error | 1162 | * p9_conn_cancel - cancel all pending requests with error |
1066 | * @m: mux data | 1163 | * @m: mux data |
1067 | * @err: error code | 1164 | * @err: error code |
1165 | * | ||
1068 | */ | 1166 | */ |
1167 | |||
1069 | void p9_conn_cancel(struct p9_conn *m, int err) | 1168 | void p9_conn_cancel(struct p9_conn *m, int err) |
1070 | { | 1169 | { |
1071 | struct p9_req *req, *rtmp; | 1170 | struct p9_req *req, *rtmp; |
@@ -1099,7 +1198,7 @@ void p9_conn_cancel(struct p9_conn *m, int err) | |||
1099 | /** | 1198 | /** |
1100 | * v9fs_parse_options - parse mount options into session structure | 1199 | * v9fs_parse_options - parse mount options into session structure |
1101 | * @options: options string passed from mount | 1200 | * @options: options string passed from mount |
1102 | * @v9ses: existing v9fs session information | 1201 | * @opts: transport-specific structure to parse options into |
1103 | * | 1202 | * |
1104 | */ | 1203 | */ |
1105 | 1204 | ||
@@ -1193,11 +1292,12 @@ static int p9_socket_open(struct p9_trans *trans, struct socket *csocket) | |||
1193 | 1292 | ||
1194 | /** | 1293 | /** |
1195 | * p9_fd_read- read from a fd | 1294 | * p9_fd_read- read from a fd |
1196 | * @v9ses: session information | 1295 | * @trans: transport instance state |
1197 | * @v: buffer to receive data into | 1296 | * @v: buffer to receive data into |
1198 | * @len: size of receive buffer | 1297 | * @len: size of receive buffer |
1199 | * | 1298 | * |
1200 | */ | 1299 | */ |
1300 | |||
1201 | static int p9_fd_read(struct p9_trans *trans, void *v, int len) | 1301 | static int p9_fd_read(struct p9_trans *trans, void *v, int len) |
1202 | { | 1302 | { |
1203 | int ret; | 1303 | int ret; |
@@ -1220,11 +1320,12 @@ static int p9_fd_read(struct p9_trans *trans, void *v, int len) | |||
1220 | 1320 | ||
1221 | /** | 1321 | /** |
1222 | * p9_fd_write - write to a socket | 1322 | * p9_fd_write - write to a socket |
1223 | * @v9ses: session information | 1323 | * @trans: transport instance state |
1224 | * @v: buffer to send data from | 1324 | * @v: buffer to send data from |
1225 | * @len: size of send buffer | 1325 | * @len: size of send buffer |
1226 | * | 1326 | * |
1227 | */ | 1327 | */ |
1328 | |||
1228 | static int p9_fd_write(struct p9_trans *trans, void *v, int len) | 1329 | static int p9_fd_write(struct p9_trans *trans, void *v, int len) |
1229 | { | 1330 | { |
1230 | int ret; | 1331 | int ret; |
@@ -1296,6 +1397,7 @@ end: | |||
1296 | * @trans: private socket structure | 1397 | * @trans: private socket structure |
1297 | * | 1398 | * |
1298 | */ | 1399 | */ |
1400 | |||
1299 | static void p9_fd_close(struct p9_trans *trans) | 1401 | static void p9_fd_close(struct p9_trans *trans) |
1300 | { | 1402 | { |
1301 | struct p9_trans_fd *ts; | 1403 | struct p9_trans_fd *ts; |