Instead of supplying a plain pid, supply an abstract struct puffs_cid *,
which can currently be used to query the pid and lwpid.
This commit is contained in:
parent
df9ef2605f
commit
ffe0a01441
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: creds.c,v 1.11 2007/07/01 15:30:15 pooka Exp $ */
|
||||
/* $NetBSD: creds.c,v 1.12 2007/07/01 17:22:18 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(lint)
|
||||
__RCSID("$NetBSD: creds.c,v 1.11 2007/07/01 15:30:15 pooka Exp $");
|
||||
__RCSID("$NetBSD: creds.c,v 1.12 2007/07/01 17:22:18 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
/*
|
||||
|
@ -152,6 +152,30 @@ puffs_cred_isjuggernaut(const struct puffs_cred *pcr)
|
|||
|| puffs_cred_isfs(pcr);
|
||||
}
|
||||
|
||||
int
|
||||
puffs_cid_getpid(const struct puffs_cid *pcid, pid_t *pid)
|
||||
{
|
||||
PUFFS_MAKEKCID(pkcid, pcid);
|
||||
|
||||
if (pkcid->pkcid_type == PUFFCID_TYPE_REAL) {
|
||||
*pid = pkcid->pkcid_pid;
|
||||
return 0;
|
||||
} else
|
||||
return ESRCH;
|
||||
}
|
||||
|
||||
int
|
||||
puffs_cid_getlwpid(const struct puffs_cid *pcid, lwpid_t *lid)
|
||||
{
|
||||
PUFFS_MAKEKCID(pkcid, pcid);
|
||||
|
||||
if (pkcid->pkcid_type == PUFFCID_TYPE_REAL) {
|
||||
*lid = pkcid->pkcid_lwpid;
|
||||
return 0;
|
||||
} else
|
||||
return ESRCH;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gerneic routine for checking file access rights. Modeled after
|
||||
* vaccess() in the kernel.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dispatcher.c,v 1.7 2007/07/01 15:30:15 pooka Exp $ */
|
||||
/* $NetBSD: dispatcher.c,v 1.8 2007/07/01 17:22:18 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.7 2007/07/01 15:30:15 pooka Exp $");
|
||||
__RCSID("$NetBSD: dispatcher.c,v 1.8 2007/07/01 17:22:18 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -154,10 +154,11 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
case PUFFS_VFS_UNMOUNT:
|
||||
{
|
||||
struct puffs_vfsreq_unmount *auxt = auxbuf;
|
||||
PUFFS_MAKECID(pcid, &auxt->pvfsr_cid);
|
||||
|
||||
PU_SETSTATE(pu, PUFFS_STATE_UNMOUNTING);
|
||||
error = pops->puffs_fs_unmount(pcc,
|
||||
auxt->pvfsr_flags, auxt->pvfsr_pid);
|
||||
auxt->pvfsr_flags, pcid);
|
||||
if (!error)
|
||||
PU_SETSTATE(pu, PUFFS_STATE_UNMOUNTED);
|
||||
else
|
||||
|
@ -168,9 +169,10 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
case PUFFS_VFS_STATVFS:
|
||||
{
|
||||
struct puffs_vfsreq_statvfs *auxt = auxbuf;
|
||||
PUFFS_MAKECID(pcid, &auxt->pvfsr_cid);
|
||||
|
||||
error = pops->puffs_fs_statvfs(pcc,
|
||||
&auxt->pvfsr_sb, auxt->pvfsr_pid);
|
||||
&auxt->pvfsr_sb, pcid);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -178,9 +180,10 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
{
|
||||
struct puffs_vfsreq_sync *auxt = auxbuf;
|
||||
PUFFS_MAKECRED(pcr, &auxt->pvfsr_cred);
|
||||
PUFFS_MAKECID(pcid, &auxt->pvfsr_cid);
|
||||
|
||||
error = pops->puffs_fs_sync(pcc,
|
||||
auxt->pvfsr_waitfor, pcr, auxt->pvfsr_pid);
|
||||
auxt->pvfsr_waitfor, pcr, pcid);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -238,6 +241,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
|
||||
pcn.pcn_pkcnp = &auxt->pvnr_cn;
|
||||
PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred);
|
||||
PUFFS_KCIDTOCID(pcn.pcn_cid, &auxt->pvnr_cn_cid);
|
||||
|
||||
if (buildpath) {
|
||||
error = puffs_path_pcnbuild(pu, &pcn, opcookie);
|
||||
|
@ -283,6 +287,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
|
||||
pcn.pcn_pkcnp = &auxt->pvnr_cn;
|
||||
PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred);
|
||||
PUFFS_KCIDTOCID(pcn.pcn_cid, &auxt->pvnr_cn_cid);
|
||||
|
||||
if (buildpath) {
|
||||
error = puffs_path_pcnbuild(pu, &pcn, opcookie);
|
||||
|
@ -319,6 +324,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
|
||||
pcn.pcn_pkcnp = &auxt->pvnr_cn;
|
||||
PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred);
|
||||
PUFFS_KCIDTOCID(pcn.pcn_cid, &auxt->pvnr_cn_cid);
|
||||
|
||||
if (buildpath) {
|
||||
error = puffs_path_pcnbuild(pu, &pcn, opcookie);
|
||||
|
@ -348,6 +354,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
{
|
||||
struct puffs_vnreq_open *auxt = auxbuf;
|
||||
PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
|
||||
PUFFS_MAKECID(pcid, &auxt->pvnr_cid);
|
||||
|
||||
if (pops->puffs_node_open == NULL) {
|
||||
error = 0;
|
||||
|
@ -355,7 +362,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
}
|
||||
|
||||
error = pops->puffs_node_open(pcc,
|
||||
opcookie, auxt->pvnr_mode, pcr, auxt->pvnr_pid);
|
||||
opcookie, auxt->pvnr_mode, pcr, pcid);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -363,6 +370,8 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
{
|
||||
struct puffs_vnreq_close *auxt = auxbuf;
|
||||
PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
|
||||
PUFFS_MAKECID(pcid, &auxt->pvnr_cid);
|
||||
|
||||
|
||||
if (pops->puffs_node_close == NULL) {
|
||||
error = 0;
|
||||
|
@ -370,7 +379,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
}
|
||||
|
||||
error = pops->puffs_node_close(pcc,
|
||||
opcookie, auxt->pvnr_fflag, pcr, auxt->pvnr_pid);
|
||||
opcookie, auxt->pvnr_fflag, pcr, pcid);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -378,6 +387,8 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
{
|
||||
struct puffs_vnreq_access *auxt = auxbuf;
|
||||
PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
|
||||
PUFFS_MAKECID(pcid, &auxt->pvnr_cid);
|
||||
|
||||
|
||||
if (pops->puffs_node_access == NULL) {
|
||||
error = 0;
|
||||
|
@ -385,7 +396,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
}
|
||||
|
||||
error = pops->puffs_node_access(pcc,
|
||||
opcookie, auxt->pvnr_mode, pcr, auxt->pvnr_pid);
|
||||
opcookie, auxt->pvnr_mode, pcr, pcid);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -393,6 +404,8 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
{
|
||||
struct puffs_vnreq_getattr *auxt = auxbuf;
|
||||
PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
|
||||
PUFFS_MAKECID(pcid, &auxt->pvnr_cid);
|
||||
|
||||
|
||||
if (pops->puffs_node_getattr == NULL) {
|
||||
error = EOPNOTSUPP;
|
||||
|
@ -400,7 +413,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
}
|
||||
|
||||
error = pops->puffs_node_getattr(pcc,
|
||||
opcookie, &auxt->pvnr_va, pcr, auxt->pvnr_pid);
|
||||
opcookie, &auxt->pvnr_va, pcr, pcid);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -408,6 +421,8 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
{
|
||||
struct puffs_vnreq_setattr *auxt = auxbuf;
|
||||
PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
|
||||
PUFFS_MAKECID(pcid, &auxt->pvnr_cid);
|
||||
|
||||
|
||||
if (pops->puffs_node_setattr == NULL) {
|
||||
error = EOPNOTSUPP;
|
||||
|
@ -415,7 +430,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
}
|
||||
|
||||
error = pops->puffs_node_setattr(pcc,
|
||||
opcookie, &auxt->pvnr_va, pcr, auxt->pvnr_pid);
|
||||
opcookie, &auxt->pvnr_va, pcr, pcid);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -423,6 +438,8 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
{
|
||||
struct puffs_vnreq_mmap *auxt = auxbuf;
|
||||
PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
|
||||
PUFFS_MAKECID(pcid, &auxt->pvnr_cid);
|
||||
|
||||
|
||||
if (pops->puffs_node_mmap == NULL) {
|
||||
error = 0;
|
||||
|
@ -430,8 +447,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
}
|
||||
|
||||
error = pops->puffs_node_mmap(pcc,
|
||||
opcookie, auxt->pvnr_fflags,
|
||||
pcr, auxt->pvnr_pid);
|
||||
opcookie, auxt->pvnr_fflags, pcr, pcid);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -439,6 +455,8 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
{
|
||||
struct puffs_vnreq_fsync *auxt = auxbuf;
|
||||
PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
|
||||
PUFFS_MAKECID(pcid, &auxt->pvnr_cid);
|
||||
|
||||
|
||||
if (pops->puffs_node_fsync == NULL) {
|
||||
error = 0;
|
||||
|
@ -447,7 +465,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
|
||||
error = pops->puffs_node_fsync(pcc, opcookie, pcr,
|
||||
auxt->pvnr_flags, auxt->pvnr_offlo,
|
||||
auxt->pvnr_offhi, auxt->pvnr_pid);
|
||||
auxt->pvnr_offhi, pcid);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -478,6 +496,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
|
||||
pcn.pcn_pkcnp = &auxt->pvnr_cn;
|
||||
PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred);
|
||||
PUFFS_KCIDTOCID(pcn.pcn_cid, &auxt->pvnr_cn_cid);
|
||||
|
||||
error = pops->puffs_node_remove(pcc,
|
||||
opcookie, auxt->pvnr_cookie_targ, &pcn);
|
||||
|
@ -495,6 +514,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
|
||||
pcn.pcn_pkcnp = &auxt->pvnr_cn;
|
||||
PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred);
|
||||
PUFFS_KCIDTOCID(pcn.pcn_cid, &auxt->pvnr_cn_cid);
|
||||
|
||||
if (buildpath) {
|
||||
error = puffs_path_pcnbuild(pu, &pcn, opcookie);
|
||||
|
@ -524,9 +544,14 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
pcn_src.pcn_pkcnp = &auxt->pvnr_cn_src;
|
||||
PUFFS_KCREDTOCRED(pcn_src.pcn_cred,
|
||||
&auxt->pvnr_cn_src_cred);
|
||||
PUFFS_KCIDTOCID(pcn_src.pcn_cid,
|
||||
&auxt->pvnr_cn_src_cid);
|
||||
|
||||
pcn_targ.pcn_pkcnp = &auxt->pvnr_cn_targ;
|
||||
PUFFS_KCREDTOCRED(pcn_targ.pcn_cred,
|
||||
&auxt->pvnr_cn_targ_cred);
|
||||
PUFFS_KCIDTOCID(pcn_targ.pcn_cid,
|
||||
&auxt->pvnr_cn_targ_cid);
|
||||
|
||||
if (buildpath) {
|
||||
pn_src = auxt->pvnr_cookie_src;
|
||||
|
@ -584,6 +609,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
|
||||
pcn.pcn_pkcnp = &auxt->pvnr_cn;
|
||||
PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred);
|
||||
PUFFS_KCIDTOCID(pcn.pcn_cid, &auxt->pvnr_cn_cid);
|
||||
|
||||
if (buildpath) {
|
||||
error = puffs_path_pcnbuild(pu, &pcn, opcookie);
|
||||
|
@ -620,6 +646,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
|
||||
pcn.pcn_pkcnp = &auxt->pvnr_cn;
|
||||
PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred);
|
||||
PUFFS_KCIDTOCID(pcn.pcn_cid, &auxt->pvnr_cn_cid);
|
||||
|
||||
error = pops->puffs_node_rmdir(pcc,
|
||||
opcookie, auxt->pvnr_cookie_targ, &pcn);
|
||||
|
@ -637,6 +664,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
|
||||
pcn.pcn_pkcnp = &auxt->pvnr_cn;
|
||||
PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred);
|
||||
PUFFS_KCIDTOCID(pcn.pcn_cid, &auxt->pvnr_cn_cid);
|
||||
|
||||
if (buildpath) {
|
||||
error = puffs_path_pcnbuild(pu, &pcn, opcookie);
|
||||
|
@ -721,19 +749,22 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
case PUFFS_VN_RECLAIM:
|
||||
{
|
||||
struct puffs_vnreq_reclaim *auxt = auxbuf;
|
||||
PUFFS_MAKECID(pcid, &auxt->pvnr_cid);
|
||||
|
||||
if (pops->puffs_node_reclaim == NULL) {
|
||||
error = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
error = pops->puffs_node_reclaim(pcc,
|
||||
opcookie, auxt->pvnr_pid);
|
||||
error = pops->puffs_node_reclaim(pcc, opcookie, pcid);
|
||||
break;
|
||||
}
|
||||
|
||||
case PUFFS_VN_INACTIVE:
|
||||
{
|
||||
struct puffs_vnreq_inactive *auxt = auxbuf;
|
||||
PUFFS_MAKECID(pcid, &auxt->pvnr_cid);
|
||||
|
||||
if (pops->puffs_node_inactive == NULL) {
|
||||
error = EOPNOTSUPP;
|
||||
break;
|
||||
|
@ -741,8 +772,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
|
||||
auxt->pvnr_backendrefs = 1; /* safe default */
|
||||
error = pops->puffs_node_inactive(pcc,
|
||||
opcookie, auxt->pvnr_pid,
|
||||
&auxt->pvnr_backendrefs);
|
||||
opcookie, pcid, &auxt->pvnr_backendrefs);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -832,6 +862,8 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
case PUFFS_VN_POLL:
|
||||
{
|
||||
struct puffs_vnreq_poll *auxt = auxbuf;
|
||||
PUFFS_MAKECID(pcid, &auxt->pvnr_cid);
|
||||
|
||||
if (pops->puffs_node_poll == NULL) {
|
||||
error = 0;
|
||||
|
||||
|
@ -843,7 +875,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
}
|
||||
|
||||
error = pops->puffs_node_poll(pcc,
|
||||
opcookie, &auxt->pvnr_events, auxt->pvnr_pid);
|
||||
opcookie, &auxt->pvnr_events, pcid);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: null.c,v 1.19 2007/06/25 07:52:01 pooka Exp $ */
|
||||
/* $NetBSD: null.c,v 1.20 2007/07/01 17:22:18 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.19 2007/06/25 07:52:01 pooka Exp $");
|
||||
__RCSID("$NetBSD: null.c,v 1.20 2007/07/01 17:22:18 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
/*
|
||||
|
@ -187,7 +187,8 @@ puffs_null_setops(struct puffs_ops *pops)
|
|||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
puffs_null_fs_statvfs(struct puffs_cc *pcc, struct statvfs *svfsb, pid_t pid)
|
||||
puffs_null_fs_statvfs(struct puffs_cc *pcc, struct statvfs *svfsb,
|
||||
const struct puffs_cid *pcid)
|
||||
{
|
||||
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
|
||||
|
||||
|
@ -278,7 +279,7 @@ puffs_null_node_mknod(struct puffs_cc *pcc, void *opc, void **newnode,
|
|||
/*ARGSUSED*/
|
||||
int
|
||||
puffs_null_node_getattr(struct puffs_cc *pcc, void *opc, struct vattr *va,
|
||||
const struct puffs_cred *pcred, pid_t pid)
|
||||
const struct puffs_cred *pcred, const struct puffs_cid *pcid)
|
||||
{
|
||||
struct puffs_node *pn = opc;
|
||||
struct stat sb;
|
||||
|
@ -293,7 +294,8 @@ 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,
|
||||
const struct vattr *va, const struct puffs_cred *pcred, pid_t pid)
|
||||
const struct vattr *va, const struct puffs_cred *pcred,
|
||||
const struct puffs_cid *pcid)
|
||||
{
|
||||
struct puffs_node *pn = opc;
|
||||
int rv;
|
||||
|
@ -311,7 +313,7 @@ puffs_null_node_setattr(struct puffs_cc *pcc, void *opc,
|
|||
int
|
||||
puffs_null_node_fsync(struct puffs_cc *pcc, void *opc,
|
||||
const struct puffs_cred *pcred, int how,
|
||||
off_t offlo, off_t offhi, pid_t pid)
|
||||
off_t offlo, off_t offhi, const struct puffs_cid *pcid)
|
||||
{
|
||||
struct puffs_node *pn = opc;
|
||||
int fd, rv;
|
||||
|
@ -561,8 +563,9 @@ puffs_null_node_write(struct puffs_cc *pcc, void *opc, uint8_t *buf,
|
|||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
puffs_null_node_reclaim(struct puffs_cc *pcc, void *opc, pid_t pid)
|
||||
puffs_null_node_reclaim(struct puffs_cc *pcc, void *opc,
|
||||
const struct puffs_cid *pcid)
|
||||
{
|
||||
|
||||
return puffs_genfs_node_reclaim(pcc, opc, pid);
|
||||
return puffs_genfs_node_reclaim(pcc, opc, pcid);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs.h,v 1.67 2007/07/01 15:30:15 pooka Exp $ */
|
||||
/* $NetBSD: puffs.h,v 1.68 2007/07/01 17:22:18 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -51,6 +51,7 @@ struct puffs_cc;
|
|||
struct puffs_getreq;
|
||||
struct puffs_putreq;
|
||||
struct puffs_cred;
|
||||
struct puffs_cid;
|
||||
|
||||
/* paths */
|
||||
struct puffs_pathobj {
|
||||
|
@ -115,6 +116,7 @@ struct puffs_cn {
|
|||
struct puffs_kcn *pcn_pkcnp; /* kernel input */
|
||||
|
||||
struct puffs_cred *pcn_cred; /* cred used for lookup */
|
||||
struct puffs_cid *pcn_cid; /* the who called */
|
||||
|
||||
struct puffs_pathobj pcn_po_full; /* PUFFS_FLAG_BUILDPATH */
|
||||
};
|
||||
|
@ -147,11 +149,12 @@ extern const struct mntopt puffsmopts[]; /* puffs.c */
|
|||
|
||||
/* callbacks for operations */
|
||||
struct puffs_ops {
|
||||
int (*puffs_fs_unmount)(struct puffs_cc *, int, pid_t);
|
||||
int (*puffs_fs_unmount)(struct puffs_cc *, int,
|
||||
const struct puffs_cid *);
|
||||
int (*puffs_fs_statvfs)(struct puffs_cc *,
|
||||
struct statvfs *, pid_t);
|
||||
struct statvfs *, const struct puffs_cid *);
|
||||
int (*puffs_fs_sync)(struct puffs_cc *, int,
|
||||
const struct puffs_cred *, pid_t);
|
||||
const struct puffs_cred *, const struct puffs_cid *);
|
||||
int (*puffs_fs_fhtonode)(struct puffs_cc *, void *, size_t,
|
||||
void **, enum vtype *, voff_t *, dev_t *);
|
||||
int (*puffs_fs_nodetofh)(struct puffs_cc *, void *cookie,
|
||||
|
@ -166,20 +169,24 @@ struct puffs_ops {
|
|||
int (*puffs_node_mknod)(struct puffs_cc *,
|
||||
void *, void **, const struct puffs_cn *, const struct vattr *);
|
||||
int (*puffs_node_open)(struct puffs_cc *,
|
||||
void *, int, const struct puffs_cred *, pid_t);
|
||||
void *, int, const struct puffs_cred *, const struct puffs_cid *);
|
||||
int (*puffs_node_close)(struct puffs_cc *,
|
||||
void *, int, const struct puffs_cred *, pid_t);
|
||||
void *, int, const struct puffs_cred *, const struct puffs_cid *);
|
||||
int (*puffs_node_access)(struct puffs_cc *,
|
||||
void *, int, const struct puffs_cred *, pid_t);
|
||||
void *, int, const struct puffs_cred *, const struct puffs_cid *);
|
||||
int (*puffs_node_getattr)(struct puffs_cc *,
|
||||
void *, struct vattr *, const struct puffs_cred *, pid_t);
|
||||
void *, struct vattr *, const struct puffs_cred *,
|
||||
const struct puffs_cid *);
|
||||
int (*puffs_node_setattr)(struct puffs_cc *,
|
||||
void *, const struct vattr *, const struct puffs_cred *, pid_t);
|
||||
int (*puffs_node_poll)(struct puffs_cc *, void *, int *, pid_t);
|
||||
void *, const struct vattr *, const struct puffs_cred *,
|
||||
const struct puffs_cid *);
|
||||
int (*puffs_node_poll)(struct puffs_cc *, void *, int *,
|
||||
const struct puffs_cid *);
|
||||
int (*puffs_node_mmap)(struct puffs_cc *,
|
||||
void *, int, const struct puffs_cred *, pid_t);
|
||||
void *, int, const struct puffs_cred *, const struct puffs_cid *);
|
||||
int (*puffs_node_fsync)(struct puffs_cc *,
|
||||
void *, const struct puffs_cred *, int, off_t, off_t, pid_t);
|
||||
void *, const struct puffs_cred *, int, off_t, off_t,
|
||||
const struct puffs_cid *);
|
||||
int (*puffs_node_seek)(struct puffs_cc *,
|
||||
void *, off_t, off_t, const struct puffs_cred *);
|
||||
int (*puffs_node_remove)(struct puffs_cc *,
|
||||
|
@ -202,9 +209,9 @@ struct puffs_ops {
|
|||
int (*puffs_node_readlink)(struct puffs_cc *,
|
||||
void *, const struct puffs_cred *, char *, size_t *);
|
||||
int (*puffs_node_reclaim)(struct puffs_cc *,
|
||||
void *, pid_t);
|
||||
void *, const struct puffs_cid *);
|
||||
int (*puffs_node_inactive)(struct puffs_cc *,
|
||||
void *, pid_t, int *);
|
||||
void *, const struct puffs_cid *, int *);
|
||||
int (*puffs_node_print)(struct puffs_cc *,
|
||||
void *);
|
||||
int (*puffs_node_pathconf)(struct puffs_cc *,
|
||||
|
@ -273,11 +280,12 @@ enum {
|
|||
#define PUFFSOP_PROTOS(fsname) \
|
||||
int fsname##_fs_mount(struct puffs_usermount *, void **, \
|
||||
struct statvfs *); \
|
||||
int fsname##_fs_unmount(struct puffs_cc *, int, pid_t); \
|
||||
int fsname##_fs_unmount(struct puffs_cc *, int, \
|
||||
const struct puffs_cid *); \
|
||||
int fsname##_fs_statvfs(struct puffs_cc *, \
|
||||
struct statvfs *, pid_t); \
|
||||
struct statvfs *, const struct puffs_cid *); \
|
||||
int fsname##_fs_sync(struct puffs_cc *, int, \
|
||||
const struct puffs_cred *cred, pid_t); \
|
||||
const struct puffs_cred *cred, const struct puffs_cid *); \
|
||||
int fsname##_fs_fhtonode(struct puffs_cc *, void *, size_t, \
|
||||
void **, enum vtype *, voff_t *, dev_t *); \
|
||||
int fsname##_fs_nodetofh(struct puffs_cc *, void *cookie, \
|
||||
|
@ -294,22 +302,28 @@ enum {
|
|||
void *, void **, const struct puffs_cn *, \
|
||||
const struct vattr *); \
|
||||
int fsname##_node_open(struct puffs_cc *, \
|
||||
void *, int, const struct puffs_cred *, pid_t); \
|
||||
void *, int, const struct puffs_cred *, \
|
||||
const struct puffs_cid *); \
|
||||
int fsname##_node_close(struct puffs_cc *, \
|
||||
void *, int, const struct puffs_cred *, pid_t); \
|
||||
void *, int, const struct puffs_cred *, \
|
||||
const struct puffs_cid *); \
|
||||
int fsname##_node_access(struct puffs_cc *, \
|
||||
void *, int, const struct puffs_cred *, pid_t); \
|
||||
void *, int, const struct puffs_cred *, \
|
||||
const struct puffs_cid *); \
|
||||
int fsname##_node_getattr(struct puffs_cc *, \
|
||||
void *, struct vattr *, const struct puffs_cred *, pid_t); \
|
||||
void *, struct vattr *, const struct puffs_cred *, \
|
||||
const struct puffs_cid *); \
|
||||
int fsname##_node_setattr(struct puffs_cc *, \
|
||||
void *, const struct vattr *, const struct puffs_cred *, \
|
||||
pid_t); \
|
||||
int fsname##_node_poll(struct puffs_cc *, void *, int *,pid_t); \
|
||||
const struct puffs_cid *); \
|
||||
int fsname##_node_poll(struct puffs_cc *, void *, int *, \
|
||||
const struct puffs_cid *); \
|
||||
int fsname##_node_mmap(struct puffs_cc *, \
|
||||
void *, int, const struct puffs_cred *, pid_t); \
|
||||
void *, int, const struct puffs_cred *, \
|
||||
const struct puffs_cid *); \
|
||||
int fsname##_node_fsync(struct puffs_cc *, \
|
||||
void *, const struct puffs_cred *, int, off_t, off_t, \
|
||||
pid_t); \
|
||||
const struct puffs_cid *); \
|
||||
int fsname##_node_seek(struct puffs_cc *, \
|
||||
void *, off_t, off_t, const struct puffs_cred *); \
|
||||
int fsname##_node_remove(struct puffs_cc *, \
|
||||
|
@ -333,9 +347,9 @@ enum {
|
|||
int fsname##_node_readlink(struct puffs_cc *, \
|
||||
void *, const struct puffs_cred *, char *, size_t *); \
|
||||
int fsname##_node_reclaim(struct puffs_cc *, \
|
||||
void *, pid_t); \
|
||||
void *, const struct puffs_cid *); \
|
||||
int fsname##_node_inactive(struct puffs_cc *, \
|
||||
void *, pid_t, int *); \
|
||||
void *, const struct puffs_cid *, int *); \
|
||||
int fsname##_node_print(struct puffs_cc *, \
|
||||
void *); \
|
||||
int fsname##_node_pathconf(struct puffs_cc *, \
|
||||
|
@ -460,12 +474,14 @@ void puffs_null_setops(struct puffs_ops *);
|
|||
/*
|
||||
* generic/dummy routines applicable for some file systems
|
||||
*/
|
||||
int puffs_fsnop_unmount(struct puffs_cc *, int, pid_t);
|
||||
int puffs_fsnop_statvfs(struct puffs_cc *, struct statvfs *, pid_t);
|
||||
int puffs_fsnop_unmount(struct puffs_cc *, int, const struct puffs_cid *);
|
||||
int puffs_fsnop_statvfs(struct puffs_cc *, struct statvfs *,
|
||||
const struct puffs_cid *);
|
||||
void puffs_zerostatvfs(struct statvfs *);
|
||||
int puffs_fsnop_sync(struct puffs_cc *, int waitfor,
|
||||
const struct puffs_cred *, pid_t);
|
||||
int puffs_genfs_node_reclaim(struct puffs_cc *, void *, pid_t);
|
||||
const struct puffs_cred *, const struct puffs_cid *);
|
||||
int puffs_genfs_node_reclaim(struct puffs_cc *, void *,
|
||||
const struct puffs_cid *);
|
||||
|
||||
/*
|
||||
* Subroutine stuff
|
||||
|
@ -485,9 +501,9 @@ mode_t puffs_addvtype2mode(mode_t, enum vtype);
|
|||
*/
|
||||
|
||||
/* Credential fetch */
|
||||
int puffs_cred_getuid(const struct puffs_cred *pcr, uid_t *);
|
||||
int puffs_cred_getgid(const struct puffs_cred *pcr, gid_t *);
|
||||
int puffs_cred_getgroups(const struct puffs_cred *pcr, gid_t *, short *);
|
||||
int puffs_cred_getuid(const struct puffs_cred *, uid_t *);
|
||||
int puffs_cred_getgid(const struct puffs_cred *, gid_t *);
|
||||
int puffs_cred_getgroups(const struct puffs_cred *, gid_t *, short *);
|
||||
|
||||
/* Credential check */
|
||||
int puffs_cred_isuid(const struct puffs_cred *, uid_t);
|
||||
|
@ -497,6 +513,10 @@ int puffs_cred_iskernel(const struct puffs_cred *);
|
|||
int puffs_cred_isfs(const struct puffs_cred *);
|
||||
int puffs_cred_isjuggernaut(const struct puffs_cred *);
|
||||
|
||||
/* Caller ID */
|
||||
int puffs_cid_getpid(const struct puffs_cid *, pid_t *);
|
||||
int puffs_cid_getlwpid(const struct puffs_cid *, lwpid_t *);
|
||||
|
||||
/* misc */
|
||||
int puffs_access(enum vtype, mode_t, uid_t, gid_t, mode_t,
|
||||
const struct puffs_cred *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_priv.h,v 1.13 2007/07/01 15:30:15 pooka Exp $ */
|
||||
/* $NetBSD: puffs_priv.h,v 1.14 2007/07/01 17:22:18 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
|
||||
|
@ -185,6 +185,16 @@ struct puffs_putreq {
|
|||
/*LINTED: tnilxnaht, the cast is ok */ \
|
||||
to = (struct puffs_cred *)from
|
||||
|
||||
#define PUFFS_MAKEKCID(to, from) \
|
||||
/*LINTED: tnilxnaht, the cast is ok */ \
|
||||
const struct puffs_kcid *to = (const struct puffs_kcid *)from
|
||||
#define PUFFS_MAKECID(to, from) \
|
||||
/*LINTED: tnilxnaht, the cast is ok */ \
|
||||
const struct puffs_cid *to = (const struct puffs_cid *)from
|
||||
#define PUFFS_KCIDTOCID(to, from) \
|
||||
/*LINTED: tnilxnaht, the cast is ok */ \
|
||||
to = (struct puffs_cid *)from
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
void puffs_calldispatcher(struct puffs_cc *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: subr.c,v 1.17 2007/06/06 01:55:01 pooka Exp $ */
|
||||
/* $NetBSD: subr.c,v 1.18 2007/07/01 17:22:19 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.17 2007/06/06 01:55:01 pooka Exp $");
|
||||
__RCSID("$NetBSD: subr.c,v 1.18 2007/07/01 17:22:19 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -81,7 +81,8 @@ 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, pid_t dontuse3)
|
||||
puffs_fsnop_unmount(struct puffs_cc *dontuse1, int dontuse2,
|
||||
const struct puffs_cid *dontuse3)
|
||||
{
|
||||
|
||||
/* would you like to see puffs rule again, my friend? */
|
||||
|
@ -91,7 +92,7 @@ puffs_fsnop_unmount(struct puffs_cc *dontuse1, int dontuse2, pid_t dontuse3)
|
|||
/*ARGSUSED*/
|
||||
int
|
||||
puffs_fsnop_sync(struct puffs_cc *dontuse1, int dontuse2,
|
||||
const struct puffs_cred *dontuse3, pid_t dontuse4)
|
||||
const struct puffs_cred *dontuse3, const struct puffs_cid *dontuse4)
|
||||
{
|
||||
|
||||
return 0;
|
||||
|
@ -100,7 +101,7 @@ puffs_fsnop_sync(struct puffs_cc *dontuse1, int dontuse2,
|
|||
/*ARGSUSED*/
|
||||
int
|
||||
puffs_fsnop_statvfs(struct puffs_cc *dontuse1, struct statvfs *sbp,
|
||||
pid_t dontuse2)
|
||||
const struct puffs_cid *dontuse2)
|
||||
{
|
||||
|
||||
sbp->f_bsize = sbp->f_frsize = sbp->f_iosize = 512;
|
||||
|
@ -117,7 +118,8 @@ puffs_fsnop_statvfs(struct puffs_cc *dontuse1, struct statvfs *sbp,
|
|||
*/
|
||||
/*ARGSUSED2*/
|
||||
int
|
||||
puffs_genfs_node_reclaim(struct puffs_cc *pcc, void *opc, pid_t pid)
|
||||
puffs_genfs_node_reclaim(struct puffs_cc *pcc, void *opc,
|
||||
const struct puffs_cid *pcid)
|
||||
{
|
||||
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_msgif.h,v 1.36 2007/07/01 15:30:15 pooka Exp $ */
|
||||
/* $NetBSD: puffs_msgif.h,v 1.37 2007/07/01 17:22:13 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
|
||||
|
@ -326,12 +326,20 @@ struct puffs_kcred {
|
|||
|
||||
#define PUFFS_TOMOVE(a,b) (MIN((a), b->pmp_req_maxsize - PUFFS_REQSTRUCT_MAX))
|
||||
|
||||
/* caller id */
|
||||
struct puffs_kcid {
|
||||
int pkcid_type;
|
||||
pid_t pkcid_pid;
|
||||
lwpid_t pkcid_lwpid;
|
||||
};
|
||||
#define PUFFCID_TYPE_REAL 1
|
||||
#define PUFFCID_TYPE_FAKE 2
|
||||
|
||||
/* puffs struct componentname built by kernel */
|
||||
struct puffs_kcn {
|
||||
/* args */
|
||||
u_long pkcn_nameiop; /* namei operation */
|
||||
u_long pkcn_flags; /* flags */
|
||||
pid_t pkcn_pid; /* caller pid */
|
||||
|
||||
char pkcn_name[MAXPATHLEN+1]; /* nul-terminated path component */
|
||||
long pkcn_namelen;
|
||||
|
@ -369,21 +377,21 @@ struct puffs_vfsreq_unmount {
|
|||
struct puffs_req pvfsr_pr;
|
||||
|
||||
int pvfsr_flags;
|
||||
pid_t pvfsr_pid;
|
||||
struct puffs_kcid pvfsr_cid;
|
||||
};
|
||||
|
||||
struct puffs_vfsreq_statvfs {
|
||||
struct puffs_req pvfsr_pr;
|
||||
|
||||
struct statvfs pvfsr_sb;
|
||||
pid_t pvfsr_pid;
|
||||
struct puffs_kcid pvfsr_cid;
|
||||
};
|
||||
|
||||
struct puffs_vfsreq_sync {
|
||||
struct puffs_req pvfsr_pr;
|
||||
|
||||
struct puffs_kcred pvfsr_cred;
|
||||
pid_t pvfsr_pid;
|
||||
struct puffs_kcid pvfsr_cid;
|
||||
int pvfsr_waitfor;
|
||||
};
|
||||
|
||||
|
@ -429,6 +437,7 @@ struct puffs_vnreq_lookup {
|
|||
|
||||
struct puffs_kcn pvnr_cn; /* OUT */
|
||||
struct puffs_kcred pvnr_cn_cred; /* OUT */
|
||||
struct puffs_kcid pvnr_cn_cid; /* OUT */
|
||||
|
||||
void *pvnr_newnode; /* IN */
|
||||
enum vtype pvnr_vtype; /* IN */
|
||||
|
@ -441,6 +450,7 @@ struct puffs_vnreq_create {
|
|||
|
||||
struct puffs_kcn pvnr_cn; /* OUT */
|
||||
struct puffs_kcred pvnr_cn_cred; /* OUT */
|
||||
struct puffs_kcid pvnr_cn_cid; /* OUT */
|
||||
|
||||
struct vattr pvnr_va; /* OUT */
|
||||
void *pvnr_newnode; /* IN */
|
||||
|
@ -451,6 +461,7 @@ struct puffs_vnreq_mknod {
|
|||
|
||||
struct puffs_kcn pvnr_cn; /* OUT */
|
||||
struct puffs_kcred pvnr_cn_cred; /* OUT */
|
||||
struct puffs_kcid pvnr_cn_cid; /* OUT */
|
||||
|
||||
struct vattr pvnr_va; /* OUT */
|
||||
void *pvnr_newnode; /* IN */
|
||||
|
@ -460,7 +471,7 @@ struct puffs_vnreq_open {
|
|||
struct puffs_req pvn_pr;
|
||||
|
||||
struct puffs_kcred pvnr_cred; /* OUT */
|
||||
pid_t pvnr_pid; /* OUT */
|
||||
struct puffs_kcid pvnr_cid; /* OUT */
|
||||
int pvnr_mode; /* OUT */
|
||||
};
|
||||
|
||||
|
@ -468,7 +479,7 @@ struct puffs_vnreq_close {
|
|||
struct puffs_req pvn_pr;
|
||||
|
||||
struct puffs_kcred pvnr_cred; /* OUT */
|
||||
pid_t pvnr_pid; /* OUT */
|
||||
struct puffs_kcid pvnr_cid; /* OUT */
|
||||
int pvnr_fflag; /* OUT */
|
||||
};
|
||||
|
||||
|
@ -476,7 +487,7 @@ struct puffs_vnreq_access {
|
|||
struct puffs_req pvn_pr;
|
||||
|
||||
struct puffs_kcred pvnr_cred; /* OUT */
|
||||
pid_t pvnr_pid; /* OUT */
|
||||
struct puffs_kcid pvnr_cid; /* OUT */
|
||||
int pvnr_mode; /* OUT */
|
||||
};
|
||||
|
||||
|
@ -486,8 +497,8 @@ struct puffs_vnreq_setgetattr {
|
|||
struct puffs_req pvn_pr;
|
||||
|
||||
struct puffs_kcred pvnr_cred; /* OUT */
|
||||
struct puffs_kcid pvnr_cid; /* OUT */
|
||||
struct vattr pvnr_va; /* IN/OUT (op depend) */
|
||||
pid_t pvnr_pid; /* OUT */
|
||||
};
|
||||
|
||||
#define puffs_vnreq_read puffs_vnreq_readwrite
|
||||
|
@ -522,16 +533,16 @@ struct puffs_vnreq_poll {
|
|||
struct puffs_req pvn_pr;
|
||||
|
||||
int pvnr_events; /* IN/OUT */
|
||||
pid_t pvnr_pid; /* OUT */
|
||||
struct puffs_kcid pvnr_cid; /* OUT */
|
||||
};
|
||||
|
||||
struct puffs_vnreq_fsync {
|
||||
struct puffs_req pvn_pr;
|
||||
|
||||
struct puffs_kcred pvnr_cred; /* OUT */
|
||||
struct puffs_kcid pvnr_cid; /* OUT */
|
||||
off_t pvnr_offlo; /* OUT */
|
||||
off_t pvnr_offhi; /* OUT */
|
||||
pid_t pvnr_pid; /* OUT */
|
||||
int pvnr_flags; /* OUT */
|
||||
};
|
||||
|
||||
|
@ -548,6 +559,7 @@ struct puffs_vnreq_remove {
|
|||
|
||||
struct puffs_kcn pvnr_cn; /* OUT */
|
||||
struct puffs_kcred pvnr_cn_cred; /* OUT */
|
||||
struct puffs_kcid pvnr_cn_cid; /* OUT */
|
||||
|
||||
void *pvnr_cookie_targ; /* OUT */
|
||||
};
|
||||
|
@ -557,6 +569,7 @@ struct puffs_vnreq_mkdir {
|
|||
|
||||
struct puffs_kcn pvnr_cn; /* OUT */
|
||||
struct puffs_kcred pvnr_cn_cred; /* OUT */
|
||||
struct puffs_kcid pvnr_cn_cid; /* OUT */
|
||||
|
||||
struct vattr pvnr_va; /* OUT */
|
||||
void *pvnr_newnode; /* IN */
|
||||
|
@ -567,6 +580,8 @@ struct puffs_vnreq_rmdir {
|
|||
|
||||
struct puffs_kcn pvnr_cn; /* OUT */
|
||||
struct puffs_kcred pvnr_cn_cred; /* OUT */
|
||||
struct puffs_kcid pvnr_cn_cid; /* OUT */
|
||||
|
||||
void *pvnr_cookie_targ; /* OUT */
|
||||
};
|
||||
|
||||
|
@ -575,6 +590,8 @@ struct puffs_vnreq_link {
|
|||
|
||||
struct puffs_kcn pvnr_cn; /* OUT */
|
||||
struct puffs_kcred pvnr_cn_cred; /* OUT */
|
||||
struct puffs_kcid pvnr_cn_cid; /* OUT */
|
||||
|
||||
void *pvnr_cookie_targ; /* OUT */
|
||||
};
|
||||
|
||||
|
@ -583,8 +600,10 @@ struct puffs_vnreq_rename {
|
|||
|
||||
struct puffs_kcn pvnr_cn_src; /* OUT */
|
||||
struct puffs_kcred pvnr_cn_src_cred; /* OUT */
|
||||
struct puffs_kcid pvnr_cn_src_cid; /* OUT */
|
||||
struct puffs_kcn pvnr_cn_targ; /* OUT */
|
||||
struct puffs_kcred pvnr_cn_targ_cred; /* OUT */
|
||||
struct puffs_kcid pvnr_cn_targ_cid; /* OUT */
|
||||
|
||||
void *pvnr_cookie_src; /* OUT */
|
||||
void *pvnr_cookie_targ; /* OUT */
|
||||
|
@ -596,6 +615,7 @@ struct puffs_vnreq_symlink {
|
|||
|
||||
struct puffs_kcn pvnr_cn; /* OUT */
|
||||
struct puffs_kcred pvnr_cn_cred; /* OUT */
|
||||
struct puffs_kcid pvnr_cn_cid; /* OUT */
|
||||
|
||||
struct vattr pvnr_va; /* OUT */
|
||||
void *pvnr_newnode; /* IN */
|
||||
|
@ -627,13 +647,13 @@ struct puffs_vnreq_readlink {
|
|||
struct puffs_vnreq_reclaim {
|
||||
struct puffs_req pvn_pr;
|
||||
|
||||
pid_t pvnr_pid; /* OUT */
|
||||
struct puffs_kcid pvnr_cid; /* OUT */
|
||||
};
|
||||
|
||||
struct puffs_vnreq_inactive {
|
||||
struct puffs_req pvn_pr;
|
||||
|
||||
pid_t pvnr_pid; /* OUT */
|
||||
struct puffs_kcid pvnr_cid; /* OUT */
|
||||
int pvnr_backendrefs; /* IN */
|
||||
};
|
||||
|
||||
|
@ -664,7 +684,7 @@ struct puffs_vnreq_mmap {
|
|||
|
||||
int pvnr_fflags; /* OUT */
|
||||
struct puffs_kcred pvnr_cred; /* OUT */
|
||||
pid_t pvnr_pid; /* OUT */
|
||||
struct puffs_kcid pvnr_cid; /* OUT */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_subr.c,v 1.36 2007/07/01 15:30:16 pooka Exp $ */
|
||||
/* $NetBSD: puffs_subr.c,v 1.37 2007/07/01 17:22:14 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_subr.c,v 1.36 2007/07/01 15:30:16 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_subr.c,v 1.37 2007/07/01 17:22:14 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
|
@ -442,14 +442,14 @@ puffs_pnode2vnode(struct puffs_mount *pmp, void *cookie, int lock,
|
|||
|
||||
void
|
||||
puffs_makecn(struct puffs_kcn *pkcn, struct puffs_kcred *pkcr,
|
||||
const struct componentname *cn)
|
||||
struct puffs_kcid *pkcid, const struct componentname *cn)
|
||||
{
|
||||
|
||||
pkcn->pkcn_nameiop = cn->cn_nameiop;
|
||||
pkcn->pkcn_flags = cn->cn_flags;
|
||||
pkcn->pkcn_pid = cn->cn_lwp->l_proc->p_pid;
|
||||
puffs_cidcvt(pkcid, cn->cn_lwp);
|
||||
|
||||
(void)memcpy(&pkcn->pkcn_name, cn->cn_nameptr, cn->cn_namelen);
|
||||
(void)memcpy(pkcn->pkcn_name, cn->cn_nameptr, cn->cn_namelen);
|
||||
pkcn->pkcn_name[cn->cn_namelen] = '\0';
|
||||
pkcn->pkcn_namelen = cn->cn_namelen;
|
||||
|
||||
|
@ -477,18 +477,21 @@ puffs_credcvt(struct puffs_kcred *pkcr, const kauth_cred_t cred)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return pid. In case the operation is coming from within the
|
||||
* kernel without any process context, borrow the swapper's pid.
|
||||
*/
|
||||
pid_t
|
||||
puffs_lwp2pid(struct lwp *l)
|
||||
void
|
||||
puffs_cidcvt(struct puffs_kcid *pkcid, const struct lwp *l)
|
||||
{
|
||||
|
||||
return l ? l->l_proc->p_pid : 0;
|
||||
if (l) {
|
||||
pkcid->pkcid_type = PUFFCID_TYPE_REAL;
|
||||
pkcid->pkcid_pid = l->l_proc->p_pid;
|
||||
pkcid->pkcid_lwpid = l->l_lid;
|
||||
} else {
|
||||
pkcid->pkcid_type = PUFFCID_TYPE_FAKE;
|
||||
pkcid->pkcid_pid = 0;
|
||||
pkcid->pkcid_lwpid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
puffs_gop_size(struct vnode *vp, off_t size, off_t *eobp,
|
||||
int flags)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_sys.h,v 1.43 2007/07/01 15:30:16 pooka Exp $ */
|
||||
/* $NetBSD: puffs_sys.h,v 1.44 2007/07/01 17:22:15 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
|
||||
|
@ -232,9 +232,9 @@ void puffs_referencenode(struct puffs_node *);
|
|||
|
||||
int puffs_pnode2vnode(struct puffs_mount *, void *, int, struct vnode **);
|
||||
void puffs_makecn(struct puffs_kcn *, struct puffs_kcred *,
|
||||
const struct componentname *);
|
||||
struct puffs_kcid *, const struct componentname *);
|
||||
void puffs_credcvt(struct puffs_kcred *, kauth_cred_t);
|
||||
pid_t puffs_lwp2pid(struct lwp *);
|
||||
void puffs_cidcvt(struct puffs_kcid *, const struct lwp *);
|
||||
|
||||
void puffs_parkdone_asyncbioread(struct puffs_req *, void *);
|
||||
void puffs_parkdone_poll(struct puffs_req *, void *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_vfsops.c,v 1.45 2007/06/21 14:54:49 pooka Exp $ */
|
||||
/* $NetBSD: puffs_vfsops.c,v 1.46 2007/07/01 17:22:16 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.45 2007/06/21 14:54:49 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.46 2007/07/01 17:22:16 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
|
@ -283,7 +283,7 @@ puffs_unmount(struct mount *mp, int mntflags, struct lwp *l)
|
|||
mutex_exit(&pmp->pmp_lock);
|
||||
|
||||
unmount_arg.pvfsr_flags = mntflags;
|
||||
unmount_arg.pvfsr_pid = puffs_lwp2pid(l);
|
||||
puffs_cidcvt(&unmount_arg.pvfsr_cid, l);
|
||||
|
||||
error = puffs_vfstouser(pmp, PUFFS_VFS_UNMOUNT,
|
||||
&unmount_arg, sizeof(unmount_arg));
|
||||
|
@ -365,7 +365,7 @@ puffs_statvfs(struct mount *mp, struct statvfs *sbp, struct lwp *l)
|
|||
/* too big for stack */
|
||||
MALLOC(statvfs_arg, struct puffs_vfsreq_statvfs *,
|
||||
sizeof(struct puffs_vfsreq_statvfs), M_PUFFS, M_WAITOK | M_ZERO);
|
||||
statvfs_arg->pvfsr_pid = puffs_lwp2pid(l);
|
||||
puffs_cidcvt(&statvfs_arg->pvfsr_cid, l);
|
||||
|
||||
error = puffs_vfstouser(pmp, PUFFS_VFS_STATVFS,
|
||||
statvfs_arg, sizeof(*statvfs_arg));
|
||||
|
@ -509,7 +509,7 @@ puffs_sync(struct mount *mp, int waitfor, struct kauth_cred *cred,
|
|||
/* sync fs */
|
||||
sync_arg.pvfsr_waitfor = waitfor;
|
||||
puffs_credcvt(&sync_arg.pvfsr_cred, cred);
|
||||
sync_arg.pvfsr_pid = puffs_lwp2pid(l);
|
||||
puffs_cidcvt(&sync_arg.pvfsr_cid, l);
|
||||
|
||||
rv = puffs_vfstouser(MPTOPUFFSMP(mp), PUFFS_VFS_SYNC,
|
||||
&sync_arg, sizeof(sync_arg));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_vnops.c,v 1.81 2007/07/01 15:30:16 pooka Exp $ */
|
||||
/* $NetBSD: puffs_vnops.c,v 1.82 2007/07/01 17:22:18 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.81 2007/07/01 15:30:16 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.82 2007/07/01 17:22:18 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/fstrans.h>
|
||||
|
@ -454,7 +454,8 @@ puffs_lookup(void *v)
|
|||
return 0;
|
||||
}
|
||||
|
||||
puffs_makecn(&lookup_arg.pvnr_cn, &lookup_arg.pvnr_cn_cred, cnp);
|
||||
puffs_makecn(&lookup_arg.pvnr_cn, &lookup_arg.pvnr_cn_cred,
|
||||
&lookup_arg.pvnr_cn_cid, cnp);
|
||||
|
||||
if (cnp->cn_flags & ISDOTDOT)
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
|
@ -539,7 +540,8 @@ puffs_create(void *v)
|
|||
DPRINTF(("puffs_create: dvp %p, cnp: %s\n",
|
||||
ap->a_dvp, ap->a_cnp->cn_nameptr));
|
||||
|
||||
puffs_makecn(&create_arg.pvnr_cn, &create_arg.pvnr_cn_cred, ap->a_cnp);
|
||||
puffs_makecn(&create_arg.pvnr_cn, &create_arg.pvnr_cn_cred,
|
||||
&create_arg.pvnr_cn_cid, ap->a_cnp);
|
||||
create_arg.pvnr_va = *ap->a_vap;
|
||||
|
||||
error = puffs_vntouser(MPTOPUFFSMP(ap->a_dvp->v_mount), PUFFS_VN_CREATE,
|
||||
|
@ -574,7 +576,8 @@ puffs_mknod(void *v)
|
|||
|
||||
PUFFS_VNREQ(mknod);
|
||||
|
||||
puffs_makecn(&mknod_arg.pvnr_cn, &mknod_arg.pvnr_cn_cred, ap->a_cnp);
|
||||
puffs_makecn(&mknod_arg.pvnr_cn, &mknod_arg.pvnr_cn_cred,
|
||||
&mknod_arg.pvnr_cn_cid, ap->a_cnp);
|
||||
mknod_arg.pvnr_va = *ap->a_vap;
|
||||
|
||||
error = puffs_vntouser(MPTOPUFFSMP(ap->a_dvp->v_mount), PUFFS_VN_MKNOD,
|
||||
|
@ -619,7 +622,7 @@ puffs_open(void *v)
|
|||
|
||||
open_arg.pvnr_mode = mode;
|
||||
puffs_credcvt(&open_arg.pvnr_cred, ap->a_cred);
|
||||
open_arg.pvnr_pid = puffs_lwp2pid(ap->a_l);
|
||||
puffs_cidcvt(&open_arg.pvnr_cid, ap->a_l);
|
||||
|
||||
error = puffs_vntouser(MPTOPUFFSMP(vp->v_mount), PUFFS_VN_OPEN,
|
||||
&open_arg, sizeof(open_arg), 0, vp, NULL);
|
||||
|
@ -645,7 +648,7 @@ puffs_close(void *v)
|
|||
M_PUFFS, M_WAITOK | M_ZERO);
|
||||
close_argp->pvnr_fflag = ap->a_fflag;
|
||||
puffs_credcvt(&close_argp->pvnr_cred, ap->a_cred);
|
||||
close_argp->pvnr_pid = puffs_lwp2pid(ap->a_l);
|
||||
puffs_cidcvt(&close_argp->pvnr_cid, ap->a_l);
|
||||
|
||||
puffs_vntouser_faf(MPTOPUFFSMP(ap->a_vp->v_mount), PUFFS_VN_CLOSE,
|
||||
close_argp, sizeof(struct puffs_vnreq_close), ap->a_vp);
|
||||
|
@ -676,8 +679,8 @@ puffs_access(void *v)
|
|||
return 0;
|
||||
|
||||
access_arg.pvnr_mode = ap->a_mode;
|
||||
access_arg.pvnr_pid = puffs_lwp2pid(ap->a_l);
|
||||
puffs_credcvt(&access_arg.pvnr_cred, ap->a_cred);
|
||||
puffs_cidcvt(&access_arg.pvnr_cid, ap->a_l);
|
||||
|
||||
return puffs_vntouser(MPTOPUFFSMP(vp->v_mount), PUFFS_VN_ACCESS,
|
||||
&access_arg, sizeof(access_arg), 0, vp, NULL);
|
||||
|
@ -707,7 +710,7 @@ puffs_getattr(void *v)
|
|||
|
||||
vattr_null(&getattr_arg.pvnr_va);
|
||||
puffs_credcvt(&getattr_arg.pvnr_cred, ap->a_cred);
|
||||
getattr_arg.pvnr_pid = puffs_lwp2pid(ap->a_l);
|
||||
puffs_cidcvt(&getattr_arg.pvnr_cid, ap->a_l);
|
||||
|
||||
error = puffs_vntouser(MPTOPUFFSMP(vp->v_mount), PUFFS_VN_GETATTR,
|
||||
&getattr_arg, sizeof(getattr_arg), 0, vp, NULL);
|
||||
|
@ -789,7 +792,7 @@ puffs_setattr(void *v)
|
|||
|
||||
(void)memcpy(&setattr_arg.pvnr_va, vap, sizeof(struct vattr));
|
||||
puffs_credcvt(&setattr_arg.pvnr_cred, ap->a_cred);
|
||||
setattr_arg.pvnr_pid = puffs_lwp2pid(ap->a_l);
|
||||
puffs_cidcvt(&setattr_arg.pvnr_cid, ap->a_l);
|
||||
|
||||
error = puffs_vntouser(MPTOPUFFSMP(ap->a_vp->v_mount), PUFFS_VN_SETATTR,
|
||||
&setattr_arg, sizeof(setattr_arg), 0, ap->a_vp, NULL);
|
||||
|
@ -824,7 +827,7 @@ puffs_inactive(void *v)
|
|||
|
||||
pmp = MPTOPUFFSMP(ap->a_vp->v_mount);
|
||||
|
||||
inactive_arg.pvnr_pid = puffs_lwp2pid(ap->a_l);
|
||||
puffs_cidcvt(&inactive_arg.pvnr_cid, ap->a_l);
|
||||
|
||||
if (EXISTSOP(pmp, INACTIVE))
|
||||
if (pmp->pmp_flags & PUFFS_KFLAG_IAONDEMAND)
|
||||
|
@ -900,7 +903,7 @@ puffs_reclaim(void *v)
|
|||
|
||||
reclaim_argp = malloc(sizeof(struct puffs_vnreq_reclaim),
|
||||
M_PUFFS, M_WAITOK | M_ZERO);
|
||||
reclaim_argp->pvnr_pid = puffs_lwp2pid(ap->a_l);
|
||||
puffs_cidcvt(&reclaim_argp->pvnr_cid, ap->a_l);
|
||||
|
||||
puffs_vntouser_faf(pmp, PUFFS_VN_RECLAIM,
|
||||
reclaim_argp, sizeof(struct puffs_vnreq_reclaim), ap->a_vp);
|
||||
|
@ -1043,7 +1046,7 @@ puffs_poll(void *v)
|
|||
M_PUFFS, M_ZERO | M_WAITOK);
|
||||
|
||||
poll_argp->pvnr_events = ap->a_events;
|
||||
poll_argp->pvnr_pid = puffs_lwp2pid(ap->a_l);
|
||||
puffs_cidcvt(&poll_argp->pvnr_cid, ap->a_l);
|
||||
|
||||
selrecord(ap->a_l, &pn->pn_sel);
|
||||
puffs_vntouser_call(pmp, PUFFS_VN_POLL,
|
||||
|
@ -1141,7 +1144,7 @@ puffs_fsync(void *v)
|
|||
fsync_argp->pvnr_flags = ap->a_flags;
|
||||
fsync_argp->pvnr_offlo = ap->a_offlo;
|
||||
fsync_argp->pvnr_offhi = ap->a_offhi;
|
||||
fsync_argp->pvnr_pid = puffs_lwp2pid(ap->a_l);
|
||||
puffs_cidcvt(&fsync_argp->pvnr_cid, ap->a_l);
|
||||
|
||||
/*
|
||||
* XXX: see comment at puffs_getattr about locking
|
||||
|
@ -1202,7 +1205,8 @@ puffs_remove(void *v)
|
|||
PUFFS_VNREQ(remove);
|
||||
|
||||
remove_arg.pvnr_cookie_targ = VPTOPNC(ap->a_vp);
|
||||
puffs_makecn(&remove_arg.pvnr_cn, &remove_arg.pvnr_cn_cred, ap->a_cnp);
|
||||
puffs_makecn(&remove_arg.pvnr_cn, &remove_arg.pvnr_cn_cred,
|
||||
&remove_arg.pvnr_cn_cid, ap->a_cnp);
|
||||
|
||||
error = puffs_vntouser(MPTOPUFFSMP(ap->a_vp->v_mount), PUFFS_VN_REMOVE,
|
||||
&remove_arg, sizeof(remove_arg), 0, ap->a_dvp, ap->a_vp);
|
||||
|
@ -1230,7 +1234,8 @@ puffs_mkdir(void *v)
|
|||
|
||||
PUFFS_VNREQ(mkdir);
|
||||
|
||||
puffs_makecn(&mkdir_arg.pvnr_cn, &mkdir_arg.pvnr_cn_cred, ap->a_cnp);
|
||||
puffs_makecn(&mkdir_arg.pvnr_cn, &mkdir_arg.pvnr_cn_cred,
|
||||
&mkdir_arg.pvnr_cn_cid, ap->a_cnp);
|
||||
mkdir_arg.pvnr_va = *ap->a_vap;
|
||||
|
||||
error = puffs_vntouser(MPTOPUFFSMP(ap->a_dvp->v_mount), PUFFS_VN_MKDIR,
|
||||
|
@ -1262,7 +1267,8 @@ puffs_rmdir(void *v)
|
|||
PUFFS_VNREQ(rmdir);
|
||||
|
||||
rmdir_arg.pvnr_cookie_targ = VPTOPNC(ap->a_vp);
|
||||
puffs_makecn(&rmdir_arg.pvnr_cn, &rmdir_arg.pvnr_cn_cred, ap->a_cnp);
|
||||
puffs_makecn(&rmdir_arg.pvnr_cn, &rmdir_arg.pvnr_cn_cred,
|
||||
&rmdir_arg.pvnr_cn_cid, ap->a_cnp);
|
||||
|
||||
error = puffs_vntouser(MPTOPUFFSMP(ap->a_dvp->v_mount), PUFFS_VN_RMDIR,
|
||||
&rmdir_arg, sizeof(rmdir_arg), 0, ap->a_dvp, ap->a_vp);
|
||||
|
@ -1289,7 +1295,8 @@ puffs_link(void *v)
|
|||
PUFFS_VNREQ(link);
|
||||
|
||||
link_arg.pvnr_cookie_targ = VPTOPNC(ap->a_vp);
|
||||
puffs_makecn(&link_arg.pvnr_cn, &link_arg.pvnr_cn_cred, ap->a_cnp);
|
||||
puffs_makecn(&link_arg.pvnr_cn, &link_arg.pvnr_cn_cred,
|
||||
&link_arg.pvnr_cn_cid, ap->a_cnp);
|
||||
|
||||
error = puffs_vntouser(MPTOPUFFSMP(ap->a_dvp->v_mount), PUFFS_VN_LINK,
|
||||
&link_arg, sizeof(link_arg), 0, ap->a_dvp, ap->a_vp);
|
||||
|
@ -1324,8 +1331,8 @@ puffs_symlink(void *v)
|
|||
|
||||
symlink_argp = malloc(sizeof(struct puffs_vnreq_symlink),
|
||||
M_PUFFS, M_ZERO | M_WAITOK);
|
||||
puffs_makecn(&symlink_argp->pvnr_cn,
|
||||
&symlink_argp->pvnr_cn_cred, ap->a_cnp);
|
||||
puffs_makecn(&symlink_argp->pvnr_cn, &symlink_argp->pvnr_cn_cred,
|
||||
&symlink_argp->pvnr_cn_cid, ap->a_cnp);
|
||||
symlink_argp->pvnr_va = *ap->a_vap;
|
||||
(void)strlcpy(symlink_argp->pvnr_link, ap->a_target,
|
||||
sizeof(symlink_argp->pvnr_link));
|
||||
|
@ -1408,9 +1415,11 @@ puffs_rename(void *v)
|
|||
else
|
||||
rename_argp->pvnr_cookie_targ = NULL;
|
||||
puffs_makecn(&rename_argp->pvnr_cn_src,
|
||||
&rename_argp->pvnr_cn_src_cred, ap->a_fcnp);
|
||||
&rename_argp->pvnr_cn_src_cred, &rename_argp->pvnr_cn_src_cid,
|
||||
ap->a_fcnp);
|
||||
puffs_makecn(&rename_argp->pvnr_cn_targ,
|
||||
&rename_argp->pvnr_cn_targ_cred, ap->a_tcnp);
|
||||
&rename_argp->pvnr_cn_targ_cred, &rename_argp->pvnr_cn_targ_cid,
|
||||
ap->a_tcnp);
|
||||
|
||||
error = puffs_vntouser(MPTOPUFFSMP(ap->a_fdvp->v_mount),
|
||||
PUFFS_VN_RENAME, rename_argp, sizeof(*rename_argp), 0,
|
||||
|
@ -2057,7 +2066,7 @@ puffs_mmap(void *v)
|
|||
if (EXISTSOP(pmp, MMAP)) {
|
||||
mmap_arg.pvnr_fflags = ap->a_fflags;
|
||||
puffs_credcvt(&mmap_arg.pvnr_cred, ap->a_cred);
|
||||
mmap_arg.pvnr_pid = puffs_lwp2pid(ap->a_l);
|
||||
puffs_cidcvt(&mmap_arg.pvnr_cid, ap->a_l);
|
||||
|
||||
error = puffs_vntouser(pmp, PUFFS_VN_MMAP,
|
||||
&mmap_arg, sizeof(mmap_arg), 0,
|
||||
|
|
Loading…
Reference in New Issue