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/features/marker/src/marker.c | 46 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'xlators/features/marker/src/marker.c') diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index dc56714a94c..b1eb252c5c2 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -66,8 +66,8 @@ marker_loc_fill (loc_t *loc, inode_t *inode, inode_t *parent, char *path) if (inode) { loc->inode = inode_ref (inode); - if (uuid_is_null (loc->gfid)) { - uuid_copy (loc->gfid, loc->inode->gfid); + if (gf_uuid_is_null (loc->gfid)) { + gf_uuid_copy (loc->gfid, loc->inode->gfid); } } @@ -501,8 +501,8 @@ marker_start_setxattr (call_frame_t *frame, xlator_t *this) if (!dict) goto out; - if (local->loc.inode && uuid_is_null (local->loc.gfid)) - uuid_copy (local->loc.gfid, local->loc.inode->gfid); + if (local->loc.inode && gf_uuid_is_null (local->loc.gfid)) + gf_uuid_copy (local->loc.gfid, local->loc.inode->gfid); GF_UUID_ASSERT (local->loc.gfid); @@ -605,8 +605,8 @@ marker_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1 || local == NULL) goto out; - if (uuid_is_null (local->loc.gfid)) - uuid_copy (local->loc.gfid, buf->ia_gfid); + if (gf_uuid_is_null (local->loc.gfid)) + gf_uuid_copy (local->loc.gfid, buf->ia_gfid); priv = this->private; @@ -679,8 +679,8 @@ marker_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1 || local == NULL) goto out; - if (uuid_is_null (local->loc.gfid)) - uuid_copy (local->loc.gfid, buf->ia_gfid); + if (gf_uuid_is_null (local->loc.gfid)) + gf_uuid_copy (local->loc.gfid, buf->ia_gfid); priv = this->private; @@ -1089,7 +1089,7 @@ marker_rename_done (call_frame_t *frame, void *cookie, xlator_t *this, if (priv->feature_enabled & GF_XTIME) { //update marks on oldpath - uuid_copy (local->loc.gfid, oplocal->loc.inode->gfid); + gf_uuid_copy (local->loc.gfid, oplocal->loc.inode->gfid); marker_xtime_update_marks (this, oplocal); marker_xtime_update_marks (this, local); } @@ -1244,7 +1244,7 @@ marker_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (newloc.name) newloc.name++; newloc.parent = inode_ref (local->loc.parent); - uuid_copy (newloc.gfid, oplocal->loc.inode->gfid); + gf_uuid_copy (newloc.gfid, oplocal->loc.inode->gfid); STACK_WIND_COOKIE (frame, marker_rename_release_oldp_lock, frame->cookie, FIRST_CHILD(this), @@ -1265,7 +1265,7 @@ marker_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (priv->feature_enabled & GF_XTIME) { //update marks on oldpath - uuid_copy (local->loc.gfid, oplocal->loc.inode->gfid); + gf_uuid_copy (local->loc.gfid, oplocal->loc.inode->gfid); marker_xtime_update_marks (this, oplocal); marker_xtime_update_marks (this, local); } @@ -1385,8 +1385,8 @@ marker_get_newpath_contribution (call_frame_t *frame, void *cookie, * reset them in the callback. */ MARKER_SET_UID_GID (frame, local, frame->root); - if (uuid_is_null (local->loc.gfid)) - uuid_copy (local->loc.gfid, local->loc.inode->gfid); + if (gf_uuid_is_null (local->loc.gfid)) + gf_uuid_copy (local->loc.gfid, local->loc.inode->gfid); GF_UUID_ASSERT (local->loc.gfid); @@ -1439,8 +1439,8 @@ marker_get_oldpath_contribution (call_frame_t *frame, void *cookie, */ MARKER_SET_UID_GID (frame, local, frame->root); - if (uuid_is_null (oplocal->loc.gfid)) - uuid_copy (oplocal->loc.gfid, + if (gf_uuid_is_null (oplocal->loc.gfid)) + gf_uuid_copy (oplocal->loc.gfid, oplocal->loc.inode->gfid); GF_UUID_ASSERT (oplocal->loc.gfid); @@ -1567,7 +1567,7 @@ marker_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, goto err; if ((newloc->inode != NULL) && (newloc->parent != oldloc->parent) - && (uuid_compare (newloc->parent->gfid, + && (gf_uuid_compare (newloc->parent->gfid, oldloc->parent->gfid) < 0)) { lock_on = &local->parent_loc; local->next_lock_on = &oplocal->parent_loc; @@ -1767,8 +1767,8 @@ marker_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1 || local == NULL) goto out; - if (uuid_is_null (local->loc.gfid)) - uuid_copy (local->loc.gfid, buf->ia_gfid); + if (gf_uuid_is_null (local->loc.gfid)) + gf_uuid_copy (local->loc.gfid, buf->ia_gfid); priv = this->private; @@ -1841,8 +1841,8 @@ marker_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1 || local == NULL) goto out; - if (uuid_is_null (local->loc.gfid)) - uuid_copy (local->loc.gfid, buf->ia_gfid); + if (gf_uuid_is_null (local->loc.gfid)) + gf_uuid_copy (local->loc.gfid, buf->ia_gfid); priv = this->private; @@ -2675,8 +2675,8 @@ marker_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * would have not yet linked to the inode table which happens * in protocol/server. */ - if (uuid_is_null (local->loc.gfid)) - uuid_copy (local->loc.gfid, buf->ia_gfid); + if (gf_uuid_is_null (local->loc.gfid)) + gf_uuid_copy (local->loc.gfid, buf->ia_gfid); if (priv->feature_enabled & GF_QUOTA) { @@ -2915,7 +2915,7 @@ init_xtime_priv (xlator_t *this, dict_t *options) if((data = dict_get (options, VOLUME_UUID)) != NULL) { priv->volume_uuid = data->data; - ret = uuid_parse (priv->volume_uuid, priv->volume_uuid_bin); + ret = gf_uuid_parse (priv->volume_uuid, priv->volume_uuid_bin); if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, "invalid volume uuid %s", priv->volume_uuid); -- cgit