summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rpc/rpc-lib/src/Makefile.am3
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c6
-rw-r--r--rpc/rpc-lib/src/rpc-common.c115
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c108
-rw-r--r--rpc/rpc-lib/src/xdr-common.h45
-rw-r--r--xlators/protocol/client/src/client-handshake.c140
-rw-r--r--xlators/protocol/client/src/client.c3
-rw-r--r--xlators/protocol/client/src/client.h1
-rw-r--r--xlators/protocol/lib/src/glusterfs-xdr.c32
-rw-r--r--xlators/protocol/lib/src/glusterfs-xdr.h23
-rw-r--r--xlators/protocol/lib/src/glusterfs3.x21
-rw-r--r--xlators/protocol/lib/src/msg-xdr.c32
-rw-r--r--xlators/protocol/lib/src/msg-xdr.h12
-rw-r--r--xlators/protocol/lib/src/protocol-common.h1
-rw-r--r--xlators/protocol/server/src/server-handshake.c57
15 files changed, 351 insertions, 248 deletions
diff --git a/rpc/rpc-lib/src/Makefile.am b/rpc/rpc-lib/src/Makefile.am
index 4df8888a0..986eb95ce 100644
--- a/rpc/rpc-lib/src/Makefile.am
+++ b/rpc/rpc-lib/src/Makefile.am
@@ -2,7 +2,8 @@ lib_LTLIBRARIES = libgfrpc.la
libgfrpc_la_LDFLAGS = -module -avoidversion
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-transport.c xdr-rpc.c xdr-rpcclnt.c rpc-clnt.c auth-glusterfs.c \
+ rpc-common.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 \
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index 84fdb9bb5..b41275c2c 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -1202,9 +1202,9 @@ rpc_clnt_submit (struct rpc_clnt *rpc, rpc_clnt_prog_t *prog,
if (conn->connected ||
/* FIXME: hack!! hack!! find a neater way to do this */
- ((prog->prognum == GLUSTER_HNDSK_PROGRAM) &&
- ((procnum == GF_HNDSK_SETVOLUME) ||
- (procnum == GF_HNDSK_DUMP_VERSION)))) {
+ (((prog->prognum == GLUSTER_HNDSK_PROGRAM) &&
+ (procnum == GF_HNDSK_SETVOLUME)) ||
+ (prog->prognum == GLUSTER_DUMP_PROGRAM))) {
if (proghdr) {
proglen += iov_length (proghdr, proghdrcount);
}
diff --git a/rpc/rpc-lib/src/rpc-common.c b/rpc/rpc-lib/src/rpc-common.c
new file mode 100644
index 000000000..ffd0c8d28
--- /dev/null
+++ b/rpc/rpc-lib/src/rpc-common.c
@@ -0,0 +1,115 @@
+
+#include "xdr-common.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;
+}
+
+
+bool_t
+xdr_gf_dump_req (XDR *xdrs, gf_dump_req *objp)
+{
+ if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_gf_prog_detail (XDR *xdrs, gf_prog_detail *objp)
+{
+ if (!xdr_string (xdrs, &objp->progname, ~0))
+ return FALSE;
+ if (!xdr_u_quad_t (xdrs, &objp->prognum))
+ return FALSE;
+ if (!xdr_u_quad_t (xdrs, &objp->progver))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->next, sizeof (gf_prog_detail), (xdrproc_t) xdr_gf_prog_detail))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_gf_dump_rsp (XDR *xdrs, gf_dump_rsp *objp)
+{
+ if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->op_ret))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->op_errno))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->prog, sizeof (gf_prog_detail), (xdrproc_t) xdr_gf_prog_detail))
+ return FALSE;
+ return TRUE;
+}
+
+
+ssize_t
+xdr_serialize_dump_rsp (struct iovec outmsg, void *rsp)
+{
+ return xdr_serialize_generic (outmsg, (void *)rsp,
+ (xdrproc_t)xdr_gf_dump_rsp);
+}
+
+ssize_t
+xdr_to_dump_req (struct iovec inmsg, void *args)
+{
+ return xdr_to_generic (inmsg, (void *)args,
+ (xdrproc_t)xdr_gf_dump_req);
+}
+
+
+ssize_t
+xdr_from_dump_req (struct iovec outmsg, void *rsp)
+{
+ return xdr_serialize_generic (outmsg, (void *)rsp,
+ (xdrproc_t)xdr_gf_dump_req);
+}
+
+ssize_t
+xdr_to_dump_rsp (struct iovec inmsg, void *args)
+{
+ return xdr_to_generic (inmsg, (void *)args,
+ (xdrproc_t)xdr_gf_dump_rsp);
+}
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index c39a88088..bb4e37ef8 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -33,6 +33,7 @@
#include "xdr-rpc.h"
#include "iobuf.h"
#include "globals.h"
+#include "xdr-common.h"
#include <errno.h>
#include <pthread.h>
@@ -45,6 +46,8 @@
#include <stdarg.h>
#include <stdio.h>
+struct rpcsvc_program gluster_dump_prog;
+
#define rpcsvc_alloc_request(con, request) \
do { \
@@ -1931,6 +1934,89 @@ free_prog:
return ret;
}
+static void
+free_prog_details (gf_dump_rsp *rsp)
+{
+ gf_prog_detail *prev = NULL;
+ gf_prog_detail *trav = NULL;
+
+ trav = rsp->prog;
+ while (trav) {
+ prev = trav;
+ trav = trav->next;
+ GF_FREE (prev);
+ }
+}
+
+static int
+build_prog_details (rpcsvc_request_t *req, gf_dump_rsp *rsp)
+{
+ int ret = -1;
+ rpcsvc_program_t *program = NULL;
+ gf_prog_detail *prog = NULL;
+ gf_prog_detail *prev = NULL;
+
+ if (!req || !req->conn || !req->conn->svc)
+ goto out;
+
+ list_for_each_entry (program, &req->conn->svc->programs, program) {
+ prog = GF_CALLOC (1, sizeof (*prog), 0);
+ if (!prog)
+ goto out;
+ prog->progname = program->progname;
+ prog->prognum = program->prognum;
+ prog->progver = program->progver;
+ if (!rsp->prog)
+ rsp->prog = prog;
+ if (prev)
+ prev->next = prog;
+ prev = prog;
+ }
+ if (prev)
+ ret = 0;
+out:
+ return ret;
+}
+
+static int
+rpcsvc_dump (rpcsvc_request_t *req)
+{
+ char rsp_buf[8 * 1024] = {0,};
+ gf_dump_rsp rsp = {0,};
+ struct iovec iov = {0,};
+ int op_errno = EINVAL;
+ int ret = -1;
+
+ if (!req)
+ goto fail;
+
+ ret = build_prog_details (req, &rsp);
+ if (ret < 0) {
+ op_errno = -ret;
+ goto fail;
+ }
+
+fail:
+ rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = ret;
+
+ iov.iov_base = rsp_buf;
+ iov.iov_len = (8 * 1024);
+
+ ret = xdr_serialize_dump_rsp (iov, &rsp);
+ if (ret < 0) {
+ req->rpc_err = GARBAGE_ARGS;
+ op_errno = EINVAL;
+ goto fail;
+ }
+
+ ret = rpcsvc_submit_generic (req, &iov, 1, NULL, 0,
+ NULL);
+
+ free_prog_details (&rsp);
+
+ return 0;
+}
int
rpcsvc_init_options (rpcsvc_t *svc, dict_t *options)
@@ -2004,6 +2090,12 @@ rpcsvc_init (glusterfs_ctx_t *ctx, dict_t *options)
svc->listener = listener;
+ ret = rpcsvc_program_register (svc, gluster_dump_prog);
+ if (ret) {
+ gf_log (GF_RPCSVC, GF_LOG_ERROR,
+ "failed to register DUMP program");
+ goto free_svc;
+ }
ret = 0;
free_svc:
if (ret == -1) {
@@ -2013,3 +2105,19 @@ free_svc:
return svc;
}
+
+
+rpcsvc_actor_t gluster_dump_actors[] = {
+ [GF_DUMP_NULL] = {"NULL", GF_DUMP_NULL, NULL, NULL, NULL },
+ [GF_DUMP_DUMP] = {"DUMP", GF_DUMP_DUMP, rpcsvc_dump, NULL, NULL },
+ [GF_DUMP_MAXVALUE] = {"MAXVALUE", GF_DUMP_MAXVALUE, NULL, NULL, NULL },
+};
+
+
+struct rpcsvc_program gluster_dump_prog = {
+ .progname = "GF-DUMP",
+ .prognum = GLUSTER_DUMP_PROGRAM,
+ .progver = GLUSTER_DUMP_VERSION,
+ .actors = gluster_dump_actors,
+ .numactors = 2,
+};
diff --git a/rpc/rpc-lib/src/xdr-common.h b/rpc/rpc-lib/src/xdr-common.h
index 0c9ffb2f8..7ba137252 100644
--- a/rpc/rpc-lib/src/xdr-common.h
+++ b/rpc/rpc-lib/src/xdr-common.h
@@ -27,6 +27,16 @@
#include <rpc/rpc.h>
+enum {
+ GF_DUMP_NULL,
+ GF_DUMP_DUMP,
+ GF_DUMP_MAXVALUE,
+} gf_dump_procnum_t;
+
+#define GLUSTER_DUMP_PROGRAM 123451501 /* Completely random */
+#define GLUSTER_DUMP_VERSION 1
+
+
#if GF_DARWIN_HOST_OS
#define xdr_u_quad_t xdr_u_int64_t
#define xdr_quad_t xdr_int64_t
@@ -43,8 +53,41 @@ struct auth_glusterfs_parms {
};
typedef struct auth_glusterfs_parms auth_glusterfs_parms;
-bool_t
+struct gf_dump_req {
+ u_quad_t gfs_id;
+};
+typedef struct gf_dump_req gf_dump_req;
+
+struct gf_prog_detail {
+ char *progname;
+ u_quad_t prognum;
+ u_quad_t progver;
+ struct gf_prog_detail *next;
+};
+typedef struct gf_prog_detail gf_prog_detail;
+
+struct gf_dump_rsp {
+ u_quad_t gfs_id;
+ int op_ret;
+ int op_errno;
+ struct gf_prog_detail *prog;
+};
+typedef struct gf_dump_rsp gf_dump_rsp;
+
+extern bool_t
xdr_auth_glusterfs_parms (XDR *xdrs, auth_glusterfs_parms *objp);
+extern bool_t xdr_gf_dump_req (XDR *, gf_dump_req*);
+extern bool_t xdr_gf_prog_detail (XDR *, gf_prog_detail*);
+extern bool_t xdr_gf_dump_rsp (XDR *, gf_dump_rsp*);
+
+ssize_t
+xdr_serialize_dump_rsp (struct iovec outmsg, void *rsp);
+ssize_t
+xdr_to_dump_req (struct iovec inmsg, void *args);
+ssize_t
+xdr_from_dump_req (struct iovec outmsg, void *rsp);
+ssize_t
+xdr_to_dump_rsp (struct iovec inmsg, void *args);
#define XDR_BYTES_PER_UNIT 4
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index 1c239d0cb..f45cc84aa 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -596,88 +596,59 @@ fail:
}
int
-select_server_supported_programs (xlator_t *this, char *msg)
+select_server_supported_programs (xlator_t *this, gf_prog_detail *prog)
{
- clnt_conf_t *conf = NULL;
- char *tmp_str = NULL;
- char *prog_str = NULL;
- char *dup_str = NULL;
- char *tmp_str1 = NULL;
- char *tmp_msg = NULL;
- char *progname = NULL;
- char *progver_str = NULL;
- char *prognum_str = NULL;
- int ret = -1;
- int progver = 0;
- int prognum = 0;
-
- if (!this || !msg)
+ gf_prog_detail *trav = NULL;
+ clnt_conf_t *conf = NULL;
+ int ret = -1;
+
+ if (!this || !prog)
goto out;
conf = this->private;
+ trav = prog;
- /* Reply in "Name:Program-Number:Program-Version,..." format */
- tmp_msg = gf_strdup (msg);
- prog_str = strtok_r (tmp_msg, ",", &tmp_str);
- while (prog_str) {
- dup_str = gf_strdup (prog_str);
-
- progname = strtok_r (dup_str, ":", &tmp_str1);
- prognum_str = strtok_r (NULL, ":", &tmp_str1);
- if (!prognum_str) {
- gf_log (this->name, GF_LOG_WARNING,
- "Supported versions not formatted");
- goto out;
- }
- sscanf (prognum_str, "%d", &prognum);
- progver_str = strtok_r (NULL, ":", &tmp_str1);
- if (!progver_str) {
- gf_log (this->name, GF_LOG_WARNING,
- "Supported versions not formatted");
- goto out;
- }
- sscanf (progver_str, "%d", &progver);
-
+ while (trav) {
/* Select 'programs' */
- if ((clnt3_1_fop_prog.prognum == prognum) &&
- (clnt3_1_fop_prog.progver == progver)) {
+ if ((clnt3_1_fop_prog.prognum == trav->prognum) &&
+ (clnt3_1_fop_prog.progver == trav->progver)) {
conf->fops = &clnt3_1_fop_prog;
gf_log (this->name, GF_LOG_INFO,
- "Using Program %s, Num (%s), Version (%s)",
- progname, prognum_str, progver_str);
+ "Using Program %s, Num (%"PRId64"), "
+ "Version (%"PRId64")",
+ trav->progname, trav->prognum, trav->progver);
ret = 0;
}
- if ((clnt3_1_mgmt_prog.prognum == prognum) &&
- (clnt3_1_mgmt_prog.progver == progver)) {
+ if ((clnt3_1_mgmt_prog.prognum == trav->prognum) &&
+ (clnt3_1_mgmt_prog.progver == trav->progver)) {
conf->mgmt = &clnt3_1_mgmt_prog;
gf_log (this->name, GF_LOG_INFO,
- "Using Program %s, Num (%s), Version (%s)",
- progname, prognum_str, progver_str);
+ "Using Program %s, Num (%"PRId64"), "
+ "Version (%"PRId64")",
+ trav->progname, trav->prognum, trav->progver);
ret = 0;
}
-
- prog_str = strtok_r (NULL, ",", &tmp_str);
- GF_FREE (dup_str);
+ if (ret) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "%s (%"PRId64") not supported", trav->progname,
+ trav->progver);
+ }
+ trav = trav->next;
}
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "none of the server versions are supported by client");
- }
- ret = 0;
out:
- if (tmp_msg)
- GF_FREE (tmp_msg);
return ret;
}
int
client_dump_version_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe)
{
- gf_dump_version_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- int ret = 0;
+ gf_dump_rsp rsp = {0,};
+ gf_prog_detail *trav = NULL;
+ gf_prog_detail *next = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+ int ret = 0;
frame = myframe;
conf = frame->this->private;
@@ -687,7 +658,7 @@ client_dump_version_cbk (struct rpc_req *req, struct iovec *iov, int count, void
goto out;
}
- ret = xdr_to_dump_version_rsp (*iov, &rsp);
+ ret = xdr_to_dump_rsp (*iov, &rsp);
if (ret < 0) {
gf_log ("", GF_LOG_ERROR, "error");
goto out;
@@ -700,12 +671,11 @@ client_dump_version_cbk (struct rpc_req *req, struct iovec *iov, int count, void
/* Check for the proper version string */
/* Reply in "Name:Program-Number:Program-Version,..." format */
- ret = select_server_supported_programs (frame->this,
- rsp.msg.msg_val);
+ ret = select_server_supported_programs (frame->this, rsp.prog);
if (ret) {
gf_log (frame->this->name, GF_LOG_ERROR,
"Server versions are not present in this "
- "release (%s)", rsp.msg.msg_val);
+ "release");
goto out;
}
@@ -713,8 +683,13 @@ client_dump_version_cbk (struct rpc_req *req, struct iovec *iov, int count, void
out:
/* don't use GF_FREE, buffer was allocated by libc */
- if (rsp.msg.msg_val) {
- free (rsp.msg.msg_val);
+ if (rsp.prog) {
+ trav = rsp.prog;
+ while (trav) {
+ next = trav->next;
+ free (trav);
+ trav = next;
+ }
}
STACK_DESTROY (frame->root);
@@ -724,10 +699,10 @@ out:
int
client_handshake (xlator_t *this, struct rpc_clnt *rpc)
{
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- gf_dump_version_req req = {0,};
- int ret = 0;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+ gf_dump_req req = {0,};
+ int ret = 0;
conf = this->private;
if (!conf->handshake)
@@ -737,24 +712,17 @@ client_handshake (xlator_t *this, struct rpc_clnt *rpc)
if (!frame)
goto out;
- req.key = "fop-handshake";
- req.gfs_id = 123456;
- ret = client_submit_request (this, &req, frame, conf->handshake,
- GF_HNDSK_DUMP_VERSION,
- client_dump_version_cbk,
- NULL, xdr_from_dump_version_req);
+ req.gfs_id = 0xbabe;
+ ret = client_submit_request (this, &req, frame, conf->dump,
+ GF_DUMP_DUMP, client_dump_version_cbk,
+ NULL, xdr_from_dump_req);
out:
return ret;
}
-
-/* */
-/* This table should ideally remain same irrespective of versions */
-
char *clnt_handshake_procs[GF_HNDSK_MAXVALUE] = {
[GF_HNDSK_NULL] = "NULL",
- [GF_HNDSK_DUMP_VERSION] = "VERSION",
[GF_HNDSK_SETVOLUME] = "SETVOLUME",
[GF_HNDSK_GETSPEC] = "GETSPEC",
[GF_HNDSK_PING] = "PING",
@@ -766,3 +734,15 @@ rpc_clnt_prog_t clnt_handshake_prog = {
.progver = GLUSTER_HNDSK_VERSION,
.procnames = clnt_handshake_procs,
};
+
+char *clnt_dump_proc[GF_DUMP_MAXVALUE] = {
+ [GF_DUMP_NULL] = "NULL",
+ [GF_DUMP_DUMP] = "DUMP",
+};
+
+rpc_clnt_prog_t clnt_dump_prog = {
+ .progname = "GF-DUMP",
+ .prognum = GLUSTER_DUMP_PROGRAM,
+ .progver = GLUSTER_DUMP_VERSION,
+ .procnames = clnt_dump_proc,
+};
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 6ad594400..97e638dfc 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -32,6 +32,8 @@
#include "compat-errno.h"
extern rpc_clnt_prog_t clnt_handshake_prog;
+extern rpc_clnt_prog_t clnt_dump_prog;
+
int
client_handshake (xlator_t *this, struct rpc_clnt *rpc);
@@ -1558,6 +1560,7 @@ init (xlator_t *this)
goto out;
conf->handshake = &clnt_handshake_prog;
+ conf->dump = &clnt_dump_prog;
this->private = conf;
ret = 0;
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index 1422c7abe..26679cf63 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -48,6 +48,7 @@ typedef struct clnt_conf {
rpc_clnt_prog_t *fops;
rpc_clnt_prog_t *mgmt;
rpc_clnt_prog_t *handshake;
+ rpc_clnt_prog_t *dump;
} clnt_conf_t;
typedef struct _client_fd_ctx {
diff --git a/xlators/protocol/lib/src/glusterfs-xdr.c b/xlators/protocol/lib/src/glusterfs-xdr.c
index cbc4d7cef..92b8c2ed2 100644
--- a/xlators/protocol/lib/src/glusterfs-xdr.c
+++ b/xlators/protocol/lib/src/glusterfs-xdr.c
@@ -1667,38 +1667,6 @@ xdr_gf_common_rsp (XDR *xdrs, gf_common_rsp *objp)
bool_t
-xdr_gf_dump_version_req (XDR *xdrs, gf_dump_version_req *objp)
-{
-
- if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
- return FALSE;
- if (!xdr_u_int (xdrs, &objp->flags))
- return FALSE;
- if (!xdr_string (xdrs, &objp->key, ~0))
- return FALSE;
- return TRUE;
-}
-
-bool_t
-xdr_gf_dump_version_rsp (XDR *xdrs, gf_dump_version_rsp *objp)
-{
-
- if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
- return FALSE;
- if (!xdr_int (xdrs, &objp->op_ret))
- return FALSE;
- if (!xdr_int (xdrs, &objp->op_errno))
- return FALSE;
- if (!xdr_u_int (xdrs, &objp->flags))
- return FALSE;
- if (!xdr_bytes (xdrs, (char **)&objp->msg.msg_val, (u_int *) &objp->msg.msg_len, ~0))
- return FALSE;
- return TRUE;
-}
-
-
-
-bool_t
xdr_gfs3_dirlist (XDR *xdrs, gfs3_dirlist *objp)
{
if (!xdr_u_quad_t (xdrs, &objp->d_ino))
diff --git a/xlators/protocol/lib/src/glusterfs-xdr.h b/xlators/protocol/lib/src/glusterfs-xdr.h
index 45ce3ff9b..a3afe8861 100644
--- a/xlators/protocol/lib/src/glusterfs-xdr.h
+++ b/xlators/protocol/lib/src/glusterfs-xdr.h
@@ -1063,25 +1063,6 @@ struct gf_common_rsp {
};
typedef struct gf_common_rsp gf_common_rsp;
-struct gf_dump_version_req {
- u_quad_t gfs_id;
- u_int flags;
- char *key;
-};
-typedef struct gf_dump_version_req gf_dump_version_req;
-
-struct gf_dump_version_rsp {
- u_quad_t gfs_id;
- int op_ret;
- int op_errno;
- u_int flags;
- struct {
- u_int msg_len;
- char *msg_val;
- } msg;
-};
-typedef struct gf_dump_version_rsp gf_dump_version_rsp;
-
struct gfs3_dirlist {
u_quad_t d_ino;
u_quad_t d_off;
@@ -1208,8 +1189,6 @@ extern bool_t xdr_gf_notify_rsp (XDR *, gf_notify_rsp*);
extern bool_t xdr_gfs3_releasedir_req (XDR *, gfs3_releasedir_req*);
extern bool_t xdr_gfs3_release_req (XDR *, gfs3_release_req*);
extern bool_t xdr_gf_common_rsp (XDR *, gf_common_rsp*);
-extern bool_t xdr_gf_dump_version_req (XDR *, gf_dump_version_req *);
-extern bool_t xdr_gf_dump_version_rsp (XDR *, gf_dump_version_rsp *);
#else /* K&R C */
extern bool_t xdr_gf_statfs ();
@@ -1297,8 +1276,6 @@ extern bool_t xdr_gf_log_req ();
extern bool_t xdr_gf_notify_req ();
extern bool_t xdr_gf_notify_rsp ();
extern bool_t xdr_gf_common_rsp ();
-extern bool_t xdr_gf_dump_version_req ();
-extern bool_t xdr_gf_dump_version_rsp ();
#endif /* K&R C */
diff --git a/xlators/protocol/lib/src/glusterfs3.x b/xlators/protocol/lib/src/glusterfs3.x
index b2eb9556c..cafe965ef 100644
--- a/xlators/protocol/lib/src/glusterfs3.x
+++ b/xlators/protocol/lib/src/glusterfs3.x
@@ -732,19 +732,20 @@ struct gf_common_rsp {
} ;
-struct gf_dump_version_req {
- unsigned hyper gfs_id;
- unsigned int flags;
- string key<>;
+struct gf_dump_req {
+ unsigned hyper gfs_id;
};
+struct gf_prog_detail {
+ string progname<>;
+ unsigned hyper prognum;
+ unsigned hyper progver;
+ struct gf_prog_detail *next;
+};
-struct gf_dump_version_rsp {
- unsigned hyper gfs_id;
- int op_ret;
- int op_errno;
- unsigned int flags;
- opaque msg<>;
+struct gf_dump_rsp {
+ unsigned hyper gfs_id;
+ struct gf_prog_detail *prog;
};
struct auth_glusterfs_parms {
diff --git a/xlators/protocol/lib/src/msg-xdr.c b/xlators/protocol/lib/src/msg-xdr.c
index 3fe5ad5f6..9227e715f 100644
--- a/xlators/protocol/lib/src/msg-xdr.c
+++ b/xlators/protocol/lib/src/msg-xdr.c
@@ -341,24 +341,6 @@ xdr_serialize_ftruncate_rsp (struct iovec outmsg, void *rsp)
ssize_t
-xdr_serialize_dump_version_rsp (struct iovec outmsg, void *rsp)
-{
- return xdr_serialize_generic (outmsg, (void *)rsp,
- (xdrproc_t)xdr_gf_dump_version_rsp);
-}
-
-
-/* Decode */
-
-
-ssize_t
-xdr_to_dump_version_req (struct iovec inmsg, void *args)
-{
- return xdr_to_generic (inmsg, (void *)args,
- (xdrproc_t)xdr_gf_dump_version_req);
-}
-
-ssize_t
xdr_to_lookup_req (struct iovec inmsg, void *args)
{
return xdr_to_generic (inmsg, (void *)args,
@@ -960,13 +942,6 @@ xdr_from_setvolume_req (struct iovec outmsg, void *req)
}
ssize_t
-xdr_from_dump_version_req (struct iovec outmsg, void *req)
-{
- return xdr_serialize_generic (outmsg, (void *)req,
- (xdrproc_t)xdr_gf_dump_version_req);
-
-}
-ssize_t
xdr_from_rmdir_req (struct iovec outmsg, void *req)
{
return xdr_serialize_generic (outmsg, (void *)req,
@@ -1207,13 +1182,6 @@ xdr_to_setvolume_rsp (struct iovec outmsg, void *rsp)
}
ssize_t
-xdr_to_dump_version_rsp (struct iovec outmsg, void *rsp)
-{
- return xdr_to_generic (outmsg, (void *)rsp,
- (xdrproc_t)xdr_gf_dump_version_rsp);
-
-}
-ssize_t
xdr_to_rmdir_rsp (struct iovec outmsg, void *rsp)
{
return xdr_to_generic (outmsg, (void *)rsp,
diff --git a/xlators/protocol/lib/src/msg-xdr.h b/xlators/protocol/lib/src/msg-xdr.h
index 59b6ca301..025b7f8c7 100644
--- a/xlators/protocol/lib/src/msg-xdr.h
+++ b/xlators/protocol/lib/src/msg-xdr.h
@@ -406,23 +406,11 @@ ssize_t
xdr_from_release_req (struct iovec outmsg, void *args);
ssize_t
-xdr_from_dump_version_req (struct iovec outmsg, void *args);
-
-ssize_t
xdr_from_setvolume_req (struct iovec outmsg, void *args);
ssize_t
xdr_to_setvolume_rsp (struct iovec inmsg, void *args);
-ssize_t
-xdr_to_dump_version_rsp (struct iovec inmsg, void *args);
-
-
-ssize_t
-xdr_serialize_dump_version_rsp (struct iovec outmsg, void *args);
-
-ssize_t
-xdr_to_dump_version_req (struct iovec inmsg, void *args);
ssize_t
diff --git a/xlators/protocol/lib/src/protocol-common.h b/xlators/protocol/lib/src/protocol-common.h
index 5590960a6..78ee2581f 100644
--- a/xlators/protocol/lib/src/protocol-common.h
+++ b/xlators/protocol/lib/src/protocol-common.h
@@ -69,7 +69,6 @@ enum gf_fop_procnum {
enum gf_handshake_procnum {
GF_HNDSK_NULL,
- GF_HNDSK_DUMP_VERSION,
GF_HNDSK_SETVOLUME,
GF_HNDSK_GETSPEC,
GF_HNDSK_PING,
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index 94586d20c..61630d1f6 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -241,52 +241,6 @@ out:
return ret;
}
-int
-build_program_list (server_conf_t *conf, char *list)
-{
- /* Reply in "Name:Program-Number:Program-Version,..." format */
- sprintf (list, "%s:%d:%d",
- glusterfs3_1_fop_prog.progname,
- glusterfs3_1_fop_prog.prognum,
- glusterfs3_1_fop_prog.progver);
- /* TODO: keep adding new versions to the list here */
- return 0;
-}
-
-int
-server_dump_version (rpcsvc_request_t *req)
-{
- char list[8192] = {0,};
- server_conf_t *conf = NULL;
- int ret = -1;
- int op_errno = EINVAL;
- gf_dump_version_req args = {0,};
- gf_dump_version_rsp rsp = {0,};
-
- conf = ((xlator_t *)req->conn->svc->mydata)->private;
-
- if (xdr_to_glusterfs_req (req, &args, xdr_to_dump_version_req)) {
- //failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
- goto fail;
- }
-
- build_program_list (conf, list);
- rsp.msg.msg_val = list;
- rsp.msg.msg_len = strlen (list) + 1;
- ret = 0;
-fail:
- rsp.op_errno = gf_errno_to_error (op_errno);
- rsp.op_ret = ret;
-
- server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
- (gfs_serialize_t)xdr_serialize_dump_version_rsp);
-
- if (args.key)
- free (args.key);
-
- return 0;
-}
int
server_getspec (rpcsvc_request_t *req)
@@ -672,11 +626,10 @@ server_ping (rpcsvc_request_t *req)
rpcsvc_actor_t gluster_handshake_actors[] = {
- [GF_HNDSK_NULL] = {"NULL", GF_HNDSK_NULL, server_null, NULL, NULL },
- [GF_HNDSK_DUMP_VERSION] = {"VERSION", GF_HNDSK_DUMP_VERSION, server_dump_version, NULL, NULL },
+ [GF_HNDSK_NULL] = {"NULL", GF_HNDSK_NULL, server_null, NULL, NULL },
[GF_HNDSK_SETVOLUME] = {"SETVOLUME", GF_HNDSK_SETVOLUME, server_setvolume, NULL, NULL },
- [GF_HNDSK_GETSPEC] = {"GETSPEC", GF_HNDSK_GETSPEC, server_getspec, NULL, NULL },
- [GF_HNDSK_PING] = {"PING", GF_HNDSK_PING, server_ping, NULL, NULL },
+ [GF_HNDSK_GETSPEC] = {"GETSPEC", GF_HNDSK_GETSPEC, server_getspec, NULL, NULL },
+ [GF_HNDSK_PING] = {"PING", GF_HNDSK_PING, server_ping, NULL, NULL },
};
@@ -684,8 +637,6 @@ struct rpcsvc_program gluster_handshake_prog = {
.progname = "GlusterFS Handshake",
.prognum = GLUSTER_HNDSK_PROGRAM,
.progver = GLUSTER_HNDSK_VERSION,
-
.actors = gluster_handshake_actors,
- .numactors = 5,
- .progport = 7008,
+ .numactors = GF_HNDSK_MAXVALUE,
};