]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libfrog: move list_sort out of libxfs
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 6 Dec 2017 15:17:07 +0000 (09:17 -0600)
committerEric Sandeen <sandeen@redhat.com>
Wed, 6 Dec 2017 15:17:07 +0000 (09:17 -0600)
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 <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Makefile
copy/Makefile
db/Makefile
growfs/Makefile
io/Makefile
libfrog/Makefile
libfrog/list_sort.c [moved from libxfs/list_sort.c with 98% similarity]
libfrog/radix-tree.c [moved from libxfs/radix-tree.c with 97% similarity]
libxfs/Makefile
logprint/Makefile
mdrestore/Makefile

index 4146473e2526c2ede4aa3cd0b72957847c613bc6..0dce80ae68e283fb10cc133b7b406871052121b7 100644 (file)
--- 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
index e630b17eb0298ceee8b20f7d3d43c2d3c1560073..f86f2d7f13d488619dace1075e666df33108ca1f 100644 (file)
@@ -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)
index 8111bf154554790d32da039e300d2b47bd20c01b..6caa6348188fa4eeaf557217a85a80bdfd191b09 100644 (file)
@@ -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)
index 19616def15729c8ba2354e289a856ed028d1b038..f0190e4b75a04e33f5e1dca4a8cc304cf0909584 100644 (file)
@@ -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
 
index 58ae2980381860e83169d2534f2aa9e8e985fcce..aa0ab7de7c0dcf2bb45a4014c3626e01f9c3dc99 100644 (file)
@@ -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)
index 6d9ed076a91860e231207580e7e85ffa651f6ac5..6034da5676394abdbb0659d175975137b396b74a 100644 (file)
@@ -11,6 +11,8 @@ LT_REVISION = 0
 LT_AGE = 0
 
 CFILES = \
+list_sort.c \
+radix-tree.c \
 util.c
 
 default: ltdepend $(LTLIBRARY)
similarity index 98%
rename from libxfs/list_sort.c
rename to libfrog/list_sort.c
index 16258d93606b7a7ae7e28e71aaa87d853cb65246..b77eece5a229b601039609364edd61a089b0ee95 100644 (file)
@@ -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 <stdlib.h>
+#include <string.h>
 #include "list.h"
 
+#define unlikely(x)    (x)
 #define MAX_LIST_LENGTH_BITS 20
 
 /*
similarity index 97%
rename from libxfs/radix-tree.c
rename to libfrog/radix-tree.c
index 3f0257fe5209d40494917f9f59f72d37c072f600..9fe5dd95b8e36cc7dca34b03708f5ac3cbaf7835 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <stdint.h>
 #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
index 994b1e56750db341ea708c4620727550fa42fec3..0470f5f6074a5a9e6c33bad56269afb3dff6f7b8 100644 (file)
@@ -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 \
index 534bf5b7c8f61ad7d7db72b5981e24739bd7b123..7fbbc98cb7e18dec73762d3bd425ce2f5d209b37 100644 (file)
@@ -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)
index 5171306356ba9e3ffbb682b0187abaaadb92c871..136ae716d691c007f4c7609bf59e9771861370b1 100644 (file)
@@ -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)