summaryrefslogtreecommitdiffstats
path: root/xlators/features/snapview-server
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/snapview-server
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/snapview-server')
-rw-r--r--xlators/features/snapview-server/src/snapview-server-helpers.c4
-rw-r--r--xlators/features/snapview-server/src/snapview-server.c72
2 files changed, 38 insertions, 38 deletions
diff --git a/xlators/features/snapview-server/src/snapview-server-helpers.c b/xlators/features/snapview-server/src/snapview-server-helpers.c
index 7f03dc47f02..c621484c19b 100644
--- a/xlators/features/snapview-server/src/snapview-server-helpers.c
+++ b/xlators/features/snapview-server/src/snapview-server-helpers.c
@@ -348,7 +348,7 @@ svs_fill_ino_from_gfid (struct iatt *buf)
GF_VALIDATE_OR_GOTO (this->name, buf, out);
/* consider least significant 8 bytes of value out of gfid */
- if (uuid_is_null (buf->ia_gfid)) {
+ if (gf_uuid_is_null (buf->ia_gfid)) {
buf->ia_ino = -1;
goto out;
}
@@ -380,7 +380,7 @@ svs_iatt_fill (uuid_t gfid, struct iatt *buf)
buf->ia_blocks = 8;
buf->ia_size = 4096;
- uuid_copy (buf->ia_gfid, gfid);
+ gf_uuid_copy (buf->ia_gfid, gfid);
svs_fill_ino_from_gfid (buf);
buf->ia_prot = ia_prot_from_st_mode (0755);
diff --git a/xlators/features/snapview-server/src/snapview-server.c b/xlators/features/snapview-server/src/snapview-server.c
index 4df7864b1bf..4820181cb56 100644
--- a/xlators/features/snapview-server/src/snapview-server.c
+++ b/xlators/features/snapview-server/src/snapview-server.c
@@ -39,8 +39,8 @@ svs_lookup_entry_point (xlator_t *this, loc_t *loc, inode_t *parent,
GF_VALIDATE_OR_GOTO (this->name, buf, out);
GF_VALIDATE_OR_GOTO (this->name, postparent, out);
- if (uuid_is_null (loc->inode->gfid)) {
- uuid_generate (gfid);
+ if (gf_uuid_is_null (loc->inode->gfid)) {
+ gf_uuid_generate (gfid);
svs_iatt_fill (gfid, buf);
/* Here the inode context of the entry point directory
@@ -63,7 +63,7 @@ svs_lookup_entry_point (xlator_t *this, loc_t *loc, inode_t *parent,
*op_errno = ENOMEM;
goto out;
}
- uuid_copy (inode_ctx->pargfid, loc->pargfid);
+ gf_uuid_copy (inode_ctx->pargfid, loc->pargfid);
memcpy (&inode_ctx->buf, buf, sizeof (*buf));
inode_ctx->type = SNAP_VIEW_ENTRY_POINT_INODE;
} else {
@@ -124,12 +124,12 @@ svs_lookup_gfid (xlator_t *this, loc_t *loc, struct iatt *buf,
GF_VALIDATE_OR_GOTO (this->name, buf, out);
GF_VALIDATE_OR_GOTO (this->name, postparent, out);
- if (uuid_is_null (loc->gfid) && uuid_is_null (loc->inode->gfid)) {
+ if (gf_uuid_is_null (loc->gfid) && gf_uuid_is_null (loc->inode->gfid)) {
gf_log (this->name, GF_LOG_ERROR, "gfid is NULL");
goto out;
}
- if (!uuid_is_null (loc->inode->gfid))
+ if (!gf_uuid_is_null (loc->inode->gfid))
memcpy (handle_obj, loc->inode->gfid,
GFAPI_HANDLE_LENGTH);
else
@@ -167,10 +167,10 @@ svs_lookup_gfid (xlator_t *this, loc_t *loc, struct iatt *buf,
}
iatt_from_stat (buf, &statbuf);
- if (!uuid_is_null (loc->gfid))
- uuid_copy (buf->ia_gfid, loc->gfid);
+ if (!gf_uuid_is_null (loc->gfid))
+ gf_uuid_copy (buf->ia_gfid, loc->gfid);
else
- uuid_copy (buf->ia_gfid, loc->inode->gfid);
+ gf_uuid_copy (buf->ia_gfid, loc->inode->gfid);
inode_ctx->type = SNAP_VIEW_VIRTUAL_INODE;
inode_ctx->fs = fs;
@@ -243,17 +243,17 @@ svs_lookup_snapshot (xlator_t *this, loc_t *loc, struct iatt *buf,
goto out;
}
- if (uuid_is_null (loc->gfid) &&
- uuid_is_null (loc->inode->gfid))
- uuid_generate (gfid);
+ if (gf_uuid_is_null (loc->gfid) &&
+ gf_uuid_is_null (loc->inode->gfid))
+ gf_uuid_generate (gfid);
else {
- if (!uuid_is_null (loc->inode->gfid))
- uuid_copy (gfid, loc->inode->gfid);
+ if (!gf_uuid_is_null (loc->inode->gfid))
+ gf_uuid_copy (gfid, loc->inode->gfid);
else
- uuid_copy (gfid, loc->gfid);
+ gf_uuid_copy (gfid, loc->gfid);
}
iatt_from_stat (buf, &statbuf);
- uuid_copy (buf->ia_gfid, gfid);
+ gf_uuid_copy (buf->ia_gfid, gfid);
svs_fill_ino_from_gfid (buf);
inode_ctx->type = SNAP_VIEW_SNAPSHOT_INODE;
inode_ctx->fs = fs;
@@ -312,18 +312,18 @@ svs_lookup_entry (xlator_t *this, loc_t *loc, struct iatt *buf,
goto out;
}
- if (uuid_is_null (loc->gfid) &&
- uuid_is_null (loc->inode->gfid))
- uuid_generate (gfid);
+ if (gf_uuid_is_null (loc->gfid) &&
+ gf_uuid_is_null (loc->inode->gfid))
+ gf_uuid_generate (gfid);
else {
- if (!uuid_is_null (loc->inode->gfid))
- uuid_copy (gfid, loc->inode->gfid);
+ if (!gf_uuid_is_null (loc->inode->gfid))
+ gf_uuid_copy (gfid, loc->inode->gfid);
else
- uuid_copy (gfid, loc->gfid);
+ gf_uuid_copy (gfid, loc->gfid);
}
iatt_from_stat (buf, &statbuf);
- uuid_copy (buf->ia_gfid, gfid);
+ gf_uuid_copy (buf->ia_gfid, gfid);
svs_fill_ino_from_gfid (buf);
inode_ctx->type = SNAP_VIEW_VIRTUAL_INODE;
inode_ctx->fs = fs;
@@ -577,8 +577,8 @@ svs_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
the server does not have the inode in the inode table.
*/
if (!inode_ctx && !parent_ctx) {
- if (uuid_is_null (loc->gfid) &&
- uuid_is_null (loc->inode->gfid)) {
+ if (gf_uuid_is_null (loc->gfid) &&
+ gf_uuid_is_null (loc->inode->gfid)) {
gf_log (this->name, GF_LOG_ERROR, "gfid is NULL");
op_ret = -1;
op_errno = ESTALE;
@@ -599,10 +599,10 @@ svs_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
* this would have already looked up by snap-view client
* so return success
*/
- if (!uuid_is_null (loc->gfid))
- uuid_copy (buf.ia_gfid, loc->gfid);
+ if (!gf_uuid_is_null (loc->gfid))
+ gf_uuid_copy (buf.ia_gfid, loc->gfid);
else
- uuid_copy (buf.ia_gfid, loc->inode->gfid);
+ gf_uuid_copy (buf.ia_gfid, loc->inode->gfid);
svs_iatt_fill (buf.ia_gfid, &buf);
svs_iatt_fill (buf.ia_gfid, &postparent);
@@ -1343,7 +1343,7 @@ svs_readdirp_fill (xlator_t *this, inode_t *parent, svs_inode_t *parent_ctx,
entry->inode = inode;
inode_ctx = svs_inode_ctx_get (this, inode);
if (!inode_ctx) {
- uuid_copy (buf.ia_gfid, inode->gfid);
+ gf_uuid_copy (buf.ia_gfid, inode->gfid);
svs_iatt_fill (inode->gfid, &buf);
buf.ia_type = inode->ia_type;
} else {
@@ -1356,13 +1356,13 @@ svs_readdirp_fill (xlator_t *this, inode_t *parent, svs_inode_t *parent_ctx,
entry->d_stat = buf;
else {
entry->d_stat.ia_ino = buf.ia_ino;
- uuid_copy (entry->d_stat.ia_gfid, buf.ia_gfid);
+ gf_uuid_copy (entry->d_stat.ia_gfid, buf.ia_gfid);
}
} else {
inode = inode_new (parent->table);
entry->inode = inode;
- uuid_generate (random_gfid);
- uuid_copy (buf.ia_gfid, random_gfid);
+ gf_uuid_generate (random_gfid);
+ gf_uuid_copy (buf.ia_gfid, random_gfid);
svs_fill_ino_from_gfid (&buf);
entry->d_ino = buf.ia_ino;
@@ -1387,7 +1387,7 @@ svs_readdirp_fill (xlator_t *this, inode_t *parent, svs_inode_t *parent_ctx,
entry->d_stat = buf;
inode_ctx->type = SNAP_VIEW_SNAPSHOT_INODE;
} else {
- uuid_copy (entry->d_stat.ia_gfid, buf.ia_gfid);
+ gf_uuid_copy (entry->d_stat.ia_gfid, buf.ia_gfid);
entry->d_stat.ia_ino = buf.ia_ino;
inode_ctx->buf = entry->d_stat;
inode_ctx->type = SNAP_VIEW_VIRTUAL_INODE;
@@ -1720,7 +1720,7 @@ svs_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
}
iatt_from_stat (&buf, &stat);
- uuid_copy (buf.ia_gfid, loc->inode->gfid);
+ gf_uuid_copy (buf.ia_gfid, loc->inode->gfid);
svs_fill_ino_from_gfid (&buf);
op_ret = ret;
}
@@ -1790,7 +1790,7 @@ svs_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
}
iatt_from_stat (&buf, &stat);
- uuid_copy (buf.ia_gfid, fd->inode->gfid);
+ gf_uuid_copy (buf.ia_gfid, fd->inode->gfid);
svs_fill_ino_from_gfid (&buf);
op_ret = ret;
}
@@ -1929,7 +1929,7 @@ svs_readv (call_frame_t *frame, xlator_t *this,
}
iatt_from_stat (&stbuf, &fstatbuf);
- uuid_copy (stbuf.ia_gfid, fd->inode->gfid);
+ gf_uuid_copy (stbuf.ia_gfid, fd->inode->gfid);
svs_fill_ino_from_gfid (&stbuf);
/* Hack to notify higher layers of EOF. */
@@ -1994,7 +1994,7 @@ svs_readlink (call_frame_t *frame, xlator_t *this,
}
iatt_from_stat (&stbuf, &stat);
- uuid_copy (stbuf.ia_gfid, loc->inode->gfid);
+ gf_uuid_copy (stbuf.ia_gfid, loc->inode->gfid);
svs_fill_ino_from_gfid (&stbuf);
buf = alloca (size + 1);