Linux 2.6.19-rc6
[cris-mirror.git] / net / core / netevent.c
blob35d02c38554e06b9b80fc86ef457698ff94d0aaf
1 /*
2 * Network event notifiers
4 * Authors:
5 * Tom Tucker <tom@opengridcomputing.com>
6 * Steve Wise <swise@opengridcomputing.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
13 * Fixes:
16 #include <linux/rtnetlink.h>
17 #include <linux/notifier.h>
19 static ATOMIC_NOTIFIER_HEAD(netevent_notif_chain);
21 /**
22 * register_netevent_notifier - register a netevent notifier block
23 * @nb: notifier
25 * Register a notifier to be called when a netevent occurs.
26 * The notifier passed is linked into the kernel structures and must
27 * not be reused until it has been unregistered. A negative errno code
28 * is returned on a failure.
30 int register_netevent_notifier(struct notifier_block *nb)
32 int err;
34 err = atomic_notifier_chain_register(&netevent_notif_chain, nb);
35 return err;
38 /**
39 * netevent_unregister_notifier - unregister a netevent notifier block
40 * @nb: notifier
42 * Unregister a notifier previously registered by
43 * register_neigh_notifier(). The notifier is unlinked into the
44 * kernel structures and may then be reused. A negative errno code
45 * is returned on a failure.
48 int unregister_netevent_notifier(struct notifier_block *nb)
50 return atomic_notifier_chain_unregister(&netevent_notif_chain, nb);
53 /**
54 * call_netevent_notifiers - call all netevent notifier blocks
55 * @val: value passed unmodified to notifier function
56 * @v: pointer passed unmodified to notifier function
58 * Call all neighbour notifier blocks. Parameters and return value
59 * are as for notifier_call_chain().
62 int call_netevent_notifiers(unsigned long val, void *v)
64 return atomic_notifier_call_chain(&netevent_notif_chain, val, v);
67 EXPORT_SYMBOL_GPL(register_netevent_notifier);
68 EXPORT_SYMBOL_GPL(unregister_netevent_notifier);
69 EXPORT_SYMBOL_GPL(call_netevent_notifiers);