git: e6db4dd9d721 - main - nfsid.h: Put the nfsd_idargs structure in a new .h

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Mon, 06 Apr 2026 14:11:10 UTC
The branch main has been updated by rmacklem:

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

commit e6db4dd9d7216067388ae91ac73c3917a93f9420
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2026-04-06 14:09:01 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-04-06 14:09:01 +0000

    nfsid.h: Put the nfsd_idargs structure in a new .h
    
    This patch moves the definition of the nfsd_idargs
    structure out of nfs.h and into a new file called
    nfsid.h.
    
    This is being done so that it can be included in
    nfs_diskless.c in a future commit.
    
    There should be no semantics change from this
    commit.
    
    MFC after:      1 week
    Fixes:  8b9775912cbc ("nfs_diskless: Add support for an NFSv4 root fs")
---
 sys/fs/nfs/nfs.h             | 23 ---------------
 sys/fs/nfs/nfs_commonport.c  |  1 +
 sys/fs/nfs/nfs_commonsubs.c  |  1 +
 sys/fs/nfs/nfs_var.h         |  1 -
 sys/fs/nfs/nfsid.h           | 67 ++++++++++++++++++++++++++++++++++++++++++++
 usr.sbin/nfsuserd/nfsuserd.c |  1 +
 6 files changed, 70 insertions(+), 24 deletions(-)

diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h
index 7903542be91d..b30e4f17b7c5 100644
--- a/sys/fs/nfs/nfs.h
+++ b/sys/fs/nfs/nfs.h
@@ -235,18 +235,6 @@ struct nfscbd_args {
 	u_short	port;		/* Port# for callbacks */
 };
 
-struct nfsd_idargs {
-	int		nid_flag;	/* Flags (see below) */
-	uid_t		nid_uid;	/* user/group id */
-	gid_t		nid_gid;
-	int		nid_usermax;	/* Upper bound on user name cache */
-	int		nid_usertimeout;/* User name timeout (minutes) */
-	u_char		*nid_name;	/* Name */
-	int		nid_namelen;	/* and its length */
-	gid_t		*nid_grps;	/* and the list */
-	int		nid_ngroup;	/* Size of groups list */
-};
-
 struct nfsd_oidargs {
 	int		nid_flag;	/* Flags (see below) */
 	uid_t		nid_uid;	/* user/group id */
@@ -391,17 +379,6 @@ struct nfsreferral {
 #define	NFSLCK_WANTBITS							\
     (NFSLCK_WANTWDELEG | NFSLCK_WANTRDELEG | NFSLCK_WANTNODELEG)
 
-/* And bits for nid_flag */
-#define	NFSID_INITIALIZE	0x0001
-#define	NFSID_ADDUID		0x0002
-#define	NFSID_DELUID		0x0004
-#define	NFSID_ADDUSERNAME	0x0008
-#define	NFSID_DELUSERNAME	0x0010
-#define	NFSID_ADDGID		0x0020
-#define	NFSID_DELGID		0x0040
-#define	NFSID_ADDGROUPNAME	0x0080
-#define	NFSID_DELGROUPNAME	0x0100
-
 /*
  * fs.nfs sysctl(3) identifiers
  */
diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c
index 44fcbe2d5722..dbc2b3b942e9 100644
--- a/sys/fs/nfs/nfs_commonport.c
+++ b/sys/fs/nfs/nfs_commonport.c
@@ -40,6 +40,7 @@
  * to this BSD variant.
  */
 #include <fs/nfs/nfsport.h>
+#include <fs/nfs/nfsid.h>
 #include <sys/smp.h>
 #include <sys/sysctl.h>
 #include <sys/taskqueue.h>
diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c
index 950288027d76..78e2fbb72bdb 100644
--- a/sys/fs/nfs/nfs_commonsubs.c
+++ b/sys/fs/nfs/nfs_commonsubs.c
@@ -43,6 +43,7 @@
 #include "opt_inet6.h"
 
 #include <fs/nfs/nfsport.h>
+#include <fs/nfs/nfsid.h>
 #include <fs/nfsclient/nfsmount.h>
 
 #include <sys/extattr.h>
diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h
index 145cbf984464..2f81905f6c36 100644
--- a/sys/fs/nfs/nfs_var.h
+++ b/sys/fs/nfs/nfs_var.h
@@ -119,7 +119,6 @@ int nfsrv_delegupdate(struct nfsrv_descript *, nfsquad_t, nfsv4stateid_t *,
     vnode_t, int, struct ucred *, NFSPROC_T *, int *);
 int nfsrv_releaselckown(struct nfsstate *, nfsquad_t, NFSPROC_T *);
 void nfsrv_zapclient(struct nfsclient *, NFSPROC_T *);
-int nfssvc_idname(struct nfsd_idargs *);
 void nfsrv_servertimer(void * __unused);
 int nfsrv_getclientipaddr(struct nfsrv_descript *, struct nfsclient *);
 void nfsrv_setupstable(NFSPROC_T *);
diff --git a/sys/fs/nfs/nfsid.h b/sys/fs/nfs/nfsid.h
new file mode 100644
index 000000000000..bd9807ca1acc
--- /dev/null
+++ b/sys/fs/nfs/nfsid.h
@@ -0,0 +1,67 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Rick Macklem at The University of Guelph.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _NFS_NFSID_H_
+#define	_NFS_NFSID_H_
+
+/* Definitions for id<-->name mapping. */
+struct nfsd_idargs {
+	int		nid_flag;	/* Flags (see below) */
+	uid_t		nid_uid;	/* user/group id */
+	gid_t		nid_gid;
+	int		nid_usermax;	/* Upper bound on user name cache */
+	int		nid_usertimeout;/* User name timeout (minutes) */
+	u_char		*nid_name;	/* Name */
+	int		nid_namelen;	/* and its length */
+	gid_t		*nid_grps;	/* and the list */
+	int		nid_ngroup;	/* Size of groups list */
+};
+
+/* And bits for nid_flag */
+#define	NFSID_INITIALIZE	0x0001
+#define	NFSID_ADDUID		0x0002
+#define	NFSID_DELUID		0x0004
+#define	NFSID_ADDUSERNAME	0x0008
+#define	NFSID_DELUSERNAME	0x0010
+#define	NFSID_ADDGID		0x0020
+#define	NFSID_DELGID		0x0040
+#define	NFSID_ADDGROUPNAME	0x0080
+#define	NFSID_DELGROUPNAME	0x0100
+#define	NFSID_SYSSPACE		0x0200
+
+#if defined(_KERNEL) || defined(KERNEL)
+int nfssvc_idname(struct nfsd_idargs *);
+#endif
+
+#endif	/* _NFS_NFSID_H */
diff --git a/usr.sbin/nfsuserd/nfsuserd.c b/usr.sbin/nfsuserd/nfsuserd.c
index 058253beaf95..9326dd9018e0 100644
--- a/usr.sbin/nfsuserd/nfsuserd.c
+++ b/usr.sbin/nfsuserd/nfsuserd.c
@@ -50,6 +50,7 @@
 #include <fs/nfs/nfsproto.h>
 #include <fs/nfs/nfskpiport.h>
 #include <fs/nfs/nfs.h>
+#include <fs/nfs/nfsid.h>
 
 #include <ctype.h>
 #include <err.h>