summaryrefslogtreecommitdiff
path: root/net/ncsi/ncsi.c
blob: c84939ecca8d33cdeac29613a31c354a42d284a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Copyright Gavin Shan, IBM Corporation 2015.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>

#include <net/ncsi.h>
#include <net/net_namespace.h>
#include <net/sock.h>

#include "internal.h"

struct net *ncsi_net = NULL;

static int __net_init ncsi_net_init(struct net *net)
{
	ncsi_net = net;
	return ncsi_netlink_init(net);
}

static void __net_exit ncsi_net_exit(struct net *net)
{
	ncsi_netlink_exit(net);
	ncsi_net = NULL;
}

static struct pernet_operations ncsi_net_ops = {
	.init = ncsi_net_init,
	.exit = ncsi_net_exit,
};

static int __init ncsi_init(void)
{
	if (ncsi_net)
		return -EEXIST;

	return register_pernet_subsys(&ncsi_net_ops);
}

fs_initcall_sync(ncsi_init);