From nobody Sat Sep 24 16:42:30 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MZZYz0Sdzz4d3Bt; Sat, 24 Sep 2022 16:42:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MZZYy5pCCz3GQ0; Sat, 24 Sep 2022 16:42:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664037751; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xwyp1BbgGEDXNg9CvBZdnSD7L0fwSfmVYhIytqlPKWI=; b=turb6iBTH2RM/as+6CwElJAU4DBoAaFku+eQbzpikRyjB/umA2bPihJUNKo0Ik5ZPKxwlX c7esYxJNfgmepm+rsgCFGrBKRLKkuvLMr0BCYI0ACVeU7cU6jmvVdT/efQzEkWF167kR+F gloiachKYD7s0yF+0/W7zJpcjIKmyXafZxmW0H89pLimpuZ/K4HhAijninFm9GTwWgGytB /b4rZFfIsQNmGkWYDaBGr/jMw9M3UaCidQdPrexVFiJqOiRYAqYk5uxRPaqhPdbFIRsTrn OvqGzgLFtxDJyWncrhXPYH9WeP19Oq3/q+9SZF8B+Yl0TAjPsLn3rEo4pc4dTg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MZZYy4ctSz17sF; Sat, 24 Sep 2022 16:42:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28OGgURa057978; Sat, 24 Sep 2022 16:42:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28OGgUJX057977; Sat, 24 Sep 2022 16:42:30 GMT (envelope-from git) Date: Sat, 24 Sep 2022 16:42:30 GMT Message-Id: <202209241642.28OGgUJX057977@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 0f01fb01c2de - main - tmpfs_subr.c: some style List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f01fb01c2de3e2c9ce8719750aea379c402ece6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664037751; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xwyp1BbgGEDXNg9CvBZdnSD7L0fwSfmVYhIytqlPKWI=; b=F9bY/s77jGxUBQSagovhzCPdi/Rro33E8nJ2AUl/pNd+klUlbVanX8YddwlEv9ALlTIb7W mH9MQXzIvFO6P5AsOg+b2ci8IJwo5U8HKGCeTqrbjfyGDfzFrB5IWyt2DnShZ/KqezL6dy P5oJc3CPGy0EkCN5+O0qpY8vEyO6nDzENG5nc5843u38DjlIdY2saUOeidZVxPJYihy5bV T2nsp2IkMeyK5aAdFHNQQthyAxq3MJMcALeq2M5LipgXLKO/RqNgKL1kHZfX6KBWA00flw egi1b3yiiQ0z7biLBHA3p31RsaUoSZK2Hu42xPJtauUmGNpUy4jwbMbDibamQw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664037751; a=rsa-sha256; cv=none; b=F+ZH6kZTW0vAm91X44wyMuSfmqM/3R1xdxOLaaMClc53J3m0lbCjIxf/sJXAQ0Jj9aPIiG c6+sDfsDvKF/uI+M4VrFpO+P7aEwMBncU1HgJansr+1uk/4qvXul6P1YlRq9026RGBDQ4f qwV86tt7T7ABcvkIiGpK2pTjTAnV8XGOvxDUcO0aniVlnCmAcq5JpahSQdMku62UPx/Mk3 p2M1Higl5nuqiciltmWaB9NAeaCv8TXzXmtMN5XuRO65Ja1jUhWla4AsTmh4JGNNJzD0Hx p4in/h386PcflSb/e4CKY0LXSafFBeOXzpqyGJydd4dsf9WY+uEqv3WgJqxTYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0f01fb01c2de3e2c9ce8719750aea379c402ece6 commit 0f01fb01c2de3e2c9ce8719750aea379c402ece6 Author: Konstantin Belousov AuthorDate: 2022-09-18 13:20:24 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-24 16:41:08 +0000 tmpfs_subr.c: some style Use 'td' as the local thread name. Wrap long lines. Remove unneeded blank lines. Reviewed by: asomers, jah, markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36625 --- sys/fs/tmpfs/tmpfs_subr.c | 67 +++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 82036a35b4f0..be1eef1c3d89 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -120,7 +120,8 @@ tmpfs_pager_writecount_recalc(vm_object_t object, vm_offset_t old, */ if (vp == NULL) { KASSERT((object->flags & OBJ_TMPFS_VREF) == 0, - ("object %p with OBJ_TMPFS_VREF but without vnode", object)); + ("object %p with OBJ_TMPFS_VREF but without vnode", + object)); VM_OBJECT_WUNLOCK(object); return; } @@ -131,7 +132,8 @@ tmpfs_pager_writecount_recalc(vm_object_t object, vm_offset_t old, VNPASS(vp->v_usecount > 0, vp); } else { VNASSERT((object->flags & OBJ_TMPFS_VREF) != 0, vp, - ("object with writable mappings does not have a reference")); + ("object with writable mappings does not " + "have a reference")); } if (old == new) { @@ -534,11 +536,13 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, symlink = NULL; if (!tmp->tm_nonc) { - symlink = cache_symlink_alloc(nnode->tn_size + 1, M_WAITOK); + symlink = cache_symlink_alloc(nnode->tn_size + 1, + M_WAITOK); symlink_smr = true; } if (symlink == NULL) { - symlink = malloc(nnode->tn_size + 1, M_TMPFSNAME, M_WAITOK); + symlink = malloc(nnode->tn_size + 1, M_TMPFSNAME, + M_WAITOK); symlink_smr = false; } memcpy(symlink, target, nnode->tn_size + 1); @@ -550,14 +554,15 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, * 1. nnode is not yet visible to the world * 2. both tn_link_target and tn_link_smr get populated * 3. release fence publishes their content - * 4. tn_link_target content is immutable until node destruction, - * where the pointer gets set to NULL + * 4. tn_link_target content is immutable until node + * destruction, where the pointer gets set to NULL * 5. tn_link_smr is never changed once set * - * As a result it is sufficient to issue load consume on the node - * pointer to also get the above content in a stable manner. - * Worst case tn_link_smr flag may be set to true despite being stale, - * while the target buffer is already cleared out. + * As a result it is sufficient to issue load consume + * on the node pointer to also get the above content + * in a stable manner. Worst case tn_link_smr flag + * may be set to true despite being stale, while the + * target buffer is already cleared out. */ atomic_store_ptr(&nnode->tn_link_target, symlink); atomic_store_char((char *)&nnode->tn_link_smr, symlink_smr); @@ -635,9 +640,10 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct tmpfs_node *node, MPASS((node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0); /* - * Make sure this is a node type we can deal with. Everything is explicitly - * enumerated without the 'default' clause so the compiler can throw an - * error in case a new type is added. + * Make sure this is a node type we can deal with. Everything + * is explicitly enumerated without the 'default' clause so + * the compiler can throw an error in case a new type is + * added. */ switch (node->tn_type) { case VBLK: @@ -651,17 +657,16 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct tmpfs_node *node, case VNON: case VBAD: case VMARKER: - panic("%s: bad type %d for node %p", __func__, (int)node->tn_type, node); + panic("%s: bad type %d for node %p", __func__, + (int)node->tn_type, node); } #endif switch (node->tn_type) { case VREG: uobj = node->tn_reg.tn_aobj; - if (uobj != NULL) { - if (uobj->size != 0) - atomic_subtract_long(&tmp->tm_pages_used, uobj->size); - } + if (uobj != NULL && uobj->size != 0) + atomic_subtract_long(&tmp->tm_pages_used, uobj->size); tmpfs_free_tmp(tmp); @@ -1882,7 +1887,7 @@ tmpfs_check_mtime(struct vnode *vp) */ int tmpfs_chflags(struct vnode *vp, u_long flags, struct ucred *cred, - struct thread *p) + struct thread *td) { int error; struct tmpfs_node *node; @@ -1905,7 +1910,7 @@ tmpfs_chflags(struct vnode *vp, u_long flags, struct ucred *cred, * Callers may only modify the file flags on objects they * have VADMIN rights for. */ - if ((error = VOP_ACCESS(vp, VADMIN, cred, p))) + if ((error = VOP_ACCESS(vp, VADMIN, cred, td))) return (error); /* * Unprivileged processes are not permitted to unset system @@ -1938,7 +1943,8 @@ tmpfs_chflags(struct vnode *vp, u_long flags, struct ucred *cred, * The vnode must be locked on entry and remain locked on exit. */ int -tmpfs_chmod(struct vnode *vp, mode_t mode, struct ucred *cred, struct thread *p) +tmpfs_chmod(struct vnode *vp, mode_t mode, struct ucred *cred, + struct thread *td) { int error; struct tmpfs_node *node; @@ -1961,7 +1967,7 @@ tmpfs_chmod(struct vnode *vp, mode_t mode, struct ucred *cred, struct thread *p) * To modify the permissions on a file, must possess VADMIN * for that file. */ - if ((error = VOP_ACCESS(vp, VADMIN, cred, p))) + if ((error = VOP_ACCESS(vp, VADMIN, cred, td))) return (error); /* @@ -1999,7 +2005,7 @@ tmpfs_chmod(struct vnode *vp, mode_t mode, struct ucred *cred, struct thread *p) */ int tmpfs_chown(struct vnode *vp, uid_t uid, gid_t gid, struct ucred *cred, - struct thread *p) + struct thread *td) { int error; struct tmpfs_node *node; @@ -2032,7 +2038,7 @@ tmpfs_chown(struct vnode *vp, uid_t uid, gid_t gid, struct ucred *cred, * To modify the ownership of a file, must possess VADMIN for that * file. */ - if ((error = VOP_ACCESS(vp, VADMIN, cred, p))) + if ((error = VOP_ACCESS(vp, VADMIN, cred, td))) return (error); /* @@ -2053,7 +2059,8 @@ tmpfs_chown(struct vnode *vp, uid_t uid, gid_t gid, struct ucred *cred, node->tn_status |= TMPFS_NODE_CHANGED; - if ((node->tn_mode & (S_ISUID | S_ISGID)) && (ouid != uid || ogid != gid)) { + if ((node->tn_mode & (S_ISUID | S_ISGID)) != 0 && + (ouid != uid || ogid != gid)) { if (priv_check_cred(cred, PRIV_VFS_RETAINSUGID)) { newmode = node->tn_mode & ~(S_ISUID | S_ISGID); atomic_store_short(&node->tn_mode, newmode); @@ -2072,7 +2079,7 @@ tmpfs_chown(struct vnode *vp, uid_t uid, gid_t gid, struct ucred *cred, */ int tmpfs_chsize(struct vnode *vp, u_quad_t size, struct ucred *cred, - struct thread *p) + struct thread *td) { int error; struct tmpfs_node *node; @@ -2131,7 +2138,7 @@ tmpfs_chsize(struct vnode *vp, u_quad_t size, struct ucred *cred, */ int tmpfs_chtimes(struct vnode *vp, struct vattr *vap, - struct ucred *cred, struct thread *l) + struct ucred *cred, struct thread *td) { int error; struct tmpfs_node *node; @@ -2148,21 +2155,17 @@ tmpfs_chtimes(struct vnode *vp, struct vattr *vap, if (node->tn_flags & (IMMUTABLE | APPEND)) return (EPERM); - error = vn_utimes_perm(vp, vap, cred, l); + error = vn_utimes_perm(vp, vap, cred, td); if (error != 0) return (error); if (vap->va_atime.tv_sec != VNOVAL) node->tn_accessed = true; - if (vap->va_mtime.tv_sec != VNOVAL) node->tn_status |= TMPFS_NODE_MODIFIED; - if (vap->va_birthtime.tv_sec != VNOVAL) node->tn_status |= TMPFS_NODE_MODIFIED; - tmpfs_itimes(vp, &vap->va_atime, &vap->va_mtime); - if (vap->va_birthtime.tv_sec != VNOVAL) node->tn_birthtime = vap->va_birthtime; ASSERT_VOP_ELOCKED(vp, "chtimes2");