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-bridge.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'xlators/mount/fuse/src/fuse-bridge.c') diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index b517475ef06..ece089976f3 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -409,7 +409,7 @@ fuse_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == 0) { if (__is_root_gfid (state->loc.inode->gfid)) buf->ia_ino = 1; - if (uuid_is_null (buf->ia_gfid)) { + if (gf_uuid_is_null (buf->ia_gfid)) { /* With a NULL gfid inode linking is not possible. Let's not pretend this call was a "success". @@ -535,8 +535,8 @@ fuse_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, inode_unref (state->loc.inode); state->loc.inode = inode_new (itable); state->is_revalidate = 2; - if (uuid_is_null (state->gfid)) - uuid_generate (state->gfid); + if (gf_uuid_is_null (state->gfid)) + gf_uuid_generate (state->gfid); fuse_gfid_set (state); STACK_WIND (frame, fuse_lookup_cbk, @@ -599,8 +599,8 @@ fuse_lookup_resume (fuse_state_t *state) "%"PRIu64": LOOKUP %s", state->finh->unique, state->loc.path); state->loc.inode = inode_new (state->loc.parent->table); - if (uuid_is_null (state->gfid)) - uuid_generate (state->gfid); + if (gf_uuid_is_null (state->gfid)) + gf_uuid_generate (state->gfid); fuse_gfid_set (state); } @@ -1496,7 +1496,7 @@ fuse_mknod (xlator_t *this, fuse_in_header_t *finh, void *msg) GET_STATE (this, finh, state); - uuid_generate (state->gfid); + gf_uuid_generate (state->gfid); fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); @@ -1562,7 +1562,7 @@ fuse_mkdir (xlator_t *this, fuse_in_header_t *finh, void *msg) GET_STATE (this, finh, state); - uuid_generate (state->gfid); + gf_uuid_generate (state->gfid); fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); @@ -1696,7 +1696,7 @@ fuse_symlink (xlator_t *this, fuse_in_header_t *finh, void *msg) GET_STATE (this, finh, state); - uuid_generate (state->gfid); + gf_uuid_generate (state->gfid); fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); @@ -2067,7 +2067,7 @@ fuse_create (xlator_t *this, fuse_in_header_t *finh, void *msg) GET_STATE (this, finh, state); - uuid_generate (state->gfid); + gf_uuid_generate (state->gfid); fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); @@ -4086,7 +4086,7 @@ fuse_first_lookup (xlator_t *this) loc.path = "/"; loc.name = ""; loc.inode = fuse_ino_to_inode (1, this); - uuid_copy (loc.gfid, loc.inode->gfid); + gf_uuid_copy (loc.gfid, loc.inode->gfid); loc.parent = NULL; dict = dict_new (); @@ -4155,7 +4155,7 @@ fuse_nameless_lookup (xlator_t *xl, uuid_t gfid, loc_t *loc) } } - uuid_copy (loc->gfid, gfid); + gf_uuid_copy (loc->gfid, gfid); xattr_req = dict_new (); if (xattr_req == NULL) { @@ -4202,7 +4202,7 @@ fuse_migrate_fd_open (xlator_t *this, fd_t *basefd, fd_t *oldfd, goto out; } - uuid_copy (loc.gfid, basefd->inode->gfid); + gf_uuid_copy (loc.gfid, basefd->inode->gfid); loc.inode = inode_find (new_subvol->itable, basefd->inode->gfid); @@ -4394,7 +4394,7 @@ fuse_migrate_fd (xlator_t *this, fd_t *basefd, xlator_t *old_subvol, LOCK (&oldfd->inode->lock); { - if (uuid_is_null (oldfd->inode->gfid)) { + if (gf_uuid_is_null (oldfd->inode->gfid)) { create_in_progress = 1; } else { create_in_progress = 0; -- cgit