summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/lib
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/protocol/lib')
-rw-r--r--xlators/protocol/lib/src/Makefile.am2
-rw-r--r--xlators/protocol/lib/src/glusterfs-xdr.c97
-rw-r--r--xlators/protocol/lib/src/glusterfs-xdr.h78
-rw-r--r--xlators/protocol/lib/src/glusterfs3.x42
-rw-r--r--xlators/protocol/lib/src/msg-xdr.h2
-rw-r--r--xlators/protocol/lib/src/protocol-common.c109
-rw-r--r--xlators/protocol/lib/src/protocol-common.h11
7 files changed, 148 insertions, 193 deletions
diff --git a/xlators/protocol/lib/src/Makefile.am b/xlators/protocol/lib/src/Makefile.am
index ece59ef90..98cf44d09 100644
--- a/xlators/protocol/lib/src/Makefile.am
+++ b/xlators/protocol/lib/src/Makefile.am
@@ -10,6 +10,6 @@ libgfproto1_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -D_GNU_SO
libgfproto1_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
-libgfproto1_la_SOURCES = authenticate.c protocol-common.c msg-xdr.c glusterfs-xdr.c
+libgfproto1_la_SOURCES = authenticate.c msg-xdr.c glusterfs-xdr.c
noinst_HEADERS = authenticate.h protocol-common.h msg-xdr.h glusterfs-xdr.h
diff --git a/xlators/protocol/lib/src/glusterfs-xdr.c b/xlators/protocol/lib/src/glusterfs-xdr.c
index 6538d6d26..e8a254094 100644
--- a/xlators/protocol/lib/src/glusterfs-xdr.c
+++ b/xlators/protocol/lib/src/glusterfs-xdr.c
@@ -1148,21 +1148,6 @@ xdr_gfs3_readdir_req (XDR *xdrs, gfs3_readdir_req *objp)
}
bool_t
-xdr_gfs3_readdir_rsp (XDR *xdrs, gfs3_readdir_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_bytes (xdrs, (char **)&objp->buf.buf_val, (u_int *) &objp->buf.buf_len, ~0))
- return FALSE;
- return TRUE;
-}
-
-bool_t
xdr_gfs3_readdirp_req (XDR *xdrs, gfs3_readdirp_req *objp)
{
@@ -1182,21 +1167,6 @@ xdr_gfs3_readdirp_req (XDR *xdrs, gfs3_readdirp_req *objp)
}
bool_t
-xdr_gfs3_readdirp_rsp (XDR *xdrs, gfs3_readdirp_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_bytes (xdrs, (char **)&objp->buf.buf_val, (u_int *) &objp->buf.buf_len, ~0))
- return FALSE;
- return TRUE;
-}
-
-bool_t
xdr_gf_setvolume_req (XDR *xdrs, gf_setvolume_req *objp)
{
@@ -1759,3 +1729,70 @@ xdr_gf_dump_version_rsp (XDR *xdrs, gf_dump_version_rsp *objp)
return TRUE;
}
+
+
+bool_t
+xdr_gfs3_dirlist (XDR *xdrs, gfs3_dirlist *objp)
+{
+ if (!xdr_u_quad_t (xdrs, &objp->d_ino))
+ return FALSE;
+ if (!xdr_u_quad_t (xdrs, &objp->d_off))
+ return FALSE;
+ if (!xdr_u_int (xdrs, &objp->d_len))
+ return FALSE;
+ if (!xdr_u_int (xdrs, &objp->d_type))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->name, ~0))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->nextentry, sizeof (gfs3_dirlist), (xdrproc_t) xdr_gfs3_dirlist))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_gfs3_readdir_rsp (XDR *xdrs, gfs3_readdir_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->reply, sizeof (gfs3_dirlist), (xdrproc_t) xdr_gfs3_dirlist))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_gfs3_dirplist (XDR *xdrs, gfs3_dirplist *objp)
+{
+ if (!xdr_u_quad_t (xdrs, &objp->d_ino))
+ return FALSE;
+ if (!xdr_u_quad_t (xdrs, &objp->d_off))
+ return FALSE;
+ if (!xdr_u_int (xdrs, &objp->d_len))
+ return FALSE;
+ if (!xdr_u_int (xdrs, &objp->d_type))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->name, ~0))
+ return FALSE;
+ if (!xdr_gf_iatt (xdrs, &objp->stat))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->nextentry, sizeof (gfs3_dirplist), (xdrproc_t) xdr_gfs3_dirplist))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_gfs3_readdirp_rsp (XDR *xdrs, gfs3_readdirp_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->reply, sizeof (struct gfs3_dirplist), (xdrproc_t) xdr_gfs3_dirplist))
+ return FALSE;
+ return TRUE;
+}
diff --git a/xlators/protocol/lib/src/glusterfs-xdr.h b/xlators/protocol/lib/src/glusterfs-xdr.h
index 1870f319d..f99335c42 100644
--- a/xlators/protocol/lib/src/glusterfs-xdr.h
+++ b/xlators/protocol/lib/src/glusterfs-xdr.h
@@ -294,16 +294,6 @@ gf_stat_from_iatt (struct gf_iatt *gf_stat, struct iatt *iatt)
}
-struct gf_dirent_nb {
- uint64_t d_ino;
- uint64_t d_off;
- uint32_t d_len;
- uint32_t d_type;
- struct gf_iatt d_stat;
- char d_name[0];
-} __attribute__((packed));
-
-
/* Gluster FS Payload structures */
struct gfs3_stat_req {
@@ -831,17 +821,6 @@ struct gfs3_readdir_req {
};
typedef struct gfs3_readdir_req gfs3_readdir_req;
-struct gfs3_readdir_rsp {
- u_quad_t gfs_id;
- int op_ret;
- int op_errno;
- struct {
- u_int buf_len;
- char *buf_val;
- } buf;
-};
-typedef struct gfs3_readdir_rsp gfs3_readdir_rsp;
-
struct gfs3_readdirp_req {
u_quad_t gfs_id;
u_quad_t ino;
@@ -852,17 +831,6 @@ struct gfs3_readdirp_req {
};
typedef struct gfs3_readdirp_req gfs3_readdirp_req;
-struct gfs3_readdirp_rsp {
- u_quad_t gfs_id;
- int op_ret;
- int op_errno;
- struct {
- u_int buf_len;
- char *buf_val;
- } buf;
-};
-typedef struct gfs3_readdirp_rsp gfs3_readdirp_rsp;
-
struct gf_setvolume_req {
u_quad_t gfs_id;
struct {
@@ -1136,6 +1104,44 @@ struct gf_dump_version_rsp {
};
typedef struct gf_dump_version_rsp gf_dump_version_rsp;
+struct gfs3_dirlist {
+ u_quad_t d_ino;
+ u_quad_t d_off;
+ u_int d_len;
+ u_int d_type;
+ char *name;
+ struct gfs3_dirlist *nextentry;
+};
+typedef struct gfs3_dirlist gfs3_dirlist;
+
+struct gfs3_readdir_rsp {
+ u_quad_t gfs_id;
+ int op_ret;
+ int op_errno;
+ struct gfs3_dirlist *reply;
+};
+typedef struct gfs3_readdir_rsp gfs3_readdir_rsp;
+
+struct gfs3_dirplist {
+ u_quad_t d_ino;
+ u_quad_t d_off;
+ u_int d_len;
+ u_int d_type;
+ char *name;
+ struct gf_iatt stat;
+ struct gfs3_dirplist *nextentry;
+};
+typedef struct gfs3_dirplist gfs3_dirplist;
+
+struct gfs3_readdirp_rsp {
+ u_quad_t gfs_id;
+ int op_ret;
+ int op_errno;
+ struct gfs3_dirplist *reply;
+};
+typedef struct gfs3_readdirp_rsp gfs3_readdirp_rsp;
+
+
/* the xdr functions */
#if defined(__STDC__) || defined(__cplusplus)
@@ -1194,9 +1200,11 @@ extern bool_t xdr_gfs3_opendir_req (XDR *, gfs3_opendir_req*);
extern bool_t xdr_gfs3_opendir_rsp (XDR *, gfs3_opendir_rsp*);
extern bool_t xdr_gfs3_fsyncdir_req (XDR *, gfs3_fsyncdir_req*);
extern bool_t xdr_gfs3_readdir_req (XDR *, gfs3_readdir_req*);
+extern bool_t xdr_gfs3_dirlist (XDR *, gfs3_dirlist*);
extern bool_t xdr_gfs3_readdir_rsp (XDR *, gfs3_readdir_rsp*);
-extern bool_t xdr_gfs3_readdirp_req (XDR *, gfs3_readdirp_req*);
+extern bool_t xdr_gfs3_dirplist (XDR *, gfs3_dirplist*);
extern bool_t xdr_gfs3_readdirp_rsp (XDR *, gfs3_readdirp_rsp*);
+extern bool_t xdr_gfs3_readdirp_req (XDR *, gfs3_readdirp_req*);
extern bool_t xdr_gf_setvolume_req (XDR *, gf_setvolume_req*);
extern bool_t xdr_gf_setvolume_rsp (XDR *, gf_setvolume_rsp*);
extern bool_t xdr_gfs3_access_req (XDR *, gfs3_access_req*);
@@ -1283,9 +1291,11 @@ extern bool_t xdr_gfs3_opendir_req ();
extern bool_t xdr_gfs3_opendir_rsp ();
extern bool_t xdr_gfs3_fsyncdir_req ();
extern bool_t xdr_gfs3_readdir_req ();
+extern bool_t xdr_gfs3_dirlist ();
extern bool_t xdr_gfs3_readdir_rsp ();
-extern bool_t xdr_gfs3_readdirp_req ();
+extern bool_t xdr_gfs3_dirplist ();
extern bool_t xdr_gfs3_readdirp_rsp ();
+extern bool_t xdr_gfs3_readdirp_req ();
extern bool_t xdr_gf_setvolume_req ();
extern bool_t xdr_gf_setvolume_rsp ();
extern bool_t xdr_gfs3_access_req ();
diff --git a/xlators/protocol/lib/src/glusterfs3.x b/xlators/protocol/lib/src/glusterfs3.x
index b6cc6e6ab..c9510527c 100644
--- a/xlators/protocol/lib/src/glusterfs3.x
+++ b/xlators/protocol/lib/src/glusterfs3.x
@@ -491,10 +491,40 @@ struct gfs3_finodelk_req {
unsigned hyper offset;
unsigned int size;
};
-struct gfs3_readdir_res {
+struct gfs3_dirlist {
+ unsigned hyper d_ino;
+ unsigned hyper d_off;
+ unsigned int d_len;
+ unsigned int d_type;
+ char *name;
+ struct gfs3_dirlist *nextentry;
+};
+
+struct gfs3_readdir_rsp {
unsigned hyper gfs_id;
- opaque buf<>;
-} ;
+ int op_ret;
+ int op_errno;
+ struct gfs3_dirlist reply;
+};
+
+
+
+struct gfs3_dirplist {
+ unsigned hyper d_ino;
+ unsigned hyper d_off;
+ unsigned int d_len;
+ unsigned int d_type;
+ char *name;
+ struct gf_iatt name_attributes;
+ struct gfs3_dirplist *nextentry;
+};
+
+struct gfs3_readdirp_rsp {
+ unsigned hyper gfs_id;
+ int op_ret;
+ int op_errno;
+ struct gfs3_dirlistp reply;
+};
struct gfs3_readdirp_req {
@@ -505,12 +535,6 @@ struct gfs3_readdir_res {
unsigned hyper offset;
unsigned int size;
} ;
- struct gfs3_readdirp_rsp {
- unsigned hyper gfs_id;
- int op_ret;
- int op_errno;
- opaque buf<>;
-} ;
struct gf_setvolume_req {
diff --git a/xlators/protocol/lib/src/msg-xdr.h b/xlators/protocol/lib/src/msg-xdr.h
index 4c383e5a5..872d9401e 100644
--- a/xlators/protocol/lib/src/msg-xdr.h
+++ b/xlators/protocol/lib/src/msg-xdr.h
@@ -532,5 +532,7 @@ ssize_t
xdr_to_lookup_rsp (struct iovec inmsg, void *args);
ssize_t
xdr_to_readv_rsp (struct iovec inmsg, void *args);
+ssize_t
+xdr_to_getspec_rsp (struct iovec inmsg, void *args);
#endif /* !_MSG_XDR_H */
diff --git a/xlators/protocol/lib/src/protocol-common.c b/xlators/protocol/lib/src/protocol-common.c
deleted file mode 100644
index 4a9845e08..000000000
--- a/xlators/protocol/lib/src/protocol-common.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- 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 "globals.h"
-#include "compat.h"
-#include "protocol-common.h"
-#include "glusterfs-xdr.h"
-
-
-static int
-gf_dirent_nb_size (gf_dirent_t *entries)
-{
- return (sizeof (struct gf_dirent_nb) + strlen (entries->d_name) + 1);
-}
-
-int
-gf_dirent_serialize (gf_dirent_t *entries, char *buf, size_t buf_size)
-{
- struct gf_dirent_nb *entry_nb = NULL;
- gf_dirent_t *entry = NULL;
- int size = 0;
- int entry_size = 0;
-
-
- list_for_each_entry (entry, &entries->list, list) {
- entry_size = gf_dirent_nb_size (entry);
-
- if (buf && (size + entry_size <= buf_size)) {
- entry_nb = (void *) (buf + size);
-
- entry_nb->d_ino = entry->d_ino;
- entry_nb->d_off = entry->d_off;
- entry_nb->d_len = entry->d_len;
- entry_nb->d_type = entry->d_type;
-
- gf_stat_from_iatt (&entry_nb->d_stat, &entry->d_stat);
-
- strcpy (entry_nb->d_name, entry->d_name);
- }
- size += entry_size;
- }
-
- return size;
-}
-
-
-int
-gf_dirent_unserialize (gf_dirent_t *entries, const char *buf, size_t buf_size)
-{
- struct gf_dirent_nb *entry_nb = NULL;
- int remaining_size = 0;
- int least_dirent_size = 0;
- int count = 0;
- gf_dirent_t *entry = NULL;
- int entry_strlen = 0;
- int entry_len = 0;
-
-
- remaining_size = buf_size;
- least_dirent_size = (sizeof (struct gf_dirent_nb) + 2);
-
- while (remaining_size >= least_dirent_size) {
- entry_nb = (void *)(buf + (buf_size - remaining_size));
-
- entry_strlen = strnlen (entry_nb->d_name, remaining_size);
- if (entry_strlen == remaining_size) {
- break;
- }
-
- entry_len = sizeof (gf_dirent_t) + entry_strlen + 1;
- entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t);
- if (!entry) {
- break;
- }
-
- entry->d_ino = entry_nb->d_ino;
- entry->d_off = entry_nb->d_off;
- entry->d_len = entry_nb->d_len;
- entry->d_type = entry_nb->d_type;
-
- gf_stat_to_iatt (&entry_nb->d_stat, &entry->d_stat);
-
- strcpy (entry->d_name, entry_nb->d_name);
-
- list_add_tail (&entry->list, &entries->list);
-
- remaining_size -= (sizeof (*entry_nb) + entry_strlen + 1);
- count++;
- }
-
- return count;
-}
diff --git a/xlators/protocol/lib/src/protocol-common.h b/xlators/protocol/lib/src/protocol-common.h
index 98a79d0fa..5378d90ba 100644
--- a/xlators/protocol/lib/src/protocol-common.h
+++ b/xlators/protocol/lib/src/protocol-common.h
@@ -20,11 +20,6 @@
#ifndef _PROTOCOL_COMMON_H
#define _PROTOCOL_COMMON_H
-#define GF_PROTOCOL_DEFAULT_PORT 6971
-
-#define GF_LOCAL_IOV 1 /* All headers are here */
-#define GF_EXTRA_IOV 2 /* needed for write/read etc */
-
enum gf_fop_procnum {
GFS3_OP_NULL, /* 0 */
GFS3_OP_STAT,
@@ -79,6 +74,7 @@ enum gf_handshake_procnum {
GF_HNDSK_SETVOLUME,
GF_HNDSK_GETSPEC,
GF_HNDSK_PING,
+ GF_HNDSK_MAXVALUE,
};
enum gf_mgmt_procnum {
@@ -96,9 +92,4 @@ enum gf_mgmt_procnum {
#define GLUSTER_HNDSK_PROGRAM 14398633 /* Completely random */
#define GLUSTER_HNDSK_VERSION 1 /* 0.0.1 */
-int
-gf_dirent_unserialize (gf_dirent_t *entries, const char *buf, size_t buf_size);
-int
-gf_dirent_serialize (gf_dirent_t *entries, char *buf, size_t buf_size);
-
#endif /* !_PROTOCOL_COMMON_H */