Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/unionfs/union_subr.c
Show First 20 Lines • Show All 691 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
int | int | ||||
unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp, | unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp, | ||||
struct vattr *uva, struct ucred *cred, struct thread *td) | struct vattr *uva, struct ucred *cred, struct thread *td) | ||||
{ | { | ||||
struct vattr lva; | struct vattr lva; | ||||
int error; | int error; | ||||
if ((error = VOP_GETATTR(lvp, &lva, cred))) | if ((error = VOP_GETATTR(lvp, 0, &lva, cred))) | ||||
return (error); | return (error); | ||||
unionfs_create_uppervattr_core(ump, &lva, uva, td); | unionfs_create_uppervattr_core(ump, &lva, uva, td); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 220 Lines • ▼ Show 20 Lines | unionfs_mkshadowdir(struct vnode *dvp, struct vnode *vp, | ||||
change_ruid(cred, rootinfo); | change_ruid(cred, rootinfo); | ||||
change_svuid(cred, (uid_t)0); | change_svuid(cred, (uid_t)0); | ||||
uifree(rootinfo); | uifree(rootinfo); | ||||
cnp->cn_cred = cred; | cnp->cn_cred = cred; | ||||
memset(&nd.ni_cnd, 0, sizeof(struct componentname)); | memset(&nd.ni_cnd, 0, sizeof(struct componentname)); | ||||
NDPREINIT(&nd); | NDPREINIT(&nd); | ||||
if ((error = VOP_GETATTR(lvp, &lva, cnp->cn_cred))) | if ((error = VOP_GETATTR(lvp, 0, &lva, cnp->cn_cred))) | ||||
goto unionfs_mkshadowdir_finish; | goto unionfs_mkshadowdir_finish; | ||||
vref(udvp); | vref(udvp); | ||||
VOP_UNLOCK(vp); | VOP_UNLOCK(vp); | ||||
if ((error = unionfs_relookup(udvp, &uvp, cnp, &nd.ni_cnd, td, | if ((error = unionfs_relookup(udvp, &uvp, cnp, &nd.ni_cnd, td, | ||||
cnp->cn_nameptr, cnp->cn_namelen, CREATE))) { | cnp->cn_nameptr, cnp->cn_namelen, CREATE))) { | ||||
/* | /* | ||||
* When handling error cases here, we drop udvp's lock and | * When handling error cases here, we drop udvp's lock and | ||||
▲ Show 20 Lines • Show All 342 Lines • ▼ Show 20 Lines | unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, | ||||
unp = VTOUNIONFS(vp); | unp = VTOUNIONFS(vp); | ||||
ump = MOUNTTOUNIONFSMOUNT(UNIONFSTOV(unp)->v_mount); | ump = MOUNTTOUNIONFSMOUNT(UNIONFSTOV(unp)->v_mount); | ||||
uvp = NULLVP; | uvp = NULLVP; | ||||
lvp = unp->un_lowervp; | lvp = unp->un_lowervp; | ||||
cred = td->td_ucred; | cred = td->td_ucred; | ||||
fmode = FFLAGS(O_WRONLY | O_CREAT | O_TRUNC | O_EXCL); | fmode = FFLAGS(O_WRONLY | O_CREAT | O_TRUNC | O_EXCL); | ||||
error = 0; | error = 0; | ||||
if ((error = VOP_GETATTR(lvp, &lva, cred)) != 0) | if ((error = VOP_GETATTR(lvp, 0, &lva, cred)) != 0) | ||||
return (error); | return (error); | ||||
unionfs_create_uppervattr_core(ump, &lva, uvap, td); | unionfs_create_uppervattr_core(ump, &lva, uvap, td); | ||||
if (unp->un_path == NULL) | if (unp->un_path == NULL) | ||||
panic("%s: NULL un_path", __func__); | panic("%s: NULL un_path", __func__); | ||||
nd.ni_cnd.cn_namelen = unp->un_pathlen; | nd.ni_cnd.cn_namelen = unp->un_pathlen; | ||||
nd.ni_cnd.cn_pnbuf = unp->un_path; | nd.ni_cnd.cn_pnbuf = unp->un_path; | ||||
▲ Show 20 Lines • Show All 272 Lines • ▼ Show 20 Lines | unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td) | ||||
* do sufficient tracking of empty state within the unionfs vnode | * do sufficient tracking of empty state within the unionfs vnode | ||||
* (in conjunction with upcalls from the lower FSes to notify us | * (in conjunction with upcalls from the lower FSes to notify us | ||||
* of out-of-band state changes) that we can avoid these costly checks | * of out-of-band state changes) that we can avoid these costly checks | ||||
* altogether. | * altogether. | ||||
*/ | */ | ||||
ASSERT_VOP_LOCKED(lvp, __func__); | ASSERT_VOP_LOCKED(lvp, __func__); | ||||
ASSERT_VOP_ELOCKED(uvp, __func__); | ASSERT_VOP_ELOCKED(uvp, __func__); | ||||
if ((error = VOP_GETATTR(uvp, &va, cred)) != 0) | if ((error = VOP_GETATTR(uvp, 0, &va, cred)) != 0) | ||||
return (error); | return (error); | ||||
if (va.va_flags & OPAQUE) | if (va.va_flags & OPAQUE) | ||||
return (0); | return (0); | ||||
#ifdef MAC | #ifdef MAC | ||||
if ((error = mac_vnode_check_open(cred, lvp, VEXEC | VREAD)) != 0) | if ((error = mac_vnode_check_open(cred, lvp, VEXEC | VREAD)) != 0) | ||||
return (error); | return (error); | ||||
#endif | #endif | ||||
if ((error = VOP_ACCESS(lvp, VEXEC | VREAD, cred, td)) != 0) | if ((error = VOP_ACCESS(lvp, VEXEC | VREAD, cred, td)) != 0) | ||||
return (error); | return (error); | ||||
if ((error = VOP_OPEN(lvp, FREAD, cred, td, NULL)) != 0) | if ((error = VOP_OPEN(lvp, FREAD, cred, td, NULL)) != 0) | ||||
return (error); | return (error); | ||||
if ((error = VOP_GETATTR(lvp, &va, cred)) != 0) | if ((error = VOP_GETATTR(lvp, 0, &va, cred)) != 0) | ||||
return (error); | return (error); | ||||
dirbuflen = max(DEV_BSIZE, GENERIC_MAXDIRSIZ); | dirbuflen = max(DEV_BSIZE, GENERIC_MAXDIRSIZ); | ||||
if (dirbuflen < va.va_blocksize) | if (dirbuflen < va.va_blocksize) | ||||
dirbuflen = va.va_blocksize; | dirbuflen = va.va_blocksize; | ||||
dirbuf = malloc(dirbuflen, M_TEMP, M_WAITOK); | dirbuf = malloc(dirbuflen, M_TEMP, M_WAITOK); | ||||
len = 0; | len = 0; | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |