Skip to content

Commit 4061743

Browse files
committed
docs/core-api/symbol-namespaces: drop table of contents and section numbering
The manually updated table of contents and section numbering are hard to maintain. Make changes similar to the following commits: 5e8f0ba ("docs/kbuild/makefiles: throw out the local table of contents") 1a4c1c9 ("docs/kbuild/makefiles: drop section numbering, use references") Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 9c036cf commit 4061743

File tree

3 files changed

+47
-71
lines changed

3 files changed

+47
-71
lines changed

Documentation/core-api/symbol-namespaces.rst

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,8 @@ The following document describes how to use Symbol Namespaces to structure the
66
export surface of in-kernel symbols exported through the family of
77
EXPORT_SYMBOL() macros.
88

9-
.. Table of Contents
10-
11-
=== 1 Introduction
12-
=== 2 How to define Symbol Namespaces
13-
--- 2.1 Using the EXPORT_SYMBOL macros
14-
--- 2.2 Using the DEFAULT_SYMBOL_NAMESPACE define
15-
=== 3 How to use Symbols exported in Namespaces
16-
=== 4 Loading Modules that use namespaced Symbols
17-
=== 5 Automatically creating MODULE_IMPORT_NS statements
18-
19-
1. Introduction
20-
===============
9+
Introduction
10+
============
2111

2212
Symbol Namespaces have been introduced as a means to structure the export
2313
surface of the in-kernel API. It allows subsystem maintainers to partition
@@ -31,15 +21,15 @@ its configuration, reject loading the module or warn about a missing import.
3121
Additionally, it is possible to put symbols into a module namespace, strictly
3222
limiting which modules are allowed to use these symbols.
3323

34-
2. How to define Symbol Namespaces
35-
==================================
24+
How to define Symbol Namespaces
25+
===============================
3626

3727
Symbols can be exported into namespace using different methods. All of them are
3828
changing the way EXPORT_SYMBOL and friends are instrumented to create ksymtab
3929
entries.
4030

41-
2.1 Using the EXPORT_SYMBOL macros
42-
==================================
31+
Using the EXPORT_SYMBOL macros
32+
------------------------------
4333

4434
In addition to the macros EXPORT_SYMBOL() and EXPORT_SYMBOL_GPL(), that allow
4535
exporting of kernel symbols to the kernel symbol table, variants of these are
@@ -57,8 +47,8 @@ refer to ``NULL``. There is no default namespace if none is defined. ``modpost``
5747
and kernel/module/main.c make use the namespace at build time or module load
5848
time, respectively.
5949

60-
2.2 Using the DEFAULT_SYMBOL_NAMESPACE define
61-
=============================================
50+
Using the DEFAULT_SYMBOL_NAMESPACE define
51+
-----------------------------------------
6252

6353
Defining namespaces for all symbols of a subsystem can be very verbose and may
6454
become hard to maintain. Therefore a default define (DEFAULT_SYMBOL_NAMESPACE)
@@ -86,8 +76,8 @@ unit as preprocessor statement. The above example would then read::
8676
within the corresponding compilation unit before the #include for
8777
<linux/export.h>. Typically it's placed before the first #include statement.
8878

89-
2.3 Using the EXPORT_SYMBOL_GPL_FOR_MODULES() macro
90-
===================================================
79+
Using the EXPORT_SYMBOL_GPL_FOR_MODULES() macro
80+
-----------------------------------------------
9181

9282
Symbols exported using this macro are put into a module namespace. This
9383
namespace cannot be imported.
@@ -102,8 +92,8 @@ For example:
10292
will limit usage of this symbol to modules whoes name matches the given
10393
patterns.
10494

105-
3. How to use Symbols exported in Namespaces
106-
============================================
95+
How to use Symbols exported in Namespaces
96+
=========================================
10797

10898
In order to use symbols that are exported into namespaces, kernel modules need
10999
to explicitly import these namespaces. Otherwise the kernel might reject to
@@ -125,11 +115,10 @@ inspected with modinfo::
125115

126116

127117
It is advisable to add the MODULE_IMPORT_NS() statement close to other module
128-
metadata definitions like MODULE_AUTHOR() or MODULE_LICENSE(). Refer to section
129-
5. for a way to create missing import statements automatically.
118+
metadata definitions like MODULE_AUTHOR() or MODULE_LICENSE().
130119

131-
4. Loading Modules that use namespaced Symbols
132-
==============================================
120+
Loading Modules that use namespaced Symbols
121+
===========================================
133122

134123
At module loading time (e.g. ``insmod``), the kernel will check each symbol
135124
referenced from the module for its availability and whether the namespace it
@@ -140,8 +129,8 @@ allow loading of modules that don't satisfy this precondition, a configuration
140129
option is available: Setting MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=y will
141130
enable loading regardless, but will emit a warning.
142131

143-
5. Automatically creating MODULE_IMPORT_NS statements
144-
=====================================================
132+
Automatically creating MODULE_IMPORT_NS statements
133+
==================================================
145134

146135
Missing namespaces imports can easily be detected at build time. In fact,
147136
modpost will emit a warning if a module uses a symbol from a namespace

Documentation/translations/it_IT/core-api/symbol-namespaces.rst

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Questo documento descrive come usare lo spazio dei nomi dei simboli
1010
per strutturare quello che viene esportato internamente al kernel
1111
grazie alle macro della famiglia EXPORT_SYMBOL().
1212

13-
1. Introduzione
14-
===============
13+
Introduzione
14+
============
1515

1616
Lo spazio dei nomi dei simboli è stato introdotto come mezzo per strutturare
1717
l'API esposta internamente al kernel. Permette ai manutentori di un
@@ -24,15 +24,15 @@ devono prima importare detto spazio. Altrimenti il kernel, a seconda
2424
della configurazione, potrebbe rifiutare di caricare il modulo o
2525
avvisare l'utente di un'importazione mancante.
2626

27-
2. Come definire uno spazio dei nomi dei simboli
28-
================================================
27+
Come definire uno spazio dei nomi dei simboli
28+
=============================================
2929

3030
I simboli possono essere esportati in spazi dei nomi usando diversi
3131
meccanismi. Tutti questi meccanismi cambiano il modo in cui
3232
EXPORT_SYMBOL e simili vengono guidati verso la creazione di voci in ksymtab.
3333

34-
2.1 Usare le macro EXPORT_SYMBOL
35-
================================
34+
Usare le macro EXPORT_SYMBOL
35+
----------------------------
3636

3737
In aggiunta alle macro EXPORT_SYMBOL() e EXPORT_SYMBOL_GPL(), che permettono
3838
di esportare simboli del kernel nella rispettiva tabella, ci sono
@@ -53,8 +53,8 @@ di base. Il programma ``modpost`` e il codice in kernel/module/main.c usano lo
5353
spazio dei nomi, rispettivamente, durante la compilazione e durante il
5454
caricamento di un modulo.
5555

56-
2.2 Usare il simbolo di preprocessore DEFAULT_SYMBOL_NAMESPACE
57-
==============================================================
56+
Usare il simbolo di preprocessore DEFAULT_SYMBOL_NAMESPACE
57+
----------------------------------------------------------
5858

5959
Definire lo spazio dei nomi per tutti i simboli di un sottosistema può essere
6060
logorante e di difficile manutenzione. Perciò è stato fornito un simbolo
@@ -83,8 +83,8 @@ direttamente nei file da compilare. L'esempio precedente diventerebbe::
8383

8484
Questo va messo prima di un qualsiasi uso di EXPORT_SYMBOL.
8585

86-
3. Come usare i simboli esportati attraverso uno spazio dei nomi
87-
================================================================
86+
Come usare i simboli esportati attraverso uno spazio dei nomi
87+
=============================================================
8888

8989
Per usare i simboli esportati da uno spazio dei nomi, i moduli del
9090
kernel devono esplicitamente importare il relativo spazio dei nomi; altrimenti
@@ -108,12 +108,10 @@ modinfo::
108108

109109

110110
Si consiglia di posizionare la dichiarazione MODULE_IMPORT_NS() vicino
111-
ai metadati del modulo come MODULE_AUTHOR() o MODULE_LICENSE(). Fate
112-
riferimento alla sezione 5. per creare automaticamente le importazioni
113-
mancanti.
111+
ai metadati del modulo come MODULE_AUTHOR() o MODULE_LICENSE().
114112

115-
4. Caricare moduli che usano simboli provenienti da spazi dei nomi
116-
==================================================================
113+
Caricare moduli che usano simboli provenienti da spazi dei nomi
114+
===============================================================
117115

118116
Quando un modulo viene caricato (per esempio usando ``insmod``), il kernel
119117
verificherà la disponibilità di ogni simbolo usato e se lo spazio dei nomi
@@ -125,8 +123,8 @@ un'opzione di configurazione: impostare
125123
MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=y caricherà i moduli comunque ma
126124
emetterà un avviso.
127125

128-
5. Creare automaticamente la dichiarazione MODULE_IMPORT_NS
129-
===========================================================
126+
Creare automaticamente la dichiarazione MODULE_IMPORT_NS
127+
========================================================
130128

131129
La mancanza di un'importazione può essere individuata facilmente al momento
132130
della compilazione. Infatti, modpost emetterà un avviso se il modulo usa

Documentation/translations/zh_CN/core-api/symbol-namespaces.rst

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,23 @@
1414

1515
本文档描述了如何使用符号命名空间来构造通过EXPORT_SYMBOL()系列宏导出的内核内符号的导出面。
1616

17-
.. 目录
18-
19-
=== 1 简介
20-
=== 2 如何定义符号命名空间
21-
--- 2.1 使用EXPORT_SYMBOL宏
22-
--- 2.2 使用DEFAULT_SYMBOL_NAMESPACE定义
23-
=== 3 如何使用命名空间中导出的符号
24-
=== 4 加载使用命名空间符号的模块
25-
=== 5 自动创建MODULE_IMPORT_NS声明
26-
27-
1. 简介
28-
=======
17+
简介
18+
====
2919

3020
符号命名空间已经被引入,作为构造内核内API的导出面的一种手段。它允许子系统维护者将
3121
他们导出的符号划分进独立的命名空间。这对于文档的编写非常有用(想想SUBSYSTEM_DEBUG
3222
命名空间),也可以限制一组符号在内核其他部分的使用。今后,使用导出到命名空间的符号
3323
的模块必须导入命名空间。否则,内核将根据其配置,拒绝加载该模块或警告说缺少
3424
导入。
3525

36-
2. 如何定义符号命名空间
37-
=======================
26+
如何定义符号命名空间
27+
====================
3828

3929
符号可以用不同的方法导出到命名空间。所有这些都在改变 EXPORT_SYMBOL 和与之类似的那些宏
4030
被检测到的方式,以创建 ksymtab 条目。
4131

42-
2.1 使用EXPORT_SYMBOL宏
43-
=======================
32+
使用EXPORT_SYMBOL宏
33+
-------------------
4434

4535
除了允许将内核符号导出到内核符号表的宏EXPORT_SYMBOL()和EXPORT_SYMBOL_GPL()之外,
4636
这些宏的变体还可以将符号导出到某个命名空间:EXPORT_SYMBOL_NS() 和 EXPORT_SYMBOL_NS_GPL()。
@@ -54,8 +44,8 @@
5444
导出时未指明命名空间的符号将指向 ``NULL`` 。如果没有定义命名空间,则默认没有。
5545
``modpost`` 和kernel/module/main.c分别在构建时或模块加载时使用名称空间。
5646

57-
2.2 使用DEFAULT_SYMBOL_NAMESPACE定义
58-
====================================
47+
使用DEFAULT_SYMBOL_NAMESPACE定义
48+
--------------------------------
5949

6050
为一个子系统的所有符号定义命名空间可能会非常冗长,并可能变得难以维护。因此,我
6151
们提供了一个默认定义(DEFAULT_SYMBOL_NAMESPACE),如果设置了这个定义, 它将成
@@ -80,8 +70,8 @@
8070

8171
应置于相关编译单元中任何 EXPORT_SYMBOL 宏之前
8272

83-
3. 如何使用命名空间中导出的符号
84-
===============================
73+
如何使用命名空间中导出的符号
74+
============================
8575

8676
为了使用被导出到命名空间的符号,内核模块需要明确地导入这些命名空间。
8777
否则内核可能会拒绝加载该模块。模块代码需要使用宏MODULE_IMPORT_NS来
@@ -100,11 +90,10 @@
10090

10191

10292
建议将 MODULE_IMPORT_NS() 语句添加到靠近其他模块元数据定义的地方,
103-
如 MODULE_AUTHOR() 或 MODULE_LICENSE() 。关于自动创建缺失的导入
104-
语句的方法,请参考第5节。
93+
如 MODULE_AUTHOR() 或 MODULE_LICENSE() 。
10594

106-
4. 加载使用命名空间符号的模块
107-
=============================
95+
加载使用命名空间符号的模块
96+
==========================
10897

10998
在模块加载时(比如 ``insmod`` ),内核将检查每个从模块中引用的符号是否可
11099
用,以及它可能被导出到的名字空间是否被模块导入。内核的默认行为是拒绝
@@ -113,8 +102,8 @@ EINVAL方式失败。要允许加载不满足这个前提条件的模块,可
113102
设置 MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=y 将使加载不受影响,但会
114103
发出警告。
115104

116-
5. 自动创建MODULE_IMPORT_NS声明
117-
===============================
105+
自动创建MODULE_IMPORT_NS声明
106+
============================
118107

119108
缺少命名空间的导入可以在构建时很容易被检测到。事实上,如果一个模块
120109
使用了一个命名空间的符号而没有导入它,modpost会发出警告。

0 commit comments

Comments
 (0)