Registering with a Chain
When a kernel component is interested in the events of a given notification chain, it
can register it with the general function notifier_chain_register. The kernel also provides a set of wrappers around
notifier_chain_register, some of which are shown in
Table 4-1.
Table 4-1 lists the main APIs and
the associated wrappers used to register and unregister to the three chains inetaddr_chain
, inet6addr_chain
, and netdev_chain.
Table 4-1. Main functions and wrappers for a few chains
|
Operation |
Function prototype | |
|---|---|---|
|
Registration |
| |
|
Wrappers | ||
|
|
| |
|
|
| |
|
|
| |
|
Unregistration |
| |
|
Wrappers | ||
|
|
| |
|
|
| |
|
|
| |
|
Notification |
| |
For each chain, the notifier_block instances are
inserted into a list, which is sorted by priority. Elements with the same priority are
sorted based on insertion time: new ones go to the tail.
Accesses to the notification chains are protected by the notifier_lock lock. The use of a single lock for all the notification chains is not ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access