Esempio n. 1
0
static void __exit
igs_module_exit(void)
{
	sock_release(igs.nl_sk->sk_socket);
	igs_instances_clear();
	OSL_LOCK_DESTROY(igs.lock);

	return;
}
Esempio n. 2
0
/*
 * Description: This function is called during module load time. It
 *              opens communication channel to configure and start EMF.
 */
static int32 __init
emf_module_init(void)
{
	EMF_DEBUG("Loading EMF\n");

	/* Allocate EMF global data object */
	emf = MALLOC(NULL, sizeof(emf_struct_t));
	if (emf == NULL)
	{
		EMF_ERROR("Out of memory allocating emf_info\n");
		return (FAILURE);
	}

	memset(emf, 0, sizeof(emf_struct_t));

	/* Create a Netlink socket in kernel-space */
#define NETLINK_EMFC 17
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
	emf->nl_sk = netlink_kernel_create(NETLINK_EMFC, 0, emf_netlink_sock_cb,
	                                   NULL, THIS_MODULE);
#else
	emf->nl_sk = netlink_kernel_create(NETLINK_EMFC, emf_netlink_sock_cb);
#endif

	if (emf->nl_sk == NULL)
	{
		EMF_ERROR("Netlink kernel socket create failed\n");
		MFREE(NULL, emf, sizeof(emf_struct_t));
		return (FAILURE);
	}

	emf->lock = OSL_LOCK_CREATE("EMF Instance List");

	if (emf->lock == NULL)
	{
		EMF_ERROR("EMF instance list lock create failed\n");
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
		sock_release(emf->nl_sk->sk_socket);
#else
		sock_release(emf->nl_sk->socket);
#endif
		MFREE(NULL, emf, sizeof(emf_struct_t));
		return (FAILURE);
	}

	/* Call the common code global init function */
	if (emfc_module_init() != SUCCESS)
	{
		OSL_LOCK_DESTROY(emf->lock);
		MFREE(NULL, emf, sizeof(emf_struct_t));
		return (FAILURE);
	}

	EMF_DEBUG("EMF Init done\n");

	return (SUCCESS);
}
Esempio n. 3
0
static void __exit
igs_module_exit(void)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
	sock_release(igs.nl_sk->sk_socket);
#else
	sock_release(igs.nl_sk->socket);
#endif
	igs_instances_clear();
	OSL_LOCK_DESTROY(igs.lock);

	return;
}
Esempio n. 4
0
static void __exit
emf_module_exit(void)
{
	/* Call the common code global exit function */
	emfc_module_exit();

	/* Clean up the instances and exit */
	sock_release(emf->nl_sk->sk_socket);
	emf_instances_clear(emf);
	OSL_LOCK_DESTROY(emf->lock);
	MFREE(NULL, emf, sizeof(emf_struct_t));

	return;
}
Esempio n. 5
0
static void __exit
emf_module_exit(void)
{
	/* Call the common code global exit function */
	emfc_module_exit();

	/* Clean up the instances and exit */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
	sock_release(emf->nl_sk->sk_socket);
#else
	sock_release(emf->nl_sk->socket);
#endif
	emf_instances_clear(emf);
	OSL_LOCK_DESTROY(emf->lock);
	MFREE(NULL, emf, sizeof(emf_struct_t));

	return;
}