Manual browser: callback_unregister(9)
|CALLBACK(9)||Kernel Developer's Manual||CALLBACK(9)|
NAMEcallback — generic callback interface
callback_head_init(struct callback_head *ch, int ipl);
callback_head_destroy(struct callback_head *ch);
callback_register(struct callback_head *ch, struct callback_entry *ce, void *obj, int (*fn)(struct callback_entry *, void *, void *));
callback_unregister(struct callback_head *ch, struct callback_entry *ce);
callback_run_roundrobin(struct callback_head *ch, void *arg);
DESCRIPTIONThe generic callback interface allows lower-level layer code to execute a registered function, or set of functions, from the higher-level layer.
Registered functions must return one of these constants:
- Indicates that the function call was successful. The following functions in the chain will be called.
- Indicates a failure case in the function call. Any following functions in the chain will not be executed.
FUNCTIONSThe callback structure callback_head should be initialized and destroyed using the functions described below. This structure contains the list of callback entries and other internal data.
The callback_entry structure is an entry, normally associated with the higher-level object. It contains the internal data of the callback interface.
- callback_head_init(ch, ipl)
- Initialize the callback structure specified by ch. The highest IPL at which this callback can be used is specified by ipl.
- Destroy the callback structure specified by ch. The caller must unregister all functions before destroying the callback structure.
- callback_register(ch, ce, obj, fn)
- Register the callback function in the callback structure specified by ch. ce should point to the entry structure of the callback object. The callback object itself is specified by obj. The function pointer is specified by fn.
- callback_unregister(ch, ce)
- Unregister the callback function from the structure specified by ch. The entry should be passed as ce. This function may block.
- callback_run_roundrobin(ch, arg)
- Executes all functions registered in the callback structure, specified by ch. The functions are executed in round-robin fashion. The value of arg will be passed to the callback functions.
CODE REFERENCESThe callback interface is implemented within the file sys/kern/subr_callback.c.
|October 28, 2009||NetBSD 7.0|