Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 May 2021 17:14:13 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 8b99833ac253 - main - procfs_map: switch to use vm_object_kvme_type
Message-ID:  <202105131714.14DHED5R063331@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=8b99833ac2538a74d013d101e2b5ec2d9e29d198

commit 8b99833ac2538a74d013d101e2b5ec2d9e29d198
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-05-10 15:20:42 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-05-13 17:10:35 +0000

    procfs_map: switch to use vm_object_kvme_type
    
    to get object type, and stop enumerating OBJT_XXX constants.  This also
    provides properly a pointer for the vnode, if object backs any.
    
    Reviewed by:    markj
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D30168
---
 sys/fs/procfs/procfs_map.c | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/sys/fs/procfs/procfs_map.c b/sys/fs/procfs/procfs_map.c
index 9ee49b0149a2..bd4cd2c09c00 100644
--- a/sys/fs/procfs/procfs_map.c
+++ b/sys/fs/procfs/procfs_map.c
@@ -51,6 +51,7 @@
 #include <sys/sysent.h>
 #endif
 #include <sys/uio.h>
+#include <sys/user.h>
 #include <sys/vnode.h>
 
 #include <fs/pseudofs/pseudofs.h>
@@ -85,7 +86,8 @@ procfs_doprocmap(PFS_FILL_ARGS)
 	char *fullpath, *freepath, *type;
 	struct ucred *cred;
 	vm_object_t lobj, nobj, obj, tobj;
-	int error, privateresident, ref_count, resident, shadow_count, flags;
+	int error, flags, kvme, privateresident, ref_count, resident;
+	int shadow_count;
 	vm_offset_t e_start, e_end;
 	vm_eflags_t e_eflags;
 	vm_prot_t e_prot;
@@ -155,29 +157,29 @@ procfs_doprocmap(PFS_FILL_ARGS)
 		freepath = NULL;
 		fullpath = "-";
 		if (lobj) {
-			vp = NULL;
-			switch (lobj->type) {
-			default:
-			case OBJT_DEFAULT:
-				type = "default";
-				break;
-			case OBJT_VNODE:
-				type = "vnode";
-				vp = lobj->handle;
+			kvme = vm_object_kvme_type(lobj, &vp);
+			if (vp != NULL)
 				vref(vp);
+			switch (kvme) {
+			default:
+				type = "unknown";
 				break;
-			case OBJT_SWAP_TMPFS:
-				type = "vnode";
-				if ((lobj->flags & OBJ_TMPFS) != 0) {
-					vp = lobj->un_pager.swp.swp_tmpfs;
-					vref(vp);
-				}
+			case KVME_TYPE_PHYS:
+				type = "phys";
 				break;
-			case OBJT_SWAP:
+			case KVME_TYPE_DEFAULT:
+			case KVME_TYPE_SWAP:
 				type = "swap";
 				break;
-			case OBJT_SG:
-			case OBJT_DEVICE:
+			case KVME_TYPE_DEAD:
+				type = "dead";
+				break;
+			case KVME_TYPE_VNODE:
+				type = "vnode";
+				break;
+			case KVME_TYPE_SG:
+			case KVME_TYPE_DEVICE:
+			case KVME_TYPE_MGTDEVICE:
 				type = "device";
 				break;
 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105131714.14DHED5R063331>