From 28397cae4102ac3f08576ebaf071ad92683097e8 Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Thu, 2 Apr 2015 15:51:30 +0200 Subject: Avoid conflict between contrib/uuid and system uuid glusterfs relies on Linux uuid implementation, which API is incompatible with most other systems's uuid. As a result, libglusterfs has to embed contrib/uuid, which is the Linux implementation, on non Linux systems. This implementation is incompatible with systtem's built in, but the symbols have the same names. Usually this is not a problem because when we link with -lglusterfs, libc's symbols are trumped. However there is a problem when a program not linked with -lglusterfs will dlopen() glusterfs component. In such a case, libc's uuid implementation is already loaded in the calling program, and it will be used instead of libglusterfs's implementation, causing crashes. A possible workaround is to use pre-load libglusterfs in the calling program (using LD_PRELOAD on NetBSD for instance), but such a mechanism is not portable, nor is it flexible. A much better approach is to rename libglusterfs's uuid_* functions to gf_uuid_* to avoid any possible conflict. This is what this change attempts. BUG: 1206587 Change-Id: I9ccd3e13afed1c7fc18508e92c7beb0f5d49f31a Signed-off-by: Emmanuel Dreyfus Reviewed-on: http://review.gluster.org/10017 Tested-by: Gluster Build System Reviewed-by: Niels de Vos --- xlators/cluster/dht/src/dht-selfheal.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'xlators/cluster/dht/src/dht-selfheal.c') diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index 727b2d6027d..f0f44ebf77a 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -657,7 +657,7 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc, goto err; } - uuid_unparse(loc->inode->gfid, gfid); + gf_uuid_unparse(loc->inode->gfid, gfid); ret = dht_disk_layout_extract (this, layout, i, &disk_layout); if (ret == -1) { @@ -700,8 +700,8 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc, } } - if (!uuid_is_null (local->gfid)) - uuid_copy (loc->gfid, local->gfid); + if (!gf_uuid_is_null (local->gfid)) + gf_uuid_copy (loc->gfid, local->gfid); STACK_WIND (frame, dht_selfheal_dir_xattr_cbk, subvol, subvol->fops->setxattr, @@ -1041,8 +1041,8 @@ dht_selfheal_dir_setattr (call_frame_t *frame, loc_t *loc, struct iatt *stbuf, return 0; } - if (!uuid_is_null (local->gfid)) - uuid_copy (loc->gfid, local->gfid); + if (!gf_uuid_is_null (local->gfid)) + gf_uuid_copy (loc->gfid, local->gfid); local->call_cnt = missing_attr; for (i = 0; i < layout->cnt; i++) { @@ -1093,7 +1093,7 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret) { - uuid_unparse(local->loc.gfid, gfid); + gf_uuid_unparse(local->loc.gfid, gfid); gf_msg (this->name, ((op_errno == EEXIST) ? GF_LOG_DEBUG : GF_LOG_WARNING), op_errno, DHT_MSG_DIR_SELFHEAL_FAILED, @@ -1188,7 +1188,7 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc, } local->call_cnt = missing_dirs; - if (!uuid_is_null (local->gfid)) { + if (!gf_uuid_is_null (local->gfid)) { dict = dict_new (); if (!dict) return -1; @@ -1739,7 +1739,7 @@ dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk, local = frame->local; this = frame->this; - uuid_unparse(loc->gfid, gfid); + gf_uuid_unparse(loc->gfid, gfid); dht_layout_anomalies (this, loc, layout, &local->selfheal.hole_cnt, @@ -1915,7 +1915,7 @@ dht_dir_attr_heal (void *data) (GF_SET_ATTR_UID | GF_SET_ATTR_GID), NULL, NULL); if (ret) { - uuid_unparse(local->loc.gfid, gfid); + gf_uuid_unparse(local->loc.gfid, gfid); gf_msg ("dht", GF_LOG_ERROR, -ret, DHT_MSG_DIR_ATTR_HEAL_FAILED, -- cgit