10 #include <linux/kernel.h>
11 #include <linux/module.h>
18 #define DICT_MAX (1 << 20)
21 #define DEVICE_NAME "xz_dec_test"
24 static int device_major;
30 static bool device_is_open;
46 static uint8_t buffer_out[1024];
52 static struct xz_buf buffers = {
55 .out_size =
sizeof(buffer_out)
64 static int xz_dec_test_open(
struct inode *
i,
struct file *
f)
69 device_is_open =
true;
83 static int xz_dec_test_release(
struct inode *i,
struct file *f)
85 device_is_open =
false;
110 "garbage at the end of the file\n",
124 buffers.
in_size =
min(remaining,
sizeof(buffer_in));
144 "CRC32 = 0x%08X\n", ~crc);
145 return size - remaining - (buffers.
in_size - buffers.
in_pos);
176 static int __init xz_dec_test_init(
void)
180 .open = &xz_dec_test_open,
181 .release = &xz_dec_test_release,
182 .write = &xz_dec_test_write
189 device_major = register_chrdev(0,
DEVICE_NAME, &fileops);
190 if (device_major < 0) {
197 "'mknod " DEVICE_NAME
" c %d 0' and write .xz files "
198 "to it.\n", device_major);
202 static void __exit xz_dec_test_exit(
void)