diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2015-04-02 15:51:30 +0200 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-04-04 10:48:35 -0700 |
commit | 28397cae4102ac3f08576ebaf071ad92683097e8 (patch) | |
tree | 4c8be92299a951c8a28e1dc85bf2671f60da6e08 /xlators/features/marker/src/marker-quota-helper.c | |
parent | 0aebfaa349c7c68c2d59531eabae5a03a748e16a (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/marker/src/marker-quota-helper.c')
-rw-r--r-- | xlators/features/marker/src/marker-quota-helper.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/xlators/features/marker/src/marker-quota-helper.c b/xlators/features/marker/src/marker-quota-helper.c index f13d5f650b9..67801c86403 100644 --- a/xlators/features/marker/src/marker-quota-helper.c +++ b/xlators/features/marker/src/marker-quota-helper.c @@ -37,8 +37,8 @@ mq_loc_fill (loc_t *loc, inode_t *inode, inode_t *parent, char *path) if (parent) loc->parent = inode_ref (parent); - if (!uuid_is_null (inode->gfid)) - uuid_copy (loc->gfid, inode->gfid); + if (!gf_uuid_is_null (inode->gfid)) + gf_uuid_copy (loc->gfid, inode->gfid); loc->path = gf_strdup (path); if (!loc->path) { @@ -140,7 +140,7 @@ mq_get_contribution_node (inode_t *inode, quota_inode_ctx_t *ctx) goto out; list_for_each_entry (temp, &ctx->contribution_head, contri_list) { - if (uuid_compare (temp->gfid, inode->gfid) == 0) { + if (gf_uuid_compare (temp->gfid, inode->gfid) == 0) { contri = temp; goto out; } @@ -171,7 +171,7 @@ __mq_add_new_contribution_node (xlator_t *this, quota_inode_ctx_t *ctx, inode_contribution_t *contribution = NULL; if (!loc->parent) { - if (!uuid_is_null (loc->pargfid)) + if (!gf_uuid_is_null (loc->pargfid)) loc->parent = inode_find (loc->inode->table, loc->pargfid); @@ -185,7 +185,7 @@ __mq_add_new_contribution_node (xlator_t *this, quota_inode_ctx_t *ctx, list_for_each_entry (contribution, &ctx->contribution_head, contri_list) { if (loc->parent && - uuid_compare (contribution->gfid, loc->parent->gfid) == 0) { + gf_uuid_compare (contribution->gfid, loc->parent->gfid) == 0) { goto out; } } @@ -196,7 +196,7 @@ __mq_add_new_contribution_node (xlator_t *this, quota_inode_ctx_t *ctx, contribution->contribution = 0; - uuid_copy (contribution->gfid, loc->parent->gfid); + gf_uuid_copy (contribution->gfid, loc->parent->gfid); LOCK_INIT (&contribution->lock); INIT_LIST_HEAD (&contribution->contri_list); @@ -218,7 +218,7 @@ mq_add_new_contribution_node (xlator_t *this, quota_inode_ctx_t *ctx, return NULL; if (((loc->path) && (strcmp (loc->path, "/") == 0)) - || (!loc->path && uuid_is_null (loc->pargfid))) + || (!loc->path && gf_uuid_is_null (loc->pargfid))) return NULL; LOCK (&ctx->lock); @@ -242,7 +242,7 @@ mq_dict_set_contribution (xlator_t *this, dict_t *dict, loc_t *loc, GF_VALIDATE_OR_GOTO ("marker", dict, out); GF_VALIDATE_OR_GOTO ("marker", loc, out); - if (gfid && !uuid_is_null(gfid)) { + if (gfid && !gf_uuid_is_null(gfid)) { GET_CONTRI_KEY (key, gfid, ret); } else if (loc->parent) { GET_CONTRI_KEY (key, loc->parent->gfid, ret); |