aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-07-17 09:43:08 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-07-17 09:43:08 +0300
commit2d40ed7b415bcb6a358c9f221160c4a419f01f19 (patch)
tree15b61ca8fe52d9b472074910704c60f89c25f9d5
parent74149643b934e2294e7878fbd2f180835f250e41 (diff)
libs: make crc32 and fec to be libraries
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--include/crc32.h13
-rw-r--r--lib/Makefile6
-rw-r--r--lib/libcrc32.c (renamed from lib/crc32.c)11
-rw-r--r--lib/libfec.c (renamed from lib/fec.c)0
-rw-r--r--mkfs.ubifs/Makefile2
5 files changed, 16 insertions, 16 deletions
diff --git a/include/crc32.h b/include/crc32.h
index 4b51177..affa303 100644
--- a/include/crc32.h
+++ b/include/crc32.h
@@ -7,16 +7,7 @@
#include <stdint.h>
-extern const uint32_t crc32_table[256];
-
-/* Return a 32-bit CRC of the contents of the buffer. */
-static inline uint32_t crc32(uint32_t val, const void *ss, int len)
-{
- const unsigned char *s = ss;
-
- while (--len >= 0)
- val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
- return val;
-}
+/* Return a 32-bit CRC of the contents of the buffer */
+extern uint32_t crc32(uint32_t val, const void *ss, int len);
#endif /* __CRC32_H__ */
diff --git a/lib/Makefile b/lib/Makefile
index 82194e4..621ed63 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -6,13 +6,13 @@ SUBDIRS =
# CFLAGS += -Werror
CPPFLAGS += -I../include
-LIBS = libmtd
-TARGETS = libmtd.a
+LIBS = libmtd libcrc32
+TARGETS = libmtd.a libcrc32.a
include ../common.mk
$(BUILDDIR)/libmtd.a: $(addprefix $(BUILDDIR)/,\
- libmtd.o libmtd_legacy.o crc32.o fec.o)
+ libmtd.o libmtd_legacy.o libcrc32.o libfec.o)
clean::
rm -f $(addsuffix .a, $(LIBS))
diff --git a/lib/crc32.c b/lib/libcrc32.c
index 6b1e50c..d556e91 100644
--- a/lib/crc32.c
+++ b/lib/libcrc32.c
@@ -39,7 +39,7 @@
#include <stdint.h>
-const uint32_t crc32_table[256] = {
+const static uint32_t crc32_table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
@@ -93,3 +93,12 @@ const uint32_t crc32_table[256] = {
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
0x2d02ef8dL
};
+
+uint32_t crc32(uint32_t val, const void *ss, int len)
+{
+ const unsigned char *s = ss;
+
+ while (--len >= 0)
+ val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
+ return val;
+}
diff --git a/lib/fec.c b/lib/libfec.c
index 6d9020f..6d9020f 100644
--- a/lib/fec.c
+++ b/lib/libfec.c
diff --git a/mkfs.ubifs/Makefile b/mkfs.ubifs/Makefile
index ba21a8c..499f9e5 100644
--- a/mkfs.ubifs/Makefile
+++ b/mkfs.ubifs/Makefile
@@ -7,7 +7,7 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch]
TARGETS = mkfs.ubifs
LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
-LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd
+LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd -lcrc32
LDLIBS_mkfs.ubifs += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
include ../common.mk