diff options
author | green <green@FreeBSD.org> | 2001-12-11 20:48:20 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 2001-12-11 20:48:20 +0000 |
commit | b40c254986521a7b9ec49e1e51f1582def697b80 (patch) | |
tree | 9fa32734117ef1f2935525d0fe0cb897b8b74d6c /sys/fs/pseudofs/pseudofs_vnops.c | |
parent | a3fff002fac556e3f3c4707f3d2f16a2b895a50a (diff) | |
download | FreeBSD-src-b40c254986521a7b9ec49e1e51f1582def697b80.zip FreeBSD-src-b40c254986521a7b9ec49e1e51f1582def697b80.tar.gz |
Add VOP_GETEXTATTR(9) passthrough support to pseudofs.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
Diffstat (limited to 'sys/fs/pseudofs/pseudofs_vnops.c')
-rw-r--r-- | sys/fs/pseudofs/pseudofs_vnops.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sys/fs/pseudofs/pseudofs_vnops.c b/sys/fs/pseudofs/pseudofs_vnops.c index 4c869b2..e7741b8 100644 --- a/sys/fs/pseudofs/pseudofs_vnops.c +++ b/sys/fs/pseudofs/pseudofs_vnops.c @@ -251,6 +251,47 @@ pfs_ioctl(struct vop_ioctl_args *va) } /* + * Perform getextattr + */ +static int +pfs_getextattr(struct vop_getextattr_args *va) +{ + struct vnode *vn = va->a_vp; + struct pfs_vdata *pvd = (struct pfs_vdata *)vn->v_data; + struct pfs_node *pn = pvd->pvd_pn; + struct proc *proc = NULL; + int error; + + PFS_TRACE((pd->pn_name)); + + if (pn->pn_getextattr == NULL) + PFS_RETURN (EOPNOTSUPP); + + /* + * This is necessary because either process' privileges may + * have changed since the open() call. + */ + if (!pfs_visible(curthread, pn, pvd->pvd_pid)) + PFS_RETURN (EIO); + + /* XXX duplicates bits of pfs_visible() */ + if (pvd->pvd_pid != NO_PID) { + if ((proc = pfind(pvd->pvd_pid)) == NULL) + PFS_RETURN (EIO); + _PHOLD(proc); + PROC_UNLOCK(proc); + } + + error = (pn->pn_getextattr)(curthread, proc, pn, va->a_attrnamespace, + va->a_name, va->a_uio, va->a_cred); + + if (proc != NULL) + PRELE(proc); + + PFS_RETURN (error); +} + +/* * Look up a file or directory */ static int @@ -748,6 +789,7 @@ static struct vnodeopv_entry_desc pfs_vnodeop_entries[] = { { &vop_close_desc, (vop_t *)pfs_close }, { &vop_create_desc, (vop_t *)pfs_badop }, { &vop_getattr_desc, (vop_t *)pfs_getattr }, + { &vop_getextattr_desc, (vop_t *)pfs_getextattr }, { &vop_ioctl_desc, (vop_t *)pfs_ioctl }, { &vop_link_desc, (vop_t *)pfs_badop }, { &vop_lookup_desc, (vop_t *)pfs_lookup }, |