diff options
author | Gaurav <gaurav@gluster.com> | 2011-01-31 04:25:38 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2011-02-04 00:39:26 -0800 |
commit | 5f8e2cab86eab7f5ee5b4bb9b649376e476c740c (patch) | |
tree | 2a40f4806584dbafe1e0c2d44dbb509de28cbeb4 /xlators/nfs | |
parent | f3648c88ebc6d58a10854d564d3fc2c82290ce13 (diff) |
Logging : Use of uuid_utoa and uuid_utoa_r.
Signed-off-by: Gaurav <gaurav@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 2308 (Threadsafe uuid to string conversion function)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2308
Diffstat (limited to 'xlators/nfs')
-rw-r--r-- | xlators/nfs/server/src/mount3.c | 5 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3-fh.c | 15 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3-helpers.c | 29 |
3 files changed, 20 insertions, 29 deletions
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c index 5f3a0a1a692..53282d9a191 100644 --- a/xlators/nfs/server/src/mount3.c +++ b/xlators/nfs/server/src/mount3.c @@ -38,6 +38,7 @@ #include "iatt.h" #include "nfs-mem-types.h" #include "nfs.h" +#include "common-utils.h" #include <errno.h> @@ -485,7 +486,6 @@ __mnt3_resolve_export_subdir_comp (mnt3_resolve_t *mres) char *nextcomp = NULL; int ret = -EFAULT; nfs_user_t nfu = {0, }; - char gfidstr[512]; uuid_t gfid = {0, }; if (!mres) @@ -501,9 +501,8 @@ __mnt3_resolve_export_subdir_comp (mnt3_resolve_t *mres) ret = nfs_entry_loc_fill (mres->exp->vol->itable, gfid, nextcomp, &mres->resolveloc, NFS_RESOLVE_CREATE); if ((ret < 0) && (ret != -2)) { - uuid_unparse (mres->resolveloc.inode->gfid, gfidstr); gf_log (GF_MNT, GF_LOG_ERROR, "Failed to resolve and create " - "inode: parent gfid %s, entry %s", gfidstr, nextcomp); + "inode: parent gfid %s, entry %s", uuid_utoa (mres->resolveloc.inode->gfid), nextcomp); ret = -EFAULT; goto err; } diff --git a/xlators/nfs/server/src/nfs3-fh.c b/xlators/nfs/server/src/nfs3-fh.c index be5a3017c3b..971bea8a30a 100644 --- a/xlators/nfs/server/src/nfs3-fh.c +++ b/xlators/nfs/server/src/nfs3-fh.c @@ -31,6 +31,7 @@ #include "nfs3-fh.h" #include "nfs-common.h" #include "iatt.h" +#include "common-utils.h" int @@ -171,7 +172,6 @@ nfs3_fh_hash_entry (uuid_t gfid) } - void nfs3_fh_to_str (struct nfs3_fh *fh, char *str) { @@ -181,13 +181,11 @@ nfs3_fh_to_str (struct nfs3_fh *fh, char *str) if ((!fh) || (!str)) return; - uuid_unparse (fh->gfid, gfid); - uuid_unparse (fh->exportid, exportid); sprintf (str, "FH: hashcount %d, exportid %s, gfid %s", - fh->hashcount, exportid, gfid); + fh->hashcount, uuid_utoa_r (fh->exportid, exportid), + uuid_utoa_r (fh->gfid, gfid)); } - void nfs3_log_fh (struct nfs3_fh *fh) { @@ -198,10 +196,10 @@ nfs3_log_fh (struct nfs3_fh *fh) if (!fh) return; - uuid_unparse (fh->gfid, gfidstr); - uuid_unparse (fh->exportid, exportidstr); gf_log ("nfs3-fh", GF_LOG_TRACE, "filehandle: hashcount %d, exportid " - "0x%s, gfid 0x%s", fh->hashcount, exportidstr, gfidstr); + "0x%s, gfid 0x%s", fh->hashcount, + uuid_utoa_r (fh->exportid, exportidstr), + uuid_utoa_r (fh->gfid, gfidstr)); /* for (; x < fh->hashcount; ++x) gf_log ("FILEHANDLE", GF_LOG_TRACE, "Hash %d: %d", x, @@ -209,7 +207,6 @@ nfs3_log_fh (struct nfs3_fh *fh) */ } - int nfs3_fh_build_parent_fh (struct nfs3_fh *child, struct iatt *newstat, struct nfs3_fh *newfh) diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c index 8697487945e..cb7ba7cbb01 100644 --- a/xlators/nfs/server/src/nfs3-helpers.c +++ b/xlators/nfs/server/src/nfs3-helpers.c @@ -35,6 +35,7 @@ #include "nfs3-helpers.h" #include "nfs-mem-types.h" #include "iatt.h" +#include "common-utils.h" #include <string.h> extern int @@ -2542,7 +2543,6 @@ nfs3_fh_resolve_check_entry (struct nfs3_fh *fh, gf_dirent_t *candidate, struct iatt *ia = NULL; int ret = GF_NFS3_FHRESOLVE_NOTFOUND; nfs3_hash_entry_t entryhash = 0; - char gfidstr[512]; if ((!fh) || (!candidate)) return ret; @@ -2553,10 +2553,10 @@ nfs3_fh_resolve_check_entry (struct nfs3_fh *fh, gf_dirent_t *candidate, ia = &candidate->d_stat; if ((uuid_compare (candidate->d_stat.ia_gfid, fh->gfid)) == 0) { - uuid_unparse (candidate->d_stat.ia_gfid, gfidstr); gf_log (GF_NFS3, GF_LOG_TRACE, "Found entry: gfid: %s, " - "name: %s, hashcount %d", gfidstr, candidate->d_name, - hashidx); + "name: %s, hashcount %d", + uuid_utoa (candidate->d_stat.ia_gfid), + candidate->d_name, hashidx); ret = GF_NFS3_FHRESOLVE_FOUND; goto found_entry; } @@ -2854,7 +2854,6 @@ nfs3_fh_resolve_dir_hard (nfs3_call_state_t *cs, uuid_t dirgfid, char *entry) { int ret = -EFAULT; nfs_user_t nfu = {0, }; - char gfidstr[512]; if (!cs) return ret; @@ -2869,9 +2868,9 @@ nfs3_fh_resolve_dir_hard (nfs3_call_state_t *cs, uuid_t dirgfid, char *entry) } nfs_user_root_create (&nfu); - uuid_unparse (dirgfid, gfidstr); gf_log (GF_NFS3, GF_LOG_TRACE, "FH hard dir resolution: gfid: %s, " - "entry: %s, next hashcount: %d", gfidstr, entry, cs->hashidx); + "entry: %s, next hashcount: %d", uuid_utoa (dirgfid), entry, + cs->hashidx); ret = nfs_entry_loc_fill (cs->vol->itable, dirgfid, entry, &cs->resolvedloc, NFS_RESOLVE_CREATE); @@ -2948,7 +2947,6 @@ nfs3_fh_resolve_search_dir (nfs3_call_state_t *cs, gf_dirent_t *entries) gf_dirent_t *candidate = NULL; int ret = GF_NFS3_FHRESOLVE_NOTFOUND; off_t lastoff = 0; - char gfidstr[512]; if ((!cs) || (!entries)) return -EFAULT; @@ -2958,9 +2956,9 @@ nfs3_fh_resolve_search_dir (nfs3_call_state_t *cs, gf_dirent_t *entries) list_for_each_entry (candidate, &entries->list, list) { lastoff = candidate->d_off; - uuid_unparse (candidate->d_stat.ia_gfid, gfidstr); gf_log (GF_NFS3, GF_LOG_TRACE, "Candidate: %s, gfid: %s", - candidate->d_name, gfidstr); + candidate->d_name, + uuid_utoa (candidate->d_stat.ia_gfid)); ret = nfs3_fh_resolve_check_entry (&cs->resolvefh, candidate, cs->hashidx); if (ret != GF_NFS3_FHRESOLVE_NOTFOUND) @@ -3004,7 +3002,6 @@ nfs3_fh_resolve_inode_hard (nfs3_call_state_t *cs) { int ret = -EFAULT; nfs_user_t nfu = {0, }; - char gfidstr[512]; if (!cs) return ret; @@ -3019,9 +3016,9 @@ nfs3_fh_resolve_inode_hard (nfs3_call_state_t *cs) } nfs_user_root_create (&nfu); - uuid_unparse (cs->resolvefh.gfid, gfidstr); gf_log (GF_NFS3, GF_LOG_TRACE, "FH hard resolution for: gfid 0x%s" - ", hashcount: %d, current hashidx %d", gfidstr, + ", hashcount: %d, current hashidx %d", + uuid_utoa (cs->resolvefh.gfid), cs->resolvefh.hashcount, cs->hashidx); ret = nfs_root_loc_fill (cs->vol->itable, &cs->resolvedloc); @@ -3047,17 +3044,15 @@ nfs3_fh_resolve_entry_hard (nfs3_call_state_t *cs) { int ret = -EFAULT; nfs_user_t nfu = {0, }; - char gfidstr[512]; if (!cs) return ret; nfs_loc_wipe (&cs->resolvedloc); nfs_user_root_create (&nfu); - uuid_unparse (cs->resolvefh.gfid, gfidstr); gf_log (GF_NFS3, GF_LOG_TRACE, "FH hard resolution: gfid: %s " - ", entry: %s, hashidx: %d", gfidstr, cs->resolventry, - cs->hashidx); + ", entry: %s, hashidx: %d", uuid_utoa (cs->resolvefh.gfid), + cs->resolventry, cs->hashidx); ret = nfs_entry_loc_fill (cs->vol->itable, cs->resolvefh.gfid, cs->resolventry, &cs->resolvedloc, |