Defining a Chain
The elements of the notification chain's list are of type
notifier_block, whose definition is the following:
struct notifier_block
{
int (*notifier_call)(struct notifier_block *self, unsigned long, void *);
struct notifier_block *next;
int priority;
};notifier_call is the function to execute, next is used to link together the elements of the list, and
priority represents the priority of the function.
Functions with higher priority are executed first. But in practice, almost all
registrations leave the priority out of the notifier_block definition, which means it gets the default
value of 0 and execution order ends up depending only on the registration order (i.e., it
is a semirandom order). The return values of notifier_call are listed in the upcoming section, "Notifying Events on a Chain."
Common names for notifier_block instances are
xxx
_chain, xxx
_notifier_chain, and xxx
_notifier_list.
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