diff options
Diffstat (limited to 'meta-filesystems/recipes-utils/xfsprogs/files')
4 files changed, 55 insertions, 468 deletions
diff --git a/meta-filesystems/recipes-utils/xfsprogs/files/drop-configure-check-for-aio.patch b/meta-filesystems/recipes-utils/xfsprogs/files/drop-configure-check-for-aio.patch deleted file mode 100644 index 760109506..000000000 --- a/meta-filesystems/recipes-utils/xfsprogs/files/drop-configure-check-for-aio.patch +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | xfsprogs: drop configure check for aio | ||
2 | |||
3 | It's unused and breaks compilation with uclibc. | ||
4 | |||
5 | Upstream-Status: Pending | ||
6 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
7 | --- | ||
8 | configure.ac | 6 +++--- | ||
9 | m4/Makefile | 1 - | ||
10 | m4/package_aiodev.m4 | 36 ------------------------------------ | ||
11 | 3 files changed, 3 insertions(+), 40 deletions(-) | ||
12 | |||
13 | diff --git a/configure.ac b/configure.ac | ||
14 | index b968977..4e2a263 100644 | ||
15 | --- a/configure.ac | ||
16 | +++ b/configure.ac | ||
17 | @@ -47,6 +47,9 @@ AC_ARG_ENABLE(lib64, | ||
18 | enable_lib64=yes) | ||
19 | AC_SUBST(enable_lib64) | ||
20 | |||
21 | +librt="-lrt" | ||
22 | +AC_SUBST(librt) | ||
23 | + | ||
24 | # | ||
25 | # If the user specified a libdir ending in lib64 do not append another | ||
26 | # 64 to the library names. | ||
27 | @@ -92,9 +95,6 @@ AC_PACKAGE_GLOBALS(xfsprogs) | ||
28 | AC_PACKAGE_UTILITIES(xfsprogs) | ||
29 | AC_MULTILIB($enable_lib64) | ||
30 | |||
31 | -AC_PACKAGE_NEED_AIO_H | ||
32 | -AC_PACKAGE_NEED_LIO_LISTIO | ||
33 | - | ||
34 | AC_PACKAGE_NEED_UUID_H | ||
35 | AC_PACKAGE_NEED_UUIDCOMPARE | ||
36 | |||
37 | diff --git a/m4/Makefile b/m4/Makefile | ||
38 | index 654a4fb..d282f0a 100644 | ||
39 | --- a/m4/Makefile | ||
40 | +++ b/m4/Makefile | ||
41 | @@ -14,7 +14,6 @@ CONFIGURE = \ | ||
42 | |||
43 | LSRCFILES = \ | ||
44 | manual_format.m4 \ | ||
45 | - package_aiodev.m4 \ | ||
46 | package_blkid.m4 \ | ||
47 | package_globals.m4 \ | ||
48 | package_libcdev.m4 \ | ||
49 | diff --git a/m4/package_aiodev.m4 b/m4/package_aiodev.m4 | ||
50 | index 490d9c8..8b13789 100644 | ||
51 | --- a/m4/package_aiodev.m4 | ||
52 | +++ b/m4/package_aiodev.m4 | ||
53 | @@ -1,37 +1 @@ | ||
54 | -# | ||
55 | -# Check if we have a libaio.h installed | ||
56 | -# | ||
57 | -AC_DEFUN([AC_PACKAGE_WANT_AIO], | ||
58 | - [ AC_CHECK_HEADERS(libaio.h, [ have_aio=true ], [ have_aio=false ]) | ||
59 | - AC_SUBST(have_aio) | ||
60 | - ]) | ||
61 | - | ||
62 | -# | ||
63 | -# Check if we have an aio.h installed | ||
64 | -# | ||
65 | -AC_DEFUN([AC_PACKAGE_NEED_AIO_H], | ||
66 | - [ AC_CHECK_HEADERS(aio.h) | ||
67 | - if test $ac_cv_header_aio_h = no; then | ||
68 | - echo | ||
69 | - echo 'FATAL ERROR: could not find a valid <aio.h> header.' | ||
70 | - exit 1 | ||
71 | - fi | ||
72 | - ]) | ||
73 | - | ||
74 | -# | ||
75 | -# Check if we have the lio_listio routine in either libc/librt | ||
76 | -# | ||
77 | -AC_DEFUN([AC_PACKAGE_NEED_LIO_LISTIO], | ||
78 | - [ AC_CHECK_FUNCS(lio_listio) | ||
79 | - if test $ac_cv_func_lio_listio = yes; then | ||
80 | - librt="" | ||
81 | - else | ||
82 | - AC_CHECK_LIB(rt, lio_listio,, [ | ||
83 | - echo | ||
84 | - echo 'FATAL ERROR: could not find a library with lio_listio.' | ||
85 | - exit 1],[-lpthread]) | ||
86 | - librt="-lrt" | ||
87 | - fi | ||
88 | - AC_SUBST(librt) | ||
89 | - ]) | ||
90 | |||
91 | -- | ||
92 | 1.8.1.2 | ||
93 | |||
diff --git a/meta-filesystems/recipes-utils/xfsprogs/files/link_needed_libs.patch b/meta-filesystems/recipes-utils/xfsprogs/files/link_needed_libs.patch new file mode 100644 index 000000000..18b95c1c3 --- /dev/null +++ b/meta-filesystems/recipes-utils/xfsprogs/files/link_needed_libs.patch | |||
@@ -0,0 +1,55 @@ | |||
1 | Index: xfsprogs-4.8.0/libxcmd/Makefile | ||
2 | =================================================================== | ||
3 | --- xfsprogs-4.8.0.orig/libxcmd/Makefile | ||
4 | +++ xfsprogs-4.8.0/libxcmd/Makefile | ||
5 | @@ -30,10 +30,21 @@ LCFLAGS += -DENABLE_EDITLINE | ||
6 | LTLIBS += $(LIBEDITLINE) $(LIBTERMCAP) | ||
7 | endif | ||
8 | |||
9 | +ifeq ($(ENABLE_BLKID),yes) | ||
10 | +LCFLAGS += -DENABLE_BLKID | ||
11 | +LTLIBS += $(LIBBLKID) | ||
12 | +endif | ||
13 | + | ||
14 | +LTLIBS += $(LIBXFS) | ||
15 | + | ||
16 | default: ltdepend $(LTLIBRARY) | ||
17 | |||
18 | include $(BUILDRULES) | ||
19 | |||
20 | -install install-dev: default | ||
21 | +install: default | ||
22 | + $(INSTALL_LTLIB) | ||
23 | + | ||
24 | +install-dev: default | ||
25 | + $(INSTALL_LTLIB_DEV) | ||
26 | |||
27 | -include .ltdep | ||
28 | Index: xfsprogs-4.8.0/libxfs/Makefile | ||
29 | =================================================================== | ||
30 | --- xfsprogs-4.8.0.orig/libxfs/Makefile | ||
31 | +++ xfsprogs-4.8.0/libxfs/Makefile | ||
32 | @@ -137,6 +137,7 @@ include $(BUILDRULES) | ||
33 | |||
34 | install: default | ||
35 | $(INSTALL) -m 755 -d $(PKG_INC_DIR) | ||
36 | + $(INSTALL_LTLIB) | ||
37 | |||
38 | install-headers: $(addsuffix -hdrs, $(PKGHFILES)) | ||
39 | |||
40 | Index: xfsprogs-4.8.0/libxlog/Makefile | ||
41 | =================================================================== | ||
42 | --- xfsprogs-4.8.0.orig/libxlog/Makefile | ||
43 | +++ xfsprogs-4.8.0/libxlog/Makefile | ||
44 | @@ -19,6 +19,10 @@ default: ltdepend $(LTLIBRARY) | ||
45 | |||
46 | include $(BUILDRULES) | ||
47 | |||
48 | -install install-dev: default | ||
49 | +install: default | ||
50 | + $(INSTALL_LTLIB) | ||
51 | + | ||
52 | +install-dev: default | ||
53 | + $(INSTALL_LTLIB_DEV) | ||
54 | |||
55 | -include .ltdep | ||
diff --git a/meta-filesystems/recipes-utils/xfsprogs/files/remove-install-as-user.patch b/meta-filesystems/recipes-utils/xfsprogs/files/remove-install-as-user.patch deleted file mode 100644 index e761db371..000000000 --- a/meta-filesystems/recipes-utils/xfsprogs/files/remove-install-as-user.patch +++ /dev/null | |||
@@ -1,205 +0,0 @@ | |||
1 | remove install as user | ||
2 | |||
3 | Upstream-Status: Inappropriate [configuration] | ||
4 | |||
5 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
6 | --- | ||
7 | include/buildmacros | 2 +- | ||
8 | include/install-sh | 95 ++++++++--------------------------------------------- | ||
9 | 2 files changed, 14 insertions(+), 83 deletions(-) | ||
10 | |||
11 | diff --git a/include/buildmacros b/include/buildmacros | ||
12 | index 7a01880..0840d55 100644 | ||
13 | --- a/include/buildmacros | ||
14 | +++ b/include/buildmacros | ||
15 | @@ -30,7 +30,7 @@ OBJECTS = $(ASFILES:.s=.o) \ | ||
16 | $(LFILES:.l=.o) \ | ||
17 | $(YFILES:%.y=%.tab.o) | ||
18 | |||
19 | -INSTALL = $(TOPDIR)/install-sh -o $(PKG_USER) -g $(PKG_GROUP) | ||
20 | +INSTALL = $(TOPDIR)/install-sh | ||
21 | |||
22 | IMAGES_DIR = $(TOPDIR)/all-images | ||
23 | DIST_DIR = $(TOPDIR)/dist | ||
24 | diff --git a/include/install-sh b/include/install-sh | ||
25 | index c952a71..b9d66f7 100755 | ||
26 | --- a/include/install-sh | ||
27 | +++ b/include/install-sh | ||
28 | @@ -24,11 +24,11 @@ | ||
29 | # set set | yes yes | ||
30 | # | ||
31 | _usage() { | ||
32 | - echo "Usage: $prog [-o owner] [-g group] [-m mode] -d directory" | ||
33 | - echo "or $prog [-D] [-o owner] [-g group] [-m mode] file directory/file" | ||
34 | - echo "or $prog [-o owner] [-g group] [-m mode] file [file ...] directory" | ||
35 | + echo "Usage: $prog [-m mode] -d directory" | ||
36 | + echo "or $prog [-m mode] file directory/file" | ||
37 | + echo "or $prog [-m mode] file [file ...] directory" | ||
38 | echo "or $prog -S file target (creates \"target\" symlink)" | ||
39 | - echo "or $prog -T lt_arg [-o owner] [-g group] [-m mode] libtool.lai directory" | ||
40 | + echo "or $prog -T lt_arg [-m mode] libtool.lai directory" | ||
41 | echo "" | ||
42 | echo "The \$DIST_MANIFEST and \$DIST_ROOT environment variables affect the" | ||
43 | echo "behaviour of this command - see comments in the script." | ||
44 | @@ -38,32 +38,6 @@ _usage() { | ||
45 | exit 1 | ||
46 | } | ||
47 | |||
48 | -_chown () | ||
49 | -{ | ||
50 | - _st=255 | ||
51 | - if [ $# -eq 3 ] ; then | ||
52 | - chown $1:$2 $3 | ||
53 | - _st=$? | ||
54 | - if [ $_st -ne 0 ] ; then | ||
55 | - if [ $REAL_UID != '0' ] ; then | ||
56 | - if [ ! -f $DIST_ROOT/.chown.quiet ] ; then | ||
57 | - echo '===============================================' | ||
58 | - echo Ownership of files under ${DIST_ROOT:-/} | ||
59 | - echo cannot be changed | ||
60 | - echo '===============================================' | ||
61 | - if [ -n "$DIST_ROOT" ] ; then | ||
62 | - touch $DIST_ROOT/.chown.quiet | ||
63 | - fi | ||
64 | - fi | ||
65 | - _st=0 | ||
66 | - fi | ||
67 | - fi | ||
68 | - fi | ||
69 | - | ||
70 | - return $_st | ||
71 | -} | ||
72 | - | ||
73 | - | ||
74 | _manifest () | ||
75 | { | ||
76 | echo $* | sed -e 's/\/\//\//g' >>${DIST_MANIFEST:-/dev/null} | ||
77 | @@ -77,9 +51,6 @@ Sflag=false | ||
78 | Tflag=false | ||
79 | DIRMODE=755 | ||
80 | FILEMODE=644 | ||
81 | -OWNER=`id -u` | ||
82 | -GROUP=`id -g` | ||
83 | -REAL_UID=$OWNER | ||
84 | |||
85 | # default is to install and don't append manifest | ||
86 | INSTALL=true | ||
87 | @@ -94,24 +65,16 @@ MANIFEST=: | ||
88 | |||
89 | if $INSTALL | ||
90 | then | ||
91 | - CP=cp; LN=ln; MKDIR=mkdir; CHMOD=chmod; CHOWN=_chown | ||
92 | + CP=cp; LN=ln; MKDIR=mkdir; CHMOD=chmod; | ||
93 | else | ||
94 | - CP=true; LN=true; MKDIR=true; CHMOD=true; CHOWN=true | ||
95 | + CP=true; LN=true; MKDIR=true; CHMOD=true; | ||
96 | fi | ||
97 | |||
98 | -[ -n "$DIST_ROOT" -a $REAL_UID -ne 0 ] && CHOWN=true | ||
99 | - | ||
100 | -while getopts "Dcm:d:S:o:g:T:" c $* | ||
101 | +while getopts "Dcm:d:S:T:" c $* | ||
102 | do | ||
103 | case $c in | ||
104 | c) | ||
105 | ;; | ||
106 | - g) | ||
107 | - GROUP=$OPTARG | ||
108 | - ;; | ||
109 | - o) | ||
110 | - OWNER=$OPTARG | ||
111 | - ;; | ||
112 | m) | ||
113 | DIRMODE=`expr $OPTARG` | ||
114 | FILEMODE=$DIRMODE | ||
115 | @@ -146,18 +109,7 @@ then | ||
116 | # first usage | ||
117 | # | ||
118 | $MKDIR -p $dir | ||
119 | - status=$? | ||
120 | - if [ $status -eq 0 ] | ||
121 | - then | ||
122 | - $CHMOD $DIRMODE $dir | ||
123 | - status=$? | ||
124 | - fi | ||
125 | - if [ $status -eq 0 ] | ||
126 | - then | ||
127 | - $CHOWN $OWNER $GROUP $dir | ||
128 | - status=$? | ||
129 | - fi | ||
130 | - $MANIFEST d $DIRMODE $OWNER $GROUP ${dir#$DIST_ROOT} | ||
131 | + $MANIFEST d $DIRMODE ${dir#$DIST_ROOT} | ||
132 | elif $Sflag | ||
133 | then | ||
134 | # | ||
135 | @@ -203,7 +155,7 @@ then | ||
136 | install_name=$target/$solib | ||
137 | $CP $solib $install_name | ||
138 | status=$? | ||
139 | - $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$solib ${install_name#$DIST_ROOT} | ||
140 | + $MANIFEST f $FILEMODE $HERE/$solib ${install_name#$DIST_ROOT} | ||
141 | break | ||
142 | fi | ||
143 | done | ||
144 | @@ -254,7 +206,7 @@ then | ||
145 | install_name=$target/$old_library | ||
146 | $CP $old_library $install_name | ||
147 | status=$? | ||
148 | - $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$old_library ${install_name#$DIST_ROOT} | ||
149 | + $MANIFEST f $FILEMODE $HERE/$old_library ${install_name#$DIST_ROOT} | ||
150 | ;; | ||
151 | *) | ||
152 | echo "$prog: -T $lt_install invalid" | ||
153 | @@ -267,7 +219,6 @@ then | ||
154 | if [ $status -eq 0 ] | ||
155 | then | ||
156 | $CHMOD $FILEMODE $install_name | ||
157 | - $CHOWN $OWNER $GROUP $install_name | ||
158 | fi | ||
159 | ;; | ||
160 | esac | ||
161 | @@ -292,23 +243,10 @@ else | ||
162 | then | ||
163 | if [ -f $dir/$f ] | ||
164 | then | ||
165 | - $CHMOD $FILEMODE $dir/$f | ||
166 | - status=$? | ||
167 | - if [ $status -eq 0 ] | ||
168 | - then | ||
169 | - $CHOWN $OWNER $GROUP $dir/$f | ||
170 | - status=$? | ||
171 | - fi | ||
172 | - $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$f ${dir#$DIST_ROOT}/$f | ||
173 | + $MANIFEST f $FILEMODE $HERE/$f ${dir#$DIST_ROOT}/$f | ||
174 | else | ||
175 | $CHMOD $FILEMODE $dir | ||
176 | - status=$? | ||
177 | - if [ $status -eq 0 ] | ||
178 | - then | ||
179 | - $CHOWN $OWNER $GROUP $dir | ||
180 | - status=$? | ||
181 | - fi | ||
182 | - $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$dir ${dir#$DIST_ROOT} | ||
183 | + $MANIFEST f $FILEMODE $HERE/$dir ${dir#$DIST_ROOT} | ||
184 | fi | ||
185 | fi | ||
186 | else | ||
187 | @@ -334,14 +272,7 @@ else | ||
188 | status=$? | ||
189 | if [ $status -eq 0 ] | ||
190 | then | ||
191 | - $CHMOD $FILEMODE $dir/$f | ||
192 | - status=$? | ||
193 | - if [ $status -eq 0 ] | ||
194 | - then | ||
195 | - $CHOWN $OWNER $GROUP $dir/$f | ||
196 | - status=$? | ||
197 | - fi | ||
198 | - $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$f ${dir#$DIST_ROOT}/$f | ||
199 | + $MANIFEST f $FILEMODE $HERE/$f ${dir#$DIST_ROOT}/$f | ||
200 | fi | ||
201 | [ $status -ne 0 ] && break | ||
202 | done | ||
203 | -- | ||
204 | 1.8.1.2 | ||
205 | |||
diff --git a/meta-filesystems/recipes-utils/xfsprogs/files/xfsprogs-generate-crctable-which-is-moved-into-runti.patch b/meta-filesystems/recipes-utils/xfsprogs/files/xfsprogs-generate-crctable-which-is-moved-into-runti.patch deleted file mode 100644 index b204195bf..000000000 --- a/meta-filesystems/recipes-utils/xfsprogs/files/xfsprogs-generate-crctable-which-is-moved-into-runti.patch +++ /dev/null | |||
@@ -1,170 +0,0 @@ | |||
1 | From e58cb210a7c15352040a411d11a8383eac0defda Mon Sep 17 00:00:00 2001 | ||
2 | From: Jianchuan Wang <jianchuan.wang@windriver.com> | ||
3 | Date: Tue, 30 Sep 2014 12:16:17 +0800 | ||
4 | Subject: [PATCH] xfsprogs: generate crctable which is moved into runtime from | ||
5 | compile | ||
6 | |||
7 | After upgraded, There is a compile error except x86, | ||
8 | Because crc32.c need two arraies crc32table_le and crc32ctable_le from crc32table.h, | ||
9 | which are generated by gen_crc32table.c relative to different platforms. | ||
10 | For this, move the function implementation from gen_crc32table.c to crc.c | ||
11 | |||
12 | Upstream-Status: Pending | ||
13 | |||
14 | Signed-off-by: Jianchuan Wang <jianchuan.wang@windriver.com> | ||
15 | --- | ||
16 | libxfs/Makefile | 23 ++---------------- | ||
17 | libxfs/crc32.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- | ||
18 | 2 files changed, 75 insertions(+), 23 deletions(-) | ||
19 | |||
20 | diff --git a/libxfs/Makefile b/libxfs/Makefile | ||
21 | index ae15a5d..7670159 100644 | ||
22 | --- a/libxfs/Makefile | ||
23 | +++ b/libxfs/Makefile | ||
24 | @@ -10,7 +10,7 @@ LT_CURRENT = 0 | ||
25 | LT_REVISION = 0 | ||
26 | LT_AGE = 0 | ||
27 | |||
28 | -HFILES = xfs.h init.h xfs_dir2_priv.h crc32defs.h crc32table.h | ||
29 | +HFILES = xfs.h init.h xfs_dir2_priv.h crc32defs.h | ||
30 | CFILES = cache.c \ | ||
31 | crc32.c \ | ||
32 | init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ | ||
33 | @@ -43,7 +43,6 @@ CFILES = cache.c \ | ||
34 | CFILES += $(PKG_PLATFORM).c | ||
35 | PCFILES = darwin.c freebsd.c irix.c linux.c | ||
36 | LSRCFILES = $(shell echo $(PCFILES) | sed -e "s/$(PKG_PLATFORM).c//g") | ||
37 | -LSRCFILES += gen_crc32table.c | ||
38 | |||
39 | # | ||
40 | # Tracing flags: | ||
41 | @@ -61,25 +60,7 @@ LTLIBS = $(LIBPTHREAD) $(LIBRT) | ||
42 | # don't try linking xfs_repair with a debug libxfs. | ||
43 | DEBUG = -DNDEBUG | ||
44 | |||
45 | -LDIRT = gen_crc32table crc32table.h crc32selftest | ||
46 | - | ||
47 | -default: crc32selftest ltdepend $(LTLIBRARY) | ||
48 | - | ||
49 | -crc32table.h: gen_crc32table.c | ||
50 | - @echo " [CC] gen_crc32table" | ||
51 | - $(Q) $(CC) $(CFLAGS) -o gen_crc32table $< | ||
52 | - @echo " [GENERATE] $@" | ||
53 | - $(Q) ./gen_crc32table > crc32table.h | ||
54 | - | ||
55 | -# The selftest binary will return an error if it fails. This is made a | ||
56 | -# dependency of the build process so that we refuse to build the tools on broken | ||
57 | -# systems/architectures. Hence we make sure that xfsprogs will never use a | ||
58 | -# busted CRC calculation at build time and hence avoid putting bad CRCs down on | ||
59 | -# disk. | ||
60 | -crc32selftest: gen_crc32table.c crc32table.h crc32.c | ||
61 | - @echo " [TEST] CRC32" | ||
62 | - $(Q) $(CC) $(CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@ | ||
63 | - $(Q) ./$@ | ||
64 | +default: ltdepend $(LTLIBRARY) | ||
65 | |||
66 | include $(BUILDRULES) | ||
67 | |||
68 | diff --git a/libxfs/crc32.c b/libxfs/crc32.c | ||
69 | index 0f847d2..be5fbc3 100644 | ||
70 | --- a/libxfs/crc32.c | ||
71 | +++ b/libxfs/crc32.c | ||
72 | @@ -55,8 +55,6 @@ typedef __u32 u64; | ||
73 | # define tobe(x) (x) | ||
74 | #endif | ||
75 | |||
76 | -#include "crc32table.h" | ||
77 | - | ||
78 | #if CRC_LE_BITS > 8 || CRC_BE_BITS > 8 | ||
79 | |||
80 | /* implements slicing-by-4 or slicing-by-8 algorithm */ | ||
81 | @@ -183,13 +181,86 @@ u32 __pure crc32c_le(u32 crc, unsigned char const *p, size_t len) | ||
82 | return crc32_le_generic(crc, p, len, NULL, CRC32C_POLY_LE); | ||
83 | } | ||
84 | #else | ||
85 | + | ||
86 | +#include <stdio.h> | ||
87 | +#include "crc32defs.h" | ||
88 | +#include <inttypes.h> | ||
89 | + | ||
90 | +#define ENTRIES_PER_LINE 4 | ||
91 | + | ||
92 | +#if CRC_LE_BITS > 8 | ||
93 | +# define LE_TABLE_ROWS (CRC_LE_BITS/8) | ||
94 | +# define LE_TABLE_SIZE 256 | ||
95 | +#else | ||
96 | +# define LE_TABLE_ROWS 1 | ||
97 | +# define LE_TABLE_SIZE (1 << CRC_LE_BITS) | ||
98 | +#endif | ||
99 | + | ||
100 | +#if CRC_BE_BITS > 8 | ||
101 | +# define BE_TABLE_ROWS (CRC_BE_BITS/8) | ||
102 | +# define BE_TABLE_SIZE 256 | ||
103 | +#else | ||
104 | +# define BE_TABLE_ROWS 1 | ||
105 | +# define BE_TABLE_SIZE (1 << CRC_BE_BITS) | ||
106 | +#endif | ||
107 | + | ||
108 | +static uint32_t crc32table_le[LE_TABLE_ROWS][256]; | ||
109 | +static uint32_t crc32ctable_le[LE_TABLE_ROWS][256]; | ||
110 | + | ||
111 | +static uint32_t crc32table_le_init = 0; | ||
112 | +static uint32_t crc32ctable_le_init = 0; | ||
113 | + | ||
114 | +/* | ||
115 | + * big endian ordered CRC not used by XFS. | ||
116 | +static uint32_t crc32table_be[BE_TABLE_ROWS][256]; | ||
117 | + */ | ||
118 | + | ||
119 | +/** | ||
120 | + * crc32init_le() - allocate and initialize LE table data | ||
121 | + * | ||
122 | + * crc is the crc of the byte i; other entries are filled in based on the | ||
123 | + * fact that crctable[i^j] = crctable[i] ^ crctable[j]. | ||
124 | + * | ||
125 | + */ | ||
126 | +static void crc32init_le_generic(const uint32_t polynomial, | ||
127 | + uint32_t (*tab)[256]) | ||
128 | +{ | ||
129 | + unsigned i, j; | ||
130 | + uint32_t crc = 1; | ||
131 | + | ||
132 | + tab[0][0] = 0; | ||
133 | + | ||
134 | + for (i = LE_TABLE_SIZE >> 1; i; i >>= 1) { | ||
135 | + crc = (crc >> 1) ^ ((crc & 1) ? polynomial : 0); | ||
136 | + for (j = 0; j < LE_TABLE_SIZE; j += 2 * i) | ||
137 | + tab[0][i + j] = crc ^ tab[0][j]; | ||
138 | + } | ||
139 | + for (i = 0; i < LE_TABLE_SIZE; i++) { | ||
140 | + crc = tab[0][i]; | ||
141 | + for (j = 1; j < LE_TABLE_ROWS; j++) { | ||
142 | + crc = tab[0][crc & 0xff] ^ (crc >> 8); | ||
143 | + tab[j][i] = crc; | ||
144 | + } | ||
145 | + } | ||
146 | +} | ||
147 | + | ||
148 | u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) | ||
149 | { | ||
150 | + if (crc32table_le_init == 0) { | ||
151 | + crc32init_le_generic(CRCPOLY_LE, crc32table_le); | ||
152 | + crc32table_le_init == 1; | ||
153 | + } | ||
154 | + | ||
155 | return crc32_le_generic(crc, p, len, | ||
156 | (const u32 (*)[256])crc32table_le, CRCPOLY_LE); | ||
157 | } | ||
158 | u32 __pure crc32c_le(u32 crc, unsigned char const *p, size_t len) | ||
159 | { | ||
160 | + if (crc32ctable_le_init == 0) { | ||
161 | + crc32init_le_generic(CRC32C_POLY_LE, crc32ctable_le); | ||
162 | + crc32ctable_le_init == 1; | ||
163 | + } | ||
164 | + | ||
165 | return crc32_le_generic(crc, p, len, | ||
166 | (const u32 (*)[256])crc32ctable_le, CRC32C_POLY_LE); | ||
167 | } | ||
168 | -- | ||
169 | 1.9.1 | ||
170 | |||