diff options
Diffstat (limited to 'rpc')
| -rw-r--r-- | rpc/rpc-lib/src/rpc-transport.c | 27 | ||||
| -rw-r--r-- | rpc/rpc-lib/src/rpc-transport.h | 2 | ||||
| -rw-r--r-- | rpc/rpc-transport/rdma/src/rdma.c | 2 | 
3 files changed, 29 insertions, 2 deletions
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c index 266d07e99ed..f6774b72353 100644 --- a/rpc/rpc-lib/src/rpc-transport.c +++ b/rpc/rpc-lib/src/rpc-transport.c @@ -33,6 +33,31 @@  #define GF_OPTION_LIST_EMPTY(_opt) (_opt->value[0] == NULL)  #endif +int32_t +rpc_transport_count (const char *transport_type) +{ +        char     *transport_dup   = NULL; +        char     *saveptr         = NULL; +        char     *ptr             = NULL; +        int       count           = 0; + +        if (transport_type == NULL) +                return -1; + +        transport_dup = gf_strdup (transport_type); +        if (transport_dup == NULL) { +                return -1; +        } + +        ptr = strtok_r (transport_dup, ",", &saveptr); +        while (ptr != NULL) { +                count++; +                ptr = strtok_r (NULL, ",", &saveptr); +        } + +        GF_FREE (transport_dup); +        return count; +}  int  rpc_transport_get_myaddr (rpc_transport_t *this, char *peeraddr, int addrlen, @@ -329,7 +354,7 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)  	ret = trans->init (trans);  	if (ret != 0) { -		gf_log ("rpc-transport", GF_LOG_ERROR, +		gf_log ("rpc-transport", GF_LOG_WARNING,  			"'%s' initialization failed", type);  		goto fail;  	} diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h index 2beff0822a2..d1c650e7ec1 100644 --- a/rpc/rpc-lib/src/rpc-transport.h +++ b/rpc/rpc-lib/src/rpc-transport.h @@ -241,6 +241,8 @@ struct rpc_transport_ops {          int32_t (*throttle)       (rpc_transport_t *this, gf_boolean_t onoff);  }; +int32_t +rpc_transport_count (const char *transport_type);  int32_t  rpc_transport_listen (rpc_transport_t *this); diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c index 92d5da258f2..d3b9c6354b4 100644 --- a/rpc/rpc-transport/rdma/src/rdma.c +++ b/rpc/rpc-transport/rdma/src/rdma.c @@ -4561,7 +4561,7 @@ init (rpc_transport_t *this)          this->private = priv;          if (gf_rdma_init (this)) { -                gf_log (this->name, GF_LOG_ERROR, +                gf_log (this->name, GF_LOG_WARNING,                          "Failed to initialize IB Device");                  return -1;          }  | 
