summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/legacy/transport
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-06-29 03:39:16 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-01 03:31:47 -0700
commitc46f8452d75e2f1b4ab77306177f39bdbb4b232c (patch)
tree6c583bc3d79fdaab83aac6933c5848583ff1fe66 /xlators/protocol/legacy/transport
parent0da2a6d08cc8fc2315742d010c8a8cab38ef75bb (diff)
backward compatibility of protocol
* made most of the 'legacy' server and transport functions as 'static' as they were getting cross linked with newer functions. * changed the name of few functions with prefix 'gf_' Signed-off-by: Amar Tumballi <amar@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
Diffstat (limited to 'xlators/protocol/legacy/transport')
-rw-r--r--xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c21
-rw-r--r--xlators/protocol/legacy/transport/ib-verbs/src/name.c24
-rw-r--r--xlators/protocol/legacy/transport/ib-verbs/src/name.h20
-rw-r--r--xlators/protocol/legacy/transport/socket/src/name.c30
-rw-r--r--xlators/protocol/legacy/transport/socket/src/name.h24
-rw-r--r--xlators/protocol/legacy/transport/socket/src/socket.c90
6 files changed, 96 insertions, 113 deletions
diff --git a/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c b/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c
index c14be17e6e8..6714d32e7d8 100644
--- a/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c
+++ b/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c
@@ -2135,7 +2135,7 @@ tcp_connect_finish (transport_t *this)
goto unlock;
}
- get_transport_identifiers (this);
+ gf_ibverbs_get_transport_identifiers (this);
priv->tcp_connected = 1;
}
@@ -2249,8 +2249,9 @@ ib_verbs_connect (struct transport *this)
}
}
- ret = ibverbs_client_get_remote_sockaddr (this, (struct sockaddr *)&sockaddr,
- &sockaddr_len);
+ ret = gf_ibverbs_client_get_remote_sockaddr (this,
+ (struct sockaddr *)&sockaddr,
+ &sockaddr_len);
if (ret != 0) {
gf_log (this->xl->name, GF_LOG_DEBUG,
"cannot get remote address to connect");
@@ -2299,9 +2300,9 @@ ib_verbs_connect (struct transport *this)
}
}
- ret = client_bind (this,
- (struct sockaddr *)&this->myinfo.sockaddr,
- &this->myinfo.sockaddr_len, priv->sock);
+ ret = gf_ibverbs_client_bind (this,
+ (struct sockaddr *)&this->myinfo.sockaddr,
+ &this->myinfo.sockaddr_len, priv->sock);
if (ret == -1)
{
gf_log (this->xl->name, GF_LOG_WARNING,
@@ -2393,7 +2394,7 @@ ib_verbs_server_event_handler (int fd, int idx, void *data,
priv->peer.trans = this;
transport_ref (this);
- get_transport_identifiers (this);
+ gf_ibverbs_get_transport_identifiers (this);
priv->tcp_connected = 1;
priv->handshake.incoming.state = IB_VERBS_HANDSHAKE_START;
@@ -2434,9 +2435,9 @@ ib_verbs_listen (transport_t *this)
char service[NI_MAXSERV], host[NI_MAXHOST];
memset (&sockaddr, 0, sizeof (sockaddr));
- ret = ibverbs_server_get_local_sockaddr (this,
- (struct sockaddr *)&sockaddr,
- &sockaddr_len);
+ ret = gf_ibverbs_server_get_local_sockaddr (this,
+ (struct sockaddr *)&sockaddr,
+ &sockaddr_len);
if (ret != 0) {
gf_log (this->xl->name, GF_LOG_DEBUG,
"cannot find network address of server to bind to");
diff --git a/xlators/protocol/legacy/transport/ib-verbs/src/name.c b/xlators/protocol/legacy/transport/ib-verbs/src/name.c
index a3e18481458..1b8f83c293e 100644
--- a/xlators/protocol/legacy/transport/ib-verbs/src/name.c
+++ b/xlators/protocol/legacy/transport/ib-verbs/src/name.c
@@ -412,11 +412,11 @@ out:
return ret;
}
-int32_t
-client_bind (transport_t *this,
- struct sockaddr *sockaddr,
- socklen_t *sockaddr_len,
- int sock)
+int32_t
+gf_ibverbs_client_bind (transport_t *this,
+ struct sockaddr *sockaddr,
+ socklen_t *sockaddr_len,
+ int sock)
{
int ret = 0;
@@ -457,9 +457,9 @@ client_bind (transport_t *this,
}
int32_t
-ibverbs_client_get_remote_sockaddr (transport_t *this,
- struct sockaddr *sockaddr,
- socklen_t *sockaddr_len)
+gf_ibverbs_client_get_remote_sockaddr (transport_t *this,
+ struct sockaddr *sockaddr,
+ socklen_t *sockaddr_len)
{
int32_t ret = 0;
char is_inet_sdp = 0;
@@ -506,9 +506,9 @@ err:
}
int32_t
-ibverbs_server_get_local_sockaddr (transport_t *this,
- struct sockaddr *addr,
- socklen_t *addr_len)
+gf_ibverbs_server_get_local_sockaddr (transport_t *this,
+ struct sockaddr *addr,
+ socklen_t *addr_len)
{
data_t *address_family_data = NULL;
int32_t ret = 0;
@@ -647,7 +647,7 @@ fill_inet6_inet_identifiers (transport_t *this, struct sockaddr_storage *addr,
}
int32_t
-get_transport_identifiers (transport_t *this)
+gf_ibverbs_get_transport_identifiers (transport_t *this)
{
int32_t ret = 0;
char is_inet_sdp = 0;
diff --git a/xlators/protocol/legacy/transport/ib-verbs/src/name.h b/xlators/protocol/legacy/transport/ib-verbs/src/name.h
index 4f0f47711d2..e2575794bc7 100644
--- a/xlators/protocol/legacy/transport/ib-verbs/src/name.h
+++ b/xlators/protocol/legacy/transport/ib-verbs/src/name.h
@@ -25,23 +25,23 @@
#include "compat.h"
-int32_t
-client_bind (transport_t *this,
- struct sockaddr *sockaddr,
- socklen_t *sockaddr_len,
- int sock);
+int32_t
+gf_ibverbs_client_bind (transport_t *this,
+ struct sockaddr *sockaddr,
+ socklen_t *sockaddr_len,
+ int sock);
int32_t
-ibverbs_client_get_remote_sockaddr (transport_t *this,
- struct sockaddr *sockaddr,
+gf_ibverbs_client_get_remote_sockaddr (transport_t *this,
+ struct sockaddr *sockaddr,
socklen_t *sockaddr_len);
int32_t
-ibverbs_server_get_local_sockaddr (transport_t *this,
- struct sockaddr *addr,
+gf_ibverbs_server_get_local_sockaddr (transport_t *this,
+ struct sockaddr *addr,
socklen_t *addr_len);
int32_t
-get_transport_identifiers (transport_t *this);
+gf_ibverbs_get_transport_identifiers (transport_t *this);
#endif /* _IB_VERBS_NAME_H */
diff --git a/xlators/protocol/legacy/transport/socket/src/name.c b/xlators/protocol/legacy/transport/socket/src/name.c
index 74abe4480a2..b0fc7b4db3c 100644
--- a/xlators/protocol/legacy/transport/socket/src/name.c
+++ b/xlators/protocol/legacy/transport/socket/src/name.c
@@ -121,7 +121,7 @@ err:
return ret;
}
-int32_t
+static int32_t
client_fill_address_family (transport_t *this, sa_family_t *sa_family)
{
data_t *address_family_data = NULL;
@@ -351,9 +351,9 @@ err:
return ret;
}
-static int32_t
-af_inet_server_get_local_sockaddr (transport_t *this,
- struct sockaddr *addr,
+static int32_t
+af_inet_server_get_local_sockaddr (transport_t *this,
+ struct sockaddr *addr,
socklen_t *addr_len)
{
struct addrinfo hints, *res = 0;
@@ -422,10 +422,10 @@ out:
return ret;
}
-int32_t
-client_bind (transport_t *this,
- struct sockaddr *sockaddr,
- socklen_t *sockaddr_len,
+int32_t
+gf_client_bind (transport_t *this,
+ struct sockaddr *sockaddr,
+ socklen_t *sockaddr_len,
int sock)
{
int ret = 0;
@@ -465,8 +465,8 @@ client_bind (transport_t *this,
}
int32_t
-socket_client_get_remote_sockaddr (transport_t *this,
- struct sockaddr *sockaddr,
+gf_socket_client_get_remote_sockaddr (transport_t *this,
+ struct sockaddr *sockaddr,
socklen_t *sockaddr_len,
sa_family_t *sa_family)
{
@@ -519,7 +519,7 @@ err:
}
-int32_t
+static int32_t
server_fill_address_family (transport_t *this, sa_family_t *sa_family)
{
data_t *address_family_data = NULL;
@@ -564,7 +564,7 @@ out:
int32_t
-socket_server_get_local_sockaddr (transport_t *this, struct sockaddr *addr,
+gf_socket_server_get_local_sockaddr (transport_t *this, struct sockaddr *addr,
socklen_t *addr_len, sa_family_t *sa_family)
{
int32_t ret = -1;
@@ -604,8 +604,8 @@ err:
return ret;
}
-int32_t
-fill_inet6_inet_identifiers (transport_t *this, struct sockaddr_storage *addr,
+static int32_t
+fill_inet6_inet_identifiers (transport_t *this, struct sockaddr_storage *addr,
int32_t addr_len, char *identifier)
{
int32_t ret = 0, tmpaddr_len = 0;
@@ -675,7 +675,7 @@ fill_inet6_inet_identifiers (transport_t *this, struct sockaddr_storage *addr,
}
int32_t
-get_transport_identifiers (transport_t *this)
+gf_get_transport_identifiers (transport_t *this)
{
int32_t ret = 0;
char is_inet_sdp = 0;
diff --git a/xlators/protocol/legacy/transport/socket/src/name.h b/xlators/protocol/legacy/transport/socket/src/name.h
index f50a7b7f4dd..1853781bd7c 100644
--- a/xlators/protocol/legacy/transport/socket/src/name.h
+++ b/xlators/protocol/legacy/transport/socket/src/name.h
@@ -22,23 +22,23 @@
#include "compat.h"
-int32_t
-client_bind (transport_t *this,
- struct sockaddr *sockaddr,
- socklen_t *sockaddr_len,
- int sock);
+int32_t
+gf_client_bind (transport_t *this,
+ struct sockaddr *sockaddr,
+ socklen_t *sockaddr_len,
+ int sock);
int32_t
-socket_client_get_remote_sockaddr (transport_t *this,
- struct sockaddr *sockaddr,
- socklen_t *sockaddr_len,
- sa_family_t *sa_family);
+gf_socket_client_get_remote_sockaddr (transport_t *this,
+ struct sockaddr *sockaddr,
+ socklen_t *sockaddr_len,
+ sa_family_t *sa_family);
int32_t
-socket_server_get_local_sockaddr (transport_t *this, struct sockaddr *addr,
- socklen_t *addr_len, sa_family_t *sa_family);
+gf_socket_server_get_local_sockaddr (transport_t *this, struct sockaddr *addr,
+ socklen_t *addr_len, sa_family_t *sa_family);
int32_t
-get_transport_identifiers (transport_t *this);
+gf_get_transport_identifiers (transport_t *this);
#endif /* _SOCKET_NAME_H */
diff --git a/xlators/protocol/legacy/transport/socket/src/socket.c b/xlators/protocol/legacy/transport/socket/src/socket.c
index fd3815d83fe..128b1ce6997 100644
--- a/xlators/protocol/legacy/transport/socket/src/socket.c
+++ b/xlators/protocol/legacy/transport/socket/src/socket.c
@@ -41,7 +41,7 @@
#define GF_LOG_ERRNO(errno) ((errno == ENOTCONN) ? GF_LOG_DEBUG : GF_LOG_ERROR)
#define SA(ptr) ((struct sockaddr *)ptr)
-int socket_init (transport_t *this);
+static int socket_init (transport_t *this);
/*
* return value:
@@ -50,7 +50,7 @@ int socket_init (transport_t *this);
* > 0 = incomplete
*/
-int
+static int
__socket_rwv (transport_t *this, struct iovec *vector, int count,
struct iovec **pending_vector, int *pending_count,
int write)
@@ -134,7 +134,7 @@ __socket_rwv (transport_t *this, struct iovec *vector, int count,
}
-int
+static int
__socket_readv (transport_t *this, struct iovec *vector, int count,
struct iovec **pending_vector, int *pending_count)
{
@@ -147,7 +147,7 @@ __socket_readv (transport_t *this, struct iovec *vector, int count,
}
-int
+static int
__socket_writev (transport_t *this, struct iovec *vector, int count,
struct iovec **pending_vector, int *pending_count)
{
@@ -160,7 +160,7 @@ __socket_writev (transport_t *this, struct iovec *vector, int count,
}
-int
+static int
__socket_disconnect (transport_t *this)
{
socket_private_t *priv = NULL;
@@ -180,7 +180,7 @@ __socket_disconnect (transport_t *this)
}
-int
+static int
__socket_server_bind (transport_t *this)
{
socket_private_t *priv = NULL;
@@ -215,7 +215,7 @@ __socket_server_bind (transport_t *this)
}
-int
+static int
__socket_nonblock (int fd)
{
int flags = 0;
@@ -230,7 +230,7 @@ __socket_nonblock (int fd)
}
-int
+static int
__socket_nodelay (int fd)
{
int on = 1;
@@ -246,7 +246,7 @@ __socket_nodelay (int fd)
}
-int
+static int
__socket_keepalive (int fd, int keepalive_intvl)
{
int on = 1;
@@ -285,7 +285,7 @@ err:
}
-int
+static int
__socket_connect_finish (int fd)
{
int ret = -1;
@@ -303,7 +303,7 @@ __socket_connect_finish (int fd)
}
-void
+static void
__socket_reset (transport_t *this)
{
socket_private_t *priv = NULL;
@@ -328,7 +328,7 @@ __socket_reset (transport_t *this)
}
-struct ioq *
+static struct ioq *
__socket_ioq_new (transport_t *this, char *buf, int len,
struct iovec *vector, int count, struct iobref *iobref)
{
@@ -379,7 +379,7 @@ __socket_ioq_new (transport_t *this, char *buf, int len,
}
-void
+static void
__socket_ioq_entry_free (struct ioq *entry)
{
list_del_init (&entry->list);
@@ -394,7 +394,7 @@ __socket_ioq_entry_free (struct ioq *entry)
}
-void
+static void
__socket_ioq_flush (transport_t *this)
{
socket_private_t *priv = NULL;
@@ -411,7 +411,7 @@ __socket_ioq_flush (transport_t *this)
}
-int
+static int
__socket_ioq_churn_entry (transport_t *this, struct ioq *entry)
{
int ret = -1;
@@ -431,7 +431,7 @@ __socket_ioq_churn_entry (transport_t *this, struct ioq *entry)
}
-int
+static int
__socket_ioq_churn (transport_t *this)
{
socket_private_t *priv = NULL;
@@ -460,7 +460,7 @@ __socket_ioq_churn (transport_t *this)
}
-int
+static int
socket_event_poll_err (transport_t *this)
{
socket_private_t *priv = NULL;
@@ -481,7 +481,7 @@ socket_event_poll_err (transport_t *this)
}
-int
+static int
socket_event_poll_out (transport_t *this)
{
socket_private_t *priv = NULL;
@@ -507,7 +507,7 @@ socket_event_poll_out (transport_t *this)
}
-int
+static int
__socket_proto_validate_header (transport_t *this,
struct socket_header *header,
size_t *size1_p, size_t *size2_p)
@@ -560,7 +560,7 @@ __socket_proto_validate_header (transport_t *this,
/* socket protocol state machine */
-int
+static int
__socket_proto_state_machine (transport_t *this)
{
int ret = -1;
@@ -741,7 +741,7 @@ unlock:
}
-int
+static int
socket_proto_state_machine (transport_t *this)
{
socket_private_t *priv = NULL;
@@ -759,7 +759,7 @@ socket_proto_state_machine (transport_t *this)
}
-int
+static int
socket_event_poll_in (transport_t *this)
{
int ret = -1;
@@ -776,7 +776,7 @@ socket_event_poll_in (transport_t *this)
}
-int
+static int
socket_connect_finish (transport_t *this)
{
int ret = -1;
@@ -831,7 +831,7 @@ socket_connect_finish (transport_t *this)
priv->connected = 1;
priv->connect_finish_log = 0;
event = GF_EVENT_CHILD_UP;
- get_transport_identifiers (this);
+ gf_get_transport_identifiers (this);
}
}
unlock:
@@ -844,7 +844,7 @@ unlock:
}
-int
+static int
socket_event_handler (int fd, int idx, void *data,
int poll_in, int poll_out, int poll_err)
{
@@ -882,7 +882,7 @@ socket_event_handler (int fd, int idx, void *data,
}
-int
+static int
socket_server_event_handler (int fd, int idx, void *data,
int poll_in, int poll_out, int poll_err)
{
@@ -965,7 +965,7 @@ socket_server_event_handler (int fd, int idx, void *data,
goto unlock;
}
- get_transport_identifiers (new_trans);
+ gf_get_transport_identifiers (new_trans);
socket_init (new_trans);
new_trans->ops = this->ops;
new_trans->init = this->init;
@@ -998,7 +998,7 @@ unlock:
}
-int
+static int
socket_disconnect (transport_t *this)
{
socket_private_t *priv = NULL;
@@ -1016,7 +1016,7 @@ socket_disconnect (transport_t *this)
}
-int
+static int
socket_connect (transport_t *this)
{
int ret = -1;
@@ -1049,7 +1049,7 @@ socket_connect (transport_t *this)
goto err;
}
- ret = socket_client_get_remote_sockaddr (this, SA (&sockaddr),
+ ret = gf_socket_client_get_remote_sockaddr (this, SA (&sockaddr),
&sockaddr_len, &sa_family);
if (ret == -1) {
/* logged inside client_get_remote_sockaddr */
@@ -1131,7 +1131,7 @@ socket_connect (transport_t *this)
SA (&this->myinfo.sockaddr)->sa_family =
SA (&this->peerinfo.sockaddr)->sa_family;
- ret = client_bind (this, SA (&this->myinfo.sockaddr),
+ ret = gf_client_bind (this, SA (&this->myinfo.sockaddr),
&this->myinfo.sockaddr_len, priv->sock);
if (ret == -1) {
gf_log (this->xl->name, GF_LOG_WARNING,
@@ -1170,7 +1170,7 @@ err:
}
-int
+static int
socket_listen (transport_t *this)
{
socket_private_t * priv = NULL;
@@ -1198,7 +1198,7 @@ socket_listen (transport_t *this)
return ret;
}
- ret = socket_server_get_local_sockaddr (this, SA (&sockaddr),
+ ret = gf_socket_server_get_local_sockaddr (this, SA (&sockaddr),
&sockaddr_len, &sa_family);
if (ret == -1) {
return ret;
@@ -1310,7 +1310,7 @@ unlock:
}
-int
+static int
socket_receive (transport_t *this, char **hdr_p, size_t *hdrlen_p,
struct iobuf **iobuf_p)
{
@@ -1353,7 +1353,7 @@ unlock:
/* TODO: implement per transfer limit */
-int
+static int
socket_submit (transport_t *this, char *buf, int len,
struct iovec *vector, int count,
struct iobref *iobref)
@@ -1423,7 +1423,7 @@ struct transport_ops tops = {
};
-int
+static int
socket_init (transport_t *this)
{
socket_private_t *priv = NULL;
@@ -1554,24 +1554,6 @@ fini (transport_t *this)
GF_FREE (priv);
}
-int32_t
-mem_acct_init (xlator_t *this)
-{
- int ret = -1;
-
- if (!this)
- return ret;
-
- ret = xlator_mem_acct_init (this, gf_common_mt_end + 1);
-
- if (ret != 0) {
- gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
- "failed");
- return ret;
- }
-
- return ret;
-}
int32_t
init (transport_t *this)