summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
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
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')
-rw-r--r--libglusterfs/src/common-utils.c4
-rw-r--r--libglusterfs/src/common-utils.h2
-rw-r--r--libglusterfs/src/gfdb/gfdb_data_store_types.h2
-rw-r--r--libglusterfs/src/gfdb/gfdb_sqlite3_helper.c2
-rw-r--r--libglusterfs/src/inode.c18
-rw-r--r--libglusterfs/src/syncop-utils.c6
-rw-r--r--libglusterfs/src/xlator.c34
7 files changed, 34 insertions, 34 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index f9eea5e5fd0..6c5f65f6987 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -2336,7 +2336,7 @@ char *
uuid_utoa (uuid_t uuid)
{
char *uuid_buffer = glusterfs_uuid_buf_get ();
- uuid_unparse (uuid, uuid_buffer);
+ gf_uuid_unparse (uuid, uuid_buffer);
return uuid_buffer;
}
@@ -2346,7 +2346,7 @@ uuid_utoa_r (uuid_t uuid, char *dst)
{
if(!dst)
return NULL;
- uuid_unparse (uuid, dst);
+ gf_uuid_unparse (uuid, dst);
return dst;
}
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index d60ba89db55..7cc85e8fe48 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -283,7 +283,7 @@ int gf_set_log_ident (cmd_args_t *cmd_args);
#endif
#define GF_UUID_ASSERT(u) \
- if (uuid_is_null (u))\
+ if (gf_uuid_is_null (u))\
GF_ASSERT (!"uuid null");
union gf_sock_union {
diff --git a/libglusterfs/src/gfdb/gfdb_data_store_types.h b/libglusterfs/src/gfdb/gfdb_data_store_types.h
index e3a2c76435b..4dd1584b6cd 100644
--- a/libglusterfs/src/gfdb/gfdb_data_store_types.h
+++ b/libglusterfs/src/gfdb/gfdb_data_store_types.h
@@ -414,7 +414,7 @@ str_to_link_info (char *str_link,
token_str = strtok_r(str_link, delimiter, &saveptr);
if (token_str != NULL) {
strcpy (gfid, token_str);
- ret = uuid_parse (gfid, link_info->pargfid);
+ ret = gf_uuid_parse (gfid, link_info->pargfid);
if (ret == -1)
goto out;
}
diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c b/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c
index 50504181d26..14aec204917 100644
--- a/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c
+++ b/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c
@@ -1051,7 +1051,7 @@ gf_sql_query_function (sqlite3_stmt *prep_stmt,
"Failed retriving GF_ID");
goto out;
}
- ret = uuid_parse (text_column, gfdb_query_record->gfid);
+ ret = gf_uuid_parse (text_column, gfdb_query_record->gfid);
if (ret) {
gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
"Failed parsing GF_ID");
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;
diff --git a/libglusterfs/src/syncop-utils.c b/libglusterfs/src/syncop-utils.c
index 2fc95fa3e70..3c0df0ab6ad 100644
--- a/libglusterfs/src/syncop-utils.c
+++ b/libglusterfs/src/syncop-utils.c
@@ -113,7 +113,7 @@ syncop_ftw (xlator_t *subvol, loc_t *loc, int pid, void *data,
if (entry->d_stat.ia_type == IA_IFDIR) {
child_loc.inode = inode_ref (entry->inode);
- uuid_copy (child_loc.gfid, entry->inode->gfid);
+ gf_uuid_copy (child_loc.gfid, entry->inode->gfid);
ret = syncop_ftw (subvol, &child_loc,
pid, data, fn);
loc_wipe (&child_loc);
@@ -198,7 +198,7 @@ syncop_ftw_throttle (xlator_t *subvol, loc_t *loc, int pid, void *data,
if (entry->d_stat.ia_type == IA_IFDIR) {
child_loc.inode = inode_ref (entry->inode);
- uuid_copy (child_loc.gfid, entry->inode->gfid);
+ gf_uuid_copy (child_loc.gfid, entry->inode->gfid);
ret = syncop_ftw_throttle (subvol, &child_loc,
pid, data, fn, count,
sleep_time);
@@ -319,7 +319,7 @@ syncop_gfid_to_path (inode_table_t *itable, xlator_t *subvol, uuid_t gfid,
loc_t loc = {0,};
dict_t *xattr = NULL;
- uuid_copy (loc.gfid, gfid);
+ gf_uuid_copy (loc.gfid, gfid);
loc.inode = inode_new (itable);
ret = syncop_getxattr (subvol, &loc, &xattr, GFID_TO_PATH_KEY, NULL);
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 5b6a4b52e33..c670ee97aee 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -711,9 +711,9 @@ loc_path (loc_t *loc, const char *bname)
if (!bname)
goto inode_path;
- if (loc->parent && !uuid_is_null (loc->parent->gfid)) {
+ if (loc->parent && !gf_uuid_is_null (loc->parent->gfid)) {
ret = inode_path (loc->parent, bname, (char**)&loc->path);
- } else if (!uuid_is_null (loc->pargfid)) {
+ } else if (!gf_uuid_is_null (loc->pargfid)) {
ret = gf_asprintf ((char**)&loc->path, INODE_PATH_FMT"/%s",
uuid_utoa (loc->pargfid), bname);
}
@@ -722,9 +722,9 @@ loc_path (loc_t *loc, const char *bname)
goto out;
inode_path:
- if (loc->inode && !uuid_is_null (loc->inode->gfid)) {
+ if (loc->inode && !gf_uuid_is_null (loc->inode->gfid)) {
ret = inode_path (loc->inode, NULL, (char **)&loc->path);
- } else if (!uuid_is_null (loc->gfid)) {
+ } else if (!gf_uuid_is_null (loc->gfid)) {
ret = gf_asprintf ((char**)&loc->path, INODE_PATH_FMT,
uuid_utoa (loc->gfid));
}
@@ -737,14 +737,14 @@ loc_gfid (loc_t *loc, uuid_t gfid)
{
if (!gfid)
goto out;
- uuid_clear (gfid);
+ gf_uuid_clear (gfid);
if (!loc)
goto out;
- else if (!uuid_is_null (loc->gfid))
- uuid_copy (gfid, loc->gfid);
- else if (loc->inode && (!uuid_is_null (loc->inode->gfid)))
- uuid_copy (gfid, loc->inode->gfid);
+ else if (!gf_uuid_is_null (loc->gfid))
+ gf_uuid_copy (gfid, loc->gfid);
+ else if (loc->inode && (!gf_uuid_is_null (loc->inode->gfid)))
+ gf_uuid_copy (gfid, loc->inode->gfid);
out:
return;
}
@@ -771,12 +771,12 @@ loc_touchup (loc_t *loc, const char *name)
if (path) /*Guaranteed to have trailing '/' */
loc->name = strrchr (path, '/') + 1;
- if (uuid_is_null (loc->pargfid))
- uuid_copy (loc->pargfid, loc->parent->gfid);
+ if (gf_uuid_is_null (loc->pargfid))
+ gf_uuid_copy (loc->pargfid, loc->parent->gfid);
} else if (loc->inode) {
ret = inode_path (loc->inode, 0, &path);
- 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);
}
if (ret < 0 || !path) {
@@ -799,8 +799,8 @@ loc_copy_overload_parent (loc_t *dst, loc_t *src, inode_t *parent)
GF_VALIDATE_OR_GOTO ("xlator", src, err);
GF_VALIDATE_OR_GOTO ("xlator", parent, err);
- uuid_copy (dst->gfid, src->gfid);
- uuid_copy (dst->pargfid, parent->gfid);
+ gf_uuid_copy (dst->gfid, src->gfid);
+ gf_uuid_copy (dst->pargfid, parent->gfid);
if (src->inode)
dst->inode = inode_ref (src->inode);
@@ -839,8 +839,8 @@ loc_copy (loc_t *dst, loc_t *src)
GF_VALIDATE_OR_GOTO ("xlator", dst, err);
GF_VALIDATE_OR_GOTO ("xlator", src, err);
- uuid_copy (dst->gfid, src->gfid);
- uuid_copy (dst->pargfid, src->pargfid);
+ gf_uuid_copy (dst->gfid, src->gfid);
+ gf_uuid_copy (dst->pargfid, src->pargfid);
if (src->inode)
dst->inode = inode_ref (src->inode);