summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-07-14 16:26:17 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-14 15:02:50 -0700
commit47dc8def246c6338cb95e71b4656962a5f74ee90 (patch)
treec627dd8f4c0743eccd85143be1399a1e505b95f2
parent2865e149c48eb5ed028cffb12e1e5273b47f2b1d (diff)
protocol/lib: rename files to standardized names and places
- move xlators/protocol/lib/* to rpc/xdr/ - rename CLI and glusterd XDR filenames - remove xlators/protocol/lib (libgfproto1.so) Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 875 (Implement a new protocol to provide proper backward/forward compatibility) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=875
-rw-r--r--cli/src/Makefile.am4
-rw-r--r--cli/src/cli-cmd-parser.c5
-rw-r--r--cli/src/cli3_1-cops.c7
-rw-r--r--configure.ac4
-rw-r--r--libglusterfs/src/Makefile.am2
-rw-r--r--rpc/Makefile.am2
-rw-r--r--rpc/rpc-lib/src/Makefile.am5
-rw-r--r--rpc/rpc-lib/src/protocol-common.h (renamed from xlators/protocol/lib/src/protocol-common.h)0
-rw-r--r--rpc/rpc-transport/socket/src/Makefile.am2
-rw-r--r--rpc/rpc-transport/socket/src/socket.c5
-rw-r--r--rpc/xdr/Makefile.am (renamed from xlators/protocol/lib/Makefile.am)0
-rw-r--r--rpc/xdr/src/Makefile.am20
-rw-r--r--rpc/xdr/src/cli1-xdr.c (renamed from xlators/protocol/lib/src/gluster1_xdr.c)2
-rw-r--r--rpc/xdr/src/cli1-xdr.h (renamed from xlators/protocol/lib/src/gluster1.h)0
-rw-r--r--rpc/xdr/src/cli1.c (renamed from xlators/protocol/lib/src/cli-xdr.c)4
-rw-r--r--rpc/xdr/src/cli1.h (renamed from xlators/protocol/lib/src/cli-xdr.h)9
-rw-r--r--rpc/xdr/src/cli1.x (renamed from xlators/protocol/lib/src/gluster1.x)0
-rw-r--r--rpc/xdr/src/glusterd1-xdr.c (renamed from xlators/protocol/lib/src/glusterd1_xdr.c)2
-rw-r--r--rpc/xdr/src/glusterd1-xdr.h (renamed from xlators/protocol/lib/src/glusterd1.h)0
-rw-r--r--rpc/xdr/src/glusterd1.c (renamed from xlators/mgmt/glusterd/src/gd-xdr.c)2
-rw-r--r--rpc/xdr/src/glusterd1.h (renamed from xlators/mgmt/glusterd/src/gd-xdr.h)8
-rw-r--r--rpc/xdr/src/glusterd1.x (renamed from xlators/protocol/lib/src/glusterd1.x)0
-rw-r--r--rpc/xdr/src/glusterfs3-xdr.c (renamed from xlators/protocol/lib/src/glusterfs-xdr.c)2
-rw-r--r--rpc/xdr/src/glusterfs3-xdr.h (renamed from xlators/protocol/lib/src/glusterfs-xdr.h)0
-rw-r--r--rpc/xdr/src/glusterfs3.c (renamed from xlators/protocol/lib/src/msg-xdr.c)79
-rw-r--r--rpc/xdr/src/glusterfs3.h (renamed from xlators/protocol/lib/src/msg-xdr.h)18
-rw-r--r--rpc/xdr/src/glusterfs3.x (renamed from xlators/protocol/lib/src/glusterfs3.x)0
-rw-r--r--rpc/xdr/src/xdr-generic.c98
-rw-r--r--rpc/xdr/src/xdr-generic.h43
-rw-r--r--xlators/mgmt/glusterd/src/Makefile.am8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-ha.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-ha.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd3_1-mops.c3
-rw-r--r--xlators/protocol/Makefile.am2
-rw-r--r--xlators/protocol/auth/addr/src/Makefile.am5
-rw-r--r--xlators/protocol/auth/login/src/Makefile.am6
-rw-r--r--xlators/protocol/client/src/Makefile.am4
-rw-r--r--xlators/protocol/client/src/client-handshake.c3
-rw-r--r--xlators/protocol/client/src/client.c3
-rw-r--r--xlators/protocol/client/src/client.h2
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c4
-rw-r--r--xlators/protocol/legacy/server/src/Makefile.am13
-rw-r--r--xlators/protocol/legacy/server/src/authenticate.c (renamed from xlators/protocol/lib/src/authenticate.c)0
-rw-r--r--xlators/protocol/legacy/server/src/authenticate.h (renamed from xlators/protocol/lib/src/authenticate.h)0
-rw-r--r--xlators/protocol/lib/src/Makefile.am14
-rw-r--r--xlators/protocol/server/src/Makefile.am8
-rw-r--r--xlators/protocol/server/src/authenticate.c249
-rw-r--r--xlators/protocol/server/src/authenticate.h60
-rw-r--r--xlators/protocol/server/src/server-handshake.c4
-rw-r--r--xlators/protocol/server/src/server.c2
-rw-r--r--xlators/protocol/server/src/server.h2
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c4
58 files changed, 560 insertions, 180 deletions
diff --git a/cli/src/Makefile.am b/cli/src/Makefile.am
index ee6a675edba..084cad5d97c 100644
--- a/cli/src/Makefile.am
+++ b/cli/src/Makefile.am
@@ -5,7 +5,7 @@ gluster_SOURCES = cli.c registry.c input.c cli-cmd.c cli-rl.c \
cli-cmd-misc.c
gluster_LDADD = $(top_builddir)/libglusterfs/src/libglusterfs.la $(GF_LDADD)\
- $(RLLIBS) $(top_builddir)/xlators/protocol/lib/src/libgfproto1.la\
+ $(RLLIBS) $(top_builddir)/rpc/xdr/src/libgfxdr.la
$(top_builddir)/rpc/rpc-lib/src/libgfrpc.la
gluster_LDFLAGS = $(GF_LDFLAGS) $(GF_GLUSTERFS_LDFLAGS)
@@ -13,7 +13,7 @@ noinst_HEADERS = cli.h cli-mem-types.h cli-cmd.h
AM_CFLAGS = -fPIC -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)\
-I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/rpc/rpc-lib/src\
- -I$(top_srcdir)/xlators/protocol/lib/src\
+ -I$(top_srcdir)/rpc/xdr/src\
-DDATADIR=\"$(localstatedir)\" \
-DCONFDIR=\"$(sysconfdir)/glusterfs\" $(GF_GLUSTERFS_CFLAGS)
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 68c6a29c865..cffa22a7e70 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -31,9 +31,10 @@
#include "cli.h"
#include "cli-cmd.h"
#include "cli-mem-types.h"
-#include "protocol-common.h"
#include "dict.h"
-#include "gluster1.h"
+
+#include "protocol-common.h"
+#include "cli1-xdr.h"
int32_t
cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options)
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c
index 4016fee80cb..95d0a703902 100644
--- a/cli/src/cli3_1-cops.c
+++ b/cli/src/cli3_1-cops.c
@@ -24,13 +24,14 @@
#endif
#include "cli.h"
-#include "gluster1.h"
-#include "cli-xdr.h"
#include "compat-errno.h"
-#include "protocol-common.h"
#include "cli-cmd.h"
#include <sys/uio.h>
+#include "cli1-xdr.h"
+#include "cli1.h"
+#include "protocol-common.h"
+
extern rpc_clnt_prog_t *cli_rpc_prog;
int
diff --git a/configure.ac b/configure.ac
index 16ea31e6055..53d36cd6ae0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,6 +31,8 @@ AC_CONFIG_FILES([Makefile
rpc/rpc-transport/Makefile
rpc/rpc-transport/socket/Makefile
rpc/rpc-transport/socket/src/Makefile
+ rpc/xdr/Makefile
+ rpc/xdr/src/Makefile
xlators/Makefile
xlators/mount/Makefile
xlators/mount/fuse/Makefile
@@ -71,8 +73,6 @@ AC_CONFIG_FILES([Makefile
xlators/debug/io-stats/Makefile
xlators/debug/io-stats/src/Makefile
xlators/protocol/Makefile
- xlators/protocol/lib/Makefile
- xlators/protocol/lib/src/Makefile
xlators/protocol/legacy/Makefile
xlators/protocol/legacy/lib/Makefile
xlators/protocol/legacy/lib/src/Makefile
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am
index 33b34ccf7f2..1155537d5d8 100644
--- a/libglusterfs/src/Makefile.am
+++ b/libglusterfs/src/Makefile.am
@@ -1,6 +1,6 @@
libglusterfs_la_CFLAGS = -fPIC -Wall -g -shared -nostartfiles $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS)
-libglusterfs_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -D_GNU_SOURCE -DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" -D$(GF_HOST_OS) -DLIBDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/auth\" -I$(CONTRIBDIR)/rbtree -DSCHEDULERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/scheduler\" -I$(CONTRIBDIR)/md5
+libglusterfs_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -D_GNU_SOURCE -DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" -D$(GF_HOST_OS) -I$(CONTRIBDIR)/rbtree -DSCHEDULERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/scheduler\" -I$(CONTRIBDIR)/md5
libglusterfs_la_LIBADD = @LEXLIB@
diff --git a/rpc/Makefile.am b/rpc/Makefile.am
index bd435fa6d38..ffb76e901fc 100644
--- a/rpc/Makefile.am
+++ b/rpc/Makefile.am
@@ -1 +1 @@
-SUBDIRS = rpc-lib rpc-transport
+SUBDIRS = rpc-lib rpc-transport xdr
diff --git a/rpc/rpc-lib/src/Makefile.am b/rpc/rpc-lib/src/Makefile.am
index 986eb95cebc..9e37797bd1a 100644
--- a/rpc/rpc-lib/src/Makefile.am
+++ b/rpc/rpc-lib/src/Makefile.am
@@ -7,10 +7,11 @@ libgfrpc_la_SOURCES = auth-unix.c rpcsvc-auth.c rpcsvc.c auth-null.c \
libgfrpc_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
noinst_HEADERS = rpcsvc.h rpc-transport.h xdr-common.h xdr-rpc.h xdr-rpcclnt.h \
- rpc-clnt.h rpcsvc-common.h
+ rpc-clnt.h rpcsvc-common.h protocol-common.h
+
AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS)\
-I$(top_srcdir)/libglusterfs/src -shared -nostartfiles $(GF_CFLAGS) \
- -I$(top_srcdir)/xlators/protocol/lib/src \
+ -I$(top_srcdir)/rpc/xdr/src \
-DRPC_TRANSPORTDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/rpc-transport\"
CLEANFILES = *~
diff --git a/xlators/protocol/lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
index c4fc12a7042..c4fc12a7042 100644
--- a/xlators/protocol/lib/src/protocol-common.h
+++ b/rpc/rpc-lib/src/protocol-common.h
diff --git a/rpc/rpc-transport/socket/src/Makefile.am b/rpc/rpc-transport/socket/src/Makefile.am
index 46a3e12378b..2c918c7e313 100644
--- a/rpc/rpc-transport/socket/src/Makefile.am
+++ b/rpc/rpc-transport/socket/src/Makefile.am
@@ -10,6 +10,6 @@ socket_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS)\
-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)/rpc/xdr/src/ -shared -nostartfiles $(GF_CFLAGS)
CLEANFILES = *~
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 4ca7121e8af..b40a93ee821 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -32,9 +32,12 @@
#include "byte-order.h"
#include "common-utils.h"
#include "compat-errno.h"
+
+
+/* ugly #includes below */
#include "protocol-common.h"
+#include "glusterfs3-xdr.h"
-#include "glusterfs-xdr.h"
#include <fcntl.h>
#include <errno.h>
#include <netinet/tcp.h>
diff --git a/xlators/protocol/lib/Makefile.am b/rpc/xdr/Makefile.am
index af437a64d6d..af437a64d6d 100644
--- a/xlators/protocol/lib/Makefile.am
+++ b/rpc/xdr/Makefile.am
diff --git a/rpc/xdr/src/Makefile.am b/rpc/xdr/src/Makefile.am
new file mode 100644
index 00000000000..79063cd6452
--- /dev/null
+++ b/rpc/xdr/src/Makefile.am
@@ -0,0 +1,20 @@
+lib_LTLIBRARIES = libgfxdr.la
+
+libgfxdr_la_CFLAGS = -fPIC -Wall -g -shared -nostartfiles $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS)
+
+libgfxdr_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 \
+ -D_GNU_SOURCE -D$(GF_HOST_OS) \
+ -I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/rpc/rpc-lib/src
+
+libgfxdr_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
+ $(top_builddir)/rpc/rpc-lib/src/libgfrpc.la
+
+libgfxdr_la_SOURCES = xdr-generic.c \
+ glusterfs3-xdr.c glusterfs3.c \
+ cli1-xdr.c cli1.c \
+ glusterd1-xdr.c glusterd1.c
+
+noinst_HEADERS = xdr-generic.h \
+ glusterfs3-xdr.h glusterfs3.h \
+ cli1-xdr.h cli1.h \
+ glusterd1-xdr.h glusterd1.h
diff --git a/xlators/protocol/lib/src/gluster1_xdr.c b/rpc/xdr/src/cli1-xdr.c
index 9a44b9989ae..5cce70fa67f 100644
--- a/xlators/protocol/lib/src/gluster1_xdr.c
+++ b/rpc/xdr/src/cli1-xdr.c
@@ -3,7 +3,7 @@
* It was generated using rpcgen.
*/
-#include "gluster1.h"
+#include "cli1-xdr.h"
bool_t
xdr_gf1_cluster_type (XDR *xdrs, gf1_cluster_type *objp)
diff --git a/xlators/protocol/lib/src/gluster1.h b/rpc/xdr/src/cli1-xdr.h
index 81948b34aac..81948b34aac 100644
--- a/xlators/protocol/lib/src/gluster1.h
+++ b/rpc/xdr/src/cli1-xdr.h
diff --git a/xlators/protocol/lib/src/cli-xdr.c b/rpc/xdr/src/cli1.c
index ba9565261c1..008353b9fcd 100644
--- a/xlators/protocol/lib/src/cli-xdr.c
+++ b/rpc/xdr/src/cli1.c
@@ -18,8 +18,8 @@
*/
-#include "cli-xdr.h"
-
+#include "cli1.h"
+#include "xdr-generic.h"
ssize_t
gf_xdr_serialize_cli_probe_rsp (struct iovec outmsg, void *rsp)
diff --git a/xlators/protocol/lib/src/cli-xdr.h b/rpc/xdr/src/cli1.h
index 2ec4f95241e..ab67084de94 100644
--- a/xlators/protocol/lib/src/cli-xdr.h
+++ b/rpc/xdr/src/cli1.h
@@ -18,13 +18,12 @@
*/
-#ifndef _MSG_CLI_XDR_H
-#define _MSG_CLI_XDR_H
+#ifndef _CLI1_H
+#define _CLI1_H
#include <sys/uio.h>
-#include "msg-xdr.h"
-#include "gluster1.h"
+#include "cli1-xdr.h"
ssize_t
gf_xdr_serialize_cli_probe_rsp (struct iovec outmsg, void *rsp);
@@ -182,4 +181,4 @@ gf_xdr_to_cli_set_vol_rsp (struct iovec inmsg, void *args);
ssize_t
gf_xdr_from_cli_set_vol_req (struct iovec outmsg, void *req);
-#endif /* !_MSG_CLI_XDR_H */
+#endif /* !_CLI1_H */
diff --git a/xlators/protocol/lib/src/gluster1.x b/rpc/xdr/src/cli1.x
index a8af1b7d658..a8af1b7d658 100644
--- a/xlators/protocol/lib/src/gluster1.x
+++ b/rpc/xdr/src/cli1.x
diff --git a/xlators/protocol/lib/src/glusterd1_xdr.c b/rpc/xdr/src/glusterd1-xdr.c
index b35cc35804c..32e6687c866 100644
--- a/xlators/protocol/lib/src/glusterd1_xdr.c
+++ b/rpc/xdr/src/glusterd1-xdr.c
@@ -3,7 +3,7 @@
* It was generated using rpcgen.
*/
-#include "glusterd1.h"
+#include "glusterd1-xdr.h"
bool_t
xdr_gd1_mgmt_probe_req (XDR *xdrs, gd1_mgmt_probe_req *objp)
diff --git a/xlators/protocol/lib/src/glusterd1.h b/rpc/xdr/src/glusterd1-xdr.h
index ee5fb9c7db3..ee5fb9c7db3 100644
--- a/xlators/protocol/lib/src/glusterd1.h
+++ b/rpc/xdr/src/glusterd1-xdr.h
diff --git a/xlators/mgmt/glusterd/src/gd-xdr.c b/rpc/xdr/src/glusterd1.c
index c70c5697f9f..76ceea3fda9 100644
--- a/xlators/mgmt/glusterd/src/gd-xdr.c
+++ b/rpc/xdr/src/glusterd1.c
@@ -18,7 +18,7 @@
*/
-#include "gd-xdr.h"
+#include "glusterd1.h"
ssize_t
diff --git a/xlators/mgmt/glusterd/src/gd-xdr.h b/rpc/xdr/src/glusterd1.h
index 911edcf780b..44b1c546502 100644
--- a/xlators/mgmt/glusterd/src/gd-xdr.h
+++ b/rpc/xdr/src/glusterd1.h
@@ -18,13 +18,13 @@
*/
-#ifndef _MSG_GD_XDR_H
-#define _MSG_GD_XDR_H
+#ifndef _GLUSTERD1_H
+#define _GLUSTERD1_H
#include <sys/uio.h>
-#include "msg-xdr.h"
-#include "glusterd1.h"
+#include "xdr-generic.h"
+#include "glusterd1-xdr.h"
ssize_t
gd_xdr_to_mgmt_probe_req (struct iovec inmsg, void *args);
diff --git a/xlators/protocol/lib/src/glusterd1.x b/rpc/xdr/src/glusterd1.x
index 935fde4ef1b..935fde4ef1b 100644
--- a/xlators/protocol/lib/src/glusterd1.x
+++ b/rpc/xdr/src/glusterd1.x
diff --git a/xlators/protocol/lib/src/glusterfs-xdr.c b/rpc/xdr/src/glusterfs3-xdr.c
index 92b8c2ed247..164c7d0e2cb 100644
--- a/xlators/protocol/lib/src/glusterfs-xdr.c
+++ b/rpc/xdr/src/glusterfs3-xdr.c
@@ -3,7 +3,7 @@
* It was generated using rpcgen.
*/
-#include "glusterfs-xdr.h"
+#include "glusterfs3-xdr.h"
#include "iatt.h"
bool_t
diff --git a/xlators/protocol/lib/src/glusterfs-xdr.h b/rpc/xdr/src/glusterfs3-xdr.h
index a3afe8861ac..a3afe8861ac 100644
--- a/xlators/protocol/lib/src/glusterfs-xdr.h
+++ b/rpc/xdr/src/glusterfs3-xdr.h
diff --git a/xlators/protocol/lib/src/msg-xdr.c b/rpc/xdr/src/glusterfs3.c
index 9c5b8b81b38..91f53f18a5c 100644
--- a/xlators/protocol/lib/src/msg-xdr.c
+++ b/rpc/xdr/src/glusterfs3.c
@@ -18,85 +18,10 @@
*/
-#include "msg-xdr.h"
+#include "glusterfs3.h"
+#include "xdr-generic.h"
-ssize_t
-xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc)
-{
- ssize_t ret = -1;
- XDR xdr;
-
- if ((!outmsg.iov_base) || (!res) || (!proc))
- return -1;
-
- xdrmem_create (&xdr, outmsg.iov_base, (unsigned int)outmsg.iov_len,
- XDR_ENCODE);
-
- if (!proc (&xdr, res)) {
- ret = -1;
- goto ret;
- }
-
- ret = xdr_encoded_length (xdr);
-
-ret:
- return ret;
-}
-
-
-ssize_t
-xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc)
-{
- XDR xdr;
- ssize_t ret = -1;
-
- if ((!inmsg.iov_base) || (!args) || (!proc))
- return -1;
-
- xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len,
- XDR_DECODE);
-
- if (!proc (&xdr, args)) {
- ret = -1;
- goto ret;
- }
-
- ret = xdr_decoded_length (xdr);
-ret:
- return ret;
-}
-
-
-ssize_t
-xdr_to_generic_payload (struct iovec inmsg, void *args, xdrproc_t proc,
- struct iovec *pendingpayload)
-{
- XDR xdr;
- ssize_t ret = -1;
-
- if ((!inmsg.iov_base) || (!args) || (!proc))
- return -1;
-
- xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len,
- XDR_DECODE);
-
- if (!proc (&xdr, args)) {
- ret = -1;
- goto ret;
- }
-
- ret = xdr_decoded_length (xdr);
-
- if (pendingpayload) {
- pendingpayload->iov_base = xdr_decoded_remaining_addr (xdr);
- pendingpayload->iov_len = xdr_decoded_remaining_len (xdr);
- }
-
-ret:
- return ret;
-}
-
/* Encode */
ssize_t
diff --git a/xlators/protocol/lib/src/msg-xdr.h b/rpc/xdr/src/glusterfs3.h
index 364819a399b..d61335b03f1 100644
--- a/xlators/protocol/lib/src/msg-xdr.h
+++ b/rpc/xdr/src/glusterfs3.h
@@ -18,12 +18,12 @@
*/
-#ifndef _MSG_XDR_H
-#define _MSG_XDR_H
+#ifndef _GLUSTERFS3_H
+#define _GLUSTERFS3_H
#include <sys/uio.h>
-#include "glusterfs-xdr.h"
+#include "glusterfs3-xdr.h"
#define xdr_decoded_remaining_addr(xdr) ((&xdr)->x_private)
#define xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy)
@@ -498,6 +498,7 @@ xdr_to_rchecksum_rsp (struct iovec inmsg, void *args);
ssize_t
xdr_to_lk_rsp (struct iovec inmsg, void *args);
+
ssize_t
xdr_to_readdirp_rsp (struct iovec inmsg, void *args);
@@ -512,13 +513,4 @@ xdr_to_readv_rsp (struct iovec inmsg, void *args);
ssize_t
xdr_to_getspec_rsp (struct iovec inmsg, void *args);
-ssize_t
-xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc);
-
-ssize_t
-xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc);
-
-ssize_t
-xdr_to_generic_payload (struct iovec inmsg, void *args, xdrproc_t proc,
- struct iovec *pendingpayload);
-#endif /* !_MSG_XDR_H */
+#endif /* !_GLUSTERFS3_H */
diff --git a/xlators/protocol/lib/src/glusterfs3.x b/rpc/xdr/src/glusterfs3.x
index cafe965efaf..cafe965efaf 100644
--- a/xlators/protocol/lib/src/glusterfs3.x
+++ b/rpc/xdr/src/glusterfs3.x
diff --git a/rpc/xdr/src/xdr-generic.c b/rpc/xdr/src/xdr-generic.c
new file mode 100644
index 00000000000..7b953f42fe3
--- /dev/null
+++ b/rpc/xdr/src/xdr-generic.c
@@ -0,0 +1,98 @@
+/*
+ Copyright (c) 2007-2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "xdr-generic.h"
+
+
+ssize_t
+xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc)
+{
+ ssize_t ret = -1;
+ XDR xdr;
+
+ if ((!outmsg.iov_base) || (!res) || (!proc))
+ return -1;
+
+ xdrmem_create (&xdr, outmsg.iov_base, (unsigned int)outmsg.iov_len,
+ XDR_ENCODE);
+
+ if (!proc (&xdr, res)) {
+ ret = -1;
+ goto ret;
+ }
+
+ ret = xdr_encoded_length (xdr);
+
+ret:
+ return ret;
+}
+
+
+ssize_t
+xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc)
+{
+ XDR xdr;
+ ssize_t ret = -1;
+
+ if ((!inmsg.iov_base) || (!args) || (!proc))
+ return -1;
+
+ xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len,
+ XDR_DECODE);
+
+ if (!proc (&xdr, args)) {
+ ret = -1;
+ goto ret;
+ }
+
+ ret = xdr_decoded_length (xdr);
+ret:
+ return ret;
+}
+
+
+ssize_t
+xdr_to_generic_payload (struct iovec inmsg, void *args, xdrproc_t proc,
+ struct iovec *pendingpayload)
+{
+ XDR xdr;
+ ssize_t ret = -1;
+
+ if ((!inmsg.iov_base) || (!args) || (!proc))
+ return -1;
+
+ xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len,
+ XDR_DECODE);
+
+ if (!proc (&xdr, args)) {
+ ret = -1;
+ goto ret;
+ }
+
+ ret = xdr_decoded_length (xdr);
+
+ if (pendingpayload) {
+ pendingpayload->iov_base = xdr_decoded_remaining_addr (xdr);
+ pendingpayload->iov_len = xdr_decoded_remaining_len (xdr);
+ }
+
+ret:
+ return ret;
+}
diff --git a/rpc/xdr/src/xdr-generic.h b/rpc/xdr/src/xdr-generic.h
new file mode 100644
index 00000000000..7ee52fe2625
--- /dev/null
+++ b/rpc/xdr/src/xdr-generic.h
@@ -0,0 +1,43 @@
+/*
+ Copyright (c) 2007-2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef _XDR_GENERIC_H
+#define _XDR_GENERIC_H
+
+#include <sys/uio.h>
+#include <rpc/rpc.h>
+
+#define xdr_decoded_remaining_addr(xdr) ((&xdr)->x_private)
+#define xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy)
+#define xdr_encoded_length(xdr) (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base))
+#define xdr_decoded_length(xdr) (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base))
+
+
+ssize_t
+xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc);
+
+ssize_t
+xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc);
+
+ssize_t
+xdr_to_generic_payload (struct iovec inmsg, void *args, xdrproc_t proc,
+ struct iovec *pendingpayload);
+
+#endif /* !_XDR_GENERIC_H */
diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am
index defeca712b6..62435a31998 100644
--- a/xlators/mgmt/glusterd/src/Makefile.am
+++ b/xlators/mgmt/glusterd/src/Makefile.am
@@ -2,16 +2,16 @@ xlator_LTLIBRARIES = glusterd.la
xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/mgmt
glusterd_la_LDFLAGS = -module -avoidversion
glusterd_la_SOURCES = glusterd.c glusterd-handler.c glusterd-sm.c glusterd-op-sm.c \
- glusterd-utils.c glusterd3_1-mops.c gd-xdr.c glusterd-ha.c
+ glusterd-utils.c glusterd3_1-mops.c glusterd-ha.c
glusterd_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la -luuid \
- $(top_builddir)/xlators/protocol/lib/src/libgfproto1.la\
+ $(top_builddir)/rpc/xdr/src/libgfxdr.la\
$(top_builddir)/rpc/rpc-lib/src/libgfrpc.la
-noinst_HEADERS = glusterd.h gd-xdr.h glusterd-utils.h glusterd-op-sm.h glusterd-sm.h glusterd-ha.h glusterd-mem-types.h
+noinst_HEADERS = glusterd.h glusterd-utils.h glusterd-op-sm.h glusterd-sm.h glusterd-ha.h glusterd-mem-types.h
AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS)\
-I$(top_srcdir)/libglusterfs/src -shared -nostartfiles $(GF_CFLAGS)\
- -I$(rpclibdir) -L$(xlatordir)/ -I$(CONTRIBDIR)/rbtree -I$(top_srcdir)/xlators/protocol/lib/src\
+ -I$(rpclibdir) -L$(xlatordir)/ -I$(CONTRIBDIR)/rbtree -I$(top_srcdir)/rpc/xdr/src\
-I$(top_srcdir)/rpc/rpc-lib/src
CLEANFILES =
diff --git a/xlators/mgmt/glusterd/src/glusterd-ha.c b/xlators/mgmt/glusterd/src/glusterd-ha.c
index 398ecce5720..49e73703ddd 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ha.c
@@ -42,8 +42,9 @@
#include "glusterd-op-sm.h"
#include "glusterd-utils.h"
#include "glusterd-ha.h"
-#include "gd-xdr.h"
-#include "cli-xdr.h"
+
+#include "glusterd1.h"
+#include "cli1.h"
#include "rpc-clnt.h"
#include <sys/resource.h>
diff --git a/xlators/mgmt/glusterd/src/glusterd-ha.h b/xlators/mgmt/glusterd/src/glusterd-ha.h
index 6b01f90600c..42684f07364 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ha.h
+++ b/xlators/mgmt/glusterd/src/glusterd-ha.h
@@ -32,7 +32,6 @@
#include "xlator.h"
#include "logging.h"
#include "call-stub.h"
-#include "authenticate.h"
#include "fd.h"
#include "byte-order.h"
#include "glusterd.h"
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index db385d7bbb7..086e62e4e18 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -41,10 +41,11 @@
#include "glusterd-sm.h"
#include "glusterd-op-sm.h"
#include "glusterd-utils.h"
-#include "gd-xdr.h"
-#include "cli-xdr.h"
+
+#include "glusterd1.h"
+#include "cli1.h"
#include "rpc-clnt.h"
-#include "gluster1.h"
+#include "glusterd1-xdr.h"
#include <sys/resource.h>
#include <inttypes.h>
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index a9417d3ff6f..9ecb798edd7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -44,7 +44,7 @@
#include "glusterd-op-sm.h"
#include "glusterd-utils.h"
#include "glusterd-ha.h"
-#include "gluster1.h"
+#include "cli1.h"
static struct list_head gd_op_sm_queue;
glusterd_op_info_t opinfo;
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
index e080acee78e..b23fafb381d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
@@ -32,7 +32,6 @@
#include "xlator.h"
#include "logging.h"
#include "call-stub.h"
-#include "authenticate.h"
#include "fd.h"
#include "byte-order.h"
#include "glusterd.h"
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.h b/xlators/mgmt/glusterd/src/glusterd-sm.h
index 6f03a8497ef..36f7a043bb1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.h
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.h
@@ -33,7 +33,6 @@
#include "xlator.h"
#include "logging.h"
#include "call-stub.h"
-#include "authenticate.h"
#include "fd.h"
#include "byte-order.h"
//#include "glusterd.h"
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 8007fa72da9..dbc22f627f5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -32,7 +32,6 @@
#include "xlator.h"
#include "logging.h"
#include "call-stub.h"
-#include "authenticate.h"
#include "fd.h"
#include "byte-order.h"
#include "glusterd.h"
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index dcc2cd0fd50..f7f1acca7e6 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -33,13 +33,12 @@
#include "xlator.h"
#include "logging.h"
#include "call-stub.h"
-#include "authenticate.h"
#include "fd.h"
#include "byte-order.h"
#include "glusterd-mem-types.h"
#include "rpcsvc.h"
#include "glusterd-sm.h"
-#include "glusterd1.h"
+#include "glusterd1-xdr.h"
diff --git a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
index 5c2bcf25099..29e1dd6251d 100644
--- a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
+++ b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
@@ -24,8 +24,9 @@
#endif
#include "rpc-clnt.h"
+#include "glusterd1-xdr.h"
#include "glusterd1.h"
-#include "gd-xdr.h"
+
#include "compat-errno.h"
#include "glusterd-op-sm.h"
#include "glusterd-sm.h"
diff --git a/xlators/protocol/Makefile.am b/xlators/protocol/Makefile.am
index 17c9a8313f8..782567c8071 100644
--- a/xlators/protocol/Makefile.am
+++ b/xlators/protocol/Makefile.am
@@ -1 +1 @@
-SUBDIRS = lib auth legacy client server
+SUBDIRS = auth legacy client server
diff --git a/xlators/protocol/auth/addr/src/Makefile.am b/xlators/protocol/auth/addr/src/Makefile.am
index ebf20b38a84..7f1dd7445bf 100644
--- a/xlators/protocol/auth/addr/src/Makefile.am
+++ b/xlators/protocol/auth/addr/src/Makefile.am
@@ -4,9 +4,8 @@ authdir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/auth
addr_la_LDFLAGS = -module -avoidversion
addr_la_SOURCES = addr.c
-addr_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
- $(top_builddir)/xlators/protocol/lib/src/libgfproto1.la
+addr_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS)\
-I$(top_srcdir)/libglusterfs/src -shared -nostartfiles $(GF_CFLAGS) \
- -I$(top_srcdir)/xlators/protocol/lib/src
+ -I$(top_srcdir)/xlators/protocol/server/src
diff --git a/xlators/protocol/auth/login/src/Makefile.am b/xlators/protocol/auth/login/src/Makefile.am
index b3b625b6e52..b4719d1a72f 100644
--- a/xlators/protocol/auth/login/src/Makefile.am
+++ b/xlators/protocol/auth/login/src/Makefile.am
@@ -4,10 +4,8 @@ authdir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/auth
login_la_LDFLAGS = -module -avoidversion
login_la_SOURCES = login.c
-login_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
- $(top_builddir)/xlators/protocol/lib/src/libgfproto1.la
-
+login_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS)\
-I$(top_srcdir)/libglusterfs/src -shared -nostartfiles $(GF_CFLAGS) \
- -I$(top_srcdir)/xlators/protocol/lib/src
+ -I$(top_srcdir)/xlators/protocol/server/src
diff --git a/xlators/protocol/client/src/Makefile.am b/xlators/protocol/client/src/Makefile.am
index 7811e088a7e..159faf268a7 100644
--- a/xlators/protocol/client/src/Makefile.am
+++ b/xlators/protocol/client/src/Makefile.am
@@ -6,11 +6,11 @@ client_la_LDFLAGS = -module -avoidversion
client_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
$(top_builddir)/rpc/rpc-lib/src/libgfrpc.la \
- $(top_builddir)/xlators/protocol/lib/src/libgfproto1.la
+ $(top_builddir)/rpc/xdr/src/libgfxdr.la
client_la_SOURCES = client.c client-helpers.c client3_1-fops.c client-handshake.c
noinst_HEADERS = client.h client-mem-types.h
AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS) \
-I$(top_srcdir)/libglusterfs/src -shared -nostartfiles $(GF_CFLAGS) \
- -I$(top_srcdir)/xlators/protocol/lib/src -I$(top_srcdir)/rpc/rpc-lib/src/
+ -I$(top_srcdir)/rpc/xdr/src -I$(top_srcdir)/rpc/rpc-lib/src/
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index 353921ac57f..31690ef17b8 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -26,10 +26,11 @@
#include "xlator.h"
#include "defaults.h"
#include "glusterfs.h"
-#include "msg-xdr.h"
#include "statedump.h"
#include "compat-errno.h"
+#include "glusterfs3.h"
+
extern rpc_clnt_prog_t clnt3_1_fop_prog;
int client_ping_cbk (struct rpc_req *req, struct iovec *iov, int count,
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 97e638dfcbe..80a2d4d3461 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -27,10 +27,11 @@
#include "xlator.h"
#include "defaults.h"
#include "glusterfs.h"
-#include "msg-xdr.h"
#include "statedump.h"
#include "compat-errno.h"
+#include "glusterfs3.h"
+
extern rpc_clnt_prog_t clnt_handshake_prog;
extern rpc_clnt_prog_t clnt_dump_prog;
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index 26679cf630a..b6aff1fba9d 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -28,7 +28,7 @@
#include "inode.h"
#include "client-mem-types.h"
#include "protocol-common.h"
-#include "glusterfs-xdr.h"
+#include "glusterfs3-xdr.h"
struct clnt_options {
char *remote_subvolume;
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index 564b1b12268..4c222adbce4 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -24,8 +24,8 @@
#endif
#include "client.h"
-#include "glusterfs-xdr.h"
-#include "msg-xdr.h"
+#include "glusterfs3-xdr.h"
+#include "glusterfs3.h"
#include "compat-errno.h"
int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data);
diff --git a/xlators/protocol/legacy/server/src/Makefile.am b/xlators/protocol/legacy/server/src/Makefile.am
index 3ef0b81bbe2..262fec9ea07 100644
--- a/xlators/protocol/legacy/server/src/Makefile.am
+++ b/xlators/protocol/legacy/server/src/Makefile.am
@@ -4,17 +4,20 @@ xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/legacy/protocol
server_old_la_LDFLAGS = -module -avoidversion
-server_old_la_SOURCES = server-protocol.c server-resolve.c server-helpers.c
+server_old_la_SOURCES = server-protocol.c server-resolve.c server-helpers.c \
+ authenticate.c
+
server_old_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
- $(top_builddir)/xlators/protocol/legacy/lib/src/libgfproto.la \
- $(top_builddir)/xlators/protocol/lib/src/libgfproto1.la
+ $(top_builddir)/xlators/protocol/legacy/lib/src/libgfproto.la
-noinst_HEADERS = server-protocol.h server-helpers.h server-mem-types.h
+noinst_HEADERS = server-protocol.h server-helpers.h server-mem-types.h \
+ authenticate.h
AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS) \
-I$(top_srcdir)/libglusterfs/src -shared -nostartfiles \
-I$(top_srcdir)/contrib/md5/ \
- -DDATADIR=\"$(localstatedir)\" -DCONFDIR=\"$(sysconfdir)/glusterfs\" \
+ -DDATADIR=\"$(localstatedir)\" -DCONFDIR=\"$(sysconfdir)/glusterfs\" \
+ -DLIBDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/auth\" \
$(GF_CFLAGS) -I$(top_srcdir)/xlators/protocol/legacy/lib/src \
-I$(top_srcdir)/xlators/protocol/lib/src
diff --git a/xlators/protocol/lib/src/authenticate.c b/xlators/protocol/legacy/server/src/authenticate.c
index 5205b54df61..5205b54df61 100644
--- a/xlators/protocol/lib/src/authenticate.c
+++ b/xlators/protocol/legacy/server/src/authenticate.c
diff --git a/xlators/protocol/lib/src/authenticate.h b/xlators/protocol/legacy/server/src/authenticate.h
index 93d73741b0a..93d73741b0a 100644
--- a/xlators/protocol/lib/src/authenticate.h
+++ b/xlators/protocol/legacy/server/src/authenticate.h
diff --git a/xlators/protocol/lib/src/Makefile.am b/xlators/protocol/lib/src/Makefile.am
deleted file mode 100644
index abd8ef83e65..00000000000
--- a/xlators/protocol/lib/src/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-lib_LTLIBRARIES = libgfproto1.la
-
-libgfproto1_la_CFLAGS = -fPIC -Wall -g -shared -nostartfiles $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS)
-
-libgfproto1_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -D_GNU_SOURCE \
- -D$(GF_HOST_OS) -DLIBDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/auth\" \
- -I$(CONTRIBDIR)/rbtree -I$(top_srcdir)/libglusterfs/src/ \
- -I$(top_srcdir)/rpc/rpc-lib/src/
-
-libgfproto1_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
-
-libgfproto1_la_SOURCES = authenticate.c msg-xdr.c glusterfs-xdr.c gluster1_xdr.c glusterd1_xdr.c cli-xdr.c
-
-noinst_HEADERS = authenticate.h protocol-common.h msg-xdr.h glusterfs-xdr.h cli-xdr.h glusterd1.h gluster1.h
diff --git a/xlators/protocol/server/src/Makefile.am b/xlators/protocol/server/src/Makefile.am
index be304bdc768..72a581ddf10 100644
--- a/xlators/protocol/server/src/Makefile.am
+++ b/xlators/protocol/server/src/Makefile.am
@@ -5,18 +5,20 @@ server_la_LDFLAGS = -module -avoidversion
server_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
$(top_builddir)/rpc/rpc-lib/src/libgfrpc.la \
- $(top_builddir)/xlators/protocol/lib/src/libgfproto1.la
+ $(top_builddir)/rpc/xdr/src/libgfxdr.la
server_la_SOURCES = server.c server-resolve.c server-helpers.c \
- server3_1-fops.c server-handshake.c
+ server3_1-fops.c server-handshake.c authenticate.c
-noinst_HEADERS = server.h server-helpers.h server-mem-types.h
+noinst_HEADERS = server.h server-helpers.h server-mem-types.h authenticate.h
AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall \
-I$(top_srcdir)/libglusterfs/src -shared -nostartfiles \
-DCONFDIR=\"$(sysconfdir)/glusterfs\" -D$(GF_HOST_OS) \
+ -DLIBDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/auth\" \
$(GF_CFLAGS) -I$(top_srcdir)/xlators/protocol/lib/src \
-I$(top_srcdir)/rpc/rpc-lib/src/ \
+ -I$(top_srcdir)/rpc/xdr/src/ \
-I$(top_srcdir)/contrib/md5/
CLEANFILES = *~
diff --git a/xlators/protocol/server/src/authenticate.c b/xlators/protocol/server/src/authenticate.c
new file mode 100644
index 00000000000..5205b54df61
--- /dev/null
+++ b/xlators/protocol/server/src/authenticate.c
@@ -0,0 +1,249 @@
+/*
+ Copyright (c) 2007-2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <stdio.h>
+#include <dlfcn.h>
+#include <errno.h>
+#include "authenticate.h"
+
+static void
+init (dict_t *this,
+ char *key,
+ data_t *value,
+ void *data)
+{
+ void *handle = NULL;
+ char *auth_file = NULL;
+ auth_handle_t *auth_handle = NULL;
+ auth_fn_t authenticate = NULL;
+ int *error = NULL;
+ int ret = 0;
+
+ /* It gets over written */
+ error = data;
+
+ if (!strncasecmp (key, "ip", strlen ("ip"))) {
+ gf_log ("authenticate", GF_LOG_ERROR,
+ "AUTHENTICATION MODULE \"IP\" HAS BEEN REPLACED "
+ "BY \"ADDR\"");
+ dict_set (this, key, data_from_dynptr (NULL, 0));
+ /* TODO: 1.3.x backword compatibility */
+ // *error = -1;
+ // return;
+ key = "addr";
+ }
+
+ ret = gf_asprintf (&auth_file, "%s/%s.so", LIBDIR, key);
+ if (-1 == ret) {
+ gf_log ("authenticate", GF_LOG_ERROR, "asprintf failed");
+ dict_set (this, key, data_from_dynptr (NULL, 0));
+ *error = -1;
+ return;
+ }
+
+ handle = dlopen (auth_file, RTLD_LAZY);
+ if (!handle) {
+ gf_log ("authenticate", GF_LOG_ERROR, "dlopen(%s): %s\n",
+ auth_file, dlerror ());
+ dict_set (this, key, data_from_dynptr (NULL, 0));
+ GF_FREE (auth_file);
+ *error = -1;
+ return;
+ }
+ GF_FREE (auth_file);
+
+ authenticate = dlsym (handle, "gf_auth");
+ if (!authenticate) {
+ gf_log ("authenticate", GF_LOG_ERROR,
+ "dlsym(gf_auth) on %s\n", dlerror ());
+ dict_set (this, key, data_from_dynptr (NULL, 0));
+ *error = -1;
+ return;
+ }
+
+ auth_handle = GF_CALLOC (1, sizeof (*auth_handle),
+ gf_common_mt_auth_handle_t);
+ if (!auth_handle) {
+ gf_log ("authenticate", GF_LOG_ERROR, "Out of memory");
+ dict_set (this, key, data_from_dynptr (NULL, 0));
+ *error = -1;
+ return;
+ }
+ auth_handle->vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t),
+ gf_common_mt_volume_opt_list_t);
+ auth_handle->vol_opt->given_opt = dlsym (handle, "options");
+ if (auth_handle->vol_opt->given_opt == NULL) {
+ gf_log ("authenticate", GF_LOG_DEBUG,
+ "volume option validation not specified");
+ }
+
+ auth_handle->authenticate = authenticate;
+ auth_handle->handle = handle;
+
+ dict_set (this, key,
+ data_from_dynptr (auth_handle, sizeof (*auth_handle)));
+}
+
+static void
+fini (dict_t *this,
+ char *key,
+ data_t *value,
+ void *data)
+{
+ auth_handle_t *handle = data_to_ptr (value);
+ if (handle) {
+ dlclose (handle->handle);
+ }
+}
+
+int32_t
+gf_auth_init (xlator_t *xl, dict_t *auth_modules)
+{
+ int ret = 0;
+ auth_handle_t *handle = NULL;
+ data_pair_t *pair = NULL;
+ dict_foreach (auth_modules, init, &ret);
+ if (!ret) {
+ pair = auth_modules->members_list;
+ while (pair) {
+ handle = data_to_ptr (pair->value);
+ if (handle) {
+ list_add_tail (&(handle->vol_opt->list),
+ &(xl->volume_options));
+ if (-1 ==
+ validate_xlator_volume_options (xl,
+ handle->vol_opt->given_opt)) {
+ gf_log ("authenticate", GF_LOG_ERROR,
+ "volume option validation "
+ "failed");
+ ret = -1;
+ }
+ }
+ pair = pair->next;
+ }
+ }
+ if (ret) {
+ gf_log (xl->name, GF_LOG_ERROR, "authentication init failed");
+ dict_foreach (auth_modules, fini, &ret);
+ ret = -1;
+ }
+ return ret;
+}
+
+static dict_t *__input_params;
+static dict_t *__config_params;
+
+void
+map (dict_t *this,
+ char *key,
+ data_t *value,
+ void *data)
+{
+ dict_t *res = data;
+ auth_fn_t authenticate;
+ auth_handle_t *handle = NULL;
+
+ if (value && (handle = data_to_ptr (value)) &&
+ (authenticate = handle->authenticate)) {
+ dict_set (res, key,
+ int_to_data (authenticate (__input_params,
+ __config_params)));
+ } else {
+ dict_set (res, key, int_to_data (AUTH_DONT_CARE));
+ }
+}
+
+void
+reduce (dict_t *this,
+ char *key,
+ data_t *value,
+ void *data)
+{
+ int64_t val = 0;
+ int64_t *res = data;
+ if (!data)
+ return;
+
+ val = data_to_int64 (value);
+ switch (val)
+ {
+ case AUTH_ACCEPT:
+ if (AUTH_DONT_CARE == *res)
+ *res = AUTH_ACCEPT;
+ break;
+
+ case AUTH_REJECT:
+ *res = AUTH_REJECT;
+ break;
+
+ case AUTH_DONT_CARE:
+ break;
+ }
+}
+
+
+auth_result_t
+gf_authenticate (dict_t *input_params,
+ dict_t *config_params,
+ dict_t *auth_modules)
+{
+ dict_t *results = NULL;
+ int64_t result = AUTH_DONT_CARE;
+
+ results = get_new_dict ();
+ __input_params = input_params;
+ __config_params = config_params;
+
+ dict_foreach (auth_modules, map, results);
+
+ dict_foreach (results, reduce, &result);
+ if (AUTH_DONT_CARE == result) {
+ data_t *peerinfo_data = dict_get (input_params, "peer-info-name");
+ char *name = NULL;
+
+ if (peerinfo_data) {
+ name = peerinfo_data->data;
+ }
+
+ gf_log ("auth", GF_LOG_ERROR,
+ "no authentication module is interested in "
+ "accepting remote-client %s", name);
+ result = AUTH_REJECT;
+ }
+
+ dict_destroy (results);
+ return result;
+}
+
+void
+gf_auth_fini (dict_t *auth_modules)
+{
+ int32_t dummy;
+
+ dict_foreach (auth_modules, fini, &dummy);
+}
diff --git a/xlators/protocol/server/src/authenticate.h b/xlators/protocol/server/src/authenticate.h
new file mode 100644
index 00000000000..93d73741b0a
--- /dev/null
+++ b/xlators/protocol/server/src/authenticate.h
@@ -0,0 +1,60 @@
+/*
+ Copyright (c) 2007-2009 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _AUTHENTICATE_H
+#define _AUTHENTICATE_H
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <stdio.h>
+#include <fnmatch.h>
+#include "dict.h"
+#include "compat.h"
+#include "list.h"
+#include "xlator.h"
+
+typedef enum {
+ AUTH_ACCEPT,
+ AUTH_REJECT,
+ AUTH_DONT_CARE
+} auth_result_t;
+
+typedef auth_result_t (*auth_fn_t) (dict_t *input_params,
+ dict_t *config_params);
+
+typedef struct {
+ void *handle;
+ auth_fn_t authenticate;
+ volume_opt_list_t *vol_opt;
+} auth_handle_t;
+
+auth_result_t gf_authenticate (dict_t *input_params,
+ dict_t *config_params,
+ dict_t *auth_modules);
+int32_t gf_auth_init (xlator_t *xl, dict_t *auth_modules);
+void gf_auth_fini (dict_t *auth_modules);
+
+#endif /* _AUTHENTICATE_H */
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index 61630d1f625..d386e9ce55b 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -25,9 +25,9 @@
#include "server.h"
#include "server-helpers.h"
-#include "glusterfs-xdr.h"
+#include "glusterfs3-xdr.h"
#include "compat-errno.h"
-#include "msg-xdr.h"
+#include "glusterfs3.h"
#include "authenticate.h"
struct __get_xl_struct {
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 00247c1eef8..874c2615e31 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -28,7 +28,7 @@
#include "server.h"
#include "server-helpers.h"
-#include "glusterfs-xdr.h"
+#include "glusterfs3-xdr.h"
#include "call-stub.h"
#include "statedump.h"
#include "defaults.h"
diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h
index aecac45071c..81ac7edcc76 100644
--- a/xlators/protocol/server/src/server.h
+++ b/xlators/protocol/server/src/server.h
@@ -27,7 +27,7 @@
#include "fd.h"
#include "protocol-common.h"
#include "server-mem-types.h"
-#include "glusterfs-xdr.h"
+#include "glusterfs3-xdr.h"
#define DEFAULT_BLOCK_SIZE 4194304 /* 4MB */
#define DEFAULT_VOLUME_FILE_PATH CONFDIR "/glusterfs.vol"
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index 578e461b0a3..1b7741766d2 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -25,8 +25,8 @@
#include "server.h"
#include "server-helpers.h"
-#include "glusterfs-xdr.h"
-#include "msg-xdr.h"
+#include "glusterfs3-xdr.h"
+#include "glusterfs3.h"
#include "compat-errno.h"
#include "md5.h"