From 29cfe643cbcf7826375a3d52ff1865706a35bc38 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 28 Jun 2019 22:51:37 +0530 Subject: libglusterfs: remove dependency of rpc Goal: 'libglusterfs' files shouldn't have any dependency outside of the tree, specially the header files, shouldn't have '#include' from outside the tree. Fixes: * Had to introduce libglusterd so, methods and structures required for only mgmt/glusterd, and cli/ are separated from 'libglusterfs/' * Remove rpc/xdr/gen from build, which was used mainly so dependency for libglusterfs could be properly satisfied. * Move rpcsvc_auth_data to client_t.h, so all dependencies could be handled. Updates: bz#1636297 Change-Id: I0e80243a5a3f4615e6fac6e1b947ad08a9363fce Signed-off-by: Amar Tumballi --- xlators/debug/io-stats/src/io-stats.c | 32 ++++++++++++++++++++----------- xlators/mgmt/glusterd/src/Makefile.am | 11 +++++++++-- xlators/mgmt/glusterd/src/glusterd.h | 2 ++ xlators/protocol/server/src/server.c | 1 - xlators/storage/posix/src/posix-helpers.c | 1 - 5 files changed, 32 insertions(+), 15 deletions(-) (limited to 'xlators') diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index b9422c0f335..71bd03c0123 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -34,7 +34,6 @@ #include #include #include -#include "cli1-xdr.h" #include #include #include @@ -67,6 +66,17 @@ typedef enum { IOS_STATS_THRU_MAX, } ios_stats_thru_t; +/* This is same as gf1_cli_info_op */ +/* had to be defined here again, so we have modularity between + xdr, xlator, and library functions */ +typedef enum ios_info_op { + GF_IOS_INFO_NONE = 0, + GF_IOS_INFO_ALL = 1, + GF_IOS_INFO_INCREMENTAL = 2, + GF_IOS_INFO_CUMULATIVE = 3, + GF_IOS_INFO_CLEAR = 4, +} ios_info_op_t; + struct ios_stat_lat { struct timeval time; double throughput; @@ -1590,7 +1600,7 @@ ios_global_stats_clear(struct ios_global_stats *stats, struct timeval *now) } int -io_stats_dump(xlator_t *this, struct ios_dump_args *args, gf1_cli_info_op op, +io_stats_dump(xlator_t *this, struct ios_dump_args *args, ios_info_op_t op, gf_boolean_t is_peek) { struct ios_conf *conf = NULL; @@ -1609,10 +1619,10 @@ io_stats_dump(xlator_t *this, struct ios_dump_args *args, gf1_cli_info_op op, gettimeofday(&now, NULL); LOCK(&conf->lock); { - if (op == GF_CLI_INFO_ALL || op == GF_CLI_INFO_CUMULATIVE) + if (op == GF_IOS_INFO_ALL || op == GF_IOS_INFO_CUMULATIVE) cumulative = conf->cumulative; - if (op == GF_CLI_INFO_ALL || op == GF_CLI_INFO_INCREMENTAL) { + if (op == GF_IOS_INFO_ALL || op == GF_IOS_INFO_INCREMENTAL) { incremental = conf->incremental; increment = conf->increment; @@ -1625,10 +1635,10 @@ io_stats_dump(xlator_t *this, struct ios_dump_args *args, gf1_cli_info_op op, } UNLOCK(&conf->lock); - if (op == GF_CLI_INFO_ALL || op == GF_CLI_INFO_CUMULATIVE) + if (op == GF_IOS_INFO_ALL || op == GF_IOS_INFO_CUMULATIVE) io_stats_dump_global(this, &cumulative, &now, -1, args); - if (op == GF_CLI_INFO_ALL || op == GF_CLI_INFO_INCREMENTAL) + if (op == GF_IOS_INFO_ALL || op == GF_IOS_INFO_INCREMENTAL) io_stats_dump_global(this, &incremental, &now, increment, args); return 0; @@ -3031,7 +3041,7 @@ conditional_dump(dict_t *dict, char *key, data_t *value, void *data) } else { (void)ios_dump_args_init(&args, IOS_DUMP_TYPE_FILE, logfp); } - io_stats_dump(this, &args, GF_CLI_INFO_ALL, _gf_false); + io_stats_dump(this, &args, GF_IOS_INFO_ALL, _gf_false); fclose(logfp); return 0; } @@ -3134,7 +3144,7 @@ _ios_dump_thread(xlator_t *this) stats_logfp = fopen(stats_filename, "w+"); if (stats_logfp) { (void)ios_dump_args_init(&args, conf->dump_format, stats_logfp); - io_stats_dump(this, &args, GF_CLI_INFO_ALL, _gf_false); + io_stats_dump(this, &args, GF_IOS_INFO_ALL, _gf_false); fclose(stats_logfp); log_stats_fopen_failure = _gf_true; } else if (log_stats_fopen_failure) { @@ -4105,8 +4115,8 @@ notify(xlator_t *this, int32_t event, void *data, ...) } } else { ret = dict_get_int32(dict, "info-op", &op); - if (ret || op < GF_CLI_INFO_ALL || GF_CLI_INFO_CLEAR < op) - op = GF_CLI_INFO_ALL; + if (ret || op < GF_IOS_INFO_ALL || GF_IOS_INFO_CLEAR < op) + op = GF_IOS_INFO_ALL; ret = dict_set_int32(output, "info-op", op); if (ret) { @@ -4115,7 +4125,7 @@ notify(xlator_t *this, int32_t event, void *data, ...) goto out; } - if (GF_CLI_INFO_CLEAR == op) { + if (GF_IOS_INFO_CLEAR == op) { ret = io_stats_clear(this->private); if (ret) gf_log(this->name, GF_LOG_ERROR, diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am index 10f389faf59..3b051a0fec9 100644 --- a/xlators/mgmt/glusterd/src/Makefile.am +++ b/xlators/mgmt/glusterd/src/Makefile.am @@ -5,7 +5,9 @@ endif xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/mgmt glusterd_la_CPPFLAGS = $(AM_CPPFLAGS) \ -DFILTERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/filter\" \ - -DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" + -DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" \ + -I$(top_srcdir)/libglusterd/src/ + glusterd_la_LDFLAGS = -module $(GF_XLATOR_DEFAULT_LDFLAGS) glusterd_la_SOURCES = glusterd.c glusterd-handler.c glusterd-sm.c \ glusterd-op-sm.c glusterd-utils.c glusterd-rpc-ops.c \ @@ -27,6 +29,7 @@ glusterd_la_SOURCES = glusterd.c glusterd-handler.c glusterd-sm.c \ glusterd_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \ + $(top_builddir)/libglusterd/src/libglusterd.la \ $(top_builddir)/rpc/xdr/src/libgfxdr.la \ $(top_builddir)/rpc/rpc-lib/src/libgfrpc.la \ $(XML_LIBS) -lcrypto $(URCU_LIBS) $(URCU_CDS_LIBS) $(LIB_DL) @@ -52,7 +55,8 @@ AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \ -I$(CONTRIBDIR)/mount -I$(CONTRIBDIR)/userspace-rcu \ -DSBIN_DIR=\"$(sbindir)\" -DDATADIR=\"$(localstatedir)\" \ -DGSYNCD_PREFIX=\"$(GLUSTERFS_LIBEXECDIR)\" \ - -DSYNCDAEMON_COMPILE=$(SYNCDAEMON_COMPILE) + -DSYNCDAEMON_COMPILE=$(SYNCDAEMON_COMPILE) \ + -I$(top_srcdir)/libglusterd/src/ AM_CFLAGS = -Wall $(GF_CFLAGS) $(URCU_CFLAGS) $(URCU_CDS_CFLAGS) $(XML_CFLAGS) @@ -70,3 +74,6 @@ if GF_INSTALL_GLUSTERD_WORKDIR (ln -sf $(DESTDIR)$(GLUSTERD_WORKDIR) $(sysconfdir)/glusterd) || true; endif endif + +$(top_builddir)/libglusterfs/src/libglusterd.la: + $(MAKE) -C $(top_builddir)/libglusterd/src/ all diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index 00211da3b63..899bd0e357b 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -39,6 +39,8 @@ #include #include "glusterd-gfproxyd-svc.h" +#include "gd-common-utils.h" + #define GLUSTERD_TR_LOG_SIZE 50 #define GLUSTERD_QUORUM_TYPE_KEY "cluster.server-quorum-type" #define GLUSTERD_QUORUM_RATIO_KEY "cluster.server-quorum-ratio" diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index f79fe26641d..1e91ede0d58 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -22,7 +22,6 @@ #include #include "server-messages.h" #include "rpc-clnt.h" -#include "glusterfsd.h" rpcsvc_cbk_program_t server_cbk_prog = { .progname = "Gluster Callback", diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 688a60b4b28..828aa289a2f 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -48,7 +48,6 @@ #include #include "posix-gfid-path.h" #include -#include "glusterfsd.h" #include "glusterfs/syncop.h" #include "timer-wheel.h" #include -- cgit