From nobody Mon Dec 26 18:29:18 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 4NgmXG5wH8z1HKZ1; Mon, 26 Dec 2022 18:29:18 +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 4NgmXG56BMz3jVZ; Mon, 26 Dec 2022 18:29:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672079358; 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=9mvZNWbJJBFdvO+bWXQZkYS1+bc6IMiyfj7b16nXmHQ=; b=A5sdd8oNdnDpDL+MoZnPo3kJrJ/uR3LrTv6uHas4GA6AHCTdiEC13vPYpyCFbQnXV5Fdwy QNgrhFTi1dRnDJDSNM3hKoHiMOjTrUWy7Ym0uYOq2O8vcxu1G0gmHO8dHTXiCSFK6kS2I0 lju6mklIMxXOBbvMDDq8T/lMIdJxOEpeTBOp4uOZjc193gsiFnB5uQLQhgghg0Q/1hkfWs 1CGLorbNyRXxa4S/wR9xC8P+Ik2nGuJGiJv+bDggmNw59wKLj0hZNVHKdbWIEJxCdH/LqC 31TfzPVtxByHNL6vcBDlzQ0qqrXJvWOp3osAIx3SO1KxPJRSqf5go1mFKcRd0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672079358; 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=9mvZNWbJJBFdvO+bWXQZkYS1+bc6IMiyfj7b16nXmHQ=; b=b+uA+L2pE2GmRQjtO6gyR9EDjScav7/6Eo3di39P+KEW2fusKfxyHVe4AZMTbeKMvt4B9Q pJh/QKQMe0J+qSqNm7dopRn283fhbuCIMPgQU2jMbv+nSduMJXGq5ms21w1JnFEukzESz5 rJjnO0xwYFB4aQsN2MPiTORE42Im1CErqV8Ux9ipGIBmbCbFQ0w1mGVMxHKuzcuyQyG2Yx c0qdUgCaefrhPsCeosh5Uy8X6ve4OVoKsaVsN1GZ7QfcQC5ihAfrTBQ7rmFodcNo9HVxnR OzqGSXkqdqjZt/KqNcWDKujO5+Px4vvg+KIKieKiYfpMWVU2uBZsTNMsSL2a1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1672079358; a=rsa-sha256; cv=none; b=C9KTs3xxuuKoFWBZ6ZyMkW+gBQck2Chr9SGWF24gkDcQWKq4HnC482E3VRneLH9tIzDmdX h5jSaRI9iTttaCw5q7EdXLCZZYpfLaUAG5I1bAVcX/wlfZ+ALlHzE44PNuvBO/RNP4e1Cv Kl0aBPf0HKr4od0cD2RqSYIm2gUvWVE6eDm8lbFubyZ+KFZeNN9gLVfGYPKghUBQAmloPJ TvXdma73AdUArAE51tJxYnTTKShg58GzxhB2M9TAPaf4mwmQ4jG/+FWcy2hoxdV+grJVSB /nxLe9CJaFPY4Dve81aFFkaOkIxzFrA4aD51s6Jxu+2XpN8u+RtZ+EF2lIta9w== 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 4NgmXG42tLzh8q; Mon, 26 Dec 2022 18:29:18 +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 2BQITIko040017; Mon, 26 Dec 2022 18:29:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BQITI9H040016; Mon, 26 Dec 2022 18:29:18 GMT (envelope-from git) Date: Mon, 26 Dec 2022 18:29:18 GMT Message-Id: <202212261829.2BQITI9H040016@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 94267fc90774 - main - vfs: use designated initializers for the typename array 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: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 94267fc9077497bc2d70466f9e91d5b6eabb37a2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=94267fc9077497bc2d70466f9e91d5b6eabb37a2 commit 94267fc9077497bc2d70466f9e91d5b6eabb37a2 Author: Mateusz Guzik AuthorDate: 2022-12-22 13:37:17 +0000 Commit: Mateusz Guzik CommitDate: 2022-12-26 17:34:41 +0000 vfs: use designated initializers for the typename array While here prefix with v for better consistency with the vnode stuff. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D37759 --- sys/kern/vfs_subr.c | 19 +++++++++++++++---- sys/sys/vnode.h | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 63a30cbbdb3d..3c9db6763c6b 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -4145,9 +4145,20 @@ vgonel(struct vnode *vp) /* * Print out a description of a vnode. */ -static const char * const typename[] = -{"VNON", "VREG", "VDIR", "VBLK", "VCHR", "VLNK", "VSOCK", "VFIFO", "VBAD", - "VMARKER"}; +static const char *const vtypename[] = { + [VNON] = "VNON", + [VREG] = "VREG", + [VDIR] = "VDIR", + [VBLK] = "VBLK", + [VCHR] = "VCHR", + [VLNK] = "VLNK", + [VSOCK] = "VSOCK", + [VFIFO] = "VFIFO", + [VBAD] = "VBAD", + [VMARKER] = "VMARKER", +}; +_Static_assert(nitems(vtypename) == VLASTTYPE + 1, + "vnode type name not added to vtypename"); _Static_assert((VHOLD_ALL_FLAGS & ~VHOLD_NO_SMR) == 0, "new hold count flag not added to vn_printf"); @@ -4165,7 +4176,7 @@ vn_printf(struct vnode *vp, const char *fmt, ...) vprintf(fmt, ap); va_end(ap); printf("%p: ", (void *)vp); - printf("type %s\n", typename[vp->v_type]); + printf("type %s\n", vtypename[vp->v_type]); holdcnt = atomic_load_int(&vp->v_holdcnt); printf(" usecount %d, writecount %d, refcount %d seqc users %d", vp->v_usecount, vp->v_writecount, holdcnt & ~VHOLD_ALL_FLAGS, diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 89784dd4e455..5e609f810b8d 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -58,6 +58,7 @@ */ enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD, VMARKER }; +#define VLASTTYPE VMARKER enum vgetstate { VGET_NONE, VGET_HOLDCNT, VGET_USECOUNT }; /*