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/features/changetimerecorder/src/changetimerecorder.c | 4 ++-- xlators/features/changetimerecorder/src/ctr-helper.c | 6 +++--- xlators/features/changetimerecorder/src/ctr-helper.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'xlators/features/changetimerecorder') diff --git a/xlators/features/changetimerecorder/src/changetimerecorder.c b/xlators/features/changetimerecorder/src/changetimerecorder.c index 4a3ee339676..21772ab1a7e 100644 --- a/xlators/features/changetimerecorder/src/changetimerecorder.c +++ b/xlators/features/changetimerecorder/src/changetimerecorder.c @@ -703,7 +703,7 @@ ctr_mknod (call_frame_t *frame, xlator_t *this, "failed to get gfid from dict"); goto out; } - uuid_copy (gfid, uuid_req); + gf_uuid_copy (gfid, uuid_req); /*fill ctr link context*/ FILL_CTR_LINK_CX (_link_cx, loc->pargfid, loc->name, loc->path); @@ -777,7 +777,7 @@ ctr_create (call_frame_t *frame, xlator_t *this, "failed to get gfid from dict"); goto out; } - uuid_copy (gfid, uuid_req); + gf_uuid_copy (gfid, uuid_req); /*fill ctr link context*/ FILL_CTR_LINK_CX(_link_cx, loc->pargfid, loc->name, loc->path); diff --git a/xlators/features/changetimerecorder/src/ctr-helper.c b/xlators/features/changetimerecorder/src/ctr-helper.c index 41eec753fe2..69d64d66690 100644 --- a/xlators/features/changetimerecorder/src/ctr-helper.c +++ b/xlators/features/changetimerecorder/src/ctr-helper.c @@ -91,13 +91,13 @@ fill_db_record_for_wind(gf_ctr_local_t *ctr_local, } /*Copy gfid into db record*/ - uuid_copy (CTR_DB_REC(ctr_local).gfid, *(ctr_inode_cx->gfid)); + gf_uuid_copy (CTR_DB_REC(ctr_local).gfid, *(ctr_inode_cx->gfid)); /*Hard Links*/ if (isdentryfop(ctr_inode_cx->fop_type)) { /*new link fop*/ if (NEW_LINK_CX(ctr_inode_cx)) { - uuid_copy (CTR_DB_REC(ctr_local).pargfid, + gf_uuid_copy (CTR_DB_REC(ctr_local).pargfid, *((NEW_LINK_CX(ctr_inode_cx))->pargfid)); strcpy (CTR_DB_REC(ctr_local).file_name, NEW_LINK_CX(ctr_inode_cx)->basename); @@ -106,7 +106,7 @@ fill_db_record_for_wind(gf_ctr_local_t *ctr_local, } /*rename fop*/ if (OLD_LINK_CX(ctr_inode_cx)) { - uuid_copy (CTR_DB_REC(ctr_local).old_pargfid, + gf_uuid_copy (CTR_DB_REC(ctr_local).old_pargfid, *((OLD_LINK_CX(ctr_inode_cx))->pargfid)); strcpy (CTR_DB_REC(ctr_local).old_file_name, OLD_LINK_CX(ctr_inode_cx)->basename); diff --git a/xlators/features/changetimerecorder/src/ctr-helper.h b/xlators/features/changetimerecorder/src/ctr-helper.h index 9f381e4791c..c63b9c122d2 100644 --- a/xlators/features/changetimerecorder/src/ctr-helper.h +++ b/xlators/features/changetimerecorder/src/ctr-helper.h @@ -88,8 +88,8 @@ do {\ 0, sizeof(gfdb_time_t));\ memset(&(ctr_local->gfdb_db_record.gfdb_unwind_change_time),\ 0, sizeof(gfdb_time_t));\ - uuid_clear (ctr_local->gfdb_db_record.gfid);\ - uuid_clear (ctr_local->gfdb_db_record.pargfid);\ + gf_uuid_clear (ctr_local->gfdb_db_record.gfid);\ + gf_uuid_clear (ctr_local->gfdb_db_record.pargfid);\ memset(ctr_local->gfdb_db_record.file_name, 0, PATH_MAX);\ memset(ctr_local->gfdb_db_record.old_file_name, 0, PATH_MAX);\ ctr_local->gfdb_db_record.gfdb_fop_type = GFDB_FOP_INVALID_OP;\ -- cgit