Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: livepatch: Add livepatch API page

The livepatch subsystem has several exported functions and objects with
kerneldoc comments. Though the livepatch documentation contains handwritten
descriptions of all of these exported functions, they are currently not
pulled into the docs build using the kernel-doc directive.

In order to allow readers of the documentation to see the full kerneldoc
comments in the generated documentation files, this change adds a new
Documentation/livepatch/api.rst page which contains kernel-doc directives
to link the kerneldoc comments directly in the documentation. With this,
all of the hand-written descriptions of the APIs now cross-reference the
kerneldoc comments on the new Livepatching APIs page, and running
./scripts/find-unused-docs.sh on kernel/livepatch no longer shows any files
as missing documentation.

Note that all of the handwritten API descriptions were left alone with the
exception of Documentation/livepatch/system-state.rst, which was updated to
allow the cross-referencing to work correctly. The file now follows the
cross-referencing formatting guidance specified in
Documentation/doc-guide/kernel-doc.rst. Furthermore, some comments around
klp_shadow_free_all() were updated to say <_, id> rather than <*, id> to
match the rest of the file, and to prevent the docs build from emitting an
"Inline emphasis start-string without end string" error.

Signed-off-by: David Vernet <void@manifault.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Acked-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20211221145743.4098360-1-void@manifault.com

authored by

David Vernet and committed by
Petr Mladek
e368cd72 50ddcdb2

+38 -7
+30
Documentation/livepatch/api.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ================= 4 + Livepatching APIs 5 + ================= 6 + 7 + Livepatch Enablement 8 + ==================== 9 + 10 + .. kernel-doc:: kernel/livepatch/core.c 11 + :export: 12 + 13 + 14 + Shadow Variables 15 + ================ 16 + 17 + .. kernel-doc:: kernel/livepatch/shadow.c 18 + :export: 19 + 20 + System State Changes 21 + ==================== 22 + 23 + .. kernel-doc:: kernel/livepatch/state.c 24 + :export: 25 + 26 + Object Types 27 + ============ 28 + 29 + .. kernel-doc:: include/linux/livepatch.h 30 + :identifiers: klp_patch klp_object klp_func klp_callbacks klp_state
+1
Documentation/livepatch/index.rst
··· 14 14 shadow-vars 15 15 system-state 16 16 reliable-stacktrace 17 + api 17 18 18 19 .. only:: subproject and html 19 20
+2 -2
Documentation/livepatch/shadow-vars.rst
··· 82 82 - call destructor function if defined 83 83 - free shadow variable 84 84 85 - * klp_shadow_free_all() - detach and free all <*, id> shadow variables 86 - - find and remove any <*, id> references from global hashtable 85 + * klp_shadow_free_all() - detach and free all <_, id> shadow variables 86 + - find and remove any <_, id> references from global hashtable 87 87 88 88 - if found 89 89
+2 -2
Documentation/livepatch/system-state.rst
··· 52 52 53 53 The state can be manipulated using two functions: 54 54 55 - - *klp_get_state(patch, id)* 55 + - klp_get_state() 56 56 57 57 - Get struct klp_state associated with the given livepatch 58 58 and state id. 59 59 60 - - *klp_get_prev_state(id)* 60 + - klp_get_prev_state() 61 61 62 62 - Get struct klp_state associated with the given feature id and 63 63 already installed livepatches.
+3 -3
kernel/livepatch/shadow.c
··· 272 272 EXPORT_SYMBOL_GPL(klp_shadow_free); 273 273 274 274 /** 275 - * klp_shadow_free_all() - detach and free all <*, id> shadow variables 275 + * klp_shadow_free_all() - detach and free all <_, id> shadow variables 276 276 * @id: data identifier 277 277 * @dtor: custom callback that can be used to unregister the variable 278 278 * and/or free data that the shadow variable points to (optional) 279 279 * 280 - * This function releases the memory for all <*, id> shadow variable 280 + * This function releases the memory for all <_, id> shadow variable 281 281 * instances, callers should stop referencing them accordingly. 282 282 */ 283 283 void klp_shadow_free_all(unsigned long id, klp_shadow_dtor_t dtor) ··· 288 288 289 289 spin_lock_irqsave(&klp_shadow_lock, flags); 290 290 291 - /* Delete all <*, id> from hash */ 291 + /* Delete all <_, id> from hash */ 292 292 hash_for_each(klp_shadow_hash, i, shadow, node) { 293 293 if (klp_shadow_match(shadow, shadow->obj, id)) 294 294 klp_shadow_free_struct(shadow, dtor);