9p: transport API reorganization
This merges the mux.c (including the connection interface) with trans_fd in preparation for transport API changes. Ultimately, trans_fd will need to be rewritten to clean it up and simplify the implementation, but this reorganization is viewed as the first step. Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
*
|
||||
* 9P Client Definitions
|
||||
*
|
||||
* Copyright (C) 2008 by Eric Van Hensbergen <ericvh@gmail.com>
|
||||
* Copyright (C) 2007 by Latchesar Ionkov <lucho@ionkov.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -29,6 +30,7 @@ struct p9_client {
|
||||
spinlock_t lock; /* protect client structure */
|
||||
int msize;
|
||||
unsigned char dotu;
|
||||
struct p9_trans_module *trans_mod;
|
||||
struct p9_trans *trans;
|
||||
struct p9_conn *conn;
|
||||
|
||||
@@ -52,8 +54,7 @@ struct p9_fid {
|
||||
struct list_head dlist; /* list of all fids attached to a dentry */
|
||||
};
|
||||
|
||||
struct p9_client *p9_client_create(struct p9_trans *trans, int msize,
|
||||
int dotu);
|
||||
struct p9_client *p9_client_create(const char *dev_name, char *options);
|
||||
void p9_client_destroy(struct p9_client *clnt);
|
||||
void p9_client_disconnect(struct p9_client *clnt);
|
||||
struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
|
||||
|
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* include/net/9p/conn.h
|
||||
*
|
||||
* Connection Definitions
|
||||
*
|
||||
* Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net>
|
||||
* Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to:
|
||||
* Free Software Foundation
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02111-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NET_9P_CONN_H
|
||||
#define NET_9P_CONN_H
|
||||
|
||||
#undef P9_NONBLOCK
|
||||
|
||||
struct p9_conn;
|
||||
struct p9_req;
|
||||
|
||||
/**
|
||||
* p9_mux_req_callback - callback function that is called when the
|
||||
* response of a request is received. The callback is called from
|
||||
* a workqueue and shouldn't block.
|
||||
*
|
||||
* @req - request
|
||||
* @a - the pointer that was specified when the request was send to be
|
||||
* passed to the callback
|
||||
*/
|
||||
typedef void (*p9_conn_req_callback)(struct p9_req *req, void *a);
|
||||
|
||||
struct p9_conn *p9_conn_create(struct p9_trans *trans, int msize,
|
||||
unsigned char *dotu);
|
||||
void p9_conn_destroy(struct p9_conn *);
|
||||
int p9_conn_rpc(struct p9_conn *m, struct p9_fcall *tc, struct p9_fcall **rc);
|
||||
|
||||
#ifdef P9_NONBLOCK
|
||||
int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc,
|
||||
p9_conn_req_callback cb, void *a);
|
||||
#endif /* P9_NONBLOCK */
|
||||
|
||||
void p9_conn_cancel(struct p9_conn *m, int err);
|
||||
|
||||
#endif /* NET_9P_CONN_H */
|
@@ -4,7 +4,7 @@
|
||||
* Transport Definition
|
||||
*
|
||||
* Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net>
|
||||
* Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
|
||||
* Copyright (C) 2004-2008 by Eric Van Hensbergen <ericvh@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
@@ -34,13 +34,12 @@ enum p9_trans_status {
|
||||
|
||||
struct p9_trans {
|
||||
enum p9_trans_status status;
|
||||
int msize;
|
||||
unsigned char extended;
|
||||
void *priv;
|
||||
int (*write) (struct p9_trans *, void *, int);
|
||||
int (*read) (struct p9_trans *, void *, int);
|
||||
void (*close) (struct p9_trans *);
|
||||
unsigned int (*poll)(struct p9_trans *, struct poll_table_struct *);
|
||||
int (*rpc) (struct p9_trans *t, struct p9_fcall *tc,
|
||||
struct p9_fcall **rc, int msize, int dotu);
|
||||
struct p9_fcall **rc);
|
||||
};
|
||||
|
||||
struct p9_trans_module {
|
||||
@@ -48,7 +47,7 @@ struct p9_trans_module {
|
||||
char *name; /* name of transport */
|
||||
int maxsize; /* max message size of transport */
|
||||
int def; /* this transport should be default */
|
||||
struct p9_trans * (*create)(const char *devname, char *options);
|
||||
struct p9_trans * (*create)(const char *, char *, int, unsigned char);
|
||||
};
|
||||
|
||||
void v9fs_register_trans(struct p9_trans_module *m);
|
||||
|
Reference in New Issue
Block a user