From nobody Fri Jan 20 03:23:24 2023 X-Original-To: dev-commits-src-all@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 4NylFT2Bl1z30vCK; Fri, 20 Jan 2023 03:23:25 +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 4NylFT0mtWz3nB4; Fri, 20 Jan 2023 03:23:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674185005; 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=HAVfhn2R+opd/9oOmRP1cX0ThFZ1o8vo2pZMYOAjkQY=; b=g+Lnoy1G9M3OWzz7mSo+i9t6jaavg09WAdak2DLCXuV02O/cR0uv9DjjrZa53ZD0GrbyYq QG5xWZwHIzG6kW4TbIDQlsrAr37lnUwq02uSiWXhvqnx0tdS88BYJPJhN3VSk1KvG8PKzs oEqwcRsAPkFc9an6WLFkb7txo8viu+W1j8qs95aRSYcBChBoPxw/kK2g1nnVgaY855RsVD XR1KYq/EeF95vk7jxlXOO4v2sXBhDoARDROeEvTquZxyS7SiNrp1NbGMELaEnFe4jgmrTG ysAb/FqEVkXgX3A2IgWXJENmRgrSJ9kFvldDpv3i+O+LY5Hf1f0g7oJKt7hIeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674185005; 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=HAVfhn2R+opd/9oOmRP1cX0ThFZ1o8vo2pZMYOAjkQY=; b=BhYtwJpdznL9cU7G7osmBMlFs5jPItC9od1Y1lL8bm1IA20QTXbBbCOsMETXNP8TSkUntL CBOM3cEj4sXeouWnv/8BSyQpZQRR98B2cHuT21YYFWobJ7/lvhA7+8aCdweliu1tw1Uj6q jn4aUxmxArIFdrkPHaZH9UluU8HZDBY8F8IGPpdU/hWTitCq+c6hHpHvvro8Y8nhmPzR0G epboHbHV9uaJzQjZC+Mg+06kjddA1+t77d9WH3Nzj5Zicds5w4vehbDtch9+5FMvJindUt 0T50HPpaKQt7puDo+KiQPPRqtxjTEJboMdPRggoOBtxmgtg+4g67Hma1sISPLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674185005; a=rsa-sha256; cv=none; b=Kziqm214CQpJqLj+P3gynI3qUzG7Zc0AiSBiIzqg1ruQdXjXjr4OpGqcd+vSqrHJurkxwa j0vCnpuP2kjjdI2JSczvDtAihR9V94RP28UnHL2QuIBmJENeZLzZKcTRRPRBzdMyypfO8q ZX/izjyFaVISQqjPoFzekX3pPEXt0+r1hZtjOXo8YxnLH/gWx0MJ248Psk9SghraS689l6 rYJdo8F8QewKkBwoZjAOpdDQTdeDUBOdrwh5G5OuivnExFEsaTLpOlWKVhWw610F/HKzxA 5drrOECD7qMMQrBSBO4KWoFCmQO2csFlU40VsPVMFu5Zcvl6xlYAeP/2VsfGww== 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 4NylFS5X15zFdy; Fri, 20 Jan 2023 03:23:24 +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 30K3NOgv042116; Fri, 20 Jan 2023 03:23:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30K3NOpG042115; Fri, 20 Jan 2023 03:23:24 GMT (envelope-from git) Date: Fri, 20 Jan 2023 03:23:24 GMT Message-Id: <202301200323.30K3NOpG042115@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 9b2f554dca7d - stable/13 - Add 'show tmpfs' ddb command List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9b2f554dca7d3a8104a760df69e011acec592df9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9b2f554dca7d3a8104a760df69e011acec592df9 commit 9b2f554dca7d3a8104a760df69e011acec592df9 Author: Konstantin Belousov AuthorDate: 2022-10-20 14:30:00 +0000 Commit: Konstantin Belousov CommitDate: 2023-01-20 03:19:01 +0000 Add 'show tmpfs' ddb command Tested by: pho (cherry picked from commit 83aff0f08c525ea3c394f3dd6598665cd369d53c) --- sys/fs/tmpfs/tmpfs_vfsops.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index b8ecedbb0348..c80042286948 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -43,6 +43,7 @@ * allocate and release resources. */ +#include "opt_ddb.h" #include "opt_tmpfs.h" #include @@ -696,3 +697,44 @@ struct vfsops tmpfs_vfsops = { .vfs_uninit = tmpfs_uninit, }; VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); + +#ifdef DDB +#include + +static void +db_print_tmpfs(struct mount *mp, struct tmpfs_mount *tmp) +{ + db_printf("mp %p (%s) tmp %p\n", mp, + mp->mnt_stat.f_mntonname, tmp); + db_printf( + "\tsize max %ju pages max %lu pages used %lu\n" + "\tinodes max %ju inodes inuse %ju refcount %ju\n" + "\tmaxfilesize %ju r%c %snamecache %smtime\n", + (uintmax_t)tmp->tm_size_max, tmp->tm_pages_max, tmp->tm_pages_used, + (uintmax_t)tmp->tm_nodes_max, (uintmax_t)tmp->tm_nodes_inuse, + (uintmax_t)tmp->tm_refcount, (uintmax_t)tmp->tm_maxfilesize, + tmp->tm_ronly ? 'o' : 'w', tmp->tm_nonc ? "no" : "", + tmp->tm_nomtime ? "no" : ""); +} + +DB_SHOW_COMMAND(tmpfs, db_show_tmpfs) +{ + struct mount *mp; + struct tmpfs_mount *tmp; + + if (have_addr) { + mp = (struct mount *)addr; + tmp = VFS_TO_TMPFS(mp); + db_print_tmpfs(mp, tmp); + return; + } + + TAILQ_FOREACH(mp, &mountlist, mnt_list) { + if (strcmp(mp->mnt_stat.f_fstypename, tmpfs_vfsconf.vfc_name) == + 0) { + tmp = VFS_TO_TMPFS(mp); + db_print_tmpfs(mp, tmp); + } + } +} +#endif /* DDB */