- fix compilation problem for !NFSSERVER && NFS.

pointed by Tom Spindler on source-changes@.
- make nfs_srvdesc_pool static.
This commit is contained in:
yamt 2006-05-19 13:53:11 +00:00
parent 7e8ecee6be
commit b245701ca1
4 changed files with 48 additions and 35 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_socket.c,v 1.131 2006/05/18 12:44:45 yamt Exp $ */
/* $NetBSD: nfs_socket.c,v 1.132 2006/05/19 13:53:11 yamt Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1995
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.131 2006/05/18 12:44:45 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.132 2006/05/19 13:53:11 yamt Exp $");
#include "fs_nfs.h"
#include "opt_nfs.h"
@ -2574,29 +2574,6 @@ nfsrv_dorec(slp, nfsd, ndp)
return (0);
}
struct nfsrv_descript *
nfsdreq_alloc(void)
{
struct nfsrv_descript *nd;
nd = pool_get(&nfs_srvdesc_pool, PR_WAITOK);
nd->nd_cr = NULL;
return nd;
}
void
nfsdreq_free(struct nfsrv_descript *nd)
{
kauth_cred_t cr;
cr = nd->nd_cr;
if (cr != NULL) {
KASSERT(kauth_cred_getrefcnt(cr) == 1);
kauth_cred_free(cr);
}
pool_put(&nfs_srvdesc_pool, nd);
}
/*
* Search for a sleeping nfsd and wake it up.
* SIDE EFFECT: If none found, set NFSD_CHECKSLP flag, so that one of the
@ -2674,3 +2651,38 @@ again:
return error;
}
#endif /* NFSSERVER */
#if defined(NFSSERVER) || (defined(NFS) && !defined(NFS_V2_ONLY))
static struct pool nfs_srvdesc_pool;
void
nfsdreq_init(void)
{
pool_init(&nfs_srvdesc_pool, sizeof(struct nfsrv_descript),
0, 0, 0, "nfsrvdescpl", &pool_allocator_nointr);
}
struct nfsrv_descript *
nfsdreq_alloc(void)
{
struct nfsrv_descript *nd;
nd = pool_get(&nfs_srvdesc_pool, PR_WAITOK);
nd->nd_cr = NULL;
return nd;
}
void
nfsdreq_free(struct nfsrv_descript *nd)
{
kauth_cred_t cr;
cr = nd->nd_cr;
if (cr != NULL) {
KASSERT(kauth_cred_getrefcnt(cr) == 1);
kauth_cred_free(cr);
}
pool_put(&nfs_srvdesc_pool, nd);
}
#endif /* defined(NFSSERVER) || (defined(NFS) && !defined(NFS_V2_ONLY)) */

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_subs.c,v 1.163 2006/05/18 12:44:45 yamt Exp $ */
/* $NetBSD: nfs_subs.c,v 1.164 2006/05/19 13:53:11 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.163 2006/05/18 12:44:45 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.164 2006/05/19 13:53:11 yamt Exp $");
#include "fs_nfs.h"
#include "opt_nfs.h"
@ -1562,10 +1562,12 @@ nfs_init0(void)
#ifdef NFSSERVER
nfsrv_init(0); /* Init server data structures */
nfsrv_initcache(); /* Init the server request cache */
pool_init(&nfs_srvdesc_pool, sizeof(struct nfsrv_descript),
0, 0, 0, "nfsrvdescpl", &pool_allocator_nointr);
#endif /* NFSSERVER */
#if defined(NFSSERVER) || (defined(NFS) && !defined(NFS_V2_ONLY))
nfsdreq_init();
#endif /* defined(NFSSERVER) || (defined(NFS) && !defined(NFS_V2_ONLY)) */
#if defined(NFSSERVER) || !defined(NFS_V2_ONLY)
/*
* Initialize the nqnfs data structures.

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_syscalls.c,v 1.93 2006/05/18 12:44:45 yamt Exp $ */
/* $NetBSD: nfs_syscalls.c,v 1.94 2006/05/19 13:53:11 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_syscalls.c,v 1.93 2006/05/18 12:44:45 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_syscalls.c,v 1.94 2006/05/19 13:53:11 yamt Exp $");
#include "fs_nfs.h"
#include "opt_nfs.h"
@ -385,7 +385,6 @@ sys_nfssvc(l, v, retval)
#ifdef NFSSERVER
MALLOC_DEFINE(M_NFSD, "NFS daemon", "Nfs server daemon structure");
MALLOC_DEFINE(M_NFSSVC, "NFS srvsock", "Nfs server structure");
struct pool nfs_srvdesc_pool;
static struct nfssvc_sock *
nfsrv_sockalloc()

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_var.h,v 1.60 2006/05/18 12:44:45 yamt Exp $ */
/* $NetBSD: nfs_var.h,v 1.61 2006/05/19 13:53:11 yamt Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -51,7 +51,6 @@ MALLOC_DECLARE(M_NFSD);
MALLOC_DECLARE(M_NFSDIROFF);
MALLOC_DECLARE(M_NFSBIGFH);
MALLOC_DECLARE(M_NQLEASE);
extern struct pool nfs_srvdesc_pool;
struct vnode;
struct uio;
@ -232,8 +231,9 @@ int nfsdsock_lock(struct nfssvc_sock *, boolean_t);
void nfsdsock_unlock(struct nfssvc_sock *);
int nfsdsock_drain(struct nfssvc_sock *);
int nfsdsock_sendreply(struct nfssvc_sock *, struct nfsrv_descript *);
void nfsdreq_free(struct nfsrv_descript *);
void nfsdreq_init(void);
struct nfsrv_descript *nfsdreq_alloc(void);
void nfsdreq_free(struct nfsrv_descript *);
/* nfs_srvcache.c */
void nfsrv_initcache(void);