lib/xz/xz_dec_test.c

Source file repositories/reference/linux-study-clean/lib/xz/xz_dec_test.c

File Facts

System
Linux kernel
Corpus path
lib/xz/xz_dec_test.c
Extension
.c
Size
5072 bytes
Lines
215
Domain
Kernel Services
Bucket
lib
Inferred role
Kernel Services: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.

Dependency Surface

Detected Declarations

Annotated Snippet

static const struct file_operations fileops = {
		.owner = THIS_MODULE,
		.open = &xz_dec_test_open,
		.release = &xz_dec_test_release,
		.write = &xz_dec_test_write
	};

	state = xz_dec_init(XZ_PREALLOC, DICT_MAX);
	if (state == NULL)
		return -ENOMEM;

	device_major = register_chrdev(0, DEVICE_NAME, &fileops);
	if (device_major < 0) {
		xz_dec_end(state);
		return device_major;
	}

	printk(KERN_INFO DEVICE_NAME ": module loaded\n");
	printk(KERN_INFO DEVICE_NAME ": Create a device node with "
			"'mknod " DEVICE_NAME " c %d 0' and write .xz files "
			"to it.\n", device_major);
	return 0;
}

static void __exit xz_dec_test_exit(void)
{
	unregister_chrdev(device_major, DEVICE_NAME);
	xz_dec_end(state);
	printk(KERN_INFO DEVICE_NAME ": module unloaded\n");
}

module_init(xz_dec_test_init);
module_exit(xz_dec_test_exit);

MODULE_DESCRIPTION("XZ decompressor tester");
MODULE_VERSION("1.0");
MODULE_AUTHOR("Lasse Collin <lasse.collin@tukaani.org>");
MODULE_LICENSE("Dual BSD/GPL");

Annotation

Implementation Notes