* extattr_delete_vp(): Delete a named extended attribute on a file or * directory * * Arguments: unlocked vnode "vp", attribute namespace "attrnamespace", * kernelspace string pointer "attrname", proc "p" * Returns: 0 on success, an error number otherwise * Locks: none * References: vp must be a valid reference for the duration of the call */
| 491 | * References: vp must be a valid reference for the duration of the call |
| 492 | */ |
| 493 | static int |
| 494 | extattr_delete_vp(struct vnode *vp, int attrnamespace, const char *attrname, |
| 495 | struct thread *td) |
| 496 | { |
| 497 | struct mount *mp; |
| 498 | int error; |
| 499 | |
| 500 | error = vn_start_write(vp, &mp, V_WAIT | PCATCH); |
| 501 | if (error) |
| 502 | return (error); |
| 503 | vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); |
| 504 | |
| 505 | #ifdef MAC |
| 506 | error = mac_vnode_check_deleteextattr(td->td_ucred, vp, attrnamespace, |
| 507 | attrname); |
| 508 | if (error) |
| 509 | goto done; |
| 510 | #endif |
| 511 | |
| 512 | error = VOP_DELETEEXTATTR(vp, attrnamespace, attrname, td->td_ucred, |
| 513 | td); |
| 514 | if (error == EOPNOTSUPP) |
| 515 | error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL, |
| 516 | td->td_ucred, td); |
| 517 | #ifdef MAC |
| 518 | done: |
| 519 | #endif |
| 520 | VOP_UNLOCK(vp); |
| 521 | vn_finished_write(mp); |
| 522 | return (error); |
| 523 | } |
| 524 | |
| 525 | #ifndef _SYS_SYSPROTO_H_ |
| 526 | struct extattr_delete_fd_args { |
no test coverage detected