From nobody Fri Dec 09 12:17:34 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 4NT95B3jj4z4kPvk; Fri, 9 Dec 2022 12:17:34 +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 4NT95B33P8z3qZJ; Fri, 9 Dec 2022 12:17:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670588254; 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=DcwNu6Zffv1c9XwjNlp/k3SY97TxHoiYuP8MI3jfSBA=; b=bq0Lm/sqJ26dXbaiy9duWCaq4EJtSTEydS+fdFbax+e7goXLbMl3cowehNqow7m9+glvZt rOyAxxai7R9qy8bn8vBNEF1LhGTBw8ldO3Jncfg9k1g+LGp3s3kF8jOppwBdqXFK2+IbAI S6bS1pO99aAWPEYlcEFbeCaB5x7BnSvC1HF4BPGpFACOxts0Jjb8n4sD5qsd1TtElRKfW9 ZmOaf1BTvrPickT1bLi5GOvlYtLe+QDg7lahI5M+qRCX5TgAufkiuBt3fwTZkOrTv22ArZ izuuWY4kvP812jQARdEgPIH2AJCPOjjW7CyY5rYhAibZgB/EYUOyHPVXQ2E1bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670588254; 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=DcwNu6Zffv1c9XwjNlp/k3SY97TxHoiYuP8MI3jfSBA=; b=o2tK7g9H2WZUMc62LxLLjjk8O9IEXzkHI+k0AUFGP8LDCfFveYn+B7Uy8tUQP0KWxThGcD cD0tvFX2mUhcG6WoDMIY9GZEQJ3wzxZhVlWKmUpIeRMWTkXV/yQhn3iDgbvpffq9VdSqAQ /M1TQOFb51WhEsfA4nwQz1Hu2yL2ZaLtw0qkyV8LCyTFtoxBCFjQh6X+qx/oMWOLj5dCg2 BaIlHUvU270mxnyj0jVzsqKG8kZ8ug5a1lOiGz7McCjLugVEOI+yxTVSUd97HNmTOdcMon boFMLTulVgyiakyh4CVYTMDau51W96s7hofkhXAQt9nErH4pkvewRUK9uTtlRw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1670588254; a=rsa-sha256; cv=none; b=X8yclHb+0jj/w5LgpkeU5dZmcd1NkipXwjT53wzWrNx0jPZOkX7msUuBG1nSSbrs8AaYdd WKw3OO0BfKYIMRuy1XZcn2DHcHK0QZju2BDeIi/w9XYNF8BPAGbj4twhkbRldSaxisDoz1 FcNNd8ZYor5uxhB6aeOaKxKiF1hK5FYqP/8EeiMS7cCCpasVlo7Cuc6RKzSnvfzU2WkWGb h3e+VKZwfdFGP6mTVirIXtyfouMUFfLygJQYXJS7srgxaonG2SK5zrJre/f84ZUBua6Q9f m5nFKJxNb/MoWOkU8LU0AA/Q4bY99q4m6c8bjwP5RAHeY9TvDPKloa5jxQULjA== 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 4NT95B228fzZkW; Fri, 9 Dec 2022 12:17:34 +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 2B9CHYJh086324; Fri, 9 Dec 2022 12:17:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2B9CHYos086322; Fri, 9 Dec 2022 12:17:34 GMT (envelope-from git) Date: Fri, 9 Dec 2022 12:17:34 GMT Message-Id: <202212091217.2B9CHYos086322@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: 83aff0f08c52 - main - Add 'show tmpfs' ddb command 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: 83aff0f08c525ea3c394f3dd6598665cd369d53c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=83aff0f08c525ea3c394f3dd6598665cd369d53c commit 83aff0f08c525ea3c394f3dd6598665cd369d53c Author: Konstantin Belousov AuthorDate: 2022-10-20 14:30:00 +0000 Commit: Konstantin Belousov CommitDate: 2022-12-09 12:15:37 +0000 Add 'show tmpfs' ddb command Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37097 --- 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 7bd44decd830..51a16ae6f5cf 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 */