summaryrefslogtreecommitdiffstats
path: root/disk-utils/mkfs.cramfs.c
diff options
context:
space:
mode:
authorKarel Zak2016-10-19 13:33:15 +0200
committerKarel Zak2016-10-19 13:33:15 +0200
commit2687686cf467210ce8051a1e25ea0b7032442c53 (patch)
tree9adde77d1fc7d2412358160c6cb78d1304dc0b4c /disk-utils/mkfs.cramfs.c
parentcramfs: add missing includes (diff)
downloadkernel-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/mkfs.cramfs.c')
-rw-r--r--disk-utils/mkfs.cramfs.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c
index 098f9afaf..bf7f00838 100644
--- a/disk-utils/mkfs.cramfs.c
+++ b/disk-utils/mkfs.cramfs.c
@@ -36,11 +36,16 @@
#include <string.h>
#include <getopt.h>
#include <zconf.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 "c.h"
#include "cramfs.h"
-#include "crc32.h"
#include "md5.h"
#include "nls.h"
#include "exitcodes.h"
@@ -407,7 +412,7 @@ static unsigned int write_superblock(struct entry *root, char *base, int size)
super->size = size;
memcpy(super->signature, CRAMFS_SIGNATURE, sizeof(super->signature));
- super->fsid.crc = ul_crc32(0L, Z_NULL, 0);
+ super->fsid.crc = crc32(0L, Z_NULL, 0);
super->fsid.edition = opt_edition;
super->fsid.blocks = total_blocks;
super->fsid.files = total_nodes;
@@ -701,7 +706,7 @@ int main(int argc, char **argv)
loff_t fslen_ub = sizeof(struct cramfs_super);
unsigned int fslen_max;
char const *dirname, *outfile;
- uint32_t crc = ul_crc32(0L, Z_NULL, 0);
+ uint32_t crc = crc32(0L, Z_NULL, 0);
int c;
cramfs_is_big_endian = HOST_IS_BIG_ENDIAN; /* default is to use host order */
@@ -857,7 +862,7 @@ int main(int argc, char **argv)
sizeof(struct cramfs_super));
/* Put the checksum in. */
- crc = ul_crc32(crc, (unsigned char *) (rom_image+opt_pad), (offset-opt_pad));
+ crc = crc32(crc, (unsigned char *) (rom_image+opt_pad), (offset-opt_pad));
((struct cramfs_super *) (rom_image+opt_pad))->fsid.crc = u32_toggle_endianness(cramfs_is_big_endian, crc);
if (verbose)
printf(_("CRC: %x\n"), crc);