summaryrefslogtreecommitdiffstats
path: root/xlators/nfs
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/nfs
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/nfs')
-rw-r--r--xlators/nfs/server/src/acl3.c6
-rw-r--r--xlators/nfs/server/src/auth-cache.c6
-rw-r--r--xlators/nfs/server/src/exports.c4
-rw-r--r--xlators/nfs/server/src/mount3.c10
-rw-r--r--xlators/nfs/server/src/nfs-common.c10
-rw-r--r--xlators/nfs/server/src/nfs-fops.c4
-rw-r--r--xlators/nfs/server/src/nfs3-fh.c24
-rw-r--r--xlators/nfs/server/src/nfs3-helpers.c2
-rw-r--r--xlators/nfs/server/src/nfs3.c24
-rw-r--r--xlators/nfs/server/src/nlm4.c6
10 files changed, 48 insertions, 48 deletions
diff --git a/xlators/nfs/server/src/acl3.c b/xlators/nfs/server/src/acl3.c
index fa10c873eb8..230fb229579 100644
--- a/xlators/nfs/server/src/acl3.c
+++ b/xlators/nfs/server/src/acl3.c
@@ -83,8 +83,8 @@ nfs3_fh_to_xlator (struct nfs3_state *nfs3, struct nfs3_fh *fh);
rpc_transport_t *trans = NULL; \
volume = nfs3_fh_to_xlator ((nfs3state), handle); \
if (!volume) { \
- uuid_unparse (handle->exportid, exportid); \
- uuid_unparse (handle->gfid, gfid); \
+ gf_uuid_unparse (handle->exportid, exportid); \
+ gf_uuid_unparse (handle->gfid, gfid); \
trans = rpcsvc_request_transport (req); \
gf_log (GF_ACL, GF_LOG_ERROR, "Failed to map " \
"FH to vol: client=%s, exportid=%s, gfid=%s",\
@@ -122,7 +122,7 @@ nfs3_fh_to_xlator (struct nfs3_state *nfs3, struct nfs3_fh *fh);
trans = rpcsvc_request_transport (cst->req); \
xlatorp = nfs3_fh_to_xlator (cst->nfs3state, \
&cst->resolvefh); \
- uuid_unparse (cst->resolvefh.gfid, gfid); \
+ gf_uuid_unparse (cst->resolvefh.gfid, gfid); \
snprintf (buf, sizeof (buf), "(%s) %s : %s", \
trans->peerinfo.identifier, \
xlatorp ? xlatorp->name : "ERR", \
diff --git a/xlators/nfs/server/src/auth-cache.c b/xlators/nfs/server/src/auth-cache.c
index 85d9056cd61..01ebaed04d2 100644
--- a/xlators/nfs/server/src/auth-cache.c
+++ b/xlators/nfs/server/src/auth-cache.c
@@ -37,9 +37,9 @@ make_hashkey(char *hashkey, struct nfs3_fh *fh, const char *host)
char mountid[256] = {0, };
size_t nbytes = 0;
- uuid_unparse (fh->exportid, exportid);
- uuid_unparse (fh->gfid, gfid);
- uuid_unparse (fh->mountid, mountid);
+ gf_uuid_unparse (fh->exportid, exportid);
+ gf_uuid_unparse (fh->gfid, gfid);
+ gf_uuid_unparse (fh->mountid, mountid);
nbytes = strlen (exportid) + strlen (gfid) + strlen (host)
+ strlen (mountid) + 5;
hashkey = alloca (nbytes);
diff --git a/xlators/nfs/server/src/exports.c b/xlators/nfs/server/src/exports.c
index af0cc7c24f2..30810361785 100644
--- a/xlators/nfs/server/src/exports.c
+++ b/xlators/nfs/server/src/exports.c
@@ -397,7 +397,7 @@ exp_file_dir_from_uuid (const struct exports_file *file,
data_t *dirdata = NULL;
struct export_dir *dir = NULL;
- uuid_unparse (export_uuid, export_uuid_str);
+ gf_uuid_unparse (export_uuid, export_uuid_str);
dirdata = dict_get (file->exports_map, export_uuid_str);
if (dirdata)
@@ -441,7 +441,7 @@ _exp_file_insert (struct exports_file *file, struct export_dir *dir)
hashedval = SuperFastHash (dirdup, strlen (dirdup));
memset (export_uuid, 0, sizeof (export_uuid));
memcpy (export_uuid, &hashedval, sizeof (hashedval));
- uuid_unparse (export_uuid, export_uuid_str);
+ gf_uuid_unparse (export_uuid, export_uuid_str);
dict_set (file->exports_map, export_uuid_str, dirdata);
out:
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index affd338abc5..63bb44fdcde 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -656,7 +656,7 @@ __mnt3_get_volume_id (struct mount3_state *ms, xlator_t *mntxl,
LOCK (&ms->mountlock);
list_for_each_entry (exp, &ms->exportlist, explist) {
if (exp->vol == mntxl) {
- uuid_copy (volumeid, exp->volumeid);
+ gf_uuid_copy (volumeid, exp->volumeid);
ret = 0;
goto out;
}
@@ -1028,7 +1028,7 @@ __mnt3_resolve_export_subdir_comp (mnt3_resolve_t *mres)
goto err;
/* Wipe the contents of the previous component */
- uuid_copy (gfid, mres->resolveloc.inode->gfid);
+ gf_uuid_copy (gfid, mres->resolveloc.inode->gfid);
nfs_loc_wipe (&mres->resolveloc);
ret = nfs_entry_loc_fill (mres->exp->vol->itable, gfid, nextcomp,
&mres->resolveloc, NFS_RESOLVE_CREATE);
@@ -3150,7 +3150,7 @@ mnt3_init_export_ent (struct mount3_state *ms, xlator_t *xl, char *exportpath,
* actually use it when a mount request comes in and a file handle
* needs to be built.
*/
- uuid_copy (exp->volumeid, volumeid);
+ gf_uuid_copy (exp->volumeid, volumeid);
exp->vol = xl;
/* On success we should return from here*/
@@ -3213,7 +3213,7 @@ __mnt3_init_volume (struct mount3_state *ms, dict_t *opts, xlator_t *xlator)
if ((!ms) || (!xlator) || (!opts))
return -1;
- uuid_clear (volumeid);
+ gf_uuid_clear (volumeid);
if (gf_nfs_dvm_off (nfs_state (ms->nfsx)))
goto no_dvm;
@@ -3240,7 +3240,7 @@ __mnt3_init_volume (struct mount3_state *ms, dict_t *opts, xlator_t *xlator)
}
if (optstr) {
- ret = uuid_parse (optstr, volumeid);
+ ret = gf_uuid_parse (optstr, volumeid);
if (ret < 0) {
gf_log (GF_MNT, GF_LOG_ERROR, "Failed to parse volume "
"UUID");
diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c
index f942d37d6e1..547e5b3a833 100644
--- a/xlators/nfs/server/src/nfs-common.c
+++ b/xlators/nfs/server/src/nfs-common.c
@@ -157,8 +157,8 @@ nfs_loc_fill (loc_t *loc, inode_t *inode, inode_t *parent, char *path)
if (inode) {
loc->inode = inode_ref (inode);
- 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);
}
if (parent)
@@ -198,7 +198,7 @@ nfs_inode_loc_fill (inode_t *inode, loc_t *loc, int how)
* the inode table, and not a newly created one. For newly
* created inode, inode_path returns null gfid as the path.
*/
- if (!uuid_is_null (inode->gfid)) {
+ if (!gf_uuid_is_null (inode->gfid)) {
ret = inode_path (inode, NULL, &resolvedpath);
if (ret < 0) {
gf_log (GF_NFS, GF_LOG_ERROR, "path resolution failed "
@@ -264,7 +264,7 @@ nfs_gfid_loc_fill (inode_table_t *itable, uuid_t gfid, loc_t *loc, int how)
gf_log (GF_NFS, GF_LOG_TRACE, "Inode was found in the itable.");
}
- uuid_copy (loc->gfid, gfid);
+ gf_uuid_copy (loc->gfid, gfid);
ret = nfs_inode_loc_fill (inode, loc, how);
if (ret < 0) {
@@ -340,7 +340,7 @@ nfs_entry_loc_fill (inode_table_t *itable, uuid_t pargfid, char *entry,
if (!parent)
goto err;
- uuid_copy (loc->pargfid, pargfid);
+ gf_uuid_copy (loc->pargfid, pargfid);
ret = -2;
entryinode = inode_grep (itable, parent, entry);
diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c
index 56d4cba47c6..c3f1b5e2fa6 100644
--- a/xlators/nfs/server/src/nfs-fops.c
+++ b/xlators/nfs/server/src/nfs-fops.c
@@ -350,9 +350,9 @@ nfs_gfid_dict (inode_t *inode)
if (dyngfid == NULL)
return (NULL);
- uuid_generate (newgfid);
+ gf_uuid_generate (newgfid);
- if (uuid_compare (inode->gfid, rootgfid) == 0)
+ if (gf_uuid_compare (inode->gfid, rootgfid) == 0)
memcpy (dyngfid, rootgfid, sizeof (uuid_t));
else
memcpy (dyngfid, newgfid, sizeof (uuid_t));
diff --git a/xlators/nfs/server/src/nfs3-fh.c b/xlators/nfs/server/src/nfs3-fh.c
index 88a8fcb1180..8d492c8c72d 100644
--- a/xlators/nfs/server/src/nfs3-fh.c
+++ b/xlators/nfs/server/src/nfs3-fh.c
@@ -58,7 +58,7 @@ nfs3_fh_init (struct nfs3_fh *fh, struct iatt *buf)
fh->ident[2] = GF_NFSFH_IDENT2;
fh->ident[3] = GF_NFSFH_IDENT3;
- uuid_copy (fh->gfid, buf->ia_gfid);
+ gf_uuid_copy (fh->gfid, buf->ia_gfid);
}
@@ -72,7 +72,7 @@ nfs3_fh_build_indexed_root_fh (xlator_list_t *cl, xlator_t *xl)
if ((!cl) || (!xl))
return fh;
- uuid_copy (buf.ia_gfid, root);
+ gf_uuid_copy (buf.ia_gfid, root);
nfs3_fh_init (&fh, &buf);
fh.exportid [15] = nfs_xlator_to_xlid (cl, xl);
@@ -87,10 +87,10 @@ nfs3_fh_build_uuid_root_fh (uuid_t volumeid, uuid_t mountid)
struct iatt buf = {0, };
uuid_t root = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
- uuid_copy (buf.ia_gfid, root);
+ gf_uuid_copy (buf.ia_gfid, root);
nfs3_fh_init (&fh, &buf);
- uuid_copy (fh.exportid, volumeid);
- uuid_copy (fh.mountid, mountid);
+ gf_uuid_copy (fh.exportid, volumeid);
+ gf_uuid_copy (fh.mountid, mountid);
return fh;
}
@@ -104,7 +104,7 @@ nfs3_fh_is_root_fh (struct nfs3_fh *fh)
if (!fh)
return 0;
- if (uuid_compare (fh->gfid, rootgfid) == 0)
+ if (gf_uuid_compare (fh->gfid, rootgfid) == 0)
return 1;
return 0;
@@ -150,7 +150,7 @@ nfs3_fh_build_parent_fh (struct nfs3_fh *child, struct iatt *newstat,
return -1;
nfs3_fh_init (newfh, newstat);
- uuid_copy (newfh->exportid, child->exportid);
+ gf_uuid_copy (newfh->exportid, child->exportid);
return 0;
}
@@ -164,9 +164,9 @@ nfs3_build_fh (inode_t *inode, uuid_t exportid, struct nfs3_fh *newfh)
newfh->ident[1] = GF_NFSFH_IDENT1;
newfh->ident[2] = GF_NFSFH_IDENT2;
newfh->ident[3] = GF_NFSFH_IDENT3;
- uuid_copy (newfh->gfid, inode->gfid);
- uuid_copy (newfh->exportid, exportid);
- /*uuid_copy (newfh->mountid, mountid);*/
+ gf_uuid_copy (newfh->gfid, inode->gfid);
+ gf_uuid_copy (newfh->exportid, exportid);
+ /*gf_uuid_copy (newfh->mountid, mountid);*/
return 0;
}
@@ -178,8 +178,8 @@ nfs3_fh_build_child_fh (struct nfs3_fh *parent, struct iatt *newstat,
return -1;
nfs3_fh_init (newfh, newstat);
- uuid_copy (newfh->exportid, parent->exportid);
- uuid_copy (newfh->mountid, parent->mountid);
+ gf_uuid_copy (newfh->exportid, parent->exportid);
+ gf_uuid_copy (newfh->mountid, parent->mountid);
return 0;
}
diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c
index b122faf764d..fb630a643cf 100644
--- a/xlators/nfs/server/src/nfs3-helpers.c
+++ b/xlators/nfs/server/src/nfs3-helpers.c
@@ -3734,7 +3734,7 @@ nfs3_fh_resolve_inode (nfs3_call_state_t *cs)
return ret;
gf_log (GF_NFS3, GF_LOG_TRACE, "FH needs inode resolution");
- uuid_copy (cs->resolvedloc.gfid, cs->resolvefh.gfid);
+ gf_uuid_copy (cs->resolvedloc.gfid, cs->resolvefh.gfid);
inode = inode_find (cs->vol->itable, cs->resolvefh.gfid);
if (!inode)
ret = nfs3_fh_resolve_inode_hard (cs);
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index b8ae5cdb5f9..1a94c00ce8c 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -92,7 +92,7 @@ __nfs3_get_export_by_volumeid (struct nfs3_state *nfs3, uuid_t exportid)
struct nfs3_export *exp = NULL;
list_for_each_entry (exp, &nfs3->exports, explist) {
- if (!uuid_compare (exportid, exp->volumeid))
+ if (!gf_uuid_compare (exportid, exp->volumeid))
goto found;
}
@@ -214,8 +214,8 @@ out:
rpc_transport_t *trans = NULL; \
volume = nfs3_fh_to_xlator ((nfs3state), handle); \
if (!volume) { \
- uuid_unparse (handle->exportid, exportid); \
- uuid_unparse (handle->gfid, gfid); \
+ gf_uuid_unparse (handle->exportid, exportid); \
+ gf_uuid_unparse (handle->gfid, gfid); \
trans = rpcsvc_request_transport (req); \
GF_LOG_OCCASIONALLY (nfs3state->occ_logger, \
GF_NFS3, GF_LOG_ERROR, "Failed to map " \
@@ -258,7 +258,7 @@ out:
trans = rpcsvc_request_transport (cst->req); \
xlatorp = nfs3_fh_to_xlator (cst->nfs3state, \
&cst->resolvefh); \
- uuid_unparse (cst->resolvefh.gfid, gfid); \
+ gf_uuid_unparse (cst->resolvefh.gfid, gfid); \
sprintf (buf, "(%s) %s : %s", \
trans->peerinfo.identifier, \
xlatorp ? xlatorp->name : "ERR", gfid); \
@@ -278,7 +278,7 @@ out:
trans = rpcsvc_request_transport (cst->req); \
xlatorp = nfs3_fh_to_xlator (cst->nfs3state, \
&cst->resolvefh); \
- uuid_unparse (cst->resolvefh.gfid, gfid); \
+ gf_uuid_unparse (cst->resolvefh.gfid, gfid); \
snprintf (buf, sizeof (buf), "(%s) %s : %s", \
trans->peerinfo.identifier, \
xlatorp ? xlatorp->name : "ERR", \
@@ -300,7 +300,7 @@ out:
trans = rpcsvc_request_transport (cst->req); \
xlatorp = nfs3_fh_to_xlator (cst->nfs3state, \
&cst->resolvefh); \
- uuid_unparse (cst->resolvefh.gfid, gfid); \
+ gf_uuid_unparse (cst->resolvefh.gfid, gfid); \
snprintf (buf, sizeof (buf), "(%s) %s : %s", \
trans->peerinfo.identifier, \
xlatorp ? xlatorp->name : "ERR", \
@@ -325,7 +325,7 @@ __nfs3_get_volume_id (struct nfs3_state *nfs3, xlator_t *xl,
list_for_each_entry (exp, &nfs3->exports, explist) {
if (exp->subvol == xl) {
- uuid_copy (volumeid, exp->volumeid);
+ gf_uuid_copy (volumeid, exp->volumeid);
ret = 0;
goto out;
}
@@ -346,7 +346,7 @@ out:
goto erl; \
} \
\
- uuid_copy ((fhd)->gfid, zero); \
+ gf_uuid_copy ((fhd)->gfid, zero); \
(fhd)->gfid[15] = 1; \
(enam) = NULL; \
if ((gf_nfs_dvm_off (nfs_state (nfs3st->nfsx)))) \
@@ -2428,7 +2428,7 @@ nfs3svc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs->preparent = *preparent;
cs->postparent = *postparent;
nfs_request_user_init (&nfu, cs->req);
- uuid_copy (cs->resolvedloc.gfid, inode->gfid);
+ gf_uuid_copy (cs->resolvedloc.gfid, inode->gfid);
ret = nfs_setattr (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,&cs->stbuf,
cs->setattr_valid, nfs3svc_create_setattr_cbk, cs);
if (ret < 0)
@@ -5331,7 +5331,7 @@ nfs3_init_subvolume_options (xlator_t *nfsx,
if (!options)
return (-1);
- uuid_clear (volumeid);
+ gf_uuid_clear (volumeid);
if (gf_nfs_dvm_off (nfs_state (nfsx)))
goto no_dvm;
@@ -5358,14 +5358,14 @@ nfs3_init_subvolume_options (xlator_t *nfsx,
}
if (optstr) {
- ret = uuid_parse (optstr, volumeid);
+ ret = gf_uuid_parse (optstr, volumeid);
if (ret < 0) {
gf_log (GF_MNT, GF_LOG_ERROR, "Failed to parse volume "
"UUID");
ret = -1;
goto err;
}
- uuid_copy (exp->volumeid, volumeid);
+ gf_uuid_copy (exp->volumeid, volumeid);
}
no_dvm:
diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c
index d1953815992..37fc9c37699 100644
--- a/xlators/nfs/server/src/nlm4.c
+++ b/xlators/nfs/server/src/nlm4.c
@@ -105,8 +105,8 @@ nfs3_fh_to_xlator (struct nfs3_state *nfs3, struct nfs3_fh *fh);
rpc_transport_t *trans = NULL; \
volume = nfs3_fh_to_xlator ((nfs3state), &handle); \
if (!volume) { \
- uuid_unparse (handle.exportid, exportid); \
- uuid_unparse (handle.gfid, gfid); \
+ gf_uuid_unparse (handle.exportid, exportid); \
+ gf_uuid_unparse (handle.gfid, gfid); \
trans = rpcsvc_request_transport (req); \
gf_log (GF_NLM, GF_LOG_ERROR, "Failed to map " \
"FH to vol: client=%s, exportid=%s, gfid=%s",\
@@ -144,7 +144,7 @@ nfs3_fh_to_xlator (struct nfs3_state *nfs3, struct nfs3_fh *fh);
trans = rpcsvc_request_transport (cst->req); \
xlatorp = nfs3_fh_to_xlator (cst->nfs3state, \
&cst->resolvefh); \
- uuid_unparse (cst->resolvefh.gfid, gfid); \
+ gf_uuid_unparse (cst->resolvefh.gfid, gfid); \
snprintf (buf, sizeof (buf), "(%s) %s : %s", \
trans->peerinfo.identifier, \
xlatorp ? xlatorp->name : "ERR", \