Module Name:    src
Committed By:   pgoyette
Date:           Sun Jun  3 01:50:28 UTC 2018

Modified Files:
        src/share/man/man9: module.9

Log Message:
Add documentation on the module_{,un}register_callbacks() routines.

XXX Still need to document the module_specificdata_* stuff, which
XXX needs to refer to a non-existent specificdata(9) man page!


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/share/man/man9/module.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/module.9
diff -u src/share/man/man9/module.9:1.43 src/share/man/man9/module.9:1.44
--- src/share/man/man9/module.9:1.43	Mon May 28 22:22:54 2018
+++ src/share/man/man9/module.9	Sun Jun  3 01:50:28 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: module.9,v 1.43 2018/05/28 22:22:54 pgoyette Exp $
+.\"	$NetBSD: module.9,v 1.44 2018/06/03 01:50:28 pgoyette Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 29, 2018
+.Dd June 3, 2018
 .Dt MODULE 9
 .Os
 .Sh NAME
@@ -75,6 +75,11 @@
 .Fn module_builtin_require_force "void"
 .Ft void
 .Fn module_load_vfs_init "void"
+.Ft "void *"
+.Fn module_register_callbacks "void (*)(struct module *)" \
+"void (*unload)(struct module *)"
+.Ft void
+.Fn module_unregister_callbacks "void *"
 .Sh DESCRIPTION
 Modules are sections of code that can be independently linked and selectively
 loaded into or unloaded from a running kernel.
@@ -443,14 +448,35 @@ is specified.
 is called near the end of system initialization, after the
 .Xr init 8
 process is created.
-.It Fn module_load_vfs_init
+.It Fn module_load_vfs_init "void"
 The module subsystem is initialized early, long before any file systems
 are available.
 After the root file system is mounted,
-.Fn module_load_vfs_init
+.Fn module_load_vfs_init "void"
 is used to enable loading modules from the file system.
 Until this routine is called, modules can only be loaded if they were
 built-in to the kernel image or provided by the boot loader.
+.It Fn module_register_callbacks "void (*load)(struct module *)" \
+"void (*unload)(struct module *)"
+Register a new set of callbacks.
+The
+.Fa load
+callback is invoked after any module (including this module) is
+successfully loaded; the
+.Fa unload
+callback is invoked before any module is unloaded.
+Each load or unload event can result in multiple invocations of the
+callback routines.
+An opaque cookie is returned which can be passed to
+.Fn module_unregister_callbacks .
+.It Fn module_unregister_callbacks "void *opaque"
+Unregister a set of callback routines previously registered with
+.Fn module_register_callbacks .
+The
+.Fa opaque
+argument should be the return value from the previous
+.Fn module_register_callbacks
+call.
 .El
 .Sh PROGRAMMING CONSIDERATIONS
 The module subsystem is designed to be called recursively, but only within

Reply via email to