From d5624b2d4baf509ad8d6037a0d9cabf9cd5ab1c5 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Wed, 25 Feb 2015 11:37:57 +0530 Subject: libglusterfs: Moved common functions as utils in syncop/common-utils These will be used by both afr and ec. Moved syncop_dirfd, syncop_ftw, syncop_dir_scan functions also into syncop-utils.c Change-Id: I467253c74a346e1e292d36a8c1a035775c3aa670 BUG: 1177601 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/9740 Reviewed-by: Krutika Dhananjay Reviewed-by: Anuradha Talur Reviewed-by: Ravishankar N Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- heal/src/glfs-heal.c | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) (limited to 'heal/src/glfs-heal.c') diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c index 3ea3f430e3b..7e8673a65ac 100644 --- a/heal/src/glfs-heal.c +++ b/heal/src/glfs-heal.c @@ -16,6 +16,7 @@ #include "glfs-internal.h" #include "protocol-common.h" #include "syncop.h" +#include "syncop-utils.h" #include #include @@ -124,43 +125,6 @@ glfsh_index_purge (xlator_t *subvol, inode_t *inode, char *name) return ret; } -int -glfsh_gfid_to_path (xlator_t *this, xlator_t *subvol, uuid_t gfid, char **path_p) -{ - int ret = 0; - char *path = NULL; - loc_t loc = {0,}; - dict_t *xattr = NULL; - - uuid_copy (loc.gfid, gfid); - loc.inode = inode_new (this->itable); - - ret = syncop_getxattr (subvol, &loc, &xattr, GFID_TO_PATH_KEY, NULL); - if (ret) - goto out; - - ret = dict_get_str (xattr, GFID_TO_PATH_KEY, &path); - if (ret || !path) { - ret = -EINVAL; - goto out; - } - - *path_p = gf_strdup (path); - if (!*path_p) { - ret = -ENOMEM; - goto out; - } - - ret = 0; - -out: - if (xattr) - dict_unref (xattr); - loc_wipe (&loc); - - return ret; -} - void glfsh_print_spb_status (dict_t *dict, char *path, uuid_t gfid, uint64_t *num_entries) @@ -275,7 +239,7 @@ glfsh_process_entries (xlator_t *xl, fd_t *fd, gf_dirent_t *entries, if (ret) continue; - ret = glfsh_gfid_to_path (this, xl, gfid, &path); + ret = syncop_gfid_to_path (this->itable, xl, gfid, &path); if (ret == -ENOENT || ret == -ESTALE) { glfsh_index_purge (xl, fd->inode, entry->d_name); -- cgit