提交 02da398b 编写于 作者: E Eric Van Hensbergen

9p: eliminate depricated conv functions

Remove depricated conv functions which have been replaced with new 
protocol routines.

This patch also reworks the one instance of the file-system code which
directly calls conversion routines (to accomplish unpacking dirreads).
Signed-off-by: NEric Van Hensbergen <ericvh@gmail.com>

上级 51a87c55
......@@ -45,7 +45,7 @@
*
*/
static inline int dt_type(struct p9_stat *mistat)
static inline int dt_type(struct p9_wstat *mistat)
{
unsigned long perm = mistat->mode;
int rettype = DT_REG;
......@@ -69,7 +69,7 @@ static inline int dt_type(struct p9_stat *mistat)
static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
int over;
struct p9_stat st;
struct p9_wstat st;
int err;
struct p9_fid *fid;
int buflen;
......@@ -92,20 +92,24 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
n = err;
while (i < n) {
err = p9_deserialize_stat(statbuf + i, buflen-i, &st,
err = p9stat_read(statbuf + i, buflen-i, &st,
fid->clnt->dotu);
if (!err) {
if (err) {
P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err);
err = -EIO;
p9stat_free(&st);
goto free_and_exit;
}
i += err;
fid->rdir_fpos += err;
i += st.size+2;
fid->rdir_fpos += st.size+2;
over = filldir(dirent, st.name.str, st.name.len,
over = filldir(dirent, st.name, strlen(st.name),
filp->f_pos, v9fs_qid2ino(&st.qid), dt_type(&st));
filp->f_pos += st.size;
filp->f_pos += st.size+2;
p9stat_free(&st);
if (over) {
err = 0;
......
......@@ -61,21 +61,18 @@ extern unsigned int p9_debug_level;
#define P9_DPRINTK(level, format, arg...) \
do { \
if (level == P9_DEBUG_9P) \
printk(KERN_NOTICE "(%8.8d) " \
format , task_pid_nr(current) , ## arg); \
else if ((p9_debug_level & level) == level) \
printk(KERN_NOTICE "-- %s (%d): " \
format , __func__, task_pid_nr(current) , ## arg); \
if ((p9_debug_level & level) == level) {\
if (level == P9_DEBUG_9P) \
printk(KERN_NOTICE "(%8.8d) " \
format , task_pid_nr(current) , ## arg); \
else \
printk(KERN_NOTICE "-- %s (%d): " \
format , __func__, task_pid_nr(current) , ## arg); \
} \
} while (0)
#define PRINT_FCALL_ERROR(s, fcall) P9_DPRINTK(P9_DEBUG_ERROR, \
"%s: %.*s\n", s, fcall?fcall->params.rerror.error.len:0, \
fcall?fcall->params.rerror.error.str:"");
#else
#define P9_DPRINTK(level, format, arg...) do { } while (0)
#define PRINT_FCALL_ERROR(s, fcall) do { } while (0)
#endif
#define P9_EPRINTK(level, format, arg...) \
......@@ -330,33 +327,6 @@ struct p9_qid {
* See Also: http://plan9.bell-labs.com/magic/man2html/2/stat
*/
struct p9_stat {
u16 size;
u16 type;
u32 dev;
struct p9_qid qid;
u32 mode;
u32 atime;
u32 mtime;
u64 length;
struct p9_str name;
struct p9_str uid;
struct p9_str gid;
struct p9_str muid;
struct p9_str extension; /* 9p2000.u extensions */
u32 n_uid; /* 9p2000.u extensions */
u32 n_gid; /* 9p2000.u extensions */
u32 n_muid; /* 9p2000.u extensions */
};
/*
* file metadata (stat) structure used to create Twstat message
* The is identical to &p9_stat, but the strings don't point to
* the same memory block and should be freed separately
*
* See Also: http://plan9.bell-labs.com/magic/man2html/2/stat
*/
struct p9_wstat {
u16 size;
u16 type;
......@@ -498,12 +468,12 @@ struct p9_tstat {
};
struct p9_rstat {
struct p9_stat stat;
struct p9_wstat stat;
};
struct p9_twstat {
u32 fid;
struct p9_stat stat;
struct p9_wstat stat;
};
struct p9_rwstat {
......@@ -517,7 +487,6 @@ struct p9_rwstat {
* @offset: used by marshalling routines to track currentposition in buffer
* @capacity: used by marshalling routines to track total capacity
* @sdata: payload
* @params: per-operation parameters
*
* &p9_fcall represents the structure for all 9P RPC
* transactions. Requests are packaged into fcalls, and reponses
......@@ -535,66 +504,10 @@ struct p9_fcall {
size_t capacity;
uint8_t *sdata;
union {
struct p9_tversion tversion;
struct p9_rversion rversion;
struct p9_tauth tauth;
struct p9_rauth rauth;
struct p9_rerror rerror;
struct p9_tflush tflush;
struct p9_rflush rflush;
struct p9_tattach tattach;
struct p9_rattach rattach;
struct p9_twalk twalk;
struct p9_rwalk rwalk;
struct p9_topen topen;
struct p9_ropen ropen;
struct p9_tcreate tcreate;
struct p9_rcreate rcreate;
struct p9_tread tread;
struct p9_rread rread;
struct p9_twrite twrite;
struct p9_rwrite rwrite;
struct p9_tclunk tclunk;
struct p9_rclunk rclunk;
struct p9_tremove tremove;
struct p9_rremove rremove;
struct p9_tstat tstat;
struct p9_rstat rstat;
struct p9_twstat twstat;
struct p9_rwstat rwstat;
} params;
};
struct p9_idpool;
int p9_deserialize_stat(void *buf, u32 buflen, struct p9_stat *stat,
int dotu);
int p9_deserialize_fcall(void *buf, u32 buflen, struct p9_fcall *fc, int dotu);
void p9_set_tag(struct p9_fcall *fc, u16 tag);
struct p9_fcall *p9_create_tversion(u32 msize, char *version);
struct p9_fcall *p9_create_tattach(u32 fid, u32 afid, char *uname,
char *aname, u32 n_uname, int dotu);
struct p9_fcall *p9_create_tauth(u32 afid, char *uname, char *aname,
u32 n_uname, int dotu);
struct p9_fcall *p9_create_tflush(u16 oldtag);
struct p9_fcall *p9_create_twalk(u32 fid, u32 newfid, u16 nwname,
char **wnames);
struct p9_fcall *p9_create_topen(u32 fid, u8 mode);
struct p9_fcall *p9_create_tcreate(u32 fid, char *name, u32 perm, u8 mode,
char *extension, int dotu);
struct p9_fcall *p9_create_tread(u32 fid, u64 offset, u32 count);
struct p9_fcall *p9_create_twrite(u32 fid, u64 offset, u32 count,
const char *data);
struct p9_fcall *p9_create_twrite_u(u32 fid, u64 offset, u32 count,
const char __user *data);
struct p9_fcall *p9_create_tclunk(u32 fid);
struct p9_fcall *p9_create_tremove(u32 fid);
struct p9_fcall *p9_create_tstat(u32 fid);
struct p9_fcall *p9_create_twstat(u32 fid, struct p9_wstat *wstat,
int dotu);
int p9_errstr2errno(char *errstr, int len);
struct p9_idpool *p9_idpool_create(void);
......
......@@ -206,6 +206,8 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst);
struct p9_req_t *p9_tag_lookup(struct p9_client *, u16);
void p9_client_cb(struct p9_client *c, struct p9_req_t *req);
int p9stat_read(char *, int, struct p9_wstat *, int);
void p9stat_free(struct p9_wstat *);
#endif /* NET_9P_CLIENT_H */
......@@ -4,7 +4,6 @@ obj-$(CONFIG_NET_9P_VIRTIO) += 9pnet_virtio.o
9pnet-objs := \
mod.o \
client.o \
conv.o \
error.o \
util.o \
protocol.o \
......
此差异已折叠。
......@@ -509,6 +509,19 @@ p9pdu_writef(struct p9_fcall *pdu, int optional, const char *fmt, ...)
return ret;
}
int p9stat_read(char *buf, int len, struct p9_wstat *st, int dotu)
{
struct p9_fcall fake_pdu;
fake_pdu.size = len;
fake_pdu.capacity = len;
fake_pdu.sdata = buf;
fake_pdu.offset = 0;
return p9pdu_readf(&fake_pdu, dotu, "S", st);
}
EXPORT_SYMBOL(p9stat_read);
int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type)
{
return p9pdu_writef(pdu, 0, "dbw", 0, type, tag);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册