Subject: kern/36466: nfs_socket.c doesn't compile when NFS is not defined
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Min Sik Kim <minskim@NetBSD.org>
List: netbsd-bugs
Date: 06/10/2007 07:20:00
>Number: 36466
>Category: kern
>Synopsis: nfs_socket.c doesn't compile when NFS is not defined
>Confidential: no
>Severity: critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jun 10 07:20:00 +0000 2007
>Originator: Min Sik Kim
>Release: NetBSD 4.99.20
>Organization:
>Environment:
System: NetBSD sulley 4.99.20 NetBSD 4.99.20 (SULLEY) #5: Sat Jun 9 21:37:12 PDT 2007 minskim@sulley:/usr/obj/sys/arch/i386/compile/SULLEY i386
Architecture: i386
Machine: i386
>Description:
Compiling nfs_socket.c fails with the following error:
# compile SULLEY/nfs_socket.o
/usr/src/../tools/bin/i386--netbsdelf-gcc -ffreestanding -fno-zero-initialized-in-bss -march=i486 -mtune=pentiumpro -O2 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-sign-compare -Wno-pointer-sign -Wno-attributes -Wextra -Wno-unused-parameter -fno-strict-aliasing -Di386 -I. -I/usr/src/sys/contrib/dev/ath/netbsd -I/usr/src/sys/../common/include -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DUMASS_DEBUG -DLKM -DIPSEC_DEBUG -DMAXUSERS=32 -D_KERNEL -D_KERNEL_OPT -I/usr/src/sys/lib/libkern/../../../common/lib/libc/quad -I/usr/src/sys/lib/libkern/../../../common/lib/libc/string -I/usr/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/string -I/usr/src/sys/dist/pf -c /usr/src/sys/nfs/nfs_socket.c
cc1: warnings being treated as errors
/usr/src/sys/nfs/nfs_socket.c:1736: warning: 'nfs_sndlock' defined but not used
/usr/src/sys/nfs/nfs_socket.c:1775: warning: 'nfs_sndunlock' defined but not used
nfs_sndlock() and nfs_sndunlock() are static functions and used by
those functions that are not compiled when NFS is not defined.
>How-To-Repeat:
Build the kernel with commenting out the NFS option in the
configuration file.
>Fix:
Do not compile nfs_sndlock() and nfs_sndunlock() when NFS is not
defined. See the following patch:
Index: sys/nfs/nfs_socket.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_socket.c,v
retrieving revision 1.157
diff -u -r1.157 nfs_socket.c
--- sys/nfs/nfs_socket.c 1 Jun 2007 11:56:03 -0000 1.157
+++ sys/nfs/nfs_socket.c 10 Jun 2007 05:33:14 -0000
@@ -169,8 +169,10 @@
struct callout nfs_timer_ch = CALLOUT_INITIALIZER_SETFUNC(nfs_timer, NULL);
+#ifdef NFS
static int nfs_sndlock(struct nfsmount *, struct nfsreq *);
static void nfs_sndunlock(struct nfsmount *);
+#endif /* NFS */
static int nfs_rcvlock(struct nfsmount *, struct nfsreq *);
static void nfs_rcvunlock(struct nfsmount *);
@@ -1725,6 +1727,7 @@
return (0);
}
+#ifdef NFS
/*
* Lock a socket against others.
* Necessary for STREAM sockets to ensure you get an entire rpc request/reply
@@ -1781,6 +1784,7 @@
cv_signal(&nmp->nm_sndcv);
mutex_exit(&nmp->nm_lock);
}
+#endif /* NFS */
static int
nfs_rcvlock(struct nfsmount *nmp, struct nfsreq *rep)