diff options
author | JulesWang <w.jq0722@gmail.com> | 2013-01-25 11:49:18 +0800 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-01-26 11:39:34 -0800 |
commit | 710c52d23a2e7839a156c123167c6e13c8207f76 (patch) | |
tree | 87d9576bcfedc84091b5d9e686cb7d0a2a629e76 /xlators/mgmt/glusterd/src/glusterd-utils.c | |
parent | 0cd9ef501d4e938a49da7835d96cec9f72521ecd (diff) |
glusterd: make 'glusterd_is_local_addr' return bool
Change-Id: Id3bd0bfc4802c166f7a32b0cc6a726aeb5617b5d
BUG: 890618
Signed-off-by: JulesWang <w.jq0722@gmail.com>
Reviewed-on: http://review.gluster.org/4427
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index d093301cea9..b68ba252ebc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -191,15 +191,13 @@ get_ip_from_addrinfo (struct addrinfo *addr, char **ip) return *ip; } -/*TODO:FIXME: The function is expected to return a "yes/no" result. - change return type to bool.*/ -int32_t +gf_boolean_t glusterd_is_local_addr (char *hostname) { int32_t ret = -1; struct addrinfo *result = NULL; struct addrinfo *res = NULL; - int32_t found = 0; + gf_boolean_t found = _gf_false; int sd = -1; char *ip = NULL; xlator_t *this = NULL; @@ -244,7 +242,7 @@ out: if (!found) gf_log (this->name, GF_LOG_DEBUG, "%s is not local", hostname); - return !found; + return found; } int32_t @@ -4060,7 +4058,7 @@ glusterd_get_brickinfo (xlator_t *this, const char *brickname, int port, list_for_each_entry (volinfo, &priv->volumes, vol_list) { list_for_each_entry (tmpbrkinfo, &volinfo->bricks, brick_list) { - if (localhost && glusterd_is_local_addr (tmpbrkinfo->hostname)) + if (localhost && !glusterd_is_local_addr (tmpbrkinfo->hostname)) continue; if (!strcmp(tmpbrkinfo->path, brickname) && (tmpbrkinfo->port == port)) { @@ -4725,11 +4723,12 @@ glusterd_hostname_to_uuid (char *hostname, uuid_t uuid) ret = glusterd_friend_find_by_hostname (hostname, &peerinfo); if (ret) { - ret = glusterd_is_local_addr (hostname); - if (ret) - goto out; - else + if (glusterd_is_local_addr (hostname)) { uuid_copy (uuid, MY_UUID); + ret = 0; + } else { + goto out; + } } else { uuid_copy (uuid, peerinfo->uuid); } |