summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/features/marker/utils/src/Makefile.am1
-rw-r--r--xlators/features/marker/utils/src/gsyncd.c24
2 files changed, 25 insertions, 0 deletions
diff --git a/xlators/features/marker/utils/src/Makefile.am b/xlators/features/marker/utils/src/Makefile.am
index 73c99cb76d8..de23fb55609 100644
--- a/xlators/features/marker/utils/src/Makefile.am
+++ b/xlators/features/marker/utils/src/Makefile.am
@@ -13,6 +13,7 @@ noinst_HEADERS = procdiggy.h
AM_CFLAGS = -fPIC -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)\
-I$(top_srcdir)/libglusterfs/src\
-DGSYNCD_PREFIX=\"$(libexecdir)/glusterfs\"\
+ -DUSE_LIBGLUSTERFS\
-DSBIN_DIR=\"$(sbindir)\" -DPYTHON=\"$(PYTHON)\"
diff --git a/xlators/features/marker/utils/src/gsyncd.c b/xlators/features/marker/utils/src/gsyncd.c
index cdf28267318..a45873a7178 100644
--- a/xlators/features/marker/utils/src/gsyncd.c
+++ b/xlators/features/marker/utils/src/gsyncd.c
@@ -19,6 +19,17 @@
#include <string.h>
#include <sys/param.h> /* for PATH_MAX */
+/* NOTE (USE_LIBGLUSTERFS):
+ * ------------------------
+ * When USE_LIBGLUSTERFS debugging sumbol is passed; perform
+ * glusterfs translator like initialization so that glusterfs
+ * globals, contexts are valid when glustefs api's are invoked.
+ * We unconditionally pass then while building gsyncd binary.
+ */
+#ifdef USE_LIBGLUSTERFS
+#include "glusterfs.h"
+#include "globals.h"
+#endif
#include "common-utils.h"
#include "run.h"
@@ -290,6 +301,19 @@ main (int argc, char **argv)
char *b = NULL;
char *sargv = NULL;
+#ifdef USE_LIBGLUSTERFS
+ glusterfs_ctx_t *ctx = NULL;
+
+ ctx = glusterfs_ctx_new ();
+ if (!ctx)
+ return ENOMEM;
+
+ if (glusterfs_globals_init (ctx))
+ return 1;
+
+ THIS->ctx = ctx;
+#endif
+
evas = getenv (_GLUSTERD_CALLED_);
if (evas && strcmp (evas, "1") == 0)
/* OK, we know glusterd called us, no need to look for further config