Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jun 2025 21:37:26 GMT
From:      Jessica Clarke <jrtc27@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 20aaf0f6578c - main - libprocstat: Drop all _KERNEL defines outside of zfs_defs.c
Message-ID:  <202506162137.55GLbQsu073094@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=20aaf0f6578cfb273383332fb9188548b53d2ca7

commit 20aaf0f6578cfb273383332fb9188548b53d2ca7
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2025-06-16 21:33:54 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2025-06-16 21:33:54 +0000

    libprocstat: Drop all _KERNEL defines outside of zfs_defs.c
    
    Defining _KERNEL is a historical hack that can often break due to the
    environment not actually being that of a kernel build. Now that we have
    other targeted macros we can define instead that don't have far-reaching
    implications like _KERNEL we can drop this.
    
    Reviewed by:    imp, kib, markj
    Differential Revision:  https://reviews.freebsd.org/D50719
---
 lib/libprocstat/cd9660.c  |  3 +--
 lib/libprocstat/msdosfs.c | 15 +++------------
 lib/libprocstat/smbfs.c   |  3 +--
 lib/libprocstat/udf.c     |  2 --
 lib/libprocstat/zfs.c     |  3 +--
 5 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/lib/libprocstat/cd9660.c b/lib/libprocstat/cd9660.c
index de1140145527..ec37f49df0f6 100644
--- a/lib/libprocstat/cd9660.c
+++ b/lib/libprocstat/cd9660.c
@@ -52,9 +52,8 @@
 
 #include <err.h>
 
-#define _KERNEL
+#define _WANT_ISO_MNT
 #include <isofs/cd9660/iso.h>
-#undef _KERNEL
 #include <isofs/cd9660/cd9660_node.h>
 
 #include <kvm.h>
diff --git a/lib/libprocstat/msdosfs.c b/lib/libprocstat/msdosfs.c
index bb1ad65e6b1a..01345bb8d334 100644
--- a/lib/libprocstat/msdosfs.c
+++ b/lib/libprocstat/msdosfs.c
@@ -44,17 +44,15 @@
 #include <sys/time.h>
 #include <sys/stat.h>
 #include <sys/vnode.h>
+#include <sys/mount.h>
 
 #include <netinet/in.h>
 
-#define	_KERNEL
-#include <sys/mount.h>
+#define _WANT_MSDOSFS_INTERNALS
 #include <fs/msdosfs/bpb.h>
 #include <fs/msdosfs/msdosfsmount.h>
-#undef _KERNEL
-
-#include <fs/msdosfs/denode.h>
 #include <fs/msdosfs/direntry.h>
+#include <fs/msdosfs/denode.h>
 #include <fs/msdosfs/fat.h>
 
 #include <err.h>
@@ -62,13 +60,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-/*
- * XXX -
- * VTODE is defined in denode.h only if _KERNEL is defined, but that leads to
- * header explosion
- */
-#define VTODE(vp) ((struct denode *)getvnodedata(vp))
-
 #include "libprocstat.h"
 #include "common_kvm.h"
 
diff --git a/lib/libprocstat/smbfs.c b/lib/libprocstat/smbfs.c
index 136cceacb471..cbd32cf8f597 100644
--- a/lib/libprocstat/smbfs.c
+++ b/lib/libprocstat/smbfs.c
@@ -32,9 +32,8 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/vnode.h>
-#define _KERNEL
+#define _WANT_MOUNT
 #include <sys/mount.h>
-#undef _KERNEL
 
 #include <netinet/in.h>
 
diff --git a/lib/libprocstat/udf.c b/lib/libprocstat/udf.c
index 9a110950f8b0..3298af6dec5f 100644
--- a/lib/libprocstat/udf.c
+++ b/lib/libprocstat/udf.c
@@ -32,9 +32,7 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/vnode.h>
-#define _KERNEL
 #include <sys/mount.h>
-#undef _KERNEL
 
 #include <netinet/in.h>
 
diff --git a/lib/libprocstat/zfs.c b/lib/libprocstat/zfs.c
index 665b1e5abe24..010337c1919a 100644
--- a/lib/libprocstat/zfs.c
+++ b/lib/libprocstat/zfs.c
@@ -31,9 +31,8 @@
 #include <stdbool.h>
 
 #include <sys/param.h>
-#define _KERNEL
+#define _WANT_MOUNT
 #include <sys/mount.h>
-#undef _KERNEL
 #include <sys/queue.h>
 #include <sys/stat.h>
 #include <sys/sysctl.h>



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