Prefer the vop_rmextattr() vnode operation for removing extended

attributes from objects over vop_setextattr() with a NULL uio; if
the file system doesn't support the vop_rmextattr() method, fall
back to the vop_setextattr() method.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
This commit is contained in:
Robert Watson 2003-06-22 23:03:07 +00:00
parent 77533ed2aa
commit 6b42f0a2eb
3 changed files with 12 additions and 5 deletions

View File

@ -4245,8 +4245,10 @@ extattr_delete_vp(struct vnode *vp, int attrnamespace, const char *attrname,
goto done;
#endif
error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL, td->td_ucred,
td);
error = VOP_RMEXTATTR(vp, attrnamespace, attrname, td->td_ucred, td);
if (error == EOPNOTSUPP)
error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL,
td->td_ucred, td);
#ifdef MAC
done:
#endif

View File

@ -4245,8 +4245,10 @@ extattr_delete_vp(struct vnode *vp, int attrnamespace, const char *attrname,
goto done;
#endif
error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL, td->td_ucred,
td);
error = VOP_RMEXTATTR(vp, attrnamespace, attrname, td->td_ucred, td);
if (error == EOPNOTSUPP)
error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL,
td->td_ucred, td);
#ifdef MAC
done:
#endif

View File

@ -1150,7 +1150,10 @@ vn_extattr_rm(struct vnode *vp, int ioflg, int attrnamespace,
}
/* authorize attribute removal as kernel */
error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL, NULL, td);
error = VOP_RMEXTATTR(vp, attrnamespace, attrname, NULL, td);
if (error == EOPNOTSUPP)
error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL,
NULL, td);
if ((ioflg & IO_NODELOCKED) == 0) {
vn_finished_write(mp);