static int __init load_deferred_module_init(void)
{
	printk("start deferred_module_init\n");
	do_deferred_initcalls();
	printk("endof deferred_module_init\n");
	return 0;
}
Beispiel #2
0
static ssize_t deferred_initcalls_read_proc(struct file *file, char __user *buf,
					   size_t nbytes, loff_t *ppos)
{
	static int deferred_initcalls_done = 0;
	int len, ret;
	char tmp[3] = "1\n";

	if (*ppos >= 3)
		return 0;

	if ((! deferred_initcalls_done) && ! (*ppos)) {
		tmp[0] = '0';
		do_deferred_initcalls();
		deferred_initcalls_done = 1;
	}

	len = min(nbytes, (size_t)3);
	ret = copy_to_user(buf, tmp, len);
	if (ret)
		return -EFAULT;
	*ppos += len;
	return len;
}