summaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-11-17 05:32:33 -0500
committerJonathan Corbet <corbet@lwn.net>2016-11-19 12:22:04 -0500
commit1dc4bbf0b268246f6202c761016735933b6f0b99 (patch)
tree0bb12a6c59472d8167dbebac4fe6a68023956813 /Documentation
parent726d661fea3e3f76d36515c74e4ce58e7789418e (diff)
docs-rst: doc-guide: split the kernel-documentation.rst contents
Having the kernel-documentation at the topmost level doesn't allow generating a separate PDF file for it. Also, makes harder to add extra contents. So, place it on a sub-dir. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/00-INDEX2
-rw-r--r--Documentation/conf.py2
-rw-r--r--Documentation/doc-guide/conf.py10
-rw-r--r--Documentation/doc-guide/docbook.rst90
-rw-r--r--Documentation/doc-guide/index.rst19
-rw-r--r--Documentation/doc-guide/kernel-doc.rst (renamed from Documentation/kernel-documentation.rst)316
-rw-r--r--Documentation/doc-guide/sphinx.rst219
-rw-r--r--Documentation/index.rst2
-rw-r--r--Documentation/kernel-doc-nano-HOWTO.txt2
-rw-r--r--Documentation/process/4.Coding.rst4
-rw-r--r--Documentation/process/coding-style.rst4
-rw-r--r--Documentation/translations/zh_CN/CodingStyle2
12 files changed, 348 insertions, 324 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index e2e74448d425..c08de5574d48 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -258,7 +258,7 @@ kdump/
258 - directory with mini HowTo on getting the crash dump code to work. 258 - directory with mini HowTo on getting the crash dump code to work.
259process/kernel-docs.rst 259process/kernel-docs.rst
260 - listing of various WWW + books that document kernel internals. 260 - listing of various WWW + books that document kernel internals.
261kernel-documentation.rst 261doc-guide/
262 - how to write and format reStructuredText kernel documentation 262 - how to write and format reStructuredText kernel documentation
263admin-guide/kernel-parameters.rst 263admin-guide/kernel-parameters.rst
264 - summary listing of command line / boot prompt args for the kernel. 264 - summary listing of command line / boot prompt args for the kernel.
diff --git a/Documentation/conf.py b/Documentation/conf.py
index ba38bcf485a9..1ac958c0333d 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -340,6 +340,8 @@ if major == 1 and minor > 3:
340# (source start file, target name, title, 340# (source start file, target name, title,
341# author, documentclass [howto, manual, or own class]). 341# author, documentclass [howto, manual, or own class]).
342latex_documents = [ 342latex_documents = [
343 ('doc-guide/index', 'kernel-doc-guide.tex', 'Linux Kernel Documentation Guide',
344 'The kernel development community', 'manual'),
343 ('admin-guide/index', 'linux-user.tex', 'Linux Kernel User Documentation', 345 ('admin-guide/index', 'linux-user.tex', 'Linux Kernel User Documentation',
344 'The kernel development community', 'manual'), 346 'The kernel development community', 'manual'),
345 ('core-api/index', 'core-api.tex', 'The kernel core API manual', 347 ('core-api/index', 'core-api.tex', 'The kernel core API manual',
diff --git a/Documentation/doc-guide/conf.py b/Documentation/doc-guide/conf.py
new file mode 100644
index 000000000000..fd3731182d5a
--- /dev/null
+++ b/Documentation/doc-guide/conf.py
@@ -0,0 +1,10 @@
1# -*- coding: utf-8; mode: python -*-
2
3project = 'Linux Kernel Documentation Guide'
4
5tags.add("subproject")
6
7latex_documents = [
8 ('index', 'kernel-doc-guide.tex', 'Linux Kernel Documentation Guide',
9 'The kernel development community', 'manual'),
10]
diff --git a/Documentation/doc-guide/docbook.rst b/Documentation/doc-guide/docbook.rst
new file mode 100644
index 000000000000..d8bf04308b43
--- /dev/null
+++ b/Documentation/doc-guide/docbook.rst
@@ -0,0 +1,90 @@
1DocBook XML [DEPRECATED]
2========================
3
4.. attention::
5
6 This section describes the deprecated DocBook XML toolchain. Please do not
7 create new DocBook XML template files. Please consider converting existing
8 DocBook XML templates files to Sphinx/reStructuredText.
9
10Converting DocBook to Sphinx
11----------------------------
12
13Over time, we expect all of the documents under ``Documentation/DocBook`` to be
14converted to Sphinx and reStructuredText. For most DocBook XML documents, a good
15enough solution is to use the simple ``Documentation/sphinx/tmplcvt`` script,
16which uses ``pandoc`` under the hood. For example::
17
18 $ cd Documentation/sphinx
19 $ ./tmplcvt ../DocBook/in.tmpl ../out.rst
20
21Then edit the resulting rst files to fix any remaining issues, and add the
22document in the ``toctree`` in ``Documentation/index.rst``.
23
24Components of the kernel-doc system
25-----------------------------------
26
27Many places in the source tree have extractable documentation in the form of
28block comments above functions. The components of this system are:
29
30- ``scripts/kernel-doc``
31
32 This is a perl script that hunts for the block comments and can mark them up
33 directly into reStructuredText, DocBook, man, text, and HTML. (No, not
34 texinfo.)
35
36- ``Documentation/DocBook/*.tmpl``
37
38 These are XML template files, which are normal XML files with special
39 place-holders for where the extracted documentation should go.
40
41- ``scripts/docproc.c``
42
43 This is a program for converting XML template files into XML files. When a
44 file is referenced it is searched for symbols exported (EXPORT_SYMBOL), to be
45 able to distinguish between internal and external functions.
46
47 It invokes kernel-doc, giving it the list of functions that are to be
48 documented.
49
50 Additionally it is used to scan the XML template files to locate all the files
51 referenced herein. This is used to generate dependency information as used by
52 make.
53
54- ``Makefile``
55
56 The targets 'xmldocs', 'psdocs', 'pdfdocs', and 'htmldocs' are used to build
57 DocBook XML files, PostScript files, PDF files, and html files in
58 Documentation/DocBook. The older target 'sgmldocs' is equivalent to 'xmldocs'.
59
60- ``Documentation/DocBook/Makefile``
61
62 This is where C files are associated with SGML templates.
63
64How to use kernel-doc comments in DocBook XML template files
65------------------------------------------------------------
66
67DocBook XML template files (\*.tmpl) are like normal XML files, except that they
68can contain escape sequences where extracted documentation should be inserted.
69
70``!E<filename>`` is replaced by the documentation, in ``<filename>``, for
71functions that are exported using ``EXPORT_SYMBOL``: the function list is
72collected from files listed in ``Documentation/DocBook/Makefile``.
73
74``!I<filename>`` is replaced by the documentation for functions that are **not**
75exported using ``EXPORT_SYMBOL``.
76
77``!D<filename>`` is used to name additional files to search for functions
78exported using ``EXPORT_SYMBOL``.
79
80``!F<filename> <function [functions...]>`` is replaced by the documentation, in
81``<filename>``, for the functions listed.
82
83``!P<filename> <section title>`` is replaced by the contents of the ``DOC:``
84section titled ``<section title>`` from ``<filename>``. Spaces are allowed in
85``<section title>``; do not quote the ``<section title>``.
86
87``!C<filename>`` is replaced by nothing, but makes the tools check that all DOC:
88sections and documented functions, symbols, etc. are used. This makes sense to
89use when you use ``!F`` or ``!P`` only and want to verify that all documentation
90is included.
diff --git a/Documentation/doc-guide/index.rst b/Documentation/doc-guide/index.rst
new file mode 100644
index 000000000000..695b7b6cf6ed
--- /dev/null
+++ b/Documentation/doc-guide/index.rst
@@ -0,0 +1,19 @@
1.. _doc_guide:
2
3=================================
4How to write kernel documentation
5=================================
6
7.. toctree::
8 :maxdepth: 1
9
10 sphinx.rst
11 kernel-doc.rst
12 docbook.rst
13
14.. only:: subproject and html
15
16 Indices
17 =======
18
19 * :ref:`genindex`
diff --git a/Documentation/kernel-documentation.rst b/Documentation/doc-guide/kernel-doc.rst
index c66ab937c2ca..afc95c9e9626 100644
--- a/Documentation/kernel-documentation.rst
+++ b/Documentation/doc-guide/kernel-doc.rst
@@ -1,228 +1,3 @@
1=================================
2How to write kernel documentation
3=================================
4
5Introduction
6============
7
8The Linux kernel uses `Sphinx`_ to generate pretty documentation from
9`reStructuredText`_ files under ``Documentation``. To build the documentation in
10HTML or PDF formats, use ``make htmldocs`` or ``make pdfdocs``. The generated
11documentation is placed in ``Documentation/output``.
12
13.. _Sphinx: http://www.sphinx-doc.org/
14.. _reStructuredText: http://docutils.sourceforge.net/rst.html
15
16The reStructuredText files may contain directives to include structured
17documentation comments, or kernel-doc comments, from source files. Usually these
18are used to describe the functions and types and design of the code. The
19kernel-doc comments have some special structure and formatting, but beyond that
20they are also treated as reStructuredText.
21
22There is also the deprecated DocBook toolchain to generate documentation from
23DocBook XML template files under ``Documentation/DocBook``. The DocBook files
24are to be converted to reStructuredText, and the toolchain is slated to be
25removed.
26
27Finally, there are thousands of plain text documentation files scattered around
28``Documentation``. Some of these will likely be converted to reStructuredText
29over time, but the bulk of them will remain in plain text.
30
31Sphinx Build
32============
33
34The usual way to generate the documentation is to run ``make htmldocs`` or
35``make pdfdocs``. There are also other formats available, see the documentation
36section of ``make help``. The generated documentation is placed in
37format-specific subdirectories under ``Documentation/output``.
38
39To generate documentation, Sphinx (``sphinx-build``) must obviously be
40installed. For prettier HTML output, the Read the Docs Sphinx theme
41(``sphinx_rtd_theme``) is used if available. For PDF output, ``rst2pdf`` is also
42needed. All of these are widely available and packaged in distributions.
43
44To pass extra options to Sphinx, you can use the ``SPHINXOPTS`` make
45variable. For example, use ``make SPHINXOPTS=-v htmldocs`` to get more verbose
46output.
47
48To remove the generated documentation, run ``make cleandocs``.
49
50Writing Documentation
51=====================
52
53Adding new documentation can be as simple as:
54
551. Add a new ``.rst`` file somewhere under ``Documentation``.
562. Refer to it from the Sphinx main `TOC tree`_ in ``Documentation/index.rst``.
57
58.. _TOC tree: http://www.sphinx-doc.org/en/stable/markup/toctree.html
59
60This is usually good enough for simple documentation (like the one you're
61reading right now), but for larger documents it may be advisable to create a
62subdirectory (or use an existing one). For example, the graphics subsystem
63documentation is under ``Documentation/gpu``, split to several ``.rst`` files,
64and has a separate ``index.rst`` (with a ``toctree`` of its own) referenced from
65the main index.
66
67See the documentation for `Sphinx`_ and `reStructuredText`_ on what you can do
68with them. In particular, the Sphinx `reStructuredText Primer`_ is a good place
69to get started with reStructuredText. There are also some `Sphinx specific
70markup constructs`_.
71
72.. _reStructuredText Primer: http://www.sphinx-doc.org/en/stable/rest.html
73.. _Sphinx specific markup constructs: http://www.sphinx-doc.org/en/stable/markup/index.html
74
75Specific guidelines for the kernel documentation
76------------------------------------------------
77
78Here are some specific guidelines for the kernel documentation:
79
80* Please don't go overboard with reStructuredText markup. Keep it simple.
81
82* Please stick to this order of heading adornments:
83
84 1. ``=`` with overline for document title::
85
86 ==============
87 Document title
88 ==============
89
90 2. ``=`` for chapters::
91
92 Chapters
93 ========
94
95 3. ``-`` for sections::
96
97 Section
98 -------
99
100 4. ``~`` for subsections::
101
102 Subsection
103 ~~~~~~~~~~
104
105 Although RST doesn't mandate a specific order ("Rather than imposing a fixed
106 number and order of section title adornment styles, the order enforced will be
107 the order as encountered."), having the higher levels the same overall makes
108 it easier to follow the documents.
109
110
111the C domain
112------------
113
114The `Sphinx C Domain`_ (name c) is suited for documentation of C API. E.g. a
115function prototype:
116
117.. code-block:: rst
118
119 .. c:function:: int ioctl( int fd, int request )
120
121The C domain of the kernel-doc has some additional features. E.g. you can
122*rename* the reference name of a function with a common name like ``open`` or
123``ioctl``:
124
125.. code-block:: rst
126
127 .. c:function:: int ioctl( int fd, int request )
128 :name: VIDIOC_LOG_STATUS
129
130The func-name (e.g. ioctl) remains in the output but the ref-name changed from
131``ioctl`` to ``VIDIOC_LOG_STATUS``. The index entry for this function is also
132changed to ``VIDIOC_LOG_STATUS`` and the function can now referenced by:
133
134.. code-block:: rst
135
136 :c:func:`VIDIOC_LOG_STATUS`
137
138
139list tables
140-----------
141
142We recommend the use of *list table* formats. The *list table* formats are
143double-stage lists. Compared to the ASCII-art they might not be as
144comfortable for
145readers of the text files. Their advantage is that they are easy to
146create or modify and that the diff of a modification is much more meaningful,
147because it is limited to the modified content.
148
149The ``flat-table`` is a double-stage list similar to the ``list-table`` with
150some additional features:
151
152* column-span: with the role ``cspan`` a cell can be extended through
153 additional columns
154
155* row-span: with the role ``rspan`` a cell can be extended through
156 additional rows
157
158* auto span rightmost cell of a table row over the missing cells on the right
159 side of that table-row. With Option ``:fill-cells:`` this behavior can
160 changed from *auto span* to *auto fill*, which automatically inserts (empty)
161 cells instead of spanning the last cell.
162
163options:
164
165* ``:header-rows:`` [int] count of header rows
166* ``:stub-columns:`` [int] count of stub columns
167* ``:widths:`` [[int] [int] ... ] widths of columns
168* ``:fill-cells:`` instead of auto-spanning missing cells, insert missing cells
169
170roles:
171
172* ``:cspan:`` [int] additional columns (*morecols*)
173* ``:rspan:`` [int] additional rows (*morerows*)
174
175The example below shows how to use this markup. The first level of the staged
176list is the *table-row*. In the *table-row* there is only one markup allowed,
177the list of the cells in this *table-row*. Exceptions are *comments* ( ``..`` )
178and *targets* (e.g. a ref to ``:ref:`last row <last row>``` / :ref:`last row
179<last row>`).
180
181.. code-block:: rst
182
183 .. flat-table:: table title
184 :widths: 2 1 1 3
185
186 * - head col 1
187 - head col 2
188 - head col 3
189 - head col 4
190
191 * - column 1
192 - field 1.1
193 - field 1.2 with autospan
194
195 * - column 2
196 - field 2.1
197 - :rspan:`1` :cspan:`1` field 2.2 - 3.3
198
199 * .. _`last row`:
200
201 - column 3
202
203Rendered as:
204
205 .. flat-table:: table title
206 :widths: 2 1 1 3
207
208 * - head col 1
209 - head col 2
210 - head col 3
211 - head col 4
212
213 * - column 1
214 - field 1.1
215 - field 1.2 with autospan
216
217 * - column 2
218 - field 2.1
219 - :rspan:`1` :cspan:`1` field 2.2 - 3.3
220
221 * .. _`last row`:
222
223 - column 3
224
225
226Including kernel-doc comments 1Including kernel-doc comments
227============================= 2=============================
228 3
@@ -586,94 +361,3 @@ file.
586 361
587Data structures visible in kernel include files should also be documented using 362Data structures visible in kernel include files should also be documented using
588kernel-doc formatted comments. 363kernel-doc formatted comments.
589
590DocBook XML [DEPRECATED]
591========================
592
593.. attention::
594
595 This section describes the deprecated DocBook XML toolchain. Please do not
596 create new DocBook XML template files. Please consider converting existing
597 DocBook XML templates files to Sphinx/reStructuredText.
598
599Converting DocBook to Sphinx
600----------------------------
601
602Over time, we expect all of the documents under ``Documentation/DocBook`` to be
603converted to Sphinx and reStructuredText. For most DocBook XML documents, a good
604enough solution is to use the simple ``Documentation/sphinx/tmplcvt`` script,
605which uses ``pandoc`` under the hood. For example::
606
607 $ cd Documentation/sphinx
608 $ ./tmplcvt ../DocBook/in.tmpl ../out.rst
609
610Then edit the resulting rst files to fix any remaining issues, and add the
611document in the ``toctree`` in ``Documentation/index.rst``.
612
613Components of the kernel-doc system
614-----------------------------------
615
616Many places in the source tree have extractable documentation in the form of
617block comments above functions. The components of this system are:
618
619- ``scripts/kernel-doc``
620
621 This is a perl script that hunts for the block comments and can mark them up
622 directly into reStructuredText, DocBook, man, text, and HTML. (No, not
623 texinfo.)
624
625- ``Documentation/DocBook/*.tmpl``
626
627 These are XML template files, which are normal XML files with special
628 place-holders for where the extracted documentation should go.
629
630- ``scripts/docproc.c``
631
632 This is a program for converting XML template files into XML files. When a
633 file is referenced it is searched for symbols exported (EXPORT_SYMBOL), to be
634 able to distinguish between internal and external functions.
635
636 It invokes kernel-doc, giving it the list of functions that are to be
637 documented.
638
639 Additionally it is used to scan the XML template files to locate all the files
640 referenced herein. This is used to generate dependency information as used by
641 make.
642
643- ``Makefile``
644
645 The targets 'xmldocs', 'psdocs', 'pdfdocs', and 'htmldocs' are used to build
646 DocBook XML files, PostScript files, PDF files, and html files in
647 Documentation/DocBook. The older target 'sgmldocs' is equivalent to 'xmldocs'.
648
649- ``Documentation/DocBook/Makefile``
650
651 This is where C files are associated with SGML templates.
652
653How to use kernel-doc comments in DocBook XML template files
654------------------------------------------------------------
655
656DocBook XML template files (\*.tmpl) are like normal XML files, except that they
657can contain escape sequences where extracted documentation should be inserted.
658
659``!E<filename>`` is replaced by the documentation, in ``<filename>``, for
660functions that are exported using ``EXPORT_SYMBOL``: the function list is
661collected from files listed in ``Documentation/DocBook/Makefile``.
662
663``!I<filename>`` is replaced by the documentation for functions that are **not**
664exported using ``EXPORT_SYMBOL``.
665
666``!D<filename>`` is used to name additional files to search for functions
667exported using ``EXPORT_SYMBOL``.
668
669``!F<filename> <function [functions...]>`` is replaced by the documentation, in
670``<filename>``, for the functions listed.
671
672``!P<filename> <section title>`` is replaced by the contents of the ``DOC:``
673section titled ``<section title>`` from ``<filename>``. Spaces are allowed in
674``<section title>``; do not quote the ``<section title>``.
675
676``!C<filename>`` is replaced by nothing, but makes the tools check that all DOC:
677sections and documented functions, symbols, etc. are used. This makes sense to
678use when you use ``!F`` or ``!P`` only and want to verify that all documentation
679is included.
diff --git a/Documentation/doc-guide/sphinx.rst b/Documentation/doc-guide/sphinx.rst
new file mode 100644
index 000000000000..96fe7ccb2c67
--- /dev/null
+++ b/Documentation/doc-guide/sphinx.rst
@@ -0,0 +1,219 @@
1Introduction
2============
3
4The Linux kernel uses `Sphinx`_ to generate pretty documentation from
5`reStructuredText`_ files under ``Documentation``. To build the documentation in
6HTML or PDF formats, use ``make htmldocs`` or ``make pdfdocs``. The generated
7documentation is placed in ``Documentation/output``.
8
9.. _Sphinx: http://www.sphinx-doc.org/
10.. _reStructuredText: http://docutils.sourceforge.net/rst.html
11
12The reStructuredText files may contain directives to include structured
13documentation comments, or kernel-doc comments, from source files. Usually these
14are used to describe the functions and types and design of the code. The
15kernel-doc comments have some special structure and formatting, but beyond that
16they are also treated as reStructuredText.
17
18There is also the deprecated DocBook toolchain to generate documentation from
19DocBook XML template files under ``Documentation/DocBook``. The DocBook files
20are to be converted to reStructuredText, and the toolchain is slated to be
21removed.
22
23Finally, there are thousands of plain text documentation files scattered around
24``Documentation``. Some of these will likely be converted to reStructuredText
25over time, but the bulk of them will remain in plain text.
26
27Sphinx Build
28============
29
30The usual way to generate the documentation is to run ``make htmldocs`` or
31``make pdfdocs``. There are also other formats available, see the documentation
32section of ``make help``. The generated documentation is placed in
33format-specific subdirectories under ``Documentation/output``.
34
35To generate documentation, Sphinx (``sphinx-build``) must obviously be
36installed. For prettier HTML output, the Read the Docs Sphinx theme
37(``sphinx_rtd_theme``) is used if available. For PDF output, ``rst2pdf`` is also
38needed. All of these are widely available and packaged in distributions.
39
40To pass extra options to Sphinx, you can use the ``SPHINXOPTS`` make
41variable. For example, use ``make SPHINXOPTS=-v htmldocs`` to get more verbose
42output.
43
44To remove the generated documentation, run ``make cleandocs``.
45
46Writing Documentation
47=====================
48
49Adding new documentation can be as simple as:
50
511. Add a new ``.rst`` file somewhere under ``Documentation``.
522. Refer to it from the Sphinx main `TOC tree`_ in ``Documentation/index.rst``.
53
54.. _TOC tree: http://www.sphinx-doc.org/en/stable/markup/toctree.html
55
56This is usually good enough for simple documentation (like the one you're
57reading right now), but for larger documents it may be advisable to create a
58subdirectory (or use an existing one). For example, the graphics subsystem
59documentation is under ``Documentation/gpu``, split to several ``.rst`` files,
60and has a separate ``index.rst`` (with a ``toctree`` of its own) referenced from
61the main index.
62
63See the documentation for `Sphinx`_ and `reStructuredText`_ on what you can do
64with them. In particular, the Sphinx `reStructuredText Primer`_ is a good place
65to get started with reStructuredText. There are also some `Sphinx specific
66markup constructs`_.
67
68.. _reStructuredText Primer: http://www.sphinx-doc.org/en/stable/rest.html
69.. _Sphinx specific markup constructs: http://www.sphinx-doc.org/en/stable/markup/index.html
70
71Specific guidelines for the kernel documentation
72------------------------------------------------
73
74Here are some specific guidelines for the kernel documentation:
75
76* Please don't go overboard with reStructuredText markup. Keep it simple.
77
78* Please stick to this order of heading adornments:
79
80 1. ``=`` with overline for document title::
81
82 ==============
83 Document title
84 ==============
85
86 2. ``=`` for chapters::
87
88 Chapters
89 ========
90
91 3. ``-`` for sections::
92
93 Section
94 -------
95
96 4. ``~`` for subsections::
97
98 Subsection
99 ~~~~~~~~~~
100
101 Although RST doesn't mandate a specific order ("Rather than imposing a fixed
102 number and order of section title adornment styles, the order enforced will be
103 the order as encountered."), having the higher levels the same overall makes
104 it easier to follow the documents.
105
106
107the C domain
108------------
109
110The `Sphinx C Domain`_ (name c) is suited for documentation of C API. E.g. a
111function prototype:
112
113.. code-block:: rst
114
115 .. c:function:: int ioctl( int fd, int request )
116
117The C domain of the kernel-doc has some additional features. E.g. you can
118*rename* the reference name of a function with a common name like ``open`` or
119``ioctl``:
120
121.. code-block:: rst
122
123 .. c:function:: int ioctl( int fd, int request )
124 :name: VIDIOC_LOG_STATUS
125
126The func-name (e.g. ioctl) remains in the output but the ref-name changed from
127``ioctl`` to ``VIDIOC_LOG_STATUS``. The index entry for this function is also
128changed to ``VIDIOC_LOG_STATUS`` and the function can now referenced by:
129
130.. code-block:: rst
131
132 :c:func:`VIDIOC_LOG_STATUS`
133
134
135list tables
136-----------
137
138We recommend the use of *list table* formats. The *list table* formats are
139double-stage lists. Compared to the ASCII-art they might not be as
140comfortable for
141readers of the text files. Their advantage is that they are easy to
142create or modify and that the diff of a modification is much more meaningful,
143because it is limited to the modified content.
144
145The ``flat-table`` is a double-stage list similar to the ``list-table`` with
146some additional features:
147
148* column-span: with the role ``cspan`` a cell can be extended through
149 additional columns
150
151* row-span: with the role ``rspan`` a cell can be extended through
152 additional rows
153
154* auto span rightmost cell of a table row over the missing cells on the right
155 side of that table-row. With Option ``:fill-cells:`` this behavior can
156 changed from *auto span* to *auto fill*, which automatically inserts (empty)
157 cells instead of spanning the last cell.
158
159options:
160
161* ``:header-rows:`` [int] count of header rows
162* ``:stub-columns:`` [int] count of stub columns
163* ``:widths:`` [[int] [int] ... ] widths of columns
164* ``:fill-cells:`` instead of auto-spanning missing cells, insert missing cells
165
166roles:
167
168* ``:cspan:`` [int] additional columns (*morecols*)
169* ``:rspan:`` [int] additional rows (*morerows*)
170
171The example below shows how to use this markup. The first level of the staged
172list is the *table-row*. In the *table-row* there is only one markup allowed,
173the list of the cells in this *table-row*. Exceptions are *comments* ( ``..`` )
174and *targets* (e.g. a ref to ``:ref:`last row <last row>``` / :ref:`last row
175<last row>`).
176
177.. code-block:: rst
178
179 .. flat-table:: table title
180 :widths: 2 1 1 3
181
182 * - head col 1
183 - head col 2
184 - head col 3
185 - head col 4
186
187 * - column 1
188 - field 1.1
189 - field 1.2 with autospan
190
191 * - column 2
192 - field 2.1
193 - :rspan:`1` :cspan:`1` field 2.2 - 3.3
194
195 * .. _`last row`:
196
197 - column 3
198
199Rendered as:
200
201 .. flat-table:: table title
202 :widths: 2 1 1 3
203
204 * - head col 1
205 - head col 2
206 - head col 3
207 - head col 4
208
209 * - column 1
210 - field 1.1
211 - field 1.2 with autospan
212
213 * - column 2
214 - field 2.1
215 - :rspan:`1` :cspan:`1` field 2.2 - 3.3
216
217 * .. _`last row`:
218
219 - column 3
diff --git a/Documentation/index.rst b/Documentation/index.rst
index 286d92bad208..bf3eb3ad6ad5 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -38,7 +38,7 @@ merged much easier.
38 38
39 process/index 39 process/index
40 dev-tools/index 40 dev-tools/index
41 kernel-documentation 41 doc-guide/index
42 42
43Kernel API documentation 43Kernel API documentation
44------------------------ 44------------------------
diff --git a/Documentation/kernel-doc-nano-HOWTO.txt b/Documentation/kernel-doc-nano-HOWTO.txt
index 062e3af271b7..104740ea0041 100644
--- a/Documentation/kernel-doc-nano-HOWTO.txt
+++ b/Documentation/kernel-doc-nano-HOWTO.txt
@@ -1,5 +1,5 @@
1NOTE: this document is outdated and will eventually be removed. See 1NOTE: this document is outdated and will eventually be removed. See
2Documentation/kernel-documentation.rst for current information. 2Documentation/doc-guide/ for current information.
3 3
4kernel-doc nano-HOWTO 4kernel-doc nano-HOWTO
5===================== 5=====================
diff --git a/Documentation/process/4.Coding.rst b/Documentation/process/4.Coding.rst
index 983d628c1112..2a728d898fc5 100644
--- a/Documentation/process/4.Coding.rst
+++ b/Documentation/process/4.Coding.rst
@@ -358,8 +358,8 @@ them, as appropriate, for externally-available functions. Even in areas
358which have not been so documented, there is no harm in adding kerneldoc 358which have not been so documented, there is no harm in adding kerneldoc
359comments for the future; indeed, this can be a useful activity for 359comments for the future; indeed, this can be a useful activity for
360beginning kernel developers. The format of these comments, along with some 360beginning kernel developers. The format of these comments, along with some
361information on how to create kerneldoc templates can be found in the file 361information on how to create kerneldoc templates can be found at
362Documentation/kernel-documentation.rst. 362:ref:`Documentation/doc-guide/ <doc_guide>`.
363 363
364Anybody who reads through a significant amount of existing kernel code will 364Anybody who reads through a significant amount of existing kernel code will
365note that, often, comments are most notable by their absence. Once again, 365note that, often, comments are most notable by their absence. Once again,
diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
index 3e7905172000..d20d52a4d812 100644
--- a/Documentation/process/coding-style.rst
+++ b/Documentation/process/coding-style.rst
@@ -525,8 +525,8 @@ of the function, telling people what it does, and possibly WHY it does
525it. 525it.
526 526
527When commenting the kernel API functions, please use the kernel-doc format. 527When commenting the kernel API functions, please use the kernel-doc format.
528See the files Documentation/kernel-documentation.rst and scripts/kernel-doc 528See the files at :ref:`Documentation/doc-guide/ <doc_guide>` and
529for details. 529``scripts/kernel-doc`` for details.
530 530
531The preferred style for long (multi-line) comments is: 531The preferred style for long (multi-line) comments is:
532 532
diff --git a/Documentation/translations/zh_CN/CodingStyle b/Documentation/translations/zh_CN/CodingStyle
index b02738042799..dc101f48e713 100644
--- a/Documentation/translations/zh_CN/CodingStyle
+++ b/Documentation/translations/zh_CN/CodingStyle
@@ -399,7 +399,7 @@ C是一个简朴的语言,你的命名也应该这样。和 Modula-2 和 Pasca
399些事情的原因。 399些事情的原因。
400 400
401当注释内核API函数时,请使用 kernel-doc 格式。请看 401当注释内核API函数时,请使用 kernel-doc 格式。请看
402Documentation/kernel-documentation.rst和scripts/kernel-doc 以获得详细信息。 402Documentation/doc-guide/和scripts/kernel-doc 以获得详细信息。
403 403
404Linux的注释风格是 C89 “/* ... */” 风格。不要使用 C99 风格 “// ...” 注释。 404Linux的注释风格是 C89 “/* ... */” 风格。不要使用 C99 风格 “// ...” 注释。
405 405