Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jun 2025 21:37:27 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: b4f9be7fb371 - main - openzfs: Add a _WANT_ZNODE that defines struct znode / znode_t for userspace
Message-ID:  <202506162137.55GLbRnE073127@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=b4f9be7fb371aa84881d12089d42df5ef14d3e89

commit b4f9be7fb371aa84881d12089d42df5ef14d3e89
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2025-06-16 21:34:12 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2025-06-16 21:34:12 +0000

    openzfs: Add a _WANT_ZNODE that defines struct znode / znode_t for userspace
    
    Note that ZNODE_OS_FIELDS needs to change to using struct vnode over
    vnode_t (matching struct zfsvfs rather than vnode_t) since vnode_t is
    only defined in the kernel SPL, not the userspace SPL (libspl).
    
    Whilst here, tidy up the includes and clarify a comment.
    
    Reviewed by:    imp, markj
    Differential Revision:  https://reviews.freebsd.org/D50720
---
 sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h | 9 ++++++++-
 sys/contrib/openzfs/include/sys/zfs_vfsops.h                    | 2 +-
 sys/contrib/openzfs/include/sys/zfs_znode.h                     | 5 ++++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h
index b292818750d9..15e3affba0e8 100644
--- a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h
+++ b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h
@@ -29,6 +29,7 @@
 #ifndef	_FREEBSD_ZFS_SYS_ZNODE_IMPL_H
 #define	_FREEBSD_ZFS_SYS_ZNODE_IMPL_H
 
+#ifdef _KERNEL
 #include <sys/list.h>
 #include <sys/dmu.h>
 #include <sys/sa.h>
@@ -42,6 +43,7 @@
 #include <sys/zfs_project.h>
 #include <vm/vm_object.h>
 #include <sys/uio.h>
+#endif
 
 #ifdef	__cplusplus
 extern "C" {
@@ -54,7 +56,7 @@ extern "C" {
  */
 #define	ZNODE_OS_FIELDS                 \
 	struct zfsvfs	*z_zfsvfs;      \
-	vnode_t		*z_vnode;       \
+	struct vnode	*z_vnode;       \
 	char		*z_cached_symlink;	\
 	uint64_t		z_uid;          \
 	uint64_t		z_gid;          \
@@ -62,6 +64,8 @@ extern "C" {
 	uint64_t		z_atime[2];     \
 	uint64_t		z_links;
 
+#ifdef _KERNEL
+
 #define	ZFS_LINK_MAX	UINT64_MAX
 
 /*
@@ -183,6 +187,9 @@ extern int zfs_znode_parent_and_name(struct znode *zp, struct znode **dzpp,
     char *buf, uint64_t buflen);
 
 extern int zfs_rlimit_fsize(off_t fsize);
+
+#endif	/* _KERNEL */
+
 #ifdef	__cplusplus
 }
 #endif
diff --git a/sys/contrib/openzfs/include/sys/zfs_vfsops.h b/sys/contrib/openzfs/include/sys/zfs_vfsops.h
index 18cc31e7183f..8b8f73cf3540 100644
--- a/sys/contrib/openzfs/include/sys/zfs_vfsops.h
+++ b/sys/contrib/openzfs/include/sys/zfs_vfsops.h
@@ -27,7 +27,7 @@
 #ifndef _SYS_ZFS_VFSOPS_H
 #define	_SYS_ZFS_VFSOPS_H
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_WANT_ZNODE)
 #include <sys/zfs_vfsops_os.h>
 #endif
 
diff --git a/sys/contrib/openzfs/include/sys/zfs_znode.h b/sys/contrib/openzfs/include/sys/zfs_znode.h
index b3a267e16f3e..2fedaff78534 100644
--- a/sys/contrib/openzfs/include/sys/zfs_znode.h
+++ b/sys/contrib/openzfs/include/sys/zfs_znode.h
@@ -163,8 +163,9 @@ extern int zfs_obj_to_pobj(objset_t *osp, sa_handle_t *hdl,
     sa_attr_type_t *sa_table, uint64_t *pobjp, int *is_xattrdir);
 extern int zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value);
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_WANT_ZNODE)
 #include <sys/zfs_znode_impl.h>
+#include <sys/zfs_rlock.h>
 
 /*
  * Directory entry locks control access to directory entries.
@@ -219,7 +220,9 @@ typedef struct znode {
 	 */
 	ZNODE_OS_FIELDS;
 } znode_t;
+#endif
 
+#ifdef _KERNEL
 /* Verifies the znode is valid. */
 static inline int
 zfs_verify_zp(znode_t *zp)



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