diff options
author | Karel Zak | 2016-10-19 13:33:15 +0200 |
---|---|---|
committer | Karel Zak | 2016-10-19 13:33:15 +0200 |
commit | 2687686cf467210ce8051a1e25ea0b7032442c53 (patch) | |
tree | 9adde77d1fc7d2412358160c6cb78d1304dc0b4c /disk-utils/fsck.cramfs.c | |
parent | cramfs: add missing includes (diff) | |
download | kernel-qcow2-util-linux-2687686cf467210ce8051a1e25ea0b7032442c53.tar.gz kernel-qcow2-util-linux-2687686cf467210ce8051a1e25ea0b7032442c53.tar.xz kernel-qcow2-util-linux-2687686cf467210ce8051a1e25ea0b7032442c53.zip |
cramfs: revert crc32 changes
We cannot use our crc32 without changes in the code, because our
ul_crc32() assumes that post-conditioning (xor) is done by
application. The zlib implementation does everything.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/fsck.cramfs.c')
-rw-r--r-- | disk-utils/fsck.cramfs.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/disk-utils/fsck.cramfs.c b/disk-utils/fsck.cramfs.c index 173ac9b4a..915c0c93c 100644 --- a/disk-utils/fsck.cramfs.c +++ b/disk-utils/fsck.cramfs.c @@ -44,6 +44,12 @@ #include <getopt.h> #include <utime.h> #include <fcntl.h> + +/* We don't use our include/crc32.h, but crc32 from zlib! + * + * The zlib implemenation performs pre/post-conditioning. The util-linux + * imlemenation requires post-conditioning (xor) in the applications. + */ #include <zlib.h> #include <sys/types.h> @@ -53,7 +59,6 @@ #include "c.h" #include "cramfs.h" #include "nls.h" -#include "crc32.h" #include "blkdev.h" #include "exitcodes.h" #include "strutils.h" @@ -215,7 +220,7 @@ static void test_crc(int start) return; } - crc = ul_crc32(0L, Z_NULL, 0); + crc = crc32(0L, Z_NULL, 0); buf = mmap(NULL, super.size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); @@ -232,8 +237,8 @@ static void test_crc(int start) } if (buf != MAP_FAILED) { ((struct cramfs_super *)((unsigned char *) buf + start))->fsid.crc = - ul_crc32(0L, Z_NULL, 0); - crc = ul_crc32(crc, (unsigned char *) buf + start, super.size - start); + crc32(0L, Z_NULL, 0); + crc = crc32(crc, (unsigned char *) buf + start, super.size - start); munmap(buf, super.size); } else { int retval; @@ -250,15 +255,15 @@ static void test_crc(int start) break; if (length == 0) ((struct cramfs_super *)buf)->fsid.crc = - ul_crc32(0L, Z_NULL, 0); + crc32(0L, Z_NULL, 0); length += retval; if (length > (super.size - start)) { - crc = ul_crc32(crc, buf, + crc = crc32(crc, buf, retval - (length - (super.size - start))); break; } - crc = ul_crc32(crc, buf, retval); + crc = crc32(crc, buf, retval); } free(buf); } |