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/mount/fuse/src/fuse-resolve.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'xlators/mount/fuse/src/fuse-resolve.c') diff --git a/xlators/mount/fuse/src/fuse-resolve.c b/xlators/mount/fuse/src/fuse-resolve.c index 5aaa32ea660..2ddb31cd076 100644 --- a/xlators/mount/fuse/src/fuse-resolve.c +++ b/xlators/mount/fuse/src/fuse-resolve.c @@ -93,7 +93,7 @@ fuse_resolve_entry (fuse_state_t *state) resolve_loc = &resolve->resolve_loc; resolve_loc->parent = inode_ref (state->loc_now->parent); - uuid_copy (resolve_loc->pargfid, state->loc_now->pargfid); + gf_uuid_copy (resolve_loc->pargfid, state->loc_now->pargfid); resolve_loc->name = resolve->bname; resolve_loc->inode = inode_new (state->itable); @@ -137,7 +137,7 @@ fuse_resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * -2: entry (inode corresponding to path) could not be resolved */ - if (uuid_is_null (resolve->gfid)) { + if (gf_uuid_is_null (resolve->gfid)) { resolve->op_ret = -1; } else { resolve->op_ret = -2; @@ -154,13 +154,13 @@ fuse_resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!link_inode) goto out; - if (!uuid_is_null (resolve->gfid)) { + if (!gf_uuid_is_null (resolve->gfid)) { loc_now->inode = link_inode; goto out; } loc_now->parent = link_inode; - uuid_copy (loc_now->pargfid, link_inode->gfid); + gf_uuid_copy (loc_now->pargfid, link_inode->gfid); fuse_resolve_entry (state); @@ -181,10 +181,10 @@ fuse_resolve_gfid (fuse_state_t *state) resolve = state->resolve_now; resolve_loc = &resolve->resolve_loc; - if (!uuid_is_null (resolve->pargfid)) { - uuid_copy (resolve_loc->gfid, resolve->pargfid); - } else if (!uuid_is_null (resolve->gfid)) { - uuid_copy (resolve_loc->gfid, resolve->gfid); + if (!gf_uuid_is_null (resolve->pargfid)) { + gf_uuid_copy (resolve_loc->gfid, resolve->pargfid); + } else if (!gf_uuid_is_null (resolve->gfid)) { + gf_uuid_copy (resolve_loc->gfid, resolve->gfid); } /* inode may already exist in case we are looking up an inode which was @@ -234,7 +234,7 @@ fuse_resolve_parent_simple (fuse_state_t *state) /* no graph switches since */ loc->parent = inode_ref (parent); - uuid_copy (loc->pargfid, parent->gfid); + gf_uuid_copy (loc->pargfid, parent->gfid); loc->inode = inode_grep (state->itable, parent, loc->name); /* nodeid for root is 1 and we blindly take the latest graph's @@ -264,7 +264,7 @@ fuse_resolve_parent_simple (fuse_state_t *state) } loc->parent = parent; - uuid_copy (loc->pargfid, resolve->pargfid); + gf_uuid_copy (loc->pargfid, resolve->pargfid); inode = inode_grep (state->itable, parent, loc->name); if (inode) { @@ -555,7 +555,7 @@ fuse_gfid_set (fuse_state_t *state) { int ret = 0; - if (uuid_is_null (state->gfid)) + if (gf_uuid_is_null (state->gfid)) goto out; if (!state->xdata) @@ -580,7 +580,7 @@ fuse_resolve_entry_init (fuse_state_t *state, fuse_resolve_t *resolve, inode_t *parent = NULL; parent = fuse_ino_to_inode (par, state->this); - uuid_copy (resolve->pargfid, parent->gfid); + gf_uuid_copy (resolve->pargfid, parent->gfid); resolve->parhint = parent; resolve->bname = gf_strdup (name); @@ -595,7 +595,7 @@ fuse_resolve_inode_init (fuse_state_t *state, fuse_resolve_t *resolve, inode_t *inode = NULL; inode = fuse_ino_to_inode (ino, state->this); - uuid_copy (resolve->gfid, inode->gfid); + gf_uuid_copy (resolve->gfid, inode->gfid); resolve->hint = inode; return 0; @@ -623,11 +623,11 @@ fuse_resolve (fuse_state_t *state) fuse_resolve_fd (state); - } else if (!uuid_is_null (resolve->pargfid)) { + } else if (!gf_uuid_is_null (resolve->pargfid)) { fuse_resolve_parent (state); - } else if (!uuid_is_null (resolve->gfid)) { + } else if (!gf_uuid_is_null (resolve->gfid)) { fuse_resolve_inode (state); -- cgit