]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libfrog: move crc32c code out of libxfs
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 1 Aug 2018 22:06:35 +0000 (17:06 -0500)
committerEric Sandeen <sandeen@redhat.com>
Wed, 1 Aug 2018 22:06:35 +0000 (17:06 -0500)
crc32c code isn't part of the kernel libxfs, nor should it be part of
xfsprogs libxfs.  Put it in libfrog since it's runtime support anyway.

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>
.gitignore
include/crc32c.h [new file with mode: 0644]
libfrog/Makefile
libfrog/crc32.c [moved from libxfs/crc32.c with 100% similarity]
libfrog/crc32defs.h [moved from libxfs/crc32defs.h with 100% similarity]
libfrog/gen_crc32table.c [moved from libxfs/gen_crc32table.c with 100% similarity]
libxfs/Makefile
libxfs/libxfs_priv.h

index 9d92eafff877dc4b3ad356a503907d440440bc25..fd131b6fde52a5a756461901105f506b6cc2885a 100644 (file)
@@ -76,6 +76,6 @@ cscope.*
 /scrub/xfs_scrub_fail@.service
 
 # generated crc files
-/libxfs/crc32selftest
-/libxfs/crc32table.h
-/libxfs/gen_crc32table
+/libfrog/crc32selftest
+/libfrog/crc32table.h
+/libfrog/gen_crc32table
diff --git a/include/crc32c.h b/include/crc32c.h
new file mode 100644 (file)
index 0000000..b4d8aa0
--- /dev/null
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
+ */
+#ifndef LIBFROG_CRC32C_H_
+#define LIBFROG_CRC32C_H_
+
+extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);
+
+#endif /* LIBFROG_CRC32C_H_ */
index d5a82434f567b2d3d43a44b078433b7bd278da1e..707666e1d7df8c85f9b98a1269bb36c1848b6a30 100644 (file)
@@ -13,6 +13,7 @@ LT_AGE = 0
 CFILES = \
 avl64.c \
 convert.c \
+crc32.c \
 fsgeom.c \
 list_sort.c \
 paths.c \
@@ -23,6 +24,12 @@ topology.c \
 util.c \
 workqueue.c
 
+HFILES = \
+crc32defs.h \
+crc32table.h
+
+LSRCFILES += gen_crc32table.c
+
 CFILES += $(PKG_PLATFORM).c
 PCFILES = darwin.c freebsd.c irix.c linux.c
 LSRCFILES = $(shell echo $(PCFILES) | sed -e "s/$(PKG_PLATFORM).c//g")
@@ -35,7 +42,25 @@ ifeq ($(HAVE_GETMNTINFO),yes)
 LCFLAGS += -DHAVE_GETMNTINFO
 endif
 
-default: ltdepend $(LTLIBRARY)
+LDIRT = gen_crc32table crc32table.h crc32selftest
+
+default: crc32selftest ltdepend $(LTLIBRARY)
+
+crc32table.h: gen_crc32table.c crc32defs.h
+       @echo "    [CC]     gen_crc32table"
+       $(Q) $(BUILD_CC) $(BUILD_CFLAGS) -o gen_crc32table $<
+       @echo "    [GENERATE] $@"
+       $(Q) ./gen_crc32table > crc32table.h
+
+# The selftest binary will return an error if it fails. This is made a
+# dependency of the build process so that we refuse to build the tools on broken
+# systems/architectures. Hence we make sure that xfsprogs will never use a
+# busted CRC calculation at build time and hence avoid putting bad CRCs down on
+# disk.
+crc32selftest: gen_crc32table.c crc32table.h crc32.c crc32defs.h
+       @echo "    [TEST]    CRC32"
+       $(Q) $(BUILD_CC) $(BUILD_CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
+       $(Q) ./$@
 
 include $(BUILDRULES)
 
similarity index 100%
rename from libxfs/crc32.c
rename to libfrog/crc32.c
similarity index 100%
rename from libxfs/crc32defs.h
rename to libfrog/crc32defs.h
index 89c6abf045121aec2fb725d087edfe79f3dee955..160498d72ab84ecab6784053e5d5cb137c739a4d 100644 (file)
@@ -48,13 +48,10 @@ HFILES = \
        libxfs_io.h \
        libxfs_api_defs.h \
        init.h \
-       crc32defs.h \
-       crc32table.h \
        libxfs_priv.h \
        xfs_dir2_priv.h
 
 CFILES = cache.c \
-       crc32.c \
        defer_item.c \
        init.c \
        kmem.c \
@@ -99,8 +96,6 @@ CFILES = cache.c \
        xfs_trans_resv.c \
        xfs_types.c
 
-LSRCFILES += gen_crc32table.c
-
 #
 # Tracing flags:
 # -DIO_DEBUG           reads and writes of buffers
@@ -117,25 +112,7 @@ LTLIBS = $(LIBPTHREAD) $(LIBRT)
 # don't try linking xfs_repair with a debug libxfs.
 DEBUG = -DNDEBUG
 
-LDIRT = gen_crc32table crc32table.h crc32selftest
-
-default: crc32selftest ltdepend $(LTLIBRARY)
-
-crc32table.h: gen_crc32table.c crc32defs.h
-       @echo "    [CC]     gen_crc32table"
-       $(Q) $(BUILD_CC) $(BUILD_CFLAGS) -o gen_crc32table $<
-       @echo "    [GENERATE] $@"
-       $(Q) ./gen_crc32table > crc32table.h
-
-# The selftest binary will return an error if it fails. This is made a
-# dependency of the build process so that we refuse to build the tools on broken
-# systems/architectures. Hence we make sure that xfsprogs will never use a
-# busted CRC calculation at build time and hence avoid putting bad CRCs down on
-# disk.
-crc32selftest: gen_crc32table.c crc32table.h crc32.c crc32defs.h
-       @echo "    [TEST]    CRC32"
-       $(Q) $(BUILD_CC) $(BUILD_CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
-       $(Q) ./$@
+default: ltdepend $(LTLIBRARY)
 
 # set up include/xfs header directory
 include $(BUILDRULES)
index d6081b74a0ade8b220468be18163f0bf4dd70ba9..2f2ca06f1bb18a4712b95975cd24b7c40755852d 100644 (file)
@@ -53,9 +53,9 @@
 #include "xfs_arch.h"
 
 #include "xfs_fs.h"
+#include "crc32c.h"
 
 /* CRC stuff, buffer API dependent on it */
-extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);
 #define crc32c(c,p,l)  crc32c_le((c),(unsigned char const *)(p),(l))
 
 #include "xfs_cksum.h"