From b28b84ca030c0bdef0f5e8619d915a98cfe1d1df Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Wed, 6 Dec 2017 09:17:07 -0600 Subject: [PATCH] libfrog: move list_sort out of libxfs List operations aren't really a part of libxfs, so move them to libfrog. This is purely a directory tree restructuring; no functional changes, though some indentation fixes are included. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- Makefile | 8 +++++--- copy/Makefile | 4 ++-- db/Makefile | 4 ++-- growfs/Makefile | 4 ++-- io/Makefile | 4 ++-- libfrog/Makefile | 2 ++ {libxfs => libfrog}/list_sort.c | 7 +++---- {libxfs => libfrog}/radix-tree.c | 26 ++++++++++++++------------ libxfs/Makefile | 2 -- logprint/Makefile | 4 ++-- mdrestore/Makefile | 4 ++-- 11 files changed, 36 insertions(+), 33 deletions(-) rename {libxfs => libfrog}/list_sort.c (98%) rename {libxfs => libfrog}/radix-tree.c (97%) diff --git a/Makefile b/Makefile index 4146473e2..0dce80ae6 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,8 @@ endif # header install rules to populate include/xfs correctly HDR_SUBDIRS = include libxfs -DLIB_SUBDIRS = libfrog libxlog libxcmd libhandle +LIBFROG_SUBDIR = libfrog +DLIB_SUBDIRS = libxlog libxcmd libhandle LIB_SUBDIRS = libxfs $(DLIB_SUBDIRS) TOOL_SUBDIRS = copy db estimate fsck growfs io logprint mkfs quota \ mdrestore repair rtcp m4 man doc debian spaceman @@ -66,7 +67,7 @@ LIBTOOLIZE_BIN=glibtoolize endif # include is listed last so it is processed last in clean rules. -SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) include +SUBDIRS = $(LIBFROG_SUBDIR) $(LIB_SUBDIRS) $(TOOL_SUBDIRS) include default: include/builddefs include/platform_defs.h ifeq ($(HAVE_BUILDDEFS), no) @@ -78,7 +79,8 @@ endif # tool/lib dependencies # note: include/xfs is set up by libxfs, too, so everything is dependent on it. -$(LIB_SUBDIRS) $(TOOL_SUBDIRS): include +$(LIBFROG_SUBDIR): include +$(LIB_SUBDIRS) $(TOOL_SUBDIRS): include libfrog $(DLIB_SUBDIRS) $(TOOL_SUBDIRS): libxfs db logprint: libxlog fsr: libhandle diff --git a/copy/Makefile b/copy/Makefile index e630b17eb..f86f2d7f1 100644 --- a/copy/Makefile +++ b/copy/Makefile @@ -9,8 +9,8 @@ LTCOMMAND = xfs_copy CFILES = xfs_copy.c HFILES = xfs_copy.h -LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBUUID) $(LIBPTHREAD) $(LIBRT) -LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG) +LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBFROG) $(LIBUUID) $(LIBPTHREAD) $(LIBRT) +LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG) $(LIBFROG) LLDFLAGS = -static-libtool-libs default: depend $(LTCOMMAND) diff --git a/db/Makefile b/db/Makefile index 8111bf154..6caa63481 100644 --- a/db/Makefile +++ b/db/Makefile @@ -17,8 +17,8 @@ HFILES = addr.h agf.h agfl.h agi.h attr.h attrshort.h bit.h block.h bmap.h \ CFILES = $(HFILES:.h=.c) btdump.c LSRCFILES = xfs_admin.sh xfs_ncheck.sh xfs_metadump.sh -LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) -LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG) +LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBFROG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) +LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG) $(LIBFROG) LLDFLAGS += -static-libtool-libs ifeq ($(ENABLE_READLINE),yes) diff --git a/growfs/Makefile b/growfs/Makefile index 19616def1..f0190e4b7 100644 --- a/growfs/Makefile +++ b/growfs/Makefile @@ -9,7 +9,7 @@ LTCOMMAND = xfs_growfs CFILES = xfs_growfs.c -LLDLIBS = $(LIBXFS) $(LIBXCMD) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) +LLDLIBS = $(LIBXFS) $(LIBXCMD) $(LIBFROG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) ifeq ($(ENABLE_READLINE),yes) LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP) endif @@ -18,7 +18,7 @@ ifeq ($(ENABLE_EDITLINE),yes) LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP) endif -LTDEPENDENCIES = $(LIBXFS) $(LIBXCMD) +LTDEPENDENCIES = $(LIBXFS) $(LIBXCMD) $(LIBFROG) LLDFLAGS = -static-libtool-libs LSRCFILES = xfs_info.sh diff --git a/io/Makefile b/io/Makefile index 58ae29803..aa0ab7de7 100644 --- a/io/Makefile +++ b/io/Makefile @@ -14,8 +14,8 @@ CFILES = init.c \ pwrite.c reflink.c scrub.c seek.c shutdown.c stat.c sync.c truncate.c \ utimes.c -LLDLIBS = $(LIBXCMD) $(LIBHANDLE) $(LIBPTHREAD) -LTDEPENDENCIES = $(LIBXCMD) $(LIBHANDLE) +LLDLIBS = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG) $(LIBPTHREAD) +LTDEPENDENCIES = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG) LLDFLAGS = -static-libtool-libs ifeq ($(HAVE_FADVISE),yes) diff --git a/libfrog/Makefile b/libfrog/Makefile index 6d9ed076a..6034da567 100644 --- a/libfrog/Makefile +++ b/libfrog/Makefile @@ -11,6 +11,8 @@ LT_REVISION = 0 LT_AGE = 0 CFILES = \ +list_sort.c \ +radix-tree.c \ util.c default: ltdepend $(LTLIBRARY) diff --git a/libxfs/list_sort.c b/libfrog/list_sort.c similarity index 98% rename from libxfs/list_sort.c rename to libfrog/list_sort.c index 16258d936..b77eece5a 100644 --- a/libxfs/list_sort.c +++ b/libfrog/list_sort.c @@ -1,10 +1,9 @@ /* List sorting code from Linux::lib/list_sort.c. */ - -#include "libxfs_priv.h" -#include "libxfs_io.h" -#include "init.h" +#include +#include #include "list.h" +#define unlikely(x) (x) #define MAX_LIST_LENGTH_BITS 20 /* diff --git a/libxfs/radix-tree.c b/libfrog/radix-tree.c similarity index 97% rename from libxfs/radix-tree.c rename to libfrog/radix-tree.c index 3f0257fe5..9fe5dd95b 100644 --- a/libxfs/radix-tree.c +++ b/libfrog/radix-tree.c @@ -17,9 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - +#include +#include +#include +#include #include "platform_defs.h" -#include "xfs.h" #include "radix-tree.h" #ifndef ARRAY_SIZE @@ -57,9 +59,9 @@ static unsigned long height_to_maxindex[RADIX_TREE_MAX_PATH]; * Radix tree node cache. */ -#define radix_tree_node_alloc(r) ((struct radix_tree_node *) \ +#define radix_tree_node_alloc(r) ((struct radix_tree_node *) \ calloc(1, sizeof(struct radix_tree_node))) -#define radix_tree_node_free(n) free(n) +#define radix_tree_node_free(n) free(n) #ifdef RADIX_TREE_TAGS @@ -72,8 +74,8 @@ static inline void tag_set(struct radix_tree_node *node, unsigned int tag, static inline void tag_clear(struct radix_tree_node *node, unsigned int tag, int offset) { - uint32_t *p = (uint32_t*)node->tags[tag] + (offset >> 5); - uint32_t m = 1 << (offset & 31); + uint32_t *p = (uint32_t*)node->tags[tag] + (offset >> 5); + uint32_t m = 1 << (offset & 31); *p &= ~m; } @@ -327,7 +329,7 @@ void *radix_tree_lookup_first(struct radix_tree_root *root, unsigned long *index * radix_tree_tag_set - set a tag on a radix tree node * @root: radix tree root * @index: index key - * @tag: tag index + * @tag: tag index * * Set the search tag (which must be < RADIX_TREE_MAX_TAGS) * corresponding to @index in the radix tree. From @@ -368,7 +370,7 @@ void *radix_tree_tag_set(struct radix_tree_root *root, * radix_tree_tag_clear - clear a tag on a radix tree node * @root: radix tree root * @index: index key - * @tag: tag index + * @tag: tag index * * Clear the search tag (which must be < RADIX_TREE_MAX_TAGS) * corresponding to @index in the radix tree. If @@ -774,10 +776,10 @@ out: */ int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag) { - struct radix_tree_node *rnode; - rnode = root->rnode; - if (!rnode) - return 0; + struct radix_tree_node *rnode; + rnode = root->rnode; + if (!rnode) + return 0; return any_tag_set(rnode, tag); } #endif diff --git a/libxfs/Makefile b/libxfs/Makefile index 994b1e567..0470f5f60 100644 --- a/libxfs/Makefile +++ b/libxfs/Makefile @@ -58,9 +58,7 @@ CFILES = cache.c \ defer_item.c \ init.c \ kmem.c \ - list_sort.c \ logitem.c \ - radix-tree.c \ rdwr.c \ trans.c \ util.c \ diff --git a/logprint/Makefile b/logprint/Makefile index 534bf5b7c..7fbbc98cb 100644 --- a/logprint/Makefile +++ b/logprint/Makefile @@ -12,8 +12,8 @@ CFILES = logprint.c \ log_copy.c log_dump.c log_misc.c \ log_print_all.c log_print_trans.c log_redo.c -LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) -LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG) +LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBFROG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) +LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG) $(LIBFROG) LLDFLAGS = -static-libtool-libs default: depend $(LTCOMMAND) diff --git a/mdrestore/Makefile b/mdrestore/Makefile index 517130635..136ae716d 100644 --- a/mdrestore/Makefile +++ b/mdrestore/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/include/builddefs LTCOMMAND = xfs_mdrestore CFILES = xfs_mdrestore.c -LLDLIBS = $(LIBXFS) $(LIBRT) $(LIBPTHREAD) $(LIBUUID) -LTDEPENDENCIES = $(LIBXFS) +LLDLIBS = $(LIBXFS) $(LIBFROG) $(LIBRT) $(LIBPTHREAD) $(LIBUUID) +LTDEPENDENCIES = $(LIBXFS) $(LIBFROG) LLDFLAGS = -static default: depend $(LTCOMMAND) -- 2.47.2