summaryrefslogtreecommitdiffstats
path: root/xlators/features/gfid-access/src/gfid-access.c
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2015-04-02 15:51:30 +0200
committerVijay Bellur <vbellur@redhat.com>2015-04-04 10:48:35 -0700
commit28397cae4102ac3f08576ebaf071ad92683097e8 (patch)
tree4c8be92299a951c8a28e1dc85bf2671f60da6e08 /xlators/features/gfid-access/src/gfid-access.c
parent0aebfaa349c7c68c2d59531eabae5a03a748e16a (diff)
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 <manu@netbsd.org> Reviewed-on: http://review.gluster.org/10017 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators/features/gfid-access/src/gfid-access.c')
-rw-r--r--xlators/features/gfid-access/src/gfid-access.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c
index 119f795a2d3..d5054432d76 100644
--- a/xlators/features/gfid-access/src/gfid-access.c
+++ b/xlators/features/gfid-access/src/gfid-access.c
@@ -42,7 +42,7 @@ ga_valid_inode_loc_copy (loc_t *dst, loc_t *src, xlator_t *this)
}
inode_unref (dst->parent);
dst->parent = inode_ref ((inode_t*)value);
- uuid_copy (dst->pargfid, dst->parent->gfid);
+ gf_uuid_copy (dst->pargfid, dst->parent->gfid);
}
if (dst->inode) {
@@ -53,7 +53,7 @@ ga_valid_inode_loc_copy (loc_t *dst, loc_t *src, xlator_t *this)
}
inode_unref (dst->inode);
dst->inode = inode_ref ((inode_t*)value);
- uuid_copy (dst->gfid, dst->inode->gfid);
+ gf_uuid_copy (dst->gfid, dst->inode->gfid);
}
out:
@@ -305,18 +305,18 @@ ga_fill_tmp_loc (loc_t *loc, xlator_t *this, uuid_t gfid,
ret = inode_ctx_get (loc->inode, this, &value);
if (!ret) {
parent = (void *)value;
- if (uuid_is_null (parent->gfid))
+ if (gf_uuid_is_null (parent->gfid))
parent = loc->inode;
}
/* parent itself should be looked up */
- uuid_copy (new_loc->pargfid, parent->gfid);
+ gf_uuid_copy (new_loc->pargfid, parent->gfid);
new_loc->parent = inode_ref (parent);
new_loc->inode = inode_grep (parent->table, parent, bname);
if (!new_loc->inode) {
new_loc->inode = inode_new (parent->table);
- uuid_copy (new_loc->inode->gfid, gfid);
+ gf_uuid_copy (new_loc->inode->gfid, gfid);
}
loc_path (new_loc, bname);
@@ -331,7 +331,7 @@ ga_fill_tmp_loc (loc_t *loc, xlator_t *this, uuid_t gfid,
ret = -1;
goto out;
}
- uuid_copy (*gfid_ptr, gfid);
+ gf_uuid_copy (*gfid_ptr, gfid);
ret = dict_set_dynptr (xdata, "gfid-req", gfid_ptr, sizeof (uuid_t));
if (ret < 0)
goto out;
@@ -354,7 +354,7 @@ __is_gfid_access_dir (uuid_t gfid)
memset (aux_gfid, 0, 16);
aux_gfid[15] = GF_AUX_GFID;
- if (uuid_compare (gfid, aux_gfid) == 0)
+ if (gf_uuid_compare (gfid, aux_gfid) == 0)
return _gf_true;
return _gf_false;
@@ -517,7 +517,7 @@ ga_new_entry (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *data,
if (!args)
goto out;
- ret = uuid_parse (args->gfid, gfid);
+ ret = gf_uuid_parse (args->gfid, gfid);
if (ret)
goto out;
@@ -605,7 +605,7 @@ ga_heal_entry (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *data,
if (!args)
goto out;
- ret = uuid_parse (args->gfid, gfid);
+ ret = gf_uuid_parse (args->gfid, gfid);
if (ret)
goto out;
@@ -766,17 +766,17 @@ ga_virtual_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode = NULL;
}
- if (!uuid_is_null (cbk_inode->gfid)) {
+ if (!gf_uuid_is_null (cbk_inode->gfid)) {
/* if the previous linked inode is used, use the
same gfid */
- uuid_copy (random_gfid, cbk_inode->gfid);
+ gf_uuid_copy (random_gfid, cbk_inode->gfid);
} else {
/* replace the buf->ia_gfid to a random gfid
for directory, for files, what we received is fine */
- uuid_generate (random_gfid);
+ gf_uuid_generate (random_gfid);
}
- uuid_copy (buf->ia_gfid, random_gfid);
+ gf_uuid_copy (buf->ia_gfid, random_gfid);
for (i = 15; i > (15 - 8); i--) {
temp_ino += (uint64_t)(buf->ia_gfid[i]) << j;
@@ -858,7 +858,7 @@ ga_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
/* here, just send 'loc->gfid' and 'loc->inode' */
tmp_loc.inode = inode_ref (loc->inode);
- uuid_copy (tmp_loc.gfid, loc->inode->gfid);
+ gf_uuid_copy (tmp_loc.gfid, loc->inode->gfid);
STACK_WIND (frame, default_lookup_cbk,
FIRST_CHILD(this),
@@ -915,7 +915,7 @@ ga_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
/* make sure the 'basename' is actually a 'canonical-gfid',
otherwise, return error */
- ret = uuid_parse (loc->name, tmp_gfid);
+ ret = gf_uuid_parse (loc->name, tmp_gfid);
if (ret)
goto err;
@@ -953,7 +953,7 @@ discover:
if (xdata)
dict_del (xdata, "gfid-req");
- uuid_copy (tmp_loc.gfid, tmp_gfid);
+ gf_uuid_copy (tmp_loc.gfid, tmp_gfid);
/* if revalidate, then we need to have the proper reference */
if (inode) {