From 0a6fe8551ac9807a8b6ad62241ec8048cf9f9025 Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Sun, 9 Jun 2019 13:31:31 +0300 Subject: multiple files: another attempt to remove includes There are many include statements that are not needed. A previous more ambitious attempt failed because of *BSD plafrom (see https://review.gluster.org/#/c/glusterfs/+/21929/ ) Now trying a more conservative reduction. It does not solve all circular deps that we have, but it does reduce some of them. There is just too much to handle reasonably (dht-common.h includes dht-lock.h which includes dht-common.h ...), but it does reduce the overall number of lines of include we need to look at in the future to understand and fix the mess later one. Change-Id: I550cd001bdefb8be0fe67632f783c0ef6bee3f9f updates: bz#1193929 Signed-off-by: Yaniv Kaul --- libglusterfs/src/glusterfs/circ-buff.h | 2 -- libglusterfs/src/glusterfs/cluster-syncop.h | 2 +- libglusterfs/src/glusterfs/common-utils.h | 4 ---- libglusterfs/src/glusterfs/compat.h | 4 ---- libglusterfs/src/glusterfs/dict.h | 1 - libglusterfs/src/glusterfs/event-history.h | 6 ++++-- libglusterfs/src/glusterfs/fd-lk.h | 4 ---- libglusterfs/src/glusterfs/fd.h | 1 - libglusterfs/src/glusterfs/hashfn.h | 2 -- libglusterfs/src/glusterfs/iobuf.h | 9 +++++---- libglusterfs/src/glusterfs/mem-pool.h | 1 - libglusterfs/src/glusterfs/rbthash.h | 12 +++++------- libglusterfs/src/glusterfs/syncop.h | 4 ++-- libglusterfs/src/glusterfs/xlator.h | 17 +++++++---------- 14 files changed, 24 insertions(+), 45 deletions(-) (limited to 'libglusterfs/src/glusterfs') diff --git a/libglusterfs/src/glusterfs/circ-buff.h b/libglusterfs/src/glusterfs/circ-buff.h index 4453b8487cd..822345b641b 100644 --- a/libglusterfs/src/glusterfs/circ-buff.h +++ b/libglusterfs/src/glusterfs/circ-buff.h @@ -12,8 +12,6 @@ #define _CB_H #include "glusterfs/common-utils.h" -#include "glusterfs/logging.h" -#include "glusterfs/mem-types.h" #define BUFFER_SIZE 10 #define TOTAL_SIZE BUFFER_SIZE + 1 diff --git a/libglusterfs/src/glusterfs/cluster-syncop.h b/libglusterfs/src/glusterfs/cluster-syncop.h index cfd3c338683..d0ad5ed548c 100644 --- a/libglusterfs/src/glusterfs/cluster-syncop.h +++ b/libglusterfs/src/glusterfs/cluster-syncop.h @@ -11,10 +11,10 @@ #ifndef _CLUSTER_SYNCOP_H #define _CLUSTER_SYNCOP_H -#include "glusterfs/xlator.h" #include #include #include + #include "glusterfs/defaults.h" #include "glusterfs/default-args.h" #include "glusterfs/syncop.h" diff --git a/libglusterfs/src/glusterfs/common-utils.h b/libglusterfs/src/glusterfs/common-utils.h index 49ebdba2fc2..d52904021e1 100644 --- a/libglusterfs/src/glusterfs/common-utils.h +++ b/libglusterfs/src/glusterfs/common-utils.h @@ -38,15 +38,11 @@ trap(void); /* To solve type punned error */ #define VOID(ptr) ((void **)((void *)ptr)) -#include "glusterfs/logging.h" -#include "glusterfs/glusterfs.h" -#include "glusterfs/locking.h" #include "glusterfs/mem-pool.h" #include "glusterfs/compat-uuid.h" #include "glusterfs/iatt.h" #include "glusterfs/libglusterfs-messages.h" #include "protocol-common.h" -#include "glusterfs/iobuf.h" #define STRINGIFY(val) #val #define TOSTRING(val) STRINGIFY(val) diff --git a/libglusterfs/src/glusterfs/compat.h b/libglusterfs/src/glusterfs/compat.h index 9374b79f9af..d2686499973 100644 --- a/libglusterfs/src/glusterfs/compat.h +++ b/libglusterfs/src/glusterfs/compat.h @@ -40,10 +40,6 @@ #define GF_XATTR_NAME_MAX XATTR_NAME_MAX #endif /* GF_LINUX_HOST_OS */ -#ifdef HAVE_XATTR_H -#include -#endif - /* * Define the fallocate flags in case we do not have the header. This also * accounts for older systems that do not define FALLOC_FL_PUNCH_HOLE. diff --git a/libglusterfs/src/glusterfs/dict.h b/libglusterfs/src/glusterfs/dict.h index 022f564f62a..7854c9feaa1 100644 --- a/libglusterfs/src/glusterfs/dict.h +++ b/libglusterfs/src/glusterfs/dict.h @@ -16,7 +16,6 @@ #include #include "glusterfs/common-utils.h" -#include "glusterfs/libglusterfs-messages.h" typedef struct _data data_t; typedef struct _dict dict_t; diff --git a/libglusterfs/src/glusterfs/event-history.h b/libglusterfs/src/glusterfs/event-history.h index c1af8934c03..f0e0422418e 100644 --- a/libglusterfs/src/glusterfs/event-history.h +++ b/libglusterfs/src/glusterfs/event-history.h @@ -11,8 +11,10 @@ #ifndef _EH_H #define _EH_H -#include "glusterfs/mem-types.h" -#include "glusterfs/circ-buff.h" +#include // for pthread_mutex_t +#include // for size_t +#include "glusterfs/circ-buff.h" // for buffer_t, circular_buffer_t +#include "glusterfs/glusterfs.h" // for gf_boolean_t struct event_hist { buffer_t *buffer; diff --git a/libglusterfs/src/glusterfs/fd-lk.h b/libglusterfs/src/glusterfs/fd-lk.h index 6465e6d3f58..76cc680306a 100644 --- a/libglusterfs/src/glusterfs/fd-lk.h +++ b/libglusterfs/src/glusterfs/fd-lk.h @@ -14,11 +14,7 @@ #include "glusterfs/fd.h" #include "glusterfs/locking.h" #include "glusterfs/list.h" -#include "glusterfs/logging.h" -#include "glusterfs/mem-pool.h" -#include "glusterfs/mem-types.h" #include "glusterfs/glusterfs.h" -#include "glusterfs/common-utils.h" #define get_lk_type(type) \ type == F_UNLCK ? "F_UNLCK" : (type == F_RDLCK ? "F_RDLCK" : "F_WRLCK") diff --git a/libglusterfs/src/glusterfs/fd.h b/libglusterfs/src/glusterfs/fd.h index cdbe2894bc3..28906d34e4d 100644 --- a/libglusterfs/src/glusterfs/fd.h +++ b/libglusterfs/src/glusterfs/fd.h @@ -17,7 +17,6 @@ #include "glusterfs/glusterfs.h" #include "glusterfs/locking.h" #include "glusterfs/fd-lk.h" -#include "glusterfs/common-utils.h" #define GF_ANON_FD_NO -2 #define GF_ANON_FD_FLAGS (O_RDWR | O_LARGEFILE) diff --git a/libglusterfs/src/glusterfs/hashfn.h b/libglusterfs/src/glusterfs/hashfn.h index a4cb33f072a..6e92e706d8c 100644 --- a/libglusterfs/src/glusterfs/hashfn.h +++ b/libglusterfs/src/glusterfs/hashfn.h @@ -20,6 +20,4 @@ SuperFastHash(const char *data, int32_t len); uint32_t gf_dm_hashfn(const char *msg, int len); -uint32_t -ReallySimpleHash(char *path, int len); #endif /* __HASHFN_H__ */ diff --git a/libglusterfs/src/glusterfs/iobuf.h b/libglusterfs/src/glusterfs/iobuf.h index 6de0f13ae36..792d4fe1529 100644 --- a/libglusterfs/src/glusterfs/iobuf.h +++ b/libglusterfs/src/glusterfs/iobuf.h @@ -11,11 +11,12 @@ #ifndef _IOBUF_H_ #define _IOBUF_H_ -#include "glusterfs/list.h" -#include "glusterfs/common-utils.h" -#include +#include // for size_t #include -#include +#include "glusterfs/atomic.h" // for gf_atomic_t +#include // for struct iovec +#include "glusterfs/locking.h" // for gf_lock_t +#include "glusterfs/list.h" #define GF_VARIABLE_IOBUF_COUNT 32 diff --git a/libglusterfs/src/glusterfs/mem-pool.h b/libglusterfs/src/glusterfs/mem-pool.h index 95579509866..004aa179b19 100644 --- a/libglusterfs/src/glusterfs/mem-pool.h +++ b/libglusterfs/src/glusterfs/mem-pool.h @@ -12,7 +12,6 @@ #define _MEM_POOL_H_ #include "glusterfs/list.h" -#include "glusterfs/locking.h" #include "glusterfs/atomic.h" #include "glusterfs/logging.h" #include "glusterfs/mem-types.h" diff --git a/libglusterfs/src/glusterfs/rbthash.h b/libglusterfs/src/glusterfs/rbthash.h index 3327ebf73c5..4c731de69c2 100644 --- a/libglusterfs/src/glusterfs/rbthash.h +++ b/libglusterfs/src/glusterfs/rbthash.h @@ -10,14 +10,12 @@ #ifndef __RBTHASH_TABLE_H_ #define __RBTHASH_TABLE_H_ -#include "rb.h" -#include "glusterfs/locking.h" -#include "glusterfs/mem-pool.h" -#include "glusterfs/logging.h" -#include "glusterfs/common-utils.h" -#include "glusterfs/list.h" -#include +#include // for uint32_t +#include "glusterfs/glusterfs.h" // for gf_boolean_t, glusterfs_ctx_t +#include "glusterfs/list.h" // for list_head +#include "glusterfs/locking.h" // for gf_lock_t +struct mem_pool; #define GF_RBTHASH_MEMPOOL 16384 // 1048576 #define GF_RBTHASH "rbthash" diff --git a/libglusterfs/src/glusterfs/syncop.h b/libglusterfs/src/glusterfs/syncop.h index e0f10175cea..b00988eeef1 100644 --- a/libglusterfs/src/glusterfs/syncop.h +++ b/libglusterfs/src/glusterfs/syncop.h @@ -11,11 +11,11 @@ #ifndef _SYNCOP_H #define _SYNCOP_H -#include "glusterfs/xlator.h" #include #include #include - +#include "glusterfs/dict.h" // for dict_t +#include "glusterfs/stack.h" // for call_frame_t, STACK_DESTROY, STACK_... #define SYNCENV_PROC_MAX 16 #define SYNCENV_PROC_MIN 2 #define SYNCPROC_IDLE_TIME 600 diff --git a/libglusterfs/src/glusterfs/xlator.h b/libglusterfs/src/glusterfs/xlator.h index 1a0ed99774b..42cbdc1ac93 100644 --- a/libglusterfs/src/glusterfs/xlator.h +++ b/libglusterfs/src/glusterfs/xlator.h @@ -11,19 +11,16 @@ #ifndef _XLATOR_H #define _XLATOR_H -#include -#include -#include - +#include // for int32_t +#include // for off_t, mode_t, off64_t, dev_t +#include "glusterfs-fops.h" // for GF_FOP_MAXVALUE, entrylk_cmd +#include "glusterfs/atomic.h" // for gf_atomic_t +#include "glusterfs/glusterfs.h" // for gf_boolean_t, glusterfs_ctx_t +#include "glusterfs/compat-uuid.h" // for uuid_t +#include "glusterfs/compat.h" #include "glusterfs/event-history.h" -#include "glusterfs/logging.h" -#include "glusterfs/common-utils.h" #include "glusterfs/dict.h" -#include "glusterfs/compat.h" -#include "glusterfs/list.h" #include "glusterfs/latency.h" -#include "glusterfs/compat-uuid.h" -#include "glusterfs/syscall.h" #define FIRST_CHILD(xl) (xl->children->xlator) #define SECOND_CHILD(xl) (xl->children->next->xlator) -- cgit