diff options
| author | Rick Macklem <rmacklem@FreeBSD.org> | 2026-09-06 20:40:34 +0000 |
|---|---|---|
| committer | Rick Macklem <rmacklem@FreeBSD.org> | 2026-09-06 20:40:34 +0000 |
| commit | 407d7177057d152f18b31773eaade93311113505 (patch) | |
| tree | a220caa3864cf84f62ba5b4f0fb4d782ac58faec | |
| parent | e8018942942e212ba5a664f0265f1101e6c48930 (diff) | |
nfsd: Clean up the "glue" for the nfsrdma.ko module
Move svc_reg() calls into a helper function so that the nfsrdma.ko
can call that. Create a new nfs_extern.h as a place to put the
nfs stuff that server side NFS over RDMA needs to access, with a
prototype for the helper function and a couple of definitions that
probably shouldn't be in svc.h.
No semantics change.
MFC after: 3 months
Fixes: 7144a1d58c5c ("nfsd: Add glue for the nfsrdma.ko module")
| -rw-r--r-- | sys/fs/nfsserver/nfs_nfsdkrpc.c | 28 | ||||
| -rw-r--r-- | sys/fs/nfsserver/nfs_nfsdport.c | 2 | ||||
| -rw-r--r-- | sys/rpc/svc.h | 2 |
3 files changed, 18 insertions, 14 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdkrpc.c b/sys/fs/nfsserver/nfs_nfsdkrpc.c index 20b76d6152cd..d96a8c354276 100644 --- a/sys/fs/nfsserver/nfs_nfsdkrpc.c +++ b/sys/fs/nfsserver/nfs_nfsdkrpc.c @@ -39,6 +39,7 @@ #include "opt_kern_tls.h" #include <fs/nfs/nfsport.h> +#include <fs/nfs/nfs_extern.h> #include <rpc/rpc.h> #include <rpc/rpcsec_gss.h> @@ -105,7 +106,6 @@ static int nfs_proc(struct nfsrv_descript *, u_int32_t, SVCXPRT *xprt, struct nfsrvcache **); extern u_long sb_max_adj; -extern int newnfs_numnfsd; extern time_t nfsdev_time; extern int nfsrv_writerpc[NFS_NPROCS]; extern volatile int nfsrv_devidcnt; @@ -555,6 +555,21 @@ nfssvc_loss(SVCXPRT *xprt) } /* + * Register xprt with the correct versions of NFS. + */ +void +nfsrv_svc_reg(SVCXPRT *xprt) +{ + + if (VNET(nfs_minvers) == NFS_VER2) + svc_reg(xprt, NFS_PROG, NFS_VER2, nfssvc_program, NULL); + if (VNET(nfs_minvers) <= NFS_VER3 && VNET(nfs_maxvers) >= NFS_VER3) + svc_reg(xprt, NFS_PROG, NFS_VER3, nfssvc_program, NULL); + if (VNET(nfs_maxvers) >= NFS_VER4) + svc_reg(xprt, NFS_PROG, NFS_VER4, nfssvc_program, NULL); +} + +/* * Adds a socket to the list for servicing by nfsds. */ int @@ -585,16 +600,7 @@ nfsrvd_addsock(struct file *fp) fp->f_ops = &badfileops; fp->f_data = NULL; xprt->xp_sockref = ++sockref; - if (VNET(nfs_minvers) == NFS_VER2) - svc_reg(xprt, NFS_PROG, NFS_VER2, nfssvc_program, - NULL); - if (VNET(nfs_minvers) <= NFS_VER3 && - VNET(nfs_maxvers) >= NFS_VER3) - svc_reg(xprt, NFS_PROG, NFS_VER3, nfssvc_program, - NULL); - if (VNET(nfs_maxvers) >= NFS_VER4) - svc_reg(xprt, NFS_PROG, NFS_VER4, nfssvc_program, - NULL); + nfsrv_svc_reg(xprt); if (so->so_type == SOCK_STREAM) svc_loss_reg(xprt, nfssvc_loss); SVC_RELEASE(xprt); diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index cfc0cea2195e..6d7f93c123f0 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -43,6 +43,7 @@ */ #include <fs/nfs/nfsport.h> +#include <fs/nfs/nfs_extern.h> #include <security/mac/mac_framework.h> #include <sys/callout.h> #include <sys/filio.h> @@ -59,7 +60,6 @@ FEATURE(nfsd, "NFSv4 server"); extern u_int32_t newnfs_true, newnfs_false, newnfs_xdrneg1; extern int nfsrv_useacl; -extern int newnfs_numnfsd; extern int nfsrv_sessionhashsize; extern struct nfslayouthash *nfslayouthash; extern int nfsrv_layouthashsize; diff --git a/sys/rpc/svc.h b/sys/rpc/svc.h index a7cbb639f48e..537dad0fdb65 100644 --- a/sys/rpc/svc.h +++ b/sys/rpc/svc.h @@ -350,8 +350,6 @@ typedef struct __rpc_svcpool { */ typedef int svc_rdma_listen_ftype(SVCPOOL *pool, int port); extern svc_rdma_listen_ftype *svc_rdma_listen; -extern int nfsrvd_rdma_port; -extern int newnfs_numnfsd; /* * Operations defined on an SVCXPRT handle |
