summaryrefslogtreecommitdiffstats
path: root/tools/gfind_missing_files
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2015-07-02 12:43:09 -0400
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-07-05 13:03:19 -0700
commit0fdf6c9db5114c77cd846c71699eb877d41ad6ae (patch)
treecba5c252006d162ce2dc3431bc1464b2d1f50df8 /tools/gfind_missing_files
parent78232678ad45cf8d12b991ea1ff441fbcdc3a601 (diff)
build: Mac OS X build issues, no spinlock, need sys_lgetxattr
use regular locks, use our syscall wrappers in libglusterfs Change-Id: I7e0d00956366806af041b69b65d1f169aa0d2ae2 BUG: 1238793 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/11515 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'tools/gfind_missing_files')
-rw-r--r--tools/gfind_missing_files/Makefile.am2
-rw-r--r--tools/gfind_missing_files/gcrawler.c24
2 files changed, 11 insertions, 15 deletions
diff --git a/tools/gfind_missing_files/Makefile.am b/tools/gfind_missing_files/Makefile.am
index 456aad836b6..043c34c4182 100644
--- a/tools/gfind_missing_files/Makefile.am
+++ b/tools/gfind_missing_files/Makefile.am
@@ -9,6 +9,8 @@ EXTRA_DIST = gfind_missing_files.sh gfid_to_path.sh \
gfindmissingfiles_PROGRAMS = gcrawler
gcrawler_SOURCES = gcrawler.c
+gcrawler_LDADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
+gcrawler_LDFLAGS = $(GF_LDFLAGS)
AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src
diff --git a/tools/gfind_missing_files/gcrawler.c b/tools/gfind_missing_files/gcrawler.c
index 517e773cb7c..6be8e48364d 100644
--- a/tools/gfind_missing_files/gcrawler.c
+++ b/tools/gfind_missing_files/gcrawler.c
@@ -12,21 +12,15 @@
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <assert.h>
+#include "locking.h"
-#ifndef __FreeBSD__
-#ifdef __NetBSD__
-#include <sys/xattr.h>
-#else
-#include <attr/xattr.h>
-#endif /* __NetBSD__ */
-#endif /* __FreeBSD__ */
-
+#include "compat.h"
#include "list.h"
+#include "syscall.h"
#define THREAD_MAX 32
#define BUMP(name) INC(name, 1)
@@ -325,7 +319,7 @@ xworker_do_crawl (struct xwork *xwork, struct dirjob *job)
tdbg ("Entering: %s\n", job->dirname);
- dirp = opendir (job->dirname);
+ dirp = sys_opendir (job->dirname);
if (!dirp) {
terr ("opendir failed on %s (%s)\n", job->dirname,
strerror (errno));
@@ -387,7 +381,7 @@ xworker_do_crawl (struct xwork *xwork, struct dirjob *job)
ret = 0;
out:
if (dirp)
- closedir (dirp);
+ sys_closedir (dirp);
return ret;
}
@@ -527,15 +521,15 @@ parse_and_validate_args (int argc, char *argv[])
}
basedir = argv[1];
- ret = lstat (basedir, &d);
+ ret = sys_lstat (basedir, &d);
if (ret) {
err ("%s: %s\n", basedir, strerror (errno));
return NULL;
}
#ifndef __FreeBSD__
- ret = lgetxattr (basedir, "trusted.glusterfs.volume-id",
- volume_id, 16);
+ ret = sys_lgetxattr (basedir, "trusted.glusterfs.volume-id",
+ volume_id, 16);
if (ret != 16) {
err ("%s:Not a valid brick path.\n", basedir);
return NULL;
@@ -543,7 +537,7 @@ parse_and_validate_args (int argc, char *argv[])
#endif /* __FreeBSD__ */
slv_mnt = argv[2];
- ret = lstat (slv_mnt, &d);
+ ret = sys_lstat (slv_mnt, &d);
if (ret) {
err ("%s: %s\n", slv_mnt, strerror (errno));
return NULL;