[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5-1000-10527-1242938044-3360@rere.qmqm.pl>
Date: Thu, 21 May 2009 22:34:05 +0200 (CEST)
From: Michał Mirosław
<mirq-linux@...e.qmqm.pl>
To: netdev@...r.kernel.org
Cc: tipc-discussion@...ts.sourceforge.net
Subject: [PATCH 5/6 2.6.30-rc6] tipc: Use genl_register_family_with_ops()
Use genl_register_family_with_ops() instead of a copy. This also changes
netlink related variable names to be kernel-wide unique for consistency
with other users.
Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
diff -urN linux-orig-mqbr/net/tipc/netlink.c linux-mqbr/net/tipc/netlink.c
--- linux-orig-mqbr/net/tipc/netlink.c 2009-03-24 00:12:14.000000000 +0100
+++ linux-mqbr/net/tipc/netlink.c 2009-05-21 18:04:46.000000000 +0200
@@ -68,7 +68,7 @@
return 0;
}
-static struct genl_family family = {
+static struct genl_family tipc_genl_family = {
.id = GENL_ID_GENERATE,
.name = TIPC_GENL_NAME,
.version = TIPC_GENL_VERSION,
@@ -76,39 +76,33 @@
.maxattr = 0,
};
-static struct genl_ops ops = {
+static struct genl_ops tipc_genl_ops = {
.cmd = TIPC_GENL_CMD,
.doit = handle_cmd,
};
-static int family_registered = 0;
+static int tipc_genl_family_registered;
int tipc_netlink_start(void)
{
+ int res;
+ res = genl_register_family_with_ops(&tipc_genl_family,
+ &tipc_genl_ops, 1);
+ if (res) {
+ err("Failed to register netlink interface\n");
+ return res;
+ }
- if (genl_register_family(&family))
- goto err;
-
- family_registered = 1;
-
- if (genl_register_ops(&family, &ops))
- goto err_unregister;
-
+ tipc_genl_family_registered = 1;
return 0;
-
- err_unregister:
- genl_unregister_family(&family);
- family_registered = 0;
- err:
- err("Failed to register netlink interface\n");
- return -EFAULT;
}
void tipc_netlink_stop(void)
{
- if (family_registered) {
- genl_unregister_family(&family);
- family_registered = 0;
- }
+ if (!tipc_genl_family_registered)
+ return;
+
+ genl_unregister_family(&tipc_genl_family);
+ tipc_genl_family_registered = 0;
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists