diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2020-07-01 12:19:05 +0300 |
---|---|---|
committer | Xavi Hernandez <xhernandez@redhat.com> | 2020-07-07 12:39:31 +0000 |
commit | 0a2de3f7f9aafadf0b20197eae2be96275271b97 (patch) | |
tree | e8eec5a7ca329d2859570e152b49b5e645821493 /libglusterfs/src/glusterfs | |
parent | 27f5c8ba844e9da54fc1304df4ffe015a3bbb9bd (diff) |
libglusterfs, glusterd: tweak directory scanning
Replace an over-engineered GF_SKIP_IRRELEVANT_ENTRIES() with
inline function gf_irrelevant_entry(), adjust related users.
Change-Id: I6f66c460f22a82dd9ebeeedc2c55fdbc10f4eec5
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Fixes: #1350
Diffstat (limited to 'libglusterfs/src/glusterfs')
-rw-r--r-- | libglusterfs/src/glusterfs/common-utils.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/libglusterfs/src/glusterfs/common-utils.h b/libglusterfs/src/glusterfs/common-utils.h index 8948fada7c3..b1a2462ee7e 100644 --- a/libglusterfs/src/glusterfs/common-utils.h +++ b/libglusterfs/src/glusterfs/common-utils.h @@ -486,18 +486,15 @@ union gf_sock_union { #define IOV_MIN(n) min(IOV_MAX, n) -#define GF_SKIP_IRRELEVANT_ENTRIES(entry, dir, scr) \ - do { \ - entry = NULL; \ - if (dir) { \ - entry = sys_readdir(dir, scr); \ - while (entry && (!strcmp(entry->d_name, ".") || \ - !fnmatch("*.tmp", entry->d_name, 0) || \ - !strcmp(entry->d_name, ".."))) { \ - entry = sys_readdir(dir, scr); \ - } \ - } \ - } while (0) +static inline gf_boolean_t +gf_irrelevant_entry(struct dirent *entry) +{ + GF_ASSERT(entry); + + return (!strcmp(entry->d_name, ".") || + !fnmatch("*.tmp", entry->d_name, 0) || + !strcmp(entry->d_name, "..")); +} static inline void iov_free(struct iovec *vector, int count) |