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
This commit is contained in:
parent
e77f2f9dc6
commit
83aff0f08c
@ -43,6 +43,7 @@
|
||||
* allocate and release resources.
|
||||
*/
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_tmpfs.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
@ -696,3 +697,44 @@ struct vfsops tmpfs_vfsops = {
|
||||
.vfs_uninit = tmpfs_uninit,
|
||||
};
|
||||
VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL);
|
||||
|
||||
#ifdef DDB
|
||||
#include <ddb/ddb.h>
|
||||
|
||||
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 */
|
||||
|
Loading…
Reference in New Issue
Block a user