adapt to puffs_framebuf changes
This commit is contained in:
parent
2b8177d9fc
commit
5069b5df0c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nineproto.c,v 1.5 2007/05/06 22:17:50 pooka Exp $ */
|
||||
/* $NetBSD: nineproto.c,v 1.6 2007/05/11 16:23:00 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: nineproto.c,v 1.5 2007/05/06 22:17:50 pooka Exp $");
|
||||
__RCSID("$NetBSD: nineproto.c,v 1.6 2007/05/11 16:23:00 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -195,7 +195,7 @@ proto_cc_dupfid(struct puffs_cc *pcc, p9pfid_t oldfid, p9pfid_t newfid)
|
||||
p9pbuf_put_4(pb, oldfid);
|
||||
p9pbuf_put_4(pb, newfid);
|
||||
p9pbuf_put_2(pb, 0);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = proto_expect_walk_nqids(pb, &qids);
|
||||
if (rv)
|
||||
@ -210,6 +210,7 @@ proto_cc_dupfid(struct puffs_cc *pcc, p9pfid_t oldfid, p9pfid_t newfid)
|
||||
int
|
||||
proto_cc_clunkfid(struct puffs_cc *pcc, p9pfid_t fid, int waitforit)
|
||||
{
|
||||
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
|
||||
struct puffs9p *p9p = puffs_cc_getspecific(pcc);
|
||||
struct puffs_framebuf *pb;
|
||||
p9ptag_t tag = NEXTTAG(p9p);
|
||||
@ -221,13 +222,12 @@ proto_cc_clunkfid(struct puffs_cc *pcc, p9pfid_t fid, int waitforit)
|
||||
p9pbuf_put_4(pb, fid);
|
||||
|
||||
if (waitforit) {
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
if (p9pbuf_get_type(pb) != P9PROTO_R_CLUNK)
|
||||
error = EPROTO;
|
||||
puffs_framebuf_destroy(pb);
|
||||
} else {
|
||||
puffs_framebuf_enqueue_justsend(puffs_cc_getusermount(pcc),
|
||||
pb, 1);
|
||||
JUSTSEND(pb);
|
||||
}
|
||||
|
||||
return error;
|
||||
@ -253,7 +253,7 @@ proto_cc_open(struct puffs_cc *pcc, p9pfid_t fid, p9pfid_t newfid, int mode)
|
||||
p9pbuf_put_2(pb, tag);
|
||||
p9pbuf_put_4(pb, newfid);
|
||||
p9pbuf_put_1(pb, mode);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
if (p9pbuf_get_type(pb) != P9PROTO_R_OPEN)
|
||||
error = EPROTO;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ninepuffs.c,v 1.7 2007/05/07 17:20:58 pooka Exp $ */
|
||||
/* $NetBSD: ninepuffs.c,v 1.8 2007/05/11 16:23:00 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: ninepuffs.c,v 1.7 2007/05/07 17:20:58 pooka Exp $");
|
||||
__RCSID("$NetBSD: ninepuffs.c,v 1.8 2007/05/11 16:23:00 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -198,7 +198,7 @@ main(int argc, char *argv[])
|
||||
if (detach)
|
||||
daemon(1, 0);
|
||||
|
||||
puffs_framebuf_eventloop(pu, p9p.servsock,
|
||||
puffs_framebuf_eventloop(pu, &p9p.servsock, 1,
|
||||
p9pbuf_read, p9pbuf_write, p9pbuf_cmp, NULL);
|
||||
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ninepuffs.h,v 1.5 2007/05/06 22:17:50 pooka Exp $ */
|
||||
/* $NetBSD: ninepuffs.h,v 1.6 2007/05/11 16:23:00 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
@ -71,6 +71,10 @@ typedef uint32_t p9pfid_t;
|
||||
puffs_framebuf_destroy(pb); \
|
||||
return (rv)
|
||||
|
||||
#define GETRESPONSE(pb) puffs_framebuf_enqueue_cc(pcc,p9p->servsock,pb)
|
||||
#define JUSTSEND(pb) puffs_framebuf_enqueue_justsend(pu,p9p->servsock,pb,1)
|
||||
#define SENDCB(pb, f, a) puffs_framebuf_enqueue_cb(pu,p9p->servsock pb,f,a)
|
||||
|
||||
struct puffs9p {
|
||||
int servsock;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: node.c,v 1.7 2007/05/07 17:20:58 pooka Exp $ */
|
||||
/* $NetBSD: node.c,v 1.8 2007/05/11 16:23:00 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: node.c,v 1.7 2007/05/07 17:20:58 pooka Exp $");
|
||||
__RCSID("$NetBSD: node.c,v 1.8 2007/05/11 16:23:00 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <assert.h>
|
||||
@ -69,7 +69,7 @@ puffs9p_node_lookup(struct puffs_cc *pcc, void *opc, void **newnode,
|
||||
p9pbuf_put_4(pb, tfid);
|
||||
p9pbuf_put_2(pb, 1);
|
||||
p9pbuf_put_str(pb, pcn->pcn_name);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = proto_expect_walk_nqids(pb, &nqid);
|
||||
if (rv) {
|
||||
@ -128,7 +128,7 @@ puffs9p_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
|
||||
p9pbuf_put_4(pb, dfp->fid);
|
||||
p9pbuf_put_8(pb, *readoff);
|
||||
p9pbuf_put_4(pb, *reslen); /* XXX */
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
p9pbuf_get_4(pb, &count);
|
||||
|
||||
@ -171,7 +171,7 @@ puffs9p_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *vap,
|
||||
p9pbuf_put_1(pb, P9PROTO_T_STAT);
|
||||
p9pbuf_put_2(pb, tag);
|
||||
p9pbuf_put_4(pb, p9n->fid_base);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = proto_expect_stat(pb, &pn->pn_va);
|
||||
if (rv)
|
||||
@ -195,7 +195,7 @@ puffs9p_node_setattr(struct puffs_cc *pcc, void *opc,
|
||||
p9pbuf_put_2(pb, tag);
|
||||
p9pbuf_put_4(pb, p9n->fid_base);
|
||||
proto_make_stat(pb, va, NULL, pn->pn_va.va_type);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
if (p9pbuf_get_type(pb) != P9PROTO_R_WSTAT)
|
||||
rv = EPROTO;
|
||||
@ -290,7 +290,7 @@ puffs9p_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
|
||||
p9pbuf_put_4(pb, p9n->fid_read);
|
||||
p9pbuf_put_8(pb, offset+nread);
|
||||
p9pbuf_put_4(pb, MIN((uint32_t)*resid,p9p->maxreq-24));
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
if (p9pbuf_get_type(pb) != P9PROTO_R_READ) {
|
||||
rv = EPROTO;
|
||||
@ -334,7 +334,7 @@ puffs9p_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
|
||||
p9pbuf_put_8(pb, offset+nwrite);
|
||||
p9pbuf_put_4(pb, chunk);
|
||||
p9pbuf_write_data(pb, buf+nwrite, chunk);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
if (p9pbuf_get_type(pb) != P9PROTO_R_WRITE) {
|
||||
rv = EPROTO;
|
||||
@ -384,7 +384,7 @@ nodecreate(struct puffs_cc *pcc, struct puffs_node *pn, void **newnode,
|
||||
p9pbuf_put_str(pb, name);
|
||||
p9pbuf_put_4(pb, dirbit | (vap->va_mode & 0777));
|
||||
p9pbuf_put_1(pb, 0);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = proto_expect_qid(pb, P9PROTO_R_CREATE, &nqid);
|
||||
if (rv)
|
||||
@ -405,7 +405,7 @@ nodecreate(struct puffs_cc *pcc, struct puffs_node *pn, void **newnode,
|
||||
p9pbuf_put_4(pb, nfid);
|
||||
p9pbuf_put_2(pb, 1);
|
||||
p9pbuf_put_str(pb, name);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
/*
|
||||
* someone removed it already? try again
|
||||
@ -457,7 +457,7 @@ noderemove(struct puffs_cc *pcc, struct p9pnode *p9n)
|
||||
p9pbuf_put_1(pb, P9PROTO_T_REMOVE);
|
||||
p9pbuf_put_2(pb, tag);
|
||||
p9pbuf_put_4(pb, testfid);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
if (p9pbuf_get_type(pb) != P9PROTO_R_REMOVE) {
|
||||
rv = EPROTO;
|
||||
@ -525,7 +525,7 @@ puffs9p_node_rename(struct puffs_cc *pcc, void *opc, void *src,
|
||||
p9pbuf_put_2(pb, tag);
|
||||
p9pbuf_put_4(pb, p9n_src->fid_base);
|
||||
proto_make_stat(pb, NULL, pcn_targ->pcn_name, pn_src->pn_va.va_type);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
if (p9pbuf_get_type(pb) != P9PROTO_R_WSTAT)
|
||||
rv = EPROTO;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr.c,v 1.2 2007/05/05 15:49:51 pooka Exp $ */
|
||||
/* $NetBSD: subr.c,v 1.3 2007/05/11 16:23:00 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: subr.c,v 1.2 2007/05/05 15:49:51 pooka Exp $");
|
||||
__RCSID("$NetBSD: subr.c,v 1.3 2007/05/11 16:23:00 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -135,7 +135,7 @@ getdfwithoffset(struct puffs_cc *pcc, struct p9pnode *p9n, off_t wantoff,
|
||||
p9pbuf_put_4(pb, dfp->fid);
|
||||
p9pbuf_put_8(pb, 0);
|
||||
p9pbuf_put_4(pb, advance);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
if (p9pbuf_get_type(pb) != P9PROTO_R_READ) {
|
||||
error = EPROTO;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: node.c,v 1.25 2007/05/07 17:20:58 pooka Exp $ */
|
||||
/* $NetBSD: node.c,v 1.26 2007/05/11 16:23:01 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: node.c,v 1.25 2007/05/07 17:20:58 pooka Exp $");
|
||||
__RCSID("$NetBSD: node.c,v 1.26 2007/05/11 16:23:01 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <assert.h>
|
||||
@ -153,7 +153,7 @@ psshfs_node_setattr(struct puffs_cc *pcc, void *opc,
|
||||
}
|
||||
|
||||
psbuf_put_vattr(pb, &kludgeva);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_status(pb);
|
||||
if (rv == 0)
|
||||
@ -182,7 +182,7 @@ psshfs_node_create(struct puffs_cc *pcc, void *opc, void **newnode,
|
||||
psbuf_req_str(pb, SSH_FXP_OPEN, reqid, PCNPATH(pcn));
|
||||
psbuf_put_4(pb, SSH_FXF_WRITE | SSH_FXF_CREAT | SSH_FXF_TRUNC);
|
||||
psbuf_put_vattr(pb, va);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_handle(pb, &fhand, &fhandlen);
|
||||
if (rv == 0)
|
||||
@ -193,7 +193,7 @@ psshfs_node_create(struct puffs_cc *pcc, void *opc, void **newnode,
|
||||
reqid = NEXTREQ(pctx);
|
||||
psbuf_recycleout(pb);
|
||||
psbuf_req_data(pb, SSH_FXP_CLOSE, reqid, fhand, fhandlen);
|
||||
puffs_framebuf_enqueue_justsend(pu, pb, 1);
|
||||
JUSTSEND(pb);
|
||||
free(fhand);
|
||||
return 0;
|
||||
|
||||
@ -220,7 +220,7 @@ psshfs_node_open(struct puffs_cc *pcc, void *opc, int mode,
|
||||
psbuf_req_str(pb, SSH_FXP_OPEN, reqid, PNPATH(pn));
|
||||
psbuf_put_4(pb, SSH_FXF_READ);
|
||||
psbuf_put_vattr(pb, &va);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_handle(pb, &psn->fhand_r, &psn->fhand_r_len);
|
||||
if (rv)
|
||||
@ -231,7 +231,7 @@ psshfs_node_open(struct puffs_cc *pcc, void *opc, int mode,
|
||||
psbuf_req_str(pb, SSH_FXP_OPEN, reqid, PNPATH(pn));
|
||||
psbuf_put_4(pb, SSH_FXF_WRITE);
|
||||
psbuf_put_vattr(pb, &va);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_handle(pb, &psn->fhand_w, &psn->fhand_w_len);
|
||||
if (rv)
|
||||
@ -256,7 +256,7 @@ psshfs_node_inactive(struct puffs_cc *pcc, void *opc, pid_t pid, int *refcount)
|
||||
pb1 = psbuf_makeout();
|
||||
psbuf_req_data(pb1, SSH_FXP_CLOSE, reqid,
|
||||
psn->fhand_r, psn->fhand_r_len);
|
||||
puffs_framebuf_enqueue_justsend(pu, pb1, 1);
|
||||
JUSTSEND(pb1);
|
||||
free(psn->fhand_r);
|
||||
psn->fhand_r = NULL;
|
||||
}
|
||||
@ -264,7 +264,7 @@ psshfs_node_inactive(struct puffs_cc *pcc, void *opc, pid_t pid, int *refcount)
|
||||
pb2 = psbuf_makeout();
|
||||
psbuf_req_data(pb2, SSH_FXP_CLOSE, reqid,
|
||||
psn->fhand_w, psn->fhand_w_len);
|
||||
puffs_framebuf_enqueue_justsend(pu, pb2, 1);
|
||||
JUSTSEND(pb2);
|
||||
free(psn->fhand_w);
|
||||
psn->fhand_w = NULL;
|
||||
}
|
||||
@ -324,7 +324,7 @@ psshfs_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
|
||||
psbuf_req_data(pb, SSH_FXP_READ, reqid, psn->fhand_r, psn->fhand_r_len);
|
||||
psbuf_put_8(pb, offset);
|
||||
psbuf_put_4(pb, readlen);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_do_data(pb, buf, &readlen);
|
||||
if (rv == 0)
|
||||
@ -354,7 +354,7 @@ psshfs_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
|
||||
psbuf_req_data(pb, SSH_FXP_WRITE, reqid, psn->fhand_w,psn->fhand_w_len);
|
||||
psbuf_put_8(pb, offset);
|
||||
psbuf_put_data(pb, buf, writelen);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_status(pb);
|
||||
if (rv == 0)
|
||||
@ -382,7 +382,7 @@ psshfs_node_readlink(struct puffs_cc *pcc, void *opc,
|
||||
}
|
||||
|
||||
psbuf_req_str(pb, SSH_FXP_READLINK, reqid, PNPATH(pn));
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_name(pb, &count);
|
||||
if (rv)
|
||||
@ -415,7 +415,7 @@ psshfs_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
|
||||
}
|
||||
|
||||
psbuf_req_str(pb, SSH_FXP_REMOVE, reqid, PNPATH(pn_targ));
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_status(pb);
|
||||
|
||||
@ -443,7 +443,7 @@ psshfs_node_mkdir(struct puffs_cc *pcc, void *opc, void **newnode,
|
||||
|
||||
psbuf_req_str(pb, SSH_FXP_MKDIR, reqid, PCNPATH(pcn));
|
||||
psbuf_put_vattr(pb, va);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_status(pb);
|
||||
|
||||
@ -464,7 +464,7 @@ psshfs_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
|
||||
struct puffs_node *pn_targ = targ;
|
||||
|
||||
psbuf_req_str(pb, SSH_FXP_RMDIR, reqid, PNPATH(pn_targ));
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_status(pb);
|
||||
if (rv == 0)
|
||||
@ -500,7 +500,7 @@ psshfs_node_symlink(struct puffs_cc *pcc, void *opc, void **newnode,
|
||||
*/
|
||||
psbuf_req_str(pb, SSH_FXP_SYMLINK, reqid, link_target);
|
||||
psbuf_put_str(pb, PCNPATH(pcn));
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_status(pb);
|
||||
if (rv == 0)
|
||||
@ -536,7 +536,7 @@ psshfs_node_rename(struct puffs_cc *pcc, void *opc, void *src,
|
||||
|
||||
psbuf_req_str(pb, SSH_FXP_RENAME, reqid, PCNPATH(pcn_src));
|
||||
psbuf_put_str(pb, PCNPATH(pcn_targ));
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_status(pb);
|
||||
if (rv == 0) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: psshfs.c,v 1.23 2007/05/09 21:46:27 pooka Exp $ */
|
||||
/* $NetBSD: psshfs.c,v 1.24 2007/05/11 16:23:01 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: psshfs.c,v 1.23 2007/05/09 21:46:27 pooka Exp $");
|
||||
__RCSID("$NetBSD: psshfs.c,v 1.24 2007/05/11 16:23:01 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -218,7 +218,7 @@ main(int argc, char *argv[])
|
||||
if (detach)
|
||||
daemon(1, 0);
|
||||
|
||||
return puffs_framebuf_eventloop(pu, pctx.sshfd,
|
||||
return puffs_framebuf_eventloop(pu, &pctx.sshfd, 1,
|
||||
psbuf_read, psbuf_write, psbuf_cmp, NULL);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: psshfs.h,v 1.12 2007/05/06 19:48:51 pooka Exp $ */
|
||||
/* $NetBSD: psshfs.h,v 1.13 2007/05/11 16:23:01 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2007 Antti Kantee. All Rights Reserved.
|
||||
@ -65,6 +65,10 @@ PUFFSOP_PROTOS(psshfs);
|
||||
puffs_framebuf_destroy(pb); \
|
||||
return (rv)
|
||||
|
||||
#define GETRESPONSE(pb) puffs_framebuf_enqueue_cc(pcc, pctx->sshfd, pb)
|
||||
#define JUSTSEND(pb) puffs_framebuf_enqueue_justsend(pu, pctx->sshfd, pb, 1)
|
||||
#define SENDCB(pb, f, a) puffs_framebuf_enqueue_cb(pu, pctx->sshfd, pb, f,a)
|
||||
|
||||
struct psshfs_dir {
|
||||
int valid;
|
||||
struct puffs_node *entry;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr.c,v 1.14 2007/05/05 15:49:51 pooka Exp $ */
|
||||
/* $NetBSD: subr.c,v 1.15 2007/05/11 16:23:01 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: subr.c,v 1.14 2007/05/05 15:49:51 pooka Exp $");
|
||||
__RCSID("$NetBSD: subr.c,v 1.15 2007/05/11 16:23:01 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <assert.h>
|
||||
@ -163,7 +163,7 @@ readdir_getattr(struct puffs_usermount *pu, struct psshfs_node *psn,
|
||||
|
||||
pb = psbuf_makeout();
|
||||
psbuf_req_str(pb, SSH_FXP_LSTAT, reqid, path);
|
||||
puffs_framebuf_enqueue_cb(pu, pb, readdir_getattr_resp, rda);
|
||||
SENDCB(pb, readdir_getattr_resp, rda);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -173,7 +173,7 @@ getpathattr(struct puffs_cc *pcc, const char *path, struct vattr *vap)
|
||||
PSSHFSAUTOVAR(pcc);
|
||||
|
||||
psbuf_req_str(pb, SSH_FXP_LSTAT, reqid, path);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_attrs(pb, vap);
|
||||
|
||||
@ -213,6 +213,7 @@ int
|
||||
sftp_readdir(struct puffs_cc *pcc, struct psshfs_ctx *pctx,
|
||||
struct puffs_node *pn)
|
||||
{
|
||||
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
|
||||
struct psshfs_node *psn = pn->pn_data;
|
||||
struct psshfs_dir *olddir, *testd;
|
||||
struct puffs_framebuf *pb;
|
||||
@ -232,7 +233,7 @@ sftp_readdir(struct puffs_cc *pcc, struct psshfs_ctx *pctx,
|
||||
|
||||
pb = psbuf_makeout();
|
||||
psbuf_req_str(pb, SSH_FXP_OPENDIR, reqid, PNPATH(pn));
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
rv = psbuf_expect_handle(pb, &dhand, &dhandlen);
|
||||
if (rv)
|
||||
@ -262,7 +263,7 @@ sftp_readdir(struct puffs_cc *pcc, struct psshfs_ctx *pctx,
|
||||
reqid = NEXTREQ(pctx);
|
||||
psbuf_recycleout(pb);
|
||||
psbuf_req_data(pb, SSH_FXP_READDIR, reqid, dhand, dhandlen);
|
||||
puffs_framebuf_enqueue_cc(pcc, pb);
|
||||
GETRESPONSE(pb);
|
||||
|
||||
/* check for EOF */
|
||||
if (psbuf_get_type(pb) == SSH_FXP_STATUS) {
|
||||
@ -320,7 +321,7 @@ sftp_readdir(struct puffs_cc *pcc, struct psshfs_ctx *pctx,
|
||||
psbuf_recycleout(pb);
|
||||
psbuf_req_data(pb, SSH_FXP_CLOSE, reqid, dhand, dhandlen);
|
||||
|
||||
puffs_framebuf_enqueue_justsend(puffs_cc_getusermount(pcc), pb, 1);
|
||||
JUSTSEND(pb);
|
||||
free(dhand);
|
||||
return rv;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user