示例#1
0
static int __init imq_init_devs(void)
{
	int err, i;

	if (numdevs < 1 || numdevs > IMQ_MAX_DEVS) {
		printk(KERN_ERR "IMQ: numdevs has to be betweed 1 and %u\n",
		       IMQ_MAX_DEVS);
		return -EINVAL;
	}

	if (numqueues < 1 || numqueues > IMQ_MAX_QUEUES) {
		printk(KERN_ERR "IMQ: numqueues has to be betweed 1 and %u\n",
		       IMQ_MAX_QUEUES);
		return -EINVAL;
	}

	get_random_bytes(&imq_hashrnd, sizeof(imq_hashrnd));

	rtnl_lock();
	err = __rtnl_link_register(&imq_link_ops);

	for (i = 0; i < numdevs && !err; i++)
		err = imq_init_one(i);

	if (err) {
		__rtnl_link_unregister(&imq_link_ops);
		memset(imq_devs_cache, 0, sizeof(imq_devs_cache));
	}
	rtnl_unlock();

	return err;
}
static int __init ifb_init_module(void)
{
	int i, err;

	rtnl_lock();
	err = __rtnl_link_register(&ifb_link_ops);

	for (i = 0; i < numifbs && !err; i++)
		err = ifb_init_one(i);
	if (err)
		__rtnl_link_unregister(&ifb_link_ops);
	rtnl_unlock();

	return err;
}
示例#3
0
文件: dummy.c 项目: 274914765/C
static int __init dummy_init_module(void)
{
    int i, err = 0;

    rtnl_lock();
    err = __rtnl_link_register(&dummy_link_ops);

    for (i = 0; i < numdummies && !err; i++)
        err = dummy_init_one();
    if (err < 0)
        __rtnl_link_unregister(&dummy_link_ops);
    rtnl_unlock();

    return err;
}
示例#4
0
static int __init vNet_init(void)
{
	int err = 0;

	printk("\n");
	
	rtnl_lock();
	err = __rtnl_link_register(&vNet_link_ops);
	if (err < 0)	
		goto out;
	
	rtnl_unlock();
out:
	rtnl_unlock();

	return err;
}
示例#5
0
static int __init ifb_init_module(void)
{
	int i, err;

	rtnl_lock();
	err = __rtnl_link_register(&ifb_link_ops);
	if (err < 0)
		goto out;

	for (i = 0; i < numifbs && !err; i++) {
		err = ifb_init_one(i);
		cond_resched();
	}
	if (err)
		__rtnl_link_unregister(&ifb_link_ops);

out:
	rtnl_unlock();

	return err;
}