aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_extattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/vfs_extattr.c')
-rw-r--r--sys/kern/vfs_extattr.c120
1 files changed, 60 insertions, 60 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 38265bdc9fff..480ae33f9796 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -3839,17 +3839,17 @@ done:
}
int
-extattr_set_file(td, uap)
+extattr_set_fd(td, uap)
struct thread *td;
- struct extattr_set_file_args /* {
- syscallarg(const char *) path;
+ struct extattr_set_fd_args /* {
+ syscallarg(int) fd;
syscallarg(int) attrnamespace;
syscallarg(const char *) attrname;
syscallarg(void *) data;
syscallarg(size_t) nbytes;
} */ *uap;
{
- struct nameidata nd;
+ struct file *fp;
char attrname[EXTATTR_MAXNAMELEN];
int error;
@@ -3857,30 +3857,28 @@ extattr_set_file(td, uap)
if (error)
return (error);
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- if ((error = namei(&nd)) != 0)
+ if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
return (error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- error = extattr_set_vp(nd.ni_vp, uap->attrnamespace, attrname,
- uap->data, uap->nbytes, td);
+ error = extattr_set_vp((struct vnode *)fp->f_data, uap->attrnamespace,
+ attrname, uap->data, uap->nbytes, td);
+ fdrop(fp, td);
- vrele(nd.ni_vp);
return (error);
}
int
-extattr_set_fd(td, uap)
+extattr_set_file(td, uap)
struct thread *td;
- struct extattr_set_fd_args /* {
- syscallarg(int) fd;
+ struct extattr_set_file_args /* {
+ syscallarg(const char *) path;
syscallarg(int) attrnamespace;
syscallarg(const char *) attrname;
syscallarg(void *) data;
syscallarg(size_t) nbytes;
} */ *uap;
{
- struct file *fp;
+ struct nameidata nd;
char attrname[EXTATTR_MAXNAMELEN];
int error;
@@ -3888,13 +3886,15 @@ extattr_set_fd(td, uap)
if (error)
return (error);
- if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
+ if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
- error = extattr_set_vp((struct vnode *)fp->f_data, uap->attrnamespace,
- attrname, uap->data, uap->nbytes, td);
- fdrop(fp, td);
+ error = extattr_set_vp(nd.ni_vp, uap->attrnamespace, attrname,
+ uap->data, uap->nbytes, td);
+ vrele(nd.ni_vp);
return (error);
}
@@ -4000,17 +4000,17 @@ done:
}
int
-extattr_get_file(td, uap)
+extattr_get_fd(td, uap)
struct thread *td;
- struct extattr_get_file_args /* {
- syscallarg(const char *) path;
+ struct extattr_get_fd_args /* {
+ syscallarg(int) fd;
syscallarg(int) attrnamespace;
syscallarg(const char *) attrname;
syscallarg(void *) data;
syscallarg(size_t) nbytes;
} */ *uap;
{
- struct nameidata nd;
+ struct file *fp;
char attrname[EXTATTR_MAXNAMELEN];
int error;
@@ -4018,30 +4018,28 @@ extattr_get_file(td, uap)
if (error)
return (error);
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- if ((error = namei(&nd)) != 0)
+ if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
return (error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- error = extattr_get_vp(nd.ni_vp, uap->attrnamespace, attrname,
- uap->data, uap->nbytes, td);
+ error = extattr_get_vp((struct vnode *)fp->f_data, uap->attrnamespace,
+ attrname, uap->data, uap->nbytes, td);
- vrele(nd.ni_vp);
+ fdrop(fp, td);
return (error);
}
int
-extattr_get_fd(td, uap)
+extattr_get_file(td, uap)
struct thread *td;
- struct extattr_get_fd_args /* {
- syscallarg(int) fd;
+ struct extattr_get_file_args /* {
+ syscallarg(const char *) path;
syscallarg(int) attrnamespace;
syscallarg(const char *) attrname;
syscallarg(void *) data;
syscallarg(size_t) nbytes;
} */ *uap;
{
- struct file *fp;
+ struct nameidata nd;
char attrname[EXTATTR_MAXNAMELEN];
int error;
@@ -4049,13 +4047,15 @@ extattr_get_fd(td, uap)
if (error)
return (error);
- if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
+ if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
- error = extattr_get_vp((struct vnode *)fp->f_data, uap->attrnamespace,
- attrname, uap->data, uap->nbytes, td);
+ error = extattr_get_vp(nd.ni_vp, uap->attrnamespace, attrname,
+ uap->data, uap->nbytes, td);
- fdrop(fp, td);
+ vrele(nd.ni_vp);
return (error);
}
@@ -4126,59 +4126,59 @@ extattr_delete_vp(struct vnode *vp, int attrnamespace, const char *attrname,
}
int
-extattr_delete_file(td, uap)
+extattr_delete_fd(td, uap)
struct thread *td;
- struct extattr_delete_file_args /* {
- syscallarg(const char *) path;
+ struct extattr_delete_fd_args /* {
+ syscallarg(int) fd;
syscallarg(int) attrnamespace;
syscallarg(const char *) attrname;
} */ *uap;
{
- struct nameidata nd;
+ struct file *fp;
+ struct vnode *vp;
char attrname[EXTATTR_MAXNAMELEN];
int error;
error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
if (error)
- return(error);
+ return (error);
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- if ((error = namei(&nd)) != 0)
- return(error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
+ if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
+ return (error);
+ vp = (struct vnode *)fp->f_data;
- error = extattr_delete_vp(nd.ni_vp, uap->attrnamespace, attrname, td);
+ error = extattr_delete_vp(vp, uap->attrnamespace, attrname, td);
- vrele(nd.ni_vp);
- return(error);
+ fdrop(fp, td);
+ return (error);
}
int
-extattr_delete_fd(td, uap)
+extattr_delete_file(td, uap)
struct thread *td;
- struct extattr_delete_fd_args /* {
- syscallarg(int) fd;
+ struct extattr_delete_file_args /* {
+ syscallarg(const char *) path;
syscallarg(int) attrnamespace;
syscallarg(const char *) attrname;
} */ *uap;
{
- struct file *fp;
- struct vnode *vp;
+ struct nameidata nd;
char attrname[EXTATTR_MAXNAMELEN];
int error;
error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
if (error)
- return (error);
+ return(error);
- if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
- return (error);
- vp = (struct vnode *)fp->f_data;
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
+ if ((error = namei(&nd)) != 0)
+ return(error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
- error = extattr_delete_vp(vp, uap->attrnamespace, attrname, td);
+ error = extattr_delete_vp(nd.ni_vp, uap->attrnamespace, attrname, td);
- fdrop(fp, td);
- return (error);
+ vrele(nd.ni_vp);
+ return(error);
}
int