summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2018-04-16 11:55:02 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-04-18 08:27:40 +0000
commit9a1ae47c8d60836ae0628a04a153f28c1085c0e8 (patch)
treebc1ad9129605eae792234024153990ec391a8784
parent7b0781a45bba826a790aa4d5a125693ac2be28ab (diff)
Add CLI option to print XLATORDIR
glusterfs gets the path to xlator dir from a compile time flag named XLATORDIR which gets passed through a -D flag to GCC. This path is used to find and load xlator shared objects. The XLATORDIR path isn't easily accessible to glusterd2. Glusterd2 currently uses the following command (hack) to get value of XLATORDIR: $ strings -d `which glusterfsd` | awk '/glusterfs/*/xlator$/' This change introduces "print-xlatordir" CLI option to expose XLATORDIR. The option is intentionally not documented. Updates: bz#1193929 Change-Id: Ic7247457600f11cd8d68eb3d0ad2526fdfda0b02 Signed-off-by: Prashanth Pai <ppai@redhat.com>
-rw-r--r--cli/src/Makefile.am1
-rw-r--r--cli/src/cli.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/cli/src/Makefile.am b/cli/src/Makefile.am
index c6323e591de..63e3409165d 100644
--- a/cli/src/Makefile.am
+++ b/cli/src/Makefile.am
@@ -20,6 +20,7 @@ AM_CPPFLAGS = $(GF_CPPFLAGS) \
-I$(top_builddir)/rpc/xdr/src\
-DDATADIR=\"$(localstatedir)\" \
-DCONFDIR=\"$(sysconfdir)/glusterfs\" \
+ -DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" \
-DGSYNCD_PREFIX=\"$(GLUSTERFS_LIBEXECDIR)\"\
-DSYNCDAEMON_COMPILE=$(SYNCDAEMON_COMPILE) -DSBIN_DIR=\"$(sbindir)\"\
$(XML_CPPFLAGS)
diff --git a/cli/src/cli.c b/cli/src/cli.c
index b58f211d3dd..7903b57edb6 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -338,6 +338,12 @@ cli_opt_parse (char *opt, struct cli_state *state)
exit (0);
}
+ /* XLATORDIR passed through a -D flag to GCC */
+ if (strcmp (opt, "print-xlatordir") == 0) {
+ cli_out ("%s", XLATORDIR);
+ exit (0);
+ }
+
if (strcmp (opt, "xml") == 0) {
#if (HAVE_LIB_XML)
state->mode |= GLUSTER_MODE_XML;