o Introduce vn_extattr_rm(), a helper function in the style of
vn_extattr_get() and vn_extattr_set(). vn_extattr_rm() removes the specified extended attribute from a vnode, authorizing the change as the kernel (NULL cred). Obtained from: TrustedBSD Project
This commit is contained in:
parent
083d01f20d
commit
100d2c187c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=66272
@ -953,3 +953,26 @@ vn_extattr_set(struct vnode *vp, int ioflg, const char *attrname, int buflen,
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
vn_extattr_rm(struct vnode *vp, int ioflg, const char *attrname, struct proc *p)
|
||||
{
|
||||
struct mount *mp;
|
||||
int error;
|
||||
|
||||
if ((ioflg & IO_NODELOCKED) == 0) {
|
||||
if ((error = vn_start_write(vp, &mp, V_WAIT)) != 0)
|
||||
return (error);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
|
||||
}
|
||||
|
||||
/* authorize attribute removal as kernel */
|
||||
error = VOP_SETEXTATTR(vp, attrname, NULL, NULL, p);
|
||||
|
||||
if ((ioflg & IO_NODELOCKED) == 0) {
|
||||
vn_finished_write(mp);
|
||||
VOP_UNLOCK(vp, 0, p);
|
||||
}
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
@ -601,6 +601,8 @@ int vn_extattr_get __P((struct vnode *vp, int ioflg, const char *attrname,
|
||||
int *buflen, char *buf, struct proc *p));
|
||||
int vn_extattr_set __P((struct vnode *vp, int ioflg, const char *attrname,
|
||||
int buflen, char *buf, struct proc *p));
|
||||
int vn_extattr_rm(struct vnode *vp, int ioflg, const char *attrname,
|
||||
struct proc *p);
|
||||
int vfs_cache_lookup __P((struct vop_lookup_args *ap));
|
||||
int vfs_object_create __P((struct vnode *vp, struct proc *p,
|
||||
struct ucred *cred));
|
||||
|
Loading…
Reference in New Issue
Block a user