Пример #1
0
/*
 * Function vlan_proto_init (pro)
 *
 *    Initialize VLAN protocol layer,
 *
 */
static int __init vlan_proto_init(void)
{
	int err;

	printk(VLAN_INF "%s v%s\n",
	       vlan_fullname, vlan_version);

	/* proc file system initialization */
	err = vlan_proc_init();
	if (err < 0) {
		printk(KERN_ERR
		       "%s: can't create entry in proc filesystem!\n",
		       __FUNCTION__);
		return err;
	}

	dev_add_pack(&vlan_packet_type);

	/* Register us to receive netdevice events */
	err = register_netdevice_notifier(&vlan_notifier_block);
	if (err < 0) {
		dev_remove_pack(&vlan_packet_type);
		vlan_proc_cleanup();
		return err;
	}

	vlan_ioctl_set(vlan_ioctl_handler);

	return 0;
}
/*
 *     Module 'remove' entry point.
 *     o delete /proc/net/router directory and static entries.
 */ 
static void __exit vlan_cleanup_module(void)
{
	int i;

	/* This table must be empty if there are no module
	 * references left.
	 */
	for (i = 0; i < VLAN_GRP_HASH_SIZE; i++) {
		if (vlan_group_hash[i] != NULL)
			BUG();
	}

	/* Un-register us from receiving netdevice events */
	unregister_netdevice_notifier(&vlan_notifier_block);

#ifdef CONFIG_VLAN_8021Q_FAST
	vlan_rx_hook = NULL;
	vlan_tx_hook = NULL;
#else
	dev_remove_pack(&vlan_packet_type);
#endif

	vlan_proc_cleanup();
	vlan_ioctl_hook = NULL;
}
Пример #3
0
int __init vlan_proc_init(void)
{
	proc_vlan_dir = proc_mkdir(name_root, proc_net);
	if (proc_vlan_dir) {
		proc_vlan_conf = create_proc_entry(name_conf,
						   S_IFREG|S_IRUSR|S_IWUSR,
						   proc_vlan_dir);
		if (proc_vlan_conf) {
			proc_vlan_conf->proc_fops = &vlan_fops;
			return 0;
		}
	}
	vlan_proc_cleanup();
	return -ENOBUFS;
}
Пример #4
0
int __net_init vlan_proc_init(struct net *net)
{
	struct vlan_net *vn = net_generic(net, vlan_net_id);

	vn->proc_vlan_dir = proc_net_mkdir(net, name_root, net->proc_net);
	if (!vn->proc_vlan_dir)
		goto err;

	vn->proc_vlan_conf = proc_create(name_conf, S_IFREG|S_IRUSR|S_IWUSR,
				     vn->proc_vlan_dir, &vlan_fops);
	if (!vn->proc_vlan_conf)
		goto err;
	return 0;

err:
	pr_err("%s: can't create entry in proc filesystem!\n", __func__);
	vlan_proc_cleanup(net);
	return -ENOBUFS;
}
Пример #5
0
/*
 *     Module 'remove' entry point.
 *     o delete /proc/net/router directory and static entries.
 */
static void __exit vlan_cleanup_module(void)
{
	int i;

	vlan_ioctl_set(NULL);

	/* Un-register us from receiving netdevice events */
	unregister_netdevice_notifier(&vlan_notifier_block);

	dev_remove_pack(&vlan_packet_type);
	vlan_cleanup_devices();

	/* This table must be empty if there are no module
	 * references left.
	 */
	for (i = 0; i < VLAN_GRP_HASH_SIZE; i++) {
		BUG_ON(!hlist_empty(&vlan_group_hash[i]));
	}
	vlan_proc_cleanup();

	synchronize_net();
}
Пример #6
0
static void __net_exit vlan_exit_net(struct net *net)
{
	vlan_proc_cleanup(net);
}