Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern extattr(9): KNF



details:   https://anonhg.NetBSD.org/src/rev/b8b005678952
branches:  trunk
changeset: 372013:b8b005678952
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Oct 25 23:22:36 2022 +0000

description:
extattr(9): KNF

No functional change intended.

diffstat:

 sys/kern/vfs_xattr.c |  345 ++++++++++++++++++++++++++++----------------------
 1 files changed, 195 insertions(+), 150 deletions(-)

diffs (truncated from 902 to 300 lines):

diff -r c663183ddce9 -r b8b005678952 sys/kern/vfs_xattr.c
--- a/sys/kern/vfs_xattr.c      Tue Oct 25 23:22:17 2022 +0000
+++ b/sys/kern/vfs_xattr.c      Tue Oct 25 23:22:36 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_xattr.c,v 1.37 2022/10/25 23:22:17 riastradh Exp $ */
+/*     $NetBSD: vfs_xattr.c,v 1.38 2022/10/25 23:22:36 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.37 2022/10/25 23:22:17 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.38 2022/10/25 23:22:36 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -113,7 +113,7 @@
 {
 
        if (cred == NOCRED)
-               return (0);
+               return 0;
 
        return kauth_authorize_vnode(cred, kauth_extattr_action(access), vp,
            NULL, genfs_can_extattr(vp, cred, access, attrspace));
@@ -131,7 +131,7 @@
 
        if (vp != NULL)
                VOP_UNLOCK(vp);
-       return (EOPNOTSUPP);
+       return EOPNOTSUPP;
 }
 
 /*
@@ -161,28 +161,27 @@
                error = copyinstr(SCARG(uap, attrname), attrname,
                    sizeof(attrname), NULL);
                if (error)
-                       return (error);
+                       return error;
        }
 
-       error = namei_simple_user(SCARG(uap, path),
-                               NSM_FOLLOW_NOEMULROOT, &path_vp);
-       if (error) {
-               return (error);
-       }
+       error = namei_simple_user(SCARG(uap, path), NSM_FOLLOW_NOEMULROOT,
+           &path_vp);
+       if (error)
+               return error;
 
        file_vp = NULL;
        if (SCARG(uap, filename) != NULL) {
                error = pathbuf_copyin(SCARG(uap, filename), &file_pb);
                if (error) {
                        vrele(path_vp);
-                       return (error);
+                       return error;
                }
                NDINIT(&file_nd, LOOKUP, FOLLOW | LOCKLEAF, file_pb);
                error = namei(&file_nd);
                if (error) {
                        pathbuf_destroy(file_pb);
                        vrele(path_vp);
-                       return (error);
+                       return error;
                }
                file_vp = file_nd.ni_vp;
                pathbuf_destroy(file_pb);
@@ -196,7 +195,7 @@
                vrele(file_vp);
        vrele(path_vp);
 
-       return (error);
+       return error;
 }
 
 /*****************************************************************************
@@ -228,7 +227,7 @@
                size_t attrlen;
 
                error = VOP_GETEXTATTR(vp, attrnamespace, attrname, NULL,
-                                      &attrlen, l->l_cred);
+                   &attrlen, l->l_cred);
 
                switch (error) {
                case ENODATA:
@@ -271,7 +270,7 @@
 
  done:
        VOP_UNLOCK(vp);
-       return (error);
+       return error;
 }
 
 /*
@@ -333,7 +332,7 @@
 
  done:
        VOP_UNLOCK(vp);
-       return (error);
+       return error;
 }
 
 /*
@@ -357,7 +356,7 @@
                    l->l_cred);
 
        VOP_UNLOCK(vp);
-       return (error);
+       return error;
 }
 
 /*
@@ -399,8 +398,8 @@
        } else
                sizep = &size;
 
-       error = VOP_LISTEXTATTR(vp, attrnamespace, auiop, sizep, 
-                               flag, l->l_cred);
+       error = VOP_LISTEXTATTR(vp, attrnamespace, auiop, sizep, flag,
+           l->l_cred);
 
        if (auiop != NULL) {
                cnt -= auio.uio_resid;
@@ -412,7 +411,7 @@
 
  done:
        VOP_UNLOCK(vp);
-       return (error);
+       return error;
 }
 
 /*****************************************************************************
@@ -420,7 +419,8 @@
  *****************************************************************************/
 
 int
-sys_extattr_set_fd(struct lwp *l, const struct sys_extattr_set_fd_args *uap, register_t *retval)
+sys_extattr_set_fd(struct lwp *l, const struct sys_extattr_set_fd_args *uap,
+    register_t *retval)
 {
        /* {
                syscallarg(int) fd;
@@ -437,22 +437,24 @@
        error = copyinstr(SCARG(uap, attrname), attrname, sizeof(attrname),
            NULL);
        if (error)
-               return (error);
+               return error;
 
        error = fd_getvnode(SCARG(uap, fd), &fp);
        if (error)
-               return (error);
+               return error;
        vp = fp->f_vnode;
 
        error = extattr_set_vp(vp, SCARG(uap, attrnamespace), attrname,
            SCARG(uap, data), SCARG(uap, nbytes), l, retval, 0);
 
        fd_putfile(SCARG(uap, fd));
-       return (error);
+       return error;
 }
 
 int
-sys_extattr_set_file(struct lwp *l, const struct sys_extattr_set_file_args *uap, register_t *retval)
+sys_extattr_set_file(struct lwp *l,
+    const struct sys_extattr_set_file_args *uap,
+    register_t *retval)
 {
        /* {
                syscallarg(const char *) path;
@@ -468,22 +470,24 @@
        error = copyinstr(SCARG(uap, attrname), attrname, sizeof(attrname),
            NULL);
        if (error)
-               return (error);
+               return error;
 
-       error = namei_simple_user(SCARG(uap, path),
-                               NSM_FOLLOW_NOEMULROOT, &vp);
+       error = namei_simple_user(SCARG(uap, path), NSM_FOLLOW_NOEMULROOT,
+           &vp);
        if (error)
-               return (error);
+               return error;
 
        error = extattr_set_vp(vp, SCARG(uap, attrnamespace), attrname,
            SCARG(uap, data), SCARG(uap, nbytes), l, retval, 0);
 
        vrele(vp);
-       return (error);
+       return error;
 }
 
 int
-sys_extattr_set_link(struct lwp *l, const struct sys_extattr_set_link_args *uap, register_t *retval)
+sys_extattr_set_link(struct lwp *l,
+    const struct sys_extattr_set_link_args *uap,
+    register_t *retval)
 {
        /* {
                syscallarg(const char *) path;
@@ -499,22 +503,24 @@
        error = copyinstr(SCARG(uap, attrname), attrname, sizeof(attrname),
            NULL);
        if (error)
-               return (error);
+               return error;
 
-       error = namei_simple_user(SCARG(uap, path),
-                               NSM_NOFOLLOW_NOEMULROOT, &vp);
+       error = namei_simple_user(SCARG(uap, path), NSM_NOFOLLOW_NOEMULROOT,
+           &vp);
        if (error)
-               return (error);
+               return error;
 
        error = extattr_set_vp(vp, SCARG(uap, attrnamespace), attrname,
            SCARG(uap, data), SCARG(uap, nbytes), l, retval, 0);
 
        vrele(vp);
-       return (error);
+       return error;
 }
 
 int
-sys_extattr_get_fd(struct lwp *l, const struct sys_extattr_get_fd_args *uap, register_t *retval)
+sys_extattr_get_fd(struct lwp *l,
+    const struct sys_extattr_get_fd_args *uap,
+    register_t *retval)
 {
        /* {
                syscallarg(int) fd;
@@ -531,22 +537,24 @@
        error = copyinstr(SCARG(uap, attrname), attrname, sizeof(attrname),
            NULL);
        if (error)
-               return (error);
+               return error;
 
        error = fd_getvnode(SCARG(uap, fd), &fp);
        if (error)
-               return (error);
+               return error;
        vp = fp->f_vnode;
 
        error = extattr_get_vp(vp, SCARG(uap, attrnamespace), attrname,
            SCARG(uap, data), SCARG(uap, nbytes), l, retval);
 
        fd_putfile(SCARG(uap, fd));
-       return (error);
+       return error;
 }
 
 int
-sys_extattr_get_file(struct lwp *l, const struct sys_extattr_get_file_args *uap, register_t *retval)
+sys_extattr_get_file(struct lwp *l,
+    const struct sys_extattr_get_file_args *uap,
+    register_t *retval)
 {
        /* {
                syscallarg(const char *) path;
@@ -562,22 +570,24 @@
        error = copyinstr(SCARG(uap, attrname), attrname, sizeof(attrname),
            NULL);
        if (error)
-               return (error);
+               return error;
 
-       error = namei_simple_user(SCARG(uap, path),
-                               NSM_FOLLOW_NOEMULROOT, &vp);
+       error = namei_simple_user(SCARG(uap, path), NSM_FOLLOW_NOEMULROOT,
+           &vp);
        if (error)
-               return (error);
+               return error;
 
        error = extattr_get_vp(vp, SCARG(uap, attrnamespace), attrname,
            SCARG(uap, data), SCARG(uap, nbytes), l, retval);
 
        vrele(vp);
-       return (error);
+       return error;
 }
 
 int
-sys_extattr_get_link(struct lwp *l, const struct sys_extattr_get_link_args *uap, register_t *retval)
+sys_extattr_get_link(struct lwp *l,
+    const struct sys_extattr_get_link_args *uap,
+    register_t *retval)
 {
        /* {
                syscallarg(const char *) path;
@@ -593,22 +603,24 @@
        error = copyinstr(SCARG(uap, attrname), attrname, sizeof(attrname),



Home | Main Index | Thread Index | Old Index