summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2014-04-17 15:54:34 -0700
committerAnand Avati <avati@redhat.com>2014-04-24 14:41:48 -0700
commita3cb38e3edf005bef73da4c9cfd958474a14d50f (patch)
treea406029332a9eb096c14d441160bb670a42df8cb /rpc
parent9c13471b109587a639662fc690384285bee02bc6 (diff)
build: MacOSX Porting fixes
git@forge.gluster.org:~schafdog/glusterfs-core/osx-glusterfs Working functionality on MacOSX - GlusterD (management daemon) - GlusterCLI (management cli) - GlusterFS FUSE (using OSXFUSE) - GlusterNFS (without NLM - issues with rpc.statd) Change-Id: I20193d3f8904388e47344e523b3787dbeab044ac BUG: 1089172 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Signed-off-by: Dennis Schafroth <dennis@schafroth.com> Tested-by: Harshavardhana <harsha@harshavardhana.net> Tested-by: Dennis Schafroth <dennis@schafroth.com> Reviewed-on: http://review.gluster.org/7503 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-lib/src/Makefile.am4
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c7
-rw-r--r--rpc/rpc-lib/src/rpc-drc.c2
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c39
-rw-r--r--rpc/rpc-lib/src/xdr-common.h6
-rw-r--r--rpc/rpc-lib/src/xdr-rpc.h17
-rw-r--r--rpc/rpc-transport/rdma/src/Makefile.am4
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c6
-rw-r--r--rpc/rpc-transport/socket/src/socket.c4
-rw-r--r--rpc/xdr/src/nlm4-xdr.h16
-rw-r--r--rpc/xdr/src/xdr-generic.c6
-rw-r--r--rpc/xdr/src/xdr-nfs3.h1
12 files changed, 65 insertions, 47 deletions
diff --git a/rpc/rpc-lib/src/Makefile.am b/rpc/rpc-lib/src/Makefile.am
index 4cdeaad0b4d..ee2f27b259b 100644
--- a/rpc/rpc-lib/src/Makefile.am
+++ b/rpc/rpc-lib/src/Makefile.am
@@ -2,10 +2,10 @@ lib_LTLIBRARIES = libgfrpc.la
libgfrpc_la_SOURCES = auth-unix.c rpcsvc-auth.c rpcsvc.c auth-null.c \
rpc-transport.c xdr-rpc.c xdr-rpcclnt.c rpc-clnt.c auth-glusterfs.c \
- rpc-drc.c
+ rpc-drc.c $(CONTRIBDIR)/sunrpc/xdr_sizeof.c
libgfrpc_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
-libgfrpc_la_LDFLAGS = -version-info $(LIBGFRPC_LT_VERSION)
+libgfrpc_la_LDFLAGS = -version-info $(LIBGFRPC_LT_VERSION) $(GF_LDFLAGS)
noinst_HEADERS = rpcsvc.h rpc-transport.h xdr-common.h xdr-rpc.h xdr-rpcclnt.h \
rpc-clnt.h rpcsvc-common.h protocol-common.h rpc-drc.h
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index e095c55b3d9..3106342e970 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -717,8 +717,9 @@ rpc_clnt_handle_cbk (struct rpc_clnt *clnt, rpc_transport_pollin_t *msg)
}
gf_log (clnt->conn.name, GF_LOG_TRACE,
- "received rpc message (XID: 0x%lx, "
- "Ver: %ld, Program: %ld, ProgVers: %ld, Proc: %ld) "
+ "receivd rpc message (XID: 0x%" GF_PRI_RPC_XID ", "
+ "Ver: %" GF_PRI_RPC_VERSION ", Program: %" GF_PRI_RPC_PROG_ID ", "
+ "ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC ") "
"from rpc-transport (%s)", rpc_call_xid (&rpcmsg),
rpc_call_rpcvers (&rpcmsg), rpc_call_program (&rpcmsg),
rpc_call_progver (&rpcmsg), rpc_call_progproc (&rpcmsg),
@@ -1141,7 +1142,7 @@ xdr_serialize_glusterfs_auth (char *dest, struct auth_glusterfs_parms_v2 *au)
{
ssize_t ret = -1;
XDR xdr;
- uint64_t ngroups = 0;
+ u_long ngroups = 0;
int max_groups = 0;
if ((!dest) || (!au))
diff --git a/rpc/rpc-lib/src/rpc-drc.c b/rpc/rpc-lib/src/rpc-drc.c
index 7e77e038e5d..0babb9bc43c 100644
--- a/rpc/rpc-lib/src/rpc-drc.c
+++ b/rpc/rpc-lib/src/rpc-drc.c
@@ -460,7 +460,7 @@ rpcsvc_vacate_drc_entries (rpcsvc_drc_globals_t *drc)
client = reply->client;
- (void *)rb_delete (client->rbtree, reply);
+ rb_delete (client->rbtree, reply);
rpcsvc_drc_op_destroy (drc, reply);
rpcsvc_drc_client_unref (drc, client);
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index 34ee6f21b49..f2cdfb23819 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -423,9 +423,10 @@ rpcsvc_request_create (rpcsvc_t *svc, rpc_transport_t *trans,
ret = -1;
rpcsvc_request_init (svc, trans, &rpcmsg, progmsg, msg, req);
- gf_log (GF_RPCSVC, GF_LOG_TRACE, "received rpc-message (XID: 0x%lx, "
- "Ver: %ld, Program: %ld, ProgVers: %ld, Proc: %ld) from"
- " rpc-transport (%s)", rpc_call_xid (&rpcmsg),
+ gf_log (GF_RPCSVC, GF_LOG_TRACE, "received rpc-message "
+ "(XID: 0x%" GF_PRI_RPC_XID ", Ver: %" GF_PRI_RPC_VERSION ", Program: %" GF_PRI_RPC_PROG_ID ", "
+ "ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC ") "
+ "from rpc-transport (%s)", rpc_call_xid (&rpcmsg),
rpc_call_rpcvers (&rpcmsg), rpc_call_program (&rpcmsg),
rpc_call_progver (&rpcmsg), rpc_call_progproc (&rpcmsg),
trans->name);
@@ -434,8 +435,9 @@ rpcsvc_request_create (rpcsvc_t *svc, rpc_transport_t *trans,
/* LOG- TODO: print rpc version, also print the peerinfo
from transport */
gf_log (GF_RPCSVC, GF_LOG_ERROR, "RPC version not supported "
- "(XID: 0x%lx, Ver: %ld, Prog: %ld, ProgVers: %ld, "
- "Proc: %ld) from trans (%s)", rpc_call_xid (&rpcmsg),
+ "(XID: 0x%" GF_PRI_RPC_XID ", Ver: %" GF_PRI_RPC_VERSION ", Program: %" GF_PRI_RPC_PROG_ID ", "
+ "ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC ") "
+ "from trans (%s)", rpc_call_xid (&rpcmsg),
rpc_call_rpcvers (&rpcmsg), rpc_call_program (&rpcmsg),
rpc_call_progver (&rpcmsg), rpc_call_progproc (&rpcmsg),
trans->name);
@@ -451,8 +453,9 @@ rpcsvc_request_create (rpcsvc_t *svc, rpc_transport_t *trans,
*/
rpcsvc_request_seterr (req, AUTH_ERROR);
gf_log (GF_RPCSVC, GF_LOG_ERROR, "auth failed on request. "
- "(XID: 0x%lx, Ver: %ld, Prog: %ld, ProgVers: %ld, "
- "Proc: %ld) from trans (%s)", rpc_call_xid (&rpcmsg),
+ "(XID: 0x%" GF_PRI_RPC_XID ", Ver: %" GF_PRI_RPC_VERSION ", Program: %" GF_PRI_RPC_PROG_ID ", "
+ "ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC ") "
+ "from trans (%s)", rpc_call_xid (&rpcmsg),
rpc_call_rpcvers (&rpcmsg), rpc_call_program (&rpcmsg),
rpc_call_progver (&rpcmsg), rpc_call_progproc (&rpcmsg),
trans->name);
@@ -797,15 +800,9 @@ err:
return txrecord;
}
-static inline int
-rpcsvc_get_callid (rpcsvc_t *rpc)
-{
- return GF_UNIVERSAL_ANSWER;
-}
-
int
rpcsvc_fill_callback (int prognum, int progver, int procnum, int payload,
- uint64_t xid, struct rpc_msg *request)
+ uint32_t xid, struct rpc_msg *request)
{
int ret = -1;
@@ -870,9 +867,9 @@ out:
return txrecord;
}
-struct iobuf *
+static struct iobuf *
rpcsvc_callback_build_record (rpcsvc_t *rpc, int prognum, int progver,
- int procnum, size_t payload, uint64_t xid,
+ int procnum, size_t payload, u_long xid,
struct iovec *recbuf)
{
struct rpc_msg request = {0, };
@@ -892,7 +889,7 @@ rpcsvc_callback_build_record (rpcsvc_t *rpc, int prognum, int progver,
&request);
if (ret == -1) {
gf_log ("rpcsvc", GF_LOG_WARNING, "cannot build a rpc-request "
- "xid (%"PRIu64")", xid);
+ "xid (%" GF_PRI_RPC_XID ")", xid);
goto out;
}
@@ -939,7 +936,6 @@ rpcsvc_callback_submit (rpcsvc_t *rpc, rpc_transport_t *trans,
rpc_transport_req_t req;
int ret = -1;
int proglen = 0;
- uint64_t callid = 0;
if (!rpc) {
goto out;
@@ -947,15 +943,14 @@ rpcsvc_callback_submit (rpcsvc_t *rpc, rpc_transport_t *trans,
memset (&req, 0, sizeof (req));
- callid = rpcsvc_get_callid (rpc);
-
if (proghdr) {
proglen += iov_length (proghdr, proghdrcount);
}
request_iob = rpcsvc_callback_build_record (rpc, prog->prognum,
prog->progver, procnum,
- proglen, callid,
+ proglen,
+ GF_UNIVERSAL_ANSWER,
&rpchdr);
if (!request_iob) {
gf_log ("rpcsvc", GF_LOG_WARNING,
@@ -1256,7 +1251,7 @@ rpcsvc_program_register_portmap (rpcsvc_program_t *newprog, uint32_t port)
if (!(pmap_set (newprog->prognum, newprog->progver, IPPROTO_TCP,
port))) {
gf_log (GF_RPCSVC, GF_LOG_ERROR, "Could not register with"
- " portmap");
+ " portmap %d %d %u", newprog->prognum, newprog->progver, port);
goto out;
}
diff --git a/rpc/rpc-lib/src/xdr-common.h b/rpc/rpc-lib/src/xdr-common.h
index f221192adbe..78c72e509ef 100644
--- a/rpc/rpc-lib/src/xdr-common.h
+++ b/rpc/rpc-lib/src/xdr-common.h
@@ -18,8 +18,8 @@
#include <rpc/types.h>
#include <sys/types.h>
-#include <rpc/auth.h>
#include <rpc/xdr.h>
+#include <rpc/auth.h>
#include <sys/uio.h>
#ifdef __NetBSD__
@@ -68,7 +68,9 @@ enum gf_dump_procnum {
#define xdr_u_quad_t xdr_u_int64_t
#define xdr_quad_t xdr_int64_t
#define xdr_uint32_t xdr_u_int32_t
-#define uint64_t u_int64_t
+#define xdr_uint64_t xdr_u_int64_t
+
+unsigned long xdr_sizeof (xdrproc_t func, void *data);
#endif
#if defined(__NetBSD__)
diff --git a/rpc/rpc-lib/src/xdr-rpc.h b/rpc/rpc-lib/src/xdr-rpc.h
index f5f4a941e92..4663ef7966a 100644
--- a/rpc/rpc-lib/src/xdr-rpc.h
+++ b/rpc/rpc-lib/src/xdr-rpc.h
@@ -78,4 +78,21 @@ xdr_to_auth_unix_cred (char *msgbuf, int msglen, struct authunix_parms *au,
#define rpc_call_verf_flavour(call) (rpc_opaque_auth_flavour ((&(call)->ru.RM_cmb.cb_verf)))
#define rpc_call_verf_len(call) (rpc_opaque_auth_len ((&(call)->ru.RM_cmb.cb_verf)))
+
+#ifdef GF_DARWIN_HOST_OS
+#define GF_PRI_RPC_XID PRIu32
+#define GF_PRI_RPC_VERSION PRIu32
+#define GF_PRI_RPC_PROG_ID PRIu32
+#define GF_PRI_RPC_PROG_VERS PRIu32
+#define GF_PRI_RPC_PROC PRIu32
+#define GF_PRI_RPC_PROC_VERSION PRIu32
+#else
+#define GF_PRI_RPC_XID PRIu64
+#define GF_PRI_RPC_VERSION PRIu64
+#define GF_PRI_RPC_PROG_ID PRIu64
+#define GF_PRI_RPC_PROG_VERS PRIu64
+#define GF_PRI_RPC_PROC PRIu64
+#define GF_PRI_RPC_PROC_VERSION PRIu64
+#endif
+
#endif
diff --git a/rpc/rpc-transport/rdma/src/Makefile.am b/rpc/rpc-transport/rdma/src/Makefile.am
index 2bf7cf2386a..e66006e52fe 100644
--- a/rpc/rpc-transport/rdma/src/Makefile.am
+++ b/rpc/rpc-transport/rdma/src/Makefile.am
@@ -3,7 +3,7 @@
transport_LTLIBRARIES = rdma.la
transportdir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/rpc-transport
-rdma_la_LDFLAGS = -module -avoid-version
+rdma_la_LDFLAGS = -module -avoid-version -nostartfiles
rdma_la_SOURCES = rdma.c name.c
rdma_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
@@ -11,7 +11,7 @@ rdma_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
noinst_HEADERS = rdma.h name.h
-I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/rpc/rpc-lib/src/ \
- -I$(top_srcdir)/xlators/protocol/lib/src/ -shared -nostartfiles $(GF_CFLAGS)
+ -I$(top_srcdir)/xlators/protocol/lib/src/ -shared $(GF_CFLAGS)
AM_CPPFLAGS = $(GF_CPPFLAGS) \
-I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/rpc/rpc-lib/src/ \
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index 701abdba771..c7510f6bb53 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -2027,7 +2027,7 @@ out:
}
-inline int32_t
+static inline int32_t
__gf_rdma_register_local_mr_for_rdma (gf_rdma_peer_t *peer,
struct iovec *vector, int count,
gf_rdma_post_context_t *ctx)
@@ -3074,7 +3074,7 @@ out:
}
-inline int32_t
+static inline int32_t
gf_rdma_decode_error_msg (gf_rdma_peer_t *peer, gf_rdma_post_t *post,
size_t bytes_in_post)
{
@@ -3616,7 +3616,7 @@ out:
}
-inline int32_t
+static inline int32_t
gf_rdma_recv_request (gf_rdma_peer_t *peer, gf_rdma_post_t *post,
gf_rdma_read_chunk_t *readch)
{
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index c5e8b889f88..6f566e49345 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -3346,7 +3346,7 @@ reconfigure (rpc_transport_t *this, dict_t *options)
optstr = NULL;
if (dict_get_str (this->options, "tcp-window-size",
&optstr) == 0) {
- if (gf_string2bytesize (optstr, &windowsize) != 0) {
+ if (gf_string2uint64 (optstr, &windowsize) != 0) {
gf_log (this->name, GF_LOG_ERROR,
"invalid number format: %s", optstr);
goto out;
@@ -3467,7 +3467,7 @@ socket_init (rpc_transport_t *this)
optstr = NULL;
if (dict_get_str (this->options, "tcp-window-size",
&optstr) == 0) {
- if (gf_string2bytesize (optstr, &windowsize) != 0) {
+ if (gf_string2uint64 (optstr, &windowsize) != 0) {
gf_log (this->name, GF_LOG_ERROR,
"invalid number format: %s", optstr);
return -1;
diff --git a/rpc/xdr/src/nlm4-xdr.h b/rpc/xdr/src/nlm4-xdr.h
index 4391a479019..8545694a658 100644
--- a/rpc/xdr/src/nlm4-xdr.h
+++ b/rpc/xdr/src/nlm4-xdr.h
@@ -17,13 +17,7 @@
#define _NLM_H_RPCGEN
#include <rpc/rpc.h>
-
-#if defined(__NetBSD__)
-#define xdr_u_quad_t xdr_u_int64_t
-#define xdr_quad_t xdr_int64_t
-#define xdr_uint32_t xdr_u_int32_t
-#define xdr_uint64_t xdr_u_int64_t
-#endif
+#include "xdr-common.h"
#ifdef __cplusplus
extern "C" {
@@ -33,6 +27,14 @@ extern "C" {
#define LM_MAXSTRLEN 1024
#define MAXNAMELEN 1025
+#if defined(GF_DARWIN_HOST_OS)
+#define xdr_u_quad_t xdr_u_int64_t
+#define xdr_quad_t xdr_int64_t
+#define xdr_uint32_t xdr_u_int32_t
+#define xdr_uint64_t xdr_u_int64_t
+#define uint64_t u_int64_t
+#endif
+
#if defined(__NetBSD__)
#define xdr_u_quad_t xdr_u_int64_t
#define xdr_quad_t xdr_int64_t
diff --git a/rpc/xdr/src/xdr-generic.c b/rpc/xdr/src/xdr-generic.c
index 58d1ee77ee2..ee29f3dfa4e 100644
--- a/rpc/xdr/src/xdr-generic.c
+++ b/rpc/xdr/src/xdr-generic.c
@@ -24,7 +24,7 @@ xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc)
xdrmem_create (&xdr, outmsg.iov_base, (unsigned int)outmsg.iov_len,
XDR_ENCODE);
- if (!proc (&xdr, res)) {
+ if (!proc (&xdr, res, 0)) {
ret = -1;
goto ret;
}
@@ -48,7 +48,7 @@ xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc)
xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len,
XDR_DECODE);
- if (!proc (&xdr, args)) {
+ if (!proc (&xdr, args, 0)) {
ret = -1;
goto ret;
}
@@ -72,7 +72,7 @@ xdr_to_generic_payload (struct iovec inmsg, void *args, xdrproc_t proc,
xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len,
XDR_DECODE);
- if (!proc (&xdr, args)) {
+ if (!proc (&xdr, args, 0)) {
ret = -1;
goto ret;
}
diff --git a/rpc/xdr/src/xdr-nfs3.h b/rpc/xdr/src/xdr-nfs3.h
index 6f6b0e1f9b0..3861771e299 100644
--- a/rpc/xdr/src/xdr-nfs3.h
+++ b/rpc/xdr/src/xdr-nfs3.h
@@ -95,6 +95,7 @@ enum nfsstat3 {
NFS3ERR_SERVERFAULT = 10006,
NFS3ERR_BADTYPE = 10007,
NFS3ERR_JUKEBOX = 10008,
+ NFS3ERR_END_OF_LIST = -1,
};
typedef enum nfsstat3 nfsstat3;