Rototill.

Ok, ok, a few more words about it: stop holding puffs_cc as a holy
value and passing it around to almost every possible place (popquiz:
which kernel variable does this remind you of?).  Instead, pass
the natural choice, puffs_usermount, and fetch puffs_cc via
puffs_cc_getcc() only in routines which actually need it.  This
not only simplifies code, but (thanks to the introduction of
puffs_cc_getcc()) enables constructs which weren't previously sanely
possible, say layering as a curious example.

There's still a little to do on this front, but this was the major
fs interface blast.
This commit is contained in:
pooka 2007-11-30 19:02:28 +00:00
parent b3dec55727
commit 21913eabe5
22 changed files with 520 additions and 542 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dispatcher.c,v 1.23 2007/11/29 17:47:55 pooka Exp $ */
/* $NetBSD: dispatcher.c,v 1.24 2007/11/30 19:02:28 pooka Exp $ */
/*
* Copyright (c) 2006, 2007 Antti Kantee. All Rights Reserved.
@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: dispatcher.c,v 1.23 2007/11/29 17:47:55 pooka Exp $");
__RCSID("$NetBSD: dispatcher.c,v 1.24 2007/11/30 19:02:28 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -272,7 +272,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
preq->preq_setbacks = 0;
if (pu->pu_oppre)
pu->pu_oppre(pcc);
pu->pu_oppre(pu);
if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_VFS) {
switch (preq->preq_optype) {
@ -281,7 +281,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
struct puffs_vfsmsg_unmount *auxt = auxbuf;
PU_SETSTATE(pu, PUFFS_STATE_UNMOUNTING);
error = pops->puffs_fs_unmount(pcc, auxt->pvfsr_flags);
error = pops->puffs_fs_unmount(pu, auxt->pvfsr_flags);
if (!error)
PU_SETSTATE(pu, PUFFS_STATE_UNMOUNTED);
else
@ -293,7 +293,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
{
struct puffs_vfsmsg_statvfs *auxt = auxbuf;
error = pops->puffs_fs_statvfs(pcc, &auxt->pvfsr_sb);
error = pops->puffs_fs_statvfs(pu, &auxt->pvfsr_sb);
break;
}
@ -302,7 +302,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
struct puffs_vfsmsg_sync *auxt = auxbuf;
PUFFS_MAKECRED(pcr, &auxt->pvfsr_cred);
error = pops->puffs_fs_sync(pcc,
error = pops->puffs_fs_sync(pu,
auxt->pvfsr_waitfor, pcr);
break;
}
@ -317,7 +317,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
pni.pni_size = &auxt->pvfsr_size;
pni.pni_rdev = &auxt->pvfsr_rdev;
error = pops->puffs_fs_fhtonode(pcc, auxt->pvfsr_data,
error = pops->puffs_fs_fhtonode(pu, auxt->pvfsr_data,
auxt->pvfsr_dsize, &pni);
break;
@ -327,7 +327,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
{
struct puffs_vfsmsg_nodetofh *auxt = auxbuf;
error = pops->puffs_fs_nodetofh(pcc,
error = pops->puffs_fs_nodetofh(pu,
auxt->pvfsr_fhcookie, auxt->pvfsr_data,
&auxt->pvfsr_dsize);
@ -342,7 +342,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
if (pops->puffs_fs_suspend == NULL)
break;
pops->puffs_fs_suspend(pcc, auxt->pvfsr_status);
pops->puffs_fs_suspend(pu, auxt->pvfsr_status);
break;
}
@ -379,7 +379,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
}
/* lookup *must* be present */
error = pops->puffs_node_lookup(pcc, opcookie,
error = pops->puffs_node_lookup(pu, opcookie,
&pni, &pcn);
if (buildpath) {
@ -428,7 +428,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_create(pcc,
error = pops->puffs_node_create(pu,
opcookie, &pni, &pcn, &auxt->pvnr_va);
if (buildpath) {
@ -469,7 +469,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_mknod(pcc,
error = pops->puffs_node_mknod(pu,
opcookie, &pni, &pcn, &auxt->pvnr_va);
if (buildpath) {
@ -496,7 +496,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_open(pcc,
error = pops->puffs_node_open(pu,
opcookie, auxt->pvnr_mode, pcr);
break;
}
@ -511,7 +511,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_close(pcc,
error = pops->puffs_node_close(pu,
opcookie, auxt->pvnr_fflag, pcr);
break;
}
@ -526,7 +526,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_access(pcc,
error = pops->puffs_node_access(pu,
opcookie, auxt->pvnr_mode, pcr);
break;
}
@ -541,7 +541,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_getattr(pcc,
error = pops->puffs_node_getattr(pu,
opcookie, &auxt->pvnr_va, pcr);
break;
}
@ -556,7 +556,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_setattr(pcc,
error = pops->puffs_node_setattr(pu,
opcookie, &auxt->pvnr_va, pcr);
break;
}
@ -571,7 +571,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_mmap(pcc,
error = pops->puffs_node_mmap(pu,
opcookie, auxt->pvnr_prot, pcr);
break;
}
@ -586,7 +586,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_fsync(pcc, opcookie, pcr,
error = pops->puffs_node_fsync(pu, opcookie, pcr,
auxt->pvnr_flags, auxt->pvnr_offlo,
auxt->pvnr_offhi);
break;
@ -602,7 +602,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_seek(pcc,
error = pops->puffs_node_seek(pu,
opcookie, auxt->pvnr_oldoff,
auxt->pvnr_newoff, pcr);
break;
@ -621,7 +621,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred);
PUFFS_KCIDTOCID(pcn.pcn_cid, &auxt->pvnr_cn_cid);
error = pops->puffs_node_remove(pcc,
error = pops->puffs_node_remove(pu,
opcookie, auxt->pvnr_cookie_targ, &pcn);
break;
}
@ -645,7 +645,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_link(pcc,
error = pops->puffs_node_link(pu,
opcookie, auxt->pvnr_cookie_targ, &pcn);
if (buildpath)
pu->pu_pathfree(pu, &pcn.pcn_po_full);
@ -686,7 +686,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_rename(pcc,
error = pops->puffs_node_rename(pu,
opcookie, auxt->pvnr_cookie_src,
&pcn_src, auxt->pvnr_cookie_targdir,
auxt->pvnr_cookie_targ, &pcn_targ);
@ -747,7 +747,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_mkdir(pcc,
error = pops->puffs_node_mkdir(pu,
opcookie, &pni, &pcn, &auxt->pvnr_va);
if (buildpath) {
@ -777,7 +777,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred);
PUFFS_KCIDTOCID(pcn.pcn_cid, &auxt->pvnr_cn_cid);
error = pops->puffs_node_rmdir(pcc,
error = pops->puffs_node_rmdir(pu,
opcookie, auxt->pvnr_cookie_targ, &pcn);
break;
}
@ -806,7 +806,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_symlink(pcc,
error = pops->puffs_node_symlink(pu,
opcookie, &pni, &pcn,
&auxt->pvnr_va, auxt->pvnr_link);
@ -850,7 +850,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
(auxt->pvnr_data + auxt->pvnr_dentoff);
res = auxt->pvnr_resid;
error = pops->puffs_node_readdir(pcc,
error = pops->puffs_node_readdir(pu,
opcookie, dent, &auxt->pvnr_offset,
&auxt->pvnr_resid, pcr, &auxt->pvnr_eofflag,
cookies, &auxt->pvnr_ncookies);
@ -875,7 +875,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
}
/*LINTED*/
error = pops->puffs_node_readlink(pcc, opcookie, pcr,
error = pops->puffs_node_readlink(pu, opcookie, pcr,
auxt->pvnr_link, &auxt->pvnr_linklen);
break;
}
@ -888,7 +888,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_reclaim(pcc, opcookie);
error = pops->puffs_node_reclaim(pu, opcookie);
break;
}
@ -900,7 +900,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_inactive(pcc, opcookie);
error = pops->puffs_node_inactive(pu, opcookie);
break;
}
@ -912,7 +912,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_pathconf(pcc,
error = pops->puffs_node_pathconf(pu,
opcookie, auxt->pvnr_name,
&auxt->pvnr_retval);
break;
@ -926,7 +926,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_advlock(pcc,
error = pops->puffs_node_advlock(pu,
opcookie, auxt->pvnr_id, auxt->pvnr_op,
&auxt->pvnr_fl, auxt->pvnr_flags);
break;
@ -939,7 +939,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_print(pcc,
error = pops->puffs_node_print(pu,
opcookie);
break;
}
@ -956,7 +956,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
}
res = auxt->pvnr_resid;
error = pops->puffs_node_read(pcc,
error = pops->puffs_node_read(pu,
opcookie, auxt->pvnr_data,
auxt->pvnr_offset, &auxt->pvnr_resid,
pcr, auxt->pvnr_ioflag);
@ -977,7 +977,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_write(pcc,
error = pops->puffs_node_write(pu,
opcookie, auxt->pvnr_data,
auxt->pvnr_offset, &auxt->pvnr_resid,
pcr, auxt->pvnr_ioflag);
@ -1001,7 +1001,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
break;
}
error = pops->puffs_node_poll(pcc,
error = pops->puffs_node_poll(pu,
opcookie, &auxt->pvnr_events);
break;
}
@ -1022,7 +1022,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
pcc->pcc_flags |= PCC_DONE;
if (pu->pu_oppost)
pu->pu_oppost(pcc);
pu->pu_oppost(pu);
/*
* Note, we are calling this from here so that we can run it

View File

@ -1,4 +1,4 @@
/* $NetBSD: null.c,v 1.23 2007/11/27 11:31:19 pooka Exp $ */
/* $NetBSD: null.c,v 1.24 2007/11/30 19:02:28 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: null.c,v 1.23 2007/11/27 11:31:19 pooka Exp $");
__RCSID("$NetBSD: null.c,v 1.24 2007/11/30 19:02:28 pooka Exp $");
#endif /* !lint */
/*
@ -187,9 +187,8 @@ puffs_null_setops(struct puffs_ops *pops)
/*ARGSUSED*/
int
puffs_null_fs_statvfs(struct puffs_cc *pcc, struct statvfs *svfsb)
puffs_null_fs_statvfs(struct puffs_usermount *pu, struct statvfs *svfsb)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
if (statvfs(PNPATH(puffs_getroot(pu)), svfsb) == -1)
return errno;
@ -198,10 +197,9 @@ puffs_null_fs_statvfs(struct puffs_cc *pcc, struct statvfs *svfsb)
}
int
puffs_null_node_lookup(struct puffs_cc *pcc, void *opc,
puffs_null_node_lookup(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn = opc, *pn_res;
struct stat sb;
int rv;
@ -238,11 +236,10 @@ puffs_null_node_lookup(struct puffs_cc *pcc, void *opc,
/*ARGSUSED*/
int
puffs_null_node_create(struct puffs_cc *pcc, void *opc,
puffs_null_node_create(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn,
const struct vattr *va)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
int fd, rv;
fd = open(PCNPATH(pcn), O_RDWR | O_CREAT | O_TRUNC);
@ -258,11 +255,10 @@ puffs_null_node_create(struct puffs_cc *pcc, void *opc,
/*ARGSUSED*/
int
puffs_null_node_mknod(struct puffs_cc *pcc, void *opc,
puffs_null_node_mknod(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn,
const struct vattr *va)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
mode_t mode;
int rv;
@ -278,7 +274,7 @@ puffs_null_node_mknod(struct puffs_cc *pcc, void *opc,
/*ARGSUSED*/
int
puffs_null_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *va,
puffs_null_node_getattr(struct puffs_usermount *pu, void *opc, struct vattr *va,
const struct puffs_cred *pcred)
{
struct puffs_node *pn = opc;
@ -293,7 +289,7 @@ puffs_null_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *va,
/*ARGSUSED*/
int
puffs_null_node_setattr(struct puffs_cc *pcc, void *opc,
puffs_null_node_setattr(struct puffs_usermount *pu, void *opc,
const struct vattr *va, const struct puffs_cred *pcred)
{
struct puffs_node *pn = opc;
@ -310,7 +306,7 @@ puffs_null_node_setattr(struct puffs_cc *pcc, void *opc,
/*ARGSUSED*/
int
puffs_null_node_fsync(struct puffs_cc *pcc, void *opc,
puffs_null_node_fsync(struct puffs_usermount *pu, void *opc,
const struct puffs_cred *pcred, int how,
off_t offlo, off_t offhi)
{
@ -340,7 +336,7 @@ puffs_null_node_fsync(struct puffs_cc *pcc, void *opc,
/*ARGSUSED*/
int
puffs_null_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
puffs_null_node_remove(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_node *pn_targ = targ;
@ -354,7 +350,7 @@ puffs_null_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
/*ARGSUSED*/
int
puffs_null_node_link(struct puffs_cc *pcc, void *opc, void *targ,
puffs_null_node_link(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_node *pn_targ = targ;
@ -367,7 +363,7 @@ puffs_null_node_link(struct puffs_cc *pcc, void *opc, void *targ,
/*ARGSUSED*/
int
puffs_null_node_rename(struct puffs_cc *pcc, void *opc, void *src,
puffs_null_node_rename(struct puffs_usermount *pu, void *opc, void *src,
const struct puffs_cn *pcn_src, void *targ_dir, void *targ,
const struct puffs_cn *pcn_targ)
{
@ -380,11 +376,10 @@ puffs_null_node_rename(struct puffs_cc *pcc, void *opc, void *src,
/*ARGSUSED*/
int
puffs_null_node_mkdir(struct puffs_cc *pcc, void *opc,
puffs_null_node_mkdir(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn,
const struct vattr *va)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
int rv;
if (mkdir(PCNPATH(pcn), va->va_mode) == -1)
@ -398,7 +393,7 @@ puffs_null_node_mkdir(struct puffs_cc *pcc, void *opc,
/*ARGSUSED*/
int
puffs_null_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
puffs_null_node_rmdir(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_node *pn_targ = targ;
@ -412,11 +407,10 @@ puffs_null_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
/*ARGSUSED*/
int
puffs_null_node_symlink(struct puffs_cc *pcc, void *opc,
puffs_null_node_symlink(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn,
const struct vattr *va, const char *linkname)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
int rv;
if (symlink(linkname, PCNPATH(pcn)) == -1)
@ -430,7 +424,7 @@ puffs_null_node_symlink(struct puffs_cc *pcc, void *opc,
/*ARGSUSED*/
int
puffs_null_node_readlink(struct puffs_cc *pcc, void *opc,
puffs_null_node_readlink(struct puffs_usermount *pu, void *opc,
const struct puffs_cred *pcred, char *linkname, size_t *linklen)
{
struct puffs_node *pn = opc;
@ -446,9 +440,10 @@ puffs_null_node_readlink(struct puffs_cc *pcc, void *opc,
/*ARGSUSED*/
int
puffs_null_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *de,
off_t *off, size_t *reslen, const struct puffs_cred *pcred,
int *eofflag, off_t *cookies, size_t *ncookies)
puffs_null_node_readdir(struct puffs_usermount *pu, void *opc,
struct dirent *de, off_t *off, size_t *reslen,
const struct puffs_cred *pcred, int *eofflag, off_t *cookies,
size_t *ncookies)
{
struct puffs_node *pn = opc;
struct dirent entry, *result;
@ -498,7 +493,7 @@ puffs_null_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *de,
/*ARGSUSED*/
int
puffs_null_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
puffs_null_node_read(struct puffs_usermount *pu, void *opc, uint8_t *buf,
off_t offset, size_t *buflen, const struct puffs_cred *pcred,
int ioflag)
{
@ -530,7 +525,7 @@ puffs_null_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
/*ARGSUSED*/
int
puffs_null_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
puffs_null_node_write(struct puffs_usermount *pu, void *opc, uint8_t *buf,
off_t offset, size_t *buflen, const struct puffs_cred *pcred,
int ioflag)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs.h,v 1.96 2007/11/29 17:47:55 pooka Exp $ */
/* $NetBSD: puffs.h,v 1.97 2007/11/30 19:02:29 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@ -156,73 +156,72 @@ extern const struct mntopt puffsmopts[]; /* puffs.c */
/* callbacks for operations */
struct puffs_ops {
int (*puffs_fs_unmount)(struct puffs_cc *, int);
int (*puffs_fs_statvfs)(struct puffs_cc *, struct statvfs *);
int (*puffs_fs_sync)(struct puffs_cc *, int,
int (*puffs_fs_unmount)(struct puffs_usermount *, int);
int (*puffs_fs_statvfs)(struct puffs_usermount *, struct statvfs *);
int (*puffs_fs_sync)(struct puffs_usermount *, int,
const struct puffs_cred *);
int (*puffs_fs_fhtonode)(struct puffs_cc *, void *, size_t,
int (*puffs_fs_fhtonode)(struct puffs_usermount *, void *, size_t,
struct puffs_newinfo *);
int (*puffs_fs_nodetofh)(struct puffs_cc *, void *cookie,
int (*puffs_fs_nodetofh)(struct puffs_usermount *, void *cookie,
void *, size_t *);
void (*puffs_fs_suspend)(struct puffs_cc *, int);
void (*puffs_fs_suspend)(struct puffs_usermount *, int);
int (*puffs_node_lookup)(struct puffs_cc *,
int (*puffs_node_lookup)(struct puffs_usermount *,
void *, struct puffs_newinfo *, const struct puffs_cn *);
int (*puffs_node_create)(struct puffs_cc *,
int (*puffs_node_create)(struct puffs_usermount *,
void *, struct puffs_newinfo *, const struct puffs_cn *,
const struct vattr *);
int (*puffs_node_mknod)(struct puffs_cc *,
int (*puffs_node_mknod)(struct puffs_usermount *,
void *, struct puffs_newinfo *, const struct puffs_cn *,
const struct vattr *);
int (*puffs_node_open)(struct puffs_cc *,
int (*puffs_node_open)(struct puffs_usermount *,
void *, int, const struct puffs_cred *);
int (*puffs_node_close)(struct puffs_cc *,
int (*puffs_node_close)(struct puffs_usermount *,
void *, int, const struct puffs_cred *);
int (*puffs_node_access)(struct puffs_cc *,
int (*puffs_node_access)(struct puffs_usermount *,
void *, int, const struct puffs_cred *);
int (*puffs_node_getattr)(struct puffs_cc *,
int (*puffs_node_getattr)(struct puffs_usermount *,
void *, struct vattr *, const struct puffs_cred *);
int (*puffs_node_setattr)(struct puffs_cc *,
int (*puffs_node_setattr)(struct puffs_usermount *,
void *, const struct vattr *, const struct puffs_cred *);
int (*puffs_node_poll)(struct puffs_cc *, void *, int *);
int (*puffs_node_mmap)(struct puffs_cc *,
int (*puffs_node_poll)(struct puffs_usermount *, void *, int *);
int (*puffs_node_mmap)(struct puffs_usermount *,
void *, vm_prot_t, const struct puffs_cred *);
int (*puffs_node_fsync)(struct puffs_cc *,
int (*puffs_node_fsync)(struct puffs_usermount *,
void *, const struct puffs_cred *, int, off_t, off_t);
int (*puffs_node_seek)(struct puffs_cc *,
int (*puffs_node_seek)(struct puffs_usermount *,
void *, off_t, off_t, const struct puffs_cred *);
int (*puffs_node_remove)(struct puffs_cc *,
int (*puffs_node_remove)(struct puffs_usermount *,
void *, void *, const struct puffs_cn *);
int (*puffs_node_link)(struct puffs_cc *,
int (*puffs_node_link)(struct puffs_usermount *,
void *, void *, const struct puffs_cn *);
int (*puffs_node_rename)(struct puffs_cc *,
int (*puffs_node_rename)(struct puffs_usermount *,
void *, void *, const struct puffs_cn *, void *, void *,
const struct puffs_cn *);
int (*puffs_node_mkdir)(struct puffs_cc *,
int (*puffs_node_mkdir)(struct puffs_usermount *,
void *, struct puffs_newinfo *, const struct puffs_cn *,
const struct vattr *);
int (*puffs_node_rmdir)(struct puffs_cc *,
int (*puffs_node_rmdir)(struct puffs_usermount *,
void *, void *, const struct puffs_cn *);
int (*puffs_node_symlink)(struct puffs_cc *,
int (*puffs_node_symlink)(struct puffs_usermount *,
void *, struct puffs_newinfo *, const struct puffs_cn *,
const struct vattr *,
const char *);
int (*puffs_node_readdir)(struct puffs_cc *,
int (*puffs_node_readdir)(struct puffs_usermount *,
void *, struct dirent *, off_t *, size_t *,
const struct puffs_cred *, int *, off_t *, size_t *);
int (*puffs_node_readlink)(struct puffs_cc *,
int (*puffs_node_readlink)(struct puffs_usermount *,
void *, const struct puffs_cred *, char *, size_t *);
int (*puffs_node_reclaim)(struct puffs_cc *, void *);
int (*puffs_node_inactive)(struct puffs_cc *, void *);
int (*puffs_node_print)(struct puffs_cc *,
void *);
int (*puffs_node_pathconf)(struct puffs_cc *,
int (*puffs_node_reclaim)(struct puffs_usermount *, void *);
int (*puffs_node_inactive)(struct puffs_usermount *, void *);
int (*puffs_node_print)(struct puffs_usermount *, void *);
int (*puffs_node_pathconf)(struct puffs_usermount *,
void *, int, int *);
int (*puffs_node_advlock)(struct puffs_cc *,
int (*puffs_node_advlock)(struct puffs_usermount *,
void *, void *, int, struct flock *, int);
int (*puffs_node_read)(struct puffs_cc *, void *,
int (*puffs_node_read)(struct puffs_usermount *, void *,
uint8_t *, off_t, size_t *, const struct puffs_cred *, int);
int (*puffs_node_write)(struct puffs_cc *, void *,
int (*puffs_node_write)(struct puffs_usermount *, void *,
uint8_t *, off_t, size_t *, const struct puffs_cred *, int);
/* XXX: this shouldn't be here */
@ -248,7 +247,7 @@ typedef int (*pu_namemod_fn)(struct puffs_usermount *,
typedef void (*pu_errnotify_fn)(struct puffs_usermount *,
uint8_t, int, const char *, void *);
typedef void (*pu_prepost_fn)(struct puffs_cc *);
typedef void (*pu_prepost_fn)(struct puffs_usermount *);
enum {
PUFFS_STATE_BEFOREMOUNT, PUFFS_STATE_RUNNING,
@ -277,72 +276,73 @@ enum {
*/
#define PUFFSOP_PROTOS(fsname) \
int fsname##_fs_unmount(struct puffs_cc *, int); \
int fsname##_fs_statvfs(struct puffs_cc *, struct statvfs *); \
int fsname##_fs_sync(struct puffs_cc *, int, \
int fsname##_fs_unmount(struct puffs_usermount *, int); \
int fsname##_fs_statvfs(struct puffs_usermount *, \
struct statvfs *); \
int fsname##_fs_sync(struct puffs_usermount *, int, \
const struct puffs_cred *cred); \
int fsname##_fs_fhtonode(struct puffs_cc *, void *, size_t, \
struct puffs_newinfo *); \
int fsname##_fs_nodetofh(struct puffs_cc *, void *cookie, \
int fsname##_fs_fhtonode(struct puffs_usermount *, void *, \
size_t, struct puffs_newinfo *); \
int fsname##_fs_nodetofh(struct puffs_usermount *, void *cookie,\
void *, size_t *); \
void fsname##_fs_suspend(struct puffs_cc *, int); \
void fsname##_fs_suspend(struct puffs_usermount *, int); \
\
int fsname##_node_lookup(struct puffs_cc *, \
int fsname##_node_lookup(struct puffs_usermount *, \
void *, struct puffs_newinfo *, const struct puffs_cn *); \
int fsname##_node_create(struct puffs_cc *, \
int fsname##_node_create(struct puffs_usermount *, \
void *, struct puffs_newinfo *, const struct puffs_cn *, \
const struct vattr *); \
int fsname##_node_mknod(struct puffs_cc *, \
int fsname##_node_mknod(struct puffs_usermount *, \
void *, struct puffs_newinfo *, const struct puffs_cn *, \
const struct vattr *); \
int fsname##_node_open(struct puffs_cc *, \
int fsname##_node_open(struct puffs_usermount *, \
void *, int, const struct puffs_cred *); \
int fsname##_node_close(struct puffs_cc *, \
int fsname##_node_close(struct puffs_usermount *, \
void *, int, const struct puffs_cred *); \
int fsname##_node_access(struct puffs_cc *, \
int fsname##_node_access(struct puffs_usermount *, \
void *, int, const struct puffs_cred *); \
int fsname##_node_getattr(struct puffs_cc *, \
int fsname##_node_getattr(struct puffs_usermount *, \
void *, struct vattr *, const struct puffs_cred *); \
int fsname##_node_setattr(struct puffs_cc *, \
int fsname##_node_setattr(struct puffs_usermount *, \
void *, const struct vattr *, const struct puffs_cred *); \
int fsname##_node_poll(struct puffs_cc *, void *, int *); \
int fsname##_node_mmap(struct puffs_cc *, \
int fsname##_node_poll(struct puffs_usermount *, void *, int *);\
int fsname##_node_mmap(struct puffs_usermount *, \
void *, vm_prot_t, const struct puffs_cred *); \
int fsname##_node_fsync(struct puffs_cc *, \
int fsname##_node_fsync(struct puffs_usermount *, \
void *, const struct puffs_cred *, int, off_t, off_t); \
int fsname##_node_seek(struct puffs_cc *, \
int fsname##_node_seek(struct puffs_usermount *, \
void *, off_t, off_t, const struct puffs_cred *); \
int fsname##_node_remove(struct puffs_cc *, \
int fsname##_node_remove(struct puffs_usermount *, \
void *, void *, const struct puffs_cn *); \
int fsname##_node_link(struct puffs_cc *, \
int fsname##_node_link(struct puffs_usermount *, \
void *, void *, const struct puffs_cn *); \
int fsname##_node_rename(struct puffs_cc *, \
int fsname##_node_rename(struct puffs_usermount *, \
void *, void *, const struct puffs_cn *, void *, void *, \
const struct puffs_cn *); \
int fsname##_node_mkdir(struct puffs_cc *, \
int fsname##_node_mkdir(struct puffs_usermount *, \
void *, struct puffs_newinfo *, const struct puffs_cn *, \
const struct vattr *); \
int fsname##_node_rmdir(struct puffs_cc *, \
int fsname##_node_rmdir(struct puffs_usermount *, \
void *, void *, const struct puffs_cn *); \
int fsname##_node_symlink(struct puffs_cc *, \
int fsname##_node_symlink(struct puffs_usermount *, \
void *, struct puffs_newinfo *, const struct puffs_cn *, \
const struct vattr *, const char *); \
int fsname##_node_readdir(struct puffs_cc *, \
int fsname##_node_readdir(struct puffs_usermount *, \
void *, struct dirent *, off_t *, size_t *, \
const struct puffs_cred *, int *, off_t *, size_t *); \
int fsname##_node_readlink(struct puffs_cc *, \
int fsname##_node_readlink(struct puffs_usermount *, \
void *, const struct puffs_cred *, char *, size_t *); \
int fsname##_node_reclaim(struct puffs_cc *, void *); \
int fsname##_node_inactive(struct puffs_cc *, void *); \
int fsname##_node_print(struct puffs_cc *, \
int fsname##_node_reclaim(struct puffs_usermount *, void *); \
int fsname##_node_inactive(struct puffs_usermount *, void *); \
int fsname##_node_print(struct puffs_usermount *, \
void *); \
int fsname##_node_pathconf(struct puffs_cc *, \
int fsname##_node_pathconf(struct puffs_usermount *, \
void *, int, int *); \
int fsname##_node_advlock(struct puffs_cc *, \
int fsname##_node_advlock(struct puffs_usermount *, \
void *, void *, int, struct flock *, int); \
int fsname##_node_read(struct puffs_cc *, void *, \
int fsname##_node_read(struct puffs_usermount *, void *, \
uint8_t *, off_t, size_t *, const struct puffs_cred *, int);\
int fsname##_node_write(struct puffs_cc *, void *, \
int fsname##_node_write(struct puffs_usermount *, void *, \
uint8_t *, off_t, size_t *, const struct puffs_cred *, int);\
\
int fsname##_cache_write(struct puffs_usermount *, void *, \
@ -358,7 +358,7 @@ enum {
PUFFSOP_PROTOS(puffs_null) /* XXX */
#define PUFFS_DEVEL_LIBVERSION 30
#define PUFFS_DEVEL_LIBVERSION 31
#define puffs_init(a,b,c,d,e) \
_puffs_init(PUFFS_DEVEL_LIBVERSION,a,b,c,d,e)
@ -468,12 +468,12 @@ void puffs_null_setops(struct puffs_ops *);
/*
* generic/dummy routines applicable for some file systems
*/
int puffs_fsnop_unmount(struct puffs_cc *, int);
int puffs_fsnop_statvfs(struct puffs_cc *, struct statvfs *);
int puffs_fsnop_unmount(struct puffs_usermount *, int);
int puffs_fsnop_statvfs(struct puffs_usermount *, struct statvfs *);
void puffs_zerostatvfs(struct statvfs *);
int puffs_fsnop_sync(struct puffs_cc *, int waitfor,
int puffs_fsnop_sync(struct puffs_usermount *, int waitfor,
const struct puffs_cred *);
int puffs_genfs_node_reclaim(struct puffs_cc *, void *);
int puffs_genfs_node_reclaim(struct puffs_usermount *, void *);
/*
* Subroutine stuff

View File

@ -1,4 +1,4 @@
.\" $NetBSD: puffs_ops.3,v 1.16 2007/11/27 11:31:19 pooka Exp $
.\" $NetBSD: puffs_ops.3,v 1.17 2007/11/30 19:02:29 pooka Exp $
.\"
.\" Copyright (c) 2007 Antti Kantee. All rights reserved.
.\"
@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd November 27, 2007
.Dd November 30, 2007
.Dt PUFFS_OPS 3
.Os
.Sh NAME
@ -35,148 +35,148 @@
.In puffs.h
.Ft int
.Fo puffs_fs_statvfs
.Fa "struct puffs_cc *pcc" "struct statvfs *sbp"
.Fa "struct puffs_usermount *pu" "struct statvfs *sbp"
.Fc
.Ft int
.Fo puffs_fs_sync
.Fa "struct puffs_cc *pcc" "int waitfor" "const struct puffs_cred *pcr"
.Fa "struct puffs_usermount *pu" "int waitfor" "const struct puffs_cred *pcr"
.Fc
.Ft int
.Fo puffs_fs_fhtonode
.Fa "struct puffs_cc *pcc" "void *fid" "size_t fidsize"
.Fa "struct puffs_usermount *pu" "void *fid" "size_t fidsize"
.Fa "struct puffs_newinfo *pni"
.Fc
.Ft int
.Fo puffs_fs_nodetofh
.Fa "struct puffs_cc *pcc" "void *cookie" "void *fid" "size_t *fidsize"
.Fa "struct puffs_usermount *pu" "void *cookie" "void *fid" "size_t *fidsize"
.Fc
.Ft void
.Fn puffs_fs_suspend "struct puffs_cc *pcc" "int status"
.Fn puffs_fs_suspend "struct puffs_usermount *pu" "int status"
.Ft int
.Fo puffs_fs_unmount
.Fa "struct puffs_cc *pcc" "int flags"
.Fa "struct puffs_usermount *pu" "int flags"
.Fc
.Ft int
.Fo puffs_node_lookup
.Fa "struct puffs_cc *pcc" "void *opc" "struct puffs_newinfo *pni"
.Fa "struct puffs_usermount *pu" "void *opc" "struct puffs_newinfo *pni"
.Fa "const struct puffs_cn *pcn"
.Fc
.Ft int
.Fo puffs_node_create
.Fa "struct puffs_cc *pcc" "void *opc" "struct puffs_newinfo *pni"
.Fa "struct puffs_usermount *pu" "void *opc" "struct puffs_newinfo *pni"
.Fa "const struct puffs_cn *pcn" "const struct vattr *vap"
.Fc
.Ft int
.Fo puffs_node_mknod
.Fa "struct puffs_cc *pcc" "void *opc" "struct puffs_newinfo *pni"
.Fa "struct puffs_usermount *pu" "void *opc" "struct puffs_newinfo *pni"
.Fa "const struct puffs_cn *pcn" "const struct vattr *vap"
.Fc
.Ft int
.Fo puffs_node_open
.Fa "struct puffs_cc *pcc" "void *opc" "int mode"
.Fa "struct puffs_usermount *pu" "void *opc" "int mode"
.Fa "const struct puffs_cred *pcr"
.Fc
.Ft int
.Fo puffs_node_close
.Fa "struct puffs_cc *pcc" "void *opc" "int flags"
.Fa "struct puffs_usermount *pu" "void *opc" "int flags"
.Fa "const struct puffs_cred *pcr"
.Fc
.Ft int
.Fo puffs_node_access
.Fa "struct puffs_cc *pcc" "void *opc" "int mode"
.Fa "struct puffs_usermount *pu" "void *opc" "int mode"
.Fa "const struct puffs_cred *pcr"
.Fc
.Ft int
.Fo puffs_node_getattr
.Fa "struct puffs_cc *pcc" "void *opc" "struct vattr *vap"
.Fa "struct puffs_usermount *pu" "void *opc" "struct vattr *vap"
.Fa "const struct puffs_cred *pcr"
.Fc
.Ft int
.Fo puffs_node_setattr
.Fa "struct puffs_cc *pcc" "void *opc" "const struct vattr *vap"
.Fa "struct puffs_usermount *pu" "void *opc" "const struct vattr *vap"
.Fa "const struct puffs_cred *pcr"
.Fc
.Ft int
.Fo puffs_node_poll
.Fa "struct puffs_cc *pcc" "void *opc" "int *events"
.Fa "struct puffs_usermount *pu" "void *opc" "int *events"
.Fc
.Ft int
.Fo puffs_node_mmap
.Fa "struct puffs_cc *pcc" "void *opc" "int flags"
.Fa "struct puffs_usermount *pu" "void *opc" "int flags"
.Fa "const struct puffs_cred *pcr"
.Fc
.Ft int
.Fo puffs_node_fsync
.Fa "struct puffs_cc *pcc" "void *opc" "const struct puffs_cred *pcr"
.Fa "struct puffs_usermount *pu" "void *opc" "const struct puffs_cred *pcr"
.Fa "int flags" "off_t offlo" "off_t offhi"
.Fc
.Ft int
.Fo puffs_node_seek
.Fa "struct puffs_cc *pcc" "void *opc" "off_t oldoff" "off_t newoff"
.Fa "struct puffs_usermount *pu" "void *opc" "off_t oldoff" "off_t newoff"
.Fa "const struct puffs_cred *pcr"
.Fc
.Ft int
.Fo puffs_node_remove
.Fa "struct puffs_cc *pcc" "void *opc" "void *targ"
.Fa "struct puffs_usermount *pu" "void *opc" "void *targ"
.Fa "const struct puffs_cn *pcn"
.Fc
.Ft int
.Fo puffs_node_link
.Fa "struct puffs_cc *pcc" "void *opc" "void *targ"
.Fa "struct puffs_usermount *pu" "void *opc" "void *targ"
.Fa "const struct puffs_cn *pcn"
.Fc
.Ft int
.Fo puffs_node_rename
.Fa "struct puffs_cc *pcc" "void *opc" "void *src"
.Fa "struct puffs_usermount *pu" "void *opc" "void *src"
.Fa "const struct puffs_cn *pcn_src" "void *targ_dir" "void *targ"
.Fa "const struct puffs_cn *pcn_targ"
.Fc
.Ft int
.Fo puffs_node_mkdir
.Fa "struct puffs_cc *pcc" "void *opc" "struct puffs_newinfo *pni"
.Fa "struct puffs_usermount *pu" "void *opc" "struct puffs_newinfo *pni"
.Fa "const struct puffs_cn *pcn" "const struct vattr *vap"
.Fc
.Ft int
.Fo puffs_node_rmdir
.Fa "struct puffs_cc *pcc" "void *opc" "void *targ"
.Fa "struct puffs_usermount *pu" "void *opc" "void *targ"
.Fa "const struct puffs_cn *pcn"
.Fc
.Ft int
.Fo puffs_node_readdir
.Fa "struct puffs_cc *pcc" "void *opc" "struct dirent *dent"
.Fa "struct puffs_usermount *pu" "void *opc" "struct dirent *dent"
.Fa "off_t *readoff" "size_t *reslen" "const struct puffs_cred *pcr"
.Fa "int *eofflag" "off_t *cookies" "size_t *ncookies"
.Fc
.Ft int
.Fo puffs_node_symlink
.Fa "struct puffs_cc *pcc" "void *opc" "struct puffs_newinfo *pni"
.Fa "struct puffs_usermount *pu" "void *opc" "struct puffs_newinfo *pni"
.Fa "const struct puffs_cn *pcn_src" "const struct vattr *vap"
.Fa "const char *link_target"
.Fc
.Ft int
.Fo puffs_node_readlink
.Fa "struct puffs_cc *pcc" "void *opc" "const struct puffs_cred *pcr"
.Fa "struct puffs_usermount *pu" "void *opc" "const struct puffs_cred *pcr"
.Fa "char *link" "size_t *linklen"
.Fc
.Ft int
.Fo puffs_node_read
.Fa "struct puffs_cc *pcc" "void *opc" "uint8_t *buf"
.Fa "struct puffs_usermount *pu" "void *opc" "uint8_t *buf"
.Fa "off_t offset" "size_t *resid" "const struct puffs_cred *pcr" "int ioflag"
.Fc
.Ft int
.Fo puffs_node_write
.Fa "struct puffs_cc *pcc" "void *opc" "uint8_t *buf"
.Fa "struct puffs_usermount *pu" "void *opc" "uint8_t *buf"
.Fa "off_t offset" "size_t *resid" "const struct puffs_cred *pcr" "int ioflag"
.Fc
.Ft int
.Fn puffs_node_print "struct puffs_cc *pcc" "void *opc"
.Fn puffs_node_print "struct puffs_usermount *pu" "void *opc"
.Ft int
.Fo puffs_node_reclaim
.Fa "struct puffs_cc *pcc" "void *opc"
.Fa "struct puffs_usermount *pu" "void *opc"
.Fc
.Ft int
.Fo puffs_node_inactive
.Fa "struct puffs_cc *pcc" "void *opc"
.Fa "struct puffs_usermount *pu" "void *opc"
.Fc
.Ft void
.Fn puffs_setback "struct puffs_cc *pcc" "int op"
@ -212,7 +212,7 @@ name using the macro
.Fn PUFFSOP_PROTOS fsname .
.Ss File system callbacks (puffs_fs)
.Bl -tag -width xxxx
.It Fn puffs_fs_statvfs "pcc" "sbp"
.It Fn puffs_fs_statvfs "pu" "sbp"
The following fields of the argument
.Fa sbp
need to be filled:
@ -232,7 +232,7 @@ need to be filled:
* fsfilcnt_t f_fresvd; file nodes reserved for root
.Ed
.It Fn puffs_fs_sync "pcc" "waitfor" "pcr"
.It Fn puffs_fs_sync "pu" "waitfor" "pcr"
All the dirty buffers that have been cached at the file server
level including metadata should be committed to stable storage.
The
@ -258,7 +258,7 @@ and will usually be either file system or kernel credentials, but might
also be user credentials.
However, most of the time it is advisable to sync regardless of the
credentials of the caller.
.It Fn puffs_fs_fhtonode "pcc" "fid" "fidsize" "pni"
.It Fn puffs_fs_fhtonode "pu" "fid" "fidsize" "pni"
Translates a file handle
.Fa fid
to a node.
@ -276,7 +276,7 @@ This function provides essentially the same information to the kernel as
.Fn puffs_node_lookup .
The information is necessary for creating a new vnode corresponding to
the file handle.
.It Fn puffs_fs_nodetofh "pcc" "cookie" "fid" "fidsize"
.It Fn puffs_fs_nodetofh "pu" "cookie" "fid" "fidsize"
Create a file handle from the node described by
.Fa cookie .
The file handle should contain enough information to reliably identify
@ -296,12 +296,12 @@ In either case, the handle length should be supplied to the kernel in
.Fa fidsize .
File systems with static length handles can ignore the size parameter as
the kernel always supplies the correct size buffer.
.It Fn puffs_fs_suspend "pcc" "status"
.It Fn puffs_fs_suspend "pu" "status"
Called when file system suspension reaches various phases.
See
.Xr puffs_suspend 3
for more information.
.It Fn puffs_fs_unmount "pcc" "flags"
.It Fn puffs_fs_unmount "pu" "flags"
Unmount the file system.
The kernel has assumedly flushed all cached data when this callback
is executed.
@ -326,7 +326,7 @@ The return value 0 signals success, else an appropriate errno value
should be returned.
Please note that neither this list nor the descriptions are complete.
.Bl -tag -width xxxx
.It Fn puffs_node_lookup "pcc" "opc" "pni" "pcn"
.It Fn puffs_node_lookup "pu" "opc" "pni" "pcn"
This function is used to locate nodes, or in other words translate
pathname components to file system data structures.
The implementation should match the name in
@ -402,9 +402,9 @@ to indicate the amount of
characters in addition to
.Ar pcn-\*[Gt]pcn_namelen
processed.
.It Fn puffs_node_create "pcc" "opc" "pni" "pcn" "va"
.It Fn puffs_node_mkdir "pcc" "opc" "pni" "pcn" "va"
.It Fn puffs_node_mknod "pcc" "opc" "pni" "pcn" "va"
.It Fn puffs_node_create "pu" "opc" "pni" "pcn" "va"
.It Fn puffs_node_mkdir "pu" "opc" "pni" "pcn" "va"
.It Fn puffs_node_mknod "pu" "opc" "pni" "pcn" "va"
A file node is created in the directory denoted by the cookie
.Fa opc
by any of the above callbacks.
@ -419,7 +419,7 @@ file, directory and device special file, respectively.
.Pp
In case of mknod, the device identifier can be found in
.Fa va-\*[Gt]va_rdev .
.It Fn puffs_node_open "pcc" "opc" "mode" "pcr"
.It Fn puffs_node_open "pu" "opc" "mode" "pcr"
Open the node denoted by the cookie
.Fa opc .
The parameter
@ -430,12 +430,12 @@ was called with, e.g.
.Dv O_APPEND
and
.Dv O_NONBLOCK .
.It Fn puffs_node_close "pcc" "opc" "flags" "pcr"
.It Fn puffs_node_close "pu" "opc" "flags" "pcr"
Close a node.
The parameter
.Fa flags
parameter describes the flags that the file was opened with.
.It Fn puffs_node_access "pcc" "opc" "mode" "pcr"
.It Fn puffs_node_access "pu" "opc" "mode" "pcr"
Check if the credentials of
.Fa pcr
have the right to perform the operation specified by
@ -450,12 +450,12 @@ can specify read, write or execute by
and
.Dv PUFFS_VEXEC ,
respectively.
.It Fn puffs_node_getattr "pcc" "opc" "va" "pcr"
.It Fn puffs_node_getattr "pu" "opc" "va" "pcr"
The attributes of the node specified by
.Fa opc
must be copied to the space pointed by
.Fa va .
.It Fn puffs_node_setattr "pcc" "opc" "va" "pcr"
.It Fn puffs_node_setattr "pu" "opc" "va" "pcr"
The attributes for the node specified by
.Fa opc
must be set to those contained in
@ -465,7 +465,7 @@ Only fields of
which contain a value different from
.Dv PUFFS_VNOVAL
(typecast to the field's type!) contain a valid value.
.It Fn puffs_node_poll "pcc" "opc" "events"
.It Fn puffs_node_poll "pu" "opc" "events"
Poll for events on node
.Ar opc .
If
@ -494,12 +494,12 @@ At this level, however, the timeout is not supplied.
In case input does not arrive, the file system should periodically
unblock and return 0 new events to avoid hanging forever.
This will hopefully be better supported by libpuffs in the future.
.It Fn puffs_node_mmap "pcc" "opc" "flags" "pcr"
.It Fn puffs_node_mmap "pu" "opc" "flags" "pcr"
Called when a regular file is being memory mapped by
.Xr mmap 2 .
.Fa flags
is currently always 0.
.It Fn puffs_node_fsync "pcc" "opc" "pcr" "flags" "offlo" "offhi"
.It Fn puffs_node_fsync "pu" "opc" "pcr" "flags" "offlo" "offhi"
Sychronize a node's contents onto stable storage.
This is necessary only if the file server caches some information
before committing it.
@ -515,7 +515,7 @@ specify the data offsets requiring to be synced.
A high offset of 0 means sync from
.Fa offlo
to the end of the file.
.It Fn puffs_node_seek pcc opc oldoff newoff pcr
.It Fn puffs_node_seek "pu" "opc" "oldoff" "newoff" "pcr"
Test if the node
.Ar opc
is seekable to the location
@ -527,8 +527,8 @@ Most file systems dealing only with regular will choose to not
implement this.
However, it is useful for example in cases where files are
unseekable streams.
.It Fn puffs_node_remove "pcc" "opc" "targ" "pcn"
.It Fn puffs_node_rmdir "pcc" "opc" "targ" "pcn"
.It Fn puffs_node_remove "pu" "opc" "targ" "pcn"
.It Fn puffs_node_rmdir "pu" "opc" "targ" "pcn"
Remove the node
.Fa targ
from the directory indicated by
@ -547,7 +547,7 @@ open file semantics.
The data may be removed only when
.Fn puffs_node_reclaim
is called for the node, as this assures there are no further users.
.It Fn puffs_node_link "pcc" "opc" "targ" "pcn"
.It Fn puffs_node_link "pu" "opc" "targ" "pcn"
Create a hard link for the node
.Fa targ
into the directory
@ -555,7 +555,7 @@ into the directory
The argument
.Fa pcn
provides the directory entry name for the new link.
.It Fn puffs_node_rename "pcc" "src_dir" "src" "pcn_src" "targ_dir" "targ" "pcn_targ"
.It Fn puffs_node_rename "pu" "src_dir" "src" "pcn_src" "targ_dir" "targ" "pcn_targ"
Rename the node
.Fa src
with the name specified by
@ -586,7 +586,7 @@ In case a rename between incompatible types is attempted, the errors
or
.Er EISDIR
should be returned, depending on the target type.
.It Fn puffs_node_readdir "pcc" "opc" "dent" "readoff" "reslen" "pcr" "eofflag" "cookies" "ncookies"
.It Fn puffs_node_readdir "pu" "opc" "dent" "readoff" "reslen" "pcr" "eofflag" "cookies" "ncookies"
To read directory entries,
.Fn puffs_node_readdir
is called.
@ -648,7 +648,7 @@ Note that
.Fa ncookies
must be initialized to zero before the first call to
.Fn PUFFS_STORE_DCOOKIE .
.It Fn puffs_node_symlink "pcc" "opc" "pni" "pcn_src" "va" "link_target"
.It Fn puffs_node_symlink "pu" "opc" "pni" "pcn_src" "va" "link_target"
Create a symbolic link into the directory
.Fa opc
with the name in
@ -659,7 +659,7 @@ The link's target is
.Fa link_target
and the created node cookie should be set in
.Fa pni .
.It Fn puffs_node_readlink "pcc" "opc" "pcr" "link" "linklen"
.It Fn puffs_node_readlink "pu" "opc" "pcr" "link" "linklen"
Read the target of a symbolic link
.Fa opc .
The result is placed in the buffer pointed to by
@ -670,7 +670,7 @@ and it must be updated to reflect the real link length.
A terminating nul character should not be put into the buffer and
.Em "must not"
be included in the link length.
.It Fn puffs_node_read "pcc" "opc" "buf" "offset" "resid" "pcr" "ioflag"
.It Fn puffs_node_read "pu" "opc" "buf" "offset" "resid" "pcr" "ioflag"
Read the contents of a file
.Fa opc .
It will gather the data from
@ -686,7 +686,7 @@ The parameter
.Fa resid
should be set to indicate the amount of request NOT completed.
In the normal case this should be 0.
.It Fn puffs_node_write "pcc" "opc" "buf" "offset" "resid" "pcr" "ioflag"
.It Fn puffs_node_write "pu" "opc" "buf" "offset" "resid" "pcr" "ioflag"
.Fn puffs_node_write
Write data to a file
.Fa opc
@ -700,23 +700,23 @@ The parameter must be set to indicate the amount of data NOT written.
In case the flag
.Dv PUFFS_IO_APPEND
is specified, the data should be appended to the end of the file.
.It Fn puffs_node_print "pcc" "opc"
.It Fn puffs_node_print "pu" "opc"
Print information about node. This is used only for kernel-initiated
diagnostic purposes.
.It Fn puffs_node_reclaim "pcc" "opc"
.It Fn puffs_node_reclaim "pu" "opc"
The kernel will no longer reference the cookie and resources associated
with it may be freed.
In case the file
.Fa opc
has a link count of zero, it may be safely removed now.
.It Fn puffs_node_inactive "pcc" "opc"
.It Fn puffs_node_inactive "pu" "opc"
The node
.Fa opc
has lost its last reference in the kernel.
However, the cookie must still remain valid until
.Fn puffs_node_reclaim
is called.
.It Fn puffs_setback pcc op
.It Fn puffs_setback "pcc" "op"
Issue a "setback" operation which will be handled when the request response
is returned to the kernel.
Currently this can be only called from mmap, open, remove and rmdir.

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr.c,v 1.20 2007/11/27 11:31:20 pooka Exp $ */
/* $NetBSD: subr.c,v 1.21 2007/11/30 19:02:29 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: subr.c,v 1.20 2007/11/27 11:31:20 pooka Exp $");
__RCSID("$NetBSD: subr.c,v 1.21 2007/11/30 19:02:29 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -81,7 +81,7 @@ puffs_nextdent(struct dirent **dent, const char *name, ino_t id, uint8_t dtype,
/*ARGSUSED*/
int
puffs_fsnop_unmount(struct puffs_cc *dontuse1, int dontuse2)
puffs_fsnop_unmount(struct puffs_usermount *dontuse1, int dontuse2)
{
/* would you like to see puffs rule again, my friend? */
@ -90,7 +90,7 @@ puffs_fsnop_unmount(struct puffs_cc *dontuse1, int dontuse2)
/*ARGSUSED*/
int
puffs_fsnop_sync(struct puffs_cc *dontuse1, int dontuse2,
puffs_fsnop_sync(struct puffs_usermount *dontuse1, int dontuse2,
const struct puffs_cred *dontuse3)
{
@ -99,7 +99,7 @@ puffs_fsnop_sync(struct puffs_cc *dontuse1, int dontuse2,
/*ARGSUSED*/
int
puffs_fsnop_statvfs(struct puffs_cc *dontuse1, struct statvfs *sbp)
puffs_fsnop_statvfs(struct puffs_usermount *dontuse1, struct statvfs *sbp)
{
sbp->f_bsize = sbp->f_frsize = sbp->f_iosize = 512;
@ -116,9 +116,8 @@ puffs_fsnop_statvfs(struct puffs_cc *dontuse1, struct statvfs *sbp)
*/
/*ARGSUSED2*/
int
puffs_genfs_node_reclaim(struct puffs_cc *pcc, void *opc)
puffs_genfs_node_reclaim(struct puffs_usermount *pu, void *opc)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
puffs_pn_put(PU_CMAP(pu, opc));

View File

@ -1,4 +1,4 @@
/* $NetBSD: refuse.c,v 1.84 2007/11/27 11:31:20 pooka Exp $ */
/* $NetBSD: refuse.c,v 1.85 2007/11/30 19:02:29 pooka Exp $ */
/*
* Copyright © 2007 Alistair Crooks. All rights reserved.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: refuse.c,v 1.84 2007/11/27 11:31:20 pooka Exp $");
__RCSID("$NetBSD: refuse.c,v 1.85 2007/11/30 19:02:29 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -252,8 +252,9 @@ set_fuse_context_uid_gid(const struct puffs_cred *cred)
/* set the pid of the calling process in the current fuse context */
static void
set_fuse_context_pid(struct puffs_cc *pcc)
set_fuse_context_pid(struct puffs_usermount *pu)
{
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct fuse_context *fusectx;
fusectx = fuse_get_context();
@ -573,10 +574,9 @@ fuse_newnode(struct puffs_usermount *pu, const char *path,
/* lookup the path */
/* ARGSUSED1 */
static int
puffs_fuse_node_lookup(struct puffs_cc *pcc, void *opc,
puffs_fuse_node_lookup(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn_res;
struct stat st;
struct fuse *fuse;
@ -614,10 +614,9 @@ puffs_fuse_node_lookup(struct puffs_cc *pcc, void *opc,
/* get attributes for the path name */
/* ARGSUSED3 */
static int
puffs_fuse_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *va,
puffs_fuse_node_getattr(struct puffs_usermount *pu, void *opc, struct vattr *va,
const struct puffs_cred *pcr)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn = opc;
struct fuse *fuse;
const char *path = PNPATH(pn);
@ -632,10 +631,9 @@ puffs_fuse_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *va,
/* read the contents of the symbolic link */
/* ARGSUSED2 */
static int
puffs_fuse_node_readlink(struct puffs_cc *pcc, void *opc,
puffs_fuse_node_readlink(struct puffs_usermount *pu, void *opc,
const struct puffs_cred *cred, char *linkname, size_t *linklen)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn = opc;
struct fuse *fuse;
const char *path = PNPATH(pn), *p;
@ -665,11 +663,10 @@ puffs_fuse_node_readlink(struct puffs_cc *pcc, void *opc,
/* make the special node */
/* ARGSUSED1 */
static int
puffs_fuse_node_mknod(struct puffs_cc *pcc, void *opc,
puffs_fuse_node_mknod(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn,
const struct vattr *va)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct fuse *fuse;
mode_t mode;
const char *path = PCNPATH(pcn);
@ -696,11 +693,10 @@ puffs_fuse_node_mknod(struct puffs_cc *pcc, void *opc,
/* make a directory */
/* ARGSUSED1 */
static int
puffs_fuse_node_mkdir(struct puffs_cc *pcc, void *opc,
puffs_fuse_node_mkdir(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn,
const struct vattr *va)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct fuse *fuse;
mode_t mode = va->va_mode;
const char *path = PCNPATH(pcn);
@ -733,11 +729,10 @@ puffs_fuse_node_mkdir(struct puffs_cc *pcc, void *opc,
*/
/*ARGSUSED1*/
static int
puffs_fuse_node_create(struct puffs_cc *pcc, void *opc,
puffs_fuse_node_create(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn,
const struct vattr *va)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct fuse *fuse;
struct fuse_file_info fi;
struct puffs_node *pn;
@ -781,10 +776,9 @@ puffs_fuse_node_create(struct puffs_cc *pcc, void *opc,
/* remove the directory entry */
/* ARGSUSED1 */
static int
puffs_fuse_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
puffs_fuse_node_remove(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn_targ = targ;
struct fuse *fuse;
const char *path = PNPATH(pn_targ);
@ -807,10 +801,9 @@ puffs_fuse_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
/* remove the directory */
/* ARGSUSED1 */
static int
puffs_fuse_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
puffs_fuse_node_rmdir(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn_targ = targ;
struct fuse *fuse;
const char *path = PNPATH(pn_targ);
@ -833,11 +826,10 @@ puffs_fuse_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
/* create a symbolic link */
/* ARGSUSED1 */
static int
puffs_fuse_node_symlink(struct puffs_cc *pcc, void *opc,
puffs_fuse_node_symlink(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn_src,
const struct vattr *va, const char *link_target)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct fuse *fuse;
const char *path = PCNPATH(pcn_src);
int ret;
@ -863,11 +855,10 @@ puffs_fuse_node_symlink(struct puffs_cc *pcc, void *opc,
/* rename a directory entry */
/* ARGSUSED1 */
static int
puffs_fuse_node_rename(struct puffs_cc *pcc, void *opc, void *src,
puffs_fuse_node_rename(struct puffs_usermount *pu, void *opc, void *src,
const struct puffs_cn *pcn_src, void *targ_dir, void *targ,
const struct puffs_cn *pcn_targ)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct fuse *fuse;
const char *path_src = PCNPATH(pcn_src);
const char *path_dest = PCNPATH(pcn_targ);
@ -892,10 +883,9 @@ puffs_fuse_node_rename(struct puffs_cc *pcc, void *opc, void *src,
/* create a link in the file system */
/* ARGSUSED1 */
static int
puffs_fuse_node_link(struct puffs_cc *pcc, void *opc, void *targ,
puffs_fuse_node_link(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn = targ;
struct fuse *fuse;
int ret;
@ -921,10 +911,9 @@ puffs_fuse_node_link(struct puffs_cc *pcc, void *opc, void *targ,
*/
/* ARGSUSED3 */
static int
puffs_fuse_node_setattr(struct puffs_cc *pcc, void *opc,
puffs_fuse_node_setattr(struct puffs_usermount *pu, void *opc,
const struct vattr *va, const struct puffs_cred *pcr)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn = opc;
struct fuse *fuse;
const char *path = PNPATH(pn);
@ -938,10 +927,9 @@ puffs_fuse_node_setattr(struct puffs_cc *pcc, void *opc,
/* ARGSUSED2 */
static int
puffs_fuse_node_open(struct puffs_cc *pcc, void *opc, int mode,
puffs_fuse_node_open(struct puffs_usermount *pu, void *opc, int mode,
const struct puffs_cred *cred)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn = opc;
struct refusenode *rn = pn->pn_data;
struct fuse_file_info *fi = &rn->file_info;
@ -977,10 +965,9 @@ puffs_fuse_node_open(struct puffs_cc *pcc, void *opc, int mode,
/* ARGSUSED2 */
static int
puffs_fuse_node_close(struct puffs_cc *pcc, void *opc, int fflag,
puffs_fuse_node_close(struct puffs_usermount *pu, void *opc, int fflag,
const struct puffs_cred *pcr)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn = opc;
struct refusenode *rn = pn->pn_data;
struct fuse *fuse;
@ -1012,11 +999,10 @@ puffs_fuse_node_close(struct puffs_cc *pcc, void *opc, int fflag,
/* read some more from the file */
/* ARGSUSED5 */
static int
puffs_fuse_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
puffs_fuse_node_read(struct puffs_usermount *pu, void *opc, uint8_t *buf,
off_t offset, size_t *resid, const struct puffs_cred *pcr,
int ioflag)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn = opc;
struct refusenode *rn = pn->pn_data;
struct fuse *fuse;
@ -1053,11 +1039,10 @@ puffs_fuse_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
/* write to the file */
/* ARGSUSED0 */
static int
puffs_fuse_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
puffs_fuse_node_write(struct puffs_usermount *pu, void *opc, uint8_t *buf,
off_t offset, size_t *resid, const struct puffs_cred *pcr,
int ioflag)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn = opc;
struct refusenode *rn = pn->pn_data;
struct fuse *fuse;
@ -1090,11 +1075,11 @@ puffs_fuse_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
/* ARGSUSED3 */
static int
puffs_fuse_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
off_t *readoff, size_t *reslen, const struct puffs_cred *pcr,
int *eofflag, off_t *cookies, size_t *ncookies)
puffs_fuse_node_readdir(struct puffs_usermount *pu, void *opc,
struct dirent *dent, off_t *readoff, size_t *reslen,
const struct puffs_cred *pcr, int *eofflag,
off_t *cookies, size_t *ncookies)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn = opc;
struct refusenode *rn = pn->pn_data;
struct puffs_fuse_dirh *dirh;
@ -1153,7 +1138,7 @@ puffs_fuse_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
/* ARGSUSED */
static int
puffs_fuse_node_reclaim(struct puffs_cc *pcc, void *opc)
puffs_fuse_node_reclaim(struct puffs_usermount *pu, void *opc)
{
struct puffs_node *pn = opc;
@ -1163,9 +1148,8 @@ puffs_fuse_node_reclaim(struct puffs_cc *pcc, void *opc)
/* ARGSUSED1 */
static int
puffs_fuse_fs_unmount(struct puffs_cc *pcc, int flags)
puffs_fuse_fs_unmount(struct puffs_usermount *pu, int flags)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct fuse *fuse;
fuse = puffs_getspecific(pu);
@ -1178,7 +1162,7 @@ puffs_fuse_fs_unmount(struct puffs_cc *pcc, int flags)
/* ARGSUSED0 */
static int
puffs_fuse_fs_sync(struct puffs_cc *pcc, int flags,
puffs_fuse_fs_sync(struct puffs_usermount *pu, int flags,
const struct puffs_cred *cr)
{
set_fuse_context_uid_gid(cr);
@ -1187,9 +1171,8 @@ puffs_fuse_fs_sync(struct puffs_cc *pcc, int flags,
/* ARGSUSED2 */
static int
puffs_fuse_fs_statvfs(struct puffs_cc *pcc, struct statvfs *svfsb)
puffs_fuse_fs_statvfs(struct puffs_usermount *pu, struct statvfs *svfsb)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct fuse *fuse;
int ret;
@ -1331,6 +1314,7 @@ fuse_new(struct fuse_chan *fc, struct fuse_args *args,
pu = puffs_init(pops, _PATH_PUFFS, name, fuse,
PUFFS_FLAG_BUILDPATH
| PUFFS_FLAG_HASHPATH
| PUFFS_FLAG_OPDUMP
| PUFFS_KFLAG_NOCACHE);
if (pu == NULL) {
err(EXIT_FAILURE, "puffs_init");

View File

@ -1,4 +1,4 @@
/* $NetBSD: dtfs_vfsops.c,v 1.22 2007/11/27 11:31:22 pooka Exp $ */
/* $NetBSD: dtfs_vfsops.c,v 1.23 2007/11/30 19:02:37 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -191,15 +191,13 @@ dtfs_domount(struct puffs_usermount *pu, const char *typestr)
#define ROUND(a,b) (((a) + ((b)-1)) & ~((b)-1))
#define NFILES 1024*1024
int
dtfs_fs_statvfs(struct puffs_cc *pcc, struct statvfs *sbp)
dtfs_fs_statvfs(struct puffs_usermount *pu, struct statvfs *sbp)
{
struct puffs_usermount *pu;
struct rlimit rlim;
struct dtfs_mount *dtm;
off_t btot, bfree;
int pgsize;
pu = puffs_cc_getusermount(pcc);
dtm = puffs_getspecific(pu);
pgsize = getpagesize();
memset(sbp, 0, sizeof(struct statvfs));
@ -239,10 +237,9 @@ addrcmp(struct puffs_usermount *pu, struct puffs_node *pn, void *arg)
}
int
dtfs_fs_fhtonode(struct puffs_cc *pcc, void *fid, size_t fidsize,
dtfs_fs_fhtonode(struct puffs_usermount *pu, void *fid, size_t fidsize,
struct puffs_newinfo *pni)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct dtfs_fid *dfid;
struct puffs_node *pn;
@ -266,7 +263,7 @@ dtfs_fs_fhtonode(struct puffs_cc *pcc, void *fid, size_t fidsize,
}
int
dtfs_fs_nodetofh(struct puffs_cc *pcc, void *cookie,
dtfs_fs_nodetofh(struct puffs_usermount *pu, void *cookie,
void *fid, size_t *fidsize)
{
struct puffs_node *pn = cookie;
@ -293,7 +290,7 @@ dtfs_fs_nodetofh(struct puffs_cc *pcc, void *cookie,
}
void
dtfs_fs_suspend(struct puffs_cc *pcc, int status)
dtfs_fs_suspend(struct puffs_usermount *pu, int status)
{
printf("suspend status %d\n", status);
@ -302,7 +299,7 @@ dtfs_fs_suspend(struct puffs_cc *pcc, int status)
}
int
dtfs_fs_unmount(struct puffs_cc *pcc, int flags)
dtfs_fs_unmount(struct puffs_usermount *pu, int flags)
{
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: dtfs_vnops.c,v 1.40 2007/11/27 11:31:22 pooka Exp $ */
/* $NetBSD: dtfs_vnops.c,v 1.41 2007/11/30 19:02:37 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -40,8 +40,8 @@
#include "dtfs.h"
int
dtfs_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn)
dtfs_node_lookup(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn)
{
struct puffs_node *pn_dir = opc;
struct dtfs_file *df = DTFS_CTOF(opc);
@ -66,8 +66,7 @@ dtfs_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
puffs_newinfo_setrdev(pni, dfd->dfd_node->pn_va.va_rdev);
if (straightflush)
puffs_flush_pagecache_node(puffs_cc_getusermount(pcc),
dfd->dfd_node);
puffs_flush_pagecache_node(pu, dfd->dfd_node);
return 0;
}
@ -86,7 +85,7 @@ dtfs_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
dtfs_node_access(struct puffs_cc *pcc, void *opc, int acc_mode,
dtfs_node_access(struct puffs_usermount *pu, void *opc, int acc_mode,
const struct puffs_cred *pcr)
{
struct puffs_node *pn = opc;
@ -96,7 +95,7 @@ dtfs_node_access(struct puffs_cc *pcc, void *opc, int acc_mode,
}
int
dtfs_node_getattr(struct puffs_cc *pcc, void *opc,
dtfs_node_getattr(struct puffs_usermount *pu, void *opc,
struct vattr *va, const struct puffs_cred *pcr)
{
struct puffs_node *pn = opc;
@ -107,7 +106,7 @@ dtfs_node_getattr(struct puffs_cc *pcc, void *opc,
}
int
dtfs_node_setattr(struct puffs_cc *pcc, void *opc,
dtfs_node_setattr(struct puffs_usermount *pu, void *opc,
const struct vattr *va, const struct puffs_cred *pcr)
{
struct puffs_node *pn = opc;
@ -165,8 +164,9 @@ dtfs_node_setattr(struct puffs_cc *pcc, void *opc,
/* create a new node in the parent directory specified by opc */
int
dtfs_node_create(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn, const struct vattr *va)
dtfs_node_create(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn,
const struct vattr *va)
{
struct puffs_node *pn_parent = opc;
struct puffs_node *pn_new;
@ -183,7 +183,7 @@ dtfs_node_create(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
dtfs_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
dtfs_node_remove(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_node *pn_parent = opc;
@ -195,14 +195,15 @@ dtfs_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
dtfs_nukenode(targ, pn_parent, pcn->pcn_name, pcn->pcn_namelen);
if (pn->pn_va.va_nlink == 0)
puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2);
puffs_setback(puffs_cc_getcc(pu), PUFFS_SETBACK_NOREF_N2);
return 0;
}
int
dtfs_node_mkdir(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn, const struct vattr *va)
dtfs_node_mkdir(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn,
const struct vattr *va)
{
struct puffs_node *pn_parent = opc;
struct puffs_node *pn_new;
@ -216,7 +217,7 @@ dtfs_node_mkdir(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
dtfs_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
dtfs_node_rmdir(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_node *pn_parent = opc;
@ -226,13 +227,13 @@ dtfs_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
return ENOTEMPTY;
dtfs_nukenode(targ, pn_parent, pcn->pcn_name, pcn->pcn_namelen);
puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2);
puffs_setback(puffs_cc_getcc(pu), PUFFS_SETBACK_NOREF_N2);
return 0;
}
int
dtfs_node_readdir(struct puffs_cc *pcc, void *opc,
dtfs_node_readdir(struct puffs_usermount *pu, void *opc,
struct dirent *dent, off_t *readoff, size_t *reslen,
const struct puffs_cred *pcr,
int *eofflag, off_t *cookies, size_t *ncookies)
@ -277,9 +278,9 @@ dtfs_node_readdir(struct puffs_cc *pcc, void *opc,
}
int
dtfs_node_poll(struct puffs_cc *pcc, void *opc, int *events)
dtfs_node_poll(struct puffs_usermount *pu, void *opc, int *events)
{
struct dtfs_mount *dtm = puffs_cc_getspecific(pcc);
struct dtfs_mount *dtm = puffs_getspecific(pu);
struct dtfs_poll dp;
struct itimerval it;
@ -288,19 +289,19 @@ dtfs_node_poll(struct puffs_cc *pcc, void *opc, int *events)
if (setitimer(ITIMER_REAL, &it, NULL) == -1)
return errno;
dp.dp_pcc = pcc;
dp.dp_pcc = puffs_cc_getcc(pu);
LIST_INSERT_HEAD(&dtm->dtm_pollent, &dp, dp_entries);
puffs_cc_yield(pcc);
puffs_cc_yield(dp.dp_pcc);
*events = *events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM);
return 0;
}
int
dtfs_node_mmap(struct puffs_cc *pcc, void *opc, vm_prot_t prot,
dtfs_node_mmap(struct puffs_usermount *pu, void *opc, vm_prot_t prot,
const struct puffs_cred *pcr)
{
struct dtfs_mount *dtm = puffs_cc_getspecific(pcc);
struct dtfs_mount *dtm = puffs_getspecific(pu);
if ((dtm->dtm_allowprot & prot) != prot)
return EACCES;
@ -309,7 +310,7 @@ dtfs_node_mmap(struct puffs_cc *pcc, void *opc, vm_prot_t prot,
}
int
dtfs_node_rename(struct puffs_cc *pcc, void *opc, void *src,
dtfs_node_rename(struct puffs_usermount *pu, void *opc, void *src,
const struct puffs_cn *pcn_src, void *targ_dir, void *targ,
const struct puffs_cn *pcn_targ)
{
@ -350,7 +351,7 @@ dtfs_node_rename(struct puffs_cc *pcc, void *opc, void *src,
}
int
dtfs_node_link(struct puffs_cc *pcc, void *opc, void *targ,
dtfs_node_link(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_node *pn_dir = opc;
@ -368,9 +369,9 @@ dtfs_node_link(struct puffs_cc *pcc, void *opc, void *targ,
}
int
dtfs_node_symlink(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn_src, const struct vattr *va,
const char *link_target)
dtfs_node_symlink(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn_src,
const struct vattr *va, const char *link_target)
{
struct puffs_node *pn_parent = opc;
struct puffs_node *pn_new;
@ -391,7 +392,7 @@ dtfs_node_symlink(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
dtfs_node_readlink(struct puffs_cc *pcc, void *opc,
dtfs_node_readlink(struct puffs_usermount *pu, void *opc,
const struct puffs_cred *cred, char *linkname, size_t *linklen)
{
struct dtfs_file *df = DTFS_CTOF(opc);
@ -405,8 +406,9 @@ dtfs_node_readlink(struct puffs_cc *pcc, void *opc,
}
int
dtfs_node_mknod(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn, const struct vattr *va)
dtfs_node_mknod(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn,
const struct vattr *va)
{
struct puffs_node *pn_parent = opc;
struct puffs_node *pn_new;
@ -432,7 +434,7 @@ dtfs_node_mknod(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
* Read operation, used both for VOP_READ and VOP_GETPAGES
*/
int
dtfs_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
dtfs_node_read(struct puffs_usermount *pu, void *opc, uint8_t *buf,
off_t offset, size_t *resid, const struct puffs_cred *pcr, int ioflag)
{
struct puffs_node *pn = opc;
@ -470,7 +472,7 @@ dtfs_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
* write operation on the wing
*/
int
dtfs_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
dtfs_node_write(struct puffs_usermount *pu, void *opc, uint8_t *buf,
off_t offset, size_t *resid, const struct puffs_cred *pcr, int ioflag)
{
struct puffs_node *pn = opc;
@ -506,7 +508,7 @@ dtfs_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
}
int
dtfs_node_reclaim(struct puffs_cc *pcc, void *opc)
dtfs_node_reclaim(struct puffs_usermount *pu, void *opc)
{
struct puffs_node *pn = opc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: icfs.c,v 1.8 2007/11/16 18:39:01 pooka Exp $ */
/* $NetBSD: icfs.c,v 1.9 2007/11/30 19:02:37 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -225,7 +225,7 @@ main(int argc, char *argv[])
}
int
ic_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
ic_node_readdir(struct puffs_usermount *pu, void *opc, struct dirent *dent,
off_t *readoff, size_t *reslen, const struct puffs_cred *pcr,
int *eofflag, off_t *cookies, size_t *ncookies)
{
@ -236,7 +236,7 @@ ic_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
dp = dent;
rl = *reslen;
rv = puffs_null_node_readdir(pcc, opc, dent, readoff, reslen, pcr,
rv = puffs_null_node_readdir(pu, opc, dent, readoff, reslen, pcr,
eofflag, cookies, ncookies);
if (rv)
return rv;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rot13fs.c,v 1.15 2007/11/16 18:39:02 pooka Exp $ */
/* $NetBSD: rot13fs.c,v 1.16 2007/11/30 19:02:38 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -189,7 +189,7 @@ main(int argc, char *argv[])
}
int
rot13_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
rot13_node_readdir(struct puffs_usermount *pu, void *opc, struct dirent *dent,
off_t *readoff, size_t *reslen, const struct puffs_cred *pcr,
int *eofflag, off_t *cookies, size_t *ncookies)
{
@ -200,7 +200,7 @@ rot13_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
dp = dent;
rl = *reslen;
rv = puffs_null_node_readdir(pcc, opc, dent, readoff, reslen, pcr,
rv = puffs_null_node_readdir(pu, opc, dent, readoff, reslen, pcr,
eofflag, cookies, ncookies);
if (rv)
return rv;
@ -215,14 +215,15 @@ rot13_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
}
int
rot13_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf, off_t offset,
size_t *resid, const struct puffs_cred *pcr, int ioflag)
rot13_node_read(struct puffs_usermount *pu, void *opc,
uint8_t *buf, off_t offset, size_t *resid,
const struct puffs_cred *pcr, int ioflag)
{
uint8_t *prebuf = buf;
size_t preres = *resid;
int rv;
rv = puffs_null_node_read(pcc, opc, buf, offset, resid, pcr, ioflag);
rv = puffs_null_node_read(pu, opc, buf, offset, resid, pcr, ioflag);
if (rv)
return rv;
@ -232,10 +233,11 @@ rot13_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf, off_t offset,
}
int
rot13_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf, off_t offset,
size_t *resid, const struct puffs_cred *pcr, int ioflag)
rot13_node_write(struct puffs_usermount *pu, void *opc,
uint8_t *buf, off_t offset, size_t *resid,
const struct puffs_cred *pcr, int ioflag)
{
flipflop(buf, *resid);
return puffs_null_node_write(pcc, opc, buf, offset, resid, pcr, ioflag);
return puffs_null_node_write(pu, opc, buf, offset, resid, pcr, ioflag);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: p2k.c,v 1.30 2007/11/27 11:31:22 pooka Exp $ */
/* $NetBSD: p2k.c,v 1.31 2007/11/30 19:02:31 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -89,17 +89,17 @@ freecn(struct componentname *cnp, int flags)
}
static void
makelwp(struct puffs_cc *pcc)
makelwp(struct puffs_usermount *pu)
{
pid_t pid;
lwpid_t lid;
puffs_cc_getcaller(pcc, &pid, &lid);
puffs_cc_getcaller(puffs_cc_getcc(pu), &pid, &lid);
rump_setup_curlwp(pid, lid, 1);
}
static void
clearlwp(struct puffs_cc *pcc)
clearlwp(struct puffs_usermount *pu)
{
rump_clear_curlwp();
@ -189,25 +189,25 @@ p2k_run_fs(const char *vfsname, const char *devpath, const char *mountpath,
}
int
p2k_fs_statvfs(struct puffs_cc *pcc, struct statvfs *sbp)
p2k_fs_statvfs(struct puffs_usermount *pu, struct statvfs *sbp)
{
struct mount *mp = puffs_cc_getspecific(pcc);
struct mount *mp = puffs_getspecific(pu);
return VFS_STATVFS(mp, sbp);
}
int
p2k_fs_unmount(struct puffs_cc *pcc, int flags)
p2k_fs_unmount(struct puffs_usermount *pu, int flags)
{
struct mount *mp = puffs_cc_getspecific(pcc);
struct mount *mp = puffs_getspecific(pu);
return VFS_UNMOUNT(mp, flags);
}
int
p2k_fs_sync(struct puffs_cc *pcc, int waitfor, const struct puffs_cred *pcr)
p2k_fs_sync(struct puffs_usermount *pu, int waitfor, const struct puffs_cred *pcr)
{
struct mount *mp = puffs_cc_getspecific(pcc);
struct mount *mp = puffs_getspecific(pu);
kauth_cred_t cred;
int rv;
@ -221,10 +221,10 @@ p2k_fs_sync(struct puffs_cc *pcc, int waitfor, const struct puffs_cred *pcr)
}
int
p2k_fs_fhtonode(struct puffs_cc *pcc, void *fid, size_t fidsize,
p2k_fs_fhtonode(struct puffs_usermount *pu, void *fid, size_t fidsize,
struct puffs_newinfo *pni)
{
struct mount *mp = puffs_cc_getspecific(pcc);
struct mount *mp = puffs_getspecific(pu);
struct vnode *vp;
enum vtype vtype;
voff_t vsize;
@ -245,7 +245,7 @@ p2k_fs_fhtonode(struct puffs_cc *pcc, void *fid, size_t fidsize,
}
int
p2k_fs_nodetofh(struct puffs_cc *pcc, void *cookie, void *fid, size_t *fidsize)
p2k_fs_nodetofh(struct puffs_usermount *pu, void *cookie, void *fid, size_t *fidsize)
{
struct vnode *vp = cookie;
@ -259,7 +259,7 @@ p2k_fs_nodetofh(struct puffs_cc *pcc, void *cookie, void *fid, size_t *fidsize)
#define AUL(a) assert(RUMP_VOP_ISLOCKED(a) == 0)
int
p2k_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
p2k_node_lookup(struct puffs_usermount *pu, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn)
{
struct componentname *cn;
@ -291,7 +291,7 @@ p2k_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
p2k_node_create(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
p2k_node_create(struct puffs_usermount *pu, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn, const struct vattr *vap)
{
struct componentname *cn;
@ -312,7 +312,7 @@ p2k_node_create(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
p2k_node_mknod(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
p2k_node_mknod(struct puffs_usermount *pu, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn, const struct vattr *vap)
{
struct componentname *cn;
@ -333,7 +333,7 @@ p2k_node_mknod(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
p2k_node_open(struct puffs_cc *pcc, void *opc, int mode,
p2k_node_open(struct puffs_usermount *pu, void *opc, int mode,
const struct puffs_cred *pcr)
{
kauth_cred_t cred;
@ -349,7 +349,7 @@ p2k_node_open(struct puffs_cc *pcc, void *opc, int mode,
}
int
p2k_node_close(struct puffs_cc *pcc, void *opc, int flags,
p2k_node_close(struct puffs_usermount *pu, void *opc, int flags,
const struct puffs_cred *pcr)
{
kauth_cred_t cred;
@ -365,7 +365,7 @@ p2k_node_close(struct puffs_cc *pcc, void *opc, int flags,
}
int
p2k_node_access(struct puffs_cc *pcc, void *opc, int mode,
p2k_node_access(struct puffs_usermount *pu, void *opc, int mode,
const struct puffs_cred *pcr)
{
kauth_cred_t cred;
@ -381,7 +381,7 @@ p2k_node_access(struct puffs_cc *pcc, void *opc, int mode,
}
int
p2k_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *vap,
p2k_node_getattr(struct puffs_usermount *pu, void *opc, struct vattr *vap,
const struct puffs_cred *pcr)
{
kauth_cred_t cred;
@ -397,7 +397,7 @@ p2k_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *vap,
}
int
p2k_node_setattr(struct puffs_cc *pcc, void *opc, const struct vattr *vap,
p2k_node_setattr(struct puffs_usermount *pu, void *opc, const struct vattr *vap,
const struct puffs_cred *pcr)
{
kauth_cred_t cred;
@ -413,7 +413,7 @@ p2k_node_setattr(struct puffs_cc *pcc, void *opc, const struct vattr *vap,
}
int
p2k_node_fsync(struct puffs_cc *pcc, void *opc, const struct puffs_cred *pcr,
p2k_node_fsync(struct puffs_usermount *pu, void *opc, const struct puffs_cred *pcr,
int flags, off_t offlo, off_t offhi)
{
kauth_cred_t cred;
@ -429,7 +429,7 @@ p2k_node_fsync(struct puffs_cc *pcc, void *opc, const struct puffs_cred *pcr,
}
int
p2k_node_seek(struct puffs_cc *pcc, void *opc, off_t oldoff, off_t newoff,
p2k_node_seek(struct puffs_usermount *pu, void *opc, off_t oldoff, off_t newoff,
const struct puffs_cred *pcr)
{
kauth_cred_t cred;
@ -445,7 +445,7 @@ p2k_node_seek(struct puffs_cc *pcc, void *opc, off_t oldoff, off_t newoff,
}
int
p2k_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
p2k_node_remove(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct componentname *cn;
@ -463,7 +463,7 @@ p2k_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
}
int
p2k_node_link(struct puffs_cc *pcc, void *opc, void *targ,
p2k_node_link(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct componentname *cn;
@ -478,7 +478,7 @@ p2k_node_link(struct puffs_cc *pcc, void *opc, void *targ,
}
int
p2k_node_rename(struct puffs_cc *pcc, void *src_dir, void *src,
p2k_node_rename(struct puffs_usermount *pu, void *src_dir, void *src,
const struct puffs_cn *pcn_src, void *targ_dir, void *targ,
const struct puffs_cn *pcn_targ)
{
@ -501,7 +501,7 @@ p2k_node_rename(struct puffs_cc *pcc, void *src_dir, void *src,
}
int
p2k_node_mkdir(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
p2k_node_mkdir(struct puffs_usermount *pu, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn, const struct vattr *vap)
{
struct componentname *cn;
@ -522,7 +522,7 @@ p2k_node_mkdir(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
p2k_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
p2k_node_rmdir(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct componentname *cn;
@ -540,9 +540,9 @@ p2k_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
}
int
p2k_node_symlink(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn_src, const struct vattr *vap,
const char *link_target)
p2k_node_symlink(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn_src,
const struct vattr *vap, const char *link_target)
{
struct componentname *cn;
struct vnode *vp;
@ -563,7 +563,7 @@ p2k_node_symlink(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
p2k_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
p2k_node_readdir(struct puffs_usermount *pu, void *opc, struct dirent *dent,
off_t *readoff, size_t *reslen, const struct puffs_cred *pcr,
int *eofflag, off_t *cookies, size_t *ncookies)
{
@ -597,7 +597,7 @@ p2k_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
}
int
p2k_node_readlink(struct puffs_cc *pcc, void *opc,
p2k_node_readlink(struct puffs_usermount *pu, void *opc,
const struct puffs_cred *pcr, char *linkname, size_t *linklen)
{
kauth_cred_t cred;
@ -616,8 +616,9 @@ p2k_node_readlink(struct puffs_cc *pcc, void *opc,
}
int
p2k_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf, off_t offset,
size_t *resid, const struct puffs_cred *pcr, int ioflag)
p2k_node_read(struct puffs_usermount *pu, void *opc,
uint8_t *buf, off_t offset, size_t *resid,
const struct puffs_cred *pcr, int ioflag)
{
kauth_cred_t cred;
struct uio *uio;
@ -635,8 +636,9 @@ p2k_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf, off_t offset,
}
int
p2k_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf, off_t offset,
size_t *resid, const struct puffs_cred *pcr, int ioflag)
p2k_node_write(struct puffs_usermount *pu, void *opc,
uint8_t *buf, off_t offset, size_t *resid,
const struct puffs_cred *pcr, int ioflag)
{
kauth_cred_t cred;
struct uio *uio;
@ -654,7 +656,7 @@ p2k_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf, off_t offset,
}
int
p2k_node_reclaim(struct puffs_cc *pcc, void *opc)
p2k_node_reclaim(struct puffs_usermount *pu, void *opc)
{
rump_recyclenode(opc);
@ -664,7 +666,7 @@ p2k_node_reclaim(struct puffs_cc *pcc, void *opc)
}
int
p2k_node_inactive(struct puffs_cc *pcc, void *opc)
p2k_node_inactive(struct puffs_usermount *pu, void *opc)
{
struct vnode *vp = opc;
int rv;
@ -673,7 +675,7 @@ p2k_node_inactive(struct puffs_cc *pcc, void *opc)
VLE(vp);
rv = RUMP_VOP_INACTIVE(vp);
if (vp->v_usecount == 0)
puffs_setback(pcc, PUFFS_SETBACK_NOREF_N1);
puffs_setback(puffs_cc_getcc(pu), PUFFS_SETBACK_NOREF_N1);
return rv;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: fs.c,v 1.6 2007/11/27 11:31:20 pooka Exp $ */
/* $NetBSD: fs.c,v 1.7 2007/11/30 19:02:38 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fs.c,v 1.6 2007/11/27 11:31:20 pooka Exp $");
__RCSID("$NetBSD: fs.c,v 1.7 2007/11/30 19:02:38 pooka Exp $");
#endif /* !lint */
#include <assert.h>
@ -227,9 +227,8 @@ p9p_handshake(struct puffs_usermount *pu,
}
int
puffs9p_fs_unmount(struct puffs_cc *pcc, int flags)
puffs9p_fs_unmount(struct puffs_usermount *pu, int flags)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs9p *p9p = puffs_getspecific(pu);
close(p9p->servsock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nineproto.c,v 1.8 2007/07/07 21:14:28 pooka Exp $ */
/* $NetBSD: nineproto.c,v 1.9 2007/11/30 19:02:38 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.8 2007/07/07 21:14:28 pooka Exp $");
__RCSID("$NetBSD: nineproto.c,v 1.9 2007/11/30 19:02:38 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -181,9 +181,10 @@ proto_getstat(struct puffs_framebuf *pb, struct vattr *vap,
}
int
proto_cc_dupfid(struct puffs_cc *pcc, p9pfid_t oldfid, p9pfid_t newfid)
proto_cc_dupfid(struct puffs_usermount *pu, p9pfid_t oldfid, p9pfid_t newfid)
{
struct puffs9p *p9p = puffs_cc_getspecific(pcc);
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct puffs9p *p9p = puffs_getspecific(pu);
struct puffs_framebuf *pb;
p9ptag_t tag = NEXTTAG(p9p);
uint16_t qids;
@ -207,10 +208,10 @@ 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)
proto_cc_clunkfid(struct puffs_usermount *pu, p9pfid_t fid, int waitforit)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs9p *p9p = puffs_cc_getspecific(pcc);
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct puffs9p *p9p = puffs_getspecific(pu);
struct puffs_framebuf *pb;
p9ptag_t tag = NEXTTAG(p9p);
int rv = 0;
@ -240,14 +241,16 @@ proto_cc_clunkfid(struct puffs_cc *pcc, p9pfid_t fid, int waitforit)
* walk a new fid, then open it
*/
int
proto_cc_open(struct puffs_cc *pcc, p9pfid_t fid, p9pfid_t newfid, int mode)
proto_cc_open(struct puffs_usermount *pu, p9pfid_t fid,
p9pfid_t newfid, int mode)
{
struct puffs9p *p9p = puffs_cc_getspecific(pcc);
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct puffs9p *p9p = puffs_getspecific(pu);
struct puffs_framebuf *pb;
p9ptag_t tag = NEXTTAG(p9p);
int rv;
rv = proto_cc_dupfid(pcc, fid, newfid);
rv = proto_cc_dupfid(pu, fid, newfid);
if (rv)
return rv;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ninepuffs.h,v 1.11 2007/09/06 16:09:10 pooka Exp $ */
/* $NetBSD: ninepuffs.h,v 1.12 2007/11/30 19:02:38 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -61,8 +61,9 @@ typedef uint32_t p9pfid_t;
#define NEXTFID(p9p) \
((++(p9p->nextfid)) == P9P_INVALFID ? p9p->nextfid = 2 : p9p->nextfid)
#define AUTOVAR(pcc) \
struct puffs9p *p9p = puffs_cc_getspecific(pcc); \
#define AUTOVAR(pu) \
struct puffs_cc *pcc = puffs_cc_getcc(pu); \
struct puffs9p *p9p = puffs_getspecific(pu); \
uint16_t tag = NEXTTAG(p9p); \
struct puffs_framebuf *pb = p9pbuf_makeout(); \
int rv = 0
@ -152,9 +153,9 @@ int proto_expect_walk_nqids(struct puffs_framebuf *, uint16_t *);
int proto_expect_stat(struct puffs_framebuf *, struct vattr *);
int proto_expect_qid(struct puffs_framebuf *, uint8_t, struct qid9p *);
int proto_cc_dupfid(struct puffs_cc *, p9pfid_t, p9pfid_t);
int proto_cc_clunkfid(struct puffs_cc *, p9pfid_t, int);
int proto_cc_open(struct puffs_cc *, p9pfid_t, p9pfid_t, int);
int proto_cc_dupfid(struct puffs_usermount *, p9pfid_t, p9pfid_t);
int proto_cc_clunkfid(struct puffs_usermount *, p9pfid_t, int);
int proto_cc_open(struct puffs_usermount *, p9pfid_t, p9pfid_t, int);
void proto_make_stat(struct puffs_framebuf *, const struct vattr *,
const char *, enum vtype);
@ -168,10 +169,10 @@ struct puffs_node *newp9pnode_va(struct puffs_usermount *,
struct puffs_node *newp9pnode_qid(struct puffs_usermount *,
const struct qid9p *, p9pfid_t);
int getdfwithoffset(struct puffs_cc *, struct p9pnode *, off_t,
int getdfwithoffset(struct puffs_usermount *, struct p9pnode *, off_t,
struct dirfid **);
void storedf(struct p9pnode *, struct dirfid *);
void releasedf(struct puffs_cc *, struct dirfid *);
void nukealldf(struct puffs_cc *, struct p9pnode *);
void releasedf(struct puffs_usermount *, struct dirfid *);
void nukealldf(struct puffs_usermount *, struct p9pnode *);
#endif /* PUFFS9P_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: node.c,v 1.18 2007/11/27 11:31:20 pooka Exp $ */
/* $NetBSD: node.c,v 1.19 2007/11/30 19:02:39 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.18 2007/11/27 11:31:20 pooka Exp $");
__RCSID("$NetBSD: node.c,v 1.19 2007/11/30 19:02:39 pooka Exp $");
#endif /* !lint */
#include <assert.h>
@ -52,9 +52,9 @@ nodecmp(struct puffs_usermount *pu, struct puffs_node *pn, void *arg)
}
static int
do_getattr(struct puffs_cc *pcc, struct puffs_node *pn, struct vattr *vap)
do_getattr(struct puffs_usermount *pu, struct puffs_node *pn, struct vattr *vap)
{
AUTOVAR(pcc);
AUTOVAR(pu);
struct p9pnode *p9n = pn->pn_data;
p9pbuf_put_1(pb, P9PROTO_T_STAT);
@ -69,24 +69,23 @@ do_getattr(struct puffs_cc *pcc, struct puffs_node *pn, struct vattr *vap)
}
int
puffs9p_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *vap,
puffs9p_node_getattr(struct puffs_usermount *pu, void *opc, struct vattr *vap,
const struct puffs_cred *pcr)
{
struct puffs_node *pn = opc;
int rv;
rv = do_getattr(pcc, pn, &pn->pn_va);
rv = do_getattr(pu, pn, &pn->pn_va);
if (rv == 0)
memcpy(vap, &pn->pn_va, sizeof(struct vattr));
return rv;
}
int
puffs9p_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
puffs9p_node_lookup(struct puffs_usermount *pu, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn)
{
AUTOVAR(pcc);
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
AUTOVAR(pu);
struct puffs_node *pn, *pn_dir = opc;
struct p9pnode *p9n_dir = pn_dir->pn_data;
p9ptag_t tfid = NEXTFID(p9p);
@ -117,9 +116,9 @@ puffs9p_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
if (pn == NULL)
pn = newp9pnode_qid(pu, &newqid, tfid);
else
proto_cc_clunkfid(pcc, tfid, 0);
proto_cc_clunkfid(pu, tfid, 0);
rv = do_getattr(pcc, pn, &pn->pn_va);
rv = do_getattr(pu, pn, &pn->pn_va);
if (rv) {
/* XXX */
free(pn->pn_data);
@ -143,11 +142,11 @@ puffs9p_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
* is closed or until they reach the end.
*/
int
puffs9p_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
puffs9p_node_readdir(struct puffs_usermount *pu, void *opc, struct dirent *dent,
off_t *readoff, size_t *reslen, const struct puffs_cred *pcr,
int *eofflag, off_t *cookies, size_t *ncookies)
{
AUTOVAR(pcc);
AUTOVAR(pu);
struct puffs_node *pn = opc;
struct p9pnode *p9n = pn->pn_data;
struct vattr va;
@ -156,7 +155,7 @@ puffs9p_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
uint32_t count;
uint16_t statsize;
rv = getdfwithoffset(pcc, p9n, *readoff, &dfp);
rv = getdfwithoffset(pu, p9n, *readoff, &dfp);
if (rv)
goto out;
@ -176,7 +175,7 @@ puffs9p_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
*/
if (count == 0) {
*eofflag = 1;
releasedf(pcc, dfp);
releasedf(pu, dfp);
goto out;
}
@ -188,7 +187,7 @@ puffs9p_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
* come back for some strange reason, we'll just
* regen it.
*/
releasedf(pcc, dfp);
releasedf(pu, dfp);
goto out;
}
@ -208,10 +207,10 @@ puffs9p_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
}
int
puffs9p_node_setattr(struct puffs_cc *pcc, void *opc,
puffs9p_node_setattr(struct puffs_usermount *pu, void *opc,
const struct vattr *va, const struct puffs_cred *pcr)
{
AUTOVAR(pcc);
AUTOVAR(pu);
struct puffs_node *pn = opc;
struct p9pnode *p9n = pn->pn_data;
@ -241,10 +240,11 @@ puffs9p_node_setattr(struct puffs_cc *pcc, void *opc,
* about permission control.
*/
int
puffs9p_node_open(struct puffs_cc *pcc, void *opc, int mode,
puffs9p_node_open(struct puffs_usermount *pu, void *opc, int mode,
const struct puffs_cred *pcr)
{
struct puffs9p *p9p = puffs_cc_getspecific(pcc);
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct puffs9p *p9p = puffs_getspecific(pu);
struct puffs_node *pn = opc;
struct p9pnode *p9n = pn->pn_data;
p9pfid_t nfid;
@ -254,7 +254,7 @@ puffs9p_node_open(struct puffs_cc *pcc, void *opc, int mode,
if (pn->pn_va.va_type != VDIR) {
if (mode & FREAD && p9n->fid_read == P9P_INVALFID) {
nfid = NEXTFID(p9p);
error = proto_cc_open(pcc, p9n->fid_base, nfid,
error = proto_cc_open(pu, p9n->fid_base, nfid,
P9PROTO_OMODE_READ);
if (error)
return error;
@ -262,7 +262,7 @@ puffs9p_node_open(struct puffs_cc *pcc, void *opc, int mode,
}
if (mode & FWRITE && p9n->fid_write == P9P_INVALFID) {
nfid = NEXTFID(p9p);
error = proto_cc_open(pcc, p9n->fid_base, nfid,
error = proto_cc_open(pu, p9n->fid_base, nfid,
P9PROTO_OMODE_WRITE);
if (error)
return error;
@ -274,20 +274,20 @@ puffs9p_node_open(struct puffs_cc *pcc, void *opc, int mode,
}
int
puffs9p_node_inactive(struct puffs_cc *pcc, void *opc)
puffs9p_node_inactive(struct puffs_usermount *pu, void *opc)
{
struct puffs_node *pn = opc;
struct p9pnode *p9n = pn->pn_data;
if (pn->pn_va.va_type == VDIR) {
nukealldf(pcc, p9n);
nukealldf(pu, p9n);
} else {
if (p9n->fid_read != P9P_INVALFID) {
proto_cc_clunkfid(pcc, p9n->fid_read, 0);
proto_cc_clunkfid(pu, p9n->fid_read, 0);
p9n->fid_read = P9P_INVALFID;
}
if (p9n->fid_write != P9P_INVALFID) {
proto_cc_clunkfid(pcc, p9n->fid_write, 0);
proto_cc_clunkfid(pu, p9n->fid_write, 0);
p9n->fid_write = P9P_INVALFID;
}
}
@ -296,11 +296,11 @@ puffs9p_node_inactive(struct puffs_cc *pcc, void *opc)
}
int
puffs9p_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
puffs9p_node_read(struct puffs_usermount *pu, void *opc, uint8_t *buf,
off_t offset, size_t *resid, const struct puffs_cred *pcr,
int ioflag)
{
AUTOVAR(pcc);
AUTOVAR(pu);
struct puffs_node *pn = opc;
struct p9pnode *p9n = pn->pn_data;
uint32_t count;
@ -335,11 +335,11 @@ puffs9p_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
}
int
puffs9p_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
puffs9p_node_write(struct puffs_usermount *pu, void *opc, uint8_t *buf,
off_t offset, size_t *resid, const struct puffs_cred *cred,
int ioflag)
{
AUTOVAR(pcc);
AUTOVAR(pu);
struct puffs_node *pn = opc;
struct p9pnode *p9n = pn->pn_data;
uint32_t chunk, count;
@ -382,12 +382,11 @@ puffs9p_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
}
static int
nodecreate(struct puffs_cc *pcc, struct puffs_node *pn,
nodecreate(struct puffs_usermount *pu, struct puffs_node *pn,
struct puffs_newinfo *pni, const char *name,
const struct vattr *vap, uint32_t dirbit)
{
AUTOVAR(pcc);
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
AUTOVAR(pu);
struct puffs_node *pn_new;
struct p9pnode *p9n = pn->pn_data;
p9pfid_t nfid = NEXTFID(p9p);
@ -400,7 +399,7 @@ nodecreate(struct puffs_cc *pcc, struct puffs_node *pn,
goto out;
}
rv = proto_cc_dupfid(pcc, p9n->fid_base, nfid);
rv = proto_cc_dupfid(pu, p9n->fid_base, nfid);
if (rv)
goto out;
@ -421,7 +420,7 @@ nodecreate(struct puffs_cc *pcc, struct puffs_node *pn,
* So, clunk it and walk the parent directory to get a fid
* which is not open for I/O yet.
*/
proto_cc_clunkfid(pcc, nfid, 0);
proto_cc_clunkfid(pu, nfid, 0);
nfid = NEXTFID(p9p);
p9pbuf_recycleout(pb);
@ -449,19 +448,19 @@ nodecreate(struct puffs_cc *pcc, struct puffs_node *pn,
}
int
puffs9p_node_create(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
puffs9p_node_create(struct puffs_usermount *pu, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn, const struct vattr *va)
{
return nodecreate(pcc, opc, pni, pcn->pcn_name, va, 0);
return nodecreate(pu, opc, pni, pcn->pcn_name, va, 0);
}
int
puffs9p_node_mkdir(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
puffs9p_node_mkdir(struct puffs_usermount *pu, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn, const struct vattr *va)
{
return nodecreate(pcc, opc, pni, pcn->pcn_name,
return nodecreate(pu, opc, pni, pcn->pcn_name,
va, P9PROTO_CPERM_DIR);
}
@ -473,13 +472,13 @@ puffs9p_node_mkdir(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
* ice with.
*/
static int
noderemove(struct puffs_cc *pcc, struct puffs_node *pn)
noderemove(struct puffs_usermount *pu, struct puffs_node *pn)
{
AUTOVAR(pcc);
AUTOVAR(pu);
struct p9pnode *p9n = pn->pn_data;
p9pfid_t testfid = NEXTFID(p9p);
rv = proto_cc_dupfid(pcc, p9n->fid_base, testfid);
rv = proto_cc_dupfid(pu, p9n->fid_base, testfid);
if (rv)
goto out;
@ -496,7 +495,7 @@ noderemove(struct puffs_cc *pcc, struct puffs_node *pn)
if (p9pbuf_get_type(pb) != P9PROTO_R_REMOVE) {
rv = EPROTO;
} else {
proto_cc_clunkfid(pcc, p9n->fid_base, 0);
proto_cc_clunkfid(pu, p9n->fid_base, 0);
p9n->fid_base = P9P_INVALFID;
puffs_pn_remove(pn);
}
@ -509,7 +508,7 @@ noderemove(struct puffs_cc *pcc, struct puffs_node *pn)
}
int
puffs9p_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
puffs9p_node_remove(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_node *pn = targ;
@ -517,11 +516,11 @@ puffs9p_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
if (pn->pn_va.va_type == VDIR)
return EISDIR;
return noderemove(pcc, pn);
return noderemove(pu, pn);
}
int
puffs9p_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
puffs9p_node_rmdir(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_node *pn = targ;
@ -529,7 +528,7 @@ puffs9p_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
if (pn->pn_va.va_type != VDIR)
return ENOTDIR;
return noderemove(pcc, pn);
return noderemove(pu, pn);
}
/*
@ -538,11 +537,11 @@ puffs9p_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
* for now.
*/
int
puffs9p_node_rename(struct puffs_cc *pcc, void *opc, void *src,
puffs9p_node_rename(struct puffs_usermount *pu, void *opc, void *src,
const struct puffs_cn *pcn_src, void *targ_dir, void *targ,
const struct puffs_cn *pcn_targ)
{
AUTOVAR(pcc);
AUTOVAR(pu);
struct puffs_node *pn_src = src;
struct p9pnode *p9n_src = pn_src->pn_data;
@ -555,7 +554,7 @@ puffs9p_node_rename(struct puffs_cc *pcc, void *opc, void *src,
if (targ) {
struct puffs_node *pn_targ = targ;
rv = noderemove(pcc, pn_targ->pn_data);
rv = noderemove(pu, pn_targ->pn_data);
if (rv)
goto out;
}
@ -584,7 +583,7 @@ puffs9p_node_rename(struct puffs_cc *pcc, void *opc, void *src,
* - "thanks"
*/
int
puffs9p_node_reclaim(struct puffs_cc *pcc, void *opc)
puffs9p_node_reclaim(struct puffs_usermount *pu, void *opc)
{
struct puffs_node *pn = opc;
struct p9pnode *p9n = pn->pn_data;
@ -592,7 +591,7 @@ puffs9p_node_reclaim(struct puffs_cc *pcc, void *opc)
assert(LIST_EMPTY(&p9n->dir_openlist));
assert(p9n->fid_read == P9P_INVALFID && p9n->fid_write == P9P_INVALFID);
proto_cc_clunkfid(pcc, p9n->fid_base, 0);
proto_cc_clunkfid(pu, p9n->fid_base, 0);
free(p9n);
puffs_pn_put(pn);

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr.c,v 1.5 2007/05/16 09:57:21 pooka Exp $ */
/* $NetBSD: subr.c,v 1.6 2007/11/30 19:02:39 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.5 2007/05/16 09:57:21 pooka Exp $");
__RCSID("$NetBSD: subr.c,v 1.6 2007/11/30 19:02:39 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -99,10 +99,11 @@ newp9pnode_qid(struct puffs_usermount *pu, const struct qid9p *qid,
* and issue dummy readdirs until we get the result we want
*/
int
getdfwithoffset(struct puffs_cc *pcc, struct p9pnode *p9n, off_t wantoff,
getdfwithoffset(struct puffs_usermount *pu, struct p9pnode *p9n, off_t wantoff,
struct dirfid **rfid)
{
struct puffs9p *p9p = puffs_cc_getspecific(pcc);
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct puffs9p *p9p = puffs_getspecific(pu);
struct puffs_framebuf *pb;
struct dirfid *dfp = NULL;
p9ptag_t tag = NEXTTAG(p9p);
@ -122,7 +123,7 @@ getdfwithoffset(struct puffs_cc *pcc, struct p9pnode *p9n, off_t wantoff,
pb = p9pbuf_makeout();
dfp = ecalloc(1, sizeof(struct dirfid));
dfp->fid = NEXTFID(p9p);
rv = proto_cc_open(pcc, p9n->fid_base, dfp->fid, P9PROTO_OMODE_READ);
rv = proto_cc_open(pu, p9n->fid_base, dfp->fid, P9PROTO_OMODE_READ);
if (rv)
goto out;
@ -170,10 +171,10 @@ getdfwithoffset(struct puffs_cc *pcc, struct p9pnode *p9n, off_t wantoff,
}
void
releasedf(struct puffs_cc *pcc, struct dirfid *dfp)
releasedf(struct puffs_usermount *pu, struct dirfid *dfp)
{
proto_cc_clunkfid(pcc, dfp->fid, 0);
proto_cc_clunkfid(pu, dfp->fid, 0);
free(dfp);
}
@ -185,12 +186,12 @@ storedf(struct p9pnode *p9n, struct dirfid *dfp)
}
void
nukealldf(struct puffs_cc *pcc, struct p9pnode *p9n)
nukealldf(struct puffs_usermount *pu, struct p9pnode *p9n)
{
struct dirfid *dfp;
while ((dfp = LIST_FIRST(&p9n->dir_openlist)) != NULL) {
LIST_REMOVE(dfp, entries);
releasedf(pcc, dfp);
releasedf(pu, dfp);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs_portal.c,v 1.15 2007/11/27 11:31:21 pooka Exp $ */
/* $NetBSD: puffs_portal.c,v 1.16 2007/11/30 19:02:39 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: puffs_portal.c,v 1.15 2007/11/27 11:31:21 pooka Exp $");
__RCSID("$NetBSD: puffs_portal.c,v 1.16 2007/11/30 19:02:39 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -305,10 +305,10 @@ sendfd(int s, int fd, int error)
* parent: yield until child produces fd. receive it and store it.
*/
static int
provide(struct puffs_cc *pcc, struct portal_node *portn,
provide(struct puffs_usermount *pu, struct portal_node *portn,
struct portal_cred *portc, char **v)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct puffs_framebuf *pufbuf;
int s[2];
int fd, error;
@ -490,7 +490,7 @@ credtr(struct portal_cred *portc, const struct puffs_cred *puffc, int mode)
* incompatibilities.
*/
int
portal_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
portal_node_lookup(struct puffs_usermount *pu, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn)
{
struct portal_node *portn;
@ -515,7 +515,7 @@ int fakeid = 3;
/* XXX: libpuffs'ize */
int
portal_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *va,
portal_node_getattr(struct puffs_usermount *pu, void *opc, struct vattr *va,
const struct puffs_cred *pcr)
{
struct timeval tv;
@ -547,7 +547,7 @@ portal_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *va,
/* for writing, just pretend we care */
int
portal_node_setattr(struct puffs_cc *pcc, void *opc, const struct vattr *va,
portal_node_setattr(struct puffs_usermount *pu, void *opc, const struct vattr *va,
const struct puffs_cred *pcr)
{
@ -555,7 +555,7 @@ portal_node_setattr(struct puffs_cc *pcc, void *opc, const struct vattr *va,
}
int
portal_node_open(struct puffs_cc *pcc, void *opc, int mode,
portal_node_open(struct puffs_usermount *pu, void *opc, int mode,
const struct puffs_cred *pcr)
{
struct portal_node *portn = opc;
@ -573,14 +573,15 @@ portal_node_open(struct puffs_cc *pcc, void *opc, int mode,
return ENOENT;
credtr(&portc, pcr, mode);
return provide(pcc, portn, &portc, v);
return provide(pu, portn, &portc, v);
}
int
portal_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf, off_t offset,
size_t *resid, const struct puffs_cred *pcr, int ioflag)
portal_node_read(struct puffs_usermount *pu, void *opc,
uint8_t *buf, off_t offset, size_t *resid,
const struct puffs_cred *pcr, int ioflag)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct portal_node *portn = opc;
struct puffs_framebuf *pufbuf;
size_t xfersize, winsize, boff;
@ -650,9 +651,11 @@ portal_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf, off_t offset,
}
int
portal_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf, off_t offset,
size_t *resid, const struct puffs_cred *pcr, int ioflag)
portal_node_write(struct puffs_usermount *pu, void *opc,
uint8_t *buf, off_t offset, size_t *resid,
const struct puffs_cred *pcr, int ioflag)
{
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct portal_node *portn = opc;
struct puffs_framebuf *pufbuf;
size_t written;
@ -665,8 +668,7 @@ portal_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf, off_t offset,
error = 0;
if (ioflag & PUFFS_IO_NDELAY) {
rv = portal_frame_wf(puffs_cc_getusermount(pcc),
pufbuf, portn->fd, &dummy);
rv = portal_frame_wf(pu, pufbuf, portn->fd, &dummy);
if (rv) {
error = rv;
goto out;
@ -692,7 +694,7 @@ portal_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf, off_t offset,
}
int
portal_node_seek(struct puffs_cc *pcc, void *opc, off_t oldoff, off_t newoff,
portal_node_seek(struct puffs_usermount *pu, void *opc, off_t oldoff, off_t newoff,
const struct puffs_cred *pcr)
{
struct portal_node *portn = opc;
@ -706,8 +708,9 @@ portal_node_seek(struct puffs_cc *pcc, void *opc, off_t oldoff, off_t newoff,
}
int
portal_node_poll(struct puffs_cc *pcc, void *opc, int *events)
portal_node_poll(struct puffs_usermount *pu, void *opc, int *events)
{
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct portal_node *portn = opc;
int what;
int rv;
@ -738,23 +741,23 @@ portal_node_poll(struct puffs_cc *pcc, void *opc, int *events)
}
int
portal_node_inactive(struct puffs_cc *pcc, void *opc)
portal_node_inactive(struct puffs_usermount *pu, void *opc)
{
if (opc == PORTAL_ROOT)
return 0;
puffs_setback(pcc, PUFFS_SETBACK_NOREF_N1);
puffs_setback(puffs_cc_getcc(pu), PUFFS_SETBACK_NOREF_N1);
return 0;
}
int
portal_node_reclaim(struct puffs_cc *pcc, void *opc)
portal_node_reclaim(struct puffs_usermount *pu, void *opc)
{
struct portal_node *portn = opc;
if (portn->fd != -1) {
puffs_framev_removefd(puffs_cc_getusermount(pcc), portn->fd, 0);
puffs_framev_removefd(pu, portn->fd, 0);
close(portn->fd);
}
free(portn->path);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fs.c,v 1.14 2007/11/27 11:31:21 pooka Exp $ */
/* $NetBSD: fs.c,v 1.15 2007/11/30 19:02:39 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fs.c,v 1.14 2007/11/27 11:31:21 pooka Exp $");
__RCSID("$NetBSD: fs.c,v 1.15 2007/11/30 19:02:39 pooka Exp $");
#endif /* !lint */
#include <err.h>
@ -129,9 +129,8 @@ psshfs_domount(struct puffs_usermount *pu)
}
int
psshfs_fs_unmount(struct puffs_cc *pcc, int flags)
psshfs_fs_unmount(struct puffs_usermount *pu, int flags)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct psshfs_ctx *pctx = puffs_getspecific(pu);
kill(pctx->sshpid, SIGTERM);
@ -140,10 +139,9 @@ psshfs_fs_unmount(struct puffs_cc *pcc, int flags)
}
int
psshfs_fs_nodetofh(struct puffs_cc *pcc, void *cookie,
psshfs_fs_nodetofh(struct puffs_usermount *pu, void *cookie,
void *fid, size_t *fidsize)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct psshfs_ctx *pctx = puffs_getspecific(pu);
struct puffs_node *pn = cookie;
struct psshfs_node *psn = pn->pn_data;
@ -158,10 +156,9 @@ psshfs_fs_nodetofh(struct puffs_cc *pcc, void *cookie,
}
int
psshfs_fs_fhtonode(struct puffs_cc *pcc, void *fid, size_t fidsize,
psshfs_fs_fhtonode(struct puffs_usermount *pu, void *fid, size_t fidsize,
struct puffs_newinfo *pni)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct psshfs_ctx *pctx = puffs_getspecific(pu);
struct psshfs_fid *pf = fid;
struct puffs_node *pn = pf->node;
@ -177,7 +174,7 @@ psshfs_fs_fhtonode(struct puffs_cc *pcc, void *fid, size_t fidsize,
return EINVAL;
/* update node attributes */
rv = getnodeattr(pcc, pn);
rv = getnodeattr(pu, pn);
if (rv)
return EINVAL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: node.c,v 1.47 2007/11/30 16:24:04 pooka Exp $ */
/* $NetBSD: node.c,v 1.48 2007/11/30 19:02:40 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: node.c,v 1.47 2007/11/30 16:24:04 pooka Exp $");
__RCSID("$NetBSD: node.c,v 1.48 2007/11/30 19:02:40 pooka Exp $");
#endif /* !lint */
#include <assert.h>
@ -39,10 +39,10 @@ __RCSID("$NetBSD: node.c,v 1.47 2007/11/30 16:24:04 pooka Exp $");
#include "sftp_proto.h"
int
psshfs_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn)
psshfs_node_lookup(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct psshfs_ctx *pctx = puffs_getspecific(pu);
struct puffs_node *pn_dir = opc;
struct psshfs_node *psn, *psn_dir = pn_dir->pn_data;
@ -69,7 +69,7 @@ psshfs_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
* Can't read the directory. We still might be
* able to find the node with getattr in -r+x dirs
*/
rv = getpathattr(pcc, PCNPATH(pcn), &va);
rv = getpathattr(pu, PCNPATH(pcn), &va);
if (rv)
return rv;
@ -105,13 +105,13 @@ psshfs_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
psshfs_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *vap,
psshfs_node_getattr(struct puffs_usermount *pu, void *opc, struct vattr *vap,
const struct puffs_cred *pcr)
{
struct puffs_node *pn = opc;
int rv;
rv = getnodeattr(pcc, pn);
rv = getnodeattr(pu, pn);
if (rv)
return rv;
@ -121,10 +121,10 @@ psshfs_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *vap,
}
int
psshfs_node_setattr(struct puffs_cc *pcc, void *opc,
psshfs_node_setattr(struct puffs_usermount *pu, void *opc,
const struct vattr *va, const struct puffs_cred *pcr)
{
PSSHFSAUTOVAR(pcc);
PSSHFSAUTOVAR(pu);
struct vattr kludgeva;
struct puffs_node *pn = opc;
@ -160,11 +160,10 @@ psshfs_node_setattr(struct puffs_cc *pcc, void *opc,
}
int
psshfs_node_create(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
psshfs_node_create(struct puffs_usermount *pu, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn, const struct vattr *va)
{
PSSHFSAUTOVAR(pcc);
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
PSSHFSAUTOVAR(pu);
struct puffs_node *pn = opc;
struct puffs_node *pn_new;
char *fhand = NULL;
@ -211,11 +210,11 @@ psshfs_node_create(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
* state of waiting.
*/
int
psshfs_node_open(struct puffs_cc *pcc, void *opc, int mode,
psshfs_node_open(struct puffs_usermount *pu, void *opc, int mode,
const struct puffs_cred *pcr)
{
struct psshfs_ctx *pctx = puffs_cc_getspecific(pcc);
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct psshfs_ctx *pctx = puffs_getspecific(pu);
struct puffs_framebuf *pb, *pb2;
struct vattr va;
struct puffs_node *pn = opc;
@ -303,21 +302,21 @@ psshfs_node_open(struct puffs_cc *pcc, void *opc, int mode,
}
int
psshfs_node_inactive(struct puffs_cc *pcc, void *opc)
psshfs_node_inactive(struct puffs_usermount *pu, void *opc)
{
struct puffs_node *pn = opc;
closehandles(puffs_cc_getusermount(pcc), pn->pn_data,
HANDLE_READ | HANDLE_WRITE);
closehandles(pu, pn->pn_data, HANDLE_READ | HANDLE_WRITE);
return 0;
}
int
psshfs_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
psshfs_node_readdir(struct puffs_usermount *pu, void *opc, struct dirent *dent,
off_t *readoff, size_t *reslen, const struct puffs_cred *pcr,
int *eofflag, off_t *cookies, size_t *ncookies)
{
struct psshfs_ctx *pctx = puffs_cc_getspecific(pcc);
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct psshfs_ctx *pctx = puffs_getspecific(pu);
struct puffs_node *pn = opc;
struct psshfs_node *psn = pn->pn_data;
struct psshfs_dir *pd;
@ -394,12 +393,11 @@ psshfs_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
}
int
psshfs_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
psshfs_node_read(struct puffs_usermount *pu, void *opc, uint8_t *buf,
off_t offset, size_t *resid, const struct puffs_cred *pcr,
int ioflag)
{
PSSHFSAUTOVAR(pcc);
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
PSSHFSAUTOVAR(pu);
struct puffs_node *pn = opc;
struct psshfs_node *psn = pn->pn_data;
struct psshfs_wait *pwp;
@ -499,12 +497,11 @@ psshfs_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
/* XXX: we should getattr for size */
int
psshfs_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
psshfs_node_write(struct puffs_usermount *pu, void *opc, uint8_t *buf,
off_t offset, size_t *resid, const struct puffs_cred *cred,
int ioflag)
{
PSSHFSAUTOVAR(pcc);
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
PSSHFSAUTOVAR(pu);
struct psshfs_wait *pwp;
struct puffs_node *pn = opc;
struct psshfs_node *psn = pn->pn_data;
@ -585,10 +582,10 @@ psshfs_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
}
int
psshfs_node_readlink(struct puffs_cc *pcc, void *opc,
psshfs_node_readlink(struct puffs_usermount *pu, void *opc,
const struct puffs_cred *cred, char *linkvalue, size_t *linklen)
{
PSSHFSAUTOVAR(pcc);
PSSHFSAUTOVAR(pu);
struct puffs_node *pn = opc;
struct psshfs_node *psn = pn->pn_data;
uint32_t count;
@ -639,10 +636,10 @@ psshfs_node_readlink(struct puffs_cc *pcc, void *opc,
}
static int
doremove(struct puffs_cc *pcc, struct puffs_node *pn_dir,
doremove(struct puffs_usermount *pu, struct puffs_node *pn_dir,
struct puffs_node *pn, const char *name)
{
PSSHFSAUTOVAR(pcc);
PSSHFSAUTOVAR(pu);
int op;
if (pn->pn_va.va_type == VDIR)
@ -662,7 +659,7 @@ doremove(struct puffs_cc *pcc, struct puffs_node *pn_dir,
}
int
psshfs_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
psshfs_node_remove(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_node *pn_targ = targ;
@ -670,15 +667,15 @@ psshfs_node_remove(struct puffs_cc *pcc, void *opc, void *targ,
assert(pn_targ->pn_va.va_type != VDIR);
rv = doremove(pcc, opc, targ, pcn->pcn_name);
rv = doremove(pu, opc, targ, pcn->pcn_name);
if (rv == 0)
puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2);
puffs_setback(puffs_cc_getcc(pu), PUFFS_SETBACK_NOREF_N2);
return rv;
}
int
psshfs_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
psshfs_node_rmdir(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_node *pn_targ = targ;
@ -686,19 +683,18 @@ psshfs_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ,
assert(pn_targ->pn_va.va_type == VDIR);
rv = doremove(pcc, opc, targ, pcn->pcn_name);
rv = doremove(pu, opc, targ, pcn->pcn_name);
if (rv == 0)
puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2);
puffs_setback(puffs_cc_getcc(pu), PUFFS_SETBACK_NOREF_N2);
return rv;
}
int
psshfs_node_mkdir(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
psshfs_node_mkdir(struct puffs_usermount *pu, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn, const struct vattr *va)
{
PSSHFSAUTOVAR(pcc);
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
PSSHFSAUTOVAR(pu);
struct puffs_node *pn = opc;
struct puffs_node *pn_new;
@ -724,12 +720,11 @@ psshfs_node_mkdir(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
psshfs_node_symlink(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
psshfs_node_symlink(struct puffs_usermount *pu, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn, const struct vattr *va,
const char *link_target)
{
PSSHFSAUTOVAR(pcc);
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
PSSHFSAUTOVAR(pu);
struct puffs_node *pn = opc;
struct puffs_node *pn_new;
@ -763,11 +758,11 @@ psshfs_node_symlink(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
psshfs_node_rename(struct puffs_cc *pcc, void *opc, void *src,
psshfs_node_rename(struct puffs_usermount *pu, void *opc, void *src,
const struct puffs_cn *pcn_src, void *targ_dir, void *targ,
const struct puffs_cn *pcn_targ)
{
PSSHFSAUTOVAR(pcc);
PSSHFSAUTOVAR(pu);
struct puffs_node *pn_sf = src;
struct puffs_node *pn_td = targ_dir, *pn_tf = targ;
struct psshfs_node *psn_targdir = pn_td->pn_data;
@ -778,7 +773,7 @@ psshfs_node_rename(struct puffs_cc *pcc, void *opc, void *src,
}
if (pn_tf) {
rv = doremove(pcc, targ_dir, pn_tf, pcn_targ->pcn_name);
rv = doremove(pu, targ_dir, pn_tf, pcn_targ->pcn_name);
if (rv)
goto out;
}
@ -829,9 +824,8 @@ psshfs_node_rename(struct puffs_cc *pcc, void *opc, void *src,
* bit.
*/
int
psshfs_node_reclaim(struct puffs_cc *pcc, void *opc)
psshfs_node_reclaim(struct puffs_usermount *pu, void *opc)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn = opc, *pn_next, *pn_root;
struct psshfs_node *psn = pn->pn_data;

View File

@ -1,4 +1,4 @@
/* $NetBSD: psshfs.h,v 1.30 2007/11/30 16:24:04 pooka Exp $ */
/* $NetBSD: psshfs.h,v 1.31 2007/11/30 19:02:40 pooka Exp $ */
/*
* Copyright (c) 2006, 2007 Antti Kantee. All Rights Reserved.
@ -49,8 +49,9 @@ extern unsigned int max_reads;
PUFFSOP_PROTOS(psshfs);
#define NEXTREQ(pctx) ((pctx->nextreq)++)
#define PSSHFSAUTOVAR(pcc) \
struct psshfs_ctx *pctx = puffs_cc_getspecific(pcc); \
#define PSSHFSAUTOVAR(pu) \
struct puffs_cc *pcc = puffs_cc_getcc(pu); \
struct psshfs_ctx *pctx = puffs_getspecific(pu); \
uint32_t reqid = NEXTREQ(pctx); \
struct puffs_framebuf *pb = psbuf_makeout(); \
int rv = 0
@ -224,8 +225,8 @@ struct puffs_node *allocnode(struct puffs_usermount *, struct puffs_node *,
struct psshfs_dir *direnter(struct puffs_node *, const char *);
void nukenode(struct puffs_node *, const char *, int);
void doreclaim(struct puffs_node *);
int getpathattr(struct puffs_cc *, const char *, struct vattr *);
int getnodeattr(struct puffs_cc *, struct puffs_node *);
int getpathattr(struct puffs_usermount *, const char *, struct vattr *);
int getnodeattr(struct puffs_usermount *, struct puffs_node *);
void closehandles(struct puffs_usermount *, struct psshfs_node *, int);
void lazyopen_rresp(struct puffs_usermount *, struct puffs_framebuf *,

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr.c,v 1.37 2007/11/30 16:24:04 pooka Exp $ */
/* $NetBSD: subr.c,v 1.38 2007/11/30 19:02:41 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: subr.c,v 1.37 2007/11/30 16:24:04 pooka Exp $");
__RCSID("$NetBSD: subr.c,v 1.38 2007/11/30 19:02:41 pooka Exp $");
#endif /* !lint */
#include <assert.h>
@ -315,9 +315,9 @@ readdir_getattr_send(struct puffs_usermount *pu, struct psshfs_node *psn)
}
int
getpathattr(struct puffs_cc *pcc, const char *path, struct vattr *vap)
getpathattr(struct puffs_usermount *pu, const char *path, struct vattr *vap)
{
PSSHFSAUTOVAR(pcc);
PSSHFSAUTOVAR(pu);
psbuf_req_str(pb, SSH_FXP_LSTAT, reqid, path);
GETRESPONSE(pb);
@ -329,9 +329,9 @@ getpathattr(struct puffs_cc *pcc, const char *path, struct vattr *vap)
}
int
getnodeattr(struct puffs_cc *pcc, struct puffs_node *pn)
getnodeattr(struct puffs_usermount *pu, struct puffs_node *pn)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct psshfs_ctx *pctx = puffs_getspecific(pu);
struct psshfs_node *psn = pn->pn_data;
struct vattr va;
@ -351,7 +351,7 @@ getnodeattr(struct puffs_cc *pcc, struct puffs_node *pn)
}
if (dohardway) {
rv = getpathattr(pcc, PNPATH(pn), &va);
rv = getpathattr(pu, PNPATH(pn), &va);
if (rv)
return rv;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctlfs.c,v 1.7 2007/11/27 11:31:21 pooka Exp $ */
/* $NetBSD: sysctlfs.c,v 1.8 2007/11/30 19:02:41 pooka Exp $ */
/*
* Copyright (c) 2006, 2007 Antti Kantee. All Rights Reserved.
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: sysctlfs.c,v 1.7 2007/11/27 11:31:21 pooka Exp $");
__RCSID("$NetBSD: sysctlfs.c,v 1.8 2007/11/30 19:02:41 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -329,7 +329,7 @@ sysctlfs_domount(struct puffs_usermount *pu)
}
int
sysctlfs_fs_fhtonode(struct puffs_cc *pcc, void *fid, size_t fidsize,
sysctlfs_fs_fhtonode(struct puffs_usermount *pu, void *fid, size_t fidsize,
struct puffs_newinfo *pni)
{
struct puffs_pathobj po;
@ -342,7 +342,7 @@ sysctlfs_fs_fhtonode(struct puffs_cc *pcc, void *fid, size_t fidsize,
po.po_len = sfid->len;
po.po_path = &sfid->path;
pn = getnode(puffs_cc_getusermount(pcc), &po, 0);
pn = getnode(pu, &po, 0);
if (pn == NULL)
return EINVAL;
sfs = pn->pn_data;
@ -357,7 +357,7 @@ sysctlfs_fs_fhtonode(struct puffs_cc *pcc, void *fid, size_t fidsize,
}
int
sysctlfs_fs_nodetofh(struct puffs_cc *pcc, void *cookie,
sysctlfs_fs_nodetofh(struct puffs_usermount *pu, void *cookie,
void *fid, size_t *fidsize)
{
struct puffs_node *pn = cookie;
@ -449,10 +449,9 @@ getsize(struct sfsnode *sfs, struct puffs_pathobj *po)
}
int
sysctlfs_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
const struct puffs_cn *pcn)
sysctlfs_node_lookup(struct puffs_usermount *pu, void *opc,
struct puffs_newinfo *pni, const struct puffs_cn *pcn)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_cn *p2cn = __UNCONST(pcn); /* XXX: fix the interface */
struct sysctlnode sn[SFS_NODEPERDIR];
struct sysctlnode qnode;
@ -504,7 +503,7 @@ sysctlfs_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
}
int
sysctlfs_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *va,
sysctlfs_node_getattr(struct puffs_usermount *pu, void *opc, struct vattr *va,
const struct puffs_cred *pcr)
{
struct puffs_node *pn = opc;
@ -535,7 +534,7 @@ sysctlfs_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *va,
}
int
sysctlfs_node_setattr(struct puffs_cc *pcc, void *opc,
sysctlfs_node_setattr(struct puffs_usermount *pu, void *opc,
const struct vattr *va, const struct puffs_cred *pcr)
{
@ -545,11 +544,11 @@ sysctlfs_node_setattr(struct puffs_cc *pcc, void *opc,
}
int
sysctlfs_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
off_t *readoff, size_t *reslen, const struct puffs_cred *pcr,
int *eofflag, off_t *cookies, size_t *ncookies)
sysctlfs_node_readdir(struct puffs_usermount *pu, void *opc,
struct dirent *dent, off_t *readoff, size_t *reslen,
const struct puffs_cred *pcr, int *eofflag,
off_t *cookies, size_t *ncookies)
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct sysctlnode sn[SFS_NODEPERDIR];
struct sysctlnode qnode;
struct puffs_node *pn_dir = opc;
@ -617,7 +616,7 @@ sysctlfs_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
}
int
sysctlfs_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
sysctlfs_node_read(struct puffs_usermount *pu, void *opc, uint8_t *buf,
off_t offset, size_t *resid, const struct puffs_cred *pcr,
int ioflag)
{
@ -647,7 +646,7 @@ sysctlfs_node_read(struct puffs_cc *pcc, void *opc, uint8_t *buf,
}
int
sysctlfs_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
sysctlfs_node_write(struct puffs_usermount *pu, void *opc, uint8_t *buf,
off_t offset, size_t *resid, const struct puffs_cred *cred,
int ioflag)
{