From dec4700c663975896f3aad1b4e59257263b4f4ac Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Mon, 10 Nov 2014 12:41:49 +0530 Subject: features/changelog: Cleanup .processing and .current directory On changelog_register cleanup .processing, .history/.processing, .current and .history/.current from the working directory. Moved glusterd_recursive_rmdir and glusterd_for_each_entry to common place(libglusterfs) and renamed as recursive_rmdir and GF_FOR_EACH_ENTRY_IN_DIR respectively BUG: 1162057 Change-Id: I1f98468a344cead039026762a805437b2f9e507b Signed-off-by: Aravinda VK Reviewed-on: http://review.gluster.org/9082 Tested-by: Gluster Build System Reviewed-by: Venky Shankar Tested-by: Venky Shankar --- libglusterfs/src/common-utils.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'libglusterfs/src/common-utils.h') diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 23a932b71aa..2a46f768e75 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -28,6 +28,7 @@ #include #endif #include +#include void trap (void); @@ -273,6 +274,19 @@ union gf_sock_union { #define IOV_MIN(n) min(IOV_MAX,n) +#define GF_FOR_EACH_ENTRY_IN_DIR(entry, dir) \ + do {\ + entry = NULL;\ + if (dir) { \ + entry = readdir (dir); \ + while (entry && (!strcmp (entry->d_name, ".") || \ + !fnmatch ("*.tmp", entry->d_name, 0) || \ + !strcmp (entry->d_name, ".."))) { \ + entry = readdir (dir); \ + } \ + } \ + } while (0) + static inline void iov_free (struct iovec *vector, int count) { @@ -660,4 +674,7 @@ fop_log_level (glusterfs_fop_t fop, int op_errno); int32_t gf_build_absolute_path (char *current_path, char *relative_path, char **path); +int +recursive_rmdir (const char *delete_path); + #endif /* _COMMON_UTILS_H */ -- cgit