diff options
author | Amar Tumballi <amarts@redhat.com> | 2019-06-28 22:51:37 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2019-08-16 05:37:03 +0000 |
commit | 29cfe643cbcf7826375a3d52ff1865706a35bc38 (patch) | |
tree | add22d6f9e8b8afaae089625526d521c53c8b33c /libglusterd | |
parent | a24288c5c9da9137eb1d5d487bc7cd11af01b88b (diff) |
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 <amarts@redhat.com>
Diffstat (limited to 'libglusterd')
-rw-r--r-- | libglusterd/Makefile.am | 3 | ||||
-rw-r--r-- | libglusterd/src/Makefile.am | 31 | ||||
-rw-r--r-- | libglusterd/src/gd-common-utils.c | 78 | ||||
-rw-r--r-- | libglusterd/src/gd-common-utils.h | 28 | ||||
-rw-r--r-- | libglusterd/src/libglusterd.sym | 2 |
5 files changed, 142 insertions, 0 deletions
diff --git a/libglusterd/Makefile.am b/libglusterd/Makefile.am new file mode 100644 index 00000000000..a985f42a877 --- /dev/null +++ b/libglusterd/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = src + +CLEANFILES = diff --git a/libglusterd/src/Makefile.am b/libglusterd/src/Makefile.am new file mode 100644 index 00000000000..684d2bac96b --- /dev/null +++ b/libglusterd/src/Makefile.am @@ -0,0 +1,31 @@ +libglusterd_la_CFLAGS = $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS) \ + -DDATADIR=\"$(localstatedir)\" + +libglusterd_la_CPPFLAGS = $(GF_CPPFLAGS) -D__USE_FILE_OFFSET64 \ + -DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" \ + -DXLATORPARENTDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)\" \ + -DXXH_NAMESPACE=GF_ -D__USE_LARGEFILE64 \ + -I$(CONTRIBDIR)/rbtree \ + -I$(CONTRIBDIR)/libexecinfo ${ARGP_STANDALONE_CPPFLAGS} \ + -DSBIN_DIR=\"$(sbindir)\" -I$(CONTRIBDIR)/timer-wheel \ + -I$(CONTRIBDIR)/xxhash \ + -I$(top_srcdir)/rpc/xdr/src -I$(top_builddir)/rpc/xdr/src \ + -I$(top_srcdir)/rpc/rpc-lib/src/ + +libglusterd_la_LIBADD = $(ZLIB_LIBS) $(MATH_LIB) $(UUID_LIBS) +libglusterd_la_LDFLAGS = -version-info $(LIBGLUSTERFS_LT_VERSION) $(GF_LDFLAGS) \ + -export-symbols $(top_srcdir)/libglusterd/src/libglusterd.sym + +lib_LTLIBRARIES = libglusterd.la + +libglusterd_la_SOURCES = gd-common-utils.c + +libglusterd_la_HEADERS = gd-common-utils.h + +libglusterd_ladir = $(includedir)/glusterfs + +noinst_HEADERS = gd-common-utils.h + +EXTRA_DIST = libglusterd.sym + +CLEANFILES = diff --git a/libglusterd/src/gd-common-utils.c b/libglusterd/src/gd-common-utils.c new file mode 100644 index 00000000000..243fab215e6 --- /dev/null +++ b/libglusterd/src/gd-common-utils.c @@ -0,0 +1,78 @@ +/* + Copyright (c) 2019 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#include "gd-common-utils.h" +#include "cli1-xdr.h" + +int +get_vol_type(int type, int dist_count, int brick_count) +{ + if ((type != GF_CLUSTER_TYPE_TIER) && (type > 0) && + (dist_count < brick_count)) + type = type + GF_CLUSTER_TYPE_MAX - 1; + + return type; +} + +char * +get_struct_variable(int mem_num, gf_gsync_status_t *sts_val) +{ + switch (mem_num) { + case 0: + return (sts_val->node); + case 1: + return (sts_val->master); + case 2: + return (sts_val->brick); + case 3: + return (sts_val->slave_user); + case 4: + return (sts_val->slave); + case 5: + return (sts_val->slave_node); + case 6: + return (sts_val->worker_status); + case 7: + return (sts_val->crawl_status); + case 8: + return (sts_val->last_synced); + case 9: + return (sts_val->entry); + case 10: + return (sts_val->data); + case 11: + return (sts_val->meta); + case 12: + return (sts_val->failures); + case 13: + return (sts_val->checkpoint_time); + case 14: + return (sts_val->checkpoint_completed); + case 15: + return (sts_val->checkpoint_completion_time); + case 16: + return (sts_val->brick_host_uuid); + case 17: + return (sts_val->last_synced_utc); + case 18: + return (sts_val->checkpoint_time_utc); + case 19: + return (sts_val->checkpoint_completion_time_utc); + case 20: + return (sts_val->slavekey); + case 21: + return (sts_val->session_slave); + default: + goto out; + } + +out: + return NULL; +} diff --git a/libglusterd/src/gd-common-utils.h b/libglusterd/src/gd-common-utils.h new file mode 100644 index 00000000000..b9bb4f956fe --- /dev/null +++ b/libglusterd/src/gd-common-utils.h @@ -0,0 +1,28 @@ +/* + Copyright (c) 2019 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _GD_COMMON_UTILS_H +#define _GD_COMMON_UTILS_H + +#include <fcntl.h> +#include <unistd.h> +#include <limits.h> +#include <stddef.h> + +#include "protocol-common.h" +#include "rpcsvc.h" + +int +get_vol_type(int type, int dist_count, int brick_count); + +char * +get_struct_variable(int mem_num, gf_gsync_status_t *sts_val); + +#endif /* _GD_COMMON_UTILS_H */ diff --git a/libglusterd/src/libglusterd.sym b/libglusterd/src/libglusterd.sym new file mode 100644 index 00000000000..45969a87c12 --- /dev/null +++ b/libglusterd/src/libglusterd.sym @@ -0,0 +1,2 @@ +get_vol_type +get_struct_variable |