Instead of switching in TI-RPC-specific logic with a function-specific
switch like HAVE_CLNT_VG_CREATE, let's use the more generic
HAVE_LIBTIRPC macro everywhere.
This simplifies ./configure (always a good thing), and makes it more
clear in the source code exactly what the extra conditionally compiled
code is for.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
AC_CHECK_HEADERS([tirpc/netconfig.h], ,
[AC_MSG_ERROR([libtirpc headers not found.])])
AC_CHECK_HEADERS([tirpc/netconfig.h], ,
[AC_MSG_ERROR([libtirpc headers not found.])])
- dnl set up HAVE_FOO for various functions
- AC_CHECK_FUNCS([getnetconfig \
- clnt_create clnt_create_timed \
- clnt_vc_create clnt_dg_create xdr_rpcb])
-
#include <rpc/rpc.h>
#include <rpc/pmap_prot.h>
#include <rpc/rpc.h>
#include <rpc/pmap_prot.h>
-#ifdef HAVE_TIRPC_NETCONFIG_H
#include <tirpc/netconfig.h>
#include <tirpc/rpc/rpcb_prot.h>
#endif
#include <tirpc/netconfig.h>
#include <tirpc/rpc/rpcb_prot.h>
#endif
* Rpcbind's local socket service does not seem to be working.
* Disable this logic for now.
*/
* Rpcbind's local socket service does not seem to be working.
* Disable this logic for now.
*/
-#else /* HAVE_XDR_RPCB */
+#else /* !HAVE_LIBTIRPC */
-#endif /* HAVE_XDR_RPCB */
+#endif /* !HAVE_LIBTIRPC */
const static rpcvers_t default_rpcb_version = RPCBVERS_4;
const static rpcvers_t default_rpcb_version = RPCBVERS_4;
+#else /* !HAVE_LIBTIRPC */
const static rpcvers_t default_rpcb_version = PMAPVERS;
const static rpcvers_t default_rpcb_version = PMAPVERS;
+#endif /* !HAVE_LIBTIRPC */
#ifdef HAVE_DECL_AI_ADDRCONFIG
/*
#ifdef HAVE_DECL_AI_ADDRCONFIG
/*
* Returns a '\0'-terminated string if successful; otherwise NULL.
* rpc_createerr.cf_stat is set to reflect the error.
*/
* Returns a '\0'-terminated string if successful; otherwise NULL.
* rpc_createerr.cf_stat is set to reflect the error.
*/
static char *nfs_gp_get_netid(const sa_family_t family,
const unsigned short protocol)
static char *nfs_gp_get_netid(const sa_family_t family,
const unsigned short protocol)
-#endif /* HAVE_XDR_RPCB */
+#endif /* HAVE_LIBTIRPC */
/*
* Extract a port number from a universal address, and terminate the
/*
* Extract a port number from a universal address, and terminate the
return (int)(status == RPC_SUCCESS);
}
return (int)(status == RPC_SUCCESS);
}
/*
* Initialize the rpcb argument for a GETADDR request.
/*
* Initialize the rpcb argument for a GETADDR request.
-#endif /* HAVE_XDR_RPCB */
+#endif /* HAVE_LIBTIRPC */
/*
* Try GETPORT request via rpcbind version 2.
/*
* Try GETPORT request via rpcbind version 2.
static unsigned short nfs_gp_getport_rpcb(CLIENT *client,
const struct sockaddr *sap,
static unsigned short nfs_gp_getport_rpcb(CLIENT *client,
const struct sockaddr *sap,
-#endif /* HAVE_XDR_RPCB */
+#endif /* HAVE_LIBTIRPC */
static unsigned long nfs_gp_getport_pmap(CLIENT *client,
const rpcprog_t program,
static unsigned long nfs_gp_getport_pmap(CLIENT *client,
const rpcprog_t program,
struct timeval timeout)
{
switch (sap->sa_family) {
struct timeval timeout)
{
switch (sap->sa_family) {
case AF_INET6:
return nfs_gp_getport_rpcb(client, sap, salen, program,
version, protocol, timeout);
case AF_INET6:
return nfs_gp_getport_rpcb(client, sap, salen, program,
version, protocol, timeout);
-#endif /* HAVE_XDR_RPCB */
+#endif /* HAVE_LIBTIRPC */
case AF_INET:
return nfs_gp_getport_pmap(client, program, version,
protocol, timeout);
case AF_INET:
return nfs_gp_getport_pmap(client, program, version,
protocol, timeout);
* address of the same address family. In this way an RPC server can
* advertise via rpcbind that it does not support AF_INET6.
*/
* address of the same address family. In this way an RPC server can
* advertise via rpcbind that it does not support AF_INET6.
*/
unsigned short nfs_rpcb_getaddr(const struct sockaddr *sap,
const socklen_t salen,
unsigned short nfs_rpcb_getaddr(const struct sockaddr *sap,
const socklen_t salen,
-#else /* HAVE_XDR_RPCB */
+#else /* !HAVE_LIBTIRPC */
unsigned short nfs_rpcb_getaddr(const struct sockaddr *sap,
const socklen_t salen,
unsigned short nfs_rpcb_getaddr(const struct sockaddr *sap,
const socklen_t salen,
-#endif /* HAVE_XDR_RPCB */
+#endif /* !HAVE_LIBTIRPC */
/**
* nfs_pmap_getport - query rpcbind via the portmap protocol (rpcbindv2)
/**
* nfs_pmap_getport - query rpcbind via the portmap protocol (rpcbindv2)
-#ifdef HAVE_TIRPC_NETCONFIG_H
/*
* Most of the headers under /usr/include/tirpc are currently
/*
* Most of the headers under /usr/include/tirpc are currently
const rpcprog_t, const rpcvers_t,
u_int, u_int);
const rpcprog_t, const rpcvers_t,
u_int, u_int);
-#endif /* HAVE_TIRPC_NETCONFIG_H */
+#endif /* HAVE_LIBTIRPC */
/*
* If "-1" is specified in the tv_sec field, use these defaults instead.
/*
* If "-1" is specified in the tv_sec field, use these defaults instead.
const rpcvers_t version,
struct timeval *timeout)
{
const rpcvers_t version,
struct timeval *timeout)
{
-#ifdef HAVE_CLNT_VC_CREATE
struct sockaddr_storage address;
const struct netbuf nbuf = {
.maxlen = sizeof(struct sockaddr_un),
.len = (size_t)salen,
.buf = &address,
};
struct sockaddr_storage address;
const struct netbuf nbuf = {
.maxlen = sizeof(struct sockaddr_un),
.len = (size_t)salen,
.buf = &address,
};
-#endif /* HAVE_CLNT_VC_CREATE */
+#endif /* HAVE_LIBTIRPC */
CLIENT *client;
int sock;
CLIENT *client;
int sock;
if (timeout->tv_sec == -1)
timeout->tv_sec = NFSRPC_TIMEOUT_TCP;
if (timeout->tv_sec == -1)
timeout->tv_sec = NFSRPC_TIMEOUT_TCP;
-#ifdef HAVE_CLNT_VC_CREATE
memcpy(nbuf.buf, sap, (size_t)salen);
client = clnt_vc_create(sock, &nbuf, program, version, 0, 0);
memcpy(nbuf.buf, sap, (size_t)salen);
client = clnt_vc_create(sock, &nbuf, program, version, 0, 0);
-#else /* HAVE_CLNT_VC_CREATE */
+#else /* !HAVE_LIBTIRPC */
client = clntunix_create((struct sockaddr_un *)sap,
program, version, &sock, 0, 0);
client = clntunix_create((struct sockaddr_un *)sap,
program, version, &sock, 0, 0);
-#endif /* HAVE_CLNT_VC_CREATE */
+#endif /* !HAVE_LIBTIRPC */
if (client != NULL)
CLNT_CONTROL(client, CLSET_FD_CLOSE, NULL);
else
if (client != NULL)
CLNT_CONTROL(client, CLSET_FD_CLOSE, NULL);
else
const rpcvers_t version,
struct timeval *timeout)
{
const rpcvers_t version,
struct timeval *timeout)
{
-#ifdef HAVE_CLNT_DG_CREATE
+ CLIENT *client;
+ int ret, sock;
+#ifdef HAVE_LIBTIRPC
struct sockaddr_storage address;
const struct netbuf nbuf = {
.maxlen = salen,
.len = salen,
.buf = &address,
};
struct sockaddr_storage address;
const struct netbuf nbuf = {
.maxlen = salen,
.len = salen,
.buf = &address,
};
-#endif /* HAVE_CLNT_DG_CREATE */
- CLIENT *client;
- int ret, sock;
-#ifndef HAVE_CLNT_DG_CREATE
+#else /* !HAVE_LIBTIRPC */
+
if (sap->sa_family != AF_INET) {
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
return NULL;
}
if (sap->sa_family != AF_INET) {
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
return NULL;
}
-#endif /* !HAVE_CLNT_DG_CREATE */
+#endif /* !HAVE_LIBTIRPC */
sock = socket((int)sap->sa_family, SOCK_DGRAM, IPPROTO_UDP);
if (sock == -1) {
sock = socket((int)sap->sa_family, SOCK_DGRAM, IPPROTO_UDP);
if (sock == -1) {
-#ifdef HAVE_CLNT_DG_CREATE
memcpy(nbuf.buf, sap, (size_t)salen);
client = clnt_dg_create(sock, &nbuf, program, version, 0, 0);
memcpy(nbuf.buf, sap, (size_t)salen);
client = clnt_dg_create(sock, &nbuf, program, version, 0, 0);
-#else /* HAVE_CLNT_DG_CREATE */
+#else /* !HAVE_LIBTIRPC */
client = clntudp_create((struct sockaddr_in *)sap, program,
version, *timeout, &sock);
client = clntudp_create((struct sockaddr_in *)sap, program,
version, *timeout, &sock);
-#endif /* HAVE_CLNT_DG_CREATE */
+#endif /* !HAVE_LIBTIRPC */
if (client != NULL) {
CLNT_CONTROL(client, CLSET_RETRY_TIMEOUT, (char *)timeout);
CLNT_CONTROL(client, CLSET_FD_CLOSE, NULL);
if (client != NULL) {
CLNT_CONTROL(client, CLSET_RETRY_TIMEOUT, (char *)timeout);
CLNT_CONTROL(client, CLSET_FD_CLOSE, NULL);
const rpcvers_t version,
struct timeval *timeout)
{
const rpcvers_t version,
struct timeval *timeout)
{
-#ifdef HAVE_CLNT_VC_CREATE
+ CLIENT *client;
+ int ret, sock;
+#ifdef HAVE_LIBTIRPC
struct sockaddr_storage address;
const struct netbuf nbuf = {
.maxlen = salen,
.len = salen,
.buf = &address,
};
struct sockaddr_storage address;
const struct netbuf nbuf = {
.maxlen = salen,
.len = salen,
.buf = &address,
};
-#endif /* HAVE_CLNT_VC_CREATE */
- CLIENT *client;
- int ret, sock;
-#ifndef HAVE_CLNT_VC_CREATE
+#else /* !HAVE_LIBTIRPC */
+
if (sap->sa_family != AF_INET) {
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
return NULL;
}
if (sap->sa_family != AF_INET) {
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
return NULL;
}
-#endif /* !HAVE_CLNT_VC_CREATE */
+#endif /* !HAVE_LIBTIRPC */
sock = socket((int)sap->sa_family, SOCK_STREAM, IPPROTO_TCP);
if (sock == -1) {
sock = socket((int)sap->sa_family, SOCK_STREAM, IPPROTO_TCP);
if (sock == -1) {
-#ifdef HAVE_CLNT_VC_CREATE
memcpy(nbuf.buf, sap, (size_t)salen);
client = clnt_vc_create(sock, &nbuf, program, version, 0, 0);
memcpy(nbuf.buf, sap, (size_t)salen);
client = clnt_vc_create(sock, &nbuf, program, version, 0, 0);
-#else /* HAVE_CLNT_VC_CREATE */
+#else /* !HAVE_LIBTIRPC */
client = clnttcp_create((struct sockaddr_in *)sap,
program, version, &sock, 0, 0);
client = clnttcp_create((struct sockaddr_in *)sap,
program, version, &sock, 0, 0);
-#endif /* HAVE_CLNT_VC_CREATE */
+#endif /* !HAVE_LIBTIRPC */
if (client != NULL)
CLNT_CONTROL(client, CLSET_FD_CLOSE, NULL);
else
if (client != NULL)
CLNT_CONTROL(client, CLSET_FD_CLOSE, NULL);
else