Index: sys/kern/vfs_extattr.c =================================================================== --- sys/kern/vfs_extattr.c +++ sys/kern/vfs_extattr.c @@ -155,9 +155,9 @@ * Locks: none * References: vp must be a valid reference for the duration of the call */ -static int +int extattr_set_vp(struct vnode *vp, int attrnamespace, const char *attrname, - void *data, size_t nbytes, struct thread *td) + void *data, size_t nbytes, enum uio_seg segflg, struct thread *td) { struct mount *mp; struct uio auio; @@ -181,7 +181,7 @@ } auio.uio_resid = nbytes; auio.uio_rw = UIO_WRITE; - auio.uio_segflg = UIO_USERSPACE; + auio.uio_segflg = segflg; auio.uio_td = td; cnt = nbytes; @@ -232,7 +232,7 @@ return (error); error = extattr_set_vp(fp->f_vnode, uap->attrnamespace, - attrname, uap->data, uap->nbytes, td); + attrname, uap->data, uap->nbytes, UIO_USERSPACE, td); fdrop(fp, td); return (error); @@ -267,7 +267,7 @@ NDFREE(&nd, NDF_ONLY_PNBUF); error = extattr_set_vp(nd.ni_vp, uap->attrnamespace, attrname, - uap->data, uap->nbytes, td); + uap->data, uap->nbytes, UIO_USERSPACE, td); vrele(nd.ni_vp); return (error); @@ -302,7 +302,7 @@ NDFREE(&nd, NDF_ONLY_PNBUF); error = extattr_set_vp(nd.ni_vp, uap->attrnamespace, attrname, - uap->data, uap->nbytes, td); + uap->data, uap->nbytes, UIO_USERSPACE, td); vrele(nd.ni_vp); return (error); @@ -318,9 +318,9 @@ * Locks: none * References: vp must be a valid reference for the duration of the call */ -static int +int extattr_get_vp(struct vnode *vp, int attrnamespace, const char *attrname, - void *data, size_t nbytes, struct thread *td) + void *data, size_t nbytes, enum uio_seg segflg, struct thread *td) { struct uio auio, *auiop; struct iovec aiov; @@ -350,7 +350,7 @@ } auio.uio_resid = nbytes; auio.uio_rw = UIO_READ; - auio.uio_segflg = UIO_USERSPACE; + auio.uio_segflg = segflg; auio.uio_td = td; auiop = &auio; cnt = nbytes; @@ -407,7 +407,7 @@ return (error); error = extattr_get_vp(fp->f_vnode, uap->attrnamespace, - attrname, uap->data, uap->nbytes, td); + attrname, uap->data, uap->nbytes, UIO_USERSPACE, td); fdrop(fp, td); return (error); @@ -441,7 +441,7 @@ NDFREE(&nd, NDF_ONLY_PNBUF); error = extattr_get_vp(nd.ni_vp, uap->attrnamespace, attrname, - uap->data, uap->nbytes, td); + uap->data, uap->nbytes, UIO_USERSPACE, td); vrele(nd.ni_vp); return (error); @@ -476,7 +476,7 @@ NDFREE(&nd, NDF_ONLY_PNBUF); error = extattr_get_vp(nd.ni_vp, uap->attrnamespace, attrname, - uap->data, uap->nbytes, td); + uap->data, uap->nbytes, UIO_USERSPACE, td); vrele(nd.ni_vp); return (error); @@ -492,7 +492,7 @@ * Locks: none * References: vp must be a valid reference for the duration of the call */ -static int +int extattr_delete_vp(struct vnode *vp, int attrnamespace, const char *attrname, struct thread *td) { @@ -626,9 +626,9 @@ * Locks: none * References: vp must be a valid reference for the duration of the call */ -static int +int extattr_list_vp(struct vnode *vp, int attrnamespace, void *data, - size_t nbytes, struct thread *td) + size_t nbytes, enum uio_seg segflg, struct thread *td) { struct uio auio, *auiop; size_t size, *sizep; @@ -653,7 +653,7 @@ } auio.uio_resid = nbytes; auio.uio_rw = UIO_READ; - auio.uio_segflg = UIO_USERSPACE; + auio.uio_segflg = segflg; auio.uio_td = td; auiop = &auio; cnt = nbytes; @@ -680,7 +680,6 @@ return (error); } - int sys_extattr_list_fd(td, uap) struct thread *td; @@ -703,7 +702,7 @@ return (error); error = extattr_list_vp(fp->f_vnode, uap->attrnamespace, uap->data, - uap->nbytes, td); + uap->nbytes, UIO_USERSPACE, td); fdrop(fp, td); return (error); @@ -730,7 +729,7 @@ NDFREE(&nd, NDF_ONLY_PNBUF); error = extattr_list_vp(nd.ni_vp, uap->attrnamespace, uap->data, - uap->nbytes, td); + uap->nbytes, UIO_USERSPACE, td); vrele(nd.ni_vp); return (error); @@ -758,7 +757,7 @@ NDFREE(&nd, NDF_ONLY_PNBUF); error = extattr_list_vp(nd.ni_vp, uap->attrnamespace, uap->data, - uap->nbytes, td); + uap->nbytes, UIO_USERSPACE, td); vrele(nd.ni_vp); return (error); Index: sys/sys/extattr.h =================================================================== --- sys/sys/extattr.h +++ sys/sys/extattr.h @@ -61,6 +61,7 @@ #ifdef _KERNEL #include +#include struct thread; struct ucred; @@ -67,6 +68,16 @@ struct vnode; int extattr_check_cred(struct vnode *vp, int attrnamespace, struct ucred *cred, struct thread *td, accmode_t accmode); +int extattr_delete_vp(struct vnode *vp, int attrnamespace, + const char *attrname, struct thread *td); +int extattr_get_vp(struct vnode *vp, int attrnamespace, + const char *attrname, void *data, size_t nbytes, + enum uio_seg segflg, struct thread *td); +int extattr_list_vp(struct vnode *vp, int attrnamespace, void *data, + size_t nbytes, enum uio_seg segflg, struct thread *td); +int extattr_set_vp(struct vnode *vp, int attrnamespace, + const char *attrname, void *data, size_t nbytes, + enum uio_seg segflg, struct thread *td); #else #include