File: lib.c

package info (click to toggle)
logfs-tools 20121013-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 180 kB
  • ctags: 513
  • sloc: ansic: 2,224; makefile: 91
file content (22 lines) | stat: -rw-r--r-- 507 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "kerncompat.h"
#include "logfs.h"

/*
 * zlib crc32 differs from the kernel variant.  zlib negated both the initial
 * value and the result bitwise.  So for the kernel ~0 is a correct initial
 * value, for zlib 0 is.
 * Better check for such funnies instead of generating bad images.
 */
void check_crc32(void)
{
	u32 c=0;
	if (logfs_crc32(&c, 4, 0) != cpu_to_be32(0xdebb20e3))
		fail("crc32 returns bad results");
}

void fail(const char *s)
{
	printf("mklogfs: %s\n", s);
	exit(EXIT_FAILURE);
}