Eric Van Hensbergen | 426cc91 | 2005-09-09 13:04:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/fs/9p/mux.h |
| 3 | * |
| 4 | * Multiplexer Definitions |
| 5 | * |
Latchesar Ionkov | 3cf6429 | 2006-01-08 01:04:58 -0800 | [diff] [blame] | 6 | * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> |
Eric Van Hensbergen | 426cc91 | 2005-09-09 13:04:22 -0700 | [diff] [blame] | 7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to: |
| 21 | * Free Software Foundation |
| 22 | * 51 Franklin Street, Fifth Floor |
| 23 | * Boston, MA 02111-1301 USA |
| 24 | * |
| 25 | */ |
| 26 | |
Latchesar Ionkov | 3cf6429 | 2006-01-08 01:04:58 -0800 | [diff] [blame] | 27 | struct v9fs_mux_data; |
Eric Van Hensbergen | 426cc91 | 2005-09-09 13:04:22 -0700 | [diff] [blame] | 28 | |
Latchesar Ionkov | 3cf6429 | 2006-01-08 01:04:58 -0800 | [diff] [blame] | 29 | /** |
| 30 | * v9fs_mux_req_callback - callback function that is called when the |
| 31 | * response of a request is received. The callback is called from |
| 32 | * a workqueue and shouldn't block. |
| 33 | * |
| 34 | * @a - the pointer that was specified when the request was send to be |
| 35 | * passed to the callback |
| 36 | * @tc - request call |
| 37 | * @rc - response call |
| 38 | * @err - error code (non-zero if error occured) |
| 39 | */ |
| 40 | typedef void (*v9fs_mux_req_callback)(void *a, struct v9fs_fcall *tc, |
| 41 | struct v9fs_fcall *rc, int err); |
Eric Van Hensbergen | 426cc91 | 2005-09-09 13:04:22 -0700 | [diff] [blame] | 42 | |
Latchesar Ionkov | 1dac06b | 2006-01-08 01:05:02 -0800 | [diff] [blame] | 43 | int v9fs_mux_global_init(void); |
Latchesar Ionkov | 3cf6429 | 2006-01-08 01:04:58 -0800 | [diff] [blame] | 44 | void v9fs_mux_global_exit(void); |
Eric Van Hensbergen | 426cc91 | 2005-09-09 13:04:22 -0700 | [diff] [blame] | 45 | |
Latchesar Ionkov | 3cf6429 | 2006-01-08 01:04:58 -0800 | [diff] [blame] | 46 | struct v9fs_mux_data *v9fs_mux_init(struct v9fs_transport *trans, int msize, |
| 47 | unsigned char *extended); |
| 48 | void v9fs_mux_destroy(struct v9fs_mux_data *); |
Eric Van Hensbergen | 426cc91 | 2005-09-09 13:04:22 -0700 | [diff] [blame] | 49 | |
Latchesar Ionkov | 3cf6429 | 2006-01-08 01:04:58 -0800 | [diff] [blame] | 50 | int v9fs_mux_send(struct v9fs_mux_data *m, struct v9fs_fcall *tc); |
| 51 | struct v9fs_fcall *v9fs_mux_recv(struct v9fs_mux_data *m); |
| 52 | int v9fs_mux_rpc(struct v9fs_mux_data *m, struct v9fs_fcall *tc, struct v9fs_fcall **rc); |
| 53 | int v9fs_mux_rpcnb(struct v9fs_mux_data *m, struct v9fs_fcall *tc, |
| 54 | v9fs_mux_req_callback cb, void *a); |
| 55 | |
| 56 | void v9fs_mux_flush(struct v9fs_mux_data *m, int sendflush); |
| 57 | void v9fs_mux_cancel(struct v9fs_mux_data *m, int err); |
Latchesar Ionkov | 1dac06b | 2006-01-08 01:05:02 -0800 | [diff] [blame] | 58 | int v9fs_errstr2errno(char *errstr, int len); |