Skip to content

Commit e368cd7

Browse files
Byte-Labpmladek
authored andcommitted
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 <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Acked-by: Miroslav Benes <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 50ddcdb commit e368cd7

File tree

5 files changed

+38
-7
lines changed

5 files changed

+38
-7
lines changed

Documentation/livepatch/api.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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

Documentation/livepatch/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Kernel Livepatching
1414
shadow-vars
1515
system-state
1616
reliable-stacktrace
17+
api
1718

1819
.. only:: subproject and html
1920

Documentation/livepatch/shadow-vars.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ to do actions that can be done only once when a new variable is allocated.
8282
- call destructor function if defined
8383
- free shadow variable
8484

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
8787

8888
- if found
8989

Documentation/livepatch/system-state.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ struct klp_state:
5252

5353
The state can be manipulated using two functions:
5454

55-
- *klp_get_state(patch, id)*
55+
- klp_get_state()
5656

5757
- Get struct klp_state associated with the given livepatch
5858
and state id.
5959

60-
- *klp_get_prev_state(id)*
60+
- klp_get_prev_state()
6161

6262
- Get struct klp_state associated with the given feature id and
6363
already installed livepatches.

kernel/livepatch/shadow.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,12 @@ void klp_shadow_free(void *obj, unsigned long id, klp_shadow_dtor_t dtor)
272272
EXPORT_SYMBOL_GPL(klp_shadow_free);
273273

274274
/**
275-
* klp_shadow_free_all() - detach and free all <*, id> shadow variables
275+
* klp_shadow_free_all() - detach and free all <_, id> shadow variables
276276
* @id: data identifier
277277
* @dtor: custom callback that can be used to unregister the variable
278278
* and/or free data that the shadow variable points to (optional)
279279
*
280-
* This function releases the memory for all <*, id> shadow variable
280+
* This function releases the memory for all <_, id> shadow variable
281281
* instances, callers should stop referencing them accordingly.
282282
*/
283283
void klp_shadow_free_all(unsigned long id, klp_shadow_dtor_t dtor)
@@ -288,7 +288,7 @@ void klp_shadow_free_all(unsigned long id, klp_shadow_dtor_t dtor)
288288

289289
spin_lock_irqsave(&klp_shadow_lock, flags);
290290

291-
/* Delete all <*, id> from hash */
291+
/* Delete all <_, id> from hash */
292292
hash_for_each(klp_shadow_hash, i, shadow, node) {
293293
if (klp_shadow_match(shadow, shadow->obj, id))
294294
klp_shadow_free_struct(shadow, dtor);

0 commit comments

Comments
 (0)