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/stripe/src/stripe.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'xlators/cluster/stripe/src') diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 8896d7a2ad2..7ac131b2ca9 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -244,11 +244,11 @@ stripe_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->postparent_size < postparent->ia_size) local->postparent_size = postparent->ia_size; - if (uuid_is_null (local->ia_gfid)) - uuid_copy (local->ia_gfid, buf->ia_gfid); + if (gf_uuid_is_null (local->ia_gfid)) + gf_uuid_copy (local->ia_gfid, buf->ia_gfid); /* Make sure the gfid on all the nodes are same */ - if (uuid_compare (local->ia_gfid, buf->ia_gfid)) { + if (gf_uuid_compare (local->ia_gfid, buf->ia_gfid)) { gf_log (this->name, GF_LOG_WARNING, "%s: gfid different on subvolume %s", local->loc.path, prev->this->name); @@ -259,7 +259,7 @@ stripe_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!callcnt) { if (local->op_ret == 0 && local->entry_self_heal_needed && - !uuid_is_null (local->loc.inode->gfid)) + !gf_uuid_is_null (local->loc.inode->gfid)) stripe_entry_self_heal (frame, this, local); if (local->failed) @@ -1485,8 +1485,8 @@ stripe_mknod_ifreg_cbk (call_frame_t *frame, void *cookie, xlator_t *this, /* Can be used as a mechanism to understand if mknod was successful in at least one place */ - if (uuid_is_null (local->ia_gfid)) - uuid_copy (local->ia_gfid, buf->ia_gfid); + if (gf_uuid_is_null (local->ia_gfid)) + gf_uuid_copy (local->ia_gfid, buf->ia_gfid); if (stripe_ctx_handle(this, prev, local, xdata)) gf_log(this->name, GF_LOG_ERROR, @@ -1512,7 +1512,7 @@ stripe_mknod_ifreg_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->failed) local->op_ret = -1; - if ((local->op_ret == -1) && !uuid_is_null (local->ia_gfid)) { + if ((local->op_ret == -1) && !gf_uuid_is_null (local->ia_gfid)) { /* ia_gfid set means, at least on one node 'mknod' is successful */ local->call_count = priv->child_count; @@ -1590,8 +1590,8 @@ stripe_mknod_first_ifreg_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->preparent = *preparent; local->postparent = *postparent; - if (uuid_is_null (local->ia_gfid)) - uuid_copy (local->ia_gfid, buf->ia_gfid); + if (gf_uuid_is_null (local->ia_gfid)) + gf_uuid_copy (local->ia_gfid, buf->ia_gfid); local->preparent.ia_blocks = local->preparent_blocks; local->preparent.ia_size = local->preparent_size; local->postparent.ia_blocks = local->postparent_blocks; @@ -4910,7 +4910,7 @@ stripe_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, loc.inode = inode_ref (local_entry->inode); - uuid_copy (loc.gfid, local_entry->d_stat.ia_gfid); + gf_uuid_copy (loc.gfid, local_entry->d_stat.ia_gfid); local_ent->orig_frame = frame; -- cgit