erofs-utils: dump: convert readdir to use erofs_iterate_dir()
PATCH 1/1 erofs-utils: dump: convert readdir to use erofs_iterate_dir()
No need to open code after erofs_iterate_dir() is finalized in liberofs.
Note that `erofs_get_pathname' isn't touched in this commit.
Signed-off-by Gao Xiang <[email protected]>
--- configure.ac | 5 ++ dump/main.c | 182 +++++++++++++++++------------------------ lib/liberofs_private.h | 12 +++ 3 files changed, 93 insertions(+), 106 deletions(-)
configure.ac +5 -0
@@ -167,6 +167,11 @@ AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1, #define _LARGEFILE64_SOURCE #include <unistd.h>]) +AC_CHECK_DECL(memrchr,[AC_DEFINE(HAVE_MEMRCHR, 1, + [Define to 1 if memrchr declared in string.h])],, + [#define _GNU_SOURCE + #include <string.h>]) + # Checks for library functions. AC_CHECK_FUNCS(m4_flatten([ backtrace
dump/main.c +76 -106
232 lines not on this page · raw message
lib/liberofs_private.h +12 -0
@@ -11,3 +11,15 @@#include <private/canned_fs_config.h> #include <private/fs_config.h> #endif + +#ifndef HAVE_MEMRCHR +static inline void *memrchr (const void *s,int c,size_t n) +{ +const unsigned char *p = (const unsigned char *)s; + +for (p += n; n >0 ; n--) +if (*--p == c) +return (void *)p; +return NULL ; +} +#endif
Signature · 1 line
2.20.1