/* * XXX Failure mode if partially written? */ int vn_extattr_set(struct vnode *vp, int ioflg, int attrnamespace, const char *attrname, size_t buflen, const void *bf, struct lwp *l) { struct uio auio; struct iovec aiov; int error; aiov.iov_len = buflen; aiov.iov_base = __UNCONST(bf); /* XXXUNCONST kills const */ auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_rw = UIO_WRITE; auio.uio_offset = 0; auio.uio_resid = buflen; UIO_SETUP_SYSSPACE(&auio); if ((ioflg & IO_NODELOCKED) == 0) { vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); } error = VOP_SETEXTATTR(vp, attrnamespace, attrname, &auio, NULL); if ((ioflg & IO_NODELOCKED) == 0) { VOP_UNLOCK(vp); } return (error); }
int RUMP_VOP_SETEXTATTR(struct vnode *vp, int attrnamespace, const char *name, struct uio *uio, struct kauth_cred *cred) { int error; rump_schedule(); error = VOP_SETEXTATTR(vp, attrnamespace, name, uio, cred); rump_unschedule(); return error; }
int vn_extattr_rm(struct vnode *vp, int ioflg, int attrnamespace, const char *attrname, struct lwp *l) { int error; if ((ioflg & IO_NODELOCKED) == 0) { vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); } error = VOP_DELETEEXTATTR(vp, attrnamespace, attrname, NULL); if (error == EOPNOTSUPP) error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL, NULL); if ((ioflg & IO_NODELOCKED) == 0) { VOP_UNLOCK(vp); } return (error); }