summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/inode.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 /libglusterfs/src/inode.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 'libglusterfs/src/inode.c')
-rw-r--r--libglusterfs/src/inode.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 1ed897ef5ec..7c548653ebf 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -279,11 +279,11 @@ __dentry_search_for_inode (inode_t *inode, uuid_t pargfid, const char *name)
/* earlier, just the ino was sent, which could have been 0, now
we deal with gfid, and if sent gfid is null or 0, no need to
continue with the check */
- if (!pargfid || uuid_is_null (pargfid))
+ if (!pargfid || gf_uuid_is_null (pargfid))
return NULL;
list_for_each_entry (tmp, &inode->dentry_list, inode_list) {
- if ((uuid_compare (tmp->parent->gfid, pargfid) == 0) &&
+ if ((gf_uuid_compare (tmp->parent->gfid, pargfid) == 0) &&
!strcmp (tmp->name, name)) {
dentry = tmp;
break;
@@ -813,7 +813,7 @@ inode_grep_for_gfid (inode_table_t *table, inode_t *parent, const char *name,
inode = dentry->inode;
if (inode) {
- uuid_copy (gfid, inode->gfid);
+ gf_uuid_copy (gfid, inode->gfid);
*type = inode->ia_type;
ret = 0;
}
@@ -833,7 +833,7 @@ __is_root_gfid (uuid_t gfid)
memset (root, 0, 16);
root[15] = 1;
- if (uuid_compare (gfid, root) == 0)
+ if (gf_uuid_compare (gfid, root) == 0)
return _gf_true;
return _gf_false;
@@ -858,7 +858,7 @@ __inode_find (inode_table_t *table, uuid_t gfid)
hash = hash_gfid (gfid, 65536);
list_for_each_entry (tmp, &table->inode_hash[hash], hash) {
- if (uuid_compare (tmp->gfid, gfid) == 0) {
+ if (gf_uuid_compare (tmp->gfid, gfid) == 0) {
inode = tmp;
break;
}
@@ -934,7 +934,7 @@ __inode_link (inode_t *inode, inode_t *parent, const char *name,
if (!iatt)
return NULL;
- if (uuid_is_null (iatt->ia_gfid))
+ if (gf_uuid_is_null (iatt->ia_gfid))
return NULL;
old_inode = __inode_find (table, iatt->ia_gfid);
@@ -942,7 +942,7 @@ __inode_link (inode_t *inode, inode_t *parent, const char *name,
if (old_inode) {
link_inode = old_inode;
} else {
- uuid_copy (inode->gfid, iatt->ia_gfid);
+ gf_uuid_copy (inode->gfid, iatt->ia_gfid);
inode->ia_type = iatt->ia_type;
__inode_hash (inode);
}
@@ -1259,7 +1259,7 @@ inode_parent (inode_t *inode, uuid_t pargfid, const char *name)
pthread_mutex_lock (&table->lock);
{
- if (pargfid && !uuid_is_null (pargfid) && name) {
+ if (pargfid && !gf_uuid_is_null (pargfid) && name) {
dentry = __dentry_search_for_inode (inode, pargfid, name);
} else {
dentry = __dentry_search_arbit (inode);
@@ -1288,7 +1288,7 @@ __inode_path (inode_t *inode, const char *name, char **bufp)
int len = 0;
char *buf = NULL;
- if (!inode || uuid_is_null (inode->gfid)) {
+ if (!inode || gf_uuid_is_null (inode->gfid)) {
GF_ASSERT (0);
gf_log_callingfn (THIS->name, GF_LOG_WARNING, "invalid inode");
return -EINVAL;