The branch main has been updated by jrtc27:

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

commit b61239ef83d671f04c3f9d3ace96cb07e0c9e6df
Author:     Jessica Clarke <jrt...@freebsd.org>
AuthorDate: 2025-06-16 21:33:18 +0000
Commit:     Jessica Clarke <jrt...@freebsd.org>
CommitDate: 2025-06-16 21:33:18 +0000

    msdosfs: Add _WANT_MSDOSFS_INTERNALS to replace MAKEFS in headers
    
    This lets other bits of userspace expose these various definitions too.
    In particular, this will be used by libprocstat so it can stop defining
    _KERNEL.
    
    The function prototypes surely won't be useful in other contexts, but
    the various types are, and it's not worth hiding the prototypes unless
    they end up causing issues, but so long as they aren't called they
    shouldn't be a problem.
    
    Note the MAKEFS define continues to exist, but only for use in
    newfs_msdos, as those sources are reused by makefs with some changed
    behaviour.
    
    Reviewed by:    imp, markj
    Differential Revision:  https://reviews.freebsd.org/D50718
---
 sys/fs/msdosfs/denode.h            |  4 ++--
 sys/fs/msdosfs/fat.h               |  4 ++--
 sys/fs/msdosfs/msdosfsmount.h      | 10 +++++-----
 usr.sbin/makefs/msdos/Makefile.inc |  2 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/sys/fs/msdosfs/denode.h b/sys/fs/msdosfs/denode.h
index 0d31b0583fa6..e6928fb46052 100644
--- a/sys/fs/msdosfs/denode.h
+++ b/sys/fs/msdosfs/denode.h
@@ -212,7 +212,7 @@ struct denode {
             ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), 
\
         putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16))
 
-#if defined(_KERNEL) || defined(MAKEFS)
+#if defined(_KERNEL) || defined(_WANT_MSDOSFS_INTERNALS)
 
 #define        VTODE(vp)       ((struct denode *)(vp)->v_data)
 #define        DETOV(de)       ((de)->de_vnode)
@@ -294,5 +294,5 @@ int removede(struct denode *pdep, struct denode *dep);
 int detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred);
 int doscheckpath( struct denode *source, struct denode *target,
     daddr_t *wait_scn);
-#endif /* _KERNEL || MAKEFS */
+#endif /* _KERNEL || _WANT_MSDOSFS_INTERNALS */
 #endif /* !_FS_MSDOSFS_DENODE_H_ */
diff --git a/sys/fs/msdosfs/fat.h b/sys/fs/msdosfs/fat.h
index a88bfb94e91d..344cd5a9416d 100644
--- a/sys/fs/msdosfs/fat.h
+++ b/sys/fs/msdosfs/fat.h
@@ -81,7 +81,7 @@
 
 #define        MSDOSFSEOF(pmp, cn)     ((((cn) | ~(pmp)->pm_fatmask) & 
CLUST_EOFS) == CLUST_EOFS)
 
-#if defined (_KERNEL) || defined(MAKEFS)
+#if defined (_KERNEL) || defined(_WANT_MSDOSFS_INTERNALS)
 /*
  * These are the values for the function argument to the function
  * fatentry().
@@ -110,5 +110,5 @@ markvoldirty(struct msdosfsmount *pmp, bool dirty)
        return (markvoldirty_upgrade(pmp, dirty, false));
 }
 
-#endif /* _KERNEL || MAKEFS */
+#endif /* _KERNEL || _WANT_MSDOSFS_INTERNALS */
 #endif /* !_FS_MSDOSFS_FAT_H_ */
diff --git a/sys/fs/msdosfs/msdosfsmount.h b/sys/fs/msdosfs/msdosfsmount.h
index adfc7e4d0e88..fcaac544a74d 100644
--- a/sys/fs/msdosfs/msdosfsmount.h
+++ b/sys/fs/msdosfs/msdosfsmount.h
@@ -52,10 +52,10 @@
 #ifndef _MSDOSFS_MSDOSFSMOUNT_H_
 #define        _MSDOSFS_MSDOSFSMOUNT_H_
 
-#if defined (_KERNEL) || defined(MAKEFS)
+#if defined(_KERNEL) || defined(_WANT_MSDOSFS_INTERNALS)
 
 #include <sys/types.h>
-#ifndef MAKEFS
+#ifdef _KERNEL
 #include <sys/lock.h>
 #include <sys/lockmgr.h>
 #else
@@ -246,9 +246,9 @@ struct msdosfs_fileno {
 #define        MSDOSFS_ASSERT_MP_LOCKED(pmp) \
        lockmgr_assert(&(pmp)->pm_fatlock, KA_XLOCKED)
 
-#endif /* _KERNEL || MAKEFS */
+#endif /* _KERNEL || _WANT_MSDOSFS_INTERNALS */
 
-#ifndef MAKEFS
+#ifdef _KERNEL
 /*
  *  Arguments to mount MSDOS filesystems.
  */
@@ -266,7 +266,7 @@ struct msdosfs_args {
        char    *cs_local;      /* Local Charset */
        mode_t  dirmask;        /* dir  mask to be applied for msdosfs perms */
 };
-#endif /* MAKEFS */
+#endif /* _KERNEL */
 
 /*
  * Msdosfs mount options:
diff --git a/usr.sbin/makefs/msdos/Makefile.inc 
b/usr.sbin/makefs/msdos/Makefile.inc
index 78ddc7804b31..cfa9e0e114c2 100644
--- a/usr.sbin/makefs/msdos/Makefile.inc
+++ b/usr.sbin/makefs/msdos/Makefile.inc
@@ -3,7 +3,7 @@ MSDOS_NEWFS=    ${SRCTOP}/sbin/newfs_msdos
 
 .PATH: ${SRCDIR}/msdos ${MSDOS} ${MSDOS_NEWFS}
 
-CFLAGS+= -DMAKEFS -I${MSDOS} -I${MSDOS_NEWFS}
+CFLAGS+= -DMAKEFS -D_WANT_MSDOSFS_INTERNALS -I${MSDOS} -I${MSDOS_NEWFS}
 
 SRCS+= mkfs_msdos.c
 SRCS+= msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_lookup.c

Reply via email to