From ee31b83a3ae52c32575f43dd60bbf9dbda676277 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Fri, 28 Mar 2008 09:50:32 +0000 Subject: [PATCH] Minor changes to improve compatibility with older FreeBSD releases. --- sys/nlm/nlm_prot_clnt.c | 2 +- sys/nlm/nlm_prot_impl.c | 19 ++++++++++++++++--- sys/nlm/nlm_prot_server.c | 4 ++-- sys/nlm/nlm_prot_svc.c | 4 ++-- sys/nlm/nlm_prot_xdr.c | 2 +- sys/nlm/sm_inter_xdr.c | 2 +- sys/rpc/auth_unix.c | 2 +- sys/rpc/authunix_prot.c | 2 +- sys/rpc/clnt_dg.c | 2 +- sys/rpc/clnt_rc.c | 2 +- sys/rpc/clnt_vc.c | 2 +- sys/rpc/inet_ntop.c | 2 +- sys/rpc/inet_pton.c | 6 +++++- sys/rpc/rpc_generic.c | 6 +++++- sys/rpc/rpcb_clnt.c | 2 +- sys/rpc/svc.c | 2 +- sys/rpc/svc_auth_unix.c | 2 +- sys/rpc/svc_dg.c | 2 +- sys/rpc/svc_generic.c | 2 +- sys/rpc/svc_vc.c | 2 +- 20 files changed, 45 insertions(+), 24 deletions(-) diff --git a/sys/nlm/nlm_prot_clnt.c b/sys/nlm/nlm_prot_clnt.c index b3ae5d8935a..9a16e32a910 100644 --- a/sys/nlm/nlm_prot_clnt.c +++ b/sys/nlm/nlm_prot_clnt.c @@ -8,7 +8,7 @@ #include #include -#include "nlm_prot.h" +#include #include #ifndef lint /*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/ diff --git a/sys/nlm/nlm_prot_impl.c b/sys/nlm/nlm_prot_impl.c index 528f8a0e9de..a799414c749 100644 --- a/sys/nlm/nlm_prot_impl.c +++ b/sys/nlm/nlm_prot_impl.c @@ -36,7 +36,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#if __FreeBSD_version >= 700000 #include +#endif #include #include #include @@ -49,9 +51,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include "nlm_prot.h" -#include "sm_inter.h" -#include "nlm.h" +#include +#include +#include #include #include @@ -79,7 +81,14 @@ SYSCTL_NODE(_vfs_nlm, OID_AUTO, sysid, CTLFLAG_RW, NULL, ""); */ static int nlm_syscall_offset = SYS_nlm_syscall; static struct sysent nlm_syscall_prev_sysent; +#if __FreeBSD_version < 700000 +static struct sysent nlm_syscall_sysent = { + (sizeof(struct nlm_syscall_args) / sizeof(register_t)) | SYF_MPSAFE, + (sy_call_t *) nlm_syscall +}; +#else MAKE_SYSENT(nlm_syscall); +#endif static bool_t nlm_syscall_registered = FALSE; /* @@ -1209,7 +1218,11 @@ nlm_syscall(struct thread *td, struct nlm_syscall_args *uap) { int error; +#if __FreeBSD_version >= 700000 error = priv_check(td, PRIV_NFS_LOCKD); +#else + error = suser(td); +#endif if (error) return (error); diff --git a/sys/nlm/nlm_prot_server.c b/sys/nlm/nlm_prot_server.c index 3e4499df845..320680ad5e6 100644 --- a/sys/nlm/nlm_prot_server.c +++ b/sys/nlm/nlm_prot_server.c @@ -37,8 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include "nlm_prot.h" -#include "nlm.h" +#include +#include /**********************************************************************/ diff --git a/sys/nlm/nlm_prot_svc.c b/sys/nlm/nlm_prot_svc.c index eca6d8668f6..3b1a140d473 100644 --- a/sys/nlm/nlm_prot_svc.c +++ b/sys/nlm/nlm_prot_svc.c @@ -28,8 +28,8 @@ #include #include -#include "nlm_prot.h" -#include "nlm.h" +#include +#include #include #ifndef lint diff --git a/sys/nlm/nlm_prot_xdr.c b/sys/nlm/nlm_prot_xdr.c index 034cbbca237..d0a6c89eef9 100644 --- a/sys/nlm/nlm_prot_xdr.c +++ b/sys/nlm/nlm_prot_xdr.c @@ -3,7 +3,7 @@ * It was generated using rpcgen. */ -#include "nlm_prot.h" +#include #include #ifndef lint /*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/ diff --git a/sys/nlm/sm_inter_xdr.c b/sys/nlm/sm_inter_xdr.c index 5f754322d1d..b225078d06f 100644 --- a/sys/nlm/sm_inter_xdr.c +++ b/sys/nlm/sm_inter_xdr.c @@ -3,7 +3,7 @@ * It was generated using rpcgen. */ -#include "sm_inter.h" +#include #include __FBSDID("$FreeBSD$"); diff --git a/sys/rpc/auth_unix.c b/sys/rpc/auth_unix.c index 57824007d2a..a2f5fd20b39 100644 --- a/sys/rpc/auth_unix.c +++ b/sys/rpc/auth_unix.c @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "rpc_com.h" +#include /* auth_unix.c */ static void authunix_nextverf (AUTH *); diff --git a/sys/rpc/authunix_prot.c b/sys/rpc/authunix_prot.c index 67ab7fb4a6d..3092b1ff612 100644 --- a/sys/rpc/authunix_prot.c +++ b/sys/rpc/authunix_prot.c @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "rpc_com.h" +#include /* gids compose part of a credential; there may not be more than 16 of them */ #define NGRPS 16 diff --git a/sys/rpc/clnt_dg.c b/sys/rpc/clnt_dg.c index 87c4aa4acb8..c66ac50003b 100644 --- a/sys/rpc/clnt_dg.c +++ b/sys/rpc/clnt_dg.c @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "rpc_com.h" +#include #ifdef _FREEFALL_CONFIG diff --git a/sys/rpc/clnt_rc.c b/sys/rpc/clnt_rc.c index e7674101a7e..ab93773bb5c 100644 --- a/sys/rpc/clnt_rc.c +++ b/sys/rpc/clnt_rc.c @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "rpc_com.h" +#include static enum clnt_stat clnt_reconnect_call(CLIENT *, rpcproc_t, xdrproc_t, void *, xdrproc_t, void *, struct timeval); diff --git a/sys/rpc/clnt_vc.c b/sys/rpc/clnt_vc.c index a92d800a97a..5731e1e0070 100644 --- a/sys/rpc/clnt_vc.c +++ b/sys/rpc/clnt_vc.c @@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "rpc_com.h" +#include #define MCALL_MSG_SIZE 24 diff --git a/sys/rpc/inet_ntop.c b/sys/rpc/inet_ntop.c index 2043be34f74..d093a970345 100644 --- a/sys/rpc/inet_ntop.c +++ b/sys/rpc/inet_ntop.c @@ -27,7 +27,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "rpc_com.h" +#include /*% * WARNING: Don't even consider trying to compile this on a system where diff --git a/sys/rpc/inet_pton.c b/sys/rpc/inet_pton.c index 49bf9578438..943fad7c6bd 100644 --- a/sys/rpc/inet_pton.c +++ b/sys/rpc/inet_pton.c @@ -27,7 +27,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include "rpc_com.h" +#include + +#if __FreeBSD_version < 700000 +#define strchr index +#endif /*% * WARNING: Don't even consider trying to compile this on a system where diff --git a/sys/rpc/rpc_generic.c b/sys/rpc/rpc_generic.c index 8d4c80f87e2..ee8ee8a4806 100644 --- a/sys/rpc/rpc_generic.c +++ b/sys/rpc/rpc_generic.c @@ -58,7 +58,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include "rpc_com.h" +#include + +#if __FreeBSD_version < 700000 +#define strrchr rindex +#endif struct handle { NCONF_HANDLE *nhandle; diff --git a/sys/rpc/rpcb_clnt.c b/sys/rpc/rpcb_clnt.c index cf47f70a094..ac3a3127f7c 100644 --- a/sys/rpc/rpcb_clnt.c +++ b/sys/rpc/rpcb_clnt.c @@ -79,7 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "rpc_com.h" +#include static struct timeval tottimeout = { 60, 0 }; static const struct timeval rmttimeout = { 3, 0 }; diff --git a/sys/rpc/svc.c b/sys/rpc/svc.c index 8be98055260..d6d6d7826c4 100644 --- a/sys/rpc/svc.c +++ b/sys/rpc/svc.c @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "rpc_com.h" +#include #define SVC_VERSQUIET 0x0001 /* keep quiet about vers mismatch */ #define version_keepquiet(xp) ((u_long)(xp)->xp_p3 & SVC_VERSQUIET) diff --git a/sys/rpc/svc_auth_unix.c b/sys/rpc/svc_auth_unix.c index 3b6969d7da0..9c6cdd78fdc 100644 --- a/sys/rpc/svc_auth_unix.c +++ b/sys/rpc/svc_auth_unix.c @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include -#include "rpc_com.h" +#include #define MAX_MACHINE_NAME 255 #define NGRPS 16 diff --git a/sys/rpc/svc_dg.c b/sys/rpc/svc_dg.c index 08d59477446..666b952ee89 100644 --- a/sys/rpc/svc_dg.c +++ b/sys/rpc/svc_dg.c @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); #include -#include "rpc_com.h" +#include static enum xprt_stat svc_dg_stat(SVCXPRT *); static bool_t svc_dg_recv(SVCXPRT *, struct rpc_msg *); diff --git a/sys/rpc/svc_generic.c b/sys/rpc/svc_generic.c index 522b413f12a..1f9b2e2711d 100644 --- a/sys/rpc/svc_generic.c +++ b/sys/rpc/svc_generic.c @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "rpc_com.h" +#include extern int __svc_vc_setflag(SVCXPRT *, int); diff --git a/sys/rpc/svc_vc.c b/sys/rpc/svc_vc.c index cada2529999..54edfd0c945 100644 --- a/sys/rpc/svc_vc.c +++ b/sys/rpc/svc_vc.c @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); #include -#include "rpc_com.h" +#include static bool_t svc_vc_rendezvous_recv(SVCXPRT *, struct rpc_msg *); static enum xprt_stat svc_vc_rendezvous_stat(SVCXPRT *);