diff options
99 files changed, 6606 insertions, 1396 deletions
@@ -16,6 +16,8 @@ Alan Cox <alan@lxorguk.ukuu.org.uk> | |||
16 | Alan Cox <root@hraefn.swansea.linux.org.uk> | 16 | Alan Cox <root@hraefn.swansea.linux.org.uk> |
17 | Aleksey Gorelov <aleksey_gorelov@phoenix.com> | 17 | Aleksey Gorelov <aleksey_gorelov@phoenix.com> |
18 | Aleksandar Markovic <aleksandar.markovic@mips.com> <aleksandar.markovic@imgtec.com> | 18 | Aleksandar Markovic <aleksandar.markovic@mips.com> <aleksandar.markovic@imgtec.com> |
19 | Alex Shi <alex.shi@linux.alibaba.com> <alex.shi@intel.com> | ||
20 | Alex Shi <alex.shi@linux.alibaba.com> <alex.shi@linaro.org> | ||
19 | Alexei Starovoitov <ast@kernel.org> <ast@plumgrid.com> | 21 | Alexei Starovoitov <ast@kernel.org> <ast@plumgrid.com> |
20 | Alexei Starovoitov <ast@kernel.org> <alexei.starovoitov@gmail.com> | 22 | Alexei Starovoitov <ast@kernel.org> <alexei.starovoitov@gmail.com> |
21 | Alexei Starovoitov <ast@kernel.org> <ast@fb.com> | 23 | Alexei Starovoitov <ast@kernel.org> <ast@fb.com> |
@@ -126,6 +128,8 @@ Leonid I Ananiev <leonid.i.ananiev@intel.com> | |||
126 | Linas Vepstas <linas@austin.ibm.com> | 128 | Linas Vepstas <linas@austin.ibm.com> |
127 | Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de> | 129 | Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de> |
128 | Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch> | 130 | Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch> |
131 | Li Yang <leoyang.li@nxp.com> <leo@zh-kernel.org> | ||
132 | Li Yang <leoyang.li@nxp.com> <leoli@freescale.com> | ||
129 | Maciej W. Rozycki <macro@mips.com> <macro@imgtec.com> | 133 | Maciej W. Rozycki <macro@mips.com> <macro@imgtec.com> |
130 | Marcin Nowakowski <marcin.nowakowski@mips.com> <marcin.nowakowski@imgtec.com> | 134 | Marcin Nowakowski <marcin.nowakowski@mips.com> <marcin.nowakowski@imgtec.com> |
131 | Mark Brown <broonie@sirena.org.uk> | 135 | Mark Brown <broonie@sirena.org.uk> |
@@ -217,6 +221,8 @@ Tejun Heo <htejun@gmail.com> | |||
217 | Thomas Graf <tgraf@suug.ch> | 221 | Thomas Graf <tgraf@suug.ch> |
218 | Thomas Pedersen <twp@codeaurora.org> | 222 | Thomas Pedersen <twp@codeaurora.org> |
219 | Tony Luck <tony.luck@intel.com> | 223 | Tony Luck <tony.luck@intel.com> |
224 | TripleX Chung <xxx.phy@gmail.com> <zhongyu@18mail.cn> | ||
225 | TripleX Chung <xxx.phy@gmail.com> <triplex@zh-kernel.org> | ||
220 | Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com> | 226 | Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com> |
221 | Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> | 227 | Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> |
222 | Uwe Kleine-König <ukl@pengutronix.de> | 228 | Uwe Kleine-König <ukl@pengutronix.de> |
diff --git a/Documentation/ABI/testing/sysfs-kernel-livepatch b/Documentation/ABI/testing/sysfs-kernel-livepatch index 85db352f68f9..bea7bd5a1d5f 100644 --- a/Documentation/ABI/testing/sysfs-kernel-livepatch +++ b/Documentation/ABI/testing/sysfs-kernel-livepatch | |||
@@ -45,7 +45,7 @@ Description: | |||
45 | use this feature without a clearance from a patch | 45 | use this feature without a clearance from a patch |
46 | distributor. Removal (rmmod) of patch modules is permanently | 46 | distributor. Removal (rmmod) of patch modules is permanently |
47 | disabled when the feature is used. See | 47 | disabled when the feature is used. See |
48 | Documentation/livepatch/livepatch.txt for more information. | 48 | Documentation/livepatch/livepatch.rst for more information. |
49 | 49 | ||
50 | What: /sys/kernel/livepatch/<patch>/<object> | 50 | What: /sys/kernel/livepatch/<patch>/<object> |
51 | Date: Nov 2014 | 51 | Date: Nov 2014 |
diff --git a/Documentation/DMA-API-HOWTO.txt b/Documentation/DMA-API-HOWTO.txt index 1a721d0f35c8..db48c6fd3162 100644 --- a/Documentation/DMA-API-HOWTO.txt +++ b/Documentation/DMA-API-HOWTO.txt | |||
@@ -147,7 +147,7 @@ networking subsystems make sure that the buffers they use are valid | |||
147 | for you to DMA from/to. | 147 | for you to DMA from/to. |
148 | 148 | ||
149 | DMA addressing capabilities | 149 | DMA addressing capabilities |
150 | ========================== | 150 | =========================== |
151 | 151 | ||
152 | By default, the kernel assumes that your device can address 32-bits of DMA | 152 | By default, the kernel assumes that your device can address 32-bits of DMA |
153 | addressing. For a 64-bit capable device, this needs to be increased, and for | 153 | addressing. For a 64-bit capable device, this needs to be increased, and for |
diff --git a/Documentation/Makefile b/Documentation/Makefile index 9786957c6a35..e889e7cb8511 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile | |||
@@ -28,8 +28,13 @@ ifeq ($(HAVE_SPHINX),0) | |||
28 | 28 | ||
29 | else # HAVE_SPHINX | 29 | else # HAVE_SPHINX |
30 | 30 | ||
31 | # User-friendly check for pdflatex | 31 | # User-friendly check for pdflatex and latexmk |
32 | HAVE_PDFLATEX := $(shell if which $(PDFLATEX) >/dev/null 2>&1; then echo 1; else echo 0; fi) | 32 | HAVE_PDFLATEX := $(shell if which $(PDFLATEX) >/dev/null 2>&1; then echo 1; else echo 0; fi) |
33 | HAVE_LATEXMK := $(shell if which latexmk >/dev/null 2>&1; then echo 1; else echo 0; fi) | ||
34 | |||
35 | ifeq ($(HAVE_LATEXMK),1) | ||
36 | PDFLATEX := latexmk -$(PDFLATEX) | ||
37 | endif #HAVE_LATEXMK | ||
33 | 38 | ||
34 | # Internal variables. | 39 | # Internal variables. |
35 | PAPEROPT_a4 = -D latex_paper_size=a4 | 40 | PAPEROPT_a4 = -D latex_paper_size=a4 |
@@ -82,7 +87,7 @@ pdfdocs: | |||
82 | else # HAVE_PDFLATEX | 87 | else # HAVE_PDFLATEX |
83 | 88 | ||
84 | pdfdocs: latexdocs | 89 | pdfdocs: latexdocs |
85 | $(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX=$(PDFLATEX) LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit;) | 90 | $(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX="$(PDFLATEX)" LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit;) |
86 | 91 | ||
87 | endif # HAVE_PDFLATEX | 92 | endif # HAVE_PDFLATEX |
88 | 93 | ||
diff --git a/Documentation/atomic_bitops.txt b/Documentation/atomic_bitops.txt index be70b32c95d9..093cdaefdb37 100644 --- a/Documentation/atomic_bitops.txt +++ b/Documentation/atomic_bitops.txt | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ============= | |
2 | On atomic bitops. | 2 | Atomic bitops |
3 | 3 | ============= | |
4 | 4 | ||
5 | While our bitmap_{}() functions are non-atomic, we have a number of operations | 5 | While our bitmap_{}() functions are non-atomic, we have a number of operations |
6 | operating on single bits in a bitmap that are atomic. | 6 | operating on single bits in a bitmap that are atomic. |
diff --git a/Documentation/clearing-warn-once.txt b/Documentation/clearing-warn-once.txt index c68598b31428..211fd926cf00 100644 --- a/Documentation/clearing-warn-once.txt +++ b/Documentation/clearing-warn-once.txt | |||
@@ -1,3 +1,5 @@ | |||
1 | Clearing WARN_ONCE | ||
2 | ------------------ | ||
1 | 3 | ||
2 | WARN_ONCE / WARN_ON_ONCE / printk_once only emit a message once. | 4 | WARN_ONCE / WARN_ON_ONCE / printk_once only emit a message once. |
3 | 5 | ||
diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst index 6870baffef82..ee1bb8983a88 100644 --- a/Documentation/core-api/index.rst +++ b/Documentation/core-api/index.rst | |||
@@ -22,7 +22,6 @@ Core utilities | |||
22 | workqueue | 22 | workqueue |
23 | genericirq | 23 | genericirq |
24 | xarray | 24 | xarray |
25 | flexible-arrays | ||
26 | librs | 25 | librs |
27 | genalloc | 26 | genalloc |
28 | errseq | 27 | errseq |
diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst index c8c03388b9de..25604904fa6e 100644 --- a/Documentation/dev-tools/kselftest.rst +++ b/Documentation/dev-tools/kselftest.rst | |||
@@ -7,6 +7,11 @@ directory. These are intended to be small tests to exercise individual code | |||
7 | paths in the kernel. Tests are intended to be run after building, installing | 7 | paths in the kernel. Tests are intended to be run after building, installing |
8 | and booting a kernel. | 8 | and booting a kernel. |
9 | 9 | ||
10 | You can find additional information on Kselftest framework, how to | ||
11 | write new tests using the framework on Kselftest wiki: | ||
12 | |||
13 | https://kselftest.wiki.kernel.org/ | ||
14 | |||
10 | On some systems, hot-plug tests could hang forever waiting for cpu and | 15 | On some systems, hot-plug tests could hang forever waiting for cpu and |
11 | memory to be ready to be offlined. A special hot-plug target is created | 16 | memory to be ready to be offlined. A special hot-plug target is created |
12 | to run the full range of hot-plug tests. In default mode, hot-plug tests run | 17 | to run the full range of hot-plug tests. In default mode, hot-plug tests run |
@@ -35,17 +40,32 @@ To build and run the tests with a single command, use:: | |||
35 | 40 | ||
36 | Note that some tests will require root privileges. | 41 | Note that some tests will require root privileges. |
37 | 42 | ||
38 | Build and run from user specific object directory (make O=dir):: | 43 | Kselftest supports saving output files in a separate directory and then |
44 | running tests. To locate output files in a separate directory two syntaxes | ||
45 | are supported. In both cases the working directory must be the root of the | ||
46 | kernel src. This is applicable to "Running a subset of selftests" section | ||
47 | below. | ||
48 | |||
49 | To build, save output files in a separate directory with O= :: | ||
39 | 50 | ||
40 | $ make O=/tmp/kselftest kselftest | 51 | $ make O=/tmp/kselftest kselftest |
41 | 52 | ||
42 | Build and run KBUILD_OUTPUT directory (make KBUILD_OUTPUT=):: | 53 | To build, save output files in a separate directory with KBUILD_OUTPUT :: |
54 | |||
55 | $ export KBUILD_OUTPUT=/tmp/kselftest; make kselftest | ||
43 | 56 | ||
44 | $ make KBUILD_OUTPUT=/tmp/kselftest kselftest | 57 | The O= assignment takes precedence over the KBUILD_OUTPUT environment |
58 | variable. | ||
45 | 59 | ||
46 | The above commands run the tests and print pass/fail summary to make it | 60 | The above commands by default run the tests and print full pass/fail report. |
47 | easier to understand the test results. Please find the detailed individual | 61 | Kselftest supports "summary" option to make it easier to understand the test |
48 | test results for each test in /tmp/testname file(s). | 62 | results. Please find the detailed individual test results for each test in |
63 | /tmp/testname file(s) when summary option is specified. This is applicable | ||
64 | to "Running a subset of selftests" section below. | ||
65 | |||
66 | To run kselftest with summary option enabled :: | ||
67 | |||
68 | $ make summary=1 kselftest | ||
49 | 69 | ||
50 | Running a subset of selftests | 70 | Running a subset of selftests |
51 | ============================= | 71 | ============================= |
@@ -61,17 +81,13 @@ You can specify multiple tests to build and run:: | |||
61 | 81 | ||
62 | $ make TARGETS="size timers" kselftest | 82 | $ make TARGETS="size timers" kselftest |
63 | 83 | ||
64 | Build and run from user specific object directory (make O=dir):: | 84 | To build, save output files in a separate directory with O= :: |
65 | 85 | ||
66 | $ make O=/tmp/kselftest TARGETS="size timers" kselftest | 86 | $ make O=/tmp/kselftest TARGETS="size timers" kselftest |
67 | 87 | ||
68 | Build and run KBUILD_OUTPUT directory (make KBUILD_OUTPUT=):: | 88 | To build, save output files in a separate directory with KBUILD_OUTPUT :: |
69 | |||
70 | $ make KBUILD_OUTPUT=/tmp/kselftest TARGETS="size timers" kselftest | ||
71 | 89 | ||
72 | The above commands run the tests and print pass/fail summary to make it | 90 | $ export KBUILD_OUTPUT=/tmp/kselftest; make TARGETS="size timers" kselftest |
73 | easier to understand the test results. Please find the detailed individual | ||
74 | test results for each test in /tmp/testname file(s). | ||
75 | 91 | ||
76 | See the top-level tools/testing/selftests/Makefile for the list of all | 92 | See the top-level tools/testing/selftests/Makefile for the list of all |
77 | possible targets. | 93 | possible targets. |
diff --git a/Documentation/doc-guide/index.rst b/Documentation/doc-guide/index.rst index a7f95d7d3a63..603f3ff55d5a 100644 --- a/Documentation/doc-guide/index.rst +++ b/Documentation/doc-guide/index.rst | |||
@@ -7,9 +7,9 @@ How to write kernel documentation | |||
7 | .. toctree:: | 7 | .. toctree:: |
8 | :maxdepth: 1 | 8 | :maxdepth: 1 |
9 | 9 | ||
10 | sphinx.rst | 10 | sphinx |
11 | kernel-doc.rst | 11 | kernel-doc |
12 | parse-headers.rst | 12 | parse-headers |
13 | 13 | ||
14 | .. only:: subproject and html | 14 | .. only:: subproject and html |
15 | 15 | ||
diff --git a/Documentation/dontdiff b/Documentation/dontdiff index 48e1930fb4a4..5eba889ea84d 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff | |||
@@ -127,7 +127,7 @@ flask.h | |||
127 | fore200e_mkfirm | 127 | fore200e_mkfirm |
128 | fore200e_pca_fw.c* | 128 | fore200e_pca_fw.c* |
129 | gconf | 129 | gconf |
130 | gconf.glade.h | 130 | gconf-cfg |
131 | gen-devlist | 131 | gen-devlist |
132 | gen_crc32table | 132 | gen_crc32table |
133 | gen_init_cpio | 133 | gen_init_cpio |
@@ -148,24 +148,22 @@ int32.c | |||
148 | int4.c | 148 | int4.c |
149 | int8.c | 149 | int8.c |
150 | kallsyms | 150 | kallsyms |
151 | kconfig | ||
152 | keywords.c | 151 | keywords.c |
153 | ksym.c* | 152 | ksym.c* |
154 | ksym.h* | 153 | ksym.h* |
155 | kxgettext | ||
156 | *lex.c | 154 | *lex.c |
157 | *lex.*.c | 155 | *lex.*.c |
158 | linux | 156 | linux |
159 | logo_*.c | 157 | logo_*.c |
160 | logo_*_clut224.c | 158 | logo_*_clut224.c |
161 | logo_*_mono.c | 159 | logo_*_mono.c |
162 | lxdialog | ||
163 | mach-types | 160 | mach-types |
164 | mach-types.h | 161 | mach-types.h |
165 | machtypes.h | 162 | machtypes.h |
166 | map | 163 | map |
167 | map_hugetlb | 164 | map_hugetlb |
168 | mconf | 165 | mconf |
166 | mconf-cfg | ||
169 | miboot* | 167 | miboot* |
170 | mk_elfconfig | 168 | mk_elfconfig |
171 | mkboot | 169 | mkboot |
@@ -183,6 +181,7 @@ modules.builtin.modinfo | |||
183 | modules.order | 181 | modules.order |
184 | modversions.h* | 182 | modversions.h* |
185 | nconf | 183 | nconf |
184 | nconf-cfg | ||
186 | ncscope.* | 185 | ncscope.* |
187 | offset.h | 186 | offset.h |
188 | oui.c* | 187 | oui.c* |
@@ -202,6 +201,7 @@ pnmtologo | |||
202 | ppc_defs.h* | 201 | ppc_defs.h* |
203 | pss_boot.h | 202 | pss_boot.h |
204 | qconf | 203 | qconf |
204 | qconf-cfg | ||
205 | r100_reg_safe.h | 205 | r100_reg_safe.h |
206 | r200_reg_safe.h | 206 | r200_reg_safe.h |
207 | r300_reg_safe.h | 207 | r300_reg_safe.h |
diff --git a/Documentation/driver-api/soundwire/stream.rst b/Documentation/driver-api/soundwire/stream.rst index 26a6064503fd..5351bd2f34a8 100644 --- a/Documentation/driver-api/soundwire/stream.rst +++ b/Documentation/driver-api/soundwire/stream.rst | |||
@@ -201,7 +201,7 @@ Bus implements below API for allocate a stream which needs to be called once | |||
201 | per stream. From ASoC DPCM framework, this stream state maybe linked to | 201 | per stream. From ASoC DPCM framework, this stream state maybe linked to |
202 | .startup() operation. | 202 | .startup() operation. |
203 | 203 | ||
204 | .. code-block:: c | 204 | .. code-block:: c |
205 | 205 | ||
206 | int sdw_alloc_stream(char * stream_name); | 206 | int sdw_alloc_stream(char * stream_name); |
207 | 207 | ||
@@ -228,7 +228,7 @@ the respective Master(s) and Slave(s) associated with stream. These APIs can | |||
228 | only be invoked once by respective Master(s) and Slave(s). From ASoC DPCM | 228 | only be invoked once by respective Master(s) and Slave(s). From ASoC DPCM |
229 | framework, this stream state is linked to .hw_params() operation. | 229 | framework, this stream state is linked to .hw_params() operation. |
230 | 230 | ||
231 | .. code-block:: c | 231 | .. code-block:: c |
232 | 232 | ||
233 | int sdw_stream_add_master(struct sdw_bus * bus, | 233 | int sdw_stream_add_master(struct sdw_bus * bus, |
234 | struct sdw_stream_config * stream_config, | 234 | struct sdw_stream_config * stream_config, |
@@ -274,7 +274,7 @@ Bus implements below API for PREPARE state which needs to be called once per | |||
274 | stream. From ASoC DPCM framework, this stream state is linked to | 274 | stream. From ASoC DPCM framework, this stream state is linked to |
275 | .prepare() operation. | 275 | .prepare() operation. |
276 | 276 | ||
277 | .. code-block:: c | 277 | .. code-block:: c |
278 | 278 | ||
279 | int sdw_prepare_stream(struct sdw_stream_runtime * stream); | 279 | int sdw_prepare_stream(struct sdw_stream_runtime * stream); |
280 | 280 | ||
@@ -304,7 +304,7 @@ Bus implements below API for ENABLE state which needs to be called once per | |||
304 | stream. From ASoC DPCM framework, this stream state is linked to | 304 | stream. From ASoC DPCM framework, this stream state is linked to |
305 | .trigger() start operation. | 305 | .trigger() start operation. |
306 | 306 | ||
307 | .. code-block:: c | 307 | .. code-block:: c |
308 | 308 | ||
309 | int sdw_enable_stream(struct sdw_stream_runtime * stream); | 309 | int sdw_enable_stream(struct sdw_stream_runtime * stream); |
310 | 310 | ||
@@ -332,7 +332,7 @@ Bus implements below API for DISABLED state which needs to be called once | |||
332 | per stream. From ASoC DPCM framework, this stream state is linked to | 332 | per stream. From ASoC DPCM framework, this stream state is linked to |
333 | .trigger() stop operation. | 333 | .trigger() stop operation. |
334 | 334 | ||
335 | .. code-block:: c | 335 | .. code-block:: c |
336 | 336 | ||
337 | int sdw_disable_stream(struct sdw_stream_runtime * stream); | 337 | int sdw_disable_stream(struct sdw_stream_runtime * stream); |
338 | 338 | ||
@@ -357,7 +357,7 @@ Bus implements below API for DEPREPARED state which needs to be called once | |||
357 | per stream. From ASoC DPCM framework, this stream state is linked to | 357 | per stream. From ASoC DPCM framework, this stream state is linked to |
358 | .trigger() stop operation. | 358 | .trigger() stop operation. |
359 | 359 | ||
360 | .. code-block:: c | 360 | .. code-block:: c |
361 | 361 | ||
362 | int sdw_deprepare_stream(struct sdw_stream_runtime * stream); | 362 | int sdw_deprepare_stream(struct sdw_stream_runtime * stream); |
363 | 363 | ||
@@ -382,7 +382,7 @@ Bus implements below APIs for RELEASE state which needs to be called by | |||
382 | all the Master(s) and Slave(s) associated with stream. From ASoC DPCM | 382 | all the Master(s) and Slave(s) associated with stream. From ASoC DPCM |
383 | framework, this stream state is linked to .hw_free() operation. | 383 | framework, this stream state is linked to .hw_free() operation. |
384 | 384 | ||
385 | .. code-block:: c | 385 | .. code-block:: c |
386 | 386 | ||
387 | int sdw_stream_remove_master(struct sdw_bus * bus, | 387 | int sdw_stream_remove_master(struct sdw_bus * bus, |
388 | struct sdw_stream_runtime * stream); | 388 | struct sdw_stream_runtime * stream); |
@@ -395,7 +395,7 @@ stream assigned as part of ALLOCATED state. | |||
395 | 395 | ||
396 | In .shutdown() the data structure maintaining stream state are freed up. | 396 | In .shutdown() the data structure maintaining stream state are freed up. |
397 | 397 | ||
398 | .. code-block:: c | 398 | .. code-block:: c |
399 | 399 | ||
400 | void sdw_release_stream(struct sdw_stream_runtime * stream); | 400 | void sdw_release_stream(struct sdw_stream_runtime * stream); |
401 | 401 | ||
diff --git a/Documentation/livepatch/callbacks.txt b/Documentation/livepatch/callbacks.rst index 182e31d4abce..470944aa8658 100644 --- a/Documentation/livepatch/callbacks.txt +++ b/Documentation/livepatch/callbacks.rst | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | Livepatch (un)patch-callbacks provide a mechanism for livepatch modules | 5 | Livepatch (un)patch-callbacks provide a mechanism for livepatch modules |
6 | to execute callback functions when a kernel object is (un)patched. They | 6 | to execute callback functions when a kernel object is (un)patched. They |
7 | can be considered a "power feature" that extends livepatching abilities | 7 | can be considered a **power feature** that **extends livepatching abilities** |
8 | to include: | 8 | to include: |
9 | 9 | ||
10 | - Safe updates to global data | 10 | - Safe updates to global data |
@@ -17,6 +17,9 @@ In most cases, (un)patch callbacks will need to be used in conjunction | |||
17 | with memory barriers and kernel synchronization primitives, like | 17 | with memory barriers and kernel synchronization primitives, like |
18 | mutexes/spinlocks, or even stop_machine(), to avoid concurrency issues. | 18 | mutexes/spinlocks, or even stop_machine(), to avoid concurrency issues. |
19 | 19 | ||
20 | 1. Motivation | ||
21 | ============= | ||
22 | |||
20 | Callbacks differ from existing kernel facilities: | 23 | Callbacks differ from existing kernel facilities: |
21 | 24 | ||
22 | - Module init/exit code doesn't run when disabling and re-enabling a | 25 | - Module init/exit code doesn't run when disabling and re-enabling a |
@@ -28,21 +31,31 @@ Callbacks are part of the klp_object structure and their implementation | |||
28 | is specific to that klp_object. Other livepatch objects may or may not | 31 | is specific to that klp_object. Other livepatch objects may or may not |
29 | be patched, irrespective of the target klp_object's current state. | 32 | be patched, irrespective of the target klp_object's current state. |
30 | 33 | ||
34 | 2. Callback types | ||
35 | ================= | ||
36 | |||
31 | Callbacks can be registered for the following livepatch actions: | 37 | Callbacks can be registered for the following livepatch actions: |
32 | 38 | ||
33 | * Pre-patch - before a klp_object is patched | 39 | * Pre-patch |
40 | - before a klp_object is patched | ||
34 | 41 | ||
35 | * Post-patch - after a klp_object has been patched and is active | 42 | * Post-patch |
43 | - after a klp_object has been patched and is active | ||
36 | across all tasks | 44 | across all tasks |
37 | 45 | ||
38 | * Pre-unpatch - before a klp_object is unpatched (ie, patched code is | 46 | * Pre-unpatch |
47 | - before a klp_object is unpatched (ie, patched code is | ||
39 | active), used to clean up post-patch callback | 48 | active), used to clean up post-patch callback |
40 | resources | 49 | resources |
41 | 50 | ||
42 | * Post-unpatch - after a klp_object has been patched, all code has | 51 | * Post-unpatch |
52 | - after a klp_object has been patched, all code has | ||
43 | been restored and no tasks are running patched code, | 53 | been restored and no tasks are running patched code, |
44 | used to cleanup pre-patch callback resources | 54 | used to cleanup pre-patch callback resources |
45 | 55 | ||
56 | 3. How it works | ||
57 | =============== | ||
58 | |||
46 | Each callback is optional, omitting one does not preclude specifying any | 59 | Each callback is optional, omitting one does not preclude specifying any |
47 | other. However, the livepatching core executes the handlers in | 60 | other. However, the livepatching core executes the handlers in |
48 | symmetry: pre-patch callbacks have a post-unpatch counterpart and | 61 | symmetry: pre-patch callbacks have a post-unpatch counterpart and |
@@ -86,11 +99,14 @@ If the object did successfully patch, but the patch transition never | |||
86 | started for some reason (e.g., if another object failed to patch), | 99 | started for some reason (e.g., if another object failed to patch), |
87 | only the post-unpatch callback will be called. | 100 | only the post-unpatch callback will be called. |
88 | 101 | ||
102 | 4. Use cases | ||
103 | ============ | ||
89 | 104 | ||
90 | Example Use-cases | 105 | Sample livepatch modules demonstrating the callback API can be found in |
91 | ================= | 106 | samples/livepatch/ directory. These samples were modified for use in |
107 | kselftests and can be found in the lib/livepatch directory. | ||
92 | 108 | ||
93 | Update global data | 109 | Global data update |
94 | ------------------ | 110 | ------------------ |
95 | 111 | ||
96 | A pre-patch callback can be useful to update a global variable. For | 112 | A pre-patch callback can be useful to update a global variable. For |
@@ -103,24 +119,15 @@ patch the data *after* patching is complete with a post-patch callback, | |||
103 | so that tcp_send_challenge_ack() could first be changed to read | 119 | so that tcp_send_challenge_ack() could first be changed to read |
104 | sysctl_tcp_challenge_ack_limit with READ_ONCE. | 120 | sysctl_tcp_challenge_ack_limit with READ_ONCE. |
105 | 121 | ||
106 | 122 | __init and probe function patches support | |
107 | Support __init and probe function patches | ||
108 | ----------------------------------------- | 123 | ----------------------------------------- |
109 | 124 | ||
110 | Although __init and probe functions are not directly livepatch-able, it | 125 | Although __init and probe functions are not directly livepatch-able, it |
111 | may be possible to implement similar updates via pre/post-patch | 126 | may be possible to implement similar updates via pre/post-patch |
112 | callbacks. | 127 | callbacks. |
113 | 128 | ||
114 | 48900cb6af42 ("virtio-net: drop NETIF_F_FRAGLIST") change the way that | 129 | The commit ``48900cb6af42 ("virtio-net: drop NETIF_F_FRAGLIST")`` change the way that |
115 | virtnet_probe() initialized its driver's net_device features. A | 130 | virtnet_probe() initialized its driver's net_device features. A |
116 | pre/post-patch callback could iterate over all such devices, making a | 131 | pre/post-patch callback could iterate over all such devices, making a |
117 | similar change to their hw_features value. (Client functions of the | 132 | similar change to their hw_features value. (Client functions of the |
118 | value may need to be updated accordingly.) | 133 | value may need to be updated accordingly.) |
119 | |||
120 | |||
121 | Other Examples | ||
122 | ============== | ||
123 | |||
124 | Sample livepatch modules demonstrating the callback API can be found in | ||
125 | samples/livepatch/ directory. These samples were modified for use in | ||
126 | kselftests and can be found in the lib/livepatch directory. | ||
diff --git a/Documentation/livepatch/cumulative-patches.txt b/Documentation/livepatch/cumulative-patches.rst index 0012808e8d44..1931f318976a 100644 --- a/Documentation/livepatch/cumulative-patches.txt +++ b/Documentation/livepatch/cumulative-patches.rst | |||
@@ -18,7 +18,7 @@ Usage | |||
18 | ----- | 18 | ----- |
19 | 19 | ||
20 | The atomic replace can be enabled by setting "replace" flag in struct klp_patch, | 20 | The atomic replace can be enabled by setting "replace" flag in struct klp_patch, |
21 | for example: | 21 | for example:: |
22 | 22 | ||
23 | static struct klp_patch patch = { | 23 | static struct klp_patch patch = { |
24 | .mod = THIS_MODULE, | 24 | .mod = THIS_MODULE, |
@@ -49,19 +49,19 @@ Features | |||
49 | 49 | ||
50 | The atomic replace allows: | 50 | The atomic replace allows: |
51 | 51 | ||
52 | + Atomically revert some functions in a previous patch while | 52 | - Atomically revert some functions in a previous patch while |
53 | upgrading other functions. | 53 | upgrading other functions. |
54 | 54 | ||
55 | + Remove eventual performance impact caused by core redirection | 55 | - Remove eventual performance impact caused by core redirection |
56 | for functions that are no longer patched. | 56 | for functions that are no longer patched. |
57 | 57 | ||
58 | + Decrease user confusion about dependencies between livepatches. | 58 | - Decrease user confusion about dependencies between livepatches. |
59 | 59 | ||
60 | 60 | ||
61 | Limitations: | 61 | Limitations: |
62 | ------------ | 62 | ------------ |
63 | 63 | ||
64 | + Once the operation finishes, there is no straightforward way | 64 | - Once the operation finishes, there is no straightforward way |
65 | to reverse it and restore the replaced patches atomically. | 65 | to reverse it and restore the replaced patches atomically. |
66 | 66 | ||
67 | A good practice is to set .replace flag in any released livepatch. | 67 | A good practice is to set .replace flag in any released livepatch. |
@@ -74,7 +74,7 @@ Limitations: | |||
74 | only when the transition was not forced. | 74 | only when the transition was not forced. |
75 | 75 | ||
76 | 76 | ||
77 | + Only the (un)patching callbacks from the _new_ cumulative livepatch are | 77 | - Only the (un)patching callbacks from the _new_ cumulative livepatch are |
78 | executed. Any callbacks from the replaced patches are ignored. | 78 | executed. Any callbacks from the replaced patches are ignored. |
79 | 79 | ||
80 | In other words, the cumulative patch is responsible for doing any actions | 80 | In other words, the cumulative patch is responsible for doing any actions |
@@ -93,7 +93,7 @@ Limitations: | |||
93 | enabled patches were called. | 93 | enabled patches were called. |
94 | 94 | ||
95 | 95 | ||
96 | + There is no special handling of shadow variables. Livepatch authors | 96 | - There is no special handling of shadow variables. Livepatch authors |
97 | must create their own rules how to pass them from one cumulative | 97 | must create their own rules how to pass them from one cumulative |
98 | patch to the other. Especially that they should not blindly remove | 98 | patch to the other. Especially that they should not blindly remove |
99 | them in module_exit() functions. | 99 | them in module_exit() functions. |
diff --git a/Documentation/livepatch/index.rst b/Documentation/livepatch/index.rst new file mode 100644 index 000000000000..edd291d51847 --- /dev/null +++ b/Documentation/livepatch/index.rst | |||
@@ -0,0 +1,21 @@ | |||
1 | :orphan: | ||
2 | |||
3 | =================== | ||
4 | Kernel Livepatching | ||
5 | =================== | ||
6 | |||
7 | .. toctree:: | ||
8 | :maxdepth: 1 | ||
9 | |||
10 | livepatch | ||
11 | callbacks | ||
12 | cumulative-patches | ||
13 | module-elf-format | ||
14 | shadow-vars | ||
15 | |||
16 | .. only:: subproject and html | ||
17 | |||
18 | Indices | ||
19 | ======= | ||
20 | |||
21 | * :ref:`genindex` | ||
diff --git a/Documentation/livepatch/livepatch.txt b/Documentation/livepatch/livepatch.rst index 4627b41ff02e..c2c598c4ead8 100644 --- a/Documentation/livepatch/livepatch.txt +++ b/Documentation/livepatch/livepatch.rst | |||
@@ -4,22 +4,22 @@ Livepatch | |||
4 | 4 | ||
5 | This document outlines basic information about kernel livepatching. | 5 | This document outlines basic information about kernel livepatching. |
6 | 6 | ||
7 | Table of Contents: | 7 | .. Table of Contents: |
8 | 8 | ||
9 | 1. Motivation | 9 | 1. Motivation |
10 | 2. Kprobes, Ftrace, Livepatching | 10 | 2. Kprobes, Ftrace, Livepatching |
11 | 3. Consistency model | 11 | 3. Consistency model |
12 | 4. Livepatch module | 12 | 4. Livepatch module |
13 | 4.1. New functions | 13 | 4.1. New functions |
14 | 4.2. Metadata | 14 | 4.2. Metadata |
15 | 5. Livepatch life-cycle | 15 | 5. Livepatch life-cycle |
16 | 5.1. Loading | 16 | 5.1. Loading |
17 | 5.2. Enabling | 17 | 5.2. Enabling |
18 | 5.3. Replacing | 18 | 5.3. Replacing |
19 | 5.4. Disabling | 19 | 5.4. Disabling |
20 | 5.5. Removing | 20 | 5.5. Removing |
21 | 6. Sysfs | 21 | 6. Sysfs |
22 | 7. Limitations | 22 | 7. Limitations |
23 | 23 | ||
24 | 24 | ||
25 | 1. Motivation | 25 | 1. Motivation |
@@ -40,14 +40,14 @@ There are multiple mechanisms in the Linux kernel that are directly related | |||
40 | to redirection of code execution; namely: kernel probes, function tracing, | 40 | to redirection of code execution; namely: kernel probes, function tracing, |
41 | and livepatching: | 41 | and livepatching: |
42 | 42 | ||
43 | + The kernel probes are the most generic. The code can be redirected by | 43 | - The kernel probes are the most generic. The code can be redirected by |
44 | putting a breakpoint instruction instead of any instruction. | 44 | putting a breakpoint instruction instead of any instruction. |
45 | 45 | ||
46 | + The function tracer calls the code from a predefined location that is | 46 | - The function tracer calls the code from a predefined location that is |
47 | close to the function entry point. This location is generated by the | 47 | close to the function entry point. This location is generated by the |
48 | compiler using the '-pg' gcc option. | 48 | compiler using the '-pg' gcc option. |
49 | 49 | ||
50 | + Livepatching typically needs to redirect the code at the very beginning | 50 | - Livepatching typically needs to redirect the code at the very beginning |
51 | of the function entry before the function parameters or the stack | 51 | of the function entry before the function parameters or the stack |
52 | are in any way modified. | 52 | are in any way modified. |
53 | 53 | ||
@@ -249,7 +249,7 @@ The patch contains only functions that are really modified. But they | |||
249 | might want to access functions or data from the original source file | 249 | might want to access functions or data from the original source file |
250 | that may only be locally accessible. This can be solved by a special | 250 | that may only be locally accessible. This can be solved by a special |
251 | relocation section in the generated livepatch module, see | 251 | relocation section in the generated livepatch module, see |
252 | Documentation/livepatch/module-elf-format.txt for more details. | 252 | Documentation/livepatch/module-elf-format.rst for more details. |
253 | 253 | ||
254 | 254 | ||
255 | 4.2. Metadata | 255 | 4.2. Metadata |
@@ -258,7 +258,7 @@ Documentation/livepatch/module-elf-format.txt for more details. | |||
258 | The patch is described by several structures that split the information | 258 | The patch is described by several structures that split the information |
259 | into three levels: | 259 | into three levels: |
260 | 260 | ||
261 | + struct klp_func is defined for each patched function. It describes | 261 | - struct klp_func is defined for each patched function. It describes |
262 | the relation between the original and the new implementation of a | 262 | the relation between the original and the new implementation of a |
263 | particular function. | 263 | particular function. |
264 | 264 | ||
@@ -275,7 +275,7 @@ into three levels: | |||
275 | only for a particular object ( vmlinux or a kernel module ). Note that | 275 | only for a particular object ( vmlinux or a kernel module ). Note that |
276 | kallsyms allows for searching symbols according to the object name. | 276 | kallsyms allows for searching symbols according to the object name. |
277 | 277 | ||
278 | + struct klp_object defines an array of patched functions (struct | 278 | - struct klp_object defines an array of patched functions (struct |
279 | klp_func) in the same object. Where the object is either vmlinux | 279 | klp_func) in the same object. Where the object is either vmlinux |
280 | (NULL) or a module name. | 280 | (NULL) or a module name. |
281 | 281 | ||
@@ -285,7 +285,7 @@ into three levels: | |||
285 | only when they are available. | 285 | only when they are available. |
286 | 286 | ||
287 | 287 | ||
288 | + struct klp_patch defines an array of patched objects (struct | 288 | - struct klp_patch defines an array of patched objects (struct |
289 | klp_object). | 289 | klp_object). |
290 | 290 | ||
291 | This structure handles all patched functions consistently and eventually, | 291 | This structure handles all patched functions consistently and eventually, |
@@ -337,14 +337,16 @@ operation fails. | |||
337 | Second, livepatch enters into a transition state where tasks are converging | 337 | Second, livepatch enters into a transition state where tasks are converging |
338 | to the patched state. If an original function is patched for the first | 338 | to the patched state. If an original function is patched for the first |
339 | time, a function specific struct klp_ops is created and an universal | 339 | time, a function specific struct klp_ops is created and an universal |
340 | ftrace handler is registered[*]. This stage is indicated by a value of '1' | 340 | ftrace handler is registered\ [#]_. This stage is indicated by a value of '1' |
341 | in /sys/kernel/livepatch/<name>/transition. For more information about | 341 | in /sys/kernel/livepatch/<name>/transition. For more information about |
342 | this process, see the "Consistency model" section. | 342 | this process, see the "Consistency model" section. |
343 | 343 | ||
344 | Finally, once all tasks have been patched, the 'transition' value changes | 344 | Finally, once all tasks have been patched, the 'transition' value changes |
345 | to '0'. | 345 | to '0'. |
346 | 346 | ||
347 | [*] Note that functions might be patched multiple times. The ftrace handler | 347 | .. [#] |
348 | |||
349 | Note that functions might be patched multiple times. The ftrace handler | ||
348 | is registered only once for a given function. Further patches just add | 350 | is registered only once for a given function. Further patches just add |
349 | an entry to the list (see field `func_stack`) of the struct klp_ops. | 351 | an entry to the list (see field `func_stack`) of the struct klp_ops. |
350 | The right implementation is selected by the ftrace handler, see | 352 | The right implementation is selected by the ftrace handler, see |
@@ -368,7 +370,7 @@ the ftrace handler is unregistered and the struct klp_ops is | |||
368 | freed when the related function is not modified by the new patch | 370 | freed when the related function is not modified by the new patch |
369 | and func_stack list becomes empty. | 371 | and func_stack list becomes empty. |
370 | 372 | ||
371 | See Documentation/livepatch/cumulative-patches.txt for more details. | 373 | See Documentation/livepatch/cumulative-patches.rst for more details. |
372 | 374 | ||
373 | 375 | ||
374 | 5.4. Disabling | 376 | 5.4. Disabling |
@@ -421,7 +423,7 @@ See Documentation/ABI/testing/sysfs-kernel-livepatch for more details. | |||
421 | 423 | ||
422 | The current Livepatch implementation has several limitations: | 424 | The current Livepatch implementation has several limitations: |
423 | 425 | ||
424 | + Only functions that can be traced could be patched. | 426 | - Only functions that can be traced could be patched. |
425 | 427 | ||
426 | Livepatch is based on the dynamic ftrace. In particular, functions | 428 | Livepatch is based on the dynamic ftrace. In particular, functions |
427 | implementing ftrace or the livepatch ftrace handler could not be | 429 | implementing ftrace or the livepatch ftrace handler could not be |
@@ -431,7 +433,7 @@ The current Livepatch implementation has several limitations: | |||
431 | 433 | ||
432 | 434 | ||
433 | 435 | ||
434 | + Livepatch works reliably only when the dynamic ftrace is located at | 436 | - Livepatch works reliably only when the dynamic ftrace is located at |
435 | the very beginning of the function. | 437 | the very beginning of the function. |
436 | 438 | ||
437 | The function need to be redirected before the stack or the function | 439 | The function need to be redirected before the stack or the function |
@@ -445,7 +447,7 @@ The current Livepatch implementation has several limitations: | |||
445 | this is handled on the ftrace level. | 447 | this is handled on the ftrace level. |
446 | 448 | ||
447 | 449 | ||
448 | + Kretprobes using the ftrace framework conflict with the patched | 450 | - Kretprobes using the ftrace framework conflict with the patched |
449 | functions. | 451 | functions. |
450 | 452 | ||
451 | Both kretprobes and livepatches use a ftrace handler that modifies | 453 | Both kretprobes and livepatches use a ftrace handler that modifies |
@@ -453,7 +455,7 @@ The current Livepatch implementation has several limitations: | |||
453 | is rejected when the handler is already in use by the other. | 455 | is rejected when the handler is already in use by the other. |
454 | 456 | ||
455 | 457 | ||
456 | + Kprobes in the original function are ignored when the code is | 458 | - Kprobes in the original function are ignored when the code is |
457 | redirected to the new implementation. | 459 | redirected to the new implementation. |
458 | 460 | ||
459 | There is a work in progress to add warnings about this situation. | 461 | There is a work in progress to add warnings about this situation. |
diff --git a/Documentation/livepatch/module-elf-format.txt b/Documentation/livepatch/module-elf-format.rst index f21a5289a09c..2a591e6f8e6c 100644 --- a/Documentation/livepatch/module-elf-format.txt +++ b/Documentation/livepatch/module-elf-format.rst | |||
@@ -4,33 +4,21 @@ Livepatch module Elf format | |||
4 | 4 | ||
5 | This document outlines the Elf format requirements that livepatch modules must follow. | 5 | This document outlines the Elf format requirements that livepatch modules must follow. |
6 | 6 | ||
7 | ----------------- | 7 | |
8 | Table of Contents | 8 | .. Table of Contents |
9 | ----------------- | 9 | |
10 | 0. Background and motivation | 10 | 1. Background and motivation |
11 | 1. Livepatch modinfo field | 11 | 2. Livepatch modinfo field |
12 | 2. Livepatch relocation sections | 12 | 3. Livepatch relocation sections |
13 | 2.1 What are livepatch relocation sections? | 13 | 3.1 Livepatch relocation section format |
14 | 2.2 Livepatch relocation section format | 14 | 4. Livepatch symbols |
15 | 2.2.1 Required flags | 15 | 4.1 A livepatch module's symbol table |
16 | 2.2.2 Required name format | 16 | 4.2 Livepatch symbol format |
17 | 2.2.3 Example livepatch relocation section names | 17 | 5. Architecture-specific sections |
18 | 2.2.4 Example `readelf --sections` output | 18 | 6. Symbol table and Elf section access |
19 | 2.2.5 Example `readelf --relocs` output | 19 | |
20 | 3. Livepatch symbols | 20 | 1. Background and motivation |
21 | 3.1 What are livepatch symbols? | 21 | ============================ |
22 | 3.2 A livepatch module's symbol table | ||
23 | 3.3 Livepatch symbol format | ||
24 | 3.3.1 Required flags | ||
25 | 3.3.2 Required name format | ||
26 | 3.3.3 Example livepatch symbol names | ||
27 | 3.3.4 Example `readelf --symbols` output | ||
28 | 4. Architecture-specific sections | ||
29 | 5. Symbol table and Elf section access | ||
30 | |||
31 | ---------------------------- | ||
32 | 0. Background and motivation | ||
33 | ---------------------------- | ||
34 | 22 | ||
35 | Formerly, livepatch required separate architecture-specific code to write | 23 | Formerly, livepatch required separate architecture-specific code to write |
36 | relocations. However, arch-specific code to write relocations already | 24 | relocations. However, arch-specific code to write relocations already |
@@ -52,8 +40,8 @@ relocation sections and symbols, which are described in this document. The | |||
52 | Elf constants used to mark livepatch symbols and relocation sections were | 40 | Elf constants used to mark livepatch symbols and relocation sections were |
53 | selected from OS-specific ranges according to the definitions from glibc. | 41 | selected from OS-specific ranges according to the definitions from glibc. |
54 | 42 | ||
55 | 0.1 Why does livepatch need to write its own relocations? | 43 | Why does livepatch need to write its own relocations? |
56 | --------------------------------------------------------- | 44 | ----------------------------------------------------- |
57 | A typical livepatch module contains patched versions of functions that can | 45 | A typical livepatch module contains patched versions of functions that can |
58 | reference non-exported global symbols and non-included local symbols. | 46 | reference non-exported global symbols and non-included local symbols. |
59 | Relocations referencing these types of symbols cannot be left in as-is | 47 | Relocations referencing these types of symbols cannot be left in as-is |
@@ -72,13 +60,8 @@ relas reference are special livepatch symbols (see section 2 and 3). The | |||
72 | arch-specific livepatch relocation code is replaced by a call to | 60 | arch-specific livepatch relocation code is replaced by a call to |
73 | apply_relocate_add(). | 61 | apply_relocate_add(). |
74 | 62 | ||
75 | ================================ | 63 | 2. Livepatch modinfo field |
76 | PATCH MODULE FORMAT REQUIREMENTS | 64 | ========================== |
77 | ================================ | ||
78 | |||
79 | -------------------------- | ||
80 | 1. Livepatch modinfo field | ||
81 | -------------------------- | ||
82 | 65 | ||
83 | Livepatch modules are required to have the "livepatch" modinfo attribute. | 66 | Livepatch modules are required to have the "livepatch" modinfo attribute. |
84 | See the sample livepatch module in samples/livepatch/ for how this is done. | 67 | See the sample livepatch module in samples/livepatch/ for how this is done. |
@@ -87,22 +70,23 @@ Livepatch modules can be identified by users by using the 'modinfo' command | |||
87 | and looking for the presence of the "livepatch" field. This field is also | 70 | and looking for the presence of the "livepatch" field. This field is also |
88 | used by the kernel module loader to identify livepatch modules. | 71 | used by the kernel module loader to identify livepatch modules. |
89 | 72 | ||
90 | Example modinfo output: | 73 | Example: |
91 | ----------------------- | 74 | -------- |
92 | % modinfo livepatch-meminfo.ko | 75 | |
93 | filename: livepatch-meminfo.ko | 76 | **Modinfo output:** |
94 | livepatch: Y | 77 | |
95 | license: GPL | 78 | :: |
96 | depends: | 79 | |
97 | vermagic: 4.3.0+ SMP mod_unload | 80 | % modinfo livepatch-meminfo.ko |
98 | 81 | filename: livepatch-meminfo.ko | |
99 | -------------------------------- | 82 | livepatch: Y |
100 | 2. Livepatch relocation sections | 83 | license: GPL |
101 | -------------------------------- | 84 | depends: |
102 | 85 | vermagic: 4.3.0+ SMP mod_unload | |
103 | ------------------------------------------- | 86 | |
104 | 2.1 What are livepatch relocation sections? | 87 | 3. Livepatch relocation sections |
105 | ------------------------------------------- | 88 | ================================ |
89 | |||
106 | A livepatch module manages its own Elf relocation sections to apply | 90 | A livepatch module manages its own Elf relocation sections to apply |
107 | relocations to modules as well as to the kernel (vmlinux) at the | 91 | relocations to modules as well as to the kernel (vmlinux) at the |
108 | appropriate time. For example, if a patch module patches a driver that is | 92 | appropriate time. For example, if a patch module patches a driver that is |
@@ -127,12 +111,9 @@ Every symbol referenced by a rela in a livepatch relocation section is a | |||
127 | livepatch symbol. These must be resolved before livepatch can call | 111 | livepatch symbol. These must be resolved before livepatch can call |
128 | apply_relocate_add(). See Section 3 for more information. | 112 | apply_relocate_add(). See Section 3 for more information. |
129 | 113 | ||
130 | --------------------------------------- | 114 | 3.1 Livepatch relocation section format |
131 | 2.2 Livepatch relocation section format | 115 | ======================================= |
132 | --------------------------------------- | ||
133 | 116 | ||
134 | 2.2.1 Required flags | ||
135 | -------------------- | ||
136 | Livepatch relocation sections must be marked with the SHF_RELA_LIVEPATCH | 117 | Livepatch relocation sections must be marked with the SHF_RELA_LIVEPATCH |
137 | section flag. See include/uapi/linux/elf.h for the definition. The module | 118 | section flag. See include/uapi/linux/elf.h for the definition. The module |
138 | loader recognizes this flag and will avoid applying those relocation sections | 119 | loader recognizes this flag and will avoid applying those relocation sections |
@@ -140,28 +121,39 @@ at patch module load time. These sections must also be marked with SHF_ALLOC, | |||
140 | so that the module loader doesn't discard them on module load (i.e. they will | 121 | so that the module loader doesn't discard them on module load (i.e. they will |
141 | be copied into memory along with the other SHF_ALLOC sections). | 122 | be copied into memory along with the other SHF_ALLOC sections). |
142 | 123 | ||
143 | 2.2.2 Required name format | 124 | The name of a livepatch relocation section must conform to the following |
144 | -------------------------- | 125 | format:: |
145 | The name of a livepatch relocation section must conform to the following format: | ||
146 | 126 | ||
147 | .klp.rela.objname.section_name | 127 | .klp.rela.objname.section_name |
148 | ^ ^^ ^ ^ ^ | 128 | ^ ^^ ^ ^ ^ |
149 | |________||_____| |__________| | 129 | |________||_____| |__________| |
150 | [A] [B] [C] | 130 | [A] [B] [C] |
151 | 131 | ||
152 | [A] The relocation section name is prefixed with the string ".klp.rela." | 132 | [A] |
153 | [B] The name of the object (i.e. "vmlinux" or name of module) to | 133 | The relocation section name is prefixed with the string ".klp.rela." |
154 | which the relocation section belongs follows immediately after the prefix. | ||
155 | [C] The actual name of the section to which this relocation section applies. | ||
156 | 134 | ||
157 | 2.2.3 Example livepatch relocation section names: | 135 | [B] |
158 | ------------------------------------------------- | 136 | The name of the object (i.e. "vmlinux" or name of module) to |
159 | .klp.rela.ext4.text.ext4_attr_store | 137 | which the relocation section belongs follows immediately after the prefix. |
160 | .klp.rela.vmlinux.text.cmdline_proc_show | 138 | |
139 | [C] | ||
140 | The actual name of the section to which this relocation section applies. | ||
141 | |||
142 | Examples: | ||
143 | --------- | ||
144 | |||
145 | **Livepatch relocation section names:** | ||
146 | |||
147 | :: | ||
148 | |||
149 | .klp.rela.ext4.text.ext4_attr_store | ||
150 | .klp.rela.vmlinux.text.cmdline_proc_show | ||
151 | |||
152 | **`readelf --sections` output for a patch | ||
153 | module that patches vmlinux and modules 9p, btrfs, ext4:** | ||
154 | |||
155 | :: | ||
161 | 156 | ||
162 | 2.2.4 Example `readelf --sections` output for a patch | ||
163 | module that patches vmlinux and modules 9p, btrfs, ext4: | ||
164 | -------------------------------------------------------- | ||
165 | Section Headers: | 157 | Section Headers: |
166 | [Nr] Name Type Address Off Size ES Flg Lk Inf Al | 158 | [Nr] Name Type Address Off Size ES Flg Lk Inf Al |
167 | [ snip ] | 159 | [ snip ] |
@@ -175,31 +167,33 @@ module that patches vmlinux and modules 9p, btrfs, ext4: | |||
175 | [ snip ] ^ ^ | 167 | [ snip ] ^ ^ |
176 | | | | 168 | | | |
177 | [*] [*] | 169 | [*] [*] |
178 | [*] Livepatch relocation sections are SHT_RELA sections but with a few special | 170 | |
179 | characteristics. Notice that they are marked SHF_ALLOC ("A") so that they will | 171 | [*] |
180 | not be discarded when the module is loaded into memory, as well as with the | 172 | Livepatch relocation sections are SHT_RELA sections but with a few special |
181 | SHF_RELA_LIVEPATCH flag ("o" - for OS-specific). | 173 | characteristics. Notice that they are marked SHF_ALLOC ("A") so that they will |
182 | 174 | not be discarded when the module is loaded into memory, as well as with the | |
183 | 2.2.5 Example `readelf --relocs` output for a patch module: | 175 | SHF_RELA_LIVEPATCH flag ("o" - for OS-specific). |
184 | ----------------------------------------------------------- | 176 | |
185 | Relocation section '.klp.rela.btrfs.text.btrfs_feature_attr_show' at offset 0x2ba0 contains 4 entries: | 177 | **`readelf --relocs` output for a patch module:** |
186 | Offset Info Type Symbol's Value Symbol's Name + Addend | 178 | |
187 | 000000000000001f 0000005e00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.printk,0 - 4 | 179 | :: |
188 | 0000000000000028 0000003d0000000b R_X86_64_32S 0000000000000000 .klp.sym.btrfs.btrfs_ktype,0 + 0 | 180 | |
189 | 0000000000000036 0000003b00000002 R_X86_64_PC32 0000000000000000 .klp.sym.btrfs.can_modify_feature.isra.3,0 - 4 | 181 | Relocation section '.klp.rela.btrfs.text.btrfs_feature_attr_show' at offset 0x2ba0 contains 4 entries: |
190 | 000000000000004c 0000004900000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.snprintf,0 - 4 | 182 | Offset Info Type Symbol's Value Symbol's Name + Addend |
191 | [ snip ] ^ | 183 | 000000000000001f 0000005e00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.printk,0 - 4 |
192 | | | 184 | 0000000000000028 0000003d0000000b R_X86_64_32S 0000000000000000 .klp.sym.btrfs.btrfs_ktype,0 + 0 |
193 | [*] | 185 | 0000000000000036 0000003b00000002 R_X86_64_PC32 0000000000000000 .klp.sym.btrfs.can_modify_feature.isra.3,0 - 4 |
194 | [*] Every symbol referenced by a relocation is a livepatch symbol. | 186 | 000000000000004c 0000004900000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.snprintf,0 - 4 |
195 | 187 | [ snip ] ^ | |
196 | -------------------- | 188 | | |
197 | 3. Livepatch symbols | 189 | [*] |
198 | -------------------- | 190 | |
199 | 191 | [*] | |
200 | ------------------------------- | 192 | Every symbol referenced by a relocation is a livepatch symbol. |
201 | 3.1 What are livepatch symbols? | 193 | |
202 | ------------------------------- | 194 | 4. Livepatch symbols |
195 | ==================== | ||
196 | |||
203 | Livepatch symbols are symbols referred to by livepatch relocation sections. | 197 | Livepatch symbols are symbols referred to by livepatch relocation sections. |
204 | These are symbols accessed from new versions of functions for patched | 198 | These are symbols accessed from new versions of functions for patched |
205 | objects, whose addresses cannot be resolved by the module loader (because | 199 | objects, whose addresses cannot be resolved by the module loader (because |
@@ -219,9 +213,8 @@ loader can identify and ignore them. Livepatch modules keep these symbols | |||
219 | in their symbol tables, and the symbol table is made accessible through | 213 | in their symbol tables, and the symbol table is made accessible through |
220 | module->symtab. | 214 | module->symtab. |
221 | 215 | ||
222 | ------------------------------------- | 216 | 4.1 A livepatch module's symbol table |
223 | 3.2 A livepatch module's symbol table | 217 | ===================================== |
224 | ------------------------------------- | ||
225 | Normally, a stripped down copy of a module's symbol table (containing only | 218 | Normally, a stripped down copy of a module's symbol table (containing only |
226 | "core" symbols) is made available through module->symtab (See layout_symtab() | 219 | "core" symbols) is made available through module->symtab (See layout_symtab() |
227 | in kernel/module.c). For livepatch modules, the symbol table copied into memory | 220 | in kernel/module.c). For livepatch modules, the symbol table copied into memory |
@@ -231,71 +224,82 @@ relocation section refer to their respective symbols with their symbol indices, | |||
231 | and the original symbol indices (and thus the symtab ordering) must be | 224 | and the original symbol indices (and thus the symtab ordering) must be |
232 | preserved in order for apply_relocate_add() to find the right symbol. | 225 | preserved in order for apply_relocate_add() to find the right symbol. |
233 | 226 | ||
234 | For example, take this particular rela from a livepatch module: | 227 | For example, take this particular rela from a livepatch module::: |
235 | Relocation section '.klp.rela.btrfs.text.btrfs_feature_attr_show' at offset 0x2ba0 contains 4 entries: | 228 | |
236 | Offset Info Type Symbol's Value Symbol's Name + Addend | 229 | Relocation section '.klp.rela.btrfs.text.btrfs_feature_attr_show' at offset 0x2ba0 contains 4 entries: |
237 | 000000000000001f 0000005e00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.printk,0 - 4 | 230 | Offset Info Type Symbol's Value Symbol's Name + Addend |
238 | 231 | 000000000000001f 0000005e00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.printk,0 - 4 | |
239 | This rela refers to the symbol '.klp.sym.vmlinux.printk,0', and the symbol index is encoded | 232 | |
240 | in 'Info'. Here its symbol index is 0x5e, which is 94 in decimal, which refers to the | 233 | This rela refers to the symbol '.klp.sym.vmlinux.printk,0', and the symbol index is encoded |
241 | symbol index 94. | 234 | in 'Info'. Here its symbol index is 0x5e, which is 94 in decimal, which refers to the |
242 | And in this patch module's corresponding symbol table, symbol index 94 refers to that very symbol: | 235 | symbol index 94. |
243 | [ snip ] | 236 | And in this patch module's corresponding symbol table, symbol index 94 refers to that very symbol: |
244 | 94: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.printk,0 | 237 | [ snip ] |
245 | [ snip ] | 238 | 94: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.printk,0 |
246 | 239 | [ snip ] | |
247 | --------------------------- | 240 | |
248 | 3.3 Livepatch symbol format | 241 | 4.2 Livepatch symbol format |
249 | --------------------------- | 242 | =========================== |
250 | 243 | ||
251 | 3.3.1 Required flags | ||
252 | -------------------- | ||
253 | Livepatch symbols must have their section index marked as SHN_LIVEPATCH, so | 244 | Livepatch symbols must have their section index marked as SHN_LIVEPATCH, so |
254 | that the module loader can identify them and not attempt to resolve them. | 245 | that the module loader can identify them and not attempt to resolve them. |
255 | See include/uapi/linux/elf.h for the actual definitions. | 246 | See include/uapi/linux/elf.h for the actual definitions. |
256 | 247 | ||
257 | 3.3.2 Required name format | 248 | Livepatch symbol names must conform to the following format:: |
258 | -------------------------- | 249 | |
259 | Livepatch symbol names must conform to the following format: | 250 | .klp.sym.objname.symbol_name,sympos |
260 | 251 | ^ ^^ ^ ^ ^ ^ | |
261 | .klp.sym.objname.symbol_name,sympos | 252 | |_______||_____| |_________| | |
262 | ^ ^^ ^ ^ ^ ^ | 253 | [A] [B] [C] [D] |
263 | |_______||_____| |_________| | | 254 | |
264 | [A] [B] [C] [D] | 255 | [A] |
265 | 256 | The symbol name is prefixed with the string ".klp.sym." | |
266 | [A] The symbol name is prefixed with the string ".klp.sym." | 257 | |
267 | [B] The name of the object (i.e. "vmlinux" or name of module) to | 258 | [B] |
268 | which the symbol belongs follows immediately after the prefix. | 259 | The name of the object (i.e. "vmlinux" or name of module) to |
269 | [C] The actual name of the symbol. | 260 | which the symbol belongs follows immediately after the prefix. |
270 | [D] The position of the symbol in the object (as according to kallsyms) | 261 | |
271 | This is used to differentiate duplicate symbols within the same | 262 | [C] |
272 | object. The symbol position is expressed numerically (0, 1, 2...). | 263 | The actual name of the symbol. |
273 | The symbol position of a unique symbol is 0. | 264 | |
274 | 265 | [D] | |
275 | 3.3.3 Example livepatch symbol names: | 266 | The position of the symbol in the object (as according to kallsyms) |
276 | ------------------------------------- | 267 | This is used to differentiate duplicate symbols within the same |
277 | .klp.sym.vmlinux.snprintf,0 | 268 | object. The symbol position is expressed numerically (0, 1, 2...). |
278 | .klp.sym.vmlinux.printk,0 | 269 | The symbol position of a unique symbol is 0. |
279 | .klp.sym.btrfs.btrfs_ktype,0 | 270 | |
280 | 271 | Examples: | |
281 | 3.3.4 Example `readelf --symbols` output for a patch module: | 272 | --------- |
282 | ------------------------------------------------------------ | 273 | |
283 | Symbol table '.symtab' contains 127 entries: | 274 | **Livepatch symbol names:** |
284 | Num: Value Size Type Bind Vis Ndx Name | 275 | |
285 | [ snip ] | 276 | :: |
286 | 73: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.snprintf,0 | 277 | |
287 | 74: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.capable,0 | 278 | .klp.sym.vmlinux.snprintf,0 |
288 | 75: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.find_next_bit,0 | 279 | .klp.sym.vmlinux.printk,0 |
289 | 76: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.si_swapinfo,0 | 280 | .klp.sym.btrfs.btrfs_ktype,0 |
290 | [ snip ] ^ | 281 | |
291 | | | 282 | **`readelf --symbols` output for a patch module:** |
292 | [*] | 283 | |
293 | [*] Note that the 'Ndx' (Section index) for these symbols is SHN_LIVEPATCH (0xff20). | 284 | :: |
294 | "OS" means OS-specific. | 285 | |
295 | 286 | Symbol table '.symtab' contains 127 entries: | |
296 | --------------------------------- | 287 | Num: Value Size Type Bind Vis Ndx Name |
297 | 4. Architecture-specific sections | 288 | [ snip ] |
298 | --------------------------------- | 289 | 73: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.snprintf,0 |
290 | 74: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.capable,0 | ||
291 | 75: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.find_next_bit,0 | ||
292 | 76: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.si_swapinfo,0 | ||
293 | [ snip ] ^ | ||
294 | | | ||
295 | [*] | ||
296 | |||
297 | [*] | ||
298 | Note that the 'Ndx' (Section index) for these symbols is SHN_LIVEPATCH (0xff20). | ||
299 | "OS" means OS-specific. | ||
300 | |||
301 | 5. Architecture-specific sections | ||
302 | ================================= | ||
299 | Architectures may override arch_klp_init_object_loaded() to perform | 303 | Architectures may override arch_klp_init_object_loaded() to perform |
300 | additional arch-specific tasks when a target module loads, such as applying | 304 | additional arch-specific tasks when a target module loads, such as applying |
301 | arch-specific sections. On x86 for example, we must apply per-object | 305 | arch-specific sections. On x86 for example, we must apply per-object |
@@ -304,20 +308,19 @@ These sections must be prefixed with ".klp.arch.$objname." so that they can | |||
304 | be easily identified when iterating through a patch module's Elf sections | 308 | be easily identified when iterating through a patch module's Elf sections |
305 | (See arch/x86/kernel/livepatch.c for a complete example). | 309 | (See arch/x86/kernel/livepatch.c for a complete example). |
306 | 310 | ||
307 | -------------------------------------- | 311 | 6. Symbol table and Elf section access |
308 | 5. Symbol table and Elf section access | 312 | ====================================== |
309 | -------------------------------------- | ||
310 | A livepatch module's symbol table is accessible through module->symtab. | 313 | A livepatch module's symbol table is accessible through module->symtab. |
311 | 314 | ||
312 | Since apply_relocate_add() requires access to a module's section headers, | 315 | Since apply_relocate_add() requires access to a module's section headers, |
313 | symbol table, and relocation section indices, Elf information is preserved for | 316 | symbol table, and relocation section indices, Elf information is preserved for |
314 | livepatch modules and is made accessible by the module loader through | 317 | livepatch modules and is made accessible by the module loader through |
315 | module->klp_info, which is a klp_modinfo struct. When a livepatch module loads, | 318 | module->klp_info, which is a klp_modinfo struct. When a livepatch module loads, |
316 | this struct is filled in by the module loader. Its fields are documented below: | 319 | this struct is filled in by the module loader. Its fields are documented below:: |
317 | 320 | ||
318 | struct klp_modinfo { | 321 | struct klp_modinfo { |
319 | Elf_Ehdr hdr; /* Elf header */ | 322 | Elf_Ehdr hdr; /* Elf header */ |
320 | Elf_Shdr *sechdrs; /* Section header table */ | 323 | Elf_Shdr *sechdrs; /* Section header table */ |
321 | char *secstrings; /* String table for the section headers */ | 324 | char *secstrings; /* String table for the section headers */ |
322 | unsigned int symndx; /* The symbol table section index */ | 325 | unsigned int symndx; /* The symbol table section index */ |
323 | }; | 326 | }; |
diff --git a/Documentation/livepatch/shadow-vars.txt b/Documentation/livepatch/shadow-vars.rst index ecc09a7be5dd..c05715aeafa4 100644 --- a/Documentation/livepatch/shadow-vars.txt +++ b/Documentation/livepatch/shadow-vars.rst | |||
@@ -27,10 +27,13 @@ A hashtable references all shadow variables. These references are | |||
27 | stored and retrieved through a <obj, id> pair. | 27 | stored and retrieved through a <obj, id> pair. |
28 | 28 | ||
29 | * The klp_shadow variable data structure encapsulates both tracking | 29 | * The klp_shadow variable data structure encapsulates both tracking |
30 | meta-data and shadow-data: | 30 | meta-data and shadow-data: |
31 | |||
31 | - meta-data | 32 | - meta-data |
33 | |||
32 | - obj - pointer to parent object | 34 | - obj - pointer to parent object |
33 | - id - data identifier | 35 | - id - data identifier |
36 | |||
34 | - data[] - storage for shadow data | 37 | - data[] - storage for shadow data |
35 | 38 | ||
36 | It is important to note that the klp_shadow_alloc() and | 39 | It is important to note that the klp_shadow_alloc() and |
@@ -47,31 +50,43 @@ to do actions that can be done only once when a new variable is allocated. | |||
47 | 50 | ||
48 | * klp_shadow_alloc() - allocate and add a new shadow variable | 51 | * klp_shadow_alloc() - allocate and add a new shadow variable |
49 | - search hashtable for <obj, id> pair | 52 | - search hashtable for <obj, id> pair |
53 | |||
50 | - if exists | 54 | - if exists |
55 | |||
51 | - WARN and return NULL | 56 | - WARN and return NULL |
57 | |||
52 | - if <obj, id> doesn't already exist | 58 | - if <obj, id> doesn't already exist |
59 | |||
53 | - allocate a new shadow variable | 60 | - allocate a new shadow variable |
54 | - initialize the variable using a custom constructor and data when provided | 61 | - initialize the variable using a custom constructor and data when provided |
55 | - add <obj, id> to the global hashtable | 62 | - add <obj, id> to the global hashtable |
56 | 63 | ||
57 | * klp_shadow_get_or_alloc() - get existing or alloc a new shadow variable | 64 | * klp_shadow_get_or_alloc() - get existing or alloc a new shadow variable |
58 | - search hashtable for <obj, id> pair | 65 | - search hashtable for <obj, id> pair |
66 | |||
59 | - if exists | 67 | - if exists |
68 | |||
60 | - return existing shadow variable | 69 | - return existing shadow variable |
70 | |||
61 | - if <obj, id> doesn't already exist | 71 | - if <obj, id> doesn't already exist |
72 | |||
62 | - allocate a new shadow variable | 73 | - allocate a new shadow variable |
63 | - initialize the variable using a custom constructor and data when provided | 74 | - initialize the variable using a custom constructor and data when provided |
64 | - add <obj, id> pair to the global hashtable | 75 | - add <obj, id> pair to the global hashtable |
65 | 76 | ||
66 | * klp_shadow_free() - detach and free a <obj, id> shadow variable | 77 | * klp_shadow_free() - detach and free a <obj, id> shadow variable |
67 | - find and remove a <obj, id> reference from global hashtable | 78 | - find and remove a <obj, id> reference from global hashtable |
79 | |||
68 | - if found | 80 | - if found |
81 | |||
69 | - call destructor function if defined | 82 | - call destructor function if defined |
70 | - free shadow variable | 83 | - free shadow variable |
71 | 84 | ||
72 | * klp_shadow_free_all() - detach and free all <*, id> shadow variables | 85 | * klp_shadow_free_all() - detach and free all <*, id> shadow variables |
73 | - find and remove any <*, id> references from global hashtable | 86 | - find and remove any <*, id> references from global hashtable |
87 | |||
74 | - if found | 88 | - if found |
89 | |||
75 | - call destructor function if defined | 90 | - call destructor function if defined |
76 | - free shadow variable | 91 | - free shadow variable |
77 | 92 | ||
@@ -102,12 +117,12 @@ parent "goes live" (ie, any shadow variable get-API requests are made | |||
102 | for this <obj, id> pair.) | 117 | for this <obj, id> pair.) |
103 | 118 | ||
104 | For commit 1d147bfa6429, when a parent sta_info structure is allocated, | 119 | For commit 1d147bfa6429, when a parent sta_info structure is allocated, |
105 | allocate a shadow copy of the ps_lock pointer, then initialize it: | 120 | allocate a shadow copy of the ps_lock pointer, then initialize it:: |
106 | 121 | ||
107 | #define PS_LOCK 1 | 122 | #define PS_LOCK 1 |
108 | struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | 123 | struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, |
109 | const u8 *addr, gfp_t gfp) | 124 | const u8 *addr, gfp_t gfp) |
110 | { | 125 | { |
111 | struct sta_info *sta; | 126 | struct sta_info *sta; |
112 | spinlock_t *ps_lock; | 127 | spinlock_t *ps_lock; |
113 | 128 | ||
@@ -123,10 +138,10 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
123 | ... | 138 | ... |
124 | 139 | ||
125 | When requiring a ps_lock, query the shadow variable API to retrieve one | 140 | When requiring a ps_lock, query the shadow variable API to retrieve one |
126 | for a specific struct sta_info: | 141 | for a specific struct sta_info::: |
127 | 142 | ||
128 | void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | 143 | void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) |
129 | { | 144 | { |
130 | spinlock_t *ps_lock; | 145 | spinlock_t *ps_lock; |
131 | 146 | ||
132 | /* sync with ieee80211_tx_h_unicast_ps_buf */ | 147 | /* sync with ieee80211_tx_h_unicast_ps_buf */ |
@@ -136,10 +151,10 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | |||
136 | ... | 151 | ... |
137 | 152 | ||
138 | When the parent sta_info structure is freed, first free the shadow | 153 | When the parent sta_info structure is freed, first free the shadow |
139 | variable: | 154 | variable:: |
140 | 155 | ||
141 | void sta_info_free(struct ieee80211_local *local, struct sta_info *sta) | 156 | void sta_info_free(struct ieee80211_local *local, struct sta_info *sta) |
142 | { | 157 | { |
143 | klp_shadow_free(sta, PS_LOCK, NULL); | 158 | klp_shadow_free(sta, PS_LOCK, NULL); |
144 | kfree(sta); | 159 | kfree(sta); |
145 | ... | 160 | ... |
@@ -155,19 +170,19 @@ these cases, the klp_shadow_get_or_alloc() call can be used to attach | |||
155 | shadow variables to parents already in-flight. | 170 | shadow variables to parents already in-flight. |
156 | 171 | ||
157 | For commit 1d147bfa6429, a good spot to allocate a shadow spinlock is | 172 | For commit 1d147bfa6429, a good spot to allocate a shadow spinlock is |
158 | inside ieee80211_sta_ps_deliver_wakeup(): | 173 | inside ieee80211_sta_ps_deliver_wakeup():: |
159 | 174 | ||
160 | int ps_lock_shadow_ctor(void *obj, void *shadow_data, void *ctor_data) | 175 | int ps_lock_shadow_ctor(void *obj, void *shadow_data, void *ctor_data) |
161 | { | 176 | { |
162 | spinlock_t *lock = shadow_data; | 177 | spinlock_t *lock = shadow_data; |
163 | 178 | ||
164 | spin_lock_init(lock); | 179 | spin_lock_init(lock); |
165 | return 0; | 180 | return 0; |
166 | } | 181 | } |
167 | 182 | ||
168 | #define PS_LOCK 1 | 183 | #define PS_LOCK 1 |
169 | void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | 184 | void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) |
170 | { | 185 | { |
171 | spinlock_t *ps_lock; | 186 | spinlock_t *ps_lock; |
172 | 187 | ||
173 | /* sync with ieee80211_tx_h_unicast_ps_buf */ | 188 | /* sync with ieee80211_tx_h_unicast_ps_buf */ |
@@ -200,10 +215,12 @@ suggests how to handle the parent object. | |||
200 | ============= | 215 | ============= |
201 | 216 | ||
202 | * https://github.com/dynup/kpatch | 217 | * https://github.com/dynup/kpatch |
203 | The livepatch implementation is based on the kpatch version of shadow | 218 | |
204 | variables. | 219 | The livepatch implementation is based on the kpatch version of shadow |
220 | variables. | ||
205 | 221 | ||
206 | * http://files.mkgnu.net/files/dynamos/doc/papers/dynamos_eurosys_07.pdf | 222 | * http://files.mkgnu.net/files/dynamos/doc/papers/dynamos_eurosys_07.pdf |
207 | Dynamic and Adaptive Updates of Non-Quiescent Subsystems in Commodity | 223 | |
208 | Operating System Kernels (Kritis Makris, Kyung Dong Ryu 2007) presented | 224 | Dynamic and Adaptive Updates of Non-Quiescent Subsystems in Commodity |
209 | a datatype update technique called "shadow data structures". | 225 | Operating System Kernels (Kritis Makris, Kyung Dong Ryu 2007) presented |
226 | a datatype update technique called "shadow data structures". | ||
diff --git a/Documentation/ntb.txt b/Documentation/ntb.txt index a043854d28df..074a423c853c 100644 --- a/Documentation/ntb.txt +++ b/Documentation/ntb.txt | |||
@@ -41,9 +41,10 @@ mainly used to perform the proper memory window initialization. Typically | |||
41 | there are two types of memory window interfaces supported by the NTB API: | 41 | there are two types of memory window interfaces supported by the NTB API: |
42 | inbound translation configured on the local ntb port and outbound translation | 42 | inbound translation configured on the local ntb port and outbound translation |
43 | configured by the peer, on the peer ntb port. The first type is | 43 | configured by the peer, on the peer ntb port. The first type is |
44 | depicted on the next figure | 44 | depicted on the next figure:: |
45 | |||
46 | Inbound translation: | ||
45 | 47 | ||
46 | Inbound translation: | ||
47 | Memory: Local NTB Port: Peer NTB Port: Peer MMIO: | 48 | Memory: Local NTB Port: Peer NTB Port: Peer MMIO: |
48 | ____________ | 49 | ____________ |
49 | | dma-mapped |-ntb_mw_set_trans(addr) | | 50 | | dma-mapped |-ntb_mw_set_trans(addr) | |
@@ -58,9 +59,10 @@ maps corresponding outbound memory window so to have access to the shared | |||
58 | memory region. | 59 | memory region. |
59 | 60 | ||
60 | The second type of interface, that implies the shared windows being | 61 | The second type of interface, that implies the shared windows being |
61 | initialized by a peer device, is depicted on the figure: | 62 | initialized by a peer device, is depicted on the figure:: |
63 | |||
64 | Outbound translation: | ||
62 | 65 | ||
63 | Outbound translation: | ||
64 | Memory: Local NTB Port: Peer NTB Port: Peer MMIO: | 66 | Memory: Local NTB Port: Peer NTB Port: Peer MMIO: |
65 | ____________ ______________ | 67 | ____________ ______________ |
66 | | dma-mapped | | | MW base addr |<== memory-mapped IO | 68 | | dma-mapped | | | MW base addr |<== memory-mapped IO |
@@ -75,11 +77,13 @@ outbound memory window so to have access to the shared memory region. | |||
75 | 77 | ||
76 | As one can see the described scenarios can be combined in one portable | 78 | As one can see the described scenarios can be combined in one portable |
77 | algorithm. | 79 | algorithm. |
80 | |||
78 | Local device: | 81 | Local device: |
79 | 1) Allocate memory for a shared window | 82 | 1) Allocate memory for a shared window |
80 | 2) Initialize memory window by translated address of the allocated region | 83 | 2) Initialize memory window by translated address of the allocated region |
81 | (it may fail if local memory window initialization is unsupported) | 84 | (it may fail if local memory window initialization is unsupported) |
82 | 3) Send the translated address and memory window index to a peer device | 85 | 3) Send the translated address and memory window index to a peer device |
86 | |||
83 | Peer device: | 87 | Peer device: |
84 | 1) Initialize memory window with retrieved address of the allocated | 88 | 1) Initialize memory window with retrieved address of the allocated |
85 | by another device memory region (it may fail if peer memory window | 89 | by another device memory region (it may fail if peer memory window |
@@ -88,6 +92,7 @@ algorithm. | |||
88 | 92 | ||
89 | In accordance with this scenario, the NTB Memory Window API can be used as | 93 | In accordance with this scenario, the NTB Memory Window API can be used as |
90 | follows: | 94 | follows: |
95 | |||
91 | Local device: | 96 | Local device: |
92 | 1) ntb_mw_count(pidx) - retrieve number of memory ranges, which can | 97 | 1) ntb_mw_count(pidx) - retrieve number of memory ranges, which can |
93 | be allocated for memory windows between local device and peer device | 98 | be allocated for memory windows between local device and peer device |
@@ -103,6 +108,7 @@ follows: | |||
103 | 5) Send translated base address (usually together with memory window | 108 | 5) Send translated base address (usually together with memory window |
104 | number) to the peer device using, for instance, scratchpad or message | 109 | number) to the peer device using, for instance, scratchpad or message |
105 | registers. | 110 | registers. |
111 | |||
106 | Peer device: | 112 | Peer device: |
107 | 1) ntb_peer_mw_set_trans(pidx, midx) - try to set received from other | 113 | 1) ntb_peer_mw_set_trans(pidx, midx) - try to set received from other |
108 | device (related to pidx) translated address for specified memory | 114 | device (related to pidx) translated address for specified memory |
diff --git a/Documentation/process/5.Posting.rst b/Documentation/process/5.Posting.rst index 4213e580f273..855a70b80269 100644 --- a/Documentation/process/5.Posting.rst +++ b/Documentation/process/5.Posting.rst | |||
@@ -216,10 +216,12 @@ The tags in common use are: | |||
216 | which can be found in :ref:`Documentation/process/submitting-patches.rst <submittingpatches>` | 216 | which can be found in :ref:`Documentation/process/submitting-patches.rst <submittingpatches>` |
217 | Code without a proper signoff cannot be merged into the mainline. | 217 | Code without a proper signoff cannot be merged into the mainline. |
218 | 218 | ||
219 | - Co-developed-by: states that the patch was also created by another developer | 219 | - Co-developed-by: states that the patch was co-created by several developers; |
220 | along with the original author. This is useful at times when multiple | 220 | it is a used to give attribution to co-authors (in addition to the author |
221 | people work on a single patch. Note, this person also needs to have a | 221 | attributed by the From: tag) when multiple people work on a single patch. |
222 | Signed-off-by: line in the patch as well. | 222 | Every Co-developed-by: must be immediately followed by a Signed-off-by: of |
223 | the associated co-author. Details and examples can be found in | ||
224 | :ref:`Documentation/process/submitting-patches.rst <submittingpatches>`. | ||
223 | 225 | ||
224 | - Acked-by: indicates an agreement by another developer (often a | 226 | - Acked-by: indicates an agreement by another developer (often a |
225 | maintainer of the relevant code) that the patch is appropriate for | 227 | maintainer of the relevant code) that the patch is appropriate for |
diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst index 8ea913e99fa1..fa864a51e6ea 100644 --- a/Documentation/process/coding-style.rst +++ b/Documentation/process/coding-style.rst | |||
@@ -843,7 +843,8 @@ used. | |||
843 | The kernel provides the following general purpose memory allocators: | 843 | The kernel provides the following general purpose memory allocators: |
844 | kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), and | 844 | kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), and |
845 | vzalloc(). Please refer to the API documentation for further information | 845 | vzalloc(). Please refer to the API documentation for further information |
846 | about them. | 846 | about them. :ref:`Documentation/core-api/memory-allocation.rst |
847 | <memory_allocation>` | ||
847 | 848 | ||
848 | The preferred form for passing a size of a struct is the following: | 849 | The preferred form for passing a size of a struct is the following: |
849 | 850 | ||
@@ -874,6 +875,9 @@ The preferred form for allocating a zeroed array is the following: | |||
874 | Both forms check for overflow on the allocation size n * sizeof(...), | 875 | Both forms check for overflow on the allocation size n * sizeof(...), |
875 | and return NULL if that occurred. | 876 | and return NULL if that occurred. |
876 | 877 | ||
878 | These generic allocation functions all emit a stack dump on failure when used | ||
879 | without __GFP_NOWARN so there is no use in emitting an additional failure | ||
880 | message when NULL is returned. | ||
877 | 881 | ||
878 | 15) The inline disease | 882 | 15) The inline disease |
879 | ---------------------- | 883 | ---------------------- |
diff --git a/Documentation/process/deprecated.rst b/Documentation/process/deprecated.rst index 0ef5a63c06ba..49e0f64a3427 100644 --- a/Documentation/process/deprecated.rst +++ b/Documentation/process/deprecated.rst | |||
@@ -1,5 +1,7 @@ | |||
1 | .. SPDX-License-Identifier: GPL-2.0 | 1 | .. SPDX-License-Identifier: GPL-2.0 |
2 | 2 | ||
3 | .. _deprecated: | ||
4 | |||
3 | ===================================================================== | 5 | ===================================================================== |
4 | Deprecated Interfaces, Language Features, Attributes, and Conventions | 6 | Deprecated Interfaces, Language Features, Attributes, and Conventions |
5 | ===================================================================== | 7 | ===================================================================== |
diff --git a/Documentation/process/howto.rst b/Documentation/process/howto.rst index ad2b6c852b95..6ab75c11d2c3 100644 --- a/Documentation/process/howto.rst +++ b/Documentation/process/howto.rst | |||
@@ -62,7 +62,7 @@ Legal Issues | |||
62 | The Linux kernel source code is released under the GPL. Please see the file | 62 | The Linux kernel source code is released under the GPL. Please see the file |
63 | COPYING in the main directory of the source tree. The Linux kernel licensing | 63 | COPYING in the main directory of the source tree. The Linux kernel licensing |
64 | rules and how to use `SPDX <https://spdx.org/>`_ identifiers in source code are | 64 | rules and how to use `SPDX <https://spdx.org/>`_ identifiers in source code are |
65 | descibed in :ref:`Documentation/process/license-rules.rst <kernel_licensing>`. | 65 | described in :ref:`Documentation/process/license-rules.rst <kernel_licensing>`. |
66 | If you have further questions about the license, please contact a lawyer, and do | 66 | If you have further questions about the license, please contact a lawyer, and do |
67 | not ask on the Linux kernel mailing list. The people on the mailing lists are | 67 | not ask on the Linux kernel mailing list. The people on the mailing lists are |
68 | not lawyers, and you should not rely on their statements on legal matters. | 68 | not lawyers, and you should not rely on their statements on legal matters. |
diff --git a/Documentation/process/kernel-docs.rst b/Documentation/process/kernel-docs.rst index ab12dddc773e..7a45a8e36ea7 100644 --- a/Documentation/process/kernel-docs.rst +++ b/Documentation/process/kernel-docs.rst | |||
@@ -95,18 +95,6 @@ On-line docs | |||
95 | [...]. This paper examines some common problems for | 95 | [...]. This paper examines some common problems for |
96 | submitting larger changes and some strategies to avoid problems. | 96 | submitting larger changes and some strategies to avoid problems. |
97 | 97 | ||
98 | * Title: **Overview of the Virtual File System** | ||
99 | |||
100 | :Author: Richard Gooch. | ||
101 | :URL: http://www.mjmwired.net/kernel/Documentation/filesystems/vfs.txt | ||
102 | :Date: 2007 | ||
103 | :Keywords: VFS, File System, mounting filesystems, opening files, | ||
104 | dentries, dcache. | ||
105 | :Description: Brief introduction to the Linux Virtual File System. | ||
106 | What is it, how it works, operations taken when opening a file or | ||
107 | mounting a file system and description of important data | ||
108 | structures explaining the purpose of each of their entries. | ||
109 | |||
110 | * Title: **Linux Device Drivers, Third Edition** | 98 | * Title: **Linux Device Drivers, Third Edition** |
111 | 99 | ||
112 | :Author: Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman | 100 | :Author: Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman |
diff --git a/Documentation/process/license-rules.rst b/Documentation/process/license-rules.rst index 6b09033a8e9e..2ef44ada3f11 100644 --- a/Documentation/process/license-rules.rst +++ b/Documentation/process/license-rules.rst | |||
@@ -234,13 +234,13 @@ kernel, can be broken down into: | |||
234 | 234 | ||
235 | | | 235 | | |
236 | 236 | ||
237 | 2. Not recommended licenses: | 237 | 2. Deprecated licenses: |
238 | 238 | ||
239 | These licenses should only be used for existing code or for importing | 239 | These licenses should only be used for existing code or for importing |
240 | code from a different project. These licenses are available from the | 240 | code from a different project. These licenses are available from the |
241 | directory:: | 241 | directory:: |
242 | 242 | ||
243 | LICENSES/other/ | 243 | LICENSES/deprecated/ |
244 | 244 | ||
245 | in the kernel source tree. | 245 | in the kernel source tree. |
246 | 246 | ||
@@ -250,14 +250,14 @@ kernel, can be broken down into: | |||
250 | 250 | ||
251 | Examples:: | 251 | Examples:: |
252 | 252 | ||
253 | LICENSES/other/ISC | 253 | LICENSES/deprecated/ISC |
254 | 254 | ||
255 | Contains the Internet Systems Consortium license text and the required | 255 | Contains the Internet Systems Consortium license text and the required |
256 | metatags:: | 256 | metatags:: |
257 | 257 | ||
258 | LICENSES/other/ZLib | 258 | LICENSES/deprecated/GPL-1.0 |
259 | 259 | ||
260 | Contains the ZLIB license text and the required metatags. | 260 | Contains the GPL version 1 license text and the required metatags. |
261 | 261 | ||
262 | Metatags: | 262 | Metatags: |
263 | 263 | ||
@@ -281,7 +281,56 @@ kernel, can be broken down into: | |||
281 | 281 | ||
282 | | | 282 | | |
283 | 283 | ||
284 | 3. _`Exceptions`: | 284 | 3. Dual Licensing Only |
285 | |||
286 | These licenses should only be used to dual license code with another | ||
287 | license in addition to a preferred license. These licenses are available | ||
288 | from the directory:: | ||
289 | |||
290 | LICENSES/dual/ | ||
291 | |||
292 | in the kernel source tree. | ||
293 | |||
294 | The files in this directory contain the full license text and | ||
295 | `Metatags`_. The file names are identical to the SPDX license | ||
296 | identifier which shall be used for the license in source files. | ||
297 | |||
298 | Examples:: | ||
299 | |||
300 | LICENSES/dual/MPL-1.1 | ||
301 | |||
302 | Contains the Mozilla Public License version 1.1 license text and the | ||
303 | required metatags:: | ||
304 | |||
305 | LICENSES/dual/Apache-2.0 | ||
306 | |||
307 | Contains the Apache License version 2.0 license text and the required | ||
308 | metatags. | ||
309 | |||
310 | Metatags: | ||
311 | |||
312 | The metatag requirements for 'other' licenses are identical to the | ||
313 | requirements of the `Preferred licenses`_. | ||
314 | |||
315 | File format example:: | ||
316 | |||
317 | Valid-License-Identifier: MPL-1.1 | ||
318 | SPDX-URL: https://spdx.org/licenses/MPL-1.1.html | ||
319 | Usage-Guide: | ||
320 | Do NOT use. The MPL-1.1 is not GPL2 compatible. It may only be used for | ||
321 | dual-licensed files where the other license is GPL2 compatible. | ||
322 | If you end up using this it MUST be used together with a GPL2 compatible | ||
323 | license using "OR". | ||
324 | To use the Mozilla Public License version 1.1 put the following SPDX | ||
325 | tag/value pair into a comment according to the placement guidelines in | ||
326 | the licensing rules documentation: | ||
327 | SPDX-License-Identifier: MPL-1.1 | ||
328 | License-Text: | ||
329 | Full license text | ||
330 | |||
331 | | | ||
332 | |||
333 | 4. _`Exceptions`: | ||
285 | 334 | ||
286 | Some licenses can be amended with exceptions which grant certain rights | 335 | Some licenses can be amended with exceptions which grant certain rights |
287 | which the original license does not. These exceptions are available | 336 | which the original license does not. These exceptions are available |
diff --git a/Documentation/process/maintainer-pgp-guide.rst b/Documentation/process/maintainer-pgp-guide.rst index aff9b1a4d77b..4bab7464ff8c 100644 --- a/Documentation/process/maintainer-pgp-guide.rst +++ b/Documentation/process/maintainer-pgp-guide.rst | |||
@@ -943,7 +943,7 @@ have on your keyring:: | |||
943 | 943 | ||
944 | Next, open the `PGP pathfinder`_. In the "From" field, paste the key | 944 | Next, open the `PGP pathfinder`_. In the "From" field, paste the key |
945 | fingerprint of Linus Torvalds from the output above. In the "To" field, | 945 | fingerprint of Linus Torvalds from the output above. In the "To" field, |
946 | paste they key-id you found via ``gpg --search`` of the unknown key, and | 946 | paste the key-id you found via ``gpg --search`` of the unknown key, and |
947 | check the results: | 947 | check the results: |
948 | 948 | ||
949 | - `Finding paths to Linus`_ | 949 | - `Finding paths to Linus`_ |
diff --git a/Documentation/process/submitting-patches.rst b/Documentation/process/submitting-patches.rst index be7d1829c3af..9c4299293c72 100644 --- a/Documentation/process/submitting-patches.rst +++ b/Documentation/process/submitting-patches.rst | |||
@@ -60,8 +60,8 @@ not in any lower subdirectory. | |||
60 | 60 | ||
61 | To create a patch for a single file, it is often sufficient to do:: | 61 | To create a patch for a single file, it is often sufficient to do:: |
62 | 62 | ||
63 | SRCTREE= linux | 63 | SRCTREE=linux |
64 | MYFILE= drivers/net/mydriver.c | 64 | MYFILE=drivers/net/mydriver.c |
65 | 65 | ||
66 | cd $SRCTREE | 66 | cd $SRCTREE |
67 | cp $MYFILE $MYFILE.orig | 67 | cp $MYFILE $MYFILE.orig |
@@ -73,7 +73,7 @@ To create a patch for multiple files, you should unpack a "vanilla", | |||
73 | or unmodified kernel source tree, and generate a ``diff`` against your | 73 | or unmodified kernel source tree, and generate a ``diff`` against your |
74 | own source tree. For example:: | 74 | own source tree. For example:: |
75 | 75 | ||
76 | MYSRC= /devel/linux | 76 | MYSRC=/devel/linux |
77 | 77 | ||
78 | tar xvfz linux-3.19.tar.gz | 78 | tar xvfz linux-3.19.tar.gz |
79 | mv linux-3.19 linux-3.19-vanilla | 79 | mv linux-3.19 linux-3.19-vanilla |
@@ -545,10 +545,40 @@ person it names - but it should indicate that this person was copied on the | |||
545 | patch. This tag documents that potentially interested parties | 545 | patch. This tag documents that potentially interested parties |
546 | have been included in the discussion. | 546 | have been included in the discussion. |
547 | 547 | ||
548 | A Co-developed-by: states that the patch was also created by another developer | 548 | Co-developed-by: states that the patch was co-created by multiple developers; |
549 | along with the original author. This is useful at times when multiple people | 549 | it is a used to give attribution to co-authors (in addition to the author |
550 | work on a single patch. Note, this person also needs to have a Signed-off-by: | 550 | attributed by the From: tag) when several people work on a single patch. Since |
551 | line in the patch as well. | 551 | Co-developed-by: denotes authorship, every Co-developed-by: must be immediately |
552 | followed by a Signed-off-by: of the associated co-author. Standard sign-off | ||
553 | procedure applies, i.e. the ordering of Signed-off-by: tags should reflect the | ||
554 | chronological history of the patch insofar as possible, regardless of whether | ||
555 | the author is attributed via From: or Co-developed-by:. Notably, the last | ||
556 | Signed-off-by: must always be that of the developer submitting the patch. | ||
557 | |||
558 | Note, the From: tag is optional when the From: author is also the person (and | ||
559 | email) listed in the From: line of the email header. | ||
560 | |||
561 | Example of a patch submitted by the From: author:: | ||
562 | |||
563 | <changelog> | ||
564 | |||
565 | Co-developed-by: First Co-Author <first@coauthor.example.org> | ||
566 | Signed-off-by: First Co-Author <first@coauthor.example.org> | ||
567 | Co-developed-by: Second Co-Author <second@coauthor.example.org> | ||
568 | Signed-off-by: Second Co-Author <second@coauthor.example.org> | ||
569 | Signed-off-by: From Author <from@author.example.org> | ||
570 | |||
571 | Example of a patch submitted by a Co-developed-by: author:: | ||
572 | |||
573 | From: From Author <from@author.example.org> | ||
574 | |||
575 | <changelog> | ||
576 | |||
577 | Co-developed-by: Random Co-Author <random@coauthor.example.org> | ||
578 | Signed-off-by: Random Co-Author <random@coauthor.example.org> | ||
579 | Signed-off-by: From Author <from@author.example.org> | ||
580 | Co-developed-by: Submitting Co-Author <sub@coauthor.example.org> | ||
581 | Signed-off-by: Submitting Co-Author <sub@coauthor.example.org> | ||
552 | 582 | ||
553 | 583 | ||
554 | 13) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes: | 584 | 13) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes: |
@@ -696,7 +726,7 @@ A couple of example Subjects:: | |||
696 | The ``from`` line must be the very first line in the message body, | 726 | The ``from`` line must be the very first line in the message body, |
697 | and has the form: | 727 | and has the form: |
698 | 728 | ||
699 | From: Original Author <author@example.com> | 729 | From: Patch Author <author@example.com> |
700 | 730 | ||
701 | The ``from`` line specifies who will be credited as the author of the | 731 | The ``from`` line specifies who will be credited as the author of the |
702 | patch in the permanent changelog. If the ``from`` line is missing, | 732 | patch in the permanent changelog. If the ``from`` line is missing, |
diff --git a/Documentation/rtc.txt b/Documentation/rtc.txt index a129acf38537..688c95b11919 100644 --- a/Documentation/rtc.txt +++ b/Documentation/rtc.txt | |||
@@ -136,5 +136,5 @@ a high functionality RTC is integrated into the SOC. That system might read | |||
136 | the system clock from the discrete RTC, but use the integrated one for all | 136 | the system clock from the discrete RTC, but use the integrated one for all |
137 | other tasks, because of its greater functionality. | 137 | other tasks, because of its greater functionality. |
138 | 138 | ||
139 | Check out tools/testing/selftests/timers/rtctest.c for an example usage of the | 139 | Check out tools/testing/selftests/rtc/rtctest.c for an example usage of the |
140 | ioctl interface. | 140 | ioctl interface. |
diff --git a/Documentation/speculation.txt b/Documentation/speculation.txt index e9e6cbae2841..50d7ea857cff 100644 --- a/Documentation/speculation.txt +++ b/Documentation/speculation.txt | |||
@@ -17,7 +17,7 @@ observed to extract secret information. | |||
17 | 17 | ||
18 | For example, in the presence of branch prediction, it is possible for bounds | 18 | For example, in the presence of branch prediction, it is possible for bounds |
19 | checks to be ignored by code which is speculatively executed. Consider the | 19 | checks to be ignored by code which is speculatively executed. Consider the |
20 | following code: | 20 | following code:: |
21 | 21 | ||
22 | int load_array(int *array, unsigned int index) | 22 | int load_array(int *array, unsigned int index) |
23 | { | 23 | { |
@@ -27,7 +27,7 @@ following code: | |||
27 | return array[index]; | 27 | return array[index]; |
28 | } | 28 | } |
29 | 29 | ||
30 | Which, on arm64, may be compiled to an assembly sequence such as: | 30 | Which, on arm64, may be compiled to an assembly sequence such as:: |
31 | 31 | ||
32 | CMP <index>, #MAX_ARRAY_ELEMS | 32 | CMP <index>, #MAX_ARRAY_ELEMS |
33 | B.LT less | 33 | B.LT less |
@@ -44,7 +44,7 @@ microarchitectural state which can be subsequently measured. | |||
44 | 44 | ||
45 | More complex sequences involving multiple dependent memory accesses may | 45 | More complex sequences involving multiple dependent memory accesses may |
46 | result in sensitive information being leaked. Consider the following | 46 | result in sensitive information being leaked. Consider the following |
47 | code, building on the prior example: | 47 | code, building on the prior example:: |
48 | 48 | ||
49 | int load_dependent_arrays(int *arr1, int *arr2, int index) | 49 | int load_dependent_arrays(int *arr1, int *arr2, int index) |
50 | { | 50 | { |
@@ -77,7 +77,7 @@ A call to array_index_nospec(index, size) returns a sanitized index | |||
77 | value that is bounded to [0, size) even under cpu speculation | 77 | value that is bounded to [0, size) even under cpu speculation |
78 | conditions. | 78 | conditions. |
79 | 79 | ||
80 | This can be used to protect the earlier load_array() example: | 80 | This can be used to protect the earlier load_array() example:: |
81 | 81 | ||
82 | int load_array(int *array, unsigned int index) | 82 | int load_array(int *array, unsigned int index) |
83 | { | 83 | { |
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt index aa058aa7bf28..f0c86fbb3b48 100644 --- a/Documentation/sysctl/kernel.txt +++ b/Documentation/sysctl/kernel.txt | |||
@@ -196,7 +196,7 @@ CAP_LAST_CAP from the kernel. | |||
196 | core_pattern: | 196 | core_pattern: |
197 | 197 | ||
198 | core_pattern is used to specify a core dumpfile pattern name. | 198 | core_pattern is used to specify a core dumpfile pattern name. |
199 | . max length 128 characters; default value is "core" | 199 | . max length 127 characters; default value is "core" |
200 | . core_pattern is used as a pattern template for the output filename; | 200 | . core_pattern is used as a pattern template for the output filename; |
201 | certain string patterns (beginning with '%') are substituted with | 201 | certain string patterns (beginning with '%') are substituted with |
202 | their actual values. | 202 | their actual values. |
diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst index 7c5e6d6ab5d1..c3b9bd2fd512 100644 --- a/Documentation/trace/ftrace.rst +++ b/Documentation/trace/ftrace.rst | |||
@@ -1404,6 +1404,7 @@ trace has provided some very helpful debugging information. | |||
1404 | 1404 | ||
1405 | If we prefer function graph output instead of function, we can set | 1405 | If we prefer function graph output instead of function, we can set |
1406 | display-graph option:: | 1406 | display-graph option:: |
1407 | |||
1407 | with echo 1 > options/display-graph | 1408 | with echo 1 > options/display-graph |
1408 | 1409 | ||
1409 | # tracer: irqsoff | 1410 | # tracer: irqsoff |
diff --git a/Documentation/trace/histogram.rst b/Documentation/trace/histogram.rst index 0ea59d45aef1..f95d94d19c22 100644 --- a/Documentation/trace/histogram.rst +++ b/Documentation/trace/histogram.rst | |||
@@ -2133,33 +2133,33 @@ The following commonly-used handler.action pairs are available: | |||
2133 | the end the event that triggered the snapshot (in this case you | 2133 | the end the event that triggered the snapshot (in this case you |
2134 | can verify the timestamps between the sched_waking and | 2134 | can verify the timestamps between the sched_waking and |
2135 | sched_switch events, which should match the time displayed in the | 2135 | sched_switch events, which should match the time displayed in the |
2136 | global maximum): | 2136 | global maximum):: |
2137 | 2137 | ||
2138 | # cat /sys/kernel/debug/tracing/snapshot | 2138 | # cat /sys/kernel/debug/tracing/snapshot |
2139 | 2139 | ||
2140 | <...>-2103 [005] d..3 309.873125: sched_switch: prev_comm=cyclictest prev_pid=2103 prev_prio=19 prev_state=D ==> next_comm=swapper/5 next_pid=0 next_prio=120 | 2140 | <...>-2103 [005] d..3 309.873125: sched_switch: prev_comm=cyclictest prev_pid=2103 prev_prio=19 prev_state=D ==> next_comm=swapper/5 next_pid=0 next_prio=120 |
2141 | <idle>-0 [005] d.h3 309.873611: sched_waking: comm=cyclictest pid=2102 prio=19 target_cpu=005 | 2141 | <idle>-0 [005] d.h3 309.873611: sched_waking: comm=cyclictest pid=2102 prio=19 target_cpu=005 |
2142 | <idle>-0 [005] dNh4 309.873613: sched_wakeup: comm=cyclictest pid=2102 prio=19 target_cpu=005 | 2142 | <idle>-0 [005] dNh4 309.873613: sched_wakeup: comm=cyclictest pid=2102 prio=19 target_cpu=005 |
2143 | <idle>-0 [005] d..3 309.873616: sched_switch: prev_comm=swapper/5 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2102 next_prio=19 | 2143 | <idle>-0 [005] d..3 309.873616: sched_switch: prev_comm=swapper/5 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2102 next_prio=19 |
2144 | <...>-2102 [005] d..3 309.873625: sched_switch: prev_comm=cyclictest prev_pid=2102 prev_prio=19 prev_state=D ==> next_comm=swapper/5 next_pid=0 next_prio=120 | 2144 | <...>-2102 [005] d..3 309.873625: sched_switch: prev_comm=cyclictest prev_pid=2102 prev_prio=19 prev_state=D ==> next_comm=swapper/5 next_pid=0 next_prio=120 |
2145 | <idle>-0 [005] d.h3 309.874624: sched_waking: comm=cyclictest pid=2102 prio=19 target_cpu=005 | 2145 | <idle>-0 [005] d.h3 309.874624: sched_waking: comm=cyclictest pid=2102 prio=19 target_cpu=005 |
2146 | <idle>-0 [005] dNh4 309.874626: sched_wakeup: comm=cyclictest pid=2102 prio=19 target_cpu=005 | 2146 | <idle>-0 [005] dNh4 309.874626: sched_wakeup: comm=cyclictest pid=2102 prio=19 target_cpu=005 |
2147 | <idle>-0 [005] dNh3 309.874628: sched_waking: comm=cyclictest pid=2103 prio=19 target_cpu=005 | 2147 | <idle>-0 [005] dNh3 309.874628: sched_waking: comm=cyclictest pid=2103 prio=19 target_cpu=005 |
2148 | <idle>-0 [005] dNh4 309.874630: sched_wakeup: comm=cyclictest pid=2103 prio=19 target_cpu=005 | 2148 | <idle>-0 [005] dNh4 309.874630: sched_wakeup: comm=cyclictest pid=2103 prio=19 target_cpu=005 |
2149 | <idle>-0 [005] d..3 309.874633: sched_switch: prev_comm=swapper/5 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2102 next_prio=19 | 2149 | <idle>-0 [005] d..3 309.874633: sched_switch: prev_comm=swapper/5 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2102 next_prio=19 |
2150 | <idle>-0 [004] d.h3 309.874757: sched_waking: comm=gnome-terminal- pid=1699 prio=120 target_cpu=004 | 2150 | <idle>-0 [004] d.h3 309.874757: sched_waking: comm=gnome-terminal- pid=1699 prio=120 target_cpu=004 |
2151 | <idle>-0 [004] dNh4 309.874762: sched_wakeup: comm=gnome-terminal- pid=1699 prio=120 target_cpu=004 | 2151 | <idle>-0 [004] dNh4 309.874762: sched_wakeup: comm=gnome-terminal- pid=1699 prio=120 target_cpu=004 |
2152 | <idle>-0 [004] d..3 309.874766: sched_switch: prev_comm=swapper/4 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=gnome-terminal- next_pid=1699 next_prio=120 | 2152 | <idle>-0 [004] d..3 309.874766: sched_switch: prev_comm=swapper/4 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=gnome-terminal- next_pid=1699 next_prio=120 |
2153 | gnome-terminal--1699 [004] d.h2 309.874941: sched_stat_runtime: comm=gnome-terminal- pid=1699 runtime=180706 [ns] vruntime=1126870572 [ns] | 2153 | gnome-terminal--1699 [004] d.h2 309.874941: sched_stat_runtime: comm=gnome-terminal- pid=1699 runtime=180706 [ns] vruntime=1126870572 [ns] |
2154 | <idle>-0 [003] d.s4 309.874956: sched_waking: comm=rcu_sched pid=9 prio=120 target_cpu=007 | 2154 | <idle>-0 [003] d.s4 309.874956: sched_waking: comm=rcu_sched pid=9 prio=120 target_cpu=007 |
2155 | <idle>-0 [003] d.s5 309.874960: sched_wake_idle_without_ipi: cpu=7 | 2155 | <idle>-0 [003] d.s5 309.874960: sched_wake_idle_without_ipi: cpu=7 |
2156 | <idle>-0 [003] d.s5 309.874961: sched_wakeup: comm=rcu_sched pid=9 prio=120 target_cpu=007 | 2156 | <idle>-0 [003] d.s5 309.874961: sched_wakeup: comm=rcu_sched pid=9 prio=120 target_cpu=007 |
2157 | <idle>-0 [007] d..3 309.874963: sched_switch: prev_comm=swapper/7 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=rcu_sched next_pid=9 next_prio=120 | 2157 | <idle>-0 [007] d..3 309.874963: sched_switch: prev_comm=swapper/7 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=rcu_sched next_pid=9 next_prio=120 |
2158 | rcu_sched-9 [007] d..3 309.874973: sched_stat_runtime: comm=rcu_sched pid=9 runtime=13646 [ns] vruntime=22531430286 [ns] | 2158 | rcu_sched-9 [007] d..3 309.874973: sched_stat_runtime: comm=rcu_sched pid=9 runtime=13646 [ns] vruntime=22531430286 [ns] |
2159 | rcu_sched-9 [007] d..3 309.874978: sched_switch: prev_comm=rcu_sched prev_pid=9 prev_prio=120 prev_state=R+ ==> next_comm=swapper/7 next_pid=0 next_prio=120 | 2159 | rcu_sched-9 [007] d..3 309.874978: sched_switch: prev_comm=rcu_sched prev_pid=9 prev_prio=120 prev_state=R+ ==> next_comm=swapper/7 next_pid=0 next_prio=120 |
2160 | <...>-2102 [005] d..4 309.874994: sched_migrate_task: comm=cyclictest pid=2103 prio=19 orig_cpu=5 dest_cpu=1 | 2160 | <...>-2102 [005] d..4 309.874994: sched_migrate_task: comm=cyclictest pid=2103 prio=19 orig_cpu=5 dest_cpu=1 |
2161 | <...>-2102 [005] d..4 309.875185: sched_wake_idle_without_ipi: cpu=1 | 2161 | <...>-2102 [005] d..4 309.875185: sched_wake_idle_without_ipi: cpu=1 |
2162 | <idle>-0 [001] d..3 309.875200: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2103 next_prio=19 | 2162 | <idle>-0 [001] d..3 309.875200: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2103 next_prio=19 |
2163 | 2163 | ||
2164 | - onchange(var).save(field,.. .) | 2164 | - onchange(var).save(field,.. .) |
2165 | 2165 | ||
@@ -2213,9 +2213,10 @@ The following commonly-used handler.action pairs are available: | |||
2213 | following the rest of the fields. | 2213 | following the rest of the fields. |
2214 | 2214 | ||
2215 | If a snaphot was taken, there is also a message indicating that, | 2215 | If a snaphot was taken, there is also a message indicating that, |
2216 | along with the value and event that triggered the snapshot: | 2216 | along with the value and event that triggered the snapshot:: |
2217 | |||
2218 | # cat /sys/kernel/debug/tracing/events/tcp/tcp_probe/hist | ||
2217 | 2219 | ||
2218 | # cat /sys/kernel/debug/tracing/events/tcp/tcp_probe/hist | ||
2219 | { dport: 1521 } hitcount: 8 | 2220 | { dport: 1521 } hitcount: 8 |
2220 | changed: 10 snd_wnd: 35456 srtt: 154262 rcv_wnd: 42112 | 2221 | changed: 10 snd_wnd: 35456 srtt: 154262 rcv_wnd: 42112 |
2221 | 2222 | ||
@@ -2228,14 +2229,15 @@ The following commonly-used handler.action pairs are available: | |||
2228 | { dport: 443 } hitcount: 211 | 2229 | { dport: 443 } hitcount: 211 |
2229 | changed: 10 snd_wnd: 26960 srtt: 17379 rcv_wnd: 28800 | 2230 | changed: 10 snd_wnd: 26960 srtt: 17379 rcv_wnd: 28800 |
2230 | 2231 | ||
2231 | Snapshot taken (see tracing/snapshot). Details: | 2232 | Snapshot taken (see tracing/snapshot). Details:: |
2233 | |||
2232 | triggering value { onchange($cwnd) }: 10 | 2234 | triggering value { onchange($cwnd) }: 10 |
2233 | triggered by event with key: { dport: 80 } | 2235 | triggered by event with key: { dport: 80 } |
2234 | 2236 | ||
2235 | Totals: | 2237 | Totals: |
2236 | Hits: 414 | 2238 | Hits: 414 |
2237 | Entries: 4 | 2239 | Entries: 4 |
2238 | Dropped: 0 | 2240 | Dropped: 0 |
2239 | 2241 | ||
2240 | In the above case, the event that triggered the snapshot has the | 2242 | In the above case, the event that triggered the snapshot has the |
2241 | key with dport == 80. If you look at the bucket that has 80 as | 2243 | key with dport == 80. If you look at the bucket that has 80 as |
@@ -2245,18 +2247,18 @@ The following commonly-used handler.action pairs are available: | |||
2245 | the global snapshot). | 2247 | the global snapshot). |
2246 | 2248 | ||
2247 | And finally, looking at the snapshot data should show at or near | 2249 | And finally, looking at the snapshot data should show at or near |
2248 | the end the event that triggered the snapshot: | 2250 | the end the event that triggered the snapshot:: |
2249 | 2251 | ||
2250 | # cat /sys/kernel/debug/tracing/snapshot | 2252 | # cat /sys/kernel/debug/tracing/snapshot |
2251 | 2253 | ||
2252 | gnome-shell-1261 [006] dN.3 49.823113: sched_stat_runtime: comm=gnome-shell pid=1261 runtime=49347 [ns] vruntime=1835730389 [ns] | 2254 | gnome-shell-1261 [006] dN.3 49.823113: sched_stat_runtime: comm=gnome-shell pid=1261 runtime=49347 [ns] vruntime=1835730389 [ns] |
2253 | kworker/u16:4-773 [003] d..3 49.823114: sched_switch: prev_comm=kworker/u16:4 prev_pid=773 prev_prio=120 prev_state=R+ ==> next_comm=kworker/3:2 next_pid=135 next_prio=120 | 2255 | kworker/u16:4-773 [003] d..3 49.823114: sched_switch: prev_comm=kworker/u16:4 prev_pid=773 prev_prio=120 prev_state=R+ ==> next_comm=kworker/3:2 next_pid=135 next_prio=120 |
2254 | gnome-shell-1261 [006] d..3 49.823114: sched_switch: prev_comm=gnome-shell prev_pid=1261 prev_prio=120 prev_state=R+ ==> next_comm=kworker/6:2 next_pid=387 next_prio=120 | 2256 | gnome-shell-1261 [006] d..3 49.823114: sched_switch: prev_comm=gnome-shell prev_pid=1261 prev_prio=120 prev_state=R+ ==> next_comm=kworker/6:2 next_pid=387 next_prio=120 |
2255 | kworker/3:2-135 [003] d..3 49.823118: sched_stat_runtime: comm=kworker/3:2 pid=135 runtime=5339 [ns] vruntime=17815800388 [ns] | 2257 | kworker/3:2-135 [003] d..3 49.823118: sched_stat_runtime: comm=kworker/3:2 pid=135 runtime=5339 [ns] vruntime=17815800388 [ns] |
2256 | kworker/6:2-387 [006] d..3 49.823120: sched_stat_runtime: comm=kworker/6:2 pid=387 runtime=9594 [ns] vruntime=14589605367 [ns] | 2258 | kworker/6:2-387 [006] d..3 49.823120: sched_stat_runtime: comm=kworker/6:2 pid=387 runtime=9594 [ns] vruntime=14589605367 [ns] |
2257 | kworker/6:2-387 [006] d..3 49.823122: sched_switch: prev_comm=kworker/6:2 prev_pid=387 prev_prio=120 prev_state=R+ ==> next_comm=gnome-shell next_pid=1261 next_prio=120 | 2259 | kworker/6:2-387 [006] d..3 49.823122: sched_switch: prev_comm=kworker/6:2 prev_pid=387 prev_prio=120 prev_state=R+ ==> next_comm=gnome-shell next_pid=1261 next_prio=120 |
2258 | kworker/3:2-135 [003] d..3 49.823123: sched_switch: prev_comm=kworker/3:2 prev_pid=135 prev_prio=120 prev_state=T ==> next_comm=swapper/3 next_pid=0 next_prio=120 | 2260 | kworker/3:2-135 [003] d..3 49.823123: sched_switch: prev_comm=kworker/3:2 prev_pid=135 prev_prio=120 prev_state=T ==> next_comm=swapper/3 next_pid=0 next_prio=120 |
2259 | <idle>-0 [004] ..s7 49.823798: tcp_probe: src=10.0.0.10:54326 dest=23.215.104.193:80 mark=0x0 length=32 snd_nxt=0xe3ae2ff5 snd_una=0xe3ae2ecd snd_cwnd=10 ssthresh=2147483647 snd_wnd=28960 srtt=19604 rcv_wnd=29312 | 2261 | <idle>-0 [004] ..s7 49.823798: tcp_probe: src=10.0.0.10:54326 dest=23.215.104.193:80 mark=0x0 length=32 snd_nxt=0xe3ae2ff5 snd_una=0xe3ae2ecd snd_cwnd=10 ssthresh=2147483647 snd_wnd=28960 srtt=19604 rcv_wnd=29312 |
2260 | 2262 | ||
2261 | 3. User space creating a trigger | 2263 | 3. User space creating a trigger |
2262 | -------------------------------- | 2264 | -------------------------------- |
diff --git a/Documentation/translations/index.rst b/Documentation/translations/index.rst index 7f77c52d33aa..e446e5ed00a6 100644 --- a/Documentation/translations/index.rst +++ b/Documentation/translations/index.rst | |||
@@ -11,3 +11,43 @@ Translations | |||
11 | it_IT/index | 11 | it_IT/index |
12 | ko_KR/index | 12 | ko_KR/index |
13 | ja_JP/index | 13 | ja_JP/index |
14 | |||
15 | |||
16 | .. _translations_disclaimer: | ||
17 | |||
18 | Disclaimer | ||
19 | ---------- | ||
20 | |||
21 | Translation's purpose is to ease reading and understanding in languages other | ||
22 | than English. Its aim is to help people who do not understand English or have | ||
23 | doubts about its interpretation. Additionally, some people prefer to read | ||
24 | documentation in their native language, but please bear in mind that the | ||
25 | *only* official documentation is the English one: :ref:`linux_doc`. | ||
26 | |||
27 | It is very unlikely that an update to :ref:`linux_doc` will be propagated | ||
28 | immediately to all translations. Translations' maintainers - and | ||
29 | contributors - follow the evolution of the official documentation and they | ||
30 | maintain translations aligned as much as they can. For this reason there is | ||
31 | no guarantee that a translation is up to date. If what you read in a | ||
32 | translation does not sound right compared to what you read in the code, please | ||
33 | inform the translation maintainer and - if you can - check also the English | ||
34 | documentation. | ||
35 | |||
36 | A translation is not a fork of the official documentation, therefore | ||
37 | translations' users should not find information that differs from the official | ||
38 | English documentation. Any content addition, removal or update, must be | ||
39 | applied to the English documents first. Afterwards and when possible, the | ||
40 | same change should be applied to translations. Translations' maintainers | ||
41 | accept only contributions that are merely translation related (e.g. new | ||
42 | translations, updates, fixes). | ||
43 | |||
44 | Translations try to be as accurate as possible but it is not possible to map | ||
45 | one language directly to all other languages. Each language has its own | ||
46 | grammar and culture, so the translation of an English statement may need to be | ||
47 | adapted to fit a different language. For this reason, when viewing | ||
48 | translations, you may find slight differences that carry the same message but | ||
49 | in a different form. | ||
50 | |||
51 | If you need to communicate with the Linux community but you do not feel | ||
52 | comfortable writing in English, you can ask the translation's maintainers | ||
53 | for help. | ||
diff --git a/Documentation/translations/it_IT/core-api/memory-allocation.rst b/Documentation/translations/it_IT/core-api/memory-allocation.rst new file mode 100644 index 000000000000..11d5148f8d6b --- /dev/null +++ b/Documentation/translations/it_IT/core-api/memory-allocation.rst | |||
@@ -0,0 +1,13 @@ | |||
1 | .. include:: ../disclaimer-ita.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/core-api/memory-allocation.rst <memory_allocation>` | ||
4 | |||
5 | .. _it_memory_allocation: | ||
6 | |||
7 | ================================ | ||
8 | Guida all'allocazione di memoria | ||
9 | ================================ | ||
10 | |||
11 | .. warning:: | ||
12 | |||
13 | TODO ancora da tradurre | ||
diff --git a/Documentation/translations/it_IT/disclaimer-ita.rst b/Documentation/translations/it_IT/disclaimer-ita.rst index d68e52de6a5d..bfe8a384baed 100644 --- a/Documentation/translations/it_IT/disclaimer-ita.rst +++ b/Documentation/translations/it_IT/disclaimer-ita.rst | |||
@@ -1,13 +1,6 @@ | |||
1 | :orphan: | 1 | :orphan: |
2 | 2 | ||
3 | .. note:: | ||
4 | This document is maintained by Federico Vaga <federico.vaga@vaga.pv.it>. | ||
5 | If you find any difference between this document and the original file or a | ||
6 | problem with the translation, please contact the maintainer of this file. | ||
7 | Following people helped to translate or review: | ||
8 | Alessia Mantegazza <amantegazza@vaga.pv.it> | ||
9 | |||
10 | .. warning:: | 3 | .. warning:: |
11 | The purpose of this file is to be easier to read and understand for Italian | 4 | In caso di dubbi sulla correttezza del contenuto di questa traduzione, |
12 | speakers and is not intended as a fork. So, if you have any comments or | 5 | l'unico riferimento valido è la documentazione ufficiale in inglese. |
13 | updates for this file please try to update the original English file first. | 6 | Per maggiori informazioni consultate le :ref:`avvertenze <it_disclaimer>`. |
diff --git a/Documentation/translations/it_IT/doc-guide/index.rst b/Documentation/translations/it_IT/doc-guide/index.rst index 7a6562b547ee..9fffff626711 100644 --- a/Documentation/translations/it_IT/doc-guide/index.rst +++ b/Documentation/translations/it_IT/doc-guide/index.rst | |||
@@ -12,9 +12,9 @@ Come scrivere la documentazione del kernel | |||
12 | .. toctree:: | 12 | .. toctree:: |
13 | :maxdepth: 1 | 13 | :maxdepth: 1 |
14 | 14 | ||
15 | sphinx.rst | 15 | sphinx |
16 | kernel-doc.rst | 16 | kernel-doc |
17 | parse-headers.rst | 17 | parse-headers |
18 | 18 | ||
19 | .. only:: subproject and html | 19 | .. only:: subproject and html |
20 | 20 | ||
diff --git a/Documentation/translations/it_IT/index.rst b/Documentation/translations/it_IT/index.rst index ea9b2916b3e4..409eaac03e9f 100644 --- a/Documentation/translations/it_IT/index.rst +++ b/Documentation/translations/it_IT/index.rst | |||
@@ -4,26 +4,49 @@ | |||
4 | Traduzione italiana | 4 | Traduzione italiana |
5 | =================== | 5 | =================== |
6 | 6 | ||
7 | L'obiettivo di questa traduzione è di rendere più facile la lettura e | 7 | :manutentore: Federico Vaga <federico.vaga@vaga.pv.it> |
8 | la comprensione per chi preferisce leggere in lingua italiana. | ||
9 | Tenete presente che la documentazione di riferimento rimane comunque | ||
10 | quella in lingua inglese: :ref:`linux_doc` | ||
11 | |||
12 | Questa traduzione cerca di essere il più fedele possibile all'originale ma | ||
13 | è ovvio che alcune frasi vadano trasformate: non aspettatevi una traduzione | ||
14 | letterale. Quando possibile, si eviteranno gli inglesismi ed al loro posto | ||
15 | verranno utilizzate le corrispettive parole italiane. | ||
16 | 8 | ||
17 | Se notate che la traduzione non è più aggiornata potete contattare | 9 | .. _it_disclaimer: |
18 | direttamente il manutentore della traduzione italiana. | ||
19 | 10 | ||
20 | Se notate che la documentazione contiene errori o dimenticanze, allora | 11 | Avvertenze |
21 | verificate la documentazione di riferimento in lingua inglese. Se il problema | 12 | ========== |
22 | è presente anche nella documentazione di riferimento, contattate il suo | ||
23 | manutentore. Se avete problemi a scrivere in inglese, potete comunque | ||
24 | riportare il problema al manutentore della traduzione italiana. | ||
25 | 13 | ||
26 | Manutentore della traduzione italiana: Federico Vaga <federico.vaga@vaga.pv.it> | 14 | L'obiettivo di questa traduzione è di rendere più facile la lettura e |
15 | la comprensione per chi non capisce l'inglese o ha dubbi sulla sua | ||
16 | interpretazione, oppure semplicemente per chi preferisce leggere in lingua | ||
17 | italiana. Tuttavia, tenete ben presente che l'*unica* documentazione | ||
18 | ufficiale è quella in lingua inglese: :ref:`linux_doc` | ||
19 | |||
20 | La propagazione simultanea a tutte le traduzioni di una modifica in | ||
21 | :ref:`linux_doc` è altamente improbabile. I manutentori delle traduzioni - | ||
22 | e i contributori - seguono l'evolversi della documentazione ufficiale e | ||
23 | cercano di mantenere le rispettive traduzioni allineate nel limite del | ||
24 | possibile. Per questo motivo non c'è garanzia che una traduzione sia | ||
25 | aggiornata all'ultima modifica. Se quello che leggete in una traduzione | ||
26 | non corrisponde a quello che leggete nel codice, informate il manutentore | ||
27 | della traduzione e - se potete - verificate anche la documentazione in | ||
28 | inglese. | ||
29 | |||
30 | Una traduzione non è un *fork* della documentazione ufficiale, perciò gli | ||
31 | utenti non vi troveranno alcuna informazione diversa rispetto alla versione | ||
32 | ufficiale. Ogni aggiunta, rimozione o modifica dei contenuti deve essere | ||
33 | fatta prima nei documenti in inglese. In seguito, e quando è possibile, la | ||
34 | stessa modifica dovrebbe essere applicata anche alle traduzioni. I manutentori | ||
35 | delle traduzioni accettano contributi che interessano prettamente l'attività | ||
36 | di traduzione (per esempio, nuove traduzioni, aggiornamenti, correzioni). | ||
37 | |||
38 | Le traduzioni cercano di essere il più possibile accurate ma non è possibile | ||
39 | mappare direttamente una lingua in un'altra. Ogni lingua ha la sua grammatica | ||
40 | e una sua cultura alle spalle, quindi la traduzione di una frase in inglese | ||
41 | potrebbe essere modificata per adattarla all'italiano. Per questo motivo, | ||
42 | quando leggete questa traduzione, potreste trovare alcune differenze di forma | ||
43 | ma che trasmettono comunque il messaggio originale. Nonostante la grande | ||
44 | diffusione di inglesismi nella lingua parlata, quando possibile, questi | ||
45 | verranno sostituiti dalle corrispettive parole italiane | ||
46 | |||
47 | Se avete bisogno d'aiuto per comunicare con la comunità Linux ma non vi sentite | ||
48 | a vostro agio nello scrivere in inglese, potete chiedere aiuto al manutentore | ||
49 | della traduzione. | ||
27 | 50 | ||
28 | La documentazione del kernel Linux | 51 | La documentazione del kernel Linux |
29 | ================================== | 52 | ================================== |
@@ -47,9 +70,7 @@ I seguenti documenti descrivono la licenza usata nei sorgenti del kernel Linux | |||
47 | (GPLv2), come licenziare i singoli file; inoltre troverete i riferimenti al | 70 | (GPLv2), come licenziare i singoli file; inoltre troverete i riferimenti al |
48 | testo integrale della licenza. | 71 | testo integrale della licenza. |
49 | 72 | ||
50 | .. warning:: | 73 | * :ref:`it_kernel_licensing` |
51 | |||
52 | TODO ancora da tradurre | ||
53 | 74 | ||
54 | Documentazione per gli utenti | 75 | Documentazione per gli utenti |
55 | ----------------------------- | 76 | ----------------------------- |
@@ -90,10 +111,6 @@ vostre modifiche molto più semplice | |||
90 | doc-guide/index | 111 | doc-guide/index |
91 | kernel-hacking/index | 112 | kernel-hacking/index |
92 | 113 | ||
93 | .. warning:: | ||
94 | |||
95 | TODO ancora da tradurre | ||
96 | |||
97 | Documentazione della API del kernel | 114 | Documentazione della API del kernel |
98 | ----------------------------------- | 115 | ----------------------------------- |
99 | 116 | ||
diff --git a/Documentation/translations/it_IT/networking/netdev-FAQ.rst b/Documentation/translations/it_IT/networking/netdev-FAQ.rst new file mode 100644 index 000000000000..8489ead7cff1 --- /dev/null +++ b/Documentation/translations/it_IT/networking/netdev-FAQ.rst | |||
@@ -0,0 +1,13 @@ | |||
1 | .. include:: ../disclaimer-ita.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` | ||
4 | |||
5 | .. _it_netdev-FAQ: | ||
6 | |||
7 | ========== | ||
8 | netdev FAQ | ||
9 | ========== | ||
10 | |||
11 | .. warning:: | ||
12 | |||
13 | TODO ancora da tradurre | ||
diff --git a/Documentation/translations/it_IT/process/5.Posting.rst b/Documentation/translations/it_IT/process/5.Posting.rst index b979266aa884..1476d51eb5e5 100644 --- a/Documentation/translations/it_IT/process/5.Posting.rst +++ b/Documentation/translations/it_IT/process/5.Posting.rst | |||
@@ -233,10 +233,12 @@ Le etichette in uso più comuni sono: | |||
233 | :ref:`Documentation/translations/it_IT/process/submitting-patches.rst <it_submittingpatches>`. | 233 | :ref:`Documentation/translations/it_IT/process/submitting-patches.rst <it_submittingpatches>`. |
234 | Codice che non presenta una firma appropriata non potrà essere integrato. | 234 | Codice che non presenta una firma appropriata non potrà essere integrato. |
235 | 235 | ||
236 | - Co-developed-by: indica che la patch è stata sviluppata anche da un altro | 236 | - Co-developed-by: indica che la patch è stata cosviluppata da diversi |
237 | sviluppatore assieme all'autore originale. Questo è utile quando più | 237 | sviluppatori; viene usato per assegnare più autori (in aggiunta a quello |
238 | persone lavorano sulla stessa patch. Da notare che questa persona deve | 238 | associato all'etichetta From:) quando più persone lavorano ad una patch. |
239 | avere anche una riga "Signed-off-by:" nella patch. | 239 | Ogni Co-developed-by: dev'essere seguito immediatamente da un Signed-off-by: |
240 | del corrispondente coautore. Maggiori dettagli ed esempi sono disponibili | ||
241 | in :ref:`Documentation/translations/it_IT/process/submitting-patches.rst <it_submittingpatches>`. | ||
240 | 242 | ||
241 | - Acked-by: indica il consenso di un altro sviluppatore (spesso il manutentore | 243 | - Acked-by: indica il consenso di un altro sviluppatore (spesso il manutentore |
242 | del codice in oggetto) all'integrazione della patch nel kernel. | 244 | del codice in oggetto) all'integrazione della patch nel kernel. |
diff --git a/Documentation/translations/it_IT/process/coding-style.rst b/Documentation/translations/it_IT/process/coding-style.rst index 2fd0e7f79d55..5ef534c95e69 100644 --- a/Documentation/translations/it_IT/process/coding-style.rst +++ b/Documentation/translations/it_IT/process/coding-style.rst | |||
@@ -859,7 +859,8 @@ racchiusa in #ifdef, potete usare printk(KERN_DEBUG ...). | |||
859 | 859 | ||
860 | Il kernel fornisce i seguenti assegnatori ad uso generico: | 860 | Il kernel fornisce i seguenti assegnatori ad uso generico: |
861 | kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), e vzalloc(). | 861 | kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), e vzalloc(). |
862 | Per maggiori informazioni, consultate la documentazione dell'API. | 862 | Per maggiori informazioni, consultate la documentazione dell'API: |
863 | :ref:`Documentation/translations/it_IT/core-api/memory-allocation.rst <it_memory_allocation>` | ||
863 | 864 | ||
864 | Il modo preferito per passare la dimensione di una struttura è il seguente: | 865 | Il modo preferito per passare la dimensione di una struttura è il seguente: |
865 | 866 | ||
@@ -890,6 +891,11 @@ Il modo preferito per assegnare un vettore a zero è il seguente: | |||
890 | Entrambe verificano la condizione di overflow per la dimensione | 891 | Entrambe verificano la condizione di overflow per la dimensione |
891 | d'assegnamento n * sizeof(...), se accade ritorneranno NULL. | 892 | d'assegnamento n * sizeof(...), se accade ritorneranno NULL. |
892 | 893 | ||
894 | Questi allocatori generici producono uno *stack dump* in caso di fallimento | ||
895 | a meno che non venga esplicitamente specificato __GFP_NOWARN. Quindi, nella | ||
896 | maggior parte dei casi, è inutile stampare messaggi aggiuntivi quando uno di | ||
897 | questi allocatori ritornano un puntatore NULL. | ||
898 | |||
893 | 15) Il morbo inline | 899 | 15) Il morbo inline |
894 | ------------------- | 900 | ------------------- |
895 | 901 | ||
diff --git a/Documentation/translations/it_IT/process/deprecated.rst b/Documentation/translations/it_IT/process/deprecated.rst new file mode 100644 index 000000000000..776f26732a94 --- /dev/null +++ b/Documentation/translations/it_IT/process/deprecated.rst | |||
@@ -0,0 +1,129 @@ | |||
1 | .. SPDX-License-Identifier: GPL-2.0 | ||
2 | |||
3 | .. include:: ../disclaimer-ita.rst | ||
4 | |||
5 | :Original: :ref:`Documentation/process/deprecated.rst <deprecated>` | ||
6 | :Translator: Federico Vaga <federico.vaga@vaga.pv.it> | ||
7 | |||
8 | .. _it_deprecated: | ||
9 | |||
10 | ============================================================================== | ||
11 | Interfacce deprecate, caratteristiche del linguaggio, attributi, e convenzioni | ||
12 | ============================================================================== | ||
13 | |||
14 | In un mondo perfetto, sarebbe possibile prendere tutti gli usi di | ||
15 | un'interfaccia deprecata e convertirli in quella nuova, e così sarebbe | ||
16 | possibile rimuovere la vecchia interfaccia in un singolo ciclo di sviluppo. | ||
17 | Tuttavia, per via delle dimensioni del kernel, la gerarchia dei manutentori e | ||
18 | le tempistiche, non è sempre possibile fare questo tipo di conversione tutta | ||
19 | in una volta. Questo significa che nuove istanze di una vecchia interfaccia | ||
20 | potrebbero aggiungersi al kernel proprio quando si sta cercando di rimuoverle, | ||
21 | aumentando così il carico di lavoro. Al fine di istruire gli sviluppatori su | ||
22 | cosa è considerato deprecato (e perché), è stata create la seguente lista a cui | ||
23 | fare riferimento quando qualcuno propone modifiche che usano cose deprecate. | ||
24 | |||
25 | __deprecated | ||
26 | ------------ | ||
27 | Nonostante questo attributo marchi visibilmente un interfaccia come deprecata, | ||
28 | `non produce più alcun avviso durante la compilazione | ||
29 | <https://git.kernel.org/linus/771c035372a036f83353eef46dbb829780330234>`_ | ||
30 | perché uno degli obiettivi del kernel è quello di compilare senza avvisi; | ||
31 | inoltre, nessuno stava agendo per rimuovere queste interfacce. Nonostante l'uso | ||
32 | di `__deprecated` in un file d'intestazione sia opportuno per segnare una | ||
33 | interfaccia come 'vecchia', questa non è una soluzione completa. L'interfaccia | ||
34 | deve essere rimossa dal kernel, o aggiunta a questo documento per scoraggiarne | ||
35 | l'uso. | ||
36 | |||
37 | Calcoli codificati negli argomenti di un allocatore | ||
38 | ---------------------------------------------------- | ||
39 | Il calcolo dinamico delle dimensioni (specialmente le moltiplicazioni) non | ||
40 | dovrebbero essere fatto negli argomenti di funzioni di allocazione di memoria | ||
41 | (o simili) per via del rischio di overflow. Questo può portare a valori più | ||
42 | piccoli di quelli che il chiamante si aspettava. L'uso di questo modo di | ||
43 | allocare può portare ad un overflow della memoria di heap e altri | ||
44 | malfunzionamenti. (Si fa eccezione per valori numerici per i quali il | ||
45 | compilatore può generare avvisi circa un potenziale overflow. Tuttavia usare | ||
46 | i valori numerici come suggerito di seguito è innocuo). | ||
47 | |||
48 | Per esempio, non usate ``count * size`` come argomento:: | ||
49 | |||
50 | foo = kmalloc(count * size, GFP_KERNEL); | ||
51 | |||
52 | Al suo posto, si dovrebbe usare l'allocatore a due argomenti:: | ||
53 | |||
54 | foo = kmalloc_array(count, size, GFP_KERNEL); | ||
55 | |||
56 | Se questo tipo di allocatore non è disponibile, allora dovrebbero essere usate | ||
57 | le funzioni del tipo *saturate-on-overflow*:: | ||
58 | |||
59 | bar = vmalloc(array_size(count, size)); | ||
60 | |||
61 | Un altro tipico caso da evitare è quello di calcolare la dimensione di una | ||
62 | struttura seguita da un vettore di altre strutture, come nel seguente caso:: | ||
63 | |||
64 | header = kzalloc(sizeof(*header) + count * sizeof(*header->item), | ||
65 | GFP_KERNEL); | ||
66 | |||
67 | Invece, usate la seguente funzione:: | ||
68 | |||
69 | header = kzalloc(struct_size(header, item, count), GFP_KERNEL); | ||
70 | |||
71 | Per maggiori dettagli fate riferimento a :c:func:`array_size`, | ||
72 | :c:func:`array3_size`, e :c:func:`struct_size`, così come la famiglia di | ||
73 | funzioni :c:func:`check_add_overflow` e :c:func:`check_mul_overflow`. | ||
74 | |||
75 | simple_strtol(), simple_strtoll(), simple_strtoul(), simple_strtoull() | ||
76 | ---------------------------------------------------------------------- | ||
77 | Le funzioni :c:func:`simple_strtol`, :c:func:`simple_strtoll`, | ||
78 | :c:func:`simple_strtoul`, e :c:func:`simple_strtoull` ignorano volutamente | ||
79 | i possibili overflow, e questo può portare il chiamante a generare risultati | ||
80 | inaspettati. Le rispettive funzioni :c:func:`kstrtol`, :c:func:`kstrtoll`, | ||
81 | :c:func:`kstrtoul`, e :c:func:`kstrtoull` sono da considerarsi le corrette | ||
82 | sostitute; tuttavia va notato che queste richiedono che la stringa sia | ||
83 | terminata con il carattere NUL o quello di nuova riga. | ||
84 | |||
85 | strcpy() | ||
86 | -------- | ||
87 | La funzione :c:func:`strcpy` non fa controlli agli estremi del buffer | ||
88 | di destinazione. Questo può portare ad un overflow oltre i limiti del | ||
89 | buffer e generare svariati tipi di malfunzionamenti. Nonostante l'opzione | ||
90 | `CONFIG_FORTIFY_SOURCE=y` e svariate opzioni del compilatore aiutano | ||
91 | a ridurne il rischio, non c'è alcuna buona ragione per continuare ad usare | ||
92 | questa funzione. La versione sicura da usare è :c:func:`strscpy`. | ||
93 | |||
94 | strncpy() su stringe terminate con NUL | ||
95 | -------------------------------------- | ||
96 | L'utilizzo di :c:func:`strncpy` non fornisce alcuna garanzia sul fatto che | ||
97 | il buffer di destinazione verrà terminato con il carattere NUL. Questo | ||
98 | potrebbe portare a diversi overflow di lettura o altri malfunzionamenti | ||
99 | causati, appunto, dalla mancanza del terminatore. Questa estende la | ||
100 | terminazione nel buffer di destinazione quando la stringa d'origine è più | ||
101 | corta; questo potrebbe portare ad una penalizzazione delle prestazioni per | ||
102 | chi usa solo stringe terminate. La versione sicura da usare è | ||
103 | :c:func:`strscpy`. (chi usa :c:func:`strscpy` e necessita di estendere la | ||
104 | terminazione con NUL deve aggiungere una chiamata a :c:func:`memset`) | ||
105 | |||
106 | Se il chiamate no usa stringhe terminate con NUL, allore :c:func:`strncpy()` | ||
107 | può continuare ad essere usata, ma i buffer di destinazione devono essere | ||
108 | marchiati con l'attributo `__nonstring <https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>`_ | ||
109 | per evitare avvisi durante la compilazione. | ||
110 | |||
111 | strlcpy() | ||
112 | --------- | ||
113 | La funzione :c:func:`strlcpy`, per prima cosa, legge interamente il buffer di | ||
114 | origine, magari leggendo più di quanto verrà effettivamente copiato. Questo | ||
115 | è inefficiente e può portare a overflow di lettura quando la stringa non è | ||
116 | terminata con NUL. La versione sicura da usare è :c:func:`strscpy`. | ||
117 | |||
118 | Vettori a dimensione variabile (VLA) | ||
119 | ------------------------------------ | ||
120 | |||
121 | Usare VLA sullo stack produce codice molto peggiore rispetto a quando si usano | ||
122 | vettori a dimensione fissa. Questi `problemi di prestazioni <https://git.kernel.org/linus/02361bc77888>`_, | ||
123 | tutt'altro che banali, sono già un motivo valido per eliminare i VLA; in | ||
124 | aggiunta sono anche un problema per la sicurezza. La crescita dinamica di un | ||
125 | vettore nello stack potrebbe eccedere la memoria rimanente in tale segmento. | ||
126 | Questo può portare a dei malfunzionamenti, potrebbe sovrascrivere | ||
127 | dati importanti alla fine dello stack (quando il kernel è compilato senza | ||
128 | `CONFIG_THREAD_INFO_IN_TASK=y`), o sovrascrivere un pezzo di memoria adiacente | ||
129 | allo stack (quando il kernel è compilato senza `CONFIG_VMAP_STACK=y`). | ||
diff --git a/Documentation/translations/it_IT/process/kernel-enforcement-statement.rst b/Documentation/translations/it_IT/process/kernel-enforcement-statement.rst index 4ddf5a35b270..1f62da622e26 100644 --- a/Documentation/translations/it_IT/process/kernel-enforcement-statement.rst +++ b/Documentation/translations/it_IT/process/kernel-enforcement-statement.rst | |||
@@ -1,13 +1,175 @@ | |||
1 | .. include:: ../disclaimer-ita.rst | 1 | .. include:: ../disclaimer-ita.rst |
2 | 2 | ||
3 | :Original: :ref:`Documentation/process/kernel-enforcement-statement.rst <process_statement_kernel>` | 3 | :Original: :ref:`Documentation/process/kernel-enforcement-statement.rst <process_statement_kernel>` |
4 | 4 | :Translator: Federico Vaga <federico.vaga@vaga.pv.it> | |
5 | 5 | ||
6 | .. _it_process_statement_kernel: | 6 | .. _it_process_statement_kernel: |
7 | 7 | ||
8 | Applicazione della licenza sul kernel Linux | 8 | Applicazione della licenza sul kernel Linux |
9 | =========================================== | 9 | =========================================== |
10 | 10 | ||
11 | .. warning:: | 11 | Come sviluppatori del kernel Linux, abbiamo un certo interessa su come il |
12 | nostro software viene usato e su come la sua licenza viene fatta rispettare. | ||
13 | Il rispetto reciproco degli obblighi di condivisione della GPL-2.0 è | ||
14 | fondamentale per la sostenibilità di lungo periodo del nostro software e | ||
15 | della nostra comunità. | ||
16 | |||
17 | Benché ognuno abbia il diritto a far rispettare il diritto d'autore per i | ||
18 | propri contributi alla nostra comunità, condividiamo l'interesse a far si che | ||
19 | ogni azione individuale nel far rispettare i propri diritti sia condotta in | ||
20 | modo da portare beneficio alla comunità e che non abbia, involontariamente, | ||
21 | impatti negativi sulla salute e la crescita del nostro ecosistema software. | ||
22 | Al fine di scoraggiare l'esecuzione di azioni inutili, concordiamo che è nel | ||
23 | migliore interesse della nostra comunità di sviluppo di impegnarci nel | ||
24 | rispettare i seguenti obblighi nei confronti degli utenti del kernel Linux | ||
25 | per conto nostro e di qualsiasi successore ai nostri interessi sul diritto | ||
26 | d'autore: | ||
27 | |||
28 | Malgrado le clausole di risoluzione della licenza GPL-2.0, abbiamo | ||
29 | concordato che è nel migliore interesse della nostra comunità di sviluppo | ||
30 | adottare le seguenti disposizioni della GPL-3.0 come permessi aggiuntivi | ||
31 | alla nostra licenza nei confronti di qualsiasi affermazione non difensiva | ||
32 | di diritti sulla licenza. | ||
33 | |||
34 | In ogni caso, se cessano tutte le violazioni di questa Licenza, allora | ||
35 | la tua licenza da parte di un dato detentore del copyright viene | ||
36 | ripristinata (a) in via cautelativa, a meno che e fino a quando il | ||
37 | detentore del copyright non cessa esplicitamente e definitivamente | ||
38 | la tua licenza, e (b) in via permanente se il detentore del copyright | ||
39 | non ti notifica in alcun modo la violazione entro 60 giorni dalla | ||
40 | cessazione della licenza. | ||
41 | |||
42 | Inoltre, la tua licenza da parte di un dato detentore del copyright | ||
43 | viene ripristinata in maniera permanente se il detentore del copyright | ||
44 | ti notifica la violazione in maniera adeguata, se questa è la prima | ||
45 | volta che ricevi una notifica di violazione di questa Licenza (per | ||
46 | qualunque Programma) dallo stesso detentore di copyright, e se rimedi | ||
47 | alla violazione entro 30 giorni dalla data di ricezione della notifica | ||
48 | di violazione. | ||
49 | |||
50 | Fornendo queste garanzie, abbiamo l'intenzione di incoraggiare l'uso del | ||
51 | software. Vogliamo che le aziende e le persone usino, modifichino e | ||
52 | distribuiscano a questo software. Vogliamo lavorare con gli utenti in modo | ||
53 | aperto e trasparente per eliminare ogni incertezza circa le nostre aspettative | ||
54 | sul rispetto o l'ottemperanza alla licenza che possa limitare l'uso del nostro | ||
55 | software. Vediamo l'azione legale come ultima spiaggia, da avviare solo quando | ||
56 | gli altri sforzi della comunità hanno fallito nel risolvere il problema. | ||
57 | |||
58 | Per finire, una volta che un problema di non rispetto della licenza viene | ||
59 | risolto, speriamo che gli utenti si sentano i benvenuti ad aggregarsi a noi | ||
60 | nello sviluppo di questo progetto. Lavorando assieme, saremo più forti. | ||
61 | |||
62 | Ad eccezione deve specificato, parliamo per noi stessi, e non per una qualsiasi | ||
63 | azienda per la quale lavoriamo oggi, o per cui abbiamo lavorato in passato, o | ||
64 | lavoreremo in futuro. | ||
65 | |||
12 | 66 | ||
13 | TODO ancora da tradurre | 67 | - Laura Abbott |
68 | - Bjorn Andersson (Linaro) | ||
69 | - Andrea Arcangeli | ||
70 | - Neil Armstrong | ||
71 | - Jens Axboe | ||
72 | - Pablo Neira Ayuso | ||
73 | - Khalid Aziz | ||
74 | - Ralf Baechle | ||
75 | - Felipe Balbi | ||
76 | - Arnd Bergmann | ||
77 | - Ard Biesheuvel | ||
78 | - Tim Bird | ||
79 | - Paolo Bonzini | ||
80 | - Christian Borntraeger | ||
81 | - Mark Brown (Linaro) | ||
82 | - Paul Burton | ||
83 | - Javier Martinez Canillas | ||
84 | - Rob Clark | ||
85 | - Kees Cook (Google) | ||
86 | - Jonathan Corbet | ||
87 | - Dennis Dalessandro | ||
88 | - Vivien Didelot (Savoir-faire Linux) | ||
89 | - Hans de Goede | ||
90 | - Mel Gorman (SUSE) | ||
91 | - Sven Eckelmann | ||
92 | - Alex Elder (Linaro) | ||
93 | - Fabio Estevam | ||
94 | - Larry Finger | ||
95 | - Bhumika Goyal | ||
96 | - Andy Gross | ||
97 | - Juergen Gross | ||
98 | - Shawn Guo | ||
99 | - Ulf Hansson | ||
100 | - Stephen Hemminger (Microsoft) | ||
101 | - Tejun Heo | ||
102 | - Rob Herring | ||
103 | - Masami Hiramatsu | ||
104 | - Michal Hocko | ||
105 | - Simon Horman | ||
106 | - Johan Hovold (Hovold Consulting AB) | ||
107 | - Christophe JAILLET | ||
108 | - Olof Johansson | ||
109 | - Lee Jones (Linaro) | ||
110 | - Heiner Kallweit | ||
111 | - Srinivas Kandagatla | ||
112 | - Jan Kara | ||
113 | - Shuah Khan (Samsung) | ||
114 | - David Kershner | ||
115 | - Jaegeuk Kim | ||
116 | - Namhyung Kim | ||
117 | - Colin Ian King | ||
118 | - Jeff Kirsher | ||
119 | - Greg Kroah-Hartman (Linux Foundation) | ||
120 | - Christian König | ||
121 | - Vinod Koul | ||
122 | - Krzysztof Kozlowski | ||
123 | - Viresh Kumar | ||
124 | - Aneesh Kumar K.V | ||
125 | - Julia Lawall | ||
126 | - Doug Ledford | ||
127 | - Chuck Lever (Oracle) | ||
128 | - Daniel Lezcano | ||
129 | - Shaohua Li | ||
130 | - Xin Long | ||
131 | - Tony Luck | ||
132 | - Catalin Marinas (Arm Ltd) | ||
133 | - Mike Marshall | ||
134 | - Chris Mason | ||
135 | - Paul E. McKenney | ||
136 | - Arnaldo Carvalho de Melo | ||
137 | - David S. Miller | ||
138 | - Ingo Molnar | ||
139 | - Kuninori Morimoto | ||
140 | - Trond Myklebust | ||
141 | - Martin K. Petersen (Oracle) | ||
142 | - Borislav Petkov | ||
143 | - Jiri Pirko | ||
144 | - Josh Poimboeuf | ||
145 | - Sebastian Reichel (Collabora) | ||
146 | - Guenter Roeck | ||
147 | - Joerg Roedel | ||
148 | - Leon Romanovsky | ||
149 | - Steven Rostedt (VMware) | ||
150 | - Frank Rowand | ||
151 | - Ivan Safonov | ||
152 | - Anna Schumaker | ||
153 | - Jes Sorensen | ||
154 | - K.Y. Srinivasan | ||
155 | - David Sterba (SUSE) | ||
156 | - Heiko Stuebner | ||
157 | - Jiri Kosina (SUSE) | ||
158 | - Willy Tarreau | ||
159 | - Dmitry Torokhov | ||
160 | - Linus Torvalds | ||
161 | - Thierry Reding | ||
162 | - Rik van Riel | ||
163 | - Luis R. Rodriguez | ||
164 | - Geert Uytterhoeven (Glider bvba) | ||
165 | - Eduardo Valentin (Amazon.com) | ||
166 | - Daniel Vetter | ||
167 | - Linus Walleij | ||
168 | - Richard Weinberger | ||
169 | - Dan Williams | ||
170 | - Rafael J. Wysocki | ||
171 | - Arvind Yadav | ||
172 | - Masahiro Yamada | ||
173 | - Wei Yongjun | ||
174 | - Lv Zheng | ||
175 | - Marc Zyngier (Arm Ltd) | ||
diff --git a/Documentation/translations/it_IT/process/license-rules.rst b/Documentation/translations/it_IT/process/license-rules.rst new file mode 100644 index 000000000000..91a8794ffd79 --- /dev/null +++ b/Documentation/translations/it_IT/process/license-rules.rst | |||
@@ -0,0 +1,452 @@ | |||
1 | .. SPDX-License-Identifier: GPL-2.0 | ||
2 | |||
3 | .. include:: ../disclaimer-ita.rst | ||
4 | |||
5 | :Original: :ref:`Documentation/process/license-rules.rst <kernel_licensing>` | ||
6 | :Translator: Federico Vaga <federico.vaga@vaga.pv.it> | ||
7 | |||
8 | .. _it_kernel_licensing: | ||
9 | |||
10 | Regole per licenziare il kernel Linux | ||
11 | ===================================== | ||
12 | |||
13 | Il kernel Linux viene rilasciato sotto i termini definiti dalla seconda | ||
14 | versione della licenza *GNU General Public License* (GPL-2.0), di cui una | ||
15 | copia è disponibile nel file LICENSES/preferred/GPL-2.0; a questo si | ||
16 | aggiunge eccezione per le chiamate di sistema come descritto in | ||
17 | LICENSES/exceptions/Linux-syscall-note; tutto ciò è descritto nel file COPYING. | ||
18 | |||
19 | Questo documento fornisce una descrizione su come ogni singolo file sorgente | ||
20 | debba essere licenziato per far si che sia chiaro e non ambiguo. Questo non | ||
21 | sostituisce la licenza del kernel. | ||
22 | |||
23 | La licenza descritta nel file COPYING si applica ai sorgenti del kernel nella | ||
24 | loro interezza, quindi i singoli file sorgenti possono avere diverse licenze ma | ||
25 | devono essere compatibili con la GPL-2.0:: | ||
26 | |||
27 | GPL-1.0+ : GNU General Public License v1.0 o successiva | ||
28 | GPL-2.0+ : GNU General Public License v2.0 o successiva | ||
29 | LGPL-2.0 : GNU Library General Public License v2 | ||
30 | LGPL-2.0+ : GNU Library General Public License v2 o successiva | ||
31 | LGPL-2.1 : GNU Lesser General Public License v2.1 | ||
32 | LGPL-2.1+ : GNU Lesser General Public License v2.1 o successiva | ||
33 | |||
34 | A parte questo, i singolo file possono essere forniti con una doppia licenza, | ||
35 | per esempio con una delle varianti compatibili della GPL e alternativamente con | ||
36 | una licenza permissiva come BSD, MIT eccetera. | ||
37 | |||
38 | I file d'intestazione per l'API verso lo spazio utente (UAPI) descrivono | ||
39 | le interfacce usate dai programmi, e per questo sono un caso speciale. | ||
40 | Secondo le note nel file COPYING, le chiamate di sistema sono un chiaro | ||
41 | confine oltre il quale non si estendono i requisiti della GPL per quei | ||
42 | programmi che le usano per comunicare con il kernel. Dato che i file | ||
43 | d'intestazione UAPI devono poter essere inclusi nei sorgenti di un | ||
44 | qualsiasi programma eseguibile sul kernel Linux, questi meritano | ||
45 | un'eccezione documentata da una clausola speciale. | ||
46 | |||
47 | Il modo più comune per indicare la licenza dei file sorgenti è quello di | ||
48 | aggiungere il corrispondente blocco di testo come commento in testa a detto | ||
49 | file. Per via della formattazione, dei refusi, eccetera, questi blocchi di | ||
50 | testo sono difficili da identificare dagli strumenti usati per verificare il | ||
51 | rispetto delle licenze. | ||
52 | |||
53 | Un'alternativa ai blocchi di testo è data dall'uso degli identificatori | ||
54 | *Software Package Data Exchange* (SPDX) in ogni file sorgente. Gli | ||
55 | identificatori di licenza SPDX sono analizzabili dalle macchine e sono precisi | ||
56 | simboli stenografici che identificano la licenza sotto la quale viene | ||
57 | licenziato il file che lo include. Gli identificatori di licenza SPDX sono | ||
58 | gestiti del gruppo di lavoro SPDX presso la Linux Foundation e sono stati | ||
59 | concordati fra i soci nell'industria, gli sviluppatori di strumenti, e i | ||
60 | rispettivi gruppi legali. Per maggiori informazioni, consultate | ||
61 | https://spdx.org/ | ||
62 | |||
63 | Il kernel Linux richiede un preciso identificatore SPDX in tutti i file | ||
64 | sorgenti. Gli identificatori validi verranno spiegati nella sezione | ||
65 | `Identificatori di licenza`_ e sono stati copiati dalla lista ufficiale di | ||
66 | licenze SPDX assieme al rispettivo testo come mostrato in | ||
67 | https://spdx.org/licenses/. | ||
68 | |||
69 | Sintassi degli identificatori di licenza | ||
70 | ---------------------------------------- | ||
71 | |||
72 | 1. Posizionamento: | ||
73 | |||
74 | L'identificativo di licenza SPDX dev'essere posizionato come prima riga | ||
75 | possibile di un file che possa contenere commenti. Per la maggior parte | ||
76 | dei file questa è la prima riga, fanno eccezione gli script che richiedono | ||
77 | come prima riga '#!PATH_TO_INTERPRETER'. Per questi script l'identificativo | ||
78 | SPDX finisce nella seconda riga. | ||
79 | |||
80 | | | ||
81 | |||
82 | 2. Stile: | ||
83 | |||
84 | L'identificativo di licenza SPDX viene aggiunto sotto forma di commento. | ||
85 | Lo stile del commento dipende dal tipo di file:: | ||
86 | |||
87 | sorgenti C: // SPDX-License-Identifier: <SPDX License Expression> | ||
88 | intestazioni C: /* SPDX-License-Identifier: <SPDX License Expression> */ | ||
89 | ASM: /* SPDX-License-Identifier: <SPDX License Expression> */ | ||
90 | scripts: # SPDX-License-Identifier: <SPDX License Expression> | ||
91 | .rst: .. SPDX-License-Identifier: <SPDX License Expression> | ||
92 | .dts{i}: // SPDX-License-Identifier: <SPDX License Expression> | ||
93 | |||
94 | Se un particolare programma non dovesse riuscire a gestire lo stile | ||
95 | principale per i commenti, allora dev'essere usato il meccanismo accettato | ||
96 | dal programma. Questo è il motivo per cui si ha "/\* \*/" nei file | ||
97 | d'intestazione C. Notammo che 'ld' falliva nell'analizzare i commenti del | ||
98 | C++ nei file .lds che venivano prodotti. Oggi questo è stato corretto, | ||
99 | ma ci sono in giro ancora vecchi programmi che non sono in grado di | ||
100 | gestire lo stile dei commenti del C++. | ||
101 | |||
102 | | | ||
103 | |||
104 | 3. Sintassi: | ||
105 | |||
106 | Una <espressione di licenza SPDX> può essere scritta usando l'identificatore | ||
107 | SPDX della licenza come indicato nella lista di licenze SPDX, oppure la | ||
108 | combinazione di due identificatori SPDX separati da "WITH" per i casi | ||
109 | eccezionali. Quando si usano più licenze l'espressione viene formata da | ||
110 | sottoespressioni separate dalle parole chiave "AND", "OR" e racchiuse fra | ||
111 | parentesi tonde "(", ")". | ||
112 | |||
113 | Gli identificativi di licenza per licenze come la [L]GPL che si avvalgono | ||
114 | dell'opzione 'o successive' si formano aggiungendo alla fine il simbolo "+" | ||
115 | per indicare l'opzione 'o successive'.:: | ||
116 | |||
117 | // SPDX-License-Identifier: GPL-2.0+ | ||
118 | // SPDX-License-Identifier: LGPL-2.1+ | ||
119 | |||
120 | WITH dovrebbe essere usato quando sono necessarie delle modifiche alla | ||
121 | licenza. Per esempio, la UAPI del kernel linux usa l'espressione:: | ||
122 | |||
123 | // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note | ||
124 | // SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note | ||
125 | |||
126 | Altri esempi di usi di WITH all'interno del kernel sono:: | ||
127 | |||
128 | // SPDX-License-Identifier: GPL-2.0 WITH mif-exception | ||
129 | // SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0 | ||
130 | |||
131 | Le eccezioni si possono usare solo in combinazione con identificatori di | ||
132 | licenza. Gli identificatori di licenza riconosciuti sono elencati nei | ||
133 | corrispondenti file d'eccezione. Per maggiori dettagli consultate | ||
134 | `Eccezioni`_ nel capitolo `Identificatori di licenza`_ | ||
135 | |||
136 | La parola chiave OR dovrebbe essere usata solo quando si usa una doppia | ||
137 | licenza e solo una dev'essere scelta. Per esempio, alcuni file dtsi sono | ||
138 | disponibili con doppia licenza:: | ||
139 | |||
140 | // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause | ||
141 | |||
142 | Esempi dal kernel di espressioni per file licenziati con doppia licenza | ||
143 | sono:: | ||
144 | |||
145 | // SPDX-License-Identifier: GPL-2.0 OR MIT | ||
146 | // SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause | ||
147 | // SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 | ||
148 | // SPDX-License-Identifier: GPL-2.0 OR MPL-1.1 | ||
149 | // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT | ||
150 | // SPDX-License-Identifier: GPL-1.0+ OR BSD-3-Clause OR OpenSSL | ||
151 | |||
152 | La parola chiave AND dovrebbe essere usata quando i termini di più licenze | ||
153 | si applicano ad un file. Per esempio, quando il codice viene preso da | ||
154 | un altro progetto il quale da i permessi per aggiungerlo nel kernel ma | ||
155 | richiede che i termini originali della licenza rimangano intatti:: | ||
156 | |||
157 | // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) AND MIT | ||
158 | |||
159 | Di seguito, un altro esempio dove entrambe i termini di licenza devono | ||
160 | essere rispettati:: | ||
161 | |||
162 | // SPDX-License-Identifier: GPL-1.0+ AND LGPL-2.1+ | ||
163 | |||
164 | Identificatori di licenza | ||
165 | ------------------------- | ||
166 | |||
167 | Le licenze attualmente in uso, così come le licenze aggiunte al kernel, possono | ||
168 | essere categorizzate in: | ||
169 | |||
170 | 1. _`Licenze raccomandate`: | ||
171 | |||
172 | Ovunque possibile le licenze qui indicate dovrebbero essere usate perché | ||
173 | pienamente compatibili e molto usate. Queste licenze sono disponibile nei | ||
174 | sorgenti del kernel, nella cartella:: | ||
175 | |||
176 | LICENSES/preferred/ | ||
177 | |||
178 | I file in questa cartella contengono il testo completo della licenza e i | ||
179 | `Metatag`_. Il nome di questi file è lo stesso usato come identificatore | ||
180 | di licenza SPDX e che deve essere usato nei file sorgenti. | ||
181 | |||
182 | Esempi:: | ||
183 | |||
184 | LICENSES/preferred/GPL-2.0 | ||
185 | |||
186 | Contiene il testo della seconda versione della licenza GPL e i metatag | ||
187 | necessari:: | ||
188 | |||
189 | LICENSES/preferred/MIT | ||
190 | |||
191 | Contiene il testo della licenza MIT e i metatag necessari. | ||
192 | |||
193 | _`Metatag`: | ||
194 | |||
195 | I seguenti metatag devono essere presenti in un file di licenza: | ||
196 | |||
197 | - Valid-License-Identifier: | ||
198 | |||
199 | Una o più righe che dichiarano quali identificatori di licenza sono validi | ||
200 | all'interno del progetto per far riferimento alla licenza in questione. | ||
201 | Solitamente, questo è un unico identificatore valido, ma per esempio le | ||
202 | licenze che permettono l'opzione 'o successive' hanno due identificatori | ||
203 | validi. | ||
204 | |||
205 | - SPDX-URL: | ||
206 | |||
207 | L'URL della pagina SPDX che contiene informazioni aggiuntive riguardanti | ||
208 | la licenza. | ||
209 | |||
210 | - Usage-Guidance: | ||
211 | |||
212 | Testo in formato libero per dare suggerimenti agli utenti. Il testo deve | ||
213 | includere degli esempi su come usare gli identificatori di licenza SPDX | ||
214 | in un file sorgente in conformità con le linea guida in | ||
215 | `Sintassi degli identificatori di licenza`_. | ||
216 | |||
217 | - License-Text: | ||
218 | |||
219 | Tutto il testo che compare dopo questa etichetta viene trattato | ||
220 | come se fosse parte del testo originale della licenza. | ||
221 | |||
222 | Esempi:: | ||
223 | |||
224 | Valid-License-Identifier: GPL-2.0 | ||
225 | Valid-License-Identifier: GPL-2.0+ | ||
226 | SPDX-URL: https://spdx.org/licenses/GPL-2.0.html | ||
227 | Usage-Guide: | ||
228 | To use this license in source code, put one of the following SPDX | ||
229 | tag/value pairs into a comment according to the placement | ||
230 | guidelines in the licensing rules documentation. | ||
231 | For 'GNU General Public License (GPL) version 2 only' use: | ||
232 | SPDX-License-Identifier: GPL-2.0 | ||
233 | For 'GNU General Public License (GPL) version 2 or any later version' use: | ||
234 | SPDX-License-Identifier: GPL-2.0+ | ||
235 | License-Text: | ||
236 | Full license text | ||
237 | |||
238 | :: | ||
239 | |||
240 | SPDX-License-Identifier: MIT | ||
241 | SPDX-URL: https://spdx.org/licenses/MIT.html | ||
242 | Usage-Guide: | ||
243 | To use this license in source code, put the following SPDX | ||
244 | tag/value pair into a comment according to the placement | ||
245 | guidelines in the licensing rules documentation. | ||
246 | SPDX-License-Identifier: MIT | ||
247 | License-Text: | ||
248 | Full license text | ||
249 | |||
250 | | | ||
251 | |||
252 | 2. Licenze non raccomandate: | ||
253 | |||
254 | Questo tipo di licenze dovrebbero essere usate solo per codice già esistente | ||
255 | o quando si prende codice da altri progetti. Le licenze sono disponibili | ||
256 | nei sorgenti del kernel nella cartella:: | ||
257 | |||
258 | LICENSES/other/ | ||
259 | |||
260 | I file in questa cartella contengono il testo completo della licenza e i | ||
261 | `Metatag`_. Il nome di questi file è lo stesso usato come identificatore | ||
262 | di licenza SPDX e che deve essere usato nei file sorgenti. | ||
263 | |||
264 | Esempi:: | ||
265 | |||
266 | LICENSES/other/ISC | ||
267 | |||
268 | Contiene il testo della licenza Internet System Consortium e i suoi | ||
269 | metatag:: | ||
270 | |||
271 | LICENSES/other/ZLib | ||
272 | |||
273 | Contiene il testo della licenza ZLIB e i suoi metatag. | ||
274 | |||
275 | Metatag: | ||
276 | |||
277 | I metatag necessari per le 'altre' ('other') licenze sono gli stessi | ||
278 | di usati per le `Licenze raccomandate`_. | ||
279 | |||
280 | Esempio del formato del file:: | ||
281 | |||
282 | Valid-License-Identifier: ISC | ||
283 | SPDX-URL: https://spdx.org/licenses/ISC.html | ||
284 | Usage-Guide: | ||
285 | Usage of this license in the kernel for new code is discouraged | ||
286 | and it should solely be used for importing code from an already | ||
287 | existing project. | ||
288 | To use this license in source code, put the following SPDX | ||
289 | tag/value pair into a comment according to the placement | ||
290 | guidelines in the licensing rules documentation. | ||
291 | SPDX-License-Identifier: ISC | ||
292 | License-Text: | ||
293 | Full license text | ||
294 | |||
295 | | | ||
296 | |||
297 | 3. _`Eccezioni`: | ||
298 | |||
299 | Alcune licenze possono essere corrette con delle eccezioni che forniscono | ||
300 | diritti aggiuntivi. Queste eccezioni sono disponibili nei sorgenti del | ||
301 | kernel nella cartella:: | ||
302 | |||
303 | LICENSES/exceptions/ | ||
304 | |||
305 | I file in questa cartella contengono il testo completo dell'eccezione e i | ||
306 | `Metatag per le eccezioni`_. | ||
307 | |||
308 | Esempi:: | ||
309 | |||
310 | LICENSES/exceptions/Linux-syscall-note | ||
311 | |||
312 | Contiene la descrizione dell'eccezione per le chiamate di sistema Linux | ||
313 | così come documentato nel file COPYING del kernel Linux; questo viene usato | ||
314 | per i file d'intestazione per la UAPI. Per esempio | ||
315 | /\* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note \*/:: | ||
316 | |||
317 | LICENSES/exceptions/GCC-exception-2.0 | ||
318 | |||
319 | Contiene la 'eccezione di linking' che permette di collegare qualsiasi | ||
320 | binario, indipendentemente dalla sua licenza, con un compilato il cui file | ||
321 | sorgente è marchiato con questa eccezione. Questo è necessario per creare | ||
322 | eseguibili dai sorgenti che non sono compatibili con la GPL. | ||
323 | |||
324 | _`Metatag per le eccezioni`: | ||
325 | |||
326 | Un file contenente un'eccezione deve avere i seguenti metatag: | ||
327 | |||
328 | - SPDX-Exception-Identifier: | ||
329 | |||
330 | Un identificatore d'eccezione che possa essere usato in combinazione con | ||
331 | un identificatore di licenza SPDX. | ||
332 | |||
333 | - SPDX-URL: | ||
334 | |||
335 | L'URL della pagina SPDX che contiene informazioni aggiuntive riguardanti | ||
336 | l'eccezione. | ||
337 | |||
338 | - SPDX-Licenses: | ||
339 | |||
340 | Una lista di licenze SPDX separate da virgola, che possono essere usate | ||
341 | con l'eccezione. | ||
342 | |||
343 | - Usage-Guidance: | ||
344 | |||
345 | Testo in formato libero per dare suggerimenti agli utenti. Il testo deve | ||
346 | includere degli esempi su come usare gli identificatori di licenza SPDX | ||
347 | in un file sorgente in conformità con le linea guida in | ||
348 | `Sintassi degli identificatori di licenza`_. | ||
349 | |||
350 | - Exception-Text: | ||
351 | |||
352 | Tutto il testo che compare dopo questa etichetta viene trattato | ||
353 | come se fosse parte del testo originale della licenza. | ||
354 | |||
355 | Esempi:: | ||
356 | |||
357 | SPDX-Exception-Identifier: Linux-syscall-note | ||
358 | SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html | ||
359 | SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+ | ||
360 | Usage-Guidance: | ||
361 | This exception is used together with one of the above SPDX-Licenses | ||
362 | to mark user-space API (uapi) header files so they can be included | ||
363 | into non GPL compliant user-space application code. | ||
364 | To use this exception add it with the keyword WITH to one of the | ||
365 | identifiers in the SPDX-Licenses tag: | ||
366 | SPDX-License-Identifier: <SPDX-License> WITH Linux-syscall-note | ||
367 | Exception-Text: | ||
368 | Full exception text | ||
369 | |||
370 | :: | ||
371 | |||
372 | SPDX-Exception-Identifier: GCC-exception-2.0 | ||
373 | SPDX-URL: https://spdx.org/licenses/GCC-exception-2.0.html | ||
374 | SPDX-Licenses: GPL-2.0, GPL-2.0+ | ||
375 | Usage-Guidance: | ||
376 | The "GCC Runtime Library exception 2.0" is used together with one | ||
377 | of the above SPDX-Licenses for code imported from the GCC runtime | ||
378 | library. | ||
379 | To use this exception add it with the keyword WITH to one of the | ||
380 | identifiers in the SPDX-Licenses tag: | ||
381 | SPDX-License-Identifier: <SPDX-License> WITH GCC-exception-2.0 | ||
382 | Exception-Text: | ||
383 | Full exception text | ||
384 | |||
385 | Per ogni identificatore di licenza SPDX e per le eccezioni dev'esserci un file | ||
386 | nella sotto-cartella LICENSES. Questo è necessario per permettere agli | ||
387 | strumenti di effettuare verifiche (come checkpatch.pl), per avere le licenze | ||
388 | disponibili per la lettura e per estrarre i diritti dai sorgenti, così come | ||
389 | raccomandato da diverse organizzazioni FOSS, per esempio l'`iniziativa FSFE | ||
390 | REUSE <https://reuse.software/>`_. | ||
391 | |||
392 | _`MODULE_LICENSE` | ||
393 | ----------------- | ||
394 | |||
395 | I moduli del kernel necessitano di un'etichetta MODULE_LICENSE(). Questa | ||
396 | etichetta non sostituisce le informazioni sulla licenza del codice sorgente | ||
397 | (SPDX-License-Identifier) né fornisce informazioni che esprimono o | ||
398 | determinano l'esatta licenza sotto la quale viene rilasciato. | ||
399 | |||
400 | Il solo scopo di questa etichetta è quello di fornire sufficienti | ||
401 | informazioni al caricatore di moduli del kernel, o agli strumenti in spazio | ||
402 | utente, per capire se il modulo è libero o proprietario. | ||
403 | |||
404 | Le stringe di licenza valide per MODULE_LICENSE() sono: | ||
405 | |||
406 | ============================= ============================================= | ||
407 | "GPL" Il modulo è licenziato con la GPL versione 2. | ||
408 | Questo non fa distinzione fra GPL'2.0-only o | ||
409 | GPL-2.0-or-later. L'esatta licenza può essere | ||
410 | determinata solo leggendo i corrispondenti | ||
411 | file sorgenti. | ||
412 | |||
413 | "GPL v2" Stesso significato di "GPL". Esiste per | ||
414 | motivi storici. | ||
415 | |||
416 | "GPL and additional rights" Questa è una variante che esiste per motivi | ||
417 | storici che indica che i sorgenti di un | ||
418 | modulo sono rilasciati sotto una variante | ||
419 | della licenza GPL v2 e quella MIT. Per favore | ||
420 | non utilizzatela per codice nuovo. | ||
421 | |||
422 | "Dual MIT/GPL" Questo è il modo corretto per esprimere il | ||
423 | il fatto che il modulo è rilasciato con | ||
424 | doppia licenza a scelta fra: una variante | ||
425 | della GPL v2 o la licenza MIT. | ||
426 | |||
427 | "Dual BSD/GPL" Questo modulo è rilasciato con doppia licenza | ||
428 | a scelta fra: una variante della GPL v2 o la | ||
429 | licenza BSD. La variante esatta della licenza | ||
430 | BSD può essere determinata solo attraverso i | ||
431 | corrispondenti file sorgenti. | ||
432 | |||
433 | "Dual MPL/GPL" Questo modulo è rilasciato con doppia licenza | ||
434 | a scelta fra: una variante della GPL v2 o la | ||
435 | Mozilla Public License (MPL). La variante | ||
436 | esatta della licenza MPL può essere | ||
437 | determinata solo attraverso i corrispondenti | ||
438 | file sorgenti. | ||
439 | |||
440 | "Proprietary" Questo modulo è rilasciato con licenza | ||
441 | proprietaria. Questa stringa è solo per i | ||
442 | moduli proprietari di terze parti e non può | ||
443 | essere usata per quelli che risiedono nei | ||
444 | sorgenti del kernel. I moduli etichettati in | ||
445 | questo modo stanno contaminando il kernel e | ||
446 | gli viene assegnato un flag 'P'; quando | ||
447 | vengono caricati, il caricatore di moduli del | ||
448 | kernel si rifiuterà di collegare questi | ||
449 | moduli ai simboli che sono stati esportati | ||
450 | con EXPORT_SYMBOL_GPL(). | ||
451 | |||
452 | ============================= ============================================= | ||
diff --git a/Documentation/translations/it_IT/process/maintainer-pgp-guide.rst b/Documentation/translations/it_IT/process/maintainer-pgp-guide.rst index 24a133f0a51d..276db0e37f43 100644 --- a/Documentation/translations/it_IT/process/maintainer-pgp-guide.rst +++ b/Documentation/translations/it_IT/process/maintainer-pgp-guide.rst | |||
@@ -1,13 +1,946 @@ | |||
1 | .. include:: ../disclaimer-ita.rst | 1 | .. include:: ../disclaimer-ita.rst |
2 | 2 | ||
3 | :Original: :ref:`Documentation/process/maintainer-pgp-guide.rst <pgpguide>` | 3 | :Original: :ref:`Documentation/process/maintainer-pgp-guide.rst <pgpguide>` |
4 | :Translator: Alessia Mantegazza <amantegazza@vaga.pv.it> | ||
4 | 5 | ||
5 | .. _it_pgpguide: | 6 | .. _it_pgpguide: |
6 | 7 | ||
8 | ========================================= | ||
9 | La guida a PGP per manutentori del kernel | ||
10 | ========================================= | ||
11 | |||
12 | :Author: Konstantin Ryabitsev <konstantin@linuxfoundation.org> | ||
13 | |||
14 | Questo documento è destinato agli sviluppatori del kernel Linux, in particolar | ||
15 | modo ai manutentori. Contiene degli approfondimenti riguardo informazioni che | ||
16 | sono state affrontate in maniera più generale nella sezione | ||
17 | "`Protecting Code Integrity`_" pubblicata dalla Linux Foundation. | ||
18 | Per approfondire alcuni argomenti trattati in questo documento è consigliato | ||
19 | leggere il documento sopraindicato | ||
20 | |||
21 | .. _`Protecting Code Integrity`: https://github.com/lfit/itpol/blob/master/protecting-code-integrity.md | ||
22 | |||
23 | Il ruolo di PGP nello sviluppo del kernel Linux | ||
24 | =============================================== | ||
25 | |||
26 | PGP aiuta ad assicurare l'integrità del codice prodotto dalla comunità | ||
27 | di sviluppo del kernel e, in secondo luogo, stabilisce canali di comunicazione | ||
28 | affidabili tra sviluppatori attraverso lo scambio di email firmate con PGP. | ||
29 | |||
30 | Il codice sorgente del kernel Linux è disponibile principalmente in due | ||
31 | formati: | ||
32 | |||
33 | - repositori distribuiti di sorgenti (git) | ||
34 | - rilasci periodici di istantanee (archivi tar) | ||
35 | |||
36 | Sia i repositori git che gli archivi tar portano le firme PGP degli | ||
37 | sviluppatori che hanno creato i rilasci ufficiali del kernel. Queste firme | ||
38 | offrono una garanzia crittografica che le versioni scaricabili rese disponibili | ||
39 | via kernel.org, o altri portali, siano identiche a quelle che gli sviluppatori | ||
40 | hanno sul loro posto di lavoro. A tal scopo: | ||
41 | |||
42 | - i repositori git forniscono firme PGP per ogni tag | ||
43 | - gli archivi tar hanno firme separate per ogni archivio | ||
44 | |||
45 | .. _it_devs_not_infra: | ||
46 | |||
47 | Fidatevi degli sviluppatori e non dell'infrastruttura | ||
48 | ----------------------------------------------------- | ||
49 | |||
50 | Fin dal 2011, quando i sistemi di kernel.org furono compromessi, il principio | ||
51 | generale del progetto Kernel Archives è stato quello di assumere che qualsiasi | ||
52 | parte dell'infrastruttura possa essere compromessa in ogni momento. Per questa | ||
53 | ragione, gli amministratori hanno intrapreso deliberatemene dei passi per | ||
54 | enfatizzare che la fiducia debba risiedere sempre negli sviluppatori e mai nel | ||
55 | codice che gestisce l'infrastruttura, indipendentemente da quali che siano le | ||
56 | pratiche di sicurezza messe in atto. | ||
57 | |||
58 | Il principio sopra indicato è la ragione per la quale è necessaria questa | ||
59 | guida. Vogliamo essere sicuri che il riporre la fiducia negli sviluppatori | ||
60 | non sia fatto semplicemente per incolpare qualcun'altro per future falle di | ||
61 | sicurezza. L'obiettivo è quello di fornire una serie di linee guida che gli | ||
62 | sviluppatori possano seguire per creare un ambiente di lavoro sicuro e | ||
63 | salvaguardare le chiavi PGP usate nello stabilire l'integrità del kernel Linux | ||
64 | stesso. | ||
65 | |||
66 | .. _it_pgp_tools: | ||
67 | |||
68 | Strumenti PGP | ||
69 | ============= | ||
70 | |||
71 | Usare GnuPG v2 | ||
72 | -------------- | ||
73 | |||
74 | La vostra distribuzione potrebbe avere già installato GnuPG, dovete solo | ||
75 | verificare che stia utilizzando la versione 2.x e non la serie 1.4 -- | ||
76 | molte distribuzioni forniscono entrambe, di base il comando ''gpg'' | ||
77 | invoca GnuPG v.1. Per controllate usate:: | ||
78 | |||
79 | $ gpg --version | head -n1 | ||
80 | |||
81 | Se visualizzate ``gpg (GnuPG) 1.4.x``, allora state usando GnuPG v.1. | ||
82 | Provate il comando ``gpg2`` (se non lo avete, potreste aver bisogno | ||
83 | di installare il pacchetto gnupg2):: | ||
84 | |||
85 | $ gpg2 --version | head -n1 | ||
86 | |||
87 | Se visualizzate ``gpg (GnuPG) 2.x.x``, allora siete pronti a partire. | ||
88 | Questa guida assume che abbiate la versione 2.2.(o successiva) di GnuPG. | ||
89 | Se state usando la versione 2.0, alcuni dei comandi indicati qui non | ||
90 | funzioneranno, in questo caso considerate un aggiornamento all'ultima versione, | ||
91 | la 2.2. Versioni di gnupg-2.1.11 e successive dovrebbero essere compatibili | ||
92 | per gli obiettivi di questa guida. | ||
93 | |||
94 | Se avete entrambi i comandi: ``gpg`` e ``gpg2``, assicuratevi di utilizzare | ||
95 | sempre la versione V2, e non quella vecchia. Per evitare errori potreste creare | ||
96 | un alias:: | ||
97 | |||
98 | $ alias gpg=gpg2 | ||
99 | |||
100 | Potete mettere questa opzione nel vostro ``.bashrc`` in modo da essere sicuri. | ||
101 | |||
102 | Configurare le opzioni di gpg-agent | ||
103 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
104 | |||
105 | L'agente GnuPG è uno strumento di aiuto che partirà automaticamente ogni volta | ||
106 | che userete il comando ``gpg`` e funzionerà in background con l'obiettivo di | ||
107 | individuare la passphrase. Ci sono due opzioni che dovreste conoscere | ||
108 | per personalizzare la scadenza della passphrase nella cache: | ||
109 | |||
110 | - ``default-cache-ttl`` (secondi): Se usate ancora la stessa chiave prima | ||
111 | che il time-to-live termini, il conto alla rovescia si resetterà per un | ||
112 | altro periodo. Di base è di 600 (10 minuti). | ||
113 | |||
114 | - ``max-cache-ttl`` (secondi): indipendentemente da quanto sia recente l'ultimo | ||
115 | uso della chiave da quando avete inserito la passphrase, se il massimo | ||
116 | time-to-live è scaduto, dovrete reinserire nuovamente la passphrase. | ||
117 | Di base è di 30 minuti. | ||
118 | |||
119 | Se ritenete entrambe questi valori di base troppo corti (o troppo lunghi), | ||
120 | potete creare il vostro file ``~/.gnupg/gpg-agent.conf`` ed impostare i vostri | ||
121 | valori:: | ||
122 | |||
123 | # set to 30 minutes for regular ttl, and 2 hours for max ttl | ||
124 | default-cache-ttl 1800 | ||
125 | max-cache-ttl 7200 | ||
126 | |||
127 | .. note:: | ||
128 | |||
129 | Non è più necessario far partire l'agente gpg manualmente all'inizio della | ||
130 | vostra sessione. Dovreste controllare i file rc per rimuovere tutto ciò che | ||
131 | riguarda vecchie le versioni di GnuPG, poiché potrebbero non svolgere più | ||
132 | bene il loro compito. | ||
133 | |||
134 | Impostare un *refresh* con cronjob | ||
135 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
136 | |||
137 | Potreste aver bisogno di rinfrescare regolarmente il vostro portachiavi in | ||
138 | modo aggiornare le chiavi pubbliche di altre persone, lavoro che è svolto | ||
139 | al meglio con un cronjob giornaliero:: | ||
140 | |||
141 | @daily /usr/bin/gpg2 --refresh >/dev/null 2>&1 | ||
142 | |||
143 | Controllate il percorso assoluto del vostro comando ``gpg`` o ``gpg2`` e usate | ||
144 | il comando ``gpg2`` se per voi ``gpg`` corrisponde alla versione GnuPG v.1. | ||
145 | |||
146 | .. _it_master_key: | ||
147 | |||
148 | Proteggere la vostra chiave PGP primaria | ||
7 | ======================================== | 149 | ======================================== |
8 | Guida a PGP per i manutentori del kernel | 150 | |
9 | ======================================== | 151 | Questa guida parte dal presupposto che abbiate già una chiave PGP che usate |
152 | per lo sviluppo del kernel Linux. Se non ne avete ancora una, date uno sguardo | ||
153 | al documento "`Protecting Code Integrity`_" che abbiamo menzionato prima. | ||
154 | |||
155 | Dovreste inoltre creare una nuova chiave se quella attuale è inferiore a 2048 | ||
156 | bit (RSA). | ||
157 | |||
158 | Chiave principale o sottochiavi | ||
159 | ------------------------------- | ||
160 | |||
161 | Le sottochiavi sono chiavi PGP totalmente indipendenti, e sono collegate alla | ||
162 | chiave principale attraverso firme certificate. È quindi importante | ||
163 | comprendere i seguenti punti: | ||
164 | |||
165 | 1. Non ci sono differenze tecniche tra la chiave principale e la sottochiave. | ||
166 | 2. In fesa di creazione, assegniamo limitazioni funzionali ad ogni chiave | ||
167 | assegnando capacità specifiche. | ||
168 | 3. Una chiave PGP può avere 4 capacità: | ||
169 | |||
170 | - **[S]** può essere usata per firmare | ||
171 | - **[E]** può essere usata per criptare | ||
172 | - **[A]** può essere usata per autenticare | ||
173 | - **[C]** può essere usata per certificare altre chiavi | ||
174 | |||
175 | 4. Una singola chiave può avere più capacità | ||
176 | 5. Una sottochiave è completamente indipendente dalla chiave principale. | ||
177 | Un messaggio criptato con la sottochiave non può essere decrittato con | ||
178 | quella principale. Se perdete la vostra sottochiave privata, non può | ||
179 | essere rigenerata in nessun modo da quella principale. | ||
180 | |||
181 | La chiave con capacità **[C]** (certify) è identificata come la chiave | ||
182 | principale perché è l'unica che può essere usata per indicare la relazione | ||
183 | con altre chiavi. Solo la chiave **[C]** può essere usata per: | ||
184 | |||
185 | - Aggiungere o revocare altre chiavi (sottochiavi) che hanno capacità S/E/A | ||
186 | - Aggiungere, modificare o eliminare le identità (unids) associate alla chiave | ||
187 | - Aggiungere o modificare la data di termine di sé stessa o di ogni sottochiave | ||
188 | - Firmare le chiavi di altre persone a scopo di creare una rete di fiducia | ||
189 | |||
190 | Di base, alla creazione di nuove chiavi, GnuPG genera quanto segue: | ||
191 | |||
192 | - Una chiave madre che porta sia la capacità di certificazione che quella | ||
193 | di firma (**[SC]**) | ||
194 | - Una sottochiave separata con capacità di criptaggio (**[E]**) | ||
195 | |||
196 | Se avete usato i parametri di base per generare la vostra chiave, quello | ||
197 | sarà il risultato. Potete verificarlo utilizzando ``gpg --list-secret-keys``, | ||
198 | per esempio:: | ||
199 | |||
200 | sec rsa2048 2018-01-23 [SC] [expires: 2020-01-23] | ||
201 | 000000000000000000000000AAAABBBBCCCCDDDD | ||
202 | uid [ultimate] Alice Dev <adev@kernel.org> | ||
203 | ssb rsa2048 2018-01-23 [E] [expires: 2020-01-23] | ||
204 | |||
205 | Qualsiasi chiave che abbia la capacità **[C]** è la vostra chiave madre, | ||
206 | indipendentemente da quali altre capacità potreste averle assegnato. | ||
207 | |||
208 | La lunga riga sotto la voce ``sec`` è la vostra impronta digitale -- | ||
209 | negli esempi che seguono, quando vedere ``[fpr]`` ci si riferisce a questa | ||
210 | stringa di 40 caratteri. | ||
211 | |||
212 | Assicuratevi che la vostra passphrase sia forte | ||
213 | ----------------------------------------------- | ||
214 | |||
215 | GnuPG utilizza le passphrases per criptare la vostra chiave privata prima | ||
216 | di salvarla sul disco. In questo modo, anche se il contenuto della vostra | ||
217 | cartella ``.gnupg`` venisse letto o trafugato nella sia interezza, gli | ||
218 | attaccanti non potrebbero comunque utilizzare le vostre chiavi private senza | ||
219 | aver prima ottenuto la passphrase per decriptarle. | ||
220 | |||
221 | È assolutamente essenziale che le vostre chiavi private siano protette da | ||
222 | una passphrase forte. Per impostarla o cambiarla, usate:: | ||
223 | |||
224 | $ gpg --change-passphrase [fpr] | ||
225 | |||
226 | Create una sottochiave di firma separata | ||
227 | ---------------------------------------- | ||
228 | |||
229 | Il nostro obiettivo è di proteggere la chiave primaria spostandola su un | ||
230 | dispositivo sconnesso dalla rete, dunque se avete solo una chiave combinata | ||
231 | **[SC]** allora dovreste creare una sottochiave di firma separata:: | ||
232 | |||
233 | $ gpg --quick-add-key [fpr] ed25519 sign | ||
234 | |||
235 | Ricordate di informare il keyserver del vostro cambiamento, cosicché altri | ||
236 | possano ricevere la vostra nuova sottochiave:: | ||
237 | |||
238 | $ gpg --send-key [fpr] | ||
239 | |||
240 | .. note:: Supporto ECC in GnuPG | ||
241 | GnuPG 2.1 e successivi supportano pienamente *Elliptic Curve Cryptography*, | ||
242 | con la possibilità di combinare sottochiavi ECC con le tradizionali chiavi | ||
243 | primarie RSA. Il principale vantaggio della crittografia ECC è che è molto | ||
244 | più veloce da calcolare e crea firme più piccole se confrontate byte per | ||
245 | byte con le chiavi RSA a più di 2048 bit. A meno che non pensiate di | ||
246 | utilizzare un dispositivo smartcard che non supporta le operazioni ECC, vi | ||
247 | raccomandiamo ti creare sottochiavi di firma ECC per il vostro lavoro col | ||
248 | kernel. | ||
249 | |||
250 | Se per qualche ragione preferite rimanere con sottochiavi RSA, nel comando | ||
251 | precedente, sostituite "ed25519" con "rsa2048". | ||
252 | |||
253 | Copia di riserva della chiave primaria per gestire il recupero da disastro | ||
254 | -------------------------------------------------------------------------- | ||
255 | |||
256 | Maggiori sono le firme di altri sviluppatori che vengono applicate alla vostra, | ||
257 | maggiori saranno i motivi per avere una copia di riserva che non sia digitale, | ||
258 | al fine di effettuare un recupero da disastro. | ||
259 | |||
260 | Il modo migliore per creare una copia fisica della vostra chiave privata è | ||
261 | l'uso del programma ``paperkey``. Consultate ``man paperkey`` per maggiori | ||
262 | dettagli sul formato dell'output ed i suoi punti di forza rispetto ad altre | ||
263 | soluzioni. Paperkey dovrebbe essere già pacchettizzato per la maggior parte | ||
264 | delle distribuzioni. | ||
265 | |||
266 | Eseguite il seguente comando per creare una copia fisica di riserva della | ||
267 | vostra chiave privata:: | ||
268 | |||
269 | $ gpg --export-secret-key [fpr] | paperkey -o /tmp/key-backup.txt | ||
270 | |||
271 | Stampate il file (o fate un pipe direttamente verso lpr), poi prendete | ||
272 | una penna e scrivete la passphare sul margine del foglio. **Questo è | ||
273 | caldamente consigliato** perché la copia cartacea è comunque criptata con | ||
274 | la passphrase, e se mai doveste cambiarla non vi ricorderete qual'era al | ||
275 | momento della creazione di quella copia -- *garantito*. | ||
276 | |||
277 | Mettete la copia cartacea e la passphrase scritta a mano in una busta e | ||
278 | mettetela in un posto sicuro e ben protetto, preferibilmente fuori casa, | ||
279 | magari in una cassetta di sicurezza in banca. | ||
280 | |||
281 | .. note:: | ||
282 | |||
283 | Probabilmente la vostra stampante non è più quello stupido dispositivo | ||
284 | connesso alla porta parallela, ma dato che il suo output è comunque | ||
285 | criptato con la passphrase, eseguire la stampa in un sistema "cloud" | ||
286 | moderno dovrebbe essere comunque relativamente sicuro. Un'opzione potrebbe | ||
287 | essere quella di cambiare la passphrase della vostra chiave primaria | ||
288 | subito dopo aver finito con paperkey. | ||
289 | |||
290 | Copia di riserva di tutta la cartella GnuPG | ||
291 | ------------------------------------------- | ||
10 | 292 | ||
11 | .. warning:: | 293 | .. warning:: |
12 | 294 | ||
13 | TODO ancora da tradurre | 295 | **!!!Non saltate questo passo!!!** |
296 | |||
297 | Quando avete bisogno di recuperare le vostre chiavi PGP è importante avere | ||
298 | una copia di riserva pronta all'uso. Questo sta su un diverso piano di | ||
299 | prontezza rispetto al recupero da disastro che abbiamo risolto con | ||
300 | ``paperkey``. Vi affiderete a queste copie esterne quando dovreste usare la | ||
301 | vostra chiave Certify -- ovvero quando fate modifiche alle vostre chiavi o | ||
302 | firmate le chiavi di altre persone ad una conferenza o ad un gruppo d'incontro. | ||
303 | |||
304 | Incominciate con una piccola chiavetta di memoria USB (preferibilmente due) | ||
305 | che userete per le copie di riserva. Dovrete criptarle usando LUKS -- fate | ||
306 | riferimento alla documentazione della vostra distribuzione per capire come | ||
307 | fare. | ||
308 | |||
309 | Per la passphrase di criptazione, potete usare la stessa della vostra chiave | ||
310 | primaria. | ||
311 | |||
312 | Una volta che il processo di criptazione è finito, reinserite il disco USB ed | ||
313 | assicurativi che venga montato correttamente. Copiate interamente la cartella | ||
314 | ``.gnugp`` nel disco criptato:: | ||
315 | |||
316 | $ cp -a ~/.gnupg /media/disk/foo/gnupg-backup | ||
317 | |||
318 | Ora dovreste verificare che tutto continui a funzionare:: | ||
319 | |||
320 | $ gpg --homedir=/media/disk/foo/gnupg-backup --list-key [fpr] | ||
321 | |||
322 | Se non vedete errori, allora dovreste avere fatto tutto con successo. | ||
323 | Smontate il disco USB, etichettatelo per bene di modo da evitare di | ||
324 | distruggerne il contenuto non appena vi serve una chiavetta USB a caso, ed | ||
325 | infine mettetelo in un posto sicuro -- ma non troppo lontano, perché vi servirà | ||
326 | di tanto in tanto per modificare le identità, aggiungere o revocare | ||
327 | sottochiavi, o firmare le chiavi di altre persone. | ||
328 | |||
329 | Togliete la chiave primaria dalla vostra home | ||
330 | --------------------------------------------- | ||
331 | |||
332 | I file che si trovano nella vostra cartella home non sono poi così ben protetti | ||
333 | come potreste pensare. Potrebbero essere letti o trafugati in diversi modi: | ||
334 | |||
335 | - accidentalmente quando fate una rapida copia della cartella home per | ||
336 | configurare una nuova postazione | ||
337 | - da un amministratore di sistema negligente o malintenzionato | ||
338 | - attraverso copie di riserva insicure | ||
339 | - attraverso malware installato in alcune applicazioni (browser, lettori PDF, | ||
340 | eccetera) | ||
341 | - attraverso coercizione quando attraversate confini internazionali | ||
342 | |||
343 | Proteggere la vostra chiave con una buona passphare aiuta notevolmente a | ||
344 | ridurre i rischi elencati qui sopra, ma le passphrase possono essere scoperte | ||
345 | attraverso i keylogger, il shoulder-surfing, o altri modi. Per questi motivi, | ||
346 | nella configurazione si raccomanda di rimuove la chiave primaria dalla vostra | ||
347 | cartella home e la si archivia su un dispositivo disconnesso. | ||
348 | |||
349 | .. warning:: | ||
350 | |||
351 | Per favore, fate riferimento alla sezione precedente e assicuratevi | ||
352 | di aver fatto una copia di riserva totale della cartella GnuPG. Quello | ||
353 | che stiamo per fare renderà la vostra chiave inutile se non avete delle | ||
354 | copie di riserva utilizzabili! | ||
355 | |||
356 | Per prima cosa, identificate il keygrip della vostra chiave primaria:: | ||
357 | |||
358 | $ gpg --with-keygrip --list-key [fpr] | ||
359 | |||
360 | L'output assomiglierà a questo:: | ||
361 | |||
362 | pub rsa2048 2018-01-24 [SC] [expires: 2020-01-24] | ||
363 | 000000000000000000000000AAAABBBBCCCCDDDD | ||
364 | Keygrip = 1111000000000000000000000000000000000000 | ||
365 | uid [ultimate] Alice Dev <adev@kernel.org> | ||
366 | sub rsa2048 2018-01-24 [E] [expires: 2020-01-24] | ||
367 | Keygrip = 2222000000000000000000000000000000000000 | ||
368 | sub ed25519 2018-01-24 [S] | ||
369 | Keygrip = 3333000000000000000000000000000000000000 | ||
370 | |||
371 | Trovate la voce keygrid che si trova sotto alla riga ``pub`` (appena sotto | ||
372 | all'impronta digitale della chiave primaria). Questo corrisponderà direttamente | ||
373 | ad un file nella cartella ``~/.gnupg``:: | ||
374 | |||
375 | $ cd ~/.gnupg/private-keys-v1.d | ||
376 | $ ls | ||
377 | 1111000000000000000000000000000000000000.key | ||
378 | 2222000000000000000000000000000000000000.key | ||
379 | 3333000000000000000000000000000000000000.key | ||
380 | |||
381 | Quello che dovrete fare è rimuovere il file .key che corrisponde al keygrip | ||
382 | della chiave primaria:: | ||
383 | |||
384 | $ cd ~/.gnupg/private-keys-v1.d | ||
385 | $ rm 1111000000000000000000000000000000000000.key | ||
386 | |||
387 | Ora, se eseguite il comando ``--list-secret-keys``, vedrete che la chiave | ||
388 | primaria non compare più (il simbolo ``#`` indica che non è disponibile):: | ||
389 | |||
390 | $ gpg --list-secret-keys | ||
391 | sec# rsa2048 2018-01-24 [SC] [expires: 2020-01-24] | ||
392 | 000000000000000000000000AAAABBBBCCCCDDDD | ||
393 | uid [ultimate] Alice Dev <adev@kernel.org> | ||
394 | ssb rsa2048 2018-01-24 [E] [expires: 2020-01-24] | ||
395 | ssb ed25519 2018-01-24 [S] | ||
396 | |||
397 | Dovreste rimuovere anche i file ``secring.gpg`` che si trovano nella cartella | ||
398 | ``~/.gnupg``, in quanto rimasugli delle versioni precedenti di GnuPG. | ||
399 | |||
400 | Se non avete la cartella "private-keys-v1.d" | ||
401 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
402 | |||
403 | Se non avete la cartella ``~/.gnupg/private-keys-v1.d``, allora le vostre | ||
404 | chiavi segrete sono ancora salvate nel vecchio file ``secring.gpg`` usato | ||
405 | da GnuPG v1. Effettuare una qualsiasi modifica alla vostra chiave, come | ||
406 | cambiare la passphare o aggiungere una sottochiave, dovrebbe convertire | ||
407 | automaticamente il vecchio formato ``secring.gpg``nel nuovo | ||
408 | ``private-keys-v1.d``. | ||
409 | |||
410 | Una volta che l'avete fatto, assicuratevi di rimuovere il file ``secring.gpg``, | ||
411 | che continua a contenere la vostra chiave privata. | ||
412 | |||
413 | .. _it_smartcards: | ||
414 | |||
415 | Spostare le sottochiavi in un apposito dispositivo criptato | ||
416 | =========================================================== | ||
417 | |||
418 | Nonostante la chiave primaria sia ora al riparo da occhi e mani indiscrete, | ||
419 | le sottochiavi si trovano ancora nella vostra cartella home. Chiunque riesca | ||
420 | a mettere le sue mani su quelle chiavi riuscirà a decriptare le vostre | ||
421 | comunicazioni o a falsificare le vostre firme (se conoscono la passphrase). | ||
422 | Inoltre, ogni volta che viene fatta un'operazione con GnuPG, le chiavi vengono | ||
423 | caricate nella memoria di sistema e potrebbero essere rubate con l'uso di | ||
424 | malware sofisticati (pensate a Meltdown e a Spectre). | ||
425 | |||
426 | Il miglior modo per proteggere le proprie chiave è di spostarle su un | ||
427 | dispositivo specializzato in grado di effettuare operazioni smartcard. | ||
428 | |||
429 | I benefici di una smartcard | ||
430 | --------------------------- | ||
431 | |||
432 | Una smartcard contiene un chip crittografico che è capace di immagazzinare | ||
433 | le chiavi private ed effettuare operazioni crittografiche direttamente sulla | ||
434 | carta stessa. Dato che la chiave non lascia mai la smartcard, il sistema | ||
435 | operativo usato sul computer non sarà in grado di accedere alle chiavi. | ||
436 | Questo è molto diverso dai dischi USB criptati che abbiamo usato allo scopo di | ||
437 | avere una copia di riserva sicura -- quando il dispositivo USB è connesso e | ||
438 | montato, il sistema operativo potrà accedere al contenuto delle chiavi private. | ||
439 | |||
440 | L'uso di un disco USB criptato non può sostituire le funzioni di un dispositivo | ||
441 | capace di operazioni di tipo smartcard. | ||
442 | |||
443 | Dispositivi smartcard disponibili | ||
444 | --------------------------------- | ||
445 | |||
446 | A meno che tutti i vostri computer dispongano di lettori smartcard, il modo | ||
447 | più semplice è equipaggiarsi di un dispositivo USB specializzato che | ||
448 | implementi le funzionalità delle smartcard. Sul mercato ci sono diverse | ||
449 | soluzioni disponibili: | ||
450 | |||
451 | - `Nitrokey Start`_: è Open hardware e Free Software, è basata sul progetto | ||
452 | `GnuK`_ della FSIJ. Ha il supporto per chiavi ECC, ma meno funzionalità di | ||
453 | sicurezza (come la resistenza alla manomissione o alcuni attacchi ad un | ||
454 | canale laterale). | ||
455 | - `Nitrokey Pro`_: è simile alla Nitrokey Start, ma è più resistente alla | ||
456 | manomissione e offre più funzionalità di sicurezza, ma l'ECC. | ||
457 | - `Yubikey 4`_: l'hardware e il software sono proprietari, ma è più economica | ||
458 | della Nitrokey Pro ed è venduta anche con porta USB-C il che è utile con i | ||
459 | computer portatili più recenti. In aggiunta, offre altre funzionalità di | ||
460 | sicurezza come FIDO, U2F, ma non l'ECC | ||
461 | |||
462 | `Su LWN c'è una buona recensione`_ dei modelli elencati qui sopra e altri. | ||
463 | Se volete usare chiavi ECC, la vostra migliore scelta sul mercato è la | ||
464 | Nitrokey Start. | ||
465 | |||
466 | .. _`Nitrokey Start`: https://shop.nitrokey.com/shop/product/nitrokey-start-6 | ||
467 | .. _`Nitrokey Pro`: https://shop.nitrokey.com/shop/product/nitrokey-pro-3 | ||
468 | .. _`Yubikey 4`: https://www.yubico.com/product/yubikey-4-series/ | ||
469 | .. _Gnuk: http://www.fsij.org/doc-gnuk/ | ||
470 | .. _`Su LWN c'è una buona recensione`: https://lwn.net/Articles/736231/ | ||
471 | |||
472 | Configurare il vostro dispositivo smartcard | ||
473 | ------------------------------------------- | ||
474 | |||
475 | Il vostro dispositivo smartcard dovrebbe iniziare a funzionare non appena | ||
476 | lo collegate ad un qualsiasi computer Linux moderno. Potete verificarlo | ||
477 | eseguendo:: | ||
478 | |||
479 | $ gpg --card-status | ||
480 | |||
481 | Se vedete tutti i dettagli della smartcard, allora ci siamo. Sfortunatamente, | ||
482 | affrontare tutti i possibili motivi per cui le cose potrebbero non funzionare | ||
483 | non è lo scopo di questa guida. Se avete problemi nel far funzionare la carta | ||
484 | con GnuPG, cercate aiuto attraverso i soliti canali di supporto. | ||
485 | |||
486 | Per configurare la vostra smartcard, dato che non c'è una via facile dalla | ||
487 | riga di comando, dovrete usate il menu di GnuPG:: | ||
488 | |||
489 | $ gpg --card-edit | ||
490 | [...omitted...] | ||
491 | gpg/card> admin | ||
492 | Admin commands are allowed | ||
493 | gpg/card> passwd | ||
494 | |||
495 | Dovreste impostare il PIN dell'utente (1), quello dell'amministratore (3) e il | ||
496 | codice di reset (4). Assicuratevi di annotare e salvare questi codici in un | ||
497 | posto sicuro -- specialmente il PIN dell'amministratore e il codice di reset | ||
498 | (che vi permetterà di azzerare completamente la smartcard). Il PIN | ||
499 | dell'amministratore viene usato così raramente che è inevitabile dimenticarselo | ||
500 | se non lo si annota. | ||
501 | |||
502 | Tornando al nostro menu, potete impostare anche altri valori (come il nome, | ||
503 | il sesso, informazioni d'accesso, eccetera), ma non sono necessari e aggiunge | ||
504 | altre informazioni sulla carta che potrebbero trapelare in caso di smarrimento. | ||
505 | |||
506 | .. note:: | ||
507 | |||
508 | A dispetto del nome "PIN", né il PIN utente né quello dell'amministratore | ||
509 | devono essere esclusivamente numerici. | ||
510 | |||
511 | Spostare le sottochiavi sulla smartcard | ||
512 | --------------------------------------- | ||
513 | |||
514 | Uscite dal menu (usando "q") e salverete tutte le modifiche. Poi, spostiamo | ||
515 | tutte le sottochiavi sulla smartcard. Per la maggior parte delle operazioni | ||
516 | vi serviranno sia la passphrase della chiave PGP che il PIN | ||
517 | dell'amministratore:: | ||
518 | |||
519 | $ gpg --edit-key [fpr] | ||
520 | |||
521 | Secret subkeys are available. | ||
522 | |||
523 | pub rsa2048/AAAABBBBCCCCDDDD | ||
524 | created: 2018-01-23 expires: 2020-01-23 usage: SC | ||
525 | trust: ultimate validity: ultimate | ||
526 | ssb rsa2048/1111222233334444 | ||
527 | created: 2018-01-23 expires: never usage: E | ||
528 | ssb ed25519/5555666677778888 | ||
529 | created: 2017-12-07 expires: never usage: S | ||
530 | [ultimate] (1). Alice Dev <adev@kernel.org> | ||
531 | |||
532 | gpg> | ||
533 | |||
534 | Usando ``--edit-key`` si tornerà alla modalità menu e noterete che | ||
535 | la lista delle chiavi è leggermente diversa. Da questo momento in poi, | ||
536 | tutti i comandi saranno eseguiti nella modalità menu, come indicato | ||
537 | da ``gpg>``. | ||
538 | |||
539 | Per prima cosa, selezioniamo la chiave che verrà messa sulla carta -- | ||
540 | potete farlo digitando ``key 1`` (è la prima della lista, la sottochiave | ||
541 | **[E]**):: | ||
542 | |||
543 | gpg> key 1 | ||
544 | |||
545 | Nel'output dovreste vedere ``ssb*`` associato alla chiave **[E]**. Il simbolo | ||
546 | ``*`` indica che la chiave è stata "selezionata". Funziona come un | ||
547 | interruttore, ovvero se scrivete nuovamente ``key 1``, il simbolo ``*`` sparirà | ||
548 | e la chiave non sarà più selezionata. | ||
549 | |||
550 | Ora, spostiamo la chiave sulla smartcard:: | ||
551 | |||
552 | gpg> keytocard | ||
553 | Please select where to store the key: | ||
554 | (2) Encryption key | ||
555 | Your selection? 2 | ||
556 | |||
557 | Dato che è la nostra chiave **[E]**, ha senso metterla nella sezione criptata. | ||
558 | Quando confermerete la selezione, vi verrà chiesta la passphrase della vostra | ||
559 | chiave PGP, e poi il PIN dell'amministratore. Se il comando ritorna senza | ||
560 | errori, allora la vostra chiave è stata spostata con successo. | ||
561 | |||
562 | **Importante**: digitate nuovamente ``key 1`` per deselezionare la prima chiave | ||
563 | e selezionate la seconda chiave **[S]** con ``key 2``:: | ||
564 | |||
565 | gpg> key 1 | ||
566 | gpg> key 2 | ||
567 | gpg> keytocard | ||
568 | Please select where to store the key: | ||
569 | (1) Signature key | ||
570 | (3) Authentication key | ||
571 | Your selection? 1 | ||
572 | |||
573 | Potete usare la chiave **[S]** sia per firmare che per autenticare, ma vogliamo | ||
574 | che sia nella sezione di firma, quindi scegliete (1). Ancora una volta, se il | ||
575 | comando ritorna senza errori, allora l'operazione è avvenuta con successo:: | ||
576 | |||
577 | gpg> q | ||
578 | Save changes? (y/N) y | ||
579 | |||
580 | Salvando le modifiche cancellerete dalla vostra cartella home tutte le chiavi | ||
581 | che avete spostato sulla carta (ma questo non è un problema, perché abbiamo | ||
582 | fatto delle copie di sicurezza nel caso in cui dovessimo configurare una | ||
583 | nuova smartcard). | ||
584 | |||
585 | Verificare che le chiavi siano state spostate | ||
586 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
587 | |||
588 | Ora, se doveste usare l'opzione ``--list-secret-keys``, vedrete una | ||
589 | sottile differenza nell'output:: | ||
590 | |||
591 | $ gpg --list-secret-keys | ||
592 | sec# rsa2048 2018-01-24 [SC] [expires: 2020-01-24] | ||
593 | 000000000000000000000000AAAABBBBCCCCDDDD | ||
594 | uid [ultimate] Alice Dev <adev@kernel.org> | ||
595 | ssb> rsa2048 2018-01-24 [E] [expires: 2020-01-24] | ||
596 | ssb> ed25519 2018-01-24 [S] | ||
597 | |||
598 | Il simbolo ``>`` in ``ssb>`` indica che la sottochiave è disponibile solo | ||
599 | nella smartcard. Se tornate nella vostra cartella delle chiavi segrete e | ||
600 | guardate al suo contenuto, noterete che i file ``.key`` sono stati sostituiti | ||
601 | con degli stub:: | ||
602 | |||
603 | $ cd ~/.gnupg/private-keys-v1.d | ||
604 | $ strings *.key | grep 'private-key' | ||
605 | |||
606 | Per indicare che i file sono solo degli stub e che in realtà il contenuto è | ||
607 | sulla smartcard, l'output dovrebbe mostrarvi ``shadowed-private-key``. | ||
608 | |||
609 | Verificare che la smartcard funzioni | ||
610 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
611 | |||
612 | Per verificare che la smartcard funzioni come dovuto, potete creare | ||
613 | una firma:: | ||
614 | |||
615 | $ echo "Hello world" | gpg --clearsign > /tmp/test.asc | ||
616 | $ gpg --verify /tmp/test.asc | ||
617 | |||
618 | Col primo comando dovrebbe chiedervi il PIN della smartcard, e poi dovrebbe | ||
619 | mostrare "Good signature" dopo l'esecuzione di ``gpg --verify``. | ||
620 | |||
621 | Complimenti, siete riusciti a rendere estremamente difficile il furto della | ||
622 | vostra identità digitale di sviluppatore. | ||
623 | |||
624 | Altre operazioni possibili con GnuPG | ||
625 | ------------------------------------ | ||
626 | |||
627 | Segue un breve accenno ad alcune delle operazioni più comuni che dovrete | ||
628 | fare con le vostre chiavi PGP. | ||
629 | |||
630 | Montare il disco con la chiave primaria | ||
631 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
632 | |||
633 | Vi servirà la vostra chiave principale per tutte le operazioni che seguiranno, | ||
634 | per cui per prima cosa dovrete accedere ai vostri backup e dire a GnuPG di | ||
635 | usarli:: | ||
636 | |||
637 | $ export GNUPGHOME=/media/disk/foo/gnupg-backup | ||
638 | $ gpg --list-secret-keys | ||
639 | |||
640 | Dovete assicurarvi di vedere ``sec`` e non ``sec#`` nell'output del programma | ||
641 | (il simbolo ``#`` significa che la chiave non è disponibile e che state ancora | ||
642 | utilizzando la vostra solita cartella di lavoro). | ||
643 | |||
644 | Estendere la data di scadenza di una chiave | ||
645 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
646 | |||
647 | La chiave principale ha una data di scadenza di 2 anni dal momento della sua | ||
648 | creazione. Questo per motivi di sicurezza e per rendere obsolete le chiavi | ||
649 | che, eventualmente, dovessero sparire dai keyserver. | ||
650 | |||
651 | Per estendere di un anno, dalla data odierna, la scadenza di una vostra chiave, | ||
652 | eseguite:: | ||
653 | |||
654 | $ gpg --quick-set-expire [fpr] 1y | ||
655 | |||
656 | Se per voi è più facile da memorizzare, potete anche utilizzare una data | ||
657 | specifica (per esempio, il vostro compleanno o capodanno):: | ||
658 | |||
659 | $ gpg --quick-set-expire [fpr] 2020-07-01 | ||
660 | |||
661 | Ricordatevi di inviare l'aggiornamento ai keyserver:: | ||
662 | |||
663 | $ gpg --send-key [fpr] | ||
664 | |||
665 | Aggiornare la vostra cartella di lavoro dopo ogni modifica | ||
666 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
667 | |||
668 | Dopo aver fatto delle modifiche alle vostre chiavi usando uno spazio a parte, | ||
669 | dovreste importarle nella vostra cartella di lavoro abituale:: | ||
670 | |||
671 | $ gpg --export | gpg --homedir ~/.gnupg --import | ||
672 | $ unset GNUPGHOME | ||
673 | |||
674 | |||
675 | Usare PGP con Git | ||
676 | ================= | ||
677 | |||
678 | Una delle caratteristiche fondanti di Git è la sua natura decentralizzata -- | ||
679 | una volta che il repositorio è stato clonato sul vostro sistema, avete la | ||
680 | storia completa del progetto, inclusi i suoi tag, i commit ed i rami. Tuttavia, | ||
681 | con i centinaia di repositori clonati che ci sono in giro, come si fa a | ||
682 | verificare che la loro copia di linux.git non è stata manomessa da qualcuno? | ||
683 | |||
684 | Oppure, cosa succede se viene scoperta una backdoor nel codice e la riga | ||
685 | "Autore" dice che sei stato tu, mentre tu sei abbastanza sicuro di | ||
686 | `non averci niente a che fare`_? | ||
687 | |||
688 | Per risolvere entrambi i problemi, Git ha introdotto l'integrazione con PGP. | ||
689 | I tag firmati dimostrano che il repositorio è integro assicurando che il suo | ||
690 | contenuto è lo stesso che si trova sulle macchine degli sviluppatori che hanno | ||
691 | creato il tag; mentre i commit firmati rendono praticamente impossibile | ||
692 | ad un malintenzionato di impersonarvi senza avere accesso alle vostre chiavi | ||
693 | PGP. | ||
694 | |||
695 | .. _`non averci niente a che fare`: https://github.com/jayphelps/git-blame-someone-else | ||
696 | |||
697 | Configurare git per usare la vostra chiave PGP | ||
698 | ---------------------------------------------- | ||
699 | |||
700 | Se avete solo una chiave segreta nel vostro portachiavi, allora non avete nulla | ||
701 | da fare in più dato che sarà la vostra chiave di base. Tuttavia, se doveste | ||
702 | avere più chiavi segrete, potete dire a git quale dovrebbe usare (``[fpg]`` | ||
703 | è la vostra impronta digitale):: | ||
704 | |||
705 | $ git config --global user.signingKey [fpr] | ||
706 | |||
707 | **IMPORTANTE**: se avete una comando dedicato per ``gpg2``, allora dovreste | ||
708 | dire a git di usare sempre quello piuttosto che il vecchio comando ``gpg``:: | ||
709 | |||
710 | $ git config --global gpg.program gpg2 | ||
711 | |||
712 | Come firmare i tag | ||
713 | ------------------ | ||
714 | |||
715 | Per creare un tag firmato, passate l'opzione ``-s`` al comando tag:: | ||
716 | |||
717 | $ git tag -s [tagname] | ||
718 | |||
719 | La nostra raccomandazione è quella di firmare sempre i tag git, perché | ||
720 | questo permette agli altri sviluppatori di verificare che il repositorio | ||
721 | git dal quale stanno prendendo il codice non è stato alterato intenzionalmente. | ||
722 | |||
723 | Come verificare i tag firmati | ||
724 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
725 | |||
726 | Per verificare un tag firmato, potete usare il comando ``verify-tag``:: | ||
727 | |||
728 | $ git verify-tag [tagname] | ||
729 | |||
730 | Se state prendendo un tag da un fork del repositorio del progetto, git | ||
731 | dovrebbe verificare automaticamente la firma di quello che state prendendo | ||
732 | e vi mostrerà il risultato durante l'operazione di merge:: | ||
733 | |||
734 | $ git pull [url] tags/sometag | ||
735 | |||
736 | Il merge conterrà qualcosa di simile:: | ||
737 | |||
738 | Merge tag 'sometag' of [url] | ||
739 | |||
740 | [Tag message] | ||
741 | |||
742 | # gpg: Signature made [...] | ||
743 | # gpg: Good signature from [...] | ||
744 | |||
745 | Se state verificando il tag di qualcun altro, allora dovrete importare | ||
746 | la loro chiave PGP. Fate riferimento alla sezione ":ref:`it_verify_identities`" | ||
747 | che troverete più avanti. | ||
748 | |||
749 | Configurare git per firmare sempre i tag con annotazione | ||
750 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
751 | |||
752 | Se state creando un tag con annotazione è molto probabile che vogliate | ||
753 | firmarlo. Per imporre a git di firmare sempre un tag con annotazione, | ||
754 | dovete impostare la seguente opzione globale:: | ||
755 | |||
756 | $ git config --global tag.forceSignAnnotated true | ||
757 | |||
758 | Come usare commit firmati | ||
759 | ------------------------- | ||
760 | |||
761 | Creare dei commit firmati è facile, ma è molto più difficile utilizzarli | ||
762 | nello sviluppo del kernel linux per via del fatto che ci si affida alle | ||
763 | liste di discussione e questo modo di procedere non mantiene le firme PGP | ||
764 | nei commit. In aggiunta, quando si usa *rebase* nel proprio repositorio | ||
765 | locale per allinearsi al kernel anche le proprie firme PGP verranno scartate. | ||
766 | Per questo motivo, la maggior parte degli sviluppatori del kernel non si | ||
767 | preoccupano troppo di firmare i propri commit ed ignoreranno quelli firmati | ||
768 | che si trovano in altri repositori usati per il proprio lavoro. | ||
769 | |||
770 | Tuttavia, se avete il vostro repositorio di lavoro disponibile al pubblico | ||
771 | su un qualche servizio di hosting git (kernel.org, infradead.org, ozlabs.org, | ||
772 | o altri), allora la raccomandazione è di firmare tutti i vostri commit | ||
773 | anche se gli sviluppatori non ne beneficeranno direttamente. | ||
774 | |||
775 | Vi raccomandiamo di farlo per i seguenti motivi: | ||
776 | |||
777 | 1. Se dovesse mai esserci la necessità di fare delle analisi forensi o | ||
778 | tracciare la provenienza di un codice, anche sorgenti mantenuti | ||
779 | esternamente che hanno firme PGP sui commit avranno un certo valore a | ||
780 | questo scopo. | ||
781 | 2. Se dovesse mai capitarvi di clonare il vostro repositorio locale (per | ||
782 | esempio dopo un danneggiamento del disco), la firma vi permetterà di | ||
783 | verificare l'integrità del repositorio prima di riprendere il lavoro. | ||
784 | 3. Se qualcuno volesse usare *cherry-pick* sui vostri commit, allora la firma | ||
785 | permetterà di verificare l'integrità dei commit prima di applicarli. | ||
786 | |||
787 | Creare commit firmati | ||
788 | ~~~~~~~~~~~~~~~~~~~~~ | ||
789 | |||
790 | Per creare un commit firmato, dovete solamente aggiungere l'opzione ``-S`` | ||
791 | al comando ``git commit`` (si usa la lettera maiuscola per evitare | ||
792 | conflitti con un'altra opzione):: | ||
793 | |||
794 | $ git commit -S | ||
795 | |||
796 | Configurare git per firmare sempre i commit | ||
797 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
798 | |||
799 | Potete dire a git di firmare sempre i commit:: | ||
800 | |||
801 | git config --global commit.gpgSign true | ||
802 | |||
803 | .. note:: | ||
804 | |||
805 | Assicuratevi di aver configurato ``gpg-agent`` prima di abilitare | ||
806 | questa opzione. | ||
807 | |||
808 | .. _it_verify_identities: | ||
809 | |||
810 | Come verificare l'identità degli sviluppatori del kernel | ||
811 | ======================================================== | ||
812 | |||
813 | Firmare i tag e i commit è facile, ma come si fa a verificare che la chiave | ||
814 | usata per firmare qualcosa appartenga davvero allo sviluppatore e non ad un | ||
815 | impostore? | ||
816 | |||
817 | Configurare l'auto-key-retrieval usando WKD e DANE | ||
818 | -------------------------------------------------- | ||
819 | |||
820 | Se non siete ancora in possesso di una vasta collezione di chiavi pubbliche | ||
821 | di altri sviluppatori, allora potreste iniziare il vostro portachiavi | ||
822 | affidandovi ai servizi di auto-scoperta e auto-recupero. GnuPG può affidarsi | ||
823 | ad altre tecnologie di delega della fiducia, come DNSSEC e TLS, per sostenervi | ||
824 | nel caso in cui iniziare una propria rete di fiducia da zero sia troppo | ||
825 | scoraggiante. | ||
826 | |||
827 | Aggiungete il seguente testo al vostro file ``~/.gnupg/gpg.conf``:: | ||
828 | |||
829 | auto-key-locate wkd,dane,local | ||
830 | auto-key-retrieve | ||
831 | |||
832 | La *DNS-Based Authentication of Named Entities* ("DANE") è un metodo | ||
833 | per la pubblicazione di chiavi pubbliche su DNS e per renderle sicure usando | ||
834 | zone firmate con DNSSEC. Il *Web Key Directory* ("WKD") è un metodo | ||
835 | alternativo che usa https a scopo di ricerca. Quando si usano DANE o WKD | ||
836 | per la ricerca di chiavi pubbliche, GnuPG validerà i certificati DNSSEC o TLS | ||
837 | prima di aggiungere al vostro portachiavi locale le eventuali chiavi trovate. | ||
838 | |||
839 | Kernel.org pubblica la WKD per tutti gli sviluppatori che hanno un account | ||
840 | kernel.org. Una volta che avete applicato le modifiche al file ``gpg.conf``, | ||
841 | potrete auto-recuperare le chiavi di Linus Torvalds e Greg Kroah-Hartman | ||
842 | (se non le avete già):: | ||
843 | |||
844 | $ gpg --locate-keys torvalds@kernel.org gregkh@kernel.org | ||
845 | |||
846 | Se avete un account kernel.org, al fine di rendere più utile l'uso di WKD | ||
847 | da parte di altri sviluppatori del kernel, dovreste `aggiungere alla vostra | ||
848 | chiave lo UID di kernel.org`_. | ||
849 | |||
850 | .. _`aggiungere alla vostra chiave lo UID di kernel.org`: https://korg.wiki.kernel.org/userdoc/mail#adding_a_kernelorg_uid_to_your_pgp_key | ||
851 | |||
852 | Web of Trust (WOT) o Trust on First Use (TOFU) | ||
853 | ---------------------------------------------- | ||
854 | |||
855 | PGP incorpora un meccanismo di delega della fiducia conosciuto come | ||
856 | "Web of Trust". Di base, questo è un tentativo di sostituire la necessità | ||
857 | di un'autorità certificativa centralizzata tipica del mondo HTTPS/TLS. | ||
858 | Invece di avere svariati produttori software che decidono chi dovrebbero | ||
859 | essere le entità di certificazione di cui dovreste fidarvi, PGP lascia | ||
860 | la responsabilità ad ogni singolo utente. | ||
861 | |||
862 | Sfortunatamente, solo poche persone capiscono come funziona la rete di fiducia. | ||
863 | Nonostante sia un importante aspetto della specifica OpenPGP, recentemente | ||
864 | le versioni di GnuPG (2.2 e successive) hanno implementato un meccanisco | ||
865 | alternativo chiamato "Trust on First Use" (TOFU). Potete pensare a TOFU come | ||
866 | "ad un approccio all fidicia simile ad SSH". In SSH, la prima volta che vi | ||
867 | connettete ad un sistema remoto, l'impronta digitale della chiave viene | ||
868 | registrata e ricordata. Se la chiave dovesse cambiare in futuro, il programma | ||
869 | SSH vi avviserà e si rifiuterà di connettersi, obbligandovi a prendere una | ||
870 | decisione circa la fiducia che riponete nella nuova chiave. In modo simile, | ||
871 | la prima volta che importate la chiave PGP di qualcuno, si assume sia valida. | ||
872 | Se ad un certo punto GnuPG trova un'altra chiave con la stessa identità, | ||
873 | entrambe, la vecchia e la nuova, verranno segnate come invalide e dovrete | ||
874 | verificare manualmente quale tenere. | ||
875 | |||
876 | Vi raccomandiamo di usare il meccanisco TOFU+PGP (che è la nuova configurazione | ||
877 | di base di GnuPG v2). Per farlo, aggiungete (o modificate) l'impostazione | ||
878 | ``trust-model`` in ``~/.gnupg/gpg.conf``:: | ||
879 | |||
880 | trust-model tofu+pgp | ||
881 | |||
882 | Come usare i keyserver in sicurezza | ||
883 | ----------------------------------- | ||
884 | Se ottenete l'errore "No public key" quando cercate di validate il tag di | ||
885 | qualcuno, allora dovreste cercare quella chiave usando un keyserver. È | ||
886 | importante tenere bene a mente che non c'è alcuna garanzia che la chiave | ||
887 | che avete recuperato da un keyserver PGP appartenga davvero alla persona | ||
888 | reale -- è progettato così. Dovreste usare il Web of Trust per assicurarvi | ||
889 | che la chiave sia valida. | ||
890 | |||
891 | Come mantenere il Web of Trust va oltre gli scopi di questo documento, | ||
892 | semplicemente perché farlo come si deve richiede sia sforzi che perseveranza | ||
893 | che tendono ad andare oltre al livello di interesse della maggior parte degli | ||
894 | esseri umani. Qui di seguito alcuni rapidi suggerimenti per aiutarvi a ridurre | ||
895 | il rischio di importare chiavi maligne. | ||
896 | |||
897 | Primo, diciamo che avete provato ad eseguire ``git verify-tag`` ma restituisce | ||
898 | un errore dicendo che la chiave non è stata trovata:: | ||
899 | |||
900 | $ git verify-tag sunxi-fixes-for-4.15-2 | ||
901 | gpg: Signature made Sun 07 Jan 2018 10:51:55 PM EST | ||
902 | gpg: using RSA key DA73759BF8619E484E5A3B47389A54219C0F2430 | ||
903 | gpg: issuer "wens@...org" | ||
904 | gpg: Can't check signature: No public key | ||
905 | |||
906 | Cerchiamo nel keyserver per maggiori informazioni sull'impronta digitale | ||
907 | della chiave (l'impronta digitale, probabilmente, appartiene ad una | ||
908 | sottochiave, dunque non possiamo usarla direttamente senza trovare prima | ||
909 | l'ID della chiave primaria associata ad essa):: | ||
910 | |||
911 | $ gpg --search DA73759BF8619E484E5A3B47389A54219C0F2430 | ||
912 | gpg: data source: hkp://keys.gnupg.net | ||
913 | (1) Chen-Yu Tsai <wens@...org> | ||
914 | 4096 bit RSA key C94035C21B4F2AEB, created: 2017-03-14, expires: 2019-03-15 | ||
915 | Keys 1-1 of 1 for "DA73759BF8619E484E5A3B47389A54219C0F2430". Enter number(s), N)ext, or Q)uit > q | ||
916 | |||
917 | Localizzate l'ID della chiave primaria, nel nostro esempio | ||
918 | ``C94035C21B4F2AEB``. Ora visualizzate le chiavi di Linus Torvalds | ||
919 | che avete nel vostro portachiavi:: | ||
920 | |||
921 | $ gpg --list-key torvalds@kernel.org | ||
922 | pub rsa2048 2011-09-20 [SC] | ||
923 | ABAF11C65A2970B130ABE3C479BE3E4300411886 | ||
924 | uid [ unknown] Linus Torvalds <torvalds@kernel.org> | ||
925 | sub rsa2048 2011-09-20 [E] | ||
926 | |||
927 | Poi, aprite il `PGP pathfinder`_. Nel campo "From", incollate l'impronta | ||
928 | digitale della chiave di Linus Torvalds che si vede nell'output qui sopra. | ||
929 | Nel campo "to", incollate il key-id della chiave sconosciuta che avete | ||
930 | trovato con ``gpg --search``, e poi verificare il risultato: | ||
931 | |||
932 | - `Finding paths to Linus`_ | ||
933 | |||
934 | Se trovate un paio di percorsi affidabili è un buon segno circa la validità | ||
935 | della chiave. Ora, potete aggiungerla al vostro portachiavi dal keyserver:: | ||
936 | |||
937 | $ gpg --recv-key C94035C21B4F2AEB | ||
938 | |||
939 | Questa procedura non è perfetta, e ovviamente state riponendo la vostra | ||
940 | fiducia nell'amministratore del servizio *PGP Pathfinder* sperando che non | ||
941 | sia malintenzionato (infatti, questo va contro :ref:`it_devs_not_infra`). | ||
942 | Tuttavia, se mantenete con cura la vostra rete di fiducia sarà un deciso | ||
943 | miglioramento rispetto alla cieca fiducia nei keyserver. | ||
944 | |||
945 | .. _`PGP pathfinder`: https://pgp.cs.uu.nl/ | ||
946 | .. _`Finding paths to Linus`: https://pgp.cs.uu.nl/paths/79BE3E4300411886/to/C94035C21B4F2AEB.html | ||
diff --git a/Documentation/translations/it_IT/process/stable-kernel-rules.rst b/Documentation/translations/it_IT/process/stable-kernel-rules.rst index 6fa5ce9c3572..48e88e5ad2c5 100644 --- a/Documentation/translations/it_IT/process/stable-kernel-rules.rst +++ b/Documentation/translations/it_IT/process/stable-kernel-rules.rst | |||
@@ -1,12 +1,202 @@ | |||
1 | .. include:: ../disclaimer-ita.rst | 1 | .. include:: ../disclaimer-ita.rst |
2 | 2 | ||
3 | :Original: :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` | 3 | :Original: :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` |
4 | :Translator: Federico Vaga <federico.vaga@vaga.pv.it> | ||
4 | 5 | ||
5 | .. _it_stable_kernel_rules: | 6 | .. _it_stable_kernel_rules: |
6 | 7 | ||
7 | Tutto quello che volevate sapere sui rilasci -stable di Linux | 8 | Tutto quello che volevate sapere sui rilasci -stable di Linux |
8 | ============================================================== | 9 | ============================================================== |
9 | 10 | ||
10 | .. warning:: | 11 | Regole sul tipo di patch che vengono o non vengono accettate nei sorgenti |
12 | "-stable": | ||
11 | 13 | ||
12 | TODO ancora da tradurre | 14 | - Ovviamente dev'essere corretta e verificata. |
15 | - Non dev'essere più grande di 100 righe, incluso il contesto. | ||
16 | - Deve correggere una cosa sola. | ||
17 | - Deve correggere un baco vero che sta disturbando gli utenti (non cose del | ||
18 | tipo "Questo potrebbe essere un problema ..."). | ||
19 | - Deve correggere un problema di compilazione (ma non per cose già segnate | ||
20 | con CONFIG_BROKEN), un kernel oops, un blocco, una corruzione di dati, | ||
21 | un vero problema di sicurezza, o problemi del tipo "oh, questo non va bene". | ||
22 | In pratica, qualcosa di critico. | ||
23 | - Problemi importanti riportati dagli utenti di una distribuzione potrebbero | ||
24 | essere considerati se correggono importanti problemi di prestazioni o di | ||
25 | interattività. Dato che questi problemi non sono così ovvi e la loro | ||
26 | correzione ha un'alta probabilità d'introdurre una regressione, dovrebbero | ||
27 | essere sottomessi solo dal manutentore della distribuzione includendo un | ||
28 | link, se esiste, ad un rapporto su bugzilla, e informazioni aggiuntive | ||
29 | sull'impatto che ha sugli utenti. | ||
30 | - Non deve correggere problemi relativi a una "teorica sezione critica", | ||
31 | a meno che non venga fornita anche una spiegazione su come questa si | ||
32 | possa verificare. | ||
33 | - Non deve includere alcuna correzione "banale" (correzioni grammaticali, | ||
34 | pulizia dagli spazi bianchi, eccetera). | ||
35 | - Deve rispettare le regole scritte in | ||
36 | :ref:`Documentation/translation/it_IT/process/submitting-patches.rst <it_submittingpatches>` | ||
37 | - Questa patch o una equivalente deve esistere già nei sorgenti principali di | ||
38 | Linux | ||
39 | |||
40 | |||
41 | Procedura per sottomettere patch per i sorgenti -stable | ||
42 | ------------------------------------------------------- | ||
43 | |||
44 | - Se la patch contiene modifiche a dei file nelle cartelle net/ o drivers/net, | ||
45 | allora seguite le linee guida descritte in | ||
46 | :ref:`Documentation/translation/it_IT/networking/netdev-FAQ.rst <it_netdev-FAQ>`; | ||
47 | ma solo dopo aver verificato al seguente indirizzo che la patch non sia | ||
48 | già in coda: | ||
49 | https://patchwork.ozlabs.org/bundle/davem/stable/?series=&submitter=&state=*&q=&archive= | ||
50 | - Una patch di sicurezza non dovrebbero essere gestite (solamente) dal processo | ||
51 | di revisione -stable, ma dovrebbe seguire le procedure descritte in | ||
52 | :ref:`Documentation/translations/it_IT/admin-guide/security-bugs.rst <it_securitybugs>`. | ||
53 | |||
54 | |||
55 | Per tutte le altre sottomissioni, scegliere una delle seguenti procedure | ||
56 | ------------------------------------------------------------------------ | ||
57 | |||
58 | .. _it_option_1: | ||
59 | |||
60 | Opzione 1 | ||
61 | ********* | ||
62 | |||
63 | Per far sì che una patch venga automaticamente inclusa nei sorgenti stabili, | ||
64 | aggiungete l'etichetta | ||
65 | |||
66 | .. code-block:: none | ||
67 | |||
68 | Cc: stable@vger.kernel.org | ||
69 | |||
70 | nell'area dedicata alla firme. Una volta che la patch è stata inclusa, verrà | ||
71 | applicata anche sui sorgenti stabili senza che l'autore o il manutentore | ||
72 | del sottosistema debba fare qualcosa. | ||
73 | |||
74 | .. _it_option_2: | ||
75 | |||
76 | Opzione 2 | ||
77 | ********* | ||
78 | |||
79 | Dopo che la patch è stata inclusa nei sorgenti Linux, inviate una mail a | ||
80 | stable@vger.kernel.org includendo: il titolo della patch, l'identificativo | ||
81 | del commit, il perché pensate che debba essere applicata, e in quale versione | ||
82 | del kernel la vorreste vedere. | ||
83 | |||
84 | .. _it_option_3: | ||
85 | |||
86 | Opzione 3 | ||
87 | ********* | ||
88 | |||
89 | Inviata la patch, dopo aver verificato che rispetta le regole descritte in | ||
90 | precedenza, a stable@vger.kernel.org. Dovete annotare nel changelog | ||
91 | l'identificativo del commit nei sorgenti principali, così come la versione | ||
92 | del kernel nel quale vorreste vedere la patch. | ||
93 | |||
94 | L':ref:`it_option_1` è fortemente raccomandata; è il modo più facile e usato. | ||
95 | L':ref:`it_option_2` e l':ref:`it_option_3` sono più utili quando, al momento | ||
96 | dell'inclusione dei sorgenti principali, si ritiene che non debbano essere | ||
97 | incluse anche in quelli stabili (per esempio, perché si crede che si dovrebbero | ||
98 | fare più verifiche per eventuali regressioni). L':ref:`it_option_3` è | ||
99 | particolarmente utile se la patch ha bisogno di qualche modifica per essere | ||
100 | applicata ad un kernel più vecchio (per esempio, perché nel frattempo l'API è | ||
101 | cambiata). | ||
102 | |||
103 | Notate che per l':ref:`it_option_3`, se la patch è diversa da quella nei | ||
104 | sorgenti principali (per esempio perché è stato necessario un lavoro di | ||
105 | adattamento) allora dev'essere ben documentata e giustificata nella descrizione | ||
106 | della patch. | ||
107 | |||
108 | L'identificativo del commit nei sorgenti principali dev'essere indicato sopra | ||
109 | al messaggio della patch, così: | ||
110 | |||
111 | .. code-block:: none | ||
112 | |||
113 | commit <sha1> upstream. | ||
114 | |||
115 | In aggiunta, alcune patch inviate attraverso l':ref:`it_option_1` potrebbero | ||
116 | dipendere da altre che devo essere incluse. Questa situazione può essere | ||
117 | indicata nel seguente modo nell'area dedicata alle firme: | ||
118 | |||
119 | .. code-block:: none | ||
120 | |||
121 | Cc: <stable@vger.kernel.org> # 3.3.x: a1f84a3: sched: Check for idle | ||
122 | Cc: <stable@vger.kernel.org> # 3.3.x: 1b9508f: sched: Rate-limit newidle | ||
123 | Cc: <stable@vger.kernel.org> # 3.3.x: fd21073: sched: Fix affinity logic | ||
124 | Cc: <stable@vger.kernel.org> # 3.3.x | ||
125 | Signed-off-by: Ingo Molnar <mingo@elte.hu> | ||
126 | |||
127 | La sequenza di etichette ha il seguente significato: | ||
128 | |||
129 | .. code-block:: none | ||
130 | |||
131 | git cherry-pick a1f84a3 | ||
132 | git cherry-pick 1b9508f | ||
133 | git cherry-pick fd21073 | ||
134 | git cherry-pick <this commit> | ||
135 | |||
136 | Inoltre, alcune patch potrebbero avere dei requisiti circa la versione del | ||
137 | kernel. Questo può essere indicato usando il seguente formato nell'area | ||
138 | dedicata alle firme: | ||
139 | |||
140 | .. code-block:: none | ||
141 | |||
142 | Cc: <stable@vger.kernel.org> # 3.3.x | ||
143 | |||
144 | L'etichetta ha il seguente significato: | ||
145 | |||
146 | .. code-block:: none | ||
147 | |||
148 | git cherry-pick <this commit> | ||
149 | |||
150 | per ogni sorgente "-stable" che inizia con la versione indicata. | ||
151 | |||
152 | Dopo la sottomissione: | ||
153 | |||
154 | - Il mittente riceverà un ACK quando la patch è stata accettata e messa in | ||
155 | coda, oppure un NAK se la patch è stata rigettata. A seconda degli impegni | ||
156 | degli sviluppatori, questa risposta potrebbe richiedere alcuni giorni. | ||
157 | - Se accettata, la patch verrà aggiunta alla coda -stable per essere | ||
158 | revisionata dal altri sviluppatori e dal principale manutentore del | ||
159 | sottosistema. | ||
160 | |||
161 | |||
162 | Ciclo di una revisione | ||
163 | ---------------------- | ||
164 | |||
165 | - Quando i manutentori -stable decidono di fare un ciclo di revisione, le | ||
166 | patch vengono mandate al comitato per la revisione, ai manutentori soggetti | ||
167 | alle modifiche delle patch (a meno che il mittente non sia anche il | ||
168 | manutentore di quell'area del kernel) e in CC: alla lista di discussione | ||
169 | linux-kernel. | ||
170 | - La commissione per la revisione ha 48 ore per dare il proprio ACK o NACK | ||
171 | alle patch. | ||
172 | - Se una patch viene rigettata da un membro della commissione, o un membro | ||
173 | della lista linux-kernel obietta la bontà della patch, sollevando problemi | ||
174 | che i manutentori ed i membri non avevano compreso, allora la patch verrà | ||
175 | rimossa dalla coda. | ||
176 | - Alla fine del ciclo di revisione tutte le patch che hanno ricevuto l'ACK | ||
177 | verranno aggiunte per il prossimo rilascio -stable, e successivamente | ||
178 | questo nuovo rilascio verrà fatto. | ||
179 | - Le patch di sicurezza verranno accettate nei sorgenti -stable direttamente | ||
180 | dalla squadra per la sicurezza del kernel, e non passerà per il normale | ||
181 | ciclo di revisione. Contattate la suddetta squadra per maggiori dettagli | ||
182 | su questa procedura. | ||
183 | |||
184 | Sorgenti | ||
185 | -------- | ||
186 | |||
187 | - La coda delle patch, sia quelle già applicate che in fase di revisione, | ||
188 | possono essere trovate al seguente indirizzo: | ||
189 | |||
190 | https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git | ||
191 | |||
192 | - Il rilascio definitivo, e marchiato, di tutti i kernel stabili può essere | ||
193 | trovato in rami distinti per versione al seguente indirizzo: | ||
194 | |||
195 | https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git | ||
196 | |||
197 | |||
198 | Comitato per la revisione | ||
199 | ------------------------- | ||
200 | |||
201 | - Questo comitato è fatto di sviluppatori del kernel che si sono offerti | ||
202 | volontari per questo lavoro, e pochi altri che non sono proprio volontari. | ||
diff --git a/Documentation/translations/it_IT/process/submitting-patches.rst b/Documentation/translations/it_IT/process/submitting-patches.rst index 2ab9c1401aa1..7d7ea92c5c5a 100644 --- a/Documentation/translations/it_IT/process/submitting-patches.rst +++ b/Documentation/translations/it_IT/process/submitting-patches.rst | |||
@@ -67,8 +67,8 @@ sulla radice dei sorgenti del kernel, e non sulle sue sottocartelle. | |||
67 | 67 | ||
68 | Per creare una patch per un singolo file, spesso è sufficiente fare:: | 68 | Per creare una patch per un singolo file, spesso è sufficiente fare:: |
69 | 69 | ||
70 | SRCTREE= linux | 70 | SRCTREE=linux |
71 | MYFILE= drivers/net/mydriver.c | 71 | MYFILE=drivers/net/mydriver.c |
72 | 72 | ||
73 | cd $SRCTREE | 73 | cd $SRCTREE |
74 | cp $MYFILE $MYFILE.orig | 74 | cp $MYFILE $MYFILE.orig |
@@ -80,7 +80,7 @@ Per creare una patch per molteplici file, dovreste spacchettare i sorgenti | |||
80 | "vergini", o comunque non modificati, e fare un ``diff`` coi vostri. | 80 | "vergini", o comunque non modificati, e fare un ``diff`` coi vostri. |
81 | Per esempio:: | 81 | Per esempio:: |
82 | 82 | ||
83 | MYSRC= /devel/linux | 83 | MYSRC=/devel/linux |
84 | 84 | ||
85 | tar xvfz linux-3.19.tar.gz | 85 | tar xvfz linux-3.19.tar.gz |
86 | mv linux-3.19 linux-3.19-vanilla | 86 | mv linux-3.19 linux-3.19-vanilla |
@@ -567,11 +567,42 @@ alcunché - ma dovrebbe indicare che la persona ha ricevuto una copia della | |||
567 | patch. Questa etichetta documenta che terzi potenzialmente interessati sono | 567 | patch. Questa etichetta documenta che terzi potenzialmente interessati sono |
568 | stati inclusi nella discussione. | 568 | stati inclusi nella discussione. |
569 | 569 | ||
570 | L'etichetta Co-developed-by: indica che la patch è stata scritta dall'autore in | 570 | Co-developed-by: indica che la patch è stata cosviluppata da diversi |
571 | collaborazione con un altro sviluppatore. Qualche volta questo è utile quando | 571 | sviluppatori; viene usato per assegnare più autori (in aggiunta a quello |
572 | più persone lavorano sulla stessa patch. Notate, questa persona deve avere | 572 | associato all'etichetta From:) quando più persone lavorano ad una patch. Dato |
573 | nella patch anche una riga Signed-off-by:. | 573 | che Co-developed-by: implica la paternità della patch, ogni Co-developed-by: |
574 | dev'essere seguito immediatamente dal Signed-off-by: del corrispondente | ||
575 | coautore. Qui si applica la procedura di base per sign-off, in pratica | ||
576 | l'ordine delle etichette Signed-off-by: dovrebbe riflettere il più possibile | ||
577 | l'ordine cronologico della storia della patch, indipendentemente dal fatto che | ||
578 | la paternità venga assegnata via From: o Co-developed-by:. Da notare che | ||
579 | l'ultimo Signed-off-by: dev'essere quello di colui che ha sottomesso la patch. | ||
574 | 580 | ||
581 | Notate anche che l'etichetta From: è opzionale quando l'autore in From: è | ||
582 | anche la persona (e indirizzo email) indicato nel From: dell'intestazione | ||
583 | dell'email. | ||
584 | |||
585 | Esempio di una patch sottomessa dall'autore in From::: | ||
586 | |||
587 | <changelog> | ||
588 | |||
589 | Co-developed-by: First Co-Author <first@coauthor.example.org> | ||
590 | Signed-off-by: First Co-Author <first@coauthor.example.org> | ||
591 | Co-developed-by: Second Co-Author <second@coauthor.example.org> | ||
592 | Signed-off-by: Second Co-Author <second@coauthor.example.org> | ||
593 | Signed-off-by: From Author <from@author.example.org> | ||
594 | |||
595 | Esempio di una patch sottomessa dall'autore Co-developed-by::: | ||
596 | |||
597 | From: From Author <from@author.example.org> | ||
598 | |||
599 | <changelog> | ||
600 | |||
601 | Co-developed-by: Random Co-Author <random@coauthor.example.org> | ||
602 | Signed-off-by: Random Co-Author <random@coauthor.example.org> | ||
603 | Signed-off-by: From Author <from@author.example.org> | ||
604 | Co-developed-by: Submitting Co-Author <sub@coauthor.example.org> | ||
605 | Signed-off-by: Submitting Co-Author <sub@coauthor.example.org> | ||
575 | 606 | ||
576 | 13) Utilizzare Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: e Fixes: | 607 | 13) Utilizzare Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: e Fixes: |
577 | ----------------------------------------------------------------------------- | 608 | ----------------------------------------------------------------------------- |
@@ -719,7 +750,7 @@ Un paio di esempi di oggetti:: | |||
719 | La riga ``from`` dev'essere la prima nel corpo del messaggio ed è nel | 750 | La riga ``from`` dev'essere la prima nel corpo del messaggio ed è nel |
720 | formato: | 751 | formato: |
721 | 752 | ||
722 | From: Original Author <author@example.com> | 753 | From: Patch Author <author@example.com> |
723 | 754 | ||
724 | La riga ``from`` indica chi verrà accreditato nel changelog permanente come | 755 | La riga ``from`` indica chi verrà accreditato nel changelog permanente come |
725 | l'autore della patch. Se la riga ``from`` è mancante, allora per determinare | 756 | l'autore della patch. Se la riga ``from`` è mancante, allora per determinare |
diff --git a/Documentation/translations/ja_JP/SubmittingPatches b/Documentation/translations/ja_JP/SubmittingPatches index 02139656463e..ad979c3c06a6 100644 --- a/Documentation/translations/ja_JP/SubmittingPatches +++ b/Documentation/translations/ja_JP/SubmittingPatches | |||
@@ -58,8 +58,8 @@ Linux カーネルに対する全ての変更は diff(1) コマンドによる | |||
58 | 1個のファイルについてのパッチを作成するためには、ほとんどの場合、 | 58 | 1個のファイルについてのパッチを作成するためには、ほとんどの場合、 |
59 | 以下の作業を行えば十分です。 | 59 | 以下の作業を行えば十分です。 |
60 | 60 | ||
61 | SRCTREE= linux-2.6 | 61 | SRCTREE=linux-2.6 |
62 | MYFILE= drivers/net/mydriver.c | 62 | MYFILE=drivers/net/mydriver.c |
63 | 63 | ||
64 | cd $SRCTREE | 64 | cd $SRCTREE |
65 | cp $MYFILE $MYFILE.orig | 65 | cp $MYFILE $MYFILE.orig |
@@ -71,7 +71,7 @@ Linux カーネルに対する全ての変更は diff(1) コマンドによる | |||
71 | なわち変更を加えてない Linux カーネルを展開し、自分の Linux カーネル | 71 | なわち変更を加えてない Linux カーネルを展開し、自分の Linux カーネル |
72 | ソースとの差分を生成しないといけません。例えば、 | 72 | ソースとの差分を生成しないといけません。例えば、 |
73 | 73 | ||
74 | MYSRC= /devel/linux-2.6 | 74 | MYSRC=/devel/linux-2.6 |
75 | 75 | ||
76 | tar xvfz linux-2.6.12.tar.gz | 76 | tar xvfz linux-2.6.12.tar.gz |
77 | mv linux-2.6.12 linux-2.6.12-vanilla | 77 | mv linux-2.6.12 linux-2.6.12-vanilla |
diff --git a/Documentation/translations/zh_CN/SubmittingPatches b/Documentation/translations/zh_CN/SubmittingPatches deleted file mode 100644 index e9098da8f1a4..000000000000 --- a/Documentation/translations/zh_CN/SubmittingPatches +++ /dev/null | |||
@@ -1,412 +0,0 @@ | |||
1 | Chinese translated version of Documentation/process/submitting-patches.rst | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | |||
9 | Chinese maintainer: TripleX Chung <triplex@zh-kernel.org> | ||
10 | --------------------------------------------------------------------- | ||
11 | Documentation/process/submitting-patches.rst 的中文翻译 | ||
12 | |||
13 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | ||
14 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
15 | 译存在问题,请联系中文版维护者。 | ||
16 | |||
17 | 中文版维护者: 钟宇 TripleX Chung <triplex@zh-kernel.org> | ||
18 | 中文版翻译者: 钟宇 TripleX Chung <triplex@zh-kernel.org> | ||
19 | 中文版校译者: 李阳 Li Yang <leo@zh-kernel.org> | ||
20 | 王聪 Wang Cong <xiyou.wangcong@gmail.com> | ||
21 | |||
22 | 以下为正文 | ||
23 | --------------------------------------------------------------------- | ||
24 | |||
25 | 如何让你的改动进入内核 | ||
26 | 或者 | ||
27 | 获得亲爱的 Linus Torvalds 的关注和处理 | ||
28 | ---------------------------------- | ||
29 | |||
30 | 对于想要将改动提交到 Linux 内核的个人或者公司来说,如果不熟悉“规矩”, | ||
31 | 提交的流程会让人畏惧。本文档收集了一系列建议,这些建议可以大大的提高你 | ||
32 | 的改动被接受的机会。 | ||
33 | 阅读 Documentation/process/submit-checklist.rst 来获得在提交代码前需要检查的项目的列 | ||
34 | 表。如果你在提交一个驱动程序,那么同时阅读一下 | ||
35 | Documentation/process/submitting-drivers.rst 。 | ||
36 | |||
37 | |||
38 | -------------------------- | ||
39 | 第一节 - 创建并发送你的改动 | ||
40 | -------------------------- | ||
41 | |||
42 | 1) "diff -up" | ||
43 | ----------- | ||
44 | |||
45 | 使用 "diff -up" 或者 "diff -uprN" 来创建补丁。 | ||
46 | |||
47 | 所有内核的改动,都是以补丁的形式呈现的,补丁由 diff(1) 生成。创建补丁的 | ||
48 | 时候,要确认它是以 "unified diff" 格式创建的,这种格式由 diff(1) 的 '-u' | ||
49 | 参数生成。而且,请使用 '-p' 参数,那样会显示每个改动所在的C函数,使得 | ||
50 | 产生的补丁容易读得多。补丁应该基于内核源代码树的根目录,而不是里边的任 | ||
51 | 何子目录。 | ||
52 | 为一个单独的文件创建补丁,一般来说这样做就够了: | ||
53 | |||
54 | SRCTREE= linux-2.6 | ||
55 | MYFILE= drivers/net/mydriver.c | ||
56 | |||
57 | cd $SRCTREE | ||
58 | cp $MYFILE $MYFILE.orig | ||
59 | vi $MYFILE # make your change | ||
60 | cd .. | ||
61 | diff -up $SRCTREE/$MYFILE{.orig,} > /tmp/patch | ||
62 | |||
63 | 为多个文件创建补丁,你可以解开一个没有修改过的内核源代码树,然后和你自 | ||
64 | 己的代码树之间做 diff 。例如: | ||
65 | |||
66 | MYSRC= /devel/linux-2.6 | ||
67 | |||
68 | tar xvfz linux-2.6.12.tar.gz | ||
69 | mv linux-2.6.12 linux-2.6.12-vanilla | ||
70 | diff -uprN -X linux-2.6.12-vanilla/Documentation/dontdiff \ | ||
71 | linux-2.6.12-vanilla $MYSRC > /tmp/patch | ||
72 | |||
73 | "dontdiff" 是内核在编译的时候产生的文件的列表,列表中的文件在 diff(1) | ||
74 | 产生的补丁里会被跳过。"dontdiff" 文件被包含在2.6.12和之后版本的内核源代 | ||
75 | 码树中。对于更早的内核版本,你可以从 | ||
76 | <http://www.xenotime.net/linux/doc/dontdiff> 获取它。 | ||
77 | 确定你的补丁里没有包含任何不属于这次补丁提交的额外文件。记得在用diff(1) | ||
78 | 生成补丁之后,审阅一次补丁,以确保准确。 | ||
79 | 如果你的改动很散乱,你应该研究一下如何将补丁分割成独立的部分,将改动分 | ||
80 | 割成一系列合乎逻辑的步骤。这样更容易让其他内核开发者审核,如果你想你的 | ||
81 | 补丁被接受,这是很重要的。下面这些脚本能够帮助你做这件事情: | ||
82 | Quilt: | ||
83 | http://savannah.nongnu.org/projects/quilt | ||
84 | |||
85 | 2)描述你的改动。 | ||
86 | 描述你的改动包含的技术细节。 | ||
87 | |||
88 | 要多具体就写多具体。最糟糕的描述可能是像下面这些语句:“更新了某驱动程 | ||
89 | 序”,“修正了某驱动程序的bug”,或者“这个补丁包含了某子系统的修改,请 | ||
90 | 使用。” | ||
91 | |||
92 | 如果你的描述开始变长,这表示你也许需要拆分你的补丁了,请看第3小节, | ||
93 | 继续。 | ||
94 | |||
95 | 3)拆分你的改动 | ||
96 | |||
97 | 将改动拆分,逻辑类似的放到同一个补丁文件里。 | ||
98 | |||
99 | 例如,如果你的改动里同时有bug修正和性能优化,那么把这些改动拆分到两个或 | ||
100 | 者更多的补丁文件中。如果你的改动包含对API的修改,并且修改了驱动程序来适 | ||
101 | 应这些新的API,那么把这些修改分成两个补丁。 | ||
102 | |||
103 | 另一方面,如果你将一个单独的改动做成多个补丁文件,那么将它们合并成一个 | ||
104 | 单独的补丁文件。这样一个逻辑上单独的改动只被包含在一个补丁文件里。 | ||
105 | |||
106 | 如果有一个补丁依赖另外一个补丁来完成它的改动,那没问题。简单的在你的补 | ||
107 | 丁描述里指出“这个补丁依赖某补丁”就好了。 | ||
108 | |||
109 | 如果你不能将补丁浓缩成更少的文件,那么每次大约发送出15个,然后等待审查 | ||
110 | 和整合。 | ||
111 | |||
112 | 4)选择 e-mail 的收件人 | ||
113 | |||
114 | 看一遍 MAINTAINERS 文件和源代码,看看你所的改动所在的内核子系统有没有指 | ||
115 | 定的维护者。如果有,给他们发e-mail。 | ||
116 | |||
117 | 如果没有找到维护者,或者维护者没有反馈,将你的补丁发送到内核开发者主邮 | ||
118 | 件列表 linux-kernel@vger.kernel.org。大部分的内核开发者都跟踪这个邮件列 | ||
119 | 表,可以评价你的改动。 | ||
120 | |||
121 | 每次不要发送超过15个补丁到 vger 邮件列表!!! | ||
122 | |||
123 | Linus Torvalds 是决定改动能否进入 Linux 内核的最终裁决者。他的 e-mail | ||
124 | 地址是 <torvalds@linux-foundation.org> 。他收到的 e-mail 很多,所以一般 | ||
125 | 的说,最好别给他发 e-mail。 | ||
126 | |||
127 | 那些修正bug,“显而易见”的修改或者是类似的只需要很少讨论的补丁可以直接 | ||
128 | 发送或者CC给Linus。那些需要讨论或者没有很清楚的好处的补丁,一般先发送到 | ||
129 | linux-kernel邮件列表。只有当补丁被讨论得差不多了,才提交给Linus。 | ||
130 | |||
131 | 5)选择CC( e-mail 抄送)列表 | ||
132 | |||
133 | 除非你有理由不这样做,否则CC linux-kernel@vger.kernel.org。 | ||
134 | |||
135 | 除了 Linus 之外,其他内核开发者也需要注意到你的改动,这样他们才能评论你 | ||
136 | 的改动并提供代码审查和建议。linux-kernel 是 Linux 内核开发者主邮件列表 | ||
137 | 。其它的邮件列表为特定的子系统提供服务,比如 USB,framebuffer 设备,虚 | ||
138 | 拟文件系统,SCSI 子系统,等等。查看 MAINTAINERS 文件来获得和你的改动有 | ||
139 | 关的邮件列表。 | ||
140 | |||
141 | Majordomo lists of VGER.KERNEL.ORG at: | ||
142 | <http://vger.kernel.org/vger-lists.html> | ||
143 | |||
144 | 如果改动影响了用户空间和内核之间的接口,请给 MAN-PAGES 的维护者(列在 | ||
145 | MAINTAINERS 文件里的)发送一个手册页(man-pages)补丁,或者至少通知一下改 | ||
146 | 变,让一些信息有途径进入手册页。 | ||
147 | |||
148 | 即使在第四步的时候,维护者没有作出回应,也要确认在修改他们的代码的时候 | ||
149 | ,一直将维护者拷贝到CC列表中。 | ||
150 | |||
151 | 对于小的补丁,你也许会CC到 Adrian Bunk 管理的搜集琐碎补丁的邮件列表 | ||
152 | (Trivial Patch Monkey)trivial@kernel.org,那里专门收集琐碎的补丁。下面这样 | ||
153 | 的补丁会被看作“琐碎的”补丁: | ||
154 | 文档的拼写修正。 | ||
155 | 修正会影响到 grep(1) 的拼写。 | ||
156 | 警告信息修正(频繁的打印无用的警告是不好的。) | ||
157 | 编译错误修正(代码逻辑的确是对的,只是编译有问题。) | ||
158 | 运行时修正(只要真的修正了错误。) | ||
159 | 移除使用了被废弃的函数/宏的代码(例如 check_region。) | ||
160 | 联系方式和文档修正。 | ||
161 | 用可移植的代码替换不可移植的代码(即使在体系结构相关的代码中,既然有 | ||
162 | 人拷贝,只要它是琐碎的) | ||
163 | 任何文件的作者/维护者对该文件的改动(例如 patch monkey 在重传模式下) | ||
164 | |||
165 | EMAIL: trivial@kernel.org | ||
166 | |||
167 | (译注,关于“琐碎补丁”的一些说明:因为原文的这一部分写得比较简单,所以不得不 | ||
168 | 违例写一下译注。"trivial"这个英文单词的本意是“琐碎的,不重要的。”但是在这里 | ||
169 | 有稍微有一些变化,例如对一些明显的NULL指针的修正,属于运行时修正,会被归类 | ||
170 | 到琐碎补丁里。虽然NULL指针的修正很重要,但是这样的修正往往很小而且很容易得到 | ||
171 | 检验,所以也被归入琐碎补丁。琐碎补丁更精确的归类应该是 | ||
172 | “simple, localized & easy to verify”,也就是说简单的,局部的和易于检验的。 | ||
173 | trivial@kernel.org邮件列表的目的是针对这样的补丁,为提交者提供一个中心,来 | ||
174 | 降低提交的门槛。) | ||
175 | |||
176 | 6)没有 MIME 编码,没有链接,没有压缩,没有附件,只有纯文本。 | ||
177 | |||
178 | Linus 和其他的内核开发者需要阅读和评论你提交的改动。对于内核开发者来说 | ||
179 | ,可以“引用”你的改动很重要,使用一般的 e-mail 工具,他们就可以在你的 | ||
180 | 代码的任何位置添加评论。 | ||
181 | |||
182 | 因为这个原因,所有的提交的补丁都是 e-mail 中“内嵌”的。 | ||
183 | 警告:如果你使用剪切-粘贴你的补丁,小心你的编辑器的自动换行功能破坏你的 | ||
184 | 补丁。 | ||
185 | |||
186 | 不要将补丁作为 MIME 编码的附件,不管是否压缩。很多流行的 e-mail 软件不 | ||
187 | 是任何时候都将 MIME 编码的附件当作纯文本发送的,这会使得别人无法在你的 | ||
188 | 代码中加评论。另外,MIME 编码的附件会让 Linus 多花一点时间来处理,这就 | ||
189 | 降低了你的改动被接受的可能性。 | ||
190 | |||
191 | 警告:一些邮件软件,比如 Mozilla 会将你的信息以如下格式发送: | ||
192 | ---- 邮件头 ---- | ||
193 | Content-Type: text/plain; charset=us-ascii; format=flowed | ||
194 | ---- 邮件头 ---- | ||
195 | 问题在于 “format=flowed” 会让接收端的某些邮件软件将邮件中的制表符替换 | ||
196 | 成空格以及做一些类似的替换。这样,你发送的时候看起来没问题的补丁就被破 | ||
197 | 坏了。 | ||
198 | |||
199 | 要修正这个问题,只需要将你的 mozilla 的 defaults/pref/mailnews.js 文件 | ||
200 | 里的 | ||
201 | pref("mailnews.send_plaintext_flowed", false); // RFC 2646======= | ||
202 | 修改成 | ||
203 | pref("mailnews.display.disable_format_flowed_support", true); | ||
204 | 就可以了。 | ||
205 | |||
206 | 7) e-mail 的大小 | ||
207 | |||
208 | 给 Linus 发送补丁的时候,永远按照第6小节说的做。 | ||
209 | |||
210 | 大的改动对邮件列表不合适,对某些维护者也不合适。如果你的补丁,在不压缩 | ||
211 | 的情况下,超过了40kB,那么你最好将补丁放在一个能通过 internet 访问的服 | ||
212 | 务器上,然后用指向你的补丁的 URL 替代。 | ||
213 | |||
214 | 8) 指出你的内核版本 | ||
215 | |||
216 | 在标题和在补丁的描述中,指出补丁对应的内核的版本,是很重要的。 | ||
217 | |||
218 | 如果补丁不能干净的在最新版本的内核上打上,Linus 是不会接受它的。 | ||
219 | |||
220 | 9) 不要气馁,继续提交。 | ||
221 | |||
222 | 当你提交了改动以后,耐心地等待。如果 Linus 喜欢你的改动并且同意它,那么 | ||
223 | 它将在下一个内核发布版本中出现。 | ||
224 | |||
225 | 然而,如果你的改动没有出现在下一个版本的内核中,可能有若干原因。减少那 | ||
226 | 些原因,修正错误,重新提交更新后的改动,是你自己的工作。 | ||
227 | |||
228 | Linus不给出任何评论就“丢弃”你的补丁是常见的事情。在系统中这样的事情很 | ||
229 | 平常。如果他没有接受你的补丁,也许是由于以下原因: | ||
230 | * 你的补丁不能在最新版本的内核上干净的打上。 | ||
231 | * 你的补丁在 linux-kernel 邮件列表中没有得到充分的讨论。 | ||
232 | * 风格问题(参照第2小节) | ||
233 | * 邮件格式问题(重读本节) | ||
234 | * 你的改动有技术问题。 | ||
235 | * 他收到了成吨的 e-mail,而你的在混乱中丢失了。 | ||
236 | * 你让人为难。 | ||
237 | |||
238 | 有疑问的时候,在 linux-kernel 邮件列表上请求评论。 | ||
239 | |||
240 | 10) 在标题上加上 PATCH 的字样 | ||
241 | |||
242 | Linus 和 linux-kernel 邮件列表的 e-mail 流量都很高,一个通常的约定是标 | ||
243 | 题行以 [PATCH] 开头。这样可以让 Linus 和其他内核开发人员可以从 e-mail | ||
244 | 的讨论中很轻易的将补丁分辨出来。 | ||
245 | |||
246 | 11)为你的工作签名 | ||
247 | |||
248 | 为了加强对谁做了何事的追踪,尤其是对那些透过好几层的维护者的补丁,我们 | ||
249 | 建议在发送出去的补丁上加一个 “sign-off” 的过程。 | ||
250 | |||
251 | "sign-off" 是在补丁的注释的最后的简单的一行文字,认证你编写了它或者其他 | ||
252 | 人有权力将它作为开放源代码的补丁传递。规则很简单:如果你能认证如下信息 | ||
253 | : | ||
254 | 开发者来源证书 1.1 | ||
255 | 对于本项目的贡献,我认证如下信息: | ||
256 | (a)这些贡献是完全或者部分的由我创建,我有权利以文件中指出 | ||
257 | 的开放源代码许可证提交它;或者 | ||
258 | (b)这些贡献基于以前的工作,据我所知,这些以前的工作受恰当的开放 | ||
259 | 源代码许可证保护,而且,根据许可证,我有权提交修改后的贡献, | ||
260 | 无论是完全还是部分由我创造,这些贡献都使用同一个开放源代码许可证 | ||
261 | (除非我被允许用其它的许可证),正如文件中指出的;或者 | ||
262 | (c)这些贡献由认证(a),(b)或者(c)的人直接提供给我,而 | ||
263 | 且我没有修改它。 | ||
264 | (d)我理解并同意这个项目和贡献是公开的,贡献的记录(包括我 | ||
265 | 一起提交的个人记录,包括 sign-off )被永久维护并且可以和这个项目 | ||
266 | 或者开放源代码的许可证同步地再发行。 | ||
267 | 那么加入这样一行: | ||
268 | Signed-off-by: Random J Developer <random@developer.example.org> | ||
269 | |||
270 | 使用你的真名(抱歉,不能使用假名或者匿名。) | ||
271 | |||
272 | 有人在最后加上标签。现在这些东西会被忽略,但是你可以这样做,来标记公司 | ||
273 | 内部的过程,或者只是指出关于 sign-off 的一些特殊细节。 | ||
274 | |||
275 | 12)标准补丁格式 | ||
276 | |||
277 | 标准的补丁,标题行是: | ||
278 | Subject: [PATCH 001/123] 子系统:一句话概述 | ||
279 | |||
280 | 标准补丁的信体存在如下部分: | ||
281 | |||
282 | - 一个 "from" 行指出补丁作者。 | ||
283 | |||
284 | - 一个空行 | ||
285 | |||
286 | - 说明的主体,这些说明文字会被拷贝到描述该补丁的永久改动记录里。 | ||
287 | |||
288 | - 一个由"---"构成的标记行 | ||
289 | |||
290 | - 不合适放到改动记录里的额外的注解。 | ||
291 | |||
292 | - 补丁本身(diff 输出) | ||
293 | |||
294 | 标题行的格式,使得对标题行按字母序排序非常的容易 - 很多 e-mail 客户端都 | ||
295 | 可以支持 - 因为序列号是用零填充的,所以按数字排序和按字母排序是一样的。 | ||
296 | |||
297 | e-mail 标题中的“子系统”标识哪个内核子系统将被打补丁。 | ||
298 | |||
299 | e-mail 标题中的“一句话概述”扼要的描述 e-mail 中的补丁。“一句话概述” | ||
300 | 不应该是一个文件名。对于一个补丁系列(“补丁系列”指一系列的多个相关补 | ||
301 | 丁),不要对每个补丁都使用同样的“一句话概述”。 | ||
302 | |||
303 | 记住 e-mail 的“一句话概述”会成为该补丁的全局唯一标识。它会蔓延到 git | ||
304 | 的改动记录里。然后“一句话概述”会被用在开发者的讨论里,用来指代这个补 | ||
305 | 丁。用户将希望通过 google 来搜索"一句话概述"来找到那些讨论这个补丁的文 | ||
306 | 章。 | ||
307 | |||
308 | 一些标题的例子: | ||
309 | |||
310 | Subject: [patch 2/5] ext2: improve scalability of bitmap searching | ||
311 | Subject: [PATCHv2 001/207] x86: fix eflags tracking | ||
312 | |||
313 | "from" 行是信体里的最上面一行,具有如下格式: | ||
314 | From: Original Author <author@example.com> | ||
315 | |||
316 | "from" 行指明在永久改动日志里,谁会被确认为作者。如果没有 "from" 行,那 | ||
317 | 么邮件头里的 "From: " 行会被用来决定改动日志中的作者。 | ||
318 | |||
319 | 说明的主题将会被提交到永久的源代码改动日志里,因此对那些早已经不记得和 | ||
320 | 这个补丁相关的讨论细节的有能力的读者来说,是有意义的。 | ||
321 | |||
322 | "---" 标记行对于补丁处理工具要找到哪里是改动日志信息的结束,是不可缺少 | ||
323 | 的。 | ||
324 | |||
325 | 对于 "---" 标记之后的额外注解,一个好的用途就是用来写 diffstat,用来显 | ||
326 | 示修改了什么文件和每个文件都增加和删除了多少行。diffstat 对于比较大的补 | ||
327 | 丁特别有用。其余那些只是和时刻或者开发者相关的注解,不合适放到永久的改 | ||
328 | 动日志里的,也应该放这里。 | ||
329 | 使用 diffstat的选项 "-p 1 -w 70" 这样文件名就会从内核源代码树的目录开始 | ||
330 | ,不会占用太宽的空间(很容易适合80列的宽度,也许会有一些缩进。) | ||
331 | |||
332 | 在后面的参考资料中能看到适当的补丁格式的更多细节。 | ||
333 | |||
334 | ------------------------------- | ||
335 | 第二节 提示,建议和诀窍 | ||
336 | ------------------------------- | ||
337 | |||
338 | 本节包含很多和提交到内核的代码有关的通常的"规则"。事情永远有例外...但是 | ||
339 | 你必须真的有好的理由这样做。你可以把本节叫做Linus的计算机科学入门课。 | ||
340 | |||
341 | 1) 读 Document/process/coding-style.rst | ||
342 | |||
343 | Nuff 说过,如果你的代码和这个偏离太多,那么它有可能会被拒绝,没有更多的 | ||
344 | 审查,没有更多的评价。 | ||
345 | |||
346 | 2) #ifdef 是丑陋的 | ||
347 | 混杂了 ifdef 的代码难以阅读和维护。别这样做。作为替代,将你的 ifdef 放 | ||
348 | 在头文件里,有条件地定义 "static inline" 函数,或者宏,在代码里用这些东 | ||
349 | 西。让编译器把那些"空操作"优化掉。 | ||
350 | |||
351 | 一个简单的例子,不好的代码: | ||
352 | |||
353 | dev = alloc_etherdev (sizeof(struct funky_private)); | ||
354 | if (!dev) | ||
355 | return -ENODEV; | ||
356 | #ifdef CONFIG_NET_FUNKINESS | ||
357 | init_funky_net(dev); | ||
358 | #endif | ||
359 | |||
360 | 清理后的例子: | ||
361 | |||
362 | (头文件里) | ||
363 | #ifndef CONFIG_NET_FUNKINESS | ||
364 | static inline void init_funky_net (struct net_device *d) {} | ||
365 | #endif | ||
366 | |||
367 | (代码文件里) | ||
368 | dev = alloc_etherdev (sizeof(struct funky_private)); | ||
369 | if (!dev) | ||
370 | return -ENODEV; | ||
371 | init_funky_net(dev); | ||
372 | |||
373 | 3) 'static inline' 比宏好 | ||
374 | |||
375 | Static inline 函数相比宏来说,是好得多的选择。Static inline 函数提供了 | ||
376 | 类型安全,没有长度限制,没有格式限制,在 gcc 下开销和宏一样小。 | ||
377 | |||
378 | 宏只在 static inline 函数不是最优的时候[在 fast paths 里有很少的独立的 | ||
379 | 案例],或者不可能用 static inline 函数的时候[例如字符串分配]。 | ||
380 | 应该用 'static inline' 而不是 'static __inline__', 'extern inline' 和 | ||
381 | 'extern __inline__' 。 | ||
382 | |||
383 | 4) 不要过度设计 | ||
384 | |||
385 | 不要试图预计模糊的未来事情,这些事情也许有用也许没有用:"让事情尽可能的 | ||
386 | 简单,而不是更简单"。 | ||
387 | |||
388 | ---------------- | ||
389 | 第三节 参考文献 | ||
390 | ---------------- | ||
391 | |||
392 | Andrew Morton, "The perfect patch" (tpp). | ||
393 | <http://www.ozlabs.org/~akpm/stuff/tpp.txt> | ||
394 | |||
395 | Jeff Garzik, "Linux kernel patch submission format". | ||
396 | <http://linux.yyz.us/patch-format.html> | ||
397 | |||
398 | Greg Kroah-Hartman, "How to piss off a kernel subsystem maintainer". | ||
399 | <http://www.kroah.com/log/2005/03/31/> | ||
400 | <http://www.kroah.com/log/2005/07/08/> | ||
401 | <http://www.kroah.com/log/2005/10/19/> | ||
402 | <http://www.kroah.com/log/2006/01/11/> | ||
403 | |||
404 | NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people! | ||
405 | <https://lkml.org/lkml/2005/7/11/336> | ||
406 | |||
407 | Kernel Documentation/process/coding-style.rst: | ||
408 | <http://sosdg.org/~coywolf/lxr/source/Documentation/process/coding-style.rst> | ||
409 | |||
410 | Linus Torvalds's mail on the canonical patch format: | ||
411 | <http://lkml.org/lkml/2005/4/7/183> | ||
412 | -- | ||
diff --git a/Documentation/translations/zh_CN/disclaimer-zh_CN.rst b/Documentation/translations/zh_CN/disclaimer-zh_CN.rst new file mode 100644 index 000000000000..dcf803ede85a --- /dev/null +++ b/Documentation/translations/zh_CN/disclaimer-zh_CN.rst | |||
@@ -0,0 +1,9 @@ | |||
1 | :orphan: | ||
2 | |||
3 | .. warning:: | ||
4 | 此文件的目的是为让中文读者更容易阅读和理解,而不是作为一个分支。 因此, | ||
5 | 如果您对此文件有任何意见或更新,请先尝试更新原始英文文件。 | ||
6 | |||
7 | .. note:: | ||
8 | 如果您发现本文档与原始文件有任何不同或者有翻译问题,请联系该文件的译者, | ||
9 | 或者请求时奎亮的帮助:<alex.shi@linux.alibaba.com>。 | ||
diff --git a/Documentation/translations/zh_CN/index.rst b/Documentation/translations/zh_CN/index.rst index 75956d669962..d3165535ec9e 100644 --- a/Documentation/translations/zh_CN/index.rst +++ b/Documentation/translations/zh_CN/index.rst | |||
@@ -3,10 +3,19 @@ | |||
3 | \renewcommand\thesection* | 3 | \renewcommand\thesection* |
4 | \renewcommand\thesubsection* | 4 | \renewcommand\thesubsection* |
5 | 5 | ||
6 | Chinese translations | 6 | 中文翻译 |
7 | ==================== | 7 | ======== |
8 | |||
9 | 这些手册包含有关如何开发内核的整体信息。内核社区非常庞大,一年下来有数千名开发 | ||
10 | 人员做出贡献。 与任何大型社区一样,知道如何完成任务将使得更改合并的过程变得更 | ||
11 | 加容易。 | ||
8 | 12 | ||
9 | .. toctree:: | 13 | .. toctree:: |
10 | :maxdepth: 1 | 14 | :maxdepth: 2 |
15 | |||
16 | process/index | ||
17 | |||
18 | 目录和表格 | ||
19 | ---------- | ||
11 | 20 | ||
12 | coding-style | 21 | * :ref:`genindex` |
diff --git a/Documentation/translations/zh_CN/magic-number.txt b/Documentation/translations/zh_CN/magic-number.txt deleted file mode 100644 index 7159cec04090..000000000000 --- a/Documentation/translations/zh_CN/magic-number.txt +++ /dev/null | |||
@@ -1,153 +0,0 @@ | |||
1 | Chinese translated version of Documentation/process/magic-number.rst | ||
2 | |||
3 | If you have any comment or update to the content, please post to LKML directly. | ||
4 | However, if you have problem communicating in English you can also ask the | ||
5 | Chinese maintainer for help. Contact the Chinese maintainer, if this | ||
6 | translation is outdated or there is problem with translation. | ||
7 | |||
8 | Chinese maintainer: Jia Wei Wei <harryxiyou@gmail.com> | ||
9 | --------------------------------------------------------------------- | ||
10 | Documentation/process/magic-number.rst的中文翻译 | ||
11 | |||
12 | 如果想评论或更新本文的内容,请直接发信到LKML。如果你使用英文交流有困难的话,也可 | ||
13 | 以向中文版维护者求助。如果本翻译更新不及时或者翻译存在问题,请联系中文版维护者。 | ||
14 | |||
15 | 中文版维护者: 贾威威 Jia Wei Wei <harryxiyou@gmail.com> | ||
16 | 中文版翻译者: 贾威威 Jia Wei Wei <harryxiyou@gmail.com> | ||
17 | 中文版校译者: 贾威威 Jia Wei Wei <harryxiyou@gmail.com> | ||
18 | |||
19 | 以下为正文 | ||
20 | --------------------------------------------------------------------- | ||
21 | 这个文件是有关当前使用的魔术值注册表。当你给一个结构添加了一个魔术值,你也应该把这个魔术值添加到这个文件,因为我们最好把用于各种结构的魔术值统一起来。 | ||
22 | |||
23 | 使用魔术值来保护内核数据结构是一个非常好的主意。这就允许你在运行期检查(a)一个结构是否已经被攻击,或者(b)你已经给一个例行程序通过了一个错误的结构。后一种情况特别地有用---特别是当你通过一个空指针指向结构体的时候。tty源码,例如,经常通过特定驱动使用这种方法并且反复地排列特定方面的结构。 | ||
24 | |||
25 | 使用魔术值的方法是在结构的开始处声明的,如下: | ||
26 | |||
27 | struct tty_ldisc { | ||
28 | int magic; | ||
29 | ... | ||
30 | }; | ||
31 | |||
32 | 当你以后给内核添加增强功能的时候,请遵守这条规则!这样就会节省数不清的调试时间,特别是一些古怪的情况,例如,数组超出范围并且重新写了超出部分。遵守这个规则,这些情况可以被快速地,安全地避免。 | ||
33 | |||
34 | Theodore Ts'o | ||
35 | 31 Mar 94 | ||
36 | |||
37 | 给当前的Linux 2.1.55添加魔术表。 | ||
38 | |||
39 | Michael Chastain | ||
40 | <mailto:mec@shout.net> | ||
41 | 22 Sep 1997 | ||
42 | |||
43 | 现在应该最新的Linux 2.1.112.因为在特性冻结期间,不能在2.2.x前改变任何东西。这些条目被数域所排序。 | ||
44 | |||
45 | Krzysztof G.Baranowski | ||
46 | <mailto: kgb@knm.org.pl> | ||
47 | 29 Jul 1998 | ||
48 | |||
49 | 更新魔术表到Linux 2.5.45。刚好越过特性冻结,但是有可能还会有一些新的魔术值在2.6.x之前融入到内核中。 | ||
50 | |||
51 | Petr Baudis | ||
52 | <pasky@ucw.cz> | ||
53 | 03 Nov 2002 | ||
54 | |||
55 | 更新魔术表到Linux 2.5.74。 | ||
56 | |||
57 | Fabian Frederick | ||
58 | <ffrederick@users.sourceforge.net> | ||
59 | 09 Jul 2003 | ||
60 | |||
61 | 魔术名 地址 结构 所在文件 | ||
62 | =========================================================================== | ||
63 | PG_MAGIC 'P' pg_{read,write}_hdr include/linux/pg.h | ||
64 | CMAGIC 0x0111 user include/linux/a.out.h | ||
65 | MKISS_DRIVER_MAGIC 0x04bf mkiss_channel drivers/net/mkiss.h | ||
66 | HDLC_MAGIC 0x239e n_hdlc drivers/char/n_hdlc.c | ||
67 | APM_BIOS_MAGIC 0x4101 apm_user arch/x86/kernel/apm_32.c | ||
68 | CYCLADES_MAGIC 0x4359 cyclades_port include/linux/cyclades.h | ||
69 | DB_MAGIC 0x4442 fc_info drivers/net/iph5526_novram.c | ||
70 | DL_MAGIC 0x444d fc_info drivers/net/iph5526_novram.c | ||
71 | FASYNC_MAGIC 0x4601 fasync_struct include/linux/fs.h | ||
72 | FF_MAGIC 0x4646 fc_info drivers/net/iph5526_novram.c | ||
73 | ISICOM_MAGIC 0x4d54 isi_port include/linux/isicom.h | ||
74 | PTY_MAGIC 0x5001 drivers/char/pty.c | ||
75 | PPP_MAGIC 0x5002 ppp include/linux/if_pppvar.h | ||
76 | SERIAL_MAGIC 0x5301 async_struct include/linux/serial.h | ||
77 | SSTATE_MAGIC 0x5302 serial_state include/linux/serial.h | ||
78 | SLIP_MAGIC 0x5302 slip drivers/net/slip.h | ||
79 | STRIP_MAGIC 0x5303 strip drivers/net/strip.c | ||
80 | X25_ASY_MAGIC 0x5303 x25_asy drivers/net/x25_asy.h | ||
81 | SIXPACK_MAGIC 0x5304 sixpack drivers/net/hamradio/6pack.h | ||
82 | AX25_MAGIC 0x5316 ax_disp drivers/net/mkiss.h | ||
83 | TTY_MAGIC 0x5401 tty_struct include/linux/tty.h | ||
84 | MGSL_MAGIC 0x5401 mgsl_info drivers/char/synclink.c | ||
85 | TTY_DRIVER_MAGIC 0x5402 tty_driver include/linux/tty_driver.h | ||
86 | MGSLPC_MAGIC 0x5402 mgslpc_info drivers/char/pcmcia/synclink_cs.c | ||
87 | TTY_LDISC_MAGIC 0x5403 tty_ldisc include/linux/tty_ldisc.h | ||
88 | USB_SERIAL_MAGIC 0x6702 usb_serial drivers/usb/serial/usb-serial.h | ||
89 | FULL_DUPLEX_MAGIC 0x6969 drivers/net/ethernet/dec/tulip/de2104x.c | ||
90 | USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth drivers/usb/class/bluetty.c | ||
91 | RFCOMM_TTY_MAGIC 0x6d02 net/bluetooth/rfcomm/tty.c | ||
92 | USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port drivers/usb/serial/usb-serial.h | ||
93 | CG_MAGIC 0x00090255 ufs_cylinder_group include/linux/ufs_fs.h | ||
94 | RPORT_MAGIC 0x00525001 r_port drivers/char/rocket_int.h | ||
95 | LSEMAGIC 0x05091998 lse drivers/fc4/fc.c | ||
96 | GDTIOCTL_MAGIC 0x06030f07 gdth_iowr_str drivers/scsi/gdth_ioctl.h | ||
97 | RIEBL_MAGIC 0x09051990 drivers/net/atarilance.c | ||
98 | NBD_REQUEST_MAGIC 0x12560953 nbd_request include/linux/nbd.h | ||
99 | RED_MAGIC2 0x170fc2a5 (any) mm/slab.c | ||
100 | BAYCOM_MAGIC 0x19730510 baycom_state drivers/net/baycom_epp.c | ||
101 | ISDN_X25IFACE_MAGIC 0x1e75a2b9 isdn_x25iface_proto_data | ||
102 | drivers/isdn/isdn_x25iface.h | ||
103 | ECP_MAGIC 0x21504345 cdkecpsig include/linux/cdk.h | ||
104 | LSOMAGIC 0x27091997 lso drivers/fc4/fc.c | ||
105 | LSMAGIC 0x2a3b4d2a ls drivers/fc4/fc.c | ||
106 | WANPIPE_MAGIC 0x414C4453 sdla_{dump,exec} include/linux/wanpipe.h | ||
107 | CS_CARD_MAGIC 0x43525553 cs_card sound/oss/cs46xx.c | ||
108 | LABELCL_MAGIC 0x4857434c labelcl_info_s include/asm/ia64/sn/labelcl.h | ||
109 | ISDN_ASYNC_MAGIC 0x49344C01 modem_info include/linux/isdn.h | ||
110 | CTC_ASYNC_MAGIC 0x49344C01 ctc_tty_info drivers/s390/net/ctctty.c | ||
111 | ISDN_NET_MAGIC 0x49344C02 isdn_net_local_s drivers/isdn/i4l/isdn_net_lib.h | ||
112 | SAVEKMSG_MAGIC2 0x4B4D5347 savekmsg arch/*/amiga/config.c | ||
113 | CS_STATE_MAGIC 0x4c4f4749 cs_state sound/oss/cs46xx.c | ||
114 | SLAB_C_MAGIC 0x4f17a36d kmem_cache mm/slab.c | ||
115 | COW_MAGIC 0x4f4f4f4d cow_header_v1 arch/um/drivers/ubd_user.c | ||
116 | I810_CARD_MAGIC 0x5072696E i810_card sound/oss/i810_audio.c | ||
117 | TRIDENT_CARD_MAGIC 0x5072696E trident_card sound/oss/trident.c | ||
118 | ROUTER_MAGIC 0x524d4157 wan_device [in wanrouter.h pre 3.9] | ||
119 | SAVEKMSG_MAGIC1 0x53415645 savekmsg arch/*/amiga/config.c | ||
120 | GDA_MAGIC 0x58464552 gda arch/mips/include/asm/sn/gda.h | ||
121 | RED_MAGIC1 0x5a2cf071 (any) mm/slab.c | ||
122 | EEPROM_MAGIC_VALUE 0x5ab478d2 lanai_dev drivers/atm/lanai.c | ||
123 | HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state include/linux/hdlcdrv.h | ||
124 | PCXX_MAGIC 0x5c6df104 channel drivers/char/pcxx.h | ||
125 | KV_MAGIC 0x5f4b565f kernel_vars_s arch/mips/include/asm/sn/klkernvars.h | ||
126 | I810_STATE_MAGIC 0x63657373 i810_state sound/oss/i810_audio.c | ||
127 | TRIDENT_STATE_MAGIC 0x63657373 trient_state sound/oss/trident.c | ||
128 | M3_CARD_MAGIC 0x646e6f50 m3_card sound/oss/maestro3.c | ||
129 | FW_HEADER_MAGIC 0x65726F66 fw_header drivers/atm/fore200e.h | ||
130 | SLOT_MAGIC 0x67267321 slot drivers/hotplug/cpqphp.h | ||
131 | SLOT_MAGIC 0x67267322 slot drivers/hotplug/acpiphp.h | ||
132 | LO_MAGIC 0x68797548 nbd_device include/linux/nbd.h | ||
133 | OPROFILE_MAGIC 0x6f70726f super_block drivers/oprofile/oprofilefs.h | ||
134 | M3_STATE_MAGIC 0x734d724d m3_state sound/oss/maestro3.c | ||
135 | VMALLOC_MAGIC 0x87654320 snd_alloc_track sound/core/memory.c | ||
136 | KMALLOC_MAGIC 0x87654321 snd_alloc_track sound/core/memory.c | ||
137 | PWC_MAGIC 0x89DC10AB pwc_device drivers/usb/media/pwc.h | ||
138 | NBD_REPLY_MAGIC 0x96744668 nbd_reply include/linux/nbd.h | ||
139 | ENI155_MAGIC 0xa54b872d midway_eprom drivers/atm/eni.h | ||
140 | CODA_MAGIC 0xC0DAC0DA coda_file_info include/linux/coda_fs_i.h | ||
141 | DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram drivers/scsi/gdth.h | ||
142 | YAM_MAGIC 0xF10A7654 yam_port drivers/net/hamradio/yam.c | ||
143 | CCB_MAGIC 0xf2691ad2 ccb drivers/scsi/ncr53c8xx.c | ||
144 | QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry drivers/scsi/arm/queue.c | ||
145 | QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry drivers/scsi/arm/queue.c | ||
146 | HTB_CMAGIC 0xFEFAFEF1 htb_class net/sched/sch_htb.c | ||
147 | NMI_MAGIC 0x48414d4d455201 nmi_s arch/mips/include/asm/sn/nmi.h | ||
148 | |||
149 | 请注意,在声音记忆管理中仍然有一些特殊的为每个驱动定义的魔术值。查看include/sound/sndmagic.h来获取他们完整的列表信息。很多OSS声音驱动拥有自己从声卡PCI ID构建的魔术值-他们也没有被列在这里。 | ||
150 | |||
151 | IrDA子系统也使用了大量的自己的魔术值,查看include/net/irda/irda.h来获取他们完整的信息。 | ||
152 | |||
153 | HFS是另外一个比较大的使用魔术值的文件系统-你可以在fs/hfs/hfs.h中找到他们。 | ||
diff --git a/Documentation/translations/zh_CN/oops-tracing.txt b/Documentation/translations/zh_CN/oops-tracing.txt index a893f04dfd5d..93fa061cf9e4 100644 --- a/Documentation/translations/zh_CN/oops-tracing.txt +++ b/Documentation/translations/zh_CN/oops-tracing.txt | |||
@@ -16,7 +16,7 @@ Documentation/admin-guide/bug-hunting.rst 的中文翻译 | |||
16 | 16 | ||
17 | 中文版维护者: 杨瑞 Dave Young <hidave.darkstar@gmail.com> | 17 | 中文版维护者: 杨瑞 Dave Young <hidave.darkstar@gmail.com> |
18 | 中文版翻译者: 杨瑞 Dave Young <hidave.darkstar@gmail.com> | 18 | 中文版翻译者: 杨瑞 Dave Young <hidave.darkstar@gmail.com> |
19 | 中文版校译者: 李阳 Li Yang <leo@zh-kernel.org> | 19 | 中文版校译者: 李阳 Li Yang <leoyang.li@nxp.com> |
20 | 王聪 Wang Cong <xiyou.wangcong@gmail.com> | 20 | 王聪 Wang Cong <xiyou.wangcong@gmail.com> |
21 | 21 | ||
22 | 以下为正文 | 22 | 以下为正文 |
diff --git a/Documentation/translations/zh_CN/process/1.Intro.rst b/Documentation/translations/zh_CN/process/1.Intro.rst new file mode 100644 index 000000000000..10a15f3dc282 --- /dev/null +++ b/Documentation/translations/zh_CN/process/1.Intro.rst | |||
@@ -0,0 +1,186 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/1.Intro.rst <development_process_intro>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_development_process_intro: | ||
7 | |||
8 | 介绍 | ||
9 | ==== | ||
10 | |||
11 | 执行摘要 | ||
12 | -------- | ||
13 | |||
14 | 本节的其余部分涵盖了内核开发过程的范围,以及开发人员及其雇主在这方面可能遇 | ||
15 | 到的各种挫折。内核代码应该合并到正式的(“主线”)内核中有很多原因,包括对用 | ||
16 | 户的自动可用性、多种形式的社区支持以及影响内核开发方向的能力。提供给Linux | ||
17 | 内核的代码必须在与GPL兼容的许可证下可用。 | ||
18 | |||
19 | :ref:`cn_development_process` 介绍了开发过程、内核发布周期和合并窗口的机制。 | ||
20 | 涵盖了补丁开发、审查和合并周期中的各个阶段。有一些关于工具和邮件列表的讨论。 | ||
21 | 鼓励希望开始内核开发的开发人员作为初始练习跟踪并修复bug。 | ||
22 | |||
23 | |||
24 | :ref:`cn_development_early_stage` 包括早期项目规划,重点是尽快让开发社区参与 | ||
25 | |||
26 | :ref:`cn_development_coding` 是关于编码过程的;讨论了其他开发人员遇到的几个 | ||
27 | 陷阱。对补丁的一些要求已经涵盖,并且介绍了一些工具,这些工具有助于确保内核 | ||
28 | 补丁是正确的。 | ||
29 | |||
30 | :ref:`cn_development_posting` 讨论发布补丁以供评审的过程。为了让开发社区 | ||
31 | 认真对待,补丁必须正确格式化和描述,并且必须发送到正确的地方。遵循本节中的 | ||
32 | 建议有助于确保为您的工作提供最好的接纳。 | ||
33 | |||
34 | :ref:`cn_development_followthrough` 介绍了发布补丁之后发生的事情;该工作 | ||
35 | 在这一点上还远远没有完成。与审阅者一起工作是开发过程中的一个重要部分;本节 | ||
36 | 提供了一些关于如何在这个重要阶段避免问题的提示。当补丁被合并到主线中时, | ||
37 | 开发人员要注意不要假定任务已经完成。 | ||
38 | |||
39 | :ref:`cn_development_advancedtopics` 介绍了两个“高级”主题: | ||
40 | 使用Git管理补丁和查看其他人发布的补丁。 | ||
41 | |||
42 | :ref:`cn_development_conclusion` 总结了有关内核开发的更多信息,附带有带有 | ||
43 | 指向资源的链接. | ||
44 | |||
45 | 这个文件是关于什么的 | ||
46 | -------------------- | ||
47 | |||
48 | Linux内核有超过800万行代码,每个版本的贡献者超过1000人,是现存最大、最活跃 | ||
49 | 的免费软件项目之一。从1991年开始,这个内核已经发展成为一个最好的操作系统 | ||
50 | 组件,运行在袖珍数字音乐播放器、台式PC、现存最大的超级计算机以及所有类型的 | ||
51 | 系统上。它是一种适用于几乎任何情况的健壮、高效和可扩展的解决方案。 | ||
52 | |||
53 | 随着Linux的发展,希望参与其开发的开发人员(和公司)的数量也在增加。硬件供应商 | ||
54 | 希望确保Linux能够很好地支持他们的产品,使这些产品对Linux用户具有吸引力。嵌入 | ||
55 | 式系统供应商使用Linux作为集成产品的组件,希望Linux能够尽可能地胜任手头的任务。 | ||
56 | 分销商和其他基于Linux的软件供应商对Linux内核的功能、性能和可靠性有着明确的 | ||
57 | 兴趣。最终用户也常常希望修改Linux,使之更好地满足他们的需求。 | ||
58 | |||
59 | Linux最引人注目的特性之一是这些开发人员可以访问它;任何具备必要技能的人都可以 | ||
60 | 改进Linux并影响其开发方向。专有产品不能提供这种开放性,这是自由软件的一个特点。 | ||
61 | 但是,如果有什么不同的话,内核比大多数其他自由软件项目更开放。一个典型的三个月 | ||
62 | 内核开发周期可以涉及1000多个开发人员,他们为100多个不同的公司 | ||
63 | (或者根本没有公司)工作。 | ||
64 | |||
65 | 与内核开发社区合作并不是特别困难。但是,尽管如此,许多潜在的贡献者在尝试做 | ||
66 | 内核工作时遇到了困难。内核社区已经发展了自己独特的操作方式,使其能够在每天 | ||
67 | 都要更改数千行代码的环境中顺利运行(并生成高质量的产品)。因此,Linux内核开发 | ||
68 | 过程与专有的开发方法有很大的不同也就不足为奇了。 | ||
69 | |||
70 | 对于新开发人员来说,内核的开发过程可能会让人感到奇怪和恐惧,但这个背后有充分的 | ||
71 | 理由和坚实的经验。一个不了解内核社区的方式的开发人员(或者更糟的是,他们试图 | ||
72 | 抛弃或规避内核社区的方式)会有一个令人沮丧的体验。开发社区, 在帮助那些试图学习 | ||
73 | 的人的同时,没有时间帮助那些不愿意倾听或不关心开发过程的人。 | ||
74 | |||
75 | 希望阅读本文的人能够避免这种令人沮丧的经历。这里有很多材料,但阅读时所做的 | ||
76 | 努力会在短时间内得到回报。开发社区总是需要能让内核变更好的开发人员;下面的 | ||
77 | 文本应该帮助您或为您工作的人员加入我们的社区。 | ||
78 | |||
79 | 致谢 | ||
80 | ---- | ||
81 | |||
82 | 本文件由Jonathan Corbet撰写,corbet@lwn.net。以下人员的建议使之更为完善: | ||
83 | Johannes Berg, James Berry, Alex Chiang, Roland Dreier, Randy Dunlap, | ||
84 | Jake Edge, Jiri Kosina, Matt Mackall, Arthur Marsh, Amanda McPherson, | ||
85 | Andrew Morton, Andrew Price, Tsugikazu Shibata, 和 Jochen Voß. | ||
86 | |||
87 | 这项工作得到了Linux基金会的支持,特别感谢Amanda McPherson,他看到了这项工作 | ||
88 | 的价值并把它变成现实。 | ||
89 | |||
90 | 代码进入主线的重要性 | ||
91 | -------------------- | ||
92 | |||
93 | 有些公司和开发人员偶尔会想,为什么他们要费心学习如何与内核社区合作,并将代码 | ||
94 | 放入主线内核(“主线”是由Linus Torvalds维护的内核,Linux发行商将其用作基础)。 | ||
95 | 在短期内,贡献代码看起来像是一种可以避免的开销;仅仅将代码分开并直接支持用户 | ||
96 | 似乎更容易。事实上,保持代码独立(“树外”)是在经济上是错误的。 | ||
97 | |||
98 | 作为说明树外代码成本的一种方法,下面是内核开发过程的一些相关方面;本文稍后将 | ||
99 | 更详细地讨论其中的大部分内容。考虑: | ||
100 | |||
101 | - 所有Linux用户都可以使用合并到主线内核中的代码。它将自动出现在所有启用它的 | ||
102 | 发行版上。不需要驱动程序磁盘、下载,也不需要为多个发行版的多个版本提供支持; | ||
103 | 对于开发人员和用户来说,这一切都是可行的。并入主线解决了大量的分布和支持问题 | ||
104 | |||
105 | - 当内核开发人员努力维护一个稳定的用户空间接口时,内部内核API处于不断变化之中. | ||
106 | 缺乏一个稳定的内部接口是一个深思熟虑的设计决策;它允许在任何时候进行基本的改 | ||
107 | 进,并产生更高质量的代码。但该策略的一个结果是,如果要使用新的内核,任何树外 | ||
108 | 代码都需要持续的维护。维护树外代码需要大量的工作才能使代码保持工作状态。 | ||
109 | |||
110 | 相反,位于主线中的代码不需要这样做,因为一个简单的规则要求进行API更改的任何 | ||
111 | 开发人员也必须修复由于该更改而破坏的任何代码。因此,合并到主线中的代码大大 | ||
112 | 降低了维护成本。 | ||
113 | |||
114 | - 除此之外,内核中的代码通常会被其他开发人员改进。令人惊讶的结果可能来自授权 | ||
115 | 您的用户社区和客户改进您的产品。 | ||
116 | |||
117 | - 内核代码在合并到主线之前和之后都要经过审查。不管原始开发人员的技能有多强, | ||
118 | 这个审查过程总是能找到改进代码的方法。审查经常发现严重的错误和安全问题。 | ||
119 | 这对于在封闭环境中开发的代码尤其如此;这种代码从外部开发人员的审查中获益 | ||
120 | 匪浅。树外代码是低质量代码。 | ||
121 | |||
122 | - 参与开发过程是您影响内核开发方向的方式。旁观者的抱怨会被听到,但是活跃的 | ||
123 | 开发人员有更强的声音——并且能够实现使内核更好地满足其需求的更改。 | ||
124 | |||
125 | - 当单独维护代码时,总是存在第三方为类似功能提供不同实现的可能性。如果发生 | ||
126 | 这种情况,合并代码将变得更加困难——甚至到了不可能的地步。然后,您将面临以下 | ||
127 | 令人不快的选择:(1)无限期地维护树外的非标准特性,或(2)放弃代码并将用户 | ||
128 | 迁移到树内版本。 | ||
129 | |||
130 | - 代码的贡献是使整个过程工作的根本。通过贡献代码,您可以向内核添加新功能,并 | ||
131 | 提供其他内核开发人员使用的功能和示例。如果您已经为Linux开发了代码(或者 | ||
132 | 正在考虑这样做),那么您显然对这个平台的持续成功感兴趣;贡献代码是确保成功 | ||
133 | 的最好方法之一。 | ||
134 | |||
135 | 上述所有理由都适用于任何树外内核代码,包括以专有的、仅二进制形式分发的代码。 | ||
136 | 然而,在考虑任何类型的纯二进制内核代码分布之前,还需要考虑其他因素。这些包括: | ||
137 | |||
138 | - 围绕专有内核模块分发的法律问题充其量是模糊的;相当多的内核版权所有者认为, | ||
139 | 大多数仅限二进制的模块是内核的派生产品,因此,它们的分发违反了GNU通用公共 | ||
140 | 许可证(下面将详细介绍)。您的作者不是律师,本文档中的任何内容都不可能被 | ||
141 | 视为法律建议。封闭源代码模块的真实法律地位只能由法院决定。但不管怎样,困扰 | ||
142 | 这些模块的不确定性仍然存在。 | ||
143 | |||
144 | - 二进制模块大大增加了调试内核问题的难度,以至于大多数内核开发人员甚至都不会 | ||
145 | 尝试。因此,只分发二进制模块将使您的用户更难从社区获得支持。 | ||
146 | |||
147 | - 对于只支持二进制的模块的发行者来说,支持也更加困难,他们必须为他们希望支持 | ||
148 | 的每个发行版和每个内核版本提供一个版本的模块。为了提供相当全面的覆盖范围, | ||
149 | 可能需要一个模块的几十个构建,并且每次升级内核时,您的用户都必须单独升级 | ||
150 | 您的模块。 | ||
151 | |||
152 | - 上面提到的关于代码评审的所有问题都更加存在于封闭源代码。由于该代码根本不可 | ||
153 | 用,因此社区无法对其进行审查,毫无疑问,它将存在严重问题。 | ||
154 | |||
155 | 尤其是嵌入式系统的制造商,可能会倾向于忽视本节中所说的大部分内容,因为他们 | ||
156 | 相信自己正在商用一种使用冻结内核版本的独立产品,在发布后不需要再进行开发。 | ||
157 | 这个论点忽略了广泛的代码审查的价值以及允许用户向产品添加功能的价值。但这些 | ||
158 | 产品也有有限的商业寿命,之后必须发布新版本的产品。在这一点上,代码在主线上 | ||
159 | 并得到良好维护的供应商将能够更好地占位,以使新产品快速上市。 | ||
160 | |||
161 | 许可 | ||
162 | ---- | ||
163 | |||
164 | 代码是根据一些许可证提供给Linux内核的,但是所有代码都必须与GNU通用公共许可 | ||
165 | 证(GPLV2)的版本2兼容,该版本是覆盖整个内核分发的许可证。在实践中,这意味 | ||
166 | 着所有代码贡献都由GPLv2(可选地,语言允许在更高版本的GPL下分发)或3子句BSD | ||
167 | 许可(New BSD License, 译者注)覆盖。任何不包含在兼容许可证中的贡献都不会 | ||
168 | 被接受到内核中。 | ||
169 | |||
170 | 贡献给内核的代码不需要(或请求)版权分配。合并到主线内核中的所有代码都保留 | ||
171 | 其原始所有权;因此,内核现在拥有数千个所有者。 | ||
172 | |||
173 | 这种所有权结构的一个暗示是,任何改变内核许可的尝试都注定会失败。很少有实际 | ||
174 | 的场景可以获得所有版权所有者的同意(或者从内核中删除他们的代码)。因此,特 | ||
175 | 别是,在可预见的将来,不可能迁移到GPL的版本3。 | ||
176 | |||
177 | 所有贡献给内核的代码都必须是合法的免费软件。因此,不接受匿名(或匿名)贡献 | ||
178 | 者的代码。所有贡献者都需要在他们的代码上“sign off”,声明代码可以在GPL下与内 | ||
179 | 核一起分发。无法提供未被其所有者许可为免费软件的代码,或可能为内核造成版权 | ||
180 | 相关问题的代码(例如,由缺乏适当保护的反向工程工作派生的代码)不能被接受。 | ||
181 | |||
182 | 有关版权相关问题的问题在Linux开发邮件列表中很常见。这样的问题通常会得到不少 | ||
183 | 答案,但要记住,回答这些问题的人不是律师,不能提供法律咨询。如果您有关于 | ||
184 | Linux源代码的法律问题,那么与了解该领域的律师交流是无法替代的。依靠从技术 | ||
185 | 邮件列表中获得的答案是一件冒险的事情。 | ||
186 | |||
diff --git a/Documentation/translations/zh_CN/process/2.Process.rst b/Documentation/translations/zh_CN/process/2.Process.rst new file mode 100644 index 000000000000..ceb733bb0294 --- /dev/null +++ b/Documentation/translations/zh_CN/process/2.Process.rst | |||
@@ -0,0 +1,360 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/2.Process.rst <development_process>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_development_process: | ||
7 | |||
8 | 开发流程如何工作 | ||
9 | ================ | ||
10 | |||
11 | 90年代早期的Linux内核开发是一件相当松散的事情,涉及的用户和开发人员相对较 | ||
12 | 少。由于拥有数以百万计的用户群,并且在一年的时间里有大约2000名开发人员参与 | ||
13 | 进来,内核因此必须发展许多流程来保持开发的顺利进行。要成为流程的有效组成 | ||
14 | 部分,需要对流程的工作方式有一个扎实的理解。 | ||
15 | |||
16 | 总览 | ||
17 | ---- | ||
18 | |||
19 | 内核开发人员使用一个松散的基于时间的发布过程,每两到三个月发布一次新的主要 | ||
20 | 内核版本。最近的发布历史记录如下: | ||
21 | |||
22 | ====== ================= | ||
23 | 4.11 四月 30, 2017 | ||
24 | 4.12 七月 2, 2017 | ||
25 | 4.13 九月 3, 2017 | ||
26 | 4.14 十一月 12, 2017 | ||
27 | 4.15 一月 28, 2018 | ||
28 | 4.16 四月 1, 2018 | ||
29 | ====== ================= | ||
30 | |||
31 | 每4.x版本都是一个主要的内核版本,具有新特性、内部API更改等等。一个典型的4.x | ||
32 | 版本包含大约13000个变更集,变更了几十万行代码。因此,4.x是Linux内核开发的前 | ||
33 | 沿;内核使用滚动开发模型,不断集成重大变化。 | ||
34 | |||
35 | 对于每个版本的补丁合并,遵循一个相对简单的规则。在每个开发周期的开始,“合并 | ||
36 | 窗口”被打开。当时,被认为足够稳定(并且被开发社区接受)的代码被合并到主线内 | ||
37 | 核中。在这段时间内,新开发周期的大部分变更(以及所有主要变更)将以接近每天 | ||
38 | 1000次变更(“补丁”或“变更集”)的速度合并。 | ||
39 | |||
40 | (顺便说一句,值得注意的是,合并窗口期间集成的更改并不是凭空产生的;它们是 | ||
41 | 提前收集、测试和分级的。稍后将详细描述该过程的工作方式)。 | ||
42 | |||
43 | 合并窗口持续大约两周。在这段时间结束时,LinusTorvalds将声明窗口已关闭,并 | ||
44 | 释放第一个“rc”内核。例如,对于目标为4.14的内核,在合并窗口结束时发生的释放 | ||
45 | 将被称为4.14-rc1。RC1版本是一个信号,表示合并新特性的时间已经过去,稳定下一 | ||
46 | 个内核的时间已经开始。 | ||
47 | |||
48 | 在接下来的6到10周内,只有修复问题的补丁才应该提交给主线。有时会允许更大的 | ||
49 | 更改,但这种情况很少发生;试图在合并窗口外合并新功能的开发人员往往会受到不 | ||
50 | 友好的接待。一般来说,如果您错过了给定特性的合并窗口,最好的做法是等待下一 | ||
51 | 个开发周期。(对于以前不支持的硬件,偶尔会对驱动程序进行例外;如果它们不 | ||
52 | 改变已有代码,则不会导致回归,并且应该可以随时安全地添加)。 | ||
53 | |||
54 | 随着修复程序进入主线,补丁速度将随着时间的推移而变慢。Linus大约每周发布一次 | ||
55 | 新的-rc内核;一个正常的系列将在-rc6和-rc9之间,内核被认为足够稳定并最终发布。 | ||
56 | 然后,整个过程又重新开始了。 | ||
57 | |||
58 | 例如,这里是4.16的开发周期进行情况(2018年的所有日期): | ||
59 | |||
60 | ============== ============================== | ||
61 | 一月 28 4.15 稳定版发布 | ||
62 | 二月 11 4.16-rc1, 合并窗口关闭 | ||
63 | 二月 18 4.16-rc2 | ||
64 | 二月 25 4.16-rc3 | ||
65 | 三月 4 4.16-rc4 | ||
66 | 三月 11 4.16-rc5 | ||
67 | 三月 18 4.16-rc6 | ||
68 | 三月 25 4.16-rc7 | ||
69 | 四月 1 4.16 稳定版发布 | ||
70 | ============== ============================== | ||
71 | |||
72 | 开发人员如何决定何时结束开发周期并创建稳定的版本?使用的最重要的指标是以前 | ||
73 | 版本的回归列表。不欢迎出现任何错误,但是那些破坏了以前能工作的系统的错误被 | ||
74 | 认为是特别严重的。因此,导致回归的补丁是不受欢迎的,很可能在稳定期内删除。 | ||
75 | |||
76 | 开发人员的目标是在稳定发布之前修复所有已知的回归。在现实世界中,这种完美是 | ||
77 | 很难实现的;在这种规模的项目中,变量太多了。有一点,延迟最终版本只会使问题 | ||
78 | 变得更糟;等待下一个合并窗口的一堆更改将变大,从而在下次创建更多的回归错误。 | ||
79 | 因此,大多数4.x内核都有一些已知的回归错误,不过,希望没有一个是严重的。 | ||
80 | |||
81 | 一旦一个稳定的版本发布,它正在进行的维护工作就被移交给“稳定团队”,目前由 | ||
82 | Greg Kroah-Hartman组成。稳定团队将使用4.x.y编号方案不定期的发布稳定版本的更 | ||
83 | 新。要加入更新版本,补丁程序必须(1)修复一个重要的bug,(2)已经合并到 | ||
84 | 下一个开发主线中。内核通常会在超过其初始版本的一个以上的开发周期内接收稳定 | ||
85 | 的更新。例如,4.13内核的历史如下 | ||
86 | |||
87 | ============== =============================== | ||
88 | 九月 3 4.13 稳定版发布 | ||
89 | 九月 13 4.13.1 | ||
90 | 九月 20 4.13.2 | ||
91 | 九月 27 4.13.3 | ||
92 | 十月 5 4.13.4 | ||
93 | 十月 12 4.13.5 | ||
94 | ... ... | ||
95 | 十一月 24 4.13.16 | ||
96 | ============== =============================== | ||
97 | |||
98 | 4.13.16是4.13版本的最终稳定更新。 | ||
99 | |||
100 | 有些内核被指定为“长期”内核;它们将得到更长时间的支持。在本文中,当前的长期 | ||
101 | 内核及其维护者是: | ||
102 | |||
103 | ====== ====================== ============================== | ||
104 | 3.16 Ben Hutchings (长期稳定内核) | ||
105 | 4.1 Sasha Levin | ||
106 | 4.4 Greg Kroah-Hartman (长期稳定内核) | ||
107 | 4.9 Greg Kroah-Hartman | ||
108 | 4.14 Greg Kroah-Hartman | ||
109 | ====== ====================== ============================== | ||
110 | |||
111 | 为长期支持选择内核纯粹是维护人员有必要和时间来维护该版本的问题。目前还没有 | ||
112 | 为即将发布的任何特定版本提供长期支持的已知计划。 | ||
113 | |||
114 | 补丁的生命周期 | ||
115 | -------------- | ||
116 | |||
117 | 补丁不会直接从开发人员的键盘进入主线内核。相反,有一个稍微复杂(如果有些非 | ||
118 | 正式)的过程,旨在确保对每个补丁进行质量审查,并确保每个补丁实现了一个在主线 | ||
119 | 中需要的更改。对于小的修复,这个过程可能会很快发生,或者,在大的和有争议的 | ||
120 | 变更的情况下,会持续数年。许多开发人员的挫折来自于对这个过程缺乏理解或者 | ||
121 | 试图绕过它。 | ||
122 | |||
123 | 为了减少这种挫折感,本文将描述补丁如何进入内核。下面是一个介绍,它以某种 | ||
124 | 理想化的方式描述了这个过程。更详细的过程将在后面的章节中介绍。 | ||
125 | |||
126 | 补丁程序经历的阶段通常是: | ||
127 | |||
128 | - 设计。这就是补丁的真正需求——以及满足这些需求的方式——的所在。设计工作通常 | ||
129 | 是在不涉及社区的情况下完成的,但是如果可能的话,最好是在公开的情况下完成 | ||
130 | 这项工作;这样可以节省很多稍后再重新设计的时间。 | ||
131 | |||
132 | - 早期评审。补丁被发布到相关的邮件列表中,列表中的开发人员会回复他们可能有 | ||
133 | 的任何评论。如果一切顺利的话,这个过程应该会发现补丁的任何主要问题。 | ||
134 | |||
135 | - 更广泛的评审。当补丁接近准备好纳入主线时,它应该被相关的子系统维护人员 | ||
136 | 接受——尽管这种接受并不能保证补丁会一直延伸到主线。补丁将出现在维护人员的 | ||
137 | 子系统树中,并进入 -next 树(如下所述)。当流程工作时,此步骤将导致对补丁 | ||
138 | 进行更广泛的审查,并发现由于将此补丁与其他人所做的工作集成而导致的任何 | ||
139 | 问题。 | ||
140 | |||
141 | - 请注意,大多数维护人员也有日常工作,因此合并补丁可能不是他们的最高优先级。 | ||
142 | 如果您的补丁程序得到了关于所需更改的反馈,那么您应该进行这些更改,或者为 | ||
143 | 不应该进行这些更改的原因辩护。如果您的补丁没有评审意见,但没有被其相应的 | ||
144 | 子系统或驱动程序维护者接受,那么您应该坚持不懈地将补丁更新到当前内核,使 | ||
145 | 其干净地应用,并不断地将其发送以供审查和合并。 | ||
146 | |||
147 | - 合并到主线。最终,一个成功的补丁将被合并到由LinusTorvalds管理的主线存储库 | ||
148 | 中。此时可能会出现更多的评论和/或问题;开发人员应对这些问题并解决出现的 | ||
149 | 任何问题很重要。 | ||
150 | |||
151 | - 稳定版发布。可能受补丁影响的用户数量现在很大,因此可能再次出现新的问题。 | ||
152 | |||
153 | - 长期维护。虽然开发人员在合并代码后可能会忘记代码,但这种行为往往会给开发 | ||
154 | 社区留下不良印象。合并代码消除了一些维护负担,因为其他代码将修复由API | ||
155 | 更改引起的问题。但是,如果代码要长期保持有用,原始开发人员应该继续为 | ||
156 | 代码负责。 | ||
157 | |||
158 | 内核开发人员(或他们的雇主)犯的最大错误之一是试图将流程简化为一个 | ||
159 | “合并到主线”步骤。这种方法总是会让所有相关人员感到沮丧。 | ||
160 | |||
161 | 补丁如何进入内核 | ||
162 | ---------------- | ||
163 | |||
164 | 只有一个人可以将补丁合并到主线内核存储库中:LinusTorvalds。但是,在进入 | ||
165 | 2.6.38内核的9500多个补丁中,只有112个(大约1.3%)是由Linus自己直接选择的。 | ||
166 | 内核项目已经发展到一个规模,没有一个开发人员可以在没有支持的情况下检查和 | ||
167 | 选择每个补丁。内核开发人员处理这种增长的方式是通过使用围绕信任链构建的 | ||
168 | 助理系统。 | ||
169 | |||
170 | 内核代码库在逻辑上被分解为一组子系统:网络、特定的体系结构支持、内存管理、 | ||
171 | 视频设备等。大多数子系统都有一个指定的维护人员,开发人员对该子系统中的代码 | ||
172 | 负有全部责任。这些子系统维护者(松散地)是他们所管理的内核部分的守护者; | ||
173 | 他们(通常)会接受一个补丁以包含到主线内核中。 | ||
174 | |||
175 | 子系统维护人员每个人都使用git源代码管理工具管理自己版本的内核源代码树。Git | ||
176 | 等工具(以及Quilt或Mercurial等相关工具)允许维护人员跟踪补丁列表,包括作者 | ||
177 | 信息和其他元数据。在任何给定的时间,维护人员都可以确定他或她的存储库中的哪 | ||
178 | 些补丁在主线中找不到。 | ||
179 | |||
180 | 当合并窗口打开时,顶级维护人员将要求Linus从其存储库中“拉出”他们为合并选择 | ||
181 | 的补丁。如果Linus同意,补丁流将流向他的存储库,成为主线内核的一部分。 | ||
182 | Linus对拉操作中接收到的特定补丁的关注程度各不相同。很明显,有时他看起来很 | ||
183 | 关注。但是,作为一般规则,Linus相信子系统维护人员不会向上游发送坏补丁。 | ||
184 | |||
185 | 子系统维护人员反过来也可以从其他维护人员那里获取补丁。例如,网络树是由首先 | ||
186 | 在专用于网络设备驱动程序、无线网络等的树中积累的补丁构建的。此存储链可以 | ||
187 | 任意长,但很少超过两个或三个链接。由于链中的每个维护者都信任那些管理较低 | ||
188 | 级别树的维护者,所以这个过程称为“信任链”。 | ||
189 | |||
190 | 显然,在这样的系统中,获取内核补丁取决于找到正确的维护者。直接向Linus发送 | ||
191 | 补丁通常不是正确的方法。 | ||
192 | |||
193 | Next 树 | ||
194 | ------- | ||
195 | |||
196 | 子系统树链引导补丁流到内核,但它也提出了一个有趣的问题:如果有人想查看为 | ||
197 | 下一个合并窗口准备的所有补丁怎么办?开发人员将感兴趣的是,还有什么其他的 | ||
198 | 更改有待解决,以查看是否存在需要担心的冲突;例如,更改核心内核函数原型的 | ||
199 | 修补程序将与使用该函数旧形式的任何其他修补程序冲突。审查人员和测试人员希望 | ||
200 | 在所有这些变更到达主线内核之前,能够访问它们的集成形式中的变更。您可以从所有 | ||
201 | 有趣的子系统树中提取更改,但这将是一项大型且容易出错的工作。 | ||
202 | |||
203 | 答案以-next树的形式出现,在这里子系统树被收集以供测试和审查。Andrew Morton | ||
204 | 维护的这些旧树被称为“-mm”(用于内存管理,这就是它的启动名字)。-mm 树集成了 | ||
205 | 一长串子系统树中的补丁;它还包含一些旨在帮助调试的补丁。 | ||
206 | |||
207 | 除此之外,-mm 还包含大量由Andrew直接选择的补丁。这些补丁可能已经发布在邮件 | ||
208 | 列表上,或者它们可能应用于内核中没有指定子系统树的部分。结果,-mm 作为一种 | ||
209 | 最后手段的子系统树运行;如果没有其他明显的路径可以让补丁进入主线,那么它很 | ||
210 | 可能以-mm 结束。累积在-mm 中的各种补丁最终将被转发到适当的子系统树,或者直接 | ||
211 | 发送到Linus。在典型的开发周期中,大约5-10%的补丁通过-mm 进入主线。 | ||
212 | |||
213 | 当前-mm 补丁可在“mmotm”(-mm of the moment)目录中找到,地址: | ||
214 | |||
215 | http://www.ozlabs.org/~akpm/mmotm/ | ||
216 | |||
217 | 然而,使用mmotm树可能是一种令人沮丧的体验;它甚至可能无法编译。 | ||
218 | |||
219 | 下一个周期补丁合并的主要树是linux-next,由Stephen Rothwell 维护。根据设计 | ||
220 | linux-next 是下一个合并窗口关闭后主线的快照。linux-next树在Linux-kernel 和 | ||
221 | Linux-next 邮件列表中发布,可从以下位置下载: | ||
222 | |||
223 | http://www.kernel.org/pub/linux/kernel/next/ | ||
224 | |||
225 | Linux-next 已经成为内核开发过程中不可或缺的一部分;在一个给定的合并窗口中合并 | ||
226 | 的所有补丁都应该在合并窗口打开之前的一段时间内找到进入Linux-next 的方法。 | ||
227 | |||
228 | Staging 树 | ||
229 | ---------- | ||
230 | |||
231 | 内核源代码树包含drivers/staging/directory,其中有许多驱动程序或文件系统的 | ||
232 | 子目录正在被添加到内核树中。它们然需要更多的工作的时候可以保留在 | ||
233 | driver/staging目录中;一旦完成,就可以将它们移到内核中。这是一种跟踪不符合 | ||
234 | Linux内核编码或质量标准的驱动程序的方法,但人们可能希望使用它们并跟踪开发。 | ||
235 | |||
236 | Greg Kroah Hartman 目前负责维护staging 树。仍需要工作的驱动程序将发送给他, | ||
237 | 每个驱动程序在drivers/staging/中都有自己的子目录。除了驱动程序源文件之外, | ||
238 | 目录中还应该有一个TODO文件。todo文件列出了驱动程序需要接受的挂起的工作, | ||
239 | 以及驱动程序的任何补丁都应该抄送的人员列表。当前的规则要求,staging的驱动 | ||
240 | 程序必须至少正确编译。 | ||
241 | |||
242 | Staging 是一种相对容易的方法,可以让新的驱动程序进入主线,幸运的是,他们会 | ||
243 | 引起其他开发人员的注意,并迅速改进。然而,进入staging并不是故事的结尾; | ||
244 | staging中没有看到常规进展的代码最终将被删除。经销商也倾向于相对不愿意使用 | ||
245 | staging驱动程序。因此,在成为一名合适的主线驱动的路上,staging 充其量只是 | ||
246 | 一个停留。 | ||
247 | |||
248 | 工具 | ||
249 | ---- | ||
250 | |||
251 | 从上面的文本可以看出,内核开发过程在很大程度上依赖于在不同方向上聚集补丁的 | ||
252 | 能力。如果没有适当强大的工具,整个系统将无法在任何地方正常工作。关于如何使用 | ||
253 | 这些工具的教程远远超出了本文档的范围,但是还是有一些指南的空间。 | ||
254 | |||
255 | 到目前为止,内核社区使用的主要源代码管理系统是git。Git是在自由软件社区中开发 | ||
256 | 的许多分布式版本控制系统之一。它非常适合内核开发,因为它在处理大型存储库和 | ||
257 | 大量补丁时性能非常好。它还有一个难以学习和使用的名声,尽管随着时间的推移它 | ||
258 | 变得更好了。对于内核开发人员来说,对Git的某种熟悉几乎是一种要求;即使他们不 | ||
259 | 将它用于自己的工作,他们也需要Git来跟上其他开发人员(以及主线)正在做的事情。 | ||
260 | |||
261 | 现在几乎所有的Linux发行版都打包了Git。主页位于: | ||
262 | |||
263 | http://git-scm.com/ | ||
264 | |||
265 | 那个页面有指向文档和教程的指针。 | ||
266 | |||
267 | 在不使用git的内核开发人员中,最流行的选择几乎肯定是mercurial: | ||
268 | |||
269 | http://www.seleric.com/mercurial/ | ||
270 | |||
271 | Mercurial与Git共享许多特性,但它提供了一个界面,许多人觉得它更易于使用。 | ||
272 | |||
273 | 另一个值得了解的工具是quilt: | ||
274 | |||
275 | http://savannah.nongnu.org/projects/quilt | ||
276 | |||
277 | Quilt 是一个补丁管理系统,而不是源代码管理系统。它不会随着时间的推移跟踪历史; | ||
278 | 相反,它面向根据不断发展的代码库跟踪一组特定的更改。一些主要的子系统维护人员 | ||
279 | 使用Quilt来管理打算向上游移动的补丁。对于某些树的管理(例如-mm),quilt 是 | ||
280 | 最好的工具。 | ||
281 | |||
282 | 邮件列表 | ||
283 | -------- | ||
284 | |||
285 | 大量的Linux内核开发工作是通过邮件列表完成的。如果不在某个地方加入至少一个列表, | ||
286 | 就很难成为社区中一个功能完备的成员。但是,Linux邮件列表对开发人员来说也是一个 | ||
287 | 潜在的危险,他们可能会被一堆电子邮件淹没,违反Linux列表上使用的约定,或者 | ||
288 | 两者兼而有之。 | ||
289 | |||
290 | 大多数内核邮件列表都在vger.kernel.org上运行;主列表位于: | ||
291 | |||
292 | http://vger.kernel.org/vger-lists.html | ||
293 | |||
294 | 不过,也有一些列表托管在别处;其中一些列表位于lists.redhat.com。 | ||
295 | |||
296 | 当然,内核开发的核心邮件列表是linux-kernel。这个名单是一个令人生畏的地方; | ||
297 | 每天的信息量可以达到500条,噪音很高,谈话技术性很强,参与者并不总是表现出 | ||
298 | 高度的礼貌。但是,没有其他地方可以让内核开发社区作为一个整体聚集在一起; | ||
299 | 避免使用此列表的开发人员将错过重要信息。 | ||
300 | |||
301 | 有一些提示可以帮助在linux-kernel生存: | ||
302 | |||
303 | - 将邮件转移到单独的文件夹,而不是主邮箱。我们必须能够持续地忽略洪流。 | ||
304 | |||
305 | - 不要试图跟踪每一次谈话-其他人都不会。重要的是要对感兴趣的主题(尽管请 | ||
306 | 注意,长时间的对话可以在不更改电子邮件主题行的情况下偏离原始主题)和参与 | ||
307 | 的人进行筛选。 | ||
308 | |||
309 | - 不要挑事。如果有人试图激起愤怒的反应,忽略他们。 | ||
310 | |||
311 | - 当响应Linux内核电子邮件(或其他列表上的电子邮件)时,请为所有相关人员保留 | ||
312 | cc:header。如果没有强有力的理由(如明确的请求),则不应删除收件人。一定要 | ||
313 | 确保你要回复的人在cc:list中。这个惯例也使你不必在回复邮件时明确要求被抄送。 | ||
314 | |||
315 | - 在提出问题之前,搜索列表档案(和整个网络)。有些开发人员可能会对那些显然 | ||
316 | 没有完成家庭作业的人感到不耐烦。 | ||
317 | |||
318 | - 避免贴顶帖(把你的答案放在你要回复的引文上面的做法)。这会让你的回答更难 | ||
319 | 理解,印象也很差。 | ||
320 | |||
321 | - 询问正确的邮件列表。linux-kernel 可能是通用的讨论点,但它不是从所有子系统 | ||
322 | 中寻找开发人员的最佳场所。 | ||
323 | |||
324 | 最后一点——找到正确的邮件列表——是开发人员出错的常见地方。在Linux内核上提出与 | ||
325 | 网络相关的问题的人几乎肯定会收到一个礼貌的建议,转而在netdev列表上提出, | ||
326 | 因为这是大多数网络开发人员经常出现的列表。还有其他列表可用于scsi、 | ||
327 | video4linux、ide、filesystem等子系统。查找邮件列表的最佳位置是与内核源代码 | ||
328 | 一起打包的MAINTAINERS文件。 | ||
329 | |||
330 | 开始内核开发 | ||
331 | ------------ | ||
332 | |||
333 | 关于如何开始内核开发过程的问题很常见——来自个人和公司。同样常见的是错误,这 | ||
334 | 使得关系的开始比必须的更困难。 | ||
335 | |||
336 | 公司通常希望聘请知名的开发人员来启动开发团队。实际上,这是一种有效的技术。 | ||
337 | 但它也往往是昂贵的,而且没有增长经验丰富的内核开发人员储备。考虑到时间的 | ||
338 | 投入,可以让内部开发人员加快Linux内核的开发速度。花这个时间可以让雇主拥有 | ||
339 | 一批了解内核和公司的开发人员,他们也可以帮助培训其他人。从中期来看,这往往 | ||
340 | 是更有利可图的方法。 | ||
341 | |||
342 | 可以理解的是,单个开发人员往往对起步感到茫然。从一个大型项目开始可能会很 | ||
343 | 吓人;人们往往想先用一些较小的东西来测试水域。这是一些开发人员开始创建修补 | ||
344 | 拼写错误或轻微编码风格问题的补丁的地方。不幸的是,这样的补丁会产生一定程度 | ||
345 | 的噪音,这会分散整个开发社区的注意力,因此,越来越多的人看不起它们。希望向 | ||
346 | 社区介绍自己的新开发人员将无法通过这些方式获得他们想要的那种接待。 | ||
347 | |||
348 | Andrew Morton 为有抱负的内核开发人员提供了这个建议 | ||
349 | |||
350 | :: | ||
351 | |||
352 | 所有内核初学者的No.1项目肯定是“确保内核在所有的机器上,你可以触摸 | ||
353 | 到的,始终运行良好" 通常这样做的方法是与其他人一起解决问题(这 | ||
354 | 可能需要坚持!)但这很好——这是内核开发的一部分 | ||
355 | |||
356 | (http://lwn.net/articles/283982/) | ||
357 | |||
358 | 在没有明显问题需要解决的情况下,建议开发人员查看当前的回归和开放式错误列表. | ||
359 | 解决需要修复的问题没有任何缺点;通过解决这些问题,开发人员将获得处理过程的 | ||
360 | 经验,同时与开发社区的其他人建立尊重。 | ||
diff --git a/Documentation/translations/zh_CN/process/3.Early-stage.rst b/Documentation/translations/zh_CN/process/3.Early-stage.rst new file mode 100644 index 000000000000..b8676aec6005 --- /dev/null +++ b/Documentation/translations/zh_CN/process/3.Early-stage.rst | |||
@@ -0,0 +1,161 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/3.Early-stage.rst <development_early_stage>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_development_early_stage: | ||
7 | |||
8 | 早期规划 | ||
9 | ======== | ||
10 | |||
11 | 当考虑一个Linux内核开发项目时,很可能会直接跳进去开始编码。然而,与任何重要 | ||
12 | 的项目一样,成功的许多基础最好是在第一行代码编写之前就做好了。在早期计划和 | ||
13 | 沟通中花费一些时间可以节省更多的时间。 | ||
14 | |||
15 | 详述问题 | ||
16 | -------- | ||
17 | |||
18 | 与任何工程项目一样,成功的内核增强从要解决的问题的清晰描述开始。在某些情况 | ||
19 | 下,这个步骤很容易:例如,当某个特定硬件需要驱动程序时。不过,在其他方面, | ||
20 | 将实际问题与建议的解决方案混淆是很有诱惑力的,这可能会导致困难。 | ||
21 | |||
22 | 举个例子:几年前,使用Linux音频的开发人员寻求一种方法来运行应用程序,而不因 | ||
23 | 系统延迟过大而导致退出或其他工件。他们得到的解决方案是一个内核模块,旨在连 | ||
24 | 接到Linux安全模块(LSM)框架中;这个模块可以配置为允许特定的应用程序访问 | ||
25 | 实时调度程序。这个模块被实现并发送到Linux内核邮件列表,在那里它立即遇到问题。 | ||
26 | |||
27 | 对于音频开发人员来说,这个安全模块足以解决他们当前的问题。但是,对于更广泛的 | ||
28 | 内核社区来说,这被视为对LSM框架的滥用(LSM框架并不打算授予他们原本不具备的 | ||
29 | 进程特权),并对系统稳定性造成风险。他们首选的解决方案包括短期的通过rlimit | ||
30 | 机制进行实时调度访问,以及长期的减少延迟的工作。 | ||
31 | |||
32 | 然而,音频社区看不到他们实施的特定解决方案的过去;他们不愿意接受替代方案。 | ||
33 | 由此产生的分歧使这些开发人员对整个内核开发过程感到失望;其中一个开发人员返回 | ||
34 | 到音频列表并发布了以下内容: | ||
35 | |||
36 | 有很多非常好的Linux内核开发人员,但他们往往会被一群傲慢的傻瓜所压倒。 | ||
37 | 试图向这些人传达用户需求是浪费时间。他们太“聪明”了,根本听不到少数人 | ||
38 | 的话。 | ||
39 | |||
40 | (http://lwn.net/articles/131776/) | ||
41 | |||
42 | 实际情况不同;与特定模块相比,内核开发人员更关心系统稳定性、长期维护以及找到 | ||
43 | 正确的问题解决方案。这个故事的寓意是把重点放在问题上——而不是具体的解决方案 | ||
44 | 上——并在投入创建代码之前与开发社区讨论这个问题。 | ||
45 | |||
46 | 因此,在考虑一个内核开发项目时,我们应该得到一组简短问题的答案: | ||
47 | |||
48 | - 究竟需要解决的问题是什么? | ||
49 | |||
50 | - 受此问题影响的用户是谁?解决方案应该解决哪些用例? | ||
51 | |||
52 | - 内核现在为何没能解决这个问题? | ||
53 | |||
54 | 只有这样,才能开始考虑可能的解决方案。 | ||
55 | |||
56 | |||
57 | 早期讨论 | ||
58 | -------- | ||
59 | |||
60 | 在计划内核开发项目时,在开始实施之前与社区进行讨论是很有意义的。早期沟通可以 | ||
61 | 通过多种方式节省时间和麻烦: | ||
62 | |||
63 | - 很可能问题是由内核以您不理解的方式解决的。Linux内核很大,具有许多不明显 | ||
64 | 的特性和功能。并不是所有的内核功能都像人们所希望的那样有文档记录,而且很 | ||
65 | 容易遗漏一些东西。你的作者发出了一个完整的驱动程序,复制了一个新作者不 | ||
66 | 知道的现有驱动程序。重新设计现有轮子的代码不仅浪费,而且不会被接受到主线 | ||
67 | 内核中。 | ||
68 | |||
69 | - 建议的解决方案中可能有一些元素不适用于主线合并。在编写代码之前,最好先 | ||
70 | 了解这样的问题。 | ||
71 | |||
72 | - 其他开发人员完全有可能考虑过这个问题;他们可能有更好的解决方案的想法,并且 | ||
73 | 可能愿意帮助创建这个解决方案。 | ||
74 | |||
75 | 在内核开发社区的多年经验给了我们一个明确的教训:闭门设计和开发的内核代码总是 | ||
76 | 有一些问题,这些问题只有在代码发布到社区中时才会被发现。有时这些问题很严重, | ||
77 | 需要数月或数年的努力才能使代码达到内核社区的标准。一些例子包括: | ||
78 | |||
79 | - 设计并实现了单处理器系统的DeviceScape网络栈。只有使其适合于多处理器系统, | ||
80 | 才能将其合并到主线中。在代码中改装锁等等是一项困难的任务;因此,这段代码 | ||
81 | (现在称为mac80211)的合并被推迟了一年多。 | ||
82 | |||
83 | - Reiser4文件系统包含许多功能,核心内核开发人员认为这些功能应该在虚拟文件 | ||
84 | 系统层中实现。它还包括一些特性,这些特性在不将系统暴露于用户引起的死锁的 | ||
85 | 情况下是不容易实现的。这些问题的最新发现——以及对其中一些问题的拒绝——已经 | ||
86 | 导致Reiser4远离了主线内核。 | ||
87 | |||
88 | - Apparmor安全模块以被认为不安全和不可靠的方式使用内部虚拟文件系统数据结构。 | ||
89 | 这种担心(包括其他)使Apparmor多年不在主线上。 | ||
90 | |||
91 | 在每一种情况下,通过与内核开发人员的早期讨论,可以避免大量的痛苦和额外的工作。 | ||
92 | |||
93 | 找谁交流 | ||
94 | -------- | ||
95 | |||
96 | 当开发人员决定公开他们的计划时,下一个问题是:我们从哪里开始?答案是找到正确 | ||
97 | 的邮件列表和正确的维护者。对于邮件列表,最好的方法是在维护者(MAINTAINERS)文件 | ||
98 | 中查找要发布的相关位置。如果有一个合适的子系统列表,那么发布它通常比在Linux | ||
99 | 内核上发布更可取;您更有可能接触到在相关子系统中具有专业知识的开发人员,并且 | ||
100 | 环境可能具支持性。 | ||
101 | |||
102 | 找到维护人员可能会有点困难。同样,维护者文件是开始的地方。但是,该文件往往不总 | ||
103 | 是最新的,并且并非所有子系统都在那里表示。实际上,维护者文件中列出的人员可能 | ||
104 | 不是当前实际担任该角色的人员。因此,当对联系谁有疑问时,一个有用的技巧是使用 | ||
105 | git(尤其是“git-log”)查看感兴趣的子系统中当前活动的用户。看看谁在写补丁, | ||
106 | 如果有人的话,谁会在这些补丁上加上用线签名的。这些人将是帮助新开发项目的最佳 | ||
107 | 人选。 | ||
108 | |||
109 | 找到合适的维护者的任务有时是非常具有挑战性的,以至于内核开发人员添加了一个 | ||
110 | 脚本来简化过程: | ||
111 | |||
112 | :: | ||
113 | |||
114 | .../scripts/get_maintainer.pl | ||
115 | |||
116 | 当给定“-f”选项时,此脚本将返回给定文件或目录的当前维护者。如果在命令行上传递 | ||
117 | 了一个补丁,它将列出可能接收补丁副本的维护人员。有许多选项可以调节 | ||
118 | get_maintainer.pl搜索维护者的难易程度;请小心使用更具攻击性的选项,因为最终 | ||
119 | 可能会包括对您正在修改的代码没有真正兴趣的开发人员。 | ||
120 | |||
121 | 如果所有其他方法都失败了,那么与Andrew Morton交谈可以成为一种有效的方法来跟踪 | ||
122 | 特定代码段的维护人员。 | ||
123 | |||
124 | 何时邮寄? | ||
125 | ---------- | ||
126 | |||
127 | 如果可能的话,在早期阶段发布你的计划只会有帮助。描述正在解决的问题以及已经 | ||
128 | 制定的关于如何实施的任何计划。您可以提供的任何信息都可以帮助开发社区为项目 | ||
129 | 提供有用的输入。 | ||
130 | |||
131 | 在这个阶段可能发生的一件令人沮丧的事情不是敌对的反应,而是很少或根本没有 | ||
132 | 反应。可悲的事实是:(1)内核开发人员往往很忙;(2)不缺少有宏伟计划和很少 | ||
133 | 代码(甚至代码前景)支持他们的人;(3)没有人有义务审查或评论别人发表的 | ||
134 | 想法。除此之外,高级设计常常隐藏一些问题,这些问题只有在有人真正尝试实现 | ||
135 | 这些设计时才会被发现;因此,内核开发人员宁愿看到代码。 | ||
136 | |||
137 | 如果发表评论的请求在评论的方式上没有什么效果,不要假设这意味着对项目没有 | ||
138 | 兴趣。不幸的是,你也不能假设你的想法没有问题。在这种情况下,最好的做法是 | ||
139 | 继续进行,把你的进展随时通知社区。 | ||
140 | |||
141 | 获得官方认可 | ||
142 | ----------------------- | ||
143 | |||
144 | 如果您的工作是在公司环境中完成的,就像大多数Linux内核工作一样,显然,在您将 | ||
145 | 公司的计划或代码发布到公共邮件列表之前,必须获得适当授权的经理的许可。发布 | ||
146 | 不确定是否兼容GPL的代码可能是有特别问题的;公司的管理层和法律人员越早能够就 | ||
147 | 发布内核开发项目达成一致,对参与的每个人都越好。 | ||
148 | |||
149 | 一些读者可能会认为他们的核心工作是为了支持还没有正式承认存在的产品。将雇主 | ||
150 | 的计划公布在公共邮件列表上可能不是一个可行的选择。在这种情况下,有必要考虑 | ||
151 | 保密是否真的是必要的;通常不需要把开发计划关在门内。 | ||
152 | |||
153 | 也就是说,有些情况下,一家公司在开发过程的早期就不能合法地披露其计划。拥有 | ||
154 | 经验丰富的内核开发人员的公司可以选择以开环的方式进行,前提是他们以后能够避免 | ||
155 | 严重的集成问题。对于没有这种内部专业知识的公司,最好的选择往往是聘请外部 | ||
156 | 开发商根据保密协议审查计划。Linux基金会运行了一个NDA程序,旨在帮助解决这种 | ||
157 | 情况; | ||
158 | |||
159 | http://www.linuxfoundation.org/en/NDA_program | ||
160 | |||
161 | 这种审查通常足以避免以后出现严重问题,而无需公开披露项目。 | ||
diff --git a/Documentation/translations/zh_CN/process/4.Coding.rst b/Documentation/translations/zh_CN/process/4.Coding.rst new file mode 100644 index 000000000000..5301e9d55255 --- /dev/null +++ b/Documentation/translations/zh_CN/process/4.Coding.rst | |||
@@ -0,0 +1,290 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/4.Coding.rst <development_coding>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_development_coding: | ||
7 | |||
8 | 使代码正确 | ||
9 | ====================== | ||
10 | |||
11 | 虽然对于一个坚实的、面向社区的设计过程有很多话要说,但是任何内核开发项目的 | ||
12 | 证明都在生成的代码中。它是将由其他开发人员检查并合并(或不合并)到主线树中 | ||
13 | 的代码。所以这段代码的质量决定了项目的最终成功。 | ||
14 | |||
15 | 本节将检查编码过程。我们将从内核开发人员出错的几种方式开始。然后重点将转移 | ||
16 | 到正确的事情和可以帮助这个任务的工具上。 | ||
17 | |||
18 | 陷阱 | ||
19 | ---- | ||
20 | |||
21 | 编码风格 | ||
22 | ******** | ||
23 | |||
24 | 内核长期以来都有一种标准的编码风格,如 | ||
25 | :ref:`Documentation/translations/zh_CN/process/coding-style.rst <cn_codingstyle>` | ||
26 | 中所述。在大部分时间里,该文件中描述的政策被认为至多是建议性的。因此,内核 | ||
27 | 中存在大量不符合编码风格准则的代码。代码的存在会给内核开发人员带来两个独立 | ||
28 | 的危害。 | ||
29 | |||
30 | 首先,要相信内核编码标准并不重要,也不强制执行。事实上,如果没有按照标准对代 | ||
31 | 码进行编码,那么向内核添加新代码是非常困难的;许多开发人员甚至会在审查代码之 | ||
32 | 前要求对代码进行重新格式化。一个与内核一样大的代码库需要一些统一的代码,以使 | ||
33 | 开发人员能够快速理解其中的任何部分。所以已经没有空间来存放奇怪的格式化代码了。 | ||
34 | |||
35 | 偶尔,内核的编码风格会与雇主的强制风格发生冲突。在这种情况下,内核的风格必须 | ||
36 | 在代码合并之前获胜。将代码放入内核意味着以多种方式放弃一定程度的控制权——包括 | ||
37 | 控制代码的格式化方式。 | ||
38 | |||
39 | 另一个陷阱是假定已经在内核中的代码迫切需要编码样式的修复。开发人员可能会开始 | ||
40 | 生成重新格式化补丁,作为熟悉过程的一种方式,或者作为将其名称写入内核变更日志 | ||
41 | 的一种方式,或者两者兼而有之。但是纯编码风格的修复被开发社区视为噪音;它们往 | ||
42 | 往受到冷遇。因此,最好避免使用这种类型的补丁。由于其他原因,在处理一段代码的 | ||
43 | 同时修复它的样式是很自然的,但是编码样式的更改不应该仅为了更改而进行。 | ||
44 | |||
45 | 编码风格的文档也不应该被视为绝对的法律,这是永远不会被违反的。如果有一个很好 | ||
46 | 的理由反对这种样式(例如,如果拆分为适合80列限制的行,那么它的可读性就会大大 | ||
47 | 降低),那么就这样做。 | ||
48 | |||
49 | 请注意,您还可以使用 ``clang-format`` 工具来帮助您处理这些规则,自动重新格式 | ||
50 | 化部分代码,并查看完整的文件,以发现编码样式错误、拼写错误和可能的改进。它还 | ||
51 | 可以方便地进行排序,包括对齐变量/宏、回流文本和其他类似任务。有关详细信息,请 | ||
52 | 参阅文件 :ref:`Documentation/process/clang-format.rst <clangformat>` | ||
53 | |||
54 | 抽象层 | ||
55 | ****** | ||
56 | |||
57 | 计算机科学教授教学生以灵活性和信息隐藏的名义广泛使用抽象层。当然,内核广泛 | ||
58 | 地使用了抽象;任何涉及数百万行代码的项目都不能做到这一点并存活下来。但经验 | ||
59 | 表明,过度或过早的抽象可能和过早的优化一样有害。抽象应用于所需的级别, | ||
60 | 不要过度。 | ||
61 | |||
62 | 在一个简单的级别上,考虑一个函数的参数,该参数总是由所有调用方作为零传递。 | ||
63 | 我们可以保留这个论点: 以防有人最终需要使用它提供的额外灵活性。不过,到那时, | ||
64 | 实现这个额外参数的代码很有可能以某种从未被注意到的微妙方式被破坏——因为它从 | ||
65 | 未被使用过。或者,当需要额外的灵活性时,它不会以符合程序员早期期望的方式来 | ||
66 | 这样做。内核开发人员通常会提交补丁来删除未使用的参数;一般来说,首先不应该 | ||
67 | 添加这些参数。 | ||
68 | |||
69 | 隐藏硬件访问的抽象层——通常允许大量的驱动程序在多个操作系统中使用——尤其不受 | ||
70 | 欢迎。这样的层使代码变得模糊,可能会造成性能损失;它们不属于Linux内核。 | ||
71 | |||
72 | 另一方面,如果您发现自己从另一个内核子系统复制了大量的代码,那么现在是时候 | ||
73 | 问一下,事实上,将这些代码中的一些提取到单独的库中,或者在更高的层次上实现 | ||
74 | 这些功能是否有意义。在整个内核中复制相同的代码没有价值。 | ||
75 | |||
76 | #ifdef 和预处理 | ||
77 | *************** | ||
78 | |||
79 | C预处理器似乎给一些C程序员带来了强大的诱惑,他们认为它是一种有效地将大量灵 | ||
80 | 活性编码到源文件中的方法。但是预处理器不是C,大量使用它会导致代码对其他人来 | ||
81 | 说更难读取,对编译器来说更难检查正确性。大量的预处理器几乎总是代码需要一些 | ||
82 | 清理工作的标志。 | ||
83 | |||
84 | 使用ifdef的条件编译实际上是一个强大的功能,它在内核中使用。但是很少有人希望 | ||
85 | 看到代码被大量地撒上ifdef块。作为一般规则,ifdef的使用应尽可能限制在头文件 | ||
86 | 中。有条件编译的代码可以限制函数,如果代码不存在,这些函数就会变成空的。然后 | ||
87 | 编译器将悄悄地优化对空函数的调用。结果是代码更加清晰,更容易理解。 | ||
88 | |||
89 | C预处理器宏存在许多危险,包括可能对具有副作用且没有类型安全性的表达式进行多 | ||
90 | 重评估。如果您试图定义宏,请考虑创建一个内联函数。结果相同的代码,但是内联 | ||
91 | 函数更容易读取,不会多次计算其参数,并且允许编译器对参数和返回值执行类型检查。 | ||
92 | |||
93 | 内联函数 | ||
94 | ******** | ||
95 | |||
96 | 不过,内联函数本身也存在风险。程序员可以倾心于避免函数调用和用内联函数填充源 | ||
97 | 文件所固有的效率。然而,这些功能实际上会降低性能。因为它们的代码在每个调用站 | ||
98 | 点都被复制,所以它们最终会增加编译内核的大小。反过来,这会对处理器的内存缓存 | ||
99 | 造成压力,从而大大降低执行速度。通常,内联函数应该非常小,而且相对较少。毕竟, | ||
100 | 函数调用的成本并不高;大量内联函数的创建是过早优化的典型例子。 | ||
101 | |||
102 | 一般来说,内核程序员会忽略缓存效果,这会带来危险。在开始的数据结构课程中,经 | ||
103 | 典的时间/空间权衡通常不适用于当代硬件。空间就是时间,因为一个大的程序比一个 | ||
104 | 更紧凑的程序运行得慢。 | ||
105 | |||
106 | 最近的编译器在决定一个给定函数是否应该被内联方面扮演着越来越积极的角色。 | ||
107 | 因此,“inline”关键字的自由放置可能不仅仅是过度的,它也可能是无关的。 | ||
108 | |||
109 | 锁 | ||
110 | ** | ||
111 | |||
112 | 2006年5月,“deviceescape”网络堆栈在GPL下发布,并被纳入主线内核。这是一个受 | ||
113 | 欢迎的消息;对Linux中无线网络的支持充其量被认为是不合格的,而deviceescape | ||
114 | 堆栈提供了修复这种情况的承诺。然而,直到2007年6月(2.6.22),这段代码才真 | ||
115 | 正进入主线。发生了什么? | ||
116 | |||
117 | 这段代码显示了许多闭门造车的迹象。但一个特别大的问题是,它并不是设计用于多 | ||
118 | 处理器系统。在合并这个网络堆栈(现在称为mac80211)之前,需要对其进行一个锁 | ||
119 | 方案的改造。 | ||
120 | |||
121 | 曾经,Linux内核代码可以在不考虑多处理器系统所带来的并发性问题的情况下进行 | ||
122 | 开发。然而,现在,这个文件是写在双核笔记本电脑上的。即使在单处理器系统上, | ||
123 | 为提高响应能力所做的工作也会提高内核内的并发性水平。编写内核代码而不考虑锁 | ||
124 | 的日子已经过去很长了。 | ||
125 | |||
126 | 可以由多个线程并发访问的任何资源(数据结构、硬件寄存器等)必须由锁保护。新 | ||
127 | 的代码应该记住这一要求;事后改装锁是一项相当困难的任务。内核开发人员应该花 | ||
128 | 时间充分了解可用的锁原语,以便为作业选择正确的工具。显示对并发性缺乏关注的 | ||
129 | 代码进入主线将很困难。 | ||
130 | |||
131 | 回归 | ||
132 | **** | ||
133 | |||
134 | 最后一个值得一提的危险是:它可能会引起改变(这可能会带来很大的改进),从而 | ||
135 | 导致现有用户的某些东西中断。这种变化被称为“回归”,回归已经成为主线内核最不 | ||
136 | 受欢迎的。除少数例外情况外,如果回归不能及时修正,会导致回归的变化将被取消。 | ||
137 | 最好首先避免回归。 | ||
138 | |||
139 | 人们常常争论,如果回归让更多人可以工作,远超过产生问题,那么回归是合理的。 | ||
140 | 如果它破坏的一个系统却为十个系统带来新的功能,为什么不进行更改呢?2007年7月, | ||
141 | Linus对这个问题给出了最佳答案: | ||
142 | |||
143 | :: | ||
144 | 所以我们不会通过引入新问题来修复错误。那样的谎言很疯狂,没有人知道 | ||
145 | 你是否真的有进展。是前进两步,后退一步,还是向前一步,向后两步? | ||
146 | |||
147 | (http://lwn.net/articles/243460/) | ||
148 | |||
149 | 一种特别不受欢迎的回归类型是用户空间ABI的任何变化。一旦接口被导出到用户空间, | ||
150 | 就必须无限期地支持它。这一事实使得用户空间接口的创建特别具有挑战性:因为它们 | ||
151 | 不能以不兼容的方式进行更改,所以必须第一次正确地进行更改。因此,用户空间界面 | ||
152 | 总是需要大量的思考、清晰的文档和广泛的审查。 | ||
153 | |||
154 | |||
155 | 代码检查工具 | ||
156 | ------------ | ||
157 | |||
158 | 至少目前,编写无错误代码仍然是我们中很少人能达到的理想状态。不过,我们希望做 | ||
159 | 的是,在代码进入主线内核之前,尽可能多地捕获并修复这些错误。为此,内核开发人 | ||
160 | 员已经组装了一系列令人印象深刻的工具,可以自动捕获各种各样的模糊问题。计算机 | ||
161 | 发现的任何问题都是一个以后不会困扰用户的问题,因此,只要有可能,就应该使用 | ||
162 | 自动化工具。 | ||
163 | |||
164 | 第一步只是注意编译器产生的警告。当代版本的GCC可以检测(并警告)大量潜在错误。 | ||
165 | 通常,这些警告都指向真正的问题。提交以供审阅的代码通常不会产生任何编译器警告。 | ||
166 | 在消除警告时,注意了解真正的原因,并尽量避免“修复”,使警告消失而不解决其原因。 | ||
167 | |||
168 | 请注意,并非所有编译器警告都默认启用。使用“make EXTRA_CFLAGS=-W”构建内核以 | ||
169 | 获得完整集合。 | ||
170 | |||
171 | 内核提供了几个配置选项,可以打开调试功能;大多数配置选项位于“kernel hacking” | ||
172 | 子菜单中。对于任何用于开发或测试目的的内核,都应该启用其中几个选项。特别是, | ||
173 | 您应该打开: | ||
174 | |||
175 | - 启用 ENABLE_MUST_CHECK and FRAME_WARN 以获得一组额外的警告,以解决使用不 | ||
176 | 推荐使用的接口或忽略函数的重要返回值等问题。这些警告生成的输出可能是冗长 | ||
177 | 的,但您不必担心来自内核其他部分的警告。 | ||
178 | |||
179 | - DEBUG_OBJECTS 将添加代码,以跟踪内核创建的各种对象的生存期,并在出现问题时 | ||
180 | 发出警告。如果要添加创建(和导出)自己的复杂对象的子系统,请考虑添加对对象 | ||
181 | 调试基础结构的支持。 | ||
182 | |||
183 | - DEBUG_SLAB 可以发现各种内存分配和使用错误;它应该用于大多数开发内核。 | ||
184 | |||
185 | - DEBUG_SPINLOCK, DEBUG_ATOMIC_SLEEP and DEBUG_MUTEXES 会发现许多常见的 | ||
186 | 锁定错误. | ||
187 | |||
188 | 还有很多其他调试选项,其中一些将在下面讨论。其中一些具有显著的性能影响,不应 | ||
189 | 一直使用。但是,在学习可用选项上花费的一些时间可能会在短期内得到多次回报。 | ||
190 | |||
191 | 其中一个较重的调试工具是锁定检查器或“lockdep”。该工具将跟踪系统中每个锁 | ||
192 | (spinlock或mutex)的获取和释放、获取锁的相对顺序、当前中断环境等等。然后, | ||
193 | 它可以确保总是以相同的顺序获取锁,相同的中断假设适用于所有情况,等等。换句话 | ||
194 | 说,lockdep可以找到许多场景,在这些场景中,系统很少会死锁。在部署的系统中, | ||
195 | 这种问题可能会很痛苦(对于开发人员和用户而言);LockDep允许提前以自动方式 | ||
196 | 发现问题。具有任何类型的非普通锁定的代码在提交包含前应在启用lockdep的情况 | ||
197 | 下运行。 | ||
198 | |||
199 | 作为一个勤奋的内核程序员,毫无疑问,您将检查任何可能失败的操作(如内存分配) | ||
200 | 的返回状态。然而,事实上,最终的故障恢复路径可能完全没有经过测试。未测试的 | ||
201 | 代码往往会被破坏;如果所有这些错误处理路径都被执行了几次,那么您可能对代码 | ||
202 | 更有信心。 | ||
203 | |||
204 | 内核提供了一个可以做到这一点的错误注入框架,特别是在涉及内存分配的情况下。 | ||
205 | 启用故障注入后,内存分配的可配置百分比将失败;这些失败可以限制在特定的代码 | ||
206 | 范围内。在启用了故障注入的情况下运行,程序员可以看到当情况恶化时代码如何响 | ||
207 | 应。有关如何使用此工具的详细信息,请参阅 | ||
208 | Documentation/fault-injection/fault-injection.txt。 | ||
209 | |||
210 | 使用“sparse”静态分析工具可以发现其他类型的错误。对于sparse,可以警告程序员 | ||
211 | 用户空间和内核空间地址之间的混淆、big endian和small endian数量的混合、在需 | ||
212 | 要一组位标志的地方传递整数值等等。sparse必须单独安装(如果您的分发服务器没 | ||
213 | 有将其打包,可以在 https://sparse.wiki.kernel.org/index.php/Main_page)找到, | ||
214 | 然后可以通过在make命令中添加“C=1”在代码上运行它。 | ||
215 | |||
216 | “Coccinelle”工具 :ref:`http://coccinelle.lip6.fr/ <devtools_coccinelle>` | ||
217 | 能够发现各种潜在的编码问题;它还可以为这些问题提出修复方案。在 | ||
218 | scripts/coccinelle目录下已经打包了相当多的内核“语义补丁”;运行 | ||
219 | “make coccicheck”将运行这些语义补丁并报告发现的任何问题。有关详细信息,请参阅 | ||
220 | :ref:`Documentation/dev-tools/coccinelle.rst <devtools_coccinelle>` | ||
221 | |||
222 | |||
223 | 其他类型的可移植性错误最好通过为其他体系结构编译代码来发现。如果没有S/390系统 | ||
224 | 或Blackfin开发板,您仍然可以执行编译步骤。可以在以下位置找到一组用于x86系统的 | ||
225 | 大型交叉编译器: | ||
226 | |||
227 | http://www.kernel.org/pub/tools/crosstool/ | ||
228 | |||
229 | 花一些时间安装和使用这些编译器将有助于避免以后的尴尬。 | ||
230 | |||
231 | 文档 | ||
232 | ---- | ||
233 | |||
234 | 文档通常比内核开发规则更为例外。即便如此,足够的文档将有助于简化将新代码合并 | ||
235 | 到内核中的过程,使其他开发人员的生活更轻松,并对您的用户有所帮助。在许多情况 | ||
236 | 下,文件的添加已基本上成为强制性的。 | ||
237 | |||
238 | 任何补丁的第一个文档是其关联的变更日志。日志条目应该描述正在解决的问题、解决 | ||
239 | 方案的形式、处理补丁的人员、对性能的任何相关影响,以及理解补丁可能需要的任何 | ||
240 | 其他内容。确保changelog说明了为什么补丁值得应用;大量开发人员未能提供这些信息。 | ||
241 | |||
242 | 任何添加新用户空间界面的代码(包括新的sysfs或/proc文件)都应该包含该界面的 | ||
243 | 文档,该文档使用户空间开发人员能够知道他们在使用什么。请参阅 | ||
244 | Documentation/abi/readme,了解如何格式化此文档以及需要提供哪些信息。 | ||
245 | |||
246 | 文件 :ref:`Documentation/admin-guide/kernel-parameters.rst <kernelparameters>` | ||
247 | 描述了内核的所有引导时间参数。任何添加新参数的补丁都应该向该文件添加适当的 | ||
248 | 条目。 | ||
249 | |||
250 | 任何新的配置选项都必须附有帮助文本,帮助文本清楚地解释了这些选项以及用户可能 | ||
251 | 希望何时选择它们。 | ||
252 | |||
253 | 许多子系统的内部API信息通过专门格式化的注释进行记录;这些注释可以通过 | ||
254 | “kernel-doc”脚本以多种方式提取和格式化。如果您在具有kerneldoc注释的子系统中 | ||
255 | 工作,则应该维护它们,并根据需要为外部可用的功能添加它们。即使在没有如此记录 | ||
256 | 的领域中,为将来添加kerneldoc注释也没有坏处;实际上,这对于刚开始开发内核的人 | ||
257 | 来说是一个有用的活动。这些注释的格式以及如何创建kerneldoc模板的一些信息可以在 | ||
258 | :ref:`Documentation/doc-guide/ <doc_guide>` 上找到。 | ||
259 | |||
260 | 任何阅读大量现有内核代码的人都会注意到,注释的缺失往往是最值得注意的。再一次, | ||
261 | 对新代码的期望比过去更高;合并未注释的代码将更加困难。这就是说,人们几乎不希望 | ||
262 | 用语言注释代码。代码本身应该是可读的,注释解释了更微妙的方面。 | ||
263 | |||
264 | 某些事情应该总是被注释。使用内存屏障时,应附上一行文字,解释为什么需要设置内存 | ||
265 | 屏障。数据结构的锁定规则通常需要在某个地方解释。一般来说,主要数据结构需要全面 | ||
266 | 的文档。应该指出单独代码位之间不明显的依赖性。任何可能诱使代码看门人进行错误的 | ||
267 | “清理”的事情都需要一个注释来说明为什么要这样做。等等。 | ||
268 | |||
269 | |||
270 | 内部API更改 | ||
271 | ----------- | ||
272 | |||
273 | 内核提供给用户空间的二进制接口不能被破坏,除非在最严重的情况下。相反,内核的 | ||
274 | 内部编程接口是高度流动的,当需要时可以更改。如果你发现自己不得不处理一个内核 | ||
275 | API,或者仅仅因为它不满足你的需求而不使用特定的功能,这可能是API需要改变的一 | ||
276 | 个标志。作为内核开发人员,您有权进行此类更改。 | ||
277 | |||
278 | 当然, 可以进行API更改,但它们必须是合理的。因此,任何进行内部API更改的补丁都 | ||
279 | 应该附带一个关于更改内容和必要原因的描述。这种变化也应该分解成一个单独的补丁, | ||
280 | 而不是埋在一个更大的补丁中。 | ||
281 | |||
282 | 另一个要点是,更改内部API的开发人员通常要负责修复内核树中被更改破坏的任何代码。 | ||
283 | 对于一个广泛使用的函数,这个职责可以导致成百上千的变化,其中许多变化可能与其他 | ||
284 | 开发人员正在做的工作相冲突。不用说,这可能是一项大工作,所以最好确保理由是 | ||
285 | 可靠的。请注意,coccinelle工具可以帮助进行广泛的API更改。 | ||
286 | |||
287 | 在进行不兼容的API更改时,应尽可能确保编译器捕获未更新的代码。这将帮助您确保找 | ||
288 | 到该接口的树内用处。它还将警告开发人员树外代码存在他们需要响应的更改。支持树外 | ||
289 | 代码不是内核开发人员需要担心的事情,但是我们也不必使树外开发人员的生活有不必要 | ||
290 | 的困难。 | ||
diff --git a/Documentation/translations/zh_CN/process/5.Posting.rst b/Documentation/translations/zh_CN/process/5.Posting.rst new file mode 100644 index 000000000000..41aba21ff050 --- /dev/null +++ b/Documentation/translations/zh_CN/process/5.Posting.rst | |||
@@ -0,0 +1,240 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/5.Posting.rst <development_posting>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_development_posting: | ||
7 | |||
8 | 发送补丁 | ||
9 | ======== | ||
10 | |||
11 | 迟早,当您的工作准备好提交给社区进行审查,并最终包含到主线内核中时。不出所料, | ||
12 | 内核开发社区已经发展出一套用于发布补丁的约定和过程;遵循这些约定和过程将使 | ||
13 | 参与其中的每个人的生活更加轻松。本文件将试图合理详细地涵盖这些期望;更多信息 | ||
14 | 也可在以下文件中找到 | ||
15 | :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>`, | ||
16 | :ref:`Documentation/process/submitting-drivers.rst <submittingdrivers>` | ||
17 | 和 :ref:`Documentation/translations/zh_CN/process/submit-checklist.rst <cn_submitchecklist>`. | ||
18 | |||
19 | 何时邮寄 | ||
20 | -------- | ||
21 | |||
22 | 在补丁完全“准备好”之前,有一个不断的诱惑来避免发布补丁。对于简单的补丁, | ||
23 | 这不是问题。但是,如果正在完成的工作很复杂,那么在工作完成之前从社区获得 | ||
24 | 反馈就可以获得很多好处。因此,您应该考虑发布正在进行的工作,甚至使Git树 | ||
25 | 可用,以便感兴趣的开发人员可以随时赶上您的工作。 | ||
26 | |||
27 | 当发布还没有准备好包含的代码时,最好在发布本身中这样说。还应提及任何有待完成 | ||
28 | 的主要工作和任何已知问题。很少有人会看到那些被认为是半生不熟的补丁,但是那些 | ||
29 | 人会想到他们可以帮助你把工作推向正确的方向。 | ||
30 | |||
31 | 创建补丁之前 | ||
32 | ------------ | ||
33 | |||
34 | 在考虑将补丁发送到开发社区之前,有许多事情应该做。这些包括: | ||
35 | |||
36 | - 尽可能地测试代码。利用内核的调试工具,确保内核使用所有合理的配置选项组合 | ||
37 | 进行构建,使用跨编译器为不同的体系结构进行构建等。 | ||
38 | |||
39 | - 确保您的代码符合内核编码风格指南。 | ||
40 | |||
41 | - 您的更改是否具有性能影响?如果是这样,您应该运行基准测试来显示您的变更的 | ||
42 | 影响(或好处);结果的摘要应该包含在补丁中。 | ||
43 | |||
44 | - 确保您有权发布代码。如果这项工作是为雇主完成的,雇主对这项工作具有所有权, | ||
45 | 并且必须同意根据GPL对其进行放行。 | ||
46 | |||
47 | 一般来说,在发布代码之前进行一些额外的思考,几乎总是能在短时间内得到回报。 | ||
48 | |||
49 | 补丁准备 | ||
50 | -------- | ||
51 | |||
52 | 准备发布补丁可能是一个惊人的工作量,但再次尝试节省时间在这里通常是不明智的, | ||
53 | 即使在短期内。 | ||
54 | |||
55 | 必须针对内核的特定版本准备补丁。作为一般规则,补丁程序应该基于Linus的Git树中 | ||
56 | 的当前主线。当以主线为基础时,从一个众所周知的发布点开始——一个稳定的或RC的 | ||
57 | 发布——而不是在一个主线分支任意点。 | ||
58 | |||
59 | 但是,可能需要针对-mm、linux-next或子系统树生成版本,以便于更广泛的测试和审查。 | ||
60 | 根据补丁的区域以及其他地方的情况,针对这些其他树建立补丁可能需要大量的工作来 | ||
61 | 解决冲突和处理API更改。 | ||
62 | |||
63 | 只有最简单的更改才应格式化为单个补丁;其他所有更改都应作为一系列逻辑更改进行。 | ||
64 | 分割补丁是一门艺术;一些开发人员花了很长时间来弄清楚如何按照社区期望的方式来 | ||
65 | 做。然而,有一些经验法则可以大大帮助: | ||
66 | |||
67 | - 您发布的补丁程序系列几乎肯定不会是工作系统中的一系列更改。相反,您所做的 | ||
68 | 更改需要在最终形式中加以考虑,然后以有意义的方式进行拆分。开发人员对离散的、 | ||
69 | 自包含的更改感兴趣,而不是您获取这些更改的路径。 | ||
70 | |||
71 | - 每个逻辑上独立的变更都应该格式化为单独的补丁。这些更改可以是小的(“向此 | ||
72 | 结构添加字段”)或大的(例如,添加一个重要的新驱动程序),但它们在概念上 | ||
73 | 应该是小的,并且可以接受一行描述。每个补丁都应该做一个特定的更改,可以单独 | ||
74 | 检查并验证它所做的事情。 | ||
75 | |||
76 | - 作为重申上述准则的一种方法:不要在同一补丁中混合不同类型的更改。如果一个 | ||
77 | 补丁修复了一个关键的安全漏洞,重新排列了一些结构,并重新格式化了代码,那么 | ||
78 | 很有可能它会被忽略,而重要的修复将丢失。 | ||
79 | |||
80 | - 每个补丁都应该产生一个内核,它可以正确地构建和运行;如果补丁系列在中间被 | ||
81 | 中断,那么结果应该仍然是一个工作的内核。补丁系列的部分应用是使用 | ||
82 | “git bisct”工具查找回归的一个常见场景;如果结果是一个损坏的内核,那么对于 | ||
83 | 那些从事追踪问题的高尚工作的开发人员和用户来说,将使他们的生活更加艰难。 | ||
84 | |||
85 | - 不过,不要过分。一位开发人员曾经将一组编辑内容作为500个单独的补丁发布到一个 | ||
86 | 文件中,这并没有使他成为内核邮件列表中最受欢迎的人。一个补丁可以相当大, | ||
87 | 只要它仍然包含一个单一的逻辑变更。 | ||
88 | |||
89 | - 用一系列补丁添加一个全新的基础设施是很有诱惑力的,但是在系列中的最后一个 | ||
90 | 补丁启用整个补丁之前,该基础设施是不使用的。如果可能的话,应该避免这种 | ||
91 | 诱惑;如果这个系列增加了回归,那么二分法将指出最后一个补丁是导致问题的 | ||
92 | 补丁,即使真正的bug在其他地方。只要有可能,添加新代码的补丁程序应该立即 | ||
93 | 激活该代码。 | ||
94 | |||
95 | 创建完美补丁系列的工作可能是一个令人沮丧的过程,在完成“真正的工作”之后需要花费 | ||
96 | 大量的时间和思考。但是,如果做得好,这是一段很好的时间。 | ||
97 | |||
98 | 补丁格式和更改日志 | ||
99 | ------------------ | ||
100 | |||
101 | 所以现在你有了一系列完美的补丁可以发布,但是这项工作还没有完成。每个补丁都 | ||
102 | 需要被格式化成一条消息,它可以快速而清晰地将其目的传达给世界其他地方。为此, | ||
103 | 每个补丁将由以下部分组成: | ||
104 | |||
105 | - 命名补丁作者的可选“from”行。只有当你通过电子邮件传递别人的补丁时,这一行 | ||
106 | 才是必要的,但是如果有疑问,添加它不会有任何伤害。 | ||
107 | |||
108 | - 一行描述补丁的作用。对于没有其他上下文的读者来说,此消息应该足够了解补丁 | ||
109 | 的范围;这是将在“短格式”变更日志中显示的行。此消息通常首先用相关的子系统 | ||
110 | 名称格式化,然后是补丁的目的。例如: | ||
111 | |||
112 | :: | ||
113 | |||
114 | gpio: fix build on CONFIG_GPIO_SYSFS=n | ||
115 | |||
116 | - 一个空白行,后面是补丁内容的详细描述。这个描述可以是必需的;它应该说明补丁 | ||
117 | 的作用以及为什么它应该应用于内核。 | ||
118 | |||
119 | - 一个或多个标记行,至少有一个由补丁作者的:signed-off-by 签名。签名将在下面 | ||
120 | 更详细地描述。 | ||
121 | |||
122 | 上面的项目一起构成补丁的变更日志。写一篇好的变更日志是一门至关重要但常常被 | ||
123 | 忽视的艺术;值得花一点时间来讨论这个问题。当你写一个变更日志时,你应该记住 | ||
124 | 有很多不同的人会读你的话。其中包括子系统维护人员和审查人员,他们需要决定是否 | ||
125 | 应该包括补丁,分销商和其他维护人员试图决定是否应该将补丁反向移植到其他内核, | ||
126 | bug搜寻人员想知道补丁是否负责他们正在追查的问题,想知道内核如何变化的用户。 | ||
127 | 等等。一个好的变更日志以最直接和最简洁的方式向所有这些人传达所需的信息。 | ||
128 | |||
129 | 为此,总结行应该描述变更的影响和动机,以及在一行约束条件下可能发生的变化。 | ||
130 | 然后,详细的描述可以详述这些主题,并提供任何需要的附加信息。如果补丁修复了 | ||
131 | 一个bug,请引用引入该bug的commit(如果可能,请在引用commits时同时提供commit id | ||
132 | 和标题)。如果某个问题与特定的日志或编译器输出相关联,请包含该输出以帮助其他 | ||
133 | 人搜索同一问题的解决方案。如果更改是为了支持以后补丁中的其他更改,那么就这么 | ||
134 | 说。如果更改了内部API,请详细说明这些更改以及其他开发人员应该如何响应。一般 | ||
135 | 来说,你越能把自己放在每个阅读你的changelog的人的位置上,changelog(和内核 | ||
136 | 作为一个整体)就越好。 | ||
137 | |||
138 | 不用说,变更日志应该是将变更提交到修订控制系统时使用的文本。接下来是: | ||
139 | |||
140 | - 补丁本身,采用统一的(“-u”)补丁格式。将“-p”选项用于diff将使函数名与更改 | ||
141 | 相关联,从而使结果补丁更容易被其他人读取。 | ||
142 | |||
143 | 您应该避免在补丁中包括对不相关文件(例如,由构建过程生成的文件或编辑器 | ||
144 | 备份文件)的更改。文档目录中的文件“dontdiff”在这方面有帮助;使用“-X”选项将 | ||
145 | 其传递给diff。 | ||
146 | |||
147 | 上面提到的标签用于描述各种开发人员如何与这个补丁的开发相关联。 | ||
148 | :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>` | ||
149 | 文档中对它们进行了详细描述;下面是一个简短的总结。每一行的格式如下: | ||
150 | |||
151 | :: | ||
152 | |||
153 | tag: Full Name <email address> optional-other-stuff | ||
154 | |||
155 | 常用的标签有: | ||
156 | |||
157 | - Signed-off-by: 这是一个开发人员的证明,他或她有权提交补丁以包含到内核中。 | ||
158 | 这是开发来源认证协议,其全文可在 | ||
159 | :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>` | ||
160 | 中找到,如果没有适当的签字,则不能合并到主线中。 | ||
161 | |||
162 | - Co-developed-by: 声明补丁是由多个开发人员共同创建的;当几个人在一个补丁上 | ||
163 | 工作时,它用于将属性赋予共同作者(除了 From: 所赋予的作者之外)。因为 | ||
164 | Co-developed-by: 表示作者身份,所以每个共同开发人, 必须紧跟在相关合作作者 | ||
165 | 的签名之后。具体内容和示例可以在以下文件中找到 | ||
166 | :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>` | ||
167 | |||
168 | - Acked-by: 表示另一个开发人员(通常是相关代码的维护人员)同意补丁适合包含 | ||
169 | 在内核中。 | ||
170 | |||
171 | - Tested-by: 声明指定的人已经测试了补丁并发现它可以工作。 | ||
172 | |||
173 | - Reviewed-by: 指定的开发人员已经审查了补丁的正确性;有关详细信息,请参阅 | ||
174 | :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>` | ||
175 | |||
176 | - Reported-by: 指定报告此补丁修复的问题的用户;此标记用于提供感谢。 | ||
177 | |||
178 | - Cc:指定的人收到了补丁的副本,并有机会对此发表评论。 | ||
179 | |||
180 | 在补丁中添加标签时要小心:只有cc:才适合在没有指定人员明确许可的情况下添加。 | ||
181 | |||
182 | 发送补丁 | ||
183 | -------- | ||
184 | |||
185 | 在邮寄补丁之前,您还需要注意以下几点: | ||
186 | |||
187 | - 您确定您的邮件发送程序不会损坏补丁吗?有免费的空白更改或由邮件客户端 | ||
188 | 执行的行包装的补丁不会在另一端复原,并且通常不会进行任何详细检查。如果有 | ||
189 | 任何疑问,把补丁寄给你自己,让你自己相信它是完好无损的。 | ||
190 | |||
191 | :ref:`Documentation/translations/zh_CN/process/email-clients.rst <cn_email_clients>` | ||
192 | 提供了一些有用的提示,可以让特定的邮件客户机工作以发送补丁。 | ||
193 | |||
194 | - 你确定你的补丁没有愚蠢的错误吗?您应该始终通过scripts/checkpatch.pl运行 | ||
195 | 补丁程序,并解决它提出的投诉。请记住,checkpatch.pl虽然是大量思考内核 | ||
196 | 补丁应该是什么样子的体现,但它并不比您聪明。如果修复checkpatch.pl投诉会 | ||
197 | 使代码变得更糟,请不要这样做。 | ||
198 | |||
199 | 补丁应始终以纯文本形式发送。请不要将它们作为附件发送;这使得审阅者在答复中更难 | ||
200 | 引用补丁的部分。相反,只需将补丁直接放到您的消息中。 | ||
201 | |||
202 | 邮寄补丁时,重要的是将副本发送给任何可能感兴趣的人。与其他一些项目不同,内核 | ||
203 | 鼓励人们错误地发送过多的副本;不要假定相关人员会看到您在邮件列表中的发布。 | ||
204 | 尤其是,副本应发送至: | ||
205 | |||
206 | - 受影响子系统的维护人员。如前所述,维护人员文件是查找这些人员的第一个地方。 | ||
207 | |||
208 | - 其他在同一领域工作的开发人员,尤其是那些现在可能在那里工作的开发人员。使用 | ||
209 | git查看还有谁修改了您正在处理的文件,这很有帮助。 | ||
210 | |||
211 | - 如果您对错误报告或功能请求做出响应,也可以抄送原始发送人。 | ||
212 | |||
213 | - 将副本发送到相关邮件列表,或者,如果没有其他应用,则发送到Linux内核列表。 | ||
214 | |||
215 | - 如果您正在修复一个bug,请考虑该修复是否应进入下一个稳定更新。如果是这样, | ||
216 | stable@vger.kernel.org 应该得到补丁的副本。另外,在补丁本身的标签中添加 | ||
217 | 一个“cc:stable@vger.kernel.org”;这将使稳定团队在修复进入主线时收到通知。 | ||
218 | |||
219 | 当为一个补丁选择接收者时,最好知道你认为谁最终会接受这个补丁并将其合并。虽然 | ||
220 | 可以将补丁直接发送给LinusTorvalds并让他合并,但通常情况下不会这样做。Linus | ||
221 | 很忙,并且有子系统维护人员负责监视内核的特定部分。通常您会希望维护人员合并您 | ||
222 | 的补丁。如果没有明显的维护人员,Andrew Morton通常是最后的补丁目标。 | ||
223 | |||
224 | 补丁需要好的主题行。补丁程序行的规范格式如下: | ||
225 | |||
226 | :: | ||
227 | |||
228 | [PATCH nn/mm] subsys: one-line description of the patch | ||
229 | |||
230 | 其中“nn”是补丁的序号,“mm”是系列中补丁的总数,“subsys”是受影响子系统的名称。 | ||
231 | 显然,一个单独的补丁可以省略nn/mm。 | ||
232 | |||
233 | 如果您有一系列重要的补丁,那么通常将介绍性描述作为零部分发送。不过,这种约定 | ||
234 | 并没有得到普遍遵循;如果您使用它,请记住简介中的信息不会使它进入内核变更日志。 | ||
235 | 因此,请确保补丁本身具有完整的变更日志信息。 | ||
236 | |||
237 | 一般来说,多部分补丁的第二部分和后续部分应作为对第一部分的回复发送,以便它们 | ||
238 | 在接收端都连接在一起。像git和coilt这样的工具有命令,可以通过适当的线程发送 | ||
239 | 一组补丁。但是,如果您有一个长系列,并且正在使用git,请远离–chain reply-to | ||
240 | 选项,以避免创建异常深的嵌套。 | ||
diff --git a/Documentation/translations/zh_CN/process/6.Followthrough.rst b/Documentation/translations/zh_CN/process/6.Followthrough.rst new file mode 100644 index 000000000000..f509e077e1cb --- /dev/null +++ b/Documentation/translations/zh_CN/process/6.Followthrough.rst | |||
@@ -0,0 +1,145 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/6.Followthrough.rst <development_followthrough>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_development_followthrough: | ||
7 | |||
8 | 跟进 | ||
9 | ==== | ||
10 | |||
11 | 在这一点上,您已经遵循了到目前为止给出的指导方针,并且,随着您自己的工程技能 | ||
12 | 的增加,已经发布了一系列完美的补丁。即使是经验丰富的内核开发人员也能犯的最大 | ||
13 | 错误之一是,认为他们的工作现在已经完成了。事实上,发布补丁意味着进入流程的下 | ||
14 | 一个阶段,可能还需要做很多工作。 | ||
15 | |||
16 | 一个补丁在第一次发布时就非常出色,没有改进的余地,这是很罕见的。内核开发流程 | ||
17 | 认识到这一事实,因此,它非常注重对已发布代码的改进。作为代码的作者,您应该与 | ||
18 | 内核社区合作,以确保您的代码符合内核的质量标准。如果不参与这个过程,很可能会 | ||
19 | 阻止将补丁包含到主线中。 | ||
20 | |||
21 | 与审阅者合作 | ||
22 | ------------ | ||
23 | |||
24 | 任何意义上的补丁都会导致其他开发人员在审查代码时发表大量评论。对于许多开发 | ||
25 | 人员来说,与审查人员合作可能是内核开发过程中最令人生畏的部分。但是,如果你 | ||
26 | 记住一些事情,生活会变得容易得多: | ||
27 | |||
28 | - 如果你已经很好地解释了你的补丁,评论人员会理解它的价值,以及为什么你会 | ||
29 | 费尽心思去写它。但是这个并不能阻止他们提出一个基本的问题:五年或十年后 | ||
30 | 用这个代码维护一个内核会是什么感觉?你可能被要求做出的许多改变——从编码风格 | ||
31 | 的调整到大量的重写——都来自于对Linux的理解,即从现在起十年后,Linux仍将在 | ||
32 | 开发中。 | ||
33 | |||
34 | - 代码审查是一项艰苦的工作,这是一项相对吃力不讨好的工作;人们记得谁编写了 | ||
35 | 内核代码,但对于那些审查它的人来说,几乎没有什么持久的名声。因此,评论 | ||
36 | 人员可能会变得暴躁,尤其是当他们看到同样的错误被一遍又一遍地犯下时。如果 | ||
37 | 你得到了一个看起来愤怒、侮辱或完全冒犯你的评论,抵制以同样方式回应的冲动。 | ||
38 | 代码审查是关于代码的,而不是关于人的,代码审查人员不会亲自攻击您。 | ||
39 | |||
40 | - 同样,代码审查人员也不想以牺牲你雇主的利益为代价来宣传他们雇主的议程。 | ||
41 | 内核开发人员通常希望今后几年能在内核上工作,但他们明白他们的雇主可能会改 | ||
42 | 变。他们真的,几乎毫无例外地,致力于创造他们所能做到的最好的内核;他们并 | ||
43 | 没有试图给雇主的竞争对手造成不适。 | ||
44 | |||
45 | 所有这些归根结底都是,当审阅者向您发送评论时,您需要注意他们正在进行的技术 | ||
46 | 观察。不要让他们的表达方式或你自己的骄傲阻止这种事情的发生。当你在一个补丁 | ||
47 | 上得到评论时,花点时间去理解评论人想说什么。如果可能的话,请修复审阅者要求 | ||
48 | 您修复的内容。然后回复审稿人:谢谢他们,并描述你将如何回答他们的问题。 | ||
49 | |||
50 | 请注意,您不必同意审阅者建议的每个更改。如果您认为审阅者误解了您的代码,请 | ||
51 | 解释到底发生了什么。如果您对建议的更改有技术上的异议,请描述它并证明您对该 | ||
52 | 问题的解决方案是正确的。如果你的解释有道理,审稿人会接受的。不过,如果你的 | ||
53 | 解释不能证明是有说服力的,尤其是当其他人开始同意审稿人的观点时,请花些时间 | ||
54 | 重新考虑一下。你很容易对自己解决问题的方法视而不见,以至于你没有意识到某个 | ||
55 | 问题根本是错误的,或者你甚至没有解决正确的问题。 | ||
56 | |||
57 | Andrew Morton建议,每一条不会导致代码更改的评论都应该导致额外的代码注释; | ||
58 | 这可以帮助未来的评论人员避免出现第一次出现的问题。 | ||
59 | |||
60 | 一个致命的错误是忽视评论,希望它们会消失。他们不会走的。如果您在没有对之前 | ||
61 | 收到的注释做出响应的情况下重新发布代码,那么很可能会发现补丁毫无用处。 | ||
62 | |||
63 | 说到重新发布代码:请记住,审阅者不会记住您上次发布的代码的所有细节。因此, | ||
64 | 提醒审查人员以前提出的问题以及您如何处理这些问题总是一个好主意;补丁变更 | ||
65 | 日志是提供此类信息的好地方。审阅者不必搜索列表档案来熟悉上次所说的内容; | ||
66 | 如果您帮助他们开始运行,当他们重新访问您的代码时,他们的心情会更好。 | ||
67 | |||
68 | 如果你已经试着做正确的事情,但事情仍然没有进展呢?大多数技术上的分歧都可以 | ||
69 | 通过讨论来解决,但有时人们只需要做出决定。如果你真的认为这个决定对你不利, | ||
70 | 你可以试着向更高的权力上诉。在这篇文章中,更高的权力倾向于Andrew Morton。 | ||
71 | Andrew在内核开发社区中受i很大的尊重;他经常为似乎被绝望地阻塞事情清障。 | ||
72 | 尽管如此,对Andrew的呼吁不应轻而易举,也不应在所有其他替代方案都被探索之前 | ||
73 | 使用。当然,记住,他也可能不同意你的意见。 | ||
74 | |||
75 | 接下来会发生什么 | ||
76 | ---------------- | ||
77 | |||
78 | 如果一个补丁被认为是添加到内核中的一件好事,并且一旦大多数审查问题得到解决, | ||
79 | 下一步通常是进入子系统维护人员的树中。工作方式因子系统而异;每个维护人员都 | ||
80 | 有自己的工作方式。特别是,可能有不止一棵树——一棵树,也许,专门用于计划下一 | ||
81 | 个合并窗口的补丁,另一棵树用于长期工作。 | ||
82 | |||
83 | 对于应用于没有明显子系统树(例如内存管理修补程序)的区域的修补程序,默认树 | ||
84 | 通常以-mm结尾。影响多个子系统的补丁也可以最终通过-mm树。 | ||
85 | |||
86 | 包含在子系统树中可以提高补丁的可见性。现在,使用该树的其他开发人员将默认获 | ||
87 | 得补丁。子系统树通常也为Linux提供支持,使其内容对整个开发社区可见。在这一点 | ||
88 | 上,您很可能会从一组新的审阅者那里得到更多的评论;这些评论需要像上一轮那样 | ||
89 | 得到回答。 | ||
90 | |||
91 | 在这一点上也会发生什么,这取决于你的补丁的性质,是与其他人正在做的工作发生 | ||
92 | 冲突。在最坏的情况下,严重的补丁冲突可能会导致一些工作被搁置,以便剩余的补丁 | ||
93 | 可以成形并合并。另一些时候,冲突解决将涉及到与其他开发人员合作,可能还会 | ||
94 | 在树之间移动一些补丁,以确保所有的应用都是干净的。这项工作可能是一件痛苦的 | ||
95 | 事情,但要计算您的福祉:在Linux下一棵树出现之前,这些冲突通常只在合并窗口 | ||
96 | 中出现,必须迅速解决。现在可以在合并窗口打开之前,在空闲时解决这些问题。 | ||
97 | |||
98 | 有朝一日,如果一切顺利,您将登录并看到您的补丁已经合并到主线内核中。祝贺你! | ||
99 | 然而,一旦庆祝活动完成(并且您已经将自己添加到维护人员文件中),就值得记住 | ||
100 | 一个重要的小事实:工作仍然没有完成。并入主线带来了自身的挑战。 | ||
101 | |||
102 | 首先,补丁的可见性再次提高。可能会有新一轮的开发者评论,他们以前不知道这 | ||
103 | 个补丁。忽略它们可能很有诱惑力,因为您的代码不再存在任何被合并的问题。但是, | ||
104 | 要抵制这种诱惑,您仍然需要对有问题或建议的开发人员作出响应。 | ||
105 | |||
106 | 不过,更重要的是:将代码包含在主线中会将代码交给更大的一组测试人员。即使您 | ||
107 | 为尚未提供的硬件提供了驱动程序,您也会惊讶于有多少人会将您的代码构建到内核 | ||
108 | 中。当然,如果有测试人员,也会有错误报告。 | ||
109 | |||
110 | 最糟糕的错误报告是回归。如果你的补丁导致回归,你会发现很多不舒服的眼睛盯着 | ||
111 | 你;回归需要尽快修复。如果您不愿意或无法修复回归(其他人都不会为您修复), | ||
112 | 那么在稳定期内,您的补丁几乎肯定会被移除。除了否定您为使补丁进入主线所做的 | ||
113 | 所有工作之外,如果由于未能修复回归而取消补丁,很可能会使将来的工作更难合并。 | ||
114 | |||
115 | 在处理完任何回归之后,可能还有其他普通的bug需要处理。稳定期是修复这些错误并 | ||
116 | 确保代码在主线内核版本中的首次发布尽可能可靠的最好机会。所以,请回答错误 | ||
117 | 报告,并尽可能解决问题。这就是稳定期的目的;一旦解决了旧补丁的任何问题,就 | ||
118 | 可以开始创建酷的新补丁。 | ||
119 | |||
120 | 别忘了,还有其他里程碑也可能会创建bug报告:下一个主线稳定版本,当著名的发行 | ||
121 | 商选择包含补丁的内核版本时,等等。继续响应这些报告是您工作的基本骄傲。但是, | ||
122 | 如果这不是足够的动机,那么也值得考虑的是,开发社区会记住那些在合并后对代码 | ||
123 | 失去兴趣的开发人员。下一次你发布补丁时,他们会以你以后不会在身边维护它为假 | ||
124 | 设来评估它。 | ||
125 | |||
126 | 其他可能发生的事情 | ||
127 | ------------------ | ||
128 | |||
129 | 有一天,你可以打开你的邮件客户端,看到有人给你寄了一个代码补丁。毕竟,这是 | ||
130 | 让您的代码公开存在的好处之一。如果您同意这个补丁,您可以将它转发给子系统 | ||
131 | 维护人员(确保包含一个正确的From:行,这样属性是正确的,并添加一个您自己 | ||
132 | 的签准),或者回复一个Acked-by,让原始发送者向上发送它。 | ||
133 | |||
134 | 如果您不同意补丁,请发送一个礼貌的回复,解释原因。如果可能的话,告诉作者需要 | ||
135 | 做哪些更改才能让您接受补丁。对于代码的编写者和维护者所反对的合并补丁,存在着 | ||
136 | 一定的阻力,但仅此而已。如果你被认为不必要的阻碍了好的工作,那么这些补丁最 | ||
137 | 终会经过你身边并进入主线。在Linux内核中,没有人对任何代码拥有绝对的否决权。 | ||
138 | 除了Linus。 | ||
139 | |||
140 | 在非常罕见的情况下,您可能会看到完全不同的东西:另一个开发人员发布了针对您 | ||
141 | 的问题的不同解决方案。在这一点上,两个补丁中的一个可能不会合并,“我的在这里 | ||
142 | 是第一个”不被认为是一个令人信服的技术论据。如果有人的补丁取代了你的补丁而进 | ||
143 | 入了主线,那么只有一种方法可以回应你:高兴你的问题得到解决,继续你的工作。 | ||
144 | 以这种方式把一个人的工作推到一边可能会伤害和气馁,但是在他们忘记了谁的补丁 | ||
145 | 真正被合并很久之后,社区会记住你的反应。 | ||
diff --git a/Documentation/translations/zh_CN/process/7.AdvancedTopics.rst b/Documentation/translations/zh_CN/process/7.AdvancedTopics.rst new file mode 100644 index 000000000000..956815edbd18 --- /dev/null +++ b/Documentation/translations/zh_CN/process/7.AdvancedTopics.rst | |||
@@ -0,0 +1,124 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/7.AdvancedTopics.rst <development_advancedtopics>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_development_advancedtopics: | ||
7 | |||
8 | 高级主题 | ||
9 | ======== | ||
10 | |||
11 | 现在,希望您能够掌握开发流程的工作方式。然而,还有更多的东西要学!本节将介绍 | ||
12 | 一些主题,这些主题对希望成为Linux内核开发过程常规部分的开发人员有帮助。 | ||
13 | |||
14 | 使用Git管理补丁 | ||
15 | --------------- | ||
16 | |||
17 | 内核使用分布式版本控制始于2002年初,当时Linus首次开始使用专有的Bitkeeper应用 | ||
18 | 程序。虽然bitkeeper存在争议,但它所体现的软件版本管理方法却肯定不是。分布式 | ||
19 | 版本控制可以立即加速内核开发项目。在当前的时代,有几种免费的比特保持器替代品。 | ||
20 | 无论好坏,内核项目都将Git作为其选择的工具。 | ||
21 | |||
22 | 使用Git管理补丁可以使开发人员的生活更加轻松,尤其是随着补丁数量的增加。Git | ||
23 | 也有其粗糙的边缘和一定的危险,它是一个年轻和强大的工具,仍然在其开发人员完善 | ||
24 | 中。本文档不会试图教会读者如何使用git;这会是个巨长的文档。相反,这里的重点 | ||
25 | 将是Git如何特别适合内核开发过程。想要加快Git的开发人员可以在以下网站上找到 | ||
26 | 更多信息: | ||
27 | |||
28 | http://git-scm.com/ | ||
29 | |||
30 | http://www.kernel.org/pub/software/scm/git/docs/user-manual.html | ||
31 | |||
32 | 在尝试使用它使补丁可供其他人使用之前,第一要务是阅读上述站点,对Git的工作 | ||
33 | 方式有一个扎实的了解。使用Git的开发人员应该能够获得主线存储库的副本,探索 | ||
34 | 修订历史,提交对树的更改,使用分支等。了解Git用于重写历史的工具(如Rebase) | ||
35 | 也很有用。Git有自己的术语和概念;Git的新用户应该了解refs、远程分支、索引、 | ||
36 | 快进合并、推拉、分离头等。一开始可能有点吓人,但这些概念不难通过一点学习来 | ||
37 | 理解。 | ||
38 | |||
39 | 使用git生成通过电子邮件提交的补丁是提高速度的一个很好的练习。 | ||
40 | |||
41 | 当您准备好开始安装Git树供其他人查看时,您当然需要一个可以从中提取的服务器。 | ||
42 | 如果您有一个可以访问Internet的系统,那么使用git守护进程设置这样的服务器相 | ||
43 | 对简单。否则,免费的公共托管网站(例如github)开始出现在网络上。成熟的开发 | ||
44 | 人员可以在kernel.org上获得一个帐户,但这些帐户并不容易找到;有关更多信息, | ||
45 | 请参阅 http://kernel.org/faq/ | ||
46 | |||
47 | 正常的Git工作流程涉及到许多分支的使用。每一条开发线都可以分为单独的“主题 | ||
48 | 分支”,并独立维护。Git的分支机构很便宜,没有理由不免费使用它们。而且,在 | ||
49 | 任何情况下,您都不应该在任何您打算让其他人从中受益的分支中进行开发。应该 | ||
50 | 小心地创建公开可用的分支;当它们处于完整的形式并准备好运行时(而不是之前), | ||
51 | 合并开发分支的补丁。 | ||
52 | |||
53 | Git提供了一些强大的工具,可以让您重写开发历史。一个不方便的补丁(比如说, | ||
54 | 一个打破二分法的补丁,或者有其他一些明显的缺陷)可以在适当的位置修复,或者 | ||
55 | 完全从历史中消失。一个补丁系列可以被重写,就好像它是在今天的主线之上写的 | ||
56 | 一样,即使你已经花了几个月的时间在写它。可以透明地将更改从一个分支转移到另 | ||
57 | 一个分支。等等。明智地使用git修改历史的能力可以帮助创建问题更少的干净补丁集。 | ||
58 | |||
59 | 然而,过度使用这种能力可能会导致其他问题,而不仅仅是对创建完美项目历史的 | ||
60 | 简单痴迷。重写历史将重写该历史中包含的更改,将经过测试(希望)的内核树变 | ||
61 | 为未经测试的内核树。但是,除此之外,如果开发人员没有对项目历史的共享视图, | ||
62 | 他们就无法轻松地协作;如果您重写了其他开发人员拉入他们存储库的历史,您将 | ||
63 | 使这些开发人员的生活更加困难。因此,这里有一个简单的经验法则:被导出到其他 | ||
64 | 人的历史在此后通常被认为是不可变的。 | ||
65 | |||
66 | 因此,一旦将一组更改推送到公开可用的服务器上,就不应该重写这些更改。如果您 | ||
67 | 尝试强制进行不会导致快进合并(即不共享同一历史记录的更改)的更改,Git将尝 | ||
68 | 试强制执行此规则。可以重写此检查,有时可能需要重写导出的树。在树之间移动变 | ||
69 | 更集以避免Linux-next中的冲突就是一个例子。但这种行为应该是罕见的。这就是为 | ||
70 | 什么开发应该在私有分支中进行(必要时可以重写)并且只有在公共分支处于合理的 | ||
71 | 高级状态时才转移到公共分支中的原因之一。 | ||
72 | |||
73 | 当主线(或其他一组变更所基于的树)前进时,很容易与该树合并以保持领先地位。 | ||
74 | 对于一个私有的分支,rebasing 可能是一个很容易跟上另一棵树的方法,但是一旦 | ||
75 | 一棵树被导出到全世界,rebasing就不是一个选项。一旦发生这种情况,就必须进行 | ||
76 | 完全合并(merge)。合并有时是很有意义的,但是过于频繁的合并会不必要地扰乱 | ||
77 | 历史。在这种情况下,建议的技术是不经常合并,通常只在特定的发布点(如主线-rc | ||
78 | 发布)合并。如果您对特定的更改感到紧张,则可以始终在私有分支中执行测试合并。 | ||
79 | 在这种情况下,git rerere 工具很有用;它记住合并冲突是如何解决的,这样您就 | ||
80 | 不必重复相同的工作。 | ||
81 | |||
82 | 关于Git这样的工具的一个最大的反复抱怨是:补丁从一个存储库到另一个存储库的 | ||
83 | 大量移动使得很容易陷入错误建议的变更中,这些变更避开审查雷达进入主线。当内 | ||
84 | 核开发人员看到这种情况发生时,他们往往会感到不高兴;在Git树上放置未查看或 | ||
85 | 主题外的补丁可能会影响您将来获取树的能力。引用Linus: | ||
86 | |||
87 | :: | ||
88 | |||
89 | 你可以给我发补丁,但要我从你哪里取一个Git补丁,我需要知道你知道 | ||
90 | 你在做什么,我需要能够相信事情而不去检查每个个人改变。 | ||
91 | |||
92 | (http://lwn.net/articles/224135/)。 | ||
93 | |||
94 | 为了避免这种情况,请确保给定分支中的所有补丁都与相关主题紧密相关;“驱动程序 | ||
95 | 修复”分支不应更改核心内存管理代码。而且,最重要的是,不要使用Git树来绕过 | ||
96 | 审查过程。不时的将树的摘要发布到相关的列表中,当时间合适时,请求 | ||
97 | Linux-next 中包含该树。 | ||
98 | |||
99 | 如果其他人开始发送补丁以包含到您的树中,不要忘记查看它们。还要确保您维护正确 | ||
100 | 的作者信息; ``git am`` 工具在这方面做得最好,但是如果它通过第三方转发给您, | ||
101 | 您可能需要在补丁中添加“From:”行。 | ||
102 | |||
103 | 请求pull操作时,请务必提供所有相关信息:树的位置、要拉的分支以及拉操作将导致 | ||
104 | 的更改。在这方面,git request pull 命令非常有用;它将按照其他开发人员的预期 | ||
105 | 格式化请求,并检查以确保您记住了将这些更改推送到公共服务器。 | ||
106 | |||
107 | 审查补丁 | ||
108 | -------- | ||
109 | |||
110 | 一些读者当然会反对将本节与“高级主题”放在一起,因为即使是刚开始的内核开发人员 | ||
111 | 也应该检查补丁。当然,学习如何在内核环境中编程没有比查看其他人发布的代码更好 | ||
112 | 的方法了。此外,审阅者永远供不应求;通过查看代码,您可以对整个流程做出重大贡献。 | ||
113 | |||
114 | 审查代码可能是一个令人生畏的前景,特别是对于一个新的内核开发人员来说,他们 | ||
115 | 可能会对公开询问代码感到紧张,而这些代码是由那些有更多经验的人发布的。不过, | ||
116 | 即使是最有经验的开发人员编写的代码也可以得到改进。也许对评审员(所有评审员) | ||
117 | 最好的建议是:把评审评论当成问题而不是批评。询问“在这条路径中如何释放锁?” | ||
118 | 总是比说“这里的锁是错误的”更好。 | ||
119 | |||
120 | 不同的开发人员将从不同的角度审查代码。一些主要关注的是编码样式以及代码行是 | ||
121 | 否有尾随空格。其他人将主要关注补丁作为一个整体实现的变更是否对内核有好处。 | ||
122 | 然而,其他人会检查是否存在锁定问题、堆栈使用过度、可能的安全问题、在其他 | ||
123 | 地方发现的代码重复、足够的文档、对性能的不利影响、用户空间ABI更改等。所有 | ||
124 | 类型的检查,如果它们导致更好的代码进入内核,都是受欢迎和值得的。 | ||
diff --git a/Documentation/translations/zh_CN/process/8.Conclusion.rst b/Documentation/translations/zh_CN/process/8.Conclusion.rst new file mode 100644 index 000000000000..2bbd76161e10 --- /dev/null +++ b/Documentation/translations/zh_CN/process/8.Conclusion.rst | |||
@@ -0,0 +1,64 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/8.Conclusion.rst <development_conclusion>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_development_conclusion: | ||
7 | |||
8 | 更多信息 | ||
9 | ======== | ||
10 | |||
11 | 关于Linux内核开发和相关主题的信息来源很多。首先是在内核源代码分发中找到的 | ||
12 | 文档目录。顶级 :ref:`Documentation/translations/zh_CN/process/howto.rst <cn_process_howto>` | ||
13 | 文件是一个重要的起点 | ||
14 | :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>` | ||
15 | 和 :ref:`process/submitting-drivers.rst <submittingdrivers>` | ||
16 | 也是所有内核开发人员都应该阅读的内容。许多内部内核API都是使用kerneldoc机制 | ||
17 | 记录的;“make htmldocs”或“make pdfdocs”可用于以HTML或PDF格式生成这些文档( | ||
18 | 尽管某些发行版提供的tex版本会遇到内部限制,无法正确处理文档)。 | ||
19 | |||
20 | 不同的网站在各个细节层次上讨论内核开发。您的作者想谦虚地建议用 http://lwn.net/ | ||
21 | 作为来源;有关许多特定内核主题的信息可以通过以下网址的lwn内核索引找到: | ||
22 | |||
23 | http://lwn.net/kernel/index/ | ||
24 | |||
25 | 除此之外,内核开发人员的一个宝贵资源是: | ||
26 | |||
27 | http://kernelnewbies.org/ | ||
28 | |||
29 | 当然,我们不应该忘记 http://kernel.org/ 这是内核发布信息的最终位置。 | ||
30 | |||
31 | 关于内核开发有很多书: | ||
32 | |||
33 | Linux设备驱动程序,第三版(Jonathan Corbet、Alessandro Rubini和Greg Kroah Hartman)。 | ||
34 | 在线:http://lwn.net/kernel/ldd3/ | ||
35 | |||
36 | Linux内核开发(Robert Love)。 | ||
37 | |||
38 | 了解Linux内核(Daniel Bovet和Marco Cesati)。 | ||
39 | |||
40 | 然而,所有这些书都有一个共同的缺点:当它们上架时,它们往往有些过时,而且它们 | ||
41 | 已经上架一段时间了。不过,在那里还可以找到相当多的好信息。 | ||
42 | |||
43 | 有关git的文档,请访问: | ||
44 | |||
45 | http://www.kernel.org/pub/software/scm/git/docs/ | ||
46 | |||
47 | http://www.kernel.org/pub/software/scm/git/docs/user-manual.html | ||
48 | |||
49 | 结论 | ||
50 | ==== | ||
51 | |||
52 | 祝贺所有通过这篇冗长的文件的人。希望它能够帮助您理解Linux内核是如何开发的, | ||
53 | 以及您如何参与这个过程。 | ||
54 | |||
55 | 最后,重要的是参与。任何开源软件项目都不超过其贡献者投入其中的总和。Linux内核 | ||
56 | 的发展速度和以前一样快,因为它得到了大量开发人员的帮助,他们都在努力使它变得 | ||
57 | 更好。内核是一个主要的例子,说明当成千上万的人为了一个共同的目标一起工作时, | ||
58 | 可以做些什么。 | ||
59 | |||
60 | 不过,内核总是可以从更大的开发人员基础中获益。总有更多的工作要做。但是,同样 | ||
61 | 重要的是,Linux生态系统中的大多数其他参与者可以通过为内核做出贡献而受益。使 | ||
62 | 代码进入主线是提高代码质量、降低维护和分发成本、提高对内核开发方向的影响程度 | ||
63 | 等的关键。这是一种人人都赢的局面。踢开你的编辑,来加入我们吧,你会非常受 | ||
64 | 欢迎的。 | ||
diff --git a/Documentation/translations/zh_CN/process/code-of-conduct-interpretation.rst b/Documentation/translations/zh_CN/process/code-of-conduct-interpretation.rst new file mode 100644 index 000000000000..c323ce76e0cb --- /dev/null +++ b/Documentation/translations/zh_CN/process/code-of-conduct-interpretation.rst | |||
@@ -0,0 +1,108 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/code-of-conduct-interpretation.rst <code_of_conduct_interpretation>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_code_of_conduct_interpretation: | ||
7 | |||
8 | Linux内核贡献者契约行为准则解释 | ||
9 | =============================== | ||
10 | |||
11 | :ref:`cn_code_of_conduct` 准则是一个通用文档,旨在为几乎所有开源社区提供一套规则。 | ||
12 | 每个开源社区都是独一无二的,Linux内核也不例外。因此,本文描述了Linux内核社区中 | ||
13 | 如何解释它。我们也不希望这种解释随着时间的推移是静态的,并将根据需要进行调整。 | ||
14 | |||
15 | 与开发软件的“传统”方法相比,Linux内核开发工作是一个非常个人化的过程。你的贡献 | ||
16 | 和背后的想法将被仔细审查,往往导致批判和批评。审查将几乎总是需要改进,材料才 | ||
17 | 能包括在内核中。要知道这是因为所有相关人员都希望看到Linux整体成功的最佳解决方 | ||
18 | 案。这个开发过程已经被证明可以创建有史以来最健壮的操作系统内核,我们不想做任何 | ||
19 | 事情来导致提交质量和最终结果的下降。 | ||
20 | |||
21 | 维护者 | ||
22 | ------ | ||
23 | |||
24 | 行为准则多次使用“维护者”一词。在内核社区中,“维护者”是负责子系统、驱动程序或 | ||
25 | 文件的任何人,并在内核源代码树的维护者文件中列出。 | ||
26 | |||
27 | 责任 | ||
28 | ---- | ||
29 | |||
30 | 《行为准则》提到了维护人员的权利和责任,这需要进一步澄清。 | ||
31 | |||
32 | 首先,最重要的是,有一个合理的期望是由维护人员通过实例来领导。 | ||
33 | |||
34 | 也就是说,我们的社区是广阔的,对维护者没有新的要求,他们单方面处理其他人在 | ||
35 | 他们活跃的社区的行为。这一责任由我们所有人承担,最终《行为准则》记录了最终的 | ||
36 | 上诉路径,以防有关行为问题的问题悬而未决。 | ||
37 | |||
38 | 维护人员应该愿意在出现问题时提供帮助,并在需要时与社区中的其他人合作。如果您 | ||
39 | 不确定如何处理出现的情况,请不要害怕联系技术咨询委员会(TAB)或其他维护人员。 | ||
40 | 除非您愿意,否则不会将其视为违规报告。如果您不确定是否该联系TAB 或任何其他维 | ||
41 | 护人员,请联系我们的冲突调解人 Mishi Choudhary <mishi@linux.com>。 | ||
42 | |||
43 | 最后,“善待对方”才是每个人的最终目标。我们知道每个人都是人,有时我们都会失败, | ||
44 | 但我们所有人的首要目标应该是努力友好地解决问题。执行行为准则将是最后的选择。 | ||
45 | |||
46 | 我们的目标是创建一个强大的、技术先进的操作系统,以及所涉及的技术复杂性,这自 | ||
47 | 然需要专业知识和决策。 | ||
48 | |||
49 | 所需的专业知识因贡献领域而异。它主要由上下文和技术复杂性决定,其次由贡献者和 | ||
50 | 维护者的期望决定。 | ||
51 | |||
52 | 专家的期望和决策都要经过讨论,但在最后,为了取得进展,必须能够做出决策。这一 | ||
53 | 特权掌握在维护人员和项目领导的手中,预计将善意使用。 | ||
54 | |||
55 | 因此,设定专业知识期望、作出决定和拒绝不适当的贡献不被视为违反行为准则。 | ||
56 | |||
57 | 虽然维护人员一般都欢迎新来者,但他们帮助(新)贡献者克服障碍的能力有限,因此 | ||
58 | 他们必须确定优先事项。这也不应被视为违反了行为准则。内核社区意识到这一点,并 | ||
59 | 以各种形式提供入门级节目,如 kernelnewbies.org 。 | ||
60 | |||
61 | 范围 | ||
62 | ---- | ||
63 | |||
64 | Linux内核社区主要在一组公共电子邮件列表上进行交互,这些列表分布在由多个不同 | ||
65 | 公司或个人控制的多个不同服务器上。所有这些列表都在内核源代码树中的 | ||
66 | MAINTAINERS 文件中定义。发送到这些邮件列表的任何电子邮件都被视为包含在行为 | ||
67 | 准则中。 | ||
68 | |||
69 | 使用 kernel.org bugzilla和其他子系统bugzilla 或bug跟踪工具的开发人员应该遵循 | ||
70 | 行为准则的指导原则。Linux内核社区没有“官方”项目电子邮件地址或“官方”社交媒体 | ||
71 | 地址。使用kernel.org电子邮件帐户执行的任何活动必须遵循为kernel.org发布的行为 | ||
72 | 准则,就像任何使用公司电子邮件帐户的个人必须遵循该公司的特定规则一样。 | ||
73 | |||
74 | 行为准则并不禁止在邮件列表消息、内核更改日志消息或代码注释中继续包含名称、 | ||
75 | 电子邮件地址和相关注释。 | ||
76 | |||
77 | 其他论坛中的互动包括在适用于上述论坛的任何规则中,通常不包括在行为准则中。 | ||
78 | 除了在极端情况下可考虑的例外情况。 | ||
79 | |||
80 | 提交给内核的贡献应该使用适当的语言。在行为准则之前已经存在的内容现在不会被 | ||
81 | 视为违反。然而,不适当的语言可以被视为一个bug;如果任何相关方提交补丁, | ||
82 | 这样的bug将被更快地修复。当前属于用户/内核API的一部分的表达式,或者反映已 | ||
83 | 发布标准或规范中使用的术语的表达式,不被视为bug。 | ||
84 | |||
85 | 执行 | ||
86 | ---- | ||
87 | |||
88 | 行为准则中列出的地址属于行为准则委员会。https://kernel.org/code-of-conduct.html | ||
89 | 列出了在任何给定时间接收这些电子邮件的确切成员。成员不能访问在加入委员会之前 | ||
90 | 或离开委员会之后所做的报告。 | ||
91 | |||
92 | 最初的行为准则委员会由TAB的志愿者以及作为中立第三方的专业调解人组成。委员会 | ||
93 | 的首要任务是建立文件化的流程,并将其公开。 | ||
94 | |||
95 | 如果报告人不希望将整个委员会纳入投诉或关切,可直接联系委员会的任何成员,包括 | ||
96 | 调解人。 | ||
97 | |||
98 | 行为准则委员会根据流程审查案例(见上文),并根据需要和适当与TAB协商,例如请求 | ||
99 | 和接收有关内核社区的信息。 | ||
100 | |||
101 | 委员会做出的任何决定都将提交到表中,以便在必要时与相关维护人员一起执行。行为 | ||
102 | 准则委员会的决定可以通过三分之二的投票推翻。 | ||
103 | |||
104 | 每季度,行为准则委员会和标签将提供一份报告,概述行为准则委员会收到的匿名报告 | ||
105 | 及其状态,以及任何否决决定的细节,包括完整和可识别的投票细节。 | ||
106 | |||
107 | 我们希望在启动期之后为行为准则委员会人员配备建立一个不同的流程。发生此情况时, | ||
108 | 将使用该信息更新此文档。 | ||
diff --git a/Documentation/translations/zh_CN/process/code-of-conduct.rst b/Documentation/translations/zh_CN/process/code-of-conduct.rst new file mode 100644 index 000000000000..99024df058e9 --- /dev/null +++ b/Documentation/translations/zh_CN/process/code-of-conduct.rst | |||
@@ -0,0 +1,72 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/code-of-conduct.rst <code_of_conduct>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_code_of_conduct: | ||
7 | |||
8 | 贡献者契约行为准则 | ||
9 | ++++++++++++++++++ | ||
10 | |||
11 | 我们的誓言 | ||
12 | ========== | ||
13 | |||
14 | 为了营造一个开放、友好的环境,我们作为贡献者和维护人承诺,让我们的社区和参 | ||
15 | 与者,拥有一个无骚扰的体验,无论年龄、体型、残疾、种族、性别特征、性别认同 | ||
16 | 和表达、经验水平、教育程度、社会状况,经济地位、国籍、个人外貌、种族、宗教 | ||
17 | 或性身份和取向。 | ||
18 | |||
19 | 我们的标准 | ||
20 | ========== | ||
21 | |||
22 | 有助于创造积极环境的行为包括: | ||
23 | |||
24 | * 使用欢迎和包容的语言 | ||
25 | * 尊重不同的观点和经验 | ||
26 | * 优雅地接受建设性的批评 | ||
27 | * 关注什么对社区最有利 | ||
28 | * 对其他社区成员表示同情 | ||
29 | |||
30 | 参与者的不可接受行为包括: | ||
31 | |||
32 | * 使用性意味的语言或意象以及不受欢迎的性注意或者更过分的行为 | ||
33 | * 煽动、侮辱/贬损评论以及个人或政治攻击 | ||
34 | * 公开或私下骚扰 | ||
35 | * 未经明确许可,发布他人的私人信息,如物理或电子地址。 | ||
36 | * 在专业场合被合理认为不适当的其他行为 | ||
37 | |||
38 | 我们的责任 | ||
39 | ========== | ||
40 | |||
41 | 维护人员负责澄清可接受行为的标准,并应针对任何不可接受行为采取适当和公平的 | ||
42 | 纠正措施。 | ||
43 | |||
44 | 维护人员有权和责任删除、编辑或拒绝与本行为准则不一致的评论、承诺、代码、 | ||
45 | wiki编辑、问题和其他贡献,或暂时或永久禁止任何贡献者从事他们认为不适当、 | ||
46 | 威胁、冒犯或有害的其他行为。 | ||
47 | |||
48 | 范围 | ||
49 | ==== | ||
50 | |||
51 | 当个人代表项目或其社区时,本行为准则既适用于项目空间,也适用于公共空间。 | ||
52 | 代表一个项目或社区的例子包括使用一个正式的项目电子邮件地址,通过一个正式 | ||
53 | 的社交媒体帐户发布,或者在在线或离线事件中担任指定的代表。项目维护人员可以 | ||
54 | 进一步定义和澄清项目的表示。 | ||
55 | |||
56 | 执行 | ||
57 | ==== | ||
58 | |||
59 | 如有滥用、骚扰或其他不可接受的行为,可联系行为准则委员会<conduct@kernel.org>。 | ||
60 | 所有投诉都将接受审查和调查,并将得到必要和适当的答复。行为准则委员会有义务 | ||
61 | 对事件报告人保密。具体执行政策的进一步细节可单独公布。 | ||
62 | |||
63 | 归属 | ||
64 | ==== | ||
65 | |||
66 | 本行为准则改编自《贡献者契约》,版本1.4,可从 | ||
67 | https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 获取。 | ||
68 | |||
69 | 解释 | ||
70 | ==== | ||
71 | |||
72 | 有关Linux内核社区如何解释此文档,请参阅 :ref:`cn_code_of_conduct_interpretation` | ||
diff --git a/Documentation/translations/zh_CN/coding-style.rst b/Documentation/translations/zh_CN/process/coding-style.rst index 3cb09803e084..5479c591c2f7 100644 --- a/Documentation/translations/zh_CN/coding-style.rst +++ b/Documentation/translations/zh_CN/process/coding-style.rst | |||
@@ -1,19 +1,10 @@ | |||
1 | Chinese translated version of Documentation/process/coding-style.rst | 1 | .. include:: ../disclaimer-zh_CN.rst |
2 | 2 | ||
3 | If you have any comment or update to the content, please post to LKML directly. | 3 | :Original: :ref:`Documentation/process/coding-style.rst <codingstyle>` |
4 | However, if you have problem communicating in English you can also ask the | ||
5 | Chinese maintainer for help. Contact the Chinese maintainer, if this | ||
6 | translation is outdated or there is problem with translation. | ||
7 | 4 | ||
8 | Chinese maintainer: Zhang Le <r0bertz@gentoo.org> | 5 | .. _cn_codingstyle: |
9 | 6 | ||
10 | --------------------------------------------------------------------- | 7 | 译者:: |
11 | |||
12 | Documentation/process/coding-style.rst 的中文翻译 | ||
13 | |||
14 | 如果想评论或更新本文的内容,请直接发信到LKML。如果你使用英文交流有困难的话, | ||
15 | 也可以向中文版维护者求助。如果本翻译更新不及时或者翻译存在问题,请联系中文版 | ||
16 | 维护者:: | ||
17 | 8 | ||
18 | 中文版维护者: 张乐 Zhang Le <r0bertz@gentoo.org> | 9 | 中文版维护者: 张乐 Zhang Le <r0bertz@gentoo.org> |
19 | 中文版翻译者: 张乐 Zhang Le <r0bertz@gentoo.org> | 10 | 中文版翻译者: 张乐 Zhang Le <r0bertz@gentoo.org> |
@@ -23,10 +14,6 @@ Documentation/process/coding-style.rst 的中文翻译 | |||
23 | Li Zefan <lizf@cn.fujitsu.com> | 14 | Li Zefan <lizf@cn.fujitsu.com> |
24 | Wang Chen <wangchen@cn.fujitsu.com> | 15 | Wang Chen <wangchen@cn.fujitsu.com> |
25 | 16 | ||
26 | 以下为正文 | ||
27 | |||
28 | --------------------------------------------------------------------- | ||
29 | |||
30 | Linux 内核代码风格 | 17 | Linux 内核代码风格 |
31 | ========================= | 18 | ========================= |
32 | 19 | ||
diff --git a/Documentation/translations/zh_CN/process/development-process.rst b/Documentation/translations/zh_CN/process/development-process.rst new file mode 100644 index 000000000000..30cffe66c075 --- /dev/null +++ b/Documentation/translations/zh_CN/process/development-process.rst | |||
@@ -0,0 +1,26 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/development-process.rst <development_process_main>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_development_process_main: | ||
7 | |||
8 | 内核开发过程指南 | ||
9 | ================ | ||
10 | |||
11 | 内容: | ||
12 | |||
13 | .. toctree:: | ||
14 | :numbered: | ||
15 | :maxdepth: 2 | ||
16 | |||
17 | 1.Intro | ||
18 | 2.Process | ||
19 | 3.Early-stage | ||
20 | 4.Coding | ||
21 | 5.Posting | ||
22 | 6.Followthrough | ||
23 | 7.AdvancedTopics | ||
24 | 8.Conclusion | ||
25 | |||
26 | 本文档的目的是帮助开发人员(及其经理)以最小的挫折感与开发社区合作。它试图记录这个社区如何以一种不熟悉Linux内核开发(或者实际上是自由软件开发)的人可以访问的方式工作。虽然这里有一些技术资料,但这是一个面向过程的讨论,不需要深入了解内核编程就可以理解。 | ||
diff --git a/Documentation/translations/zh_CN/email-clients.txt b/Documentation/translations/zh_CN/process/email-clients.rst index ec31d97e8d0e..102023651118 100644 --- a/Documentation/translations/zh_CN/email-clients.txt +++ b/Documentation/translations/zh_CN/process/email-clients.rst | |||
@@ -1,33 +1,34 @@ | |||
1 | Chinese translated version of Documentation/process/email-clients.rst | 1 | .. _cn_email_clients: |
2 | 2 | ||
3 | If you have any comment or update to the content, please contact the | 3 | .. include:: ../disclaimer-zh_CN.rst |
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | 4 | ||
9 | Chinese maintainer: Harry Wei <harryxiyou@gmail.com> | 5 | :Original: :ref:`Documentation/process/email-clients.rst <email_clients>` |
10 | --------------------------------------------------------------------- | ||
11 | Documentation/process/email-clients.rst 的中文翻译 | ||
12 | 6 | ||
13 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | 7 | 译者:: |
14 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
15 | 译存在问题,请联系中文版维护者。 | ||
16 | 8 | ||
17 | 中文版维护者: 贾威威 Harry Wei <harryxiyou@gmail.com> | 9 | 中文版维护者: 贾威威 Harry Wei <harryxiyou@gmail.com> |
18 | 中文版翻译者: 贾威威 Harry Wei <harryxiyou@gmail.com> | 10 | 中文版翻译者: 贾威威 Harry Wei <harryxiyou@gmail.com> |
19 | 中文版校译者: Yinglin Luan <synmyth@gmail.com> | 11 | 时奎亮 Alex Shi <alex.shi@linux.alibaba.com> |
20 | Xiaochen Wang <wangxiaochen0@gmail.com> | 12 | 中文版校译者: Yinglin Luan <synmyth@gmail.com> |
21 | yaxinsn <yaxinsn@163.com> | 13 | Xiaochen Wang <wangxiaochen0@gmail.com> |
22 | 14 | yaxinsn <yaxinsn@163.com> | |
23 | 以下为正文 | ||
24 | --------------------------------------------------------------------- | ||
25 | 15 | ||
26 | Linux邮件客户端配置信息 | 16 | Linux邮件客户端配置信息 |
27 | ====================================================================== | 17 | ======================= |
18 | |||
19 | Git | ||
20 | --- | ||
21 | |||
22 | 现在大多数开发人员使用 ``git send-email`` 而不是常规的电子邮件客户端。这方面 | ||
23 | 的手册非常好。在接收端,维护人员使用 ``git am`` 加载补丁。 | ||
24 | |||
25 | 如果你是 ``git`` 新手,那么把你的第一个补丁发送给你自己。将其保存为包含所有 | ||
26 | 标题的原始文本。运行 ``git am raw_email.txt`` ,然后使用 ``git log`` 查看更 | ||
27 | 改日志。如果工作正常,再将补丁发送到相应的邮件列表。 | ||
28 | |||
28 | 29 | ||
29 | 普通配置 | 30 | 普通配置 |
30 | ---------------------------------------------------------------------- | 31 | -------- |
31 | Linux内核补丁是通过邮件被提交的,最好把补丁作为邮件体的内嵌文本。有些维护者 | 32 | Linux内核补丁是通过邮件被提交的,最好把补丁作为邮件体的内嵌文本。有些维护者 |
32 | 接收附件,但是附件的内容格式应该是"text/plain"。然而,附件一般是不赞成的, | 33 | 接收附件,但是附件的内容格式应该是"text/plain"。然而,附件一般是不赞成的, |
33 | 因为这会使补丁的引用部分在评论过程中变的很困难。 | 34 | 因为这会使补丁的引用部分在评论过程中变的很困难。 |
@@ -56,7 +57,7 @@ Linux内核补丁是通过邮件被提交的,最好把补丁作为邮件体的 | |||
56 | 57 | ||
57 | 58 | ||
58 | 一些邮件客户端提示 | 59 | 一些邮件客户端提示 |
59 | ---------------------------------------------------------------------- | 60 | ------------------ |
60 | 这里给出一些详细的MUA配置提示,可以用于给Linux内核发送补丁。这些并不意味是 | 61 | 这里给出一些详细的MUA配置提示,可以用于给Linux内核发送补丁。这些并不意味是 |
61 | 所有的软件包配置总结。 | 62 | 所有的软件包配置总结。 |
62 | 63 | ||
@@ -64,8 +65,8 @@ Linux内核补丁是通过邮件被提交的,最好把补丁作为邮件体的 | |||
64 | TUI = 以文本为基础的用户接口 | 65 | TUI = 以文本为基础的用户接口 |
65 | GUI = 图形界面用户接口 | 66 | GUI = 图形界面用户接口 |
66 | 67 | ||
67 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
68 | Alpine (TUI) | 68 | Alpine (TUI) |
69 | ~~~~~~~~~~~~ | ||
69 | 70 | ||
70 | 配置选项: | 71 | 配置选项: |
71 | 在"Sending Preferences"部分: | 72 | 在"Sending Preferences"部分: |
@@ -76,8 +77,8 @@ Alpine (TUI) | |||
76 | 当写邮件时,光标应该放在补丁会出现的地方,然后按下CTRL-R组合键,使指定的 | 77 | 当写邮件时,光标应该放在补丁会出现的地方,然后按下CTRL-R组合键,使指定的 |
77 | 补丁文件嵌入到邮件中。 | 78 | 补丁文件嵌入到邮件中。 |
78 | 79 | ||
79 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
80 | Evolution (GUI) | 80 | Evolution (GUI) |
81 | ~~~~~~~~~~~~~~~ | ||
81 | 82 | ||
82 | 一些开发者成功的使用它发送补丁 | 83 | 一些开发者成功的使用它发送补丁 |
83 | 84 | ||
@@ -89,8 +90,8 @@ Evolution (GUI) | |||
89 | 90 | ||
90 | 你还可以"diff -Nru old.c new.c | xclip",选择Preformat,然后使用中间键进行粘帖。 | 91 | 你还可以"diff -Nru old.c new.c | xclip",选择Preformat,然后使用中间键进行粘帖。 |
91 | 92 | ||
92 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
93 | Kmail (GUI) | 93 | Kmail (GUI) |
94 | ~~~~~~~~~~~ | ||
94 | 95 | ||
95 | 一些开发者成功的使用它发送补丁。 | 96 | 一些开发者成功的使用它发送补丁。 |
96 | 97 | ||
@@ -118,13 +119,13 @@ display",这样内嵌附件更容易让读者看到。 | |||
118 | 并且希望这将会被处理。邮件是以只针对某个用户可读写的权限被保存的,所以如果你想把邮件复制到其他地方, | 119 | 并且希望这将会被处理。邮件是以只针对某个用户可读写的权限被保存的,所以如果你想把邮件复制到其他地方, |
119 | 你不得不把他们的权限改为组或者整体可读。 | 120 | 你不得不把他们的权限改为组或者整体可读。 |
120 | 121 | ||
121 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
122 | Lotus Notes (GUI) | 122 | Lotus Notes (GUI) |
123 | ~~~~~~~~~~~~~~~~~ | ||
123 | 124 | ||
124 | 不要使用它。 | 125 | 不要使用它。 |
125 | 126 | ||
126 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
127 | Mutt (TUI) | 127 | Mutt (TUI) |
128 | ~~~~~~~~~~ | ||
128 | 129 | ||
129 | 很多Linux开发人员使用mutt客户端,所以证明它肯定工作的非常漂亮。 | 130 | 很多Linux开发人员使用mutt客户端,所以证明它肯定工作的非常漂亮。 |
130 | 131 | ||
@@ -142,12 +143,49 @@ Mutt不自带编辑器,所以不管你使用什么编辑器都不应该带有 | |||
142 | 如果想要把补丁作为内嵌文本。 | 143 | 如果想要把补丁作为内嵌文本。 |
143 | (a)ttach工作的很好,不带有"set paste"。 | 144 | (a)ttach工作的很好,不带有"set paste"。 |
144 | 145 | ||
146 | 你可以通过 ``git format-patch`` 生成补丁,然后用 Mutt发送它们:: | ||
147 | |||
148 | $ mutt -H 0001-some-bug-fix.patch | ||
149 | |||
145 | 配置选项: | 150 | 配置选项: |
146 | 它应该以默认设置的形式工作。 | 151 | 它应该以默认设置的形式工作。 |
147 | 然而,把"send_charset"设置为"us-ascii::utf-8"也是一个不错的主意。 | 152 | 然而,把"send_charset"设置为"us-ascii::utf-8"也是一个不错的主意。 |
148 | 153 | ||
149 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 154 | Mutt 是高度可配置的。 这里是个使用mutt通过 Gmail 发送的补丁的最小配置:: |
155 | |||
156 | # .muttrc | ||
157 | # ================ IMAP ==================== | ||
158 | set imap_user = 'yourusername@gmail.com' | ||
159 | set imap_pass = 'yourpassword' | ||
160 | set spoolfile = imaps://imap.gmail.com/INBOX | ||
161 | set folder = imaps://imap.gmail.com/ | ||
162 | set record="imaps://imap.gmail.com/[Gmail]/Sent Mail" | ||
163 | set postponed="imaps://imap.gmail.com/[Gmail]/Drafts" | ||
164 | set mbox="imaps://imap.gmail.com/[Gmail]/All Mail" | ||
165 | |||
166 | # ================ SMTP ==================== | ||
167 | set smtp_url = "smtp://username@smtp.gmail.com:587/" | ||
168 | set smtp_pass = $imap_pass | ||
169 | set ssl_force_tls = yes # Require encrypted connection | ||
170 | |||
171 | # ================ Composition ==================== | ||
172 | set editor = `echo \$EDITOR` | ||
173 | set edit_headers = yes # See the headers when editing | ||
174 | set charset = UTF-8 # value of $LANG; also fallback for send_charset | ||
175 | # Sender, email address, and sign-off line must match | ||
176 | unset use_domain # because joe@localhost is just embarrassing | ||
177 | set realname = "YOUR NAME" | ||
178 | set from = "username@gmail.com" | ||
179 | set use_from = yes | ||
180 | |||
181 | Mutt文档含有更多信息: | ||
182 | |||
183 | http://dev.mutt.org/trac/wiki/UseCases/Gmail | ||
184 | |||
185 | http://dev.mutt.org/doc/manual.html | ||
186 | |||
150 | Pine (TUI) | 187 | Pine (TUI) |
188 | ~~~~~~~~~~ | ||
151 | 189 | ||
152 | Pine过去有一些空格删减问题,但是这些现在应该都被修复了。 | 190 | Pine过去有一些空格删减问题,但是这些现在应该都被修复了。 |
153 | 191 | ||
@@ -158,8 +196,8 @@ Pine过去有一些空格删减问题,但是这些现在应该都被修复了 | |||
158 | - "no-strip-whitespace-before-send"选项也是需要的。 | 196 | - "no-strip-whitespace-before-send"选项也是需要的。 |
159 | 197 | ||
160 | 198 | ||
161 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
162 | Sylpheed (GUI) | 199 | Sylpheed (GUI) |
200 | ~~~~~~~~~~~~~~ | ||
163 | 201 | ||
164 | - 内嵌文本可以很好的工作(或者使用附件)。 | 202 | - 内嵌文本可以很好的工作(或者使用附件)。 |
165 | - 允许使用外部的编辑器。 | 203 | - 允许使用外部的编辑器。 |
@@ -168,8 +206,8 @@ Sylpheed (GUI) | |||
168 | - 在组成窗口中有一个很有用的ruler bar。 | 206 | - 在组成窗口中有一个很有用的ruler bar。 |
169 | - 给地址本中添加地址就不会正确的了解显示名。 | 207 | - 给地址本中添加地址就不会正确的了解显示名。 |
170 | 208 | ||
171 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
172 | Thunderbird (GUI) | 209 | Thunderbird (GUI) |
210 | ~~~~~~~~~~~~~~~~~ | ||
173 | 211 | ||
174 | 默认情况下,thunderbird很容易损坏文本,但是还有一些方法可以强制它变得更好。 | 212 | 默认情况下,thunderbird很容易损坏文本,但是还有一些方法可以强制它变得更好。 |
175 | 213 | ||
@@ -191,13 +229,13 @@ Thunderbird (GUI) | |||
191 | $EDITOR来读取或者合并补丁到文本中。要实现它,可以下载并且安装这个扩展,然后添加一个使用它的 | 229 | $EDITOR来读取或者合并补丁到文本中。要实现它,可以下载并且安装这个扩展,然后添加一个使用它的 |
192 | 按键View->Toolbars->Customize...最后当你书写信息的时候仅仅点击它就可以了。 | 230 | 按键View->Toolbars->Customize...最后当你书写信息的时候仅仅点击它就可以了。 |
193 | 231 | ||
194 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
195 | TkRat (GUI) | 232 | TkRat (GUI) |
233 | ~~~~~~~~~~~ | ||
196 | 234 | ||
197 | 可以使用它。使用"Insert file..."或者外部的编辑器。 | 235 | 可以使用它。使用"Insert file..."或者外部的编辑器。 |
198 | 236 | ||
199 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
200 | Gmail (Web GUI) | 237 | Gmail (Web GUI) |
238 | ~~~~~~~~~~~~~~~ | ||
201 | 239 | ||
202 | 不要使用它发送补丁。 | 240 | 不要使用它发送补丁。 |
203 | 241 | ||
diff --git a/Documentation/translations/zh_CN/HOWTO b/Documentation/translations/zh_CN/process/howto.rst index 7a00a8a4eb15..5b671178b17b 100644 --- a/Documentation/translations/zh_CN/HOWTO +++ b/Documentation/translations/zh_CN/process/howto.rst | |||
@@ -1,32 +1,22 @@ | |||
1 | Chinese translated version of Documentation/process/howto.rst | 1 | .. _cn_process_howto: |
2 | 2 | ||
3 | If you have any comment or update to the content, please contact the | 3 | .. include:: ../disclaimer-zh_CN.rst |
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | 4 | ||
9 | Maintainer: Greg Kroah-Hartman <greg@kroah.com> | 5 | :Original: :ref:`Documentation/process/howto.rst <process_howto>` |
10 | Chinese maintainer: Li Yang <leoli@freescale.com> | ||
11 | --------------------------------------------------------------------- | ||
12 | Documentation/process/howto.rst 的中文翻译 | ||
13 | 6 | ||
14 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | 7 | 译者:: |
15 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
16 | 译存在问题,请联系中文版维护者。 | ||
17 | 8 | ||
18 | 英文版维护者: Greg Kroah-Hartman <greg@kroah.com> | 9 | 英文版维护者: Greg Kroah-Hartman <greg@kroah.com> |
19 | 中文版维护者: 李阳 Li Yang <leoli@freescale.com> | 10 | 中文版维护者: 李阳 Li Yang <leoyang.li@nxp.com> |
20 | 中文版翻译者: 李阳 Li Yang <leoli@freescale.com> | 11 | 中文版翻译者: 李阳 Li Yang <leoyang.li@nxp.com> |
21 | 中文版校译者: 钟宇 TripleX Chung <xxx.phy@gmail.com> | 12 | 时奎亮 Alex Shi <alex.shi@linux.alibaba.com> |
22 | 陈琦 Maggie Chen <chenqi@beyondsoft.com> | 13 | 中文版校译者: |
23 | 王聪 Wang Cong <xiyou.wangcong@gmail.com> | 14 | 钟宇 TripleX Chung <xxx.phy@gmail.com> |
24 | 15 | 陈琦 Maggie Chen <chenqi@beyondsoft.com> | |
25 | 以下为正文 | 16 | 王聪 Wang Cong <xiyou.wangcong@gmail.com> |
26 | --------------------------------------------------------------------- | ||
27 | 17 | ||
28 | 如何参与Linux内核开发 | 18 | 如何参与Linux内核开发 |
29 | --------------------- | 19 | ===================== |
30 | 20 | ||
31 | 这是一篇将如何参与Linux内核开发的相关问题一网打尽的终极秘笈。它将指导你 | 21 | 这是一篇将如何参与Linux内核开发的相关问题一网打尽的终极秘笈。它将指导你 |
32 | 成为一名Linux内核开发者,并且学会如何同Linux内核开发社区合作。它尽可能不 | 22 | 成为一名Linux内核开发者,并且学会如何同Linux内核开发社区合作。它尽可能不 |
@@ -47,6 +37,7 @@ Linux内核大部分是由C语言写成的,一些体系结构相关的代码 | |||
47 | 参与内核开发,你必须精通C语言。除非你想为某个架构开发底层代码,否则你并 | 37 | 参与内核开发,你必须精通C语言。除非你想为某个架构开发底层代码,否则你并 |
48 | 不需要了解(任何体系结构的)汇编语言。下面列举的书籍虽然不能替代扎实的C | 38 | 不需要了解(任何体系结构的)汇编语言。下面列举的书籍虽然不能替代扎实的C |
49 | 语言教育和多年的开发经验,但如果需要的话,做为参考还是不错的: | 39 | 语言教育和多年的开发经验,但如果需要的话,做为参考还是不错的: |
40 | |||
50 | - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall] | 41 | - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall] |
51 | 《C程序设计语言(第2版·新版)》(徐宝文 李志 译)[机械工业出版社] | 42 | 《C程序设计语言(第2版·新版)》(徐宝文 李志 译)[机械工业出版社] |
52 | - "Practical C Programming" by Steve Oualline [O'Reilly] | 43 | - "Practical C Programming" by Steve Oualline [O'Reilly] |
@@ -71,9 +62,11 @@ Linux内核使用GNU C和GNU工具链开发。虽然它遵循ISO C89标准,但 | |||
71 | -------- | 62 | -------- |
72 | 63 | ||
73 | Linux内核源代码都是在GPL(通用公共许可证)的保护下发布的。要了解这种许可 | 64 | Linux内核源代码都是在GPL(通用公共许可证)的保护下发布的。要了解这种许可 |
74 | 的细节请查看源代码主目录下的COPYING文件。如果你对它还有更深入问题请联系 | 65 | 的细节请查看源代码主目录下的COPYING文件。Linux内核许可准则和如何使用 |
75 | 律师,而不要在Linux内核邮件组上提问。因为邮件组里的人并不是律师,不要期 | 66 | `SPDX <https://spdx.org/>` 标志符说明在这个文件中 |
76 | 望他们的话有法律效力。 | 67 | :ref:`Documentation/translations/zh_CN/process/license-rules.rst <cn_kernel_licensing>` |
68 | 如果你对它还有更深入问题请联系律师,而不要在Linux内核邮件组上提问。因为 | ||
69 | 邮件组里的人并不是律师,不要期望他们的话有法律效力。 | ||
77 | 70 | ||
78 | 对于GPL的常见问题和解答,请访问以下链接: | 71 | 对于GPL的常见问题和解答,请访问以下链接: |
79 | http://www.gnu.org/licenses/gpl-faq.html | 72 | http://www.gnu.org/licenses/gpl-faq.html |
@@ -89,65 +82,75 @@ Linux内核代码中包含有大量的文档。这些文档对于学习如何与 | |||
89 | 的维护者解释这些变化。 | 82 | 的维护者解释这些变化。 |
90 | 83 | ||
91 | 以下是内核代码中需要阅读的文档: | 84 | 以下是内核代码中需要阅读的文档: |
92 | README | 85 | :ref:`Documentation/admin-guide/README.rst <readme>` |
93 | 文件简要介绍了Linux内核的背景,并且描述了如何配置和编译内核。内核的 | 86 | 文件简要介绍了Linux内核的背景,并且描述了如何配置和编译内核。内核的 |
94 | 新用户应该从这里开始。 | 87 | 新用户应该从这里开始。 |
95 | 88 | ||
96 | Documentation/process/changes.rst | 89 | |
90 | :ref:`Documentation/process/changes.rst <changes>` | ||
97 | 文件给出了用来编译和使用内核所需要的最小软件包列表。 | 91 | 文件给出了用来编译和使用内核所需要的最小软件包列表。 |
98 | 92 | ||
99 | Documentation/process/coding-style.rst | 93 | :ref:`Documentation/translations/zh_CN/process/coding-style.rst <cn_codingstyle>` |
100 | 描述Linux内核的代码风格和理由。所有新代码需要遵守这篇文档中定义的规 | 94 | 描述Linux内核的代码风格和理由。所有新代码需要遵守这篇文档中定义的规 |
101 | 范。大多数维护者只会接收符合规定的补丁,很多人也只会帮忙检查符合风格 | 95 | 范。大多数维护者只会接收符合规定的补丁,很多人也只会帮忙检查符合风格 |
102 | 的代码。 | 96 | 的代码。 |
103 | 97 | ||
104 | Documentation/process/submitting-patches.rst | 98 | :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>` |
105 | Documentation/process/submitting-drivers.rst | 99 | :ref:`Documentation/process/submitting-drivers.rst <submittingdrivers>` |
100 | |||
106 | 这两份文档明确描述如何创建和发送补丁,其中包括(但不仅限于): | 101 | 这两份文档明确描述如何创建和发送补丁,其中包括(但不仅限于): |
107 | - 邮件内容 | 102 | - 邮件内容 |
108 | - 邮件格式 | 103 | - 邮件格式 |
109 | - 选择收件人 | 104 | - 选择收件人 |
105 | |||
110 | 遵守这些规定并不能保证提交成功(因为所有补丁需要通过严格的内容和风格 | 106 | 遵守这些规定并不能保证提交成功(因为所有补丁需要通过严格的内容和风格 |
111 | 审查),但是忽视他们几乎就意味着失败。 | 107 | 审查),但是忽视他们几乎就意味着失败。 |
112 | 108 | ||
113 | 其他关于如何正确地生成补丁的优秀文档包括: | 109 | 其他关于如何正确地生成补丁的优秀文档包括: |
114 | "The Perfect Patch" | 110 | "The Perfect Patch" |
111 | |||
115 | http://www.ozlabs.org/~akpm/stuff/tpp.txt | 112 | http://www.ozlabs.org/~akpm/stuff/tpp.txt |
113 | |||
116 | "Linux kernel patch submission format" | 114 | "Linux kernel patch submission format" |
115 | |||
117 | http://linux.yyz.us/patch-format.html | 116 | http://linux.yyz.us/patch-format.html |
118 | 117 | ||
119 | Documentation/process/stable-api-nonsense.rst | 118 | :ref:`Documentation/translations/zh_CN/process/stable-api-nonsense.rst <cn_stable_api_nonsense>` |
120 | 论证内核为什么特意不包括稳定的内核内部API,也就是说不包括像这样的特 | 119 | 论证内核为什么特意不包括稳定的内核内部API,也就是说不包括像这样的特 |
121 | 性: | 120 | 性: |
121 | |||
122 | - 子系统中间层(为了兼容性?) | 122 | - 子系统中间层(为了兼容性?) |
123 | - 在不同操作系统间易于移植的驱动程序 | 123 | - 在不同操作系统间易于移植的驱动程序 |
124 | - 减缓(甚至阻止)内核代码的快速变化 | 124 | - 减缓(甚至阻止)内核代码的快速变化 |
125 | |||
125 | 这篇文档对于理解Linux的开发哲学至关重要。对于将开发平台从其他操作系 | 126 | 这篇文档对于理解Linux的开发哲学至关重要。对于将开发平台从其他操作系 |
126 | 统转移到Linux的人来说也很重要。 | 127 | 统转移到Linux的人来说也很重要。 |
127 | 128 | ||
128 | Documentation/admin-guide/security-bugs.rst | 129 | :ref:`Documentation/admin-guide/security-bugs.rst <securitybugs>` |
129 | 如果你认为自己发现了Linux内核的安全性问题,请根据这篇文档中的步骤来 | 130 | 如果你认为自己发现了Linux内核的安全性问题,请根据这篇文档中的步骤来 |
130 | 提醒其他内核开发者并帮助解决这个问题。 | 131 | 提醒其他内核开发者并帮助解决这个问题。 |
131 | 132 | ||
132 | Documentation/process/management-style.rst | 133 | :ref:`Documentation/translations/zh_CN/process/management-style.rst <cn_managementstyle>` |
134 | |||
133 | 描述内核维护者的工作方法及其共有特点。这对于刚刚接触内核开发(或者对 | 135 | 描述内核维护者的工作方法及其共有特点。这对于刚刚接触内核开发(或者对 |
134 | 它感到好奇)的人来说很重要,因为它解释了很多对于内核维护者独特行为的 | 136 | 它感到好奇)的人来说很重要,因为它解释了很多对于内核维护者独特行为的 |
135 | 普遍误解与迷惑。 | 137 | 普遍误解与迷惑。 |
136 | 138 | ||
137 | Documentation/process/stable-kernel-rules.rst | 139 | :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` |
138 | 解释了稳定版内核发布的规则,以及如何将改动放入这些版本的步骤。 | 140 | 解释了稳定版内核发布的规则,以及如何将改动放入这些版本的步骤。 |
139 | 141 | ||
140 | Documentation/process/kernel-docs.rst | 142 | :ref:`Documentation/process/kernel-docs.rst <kernel_docs>` |
141 | 有助于内核开发的外部文档列表。如果你在内核自带的文档中没有找到你想找 | 143 | 有助于内核开发的外部文档列表。如果你在内核自带的文档中没有找到你想找 |
142 | 的内容,可以查看这些文档。 | 144 | 的内容,可以查看这些文档。 |
143 | 145 | ||
144 | Documentation/process/applying-patches.rst | 146 | :ref:`Documentation/process/applying-patches.rst <applying_patches>` |
145 | 关于补丁是什么以及如何将它打在不同内核开发分支上的好介绍 | 147 | 关于补丁是什么以及如何将它打在不同内核开发分支上的好介绍 |
146 | 148 | ||
147 | 内核还拥有大量从代码自动生成的文档。它包含内核内部API的全面介绍以及如何 | 149 | 内核还拥有大量从代码自动生成的文档。它包含内核内部API的全面介绍以及如何 |
148 | 妥善处理加锁的规则。生成的文档会放在 Documentation/DocBook/目录下。在内 | 150 | 妥善处理加锁的规则。生成的文档会放在 Documentation/DocBook/目录下。在内 |
149 | 核源码的主目录中使用以下不同命令将会分别生成PDF、Postscript、HTML和手册 | 151 | 核源码的主目录中使用以下不同命令将会分别生成PDF、Postscript、HTML和手册 |
150 | 页等不同格式的文档: | 152 | 页等不同格式的文档:: |
153 | |||
151 | make pdfdocs | 154 | make pdfdocs |
152 | make htmldocs | 155 | make htmldocs |
153 | 156 | ||
@@ -155,7 +158,9 @@ Linux内核代码中包含有大量的文档。这些文档对于学习如何与 | |||
155 | 如何成为内核开发者 | 158 | 如何成为内核开发者 |
156 | ------------------ | 159 | ------------------ |
157 | 如果你对Linux内核开发一无所知,你应该访问“Linux内核新手”计划: | 160 | 如果你对Linux内核开发一无所知,你应该访问“Linux内核新手”计划: |
161 | |||
158 | http://kernelnewbies.org | 162 | http://kernelnewbies.org |
163 | |||
159 | 它拥有一个可以问各种最基本的内核开发问题的邮件列表(在提问之前一定要记得 | 164 | 它拥有一个可以问各种最基本的内核开发问题的邮件列表(在提问之前一定要记得 |
160 | 查找已往的邮件,确认是否有人已经回答过相同的问题)。它还拥有一个可以获得 | 165 | 查找已往的邮件,确认是否有人已经回答过相同的问题)。它还拥有一个可以获得 |
161 | 实时反馈的IRC聊天频道,以及大量对于学习Linux内核开发相当有帮助的文档。 | 166 | 实时反馈的IRC聊天频道,以及大量对于学习Linux内核开发相当有帮助的文档。 |
@@ -166,23 +171,21 @@ Linux内核代码中包含有大量的文档。这些文档对于学习如何与 | |||
166 | 171 | ||
167 | 如果你想加入内核开发社区并协助完成一些任务,却找不到从哪里开始,可以访问 | 172 | 如果你想加入内核开发社区并协助完成一些任务,却找不到从哪里开始,可以访问 |
168 | “Linux内核房管员”计划: | 173 | “Linux内核房管员”计划: |
174 | |||
169 | http://kernelnewbies.org/KernelJanitors | 175 | http://kernelnewbies.org/KernelJanitors |
176 | |||
170 | 这是极佳的起点。它提供一个相对简单的任务列表,列出内核代码中需要被重新 | 177 | 这是极佳的起点。它提供一个相对简单的任务列表,列出内核代码中需要被重新 |
171 | 整理或者改正的地方。通过和负责这个计划的开发者们一同工作,你会学到将补丁 | 178 | 整理或者改正的地方。通过和负责这个计划的开发者们一同工作,你会学到将补丁 |
172 | 集成进内核的基本原理。如果还没有决定下一步要做什么的话,你还可能会得到方 | 179 | 集成进内核的基本原理。如果还没有决定下一步要做什么的话,你还可能会得到方 |
173 | 向性的指点。 | 180 | 向性的指点。 |
174 | 181 | ||
175 | 如果你已经有一些现成的代码想要放到内核中,但是需要一些帮助来使它们拥有正 | ||
176 | 确的格式。请访问“内核导师”计划。这个计划就是用来帮助你完成这个目标的。它 | ||
177 | 是一个邮件列表,地址如下: | ||
178 | http://selenic.com/mailman/listinfo/kernel-mentors | ||
179 | |||
180 | 在真正动手修改内核代码之前,理解要修改的代码如何运作是必需的。要达到这个 | 182 | 在真正动手修改内核代码之前,理解要修改的代码如何运作是必需的。要达到这个 |
181 | 目的,没什么办法比直接读代码更有效了(大多数花招都会有相应的注释),而且 | 183 | 目的,没什么办法比直接读代码更有效了(大多数花招都会有相应的注释),而且 |
182 | 一些特制的工具还可以提供帮助。例如,“Linux代码交叉引用”项目就是一个值得 | 184 | 一些特制的工具还可以提供帮助。例如,“Linux代码交叉引用”项目就是一个值得 |
183 | 特别推荐的帮助工具,它将源代码显示在有编目和索引的网页上。其中一个更新及 | 185 | 特别推荐的帮助工具,它将源代码显示在有编目和索引的网页上。其中一个更新及 |
184 | 时的内核源码库,可以通过以下地址访问: | 186 | 时的内核源码库,可以通过以下地址访问: |
185 | http://sosdg.org/~coywolf/lxr/ | 187 | |
188 | https://elixir.bootlin.com/ | ||
186 | 189 | ||
187 | 190 | ||
188 | 开发流程 | 191 | 开发流程 |
@@ -190,22 +193,23 @@ Linux内核代码中包含有大量的文档。这些文档对于学习如何与 | |||
190 | 193 | ||
191 | 目前Linux内核开发流程包括几个“主内核分支”和很多子系统相关的内核分支。这 | 194 | 目前Linux内核开发流程包括几个“主内核分支”和很多子系统相关的内核分支。这 |
192 | 些分支包括: | 195 | 些分支包括: |
193 | - 2.6.x主内核源码树 | ||
194 | - 2.6.x.y -stable内核源码树 | ||
195 | - 2.6.x -mm内核补丁集 | ||
196 | - 子系统相关的内核源码树和补丁集 | ||
197 | 196 | ||
197 | - Linus 的内核源码树 | ||
198 | - 多个主要版本的稳定版内核树 | ||
199 | - 子系统相关的内核树 | ||
200 | - linux-next 集成测试树 | ||
201 | |||
202 | |||
203 | 主线树 | ||
204 | ------ | ||
205 | 主线树是由Linus Torvalds 维护的。你可以在https://kernel.org 网站或者代码 | ||
206 | 库中下找到它。它的开发遵循以下步骤: | ||
198 | 207 | ||
199 | 2.6.x内核主源码树 | ||
200 | ----------------- | ||
201 | 2.6.x内核是由Linus Torvalds(Linux的创造者)亲自维护的。你可以在 | ||
202 | kernel.org网站的pub/linux/kernel/v2.6/目录下找到它。它的开发遵循以下步 | ||
203 | 骤: | ||
204 | - 每当一个新版本的内核被发布,为期两周的集成窗口将被打开。在这段时间里 | 208 | - 每当一个新版本的内核被发布,为期两周的集成窗口将被打开。在这段时间里 |
205 | 维护者可以向Linus提交大段的修改,通常这些修改已经被放到-mm内核中几个 | 209 | 维护者可以向Linus提交大段的修改,通常这些修改已经被放到-mm内核中几个 |
206 | 星期了。提交大量修改的首选方式是使用git工具(内核的代码版本管理工具 | 210 | 星期了。提交大量修改的首选方式是使用git工具(内核的代码版本管理工具 |
207 | ,更多的信息可以在http://git-scm.com/获取),不过使用普通补丁也是可以 | 211 | ,更多的信息可以在 http://git-scm.com/ 获取),不过使用普通补丁也是 |
208 | 的。 | 212 | 可以的。 |
209 | - 两个星期以后-rc1版本内核发布。之后只有不包含可能影响整个内核稳定性的 | 213 | - 两个星期以后-rc1版本内核发布。之后只有不包含可能影响整个内核稳定性的 |
210 | 新功能的补丁才可能被接受。请注意一个全新的驱动程序(或者文件系统)有 | 214 | 新功能的补丁才可能被接受。请注意一个全新的驱动程序(或者文件系统)有 |
211 | 可能在-rc1后被接受是因为这样的修改完全独立,不会影响其他的代码,所以 | 215 | 可能在-rc1后被接受是因为这样的修改完全独立,不会影响其他的代码,所以 |
@@ -220,106 +224,61 @@ kernel.org网站的pub/linux/kernel/v2.6/目录下找到它。它的开发遵循 | |||
220 | “没有人知道新内核何时会被发布,因为发布是根据已知bug的情况来决定 | 224 | “没有人知道新内核何时会被发布,因为发布是根据已知bug的情况来决定 |
221 | 的,而不是根据一个事先制定好的时间表。” | 225 | 的,而不是根据一个事先制定好的时间表。” |
222 | 226 | ||
227 | 子系统特定树 | ||
228 | ------------ | ||
223 | 229 | ||
224 | 2.6.x.y -stable(稳定版)内核源码树 | 230 | 各种内核子系统的维护者——以及许多内核子系统开发人员——在源代码库中公开了他们 |
225 | ----------------------------------- | 231 | 当前的开发状态。这样,其他人就可以看到内核的不同区域发生了什么。在开发速度 |
226 | 由4个数字组成的内核版本号说明此内核是-stable版本。它们包含基于2.6.x版本 | 232 | 很快的领域,可能会要求开发人员将提交的内容建立在这样的子系统内核树上,这样 |
227 | 内核的相对较小且至关重要的修补,这些修补针对安全性问题或者严重的内核退步。 | 233 | 就避免了提交与其他已经进行的工作之间的冲突。 |
228 | |||
229 | 这种版本的内核适用于那些期望获得最新的稳定版内核并且不想参与测试开发版或 | ||
230 | 者实验版的用户。 | ||
231 | |||
232 | 如果没有2.6.x.y版本内核存在,那么最新的2.6.x版本内核就相当于是当前的稳定 | ||
233 | 版内核。 | ||
234 | |||
235 | 2.6.x.y版本由“稳定版”小组(邮件地址<stable@vger.kernel.org>)维护,一般隔周发 | ||
236 | 布新版本。 | ||
237 | |||
238 | 内核源码中的Documentation/process/stable-kernel-rules.rst文件具体描述了可被稳定 | ||
239 | 版内核接受的修改类型以及发布的流程。 | ||
240 | 234 | ||
235 | 这些存储库中的大多数都是Git树,但是也有其他的scm在使用,或者补丁队列被发布 | ||
236 | 为Quilt系列。这些子系统存储库的地址列在MAINTAINERS文件中。其中许多可以在 | ||
237 | https://git.kernel.org/上浏览。 | ||
241 | 238 | ||
242 | 2.6.x -mm补丁集 | 239 | 在将一个建议的补丁提交到这样的子系统树之前,需要对它进行审查,审查主要发生 |
243 | --------------- | 240 | 在邮件列表上(请参见下面相应的部分)。对于几个内核子系统,这个审查过程是通 |
244 | 这是由Andrew Morton维护的试验性内核补丁集。Andrew将所有子系统的内核源码 | 241 | 过工具补丁跟踪的。Patchwork提供了一个Web界面,显示补丁发布、对补丁的任何评 |
245 | 和补丁拼凑到一起,并且加入了大量从linux-kernel邮件列表中采集的补丁。这个 | 242 | 论或修订,维护人员可以将补丁标记为正在审查、接受或拒绝。大多数补丁网站都列 |
246 | 源码树是新功能和补丁的试炼场。当补丁在-mm补丁集里证明了其价值以后Andrew | 243 | 在 https://patchwork.kernel.org/ |
247 | 或者相应子系统的维护者会将补丁发给Linus以便集成进主内核源码树。 | ||
248 | 244 | ||
249 | 在将所有新补丁发给Linus以集成到主内核源码树之前,我们非常鼓励先把这些补 | 245 | Linux-next 集成测试树 |
250 | 丁放在-mm版内核源码树中进行测试。 | 246 | --------------------- |
251 | |||
252 | 这些内核版本不适合在需要稳定运行的系统上运行,因为运行它们比运行任何其他 | ||
253 | 内核分支都更具有风险。 | ||
254 | |||
255 | 如果你想为内核开发进程提供帮助,请尝试并使用这些内核版本,并在 | ||
256 | linux-kernel邮件列表中提供反馈,告诉大家你遇到了问题还是一切正常。 | ||
257 | |||
258 | 通常-mm版补丁集不光包括这些额外的试验性补丁,还包括发布时-git版主源码树 | ||
259 | 中的改动。 | ||
260 | |||
261 | -mm版内核没有固定的发布周期,但是通常在每两个-rc版内核发布之间都会有若干 | ||
262 | 个-mm版内核发布(一般是1至3个)。 | ||
263 | |||
264 | |||
265 | 子系统相关内核源码树和补丁集 | ||
266 | ---------------------------- | ||
267 | 相当一部分内核子系统开发者会公开他们自己的开发源码树,以便其他人能了解内 | ||
268 | 核的不同领域正在发生的事情。如上所述,这些源码树会被集成到-mm版本内核中。 | ||
269 | |||
270 | 下面是目前可用的一些内核源码树的列表: | ||
271 | 通过git管理的源码树: | ||
272 | - Kbuild开发源码树, Sam Ravnborg <sam@ravnborg.org> | ||
273 | git.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git | ||
274 | |||
275 | - ACPI开发源码树, Len Brown <len.brown@intel.com> | ||
276 | git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git | ||
277 | |||
278 | - 块设备开发源码树, Jens Axboe <axboe@suse.de> | ||
279 | git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git | ||
280 | |||
281 | - DRM开发源码树, Dave Airlie <airlied@linux.ie> | ||
282 | git.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git | ||
283 | |||
284 | - ia64开发源码树, Tony Luck <tony.luck@intel.com> | ||
285 | git.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git | ||
286 | 247 | ||
287 | - ieee1394树, Jody McIntyre <scjody@modernduck.com> | 248 | 子系统的新并到主树之前,需要对它们进行集成测试。为此,存在一个 |
288 | git.kernel.org:/pub/scm/linux/kernel/git/scjody/ieee1394.git | 249 | 特殊的测试存储库,其中几乎每天都会提取所有子系统树: |
289 | 250 | ||
290 | - infiniband开发源码树, Roland Dreier <rolandd@cisco.com> | 251 | https://git.kernel.org/?p=linux/kernel/git/next/linux-next.git |
291 | git.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git | ||
292 | 252 | ||
293 | - libata, Jeff Garzik <jgarzik@pobox.com> | 253 | 通过这种方式,Linux-next 下个并阶段将进入主内的内容给出了一个概要 |
294 | git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git | 254 | 展望。非常欢冒险的测试者运行测试Linux-next。 |
295 | 255 | ||
296 | - 网络驱动程序开发源码树, Jeff Garzik <jgarzik@pobox.com> | 256 | 多个主要版本的稳定版内核树 |
297 | git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git | 257 | ----------------------------------- |
258 | 由3个数字组成的内核版本号说明此内核是-stable版本。它们包含内核的相对较小且 | ||
259 | 至关重要的修补,这些修补针对安全性问题或者严重的内核退步。 | ||
298 | 260 | ||
299 | - pcmcia树, Dominik Brodowski <linux@dominikbrodowski.net> | 261 | 这种版本的核用于那些期望获新稳定版内并且不想参与测试开版或 |
300 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git | 262 | 者实验版的用户。 |
301 | 263 | ||
302 | - SCSI树, James Bottomley <James.Bottomley@SteelEye.com> | 264 | 稳版树版本由“稳定版”小组(邮件地址<stable@vger.kernel.org>)维护,一般 |
303 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git | 265 | 隔周发布新版本。 |
304 | 266 | ||
305 | 使用quilt管理的补丁集: | 267 | 内核源码中的 :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` |
306 | - USB, PCI, 驱动程序核心和I2C, Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 268 | 文件具体描述了可被稳定版内核接受的修改类型以及发布的流程。 |
307 | kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ | ||
308 | - x86-64, 部分i386, Andi Kleen <ak@suse.de> | ||
309 | ftp.firstfloor.org:/pub/ak/x86_64/quilt/ | ||
310 | 269 | ||
311 | 其他内核源码树可以在http://git.kernel.org的列表中和MAINTAINERS文件里 | ||
312 | 找到。 | ||
313 | 270 | ||
314 | 报告bug | 271 | 报告bug |
315 | ------- | 272 | ------- |
316 | 273 | ||
317 | bugzilla.kernel.org是Linux内核开发者们用来跟踪内核Bug的网站。我们鼓励用 | 274 | bugzilla.kernel.org是Linux内核开发者们用来跟踪内核Bug的网站。我们鼓励用 |
318 | 户在这个工具中报告找到的所有bug。如何使用内核bugzilla的细节请访问: | 275 | 户在这个工具中报告找到的所有bug。如何使用内核bugzilla的细节请访问: |
276 | |||
319 | http://test.kernel.org/bugzilla/faq.html | 277 | http://test.kernel.org/bugzilla/faq.html |
320 | 278 | ||
321 | 内核源码主目录中的admin-guide/reporting-bugs.rst文件里有一个很好的模板。它指导用户如何报 | 279 | 内核源码主目录中的:ref:`admin-guide/reporting-bugs.rst <reportingbugs>` |
322 | 告可能的内核bug以及需要提供哪些信息来帮助内核开发者们找到问题的根源。 | 280 | 文件里有一个很好的模板。它指导用户如何报告可能的内核bug以及需要提供哪些信息 |
281 | 来帮助内核开发者们找到问题的根源。 | ||
323 | 282 | ||
324 | 283 | ||
325 | 利用bug报告 | 284 | 利用bug报告 |
@@ -330,12 +289,7 @@ bugzilla.kernel.org是Linux内核开发者们用来跟踪内核Bug的网站。 | |||
330 | 者感受到你的存在。修改bug是赢得其他开发者赞誉的最好办法,因为并不是很多 | 289 | 者感受到你的存在。修改bug是赢得其他开发者赞誉的最好办法,因为并不是很多 |
331 | 人都喜欢浪费时间去修改别人报告的bug。 | 290 | 人都喜欢浪费时间去修改别人报告的bug。 |
332 | 291 | ||
333 | 要尝试修改已知的bug,请访问http://bugzilla.kernel.org网址。如果你想获得 | 292 | 要尝试修改已知的bug,请访问 http://bugzilla.kernel.org 网址。 |
334 | 最新bug的通知,可以订阅bugme-new邮件列表(只有新的bug报告会被寄到这里) | ||
335 | 或者订阅bugme-janitor邮件列表(所有bugzilla的变动都会被寄到这里)。 | ||
336 | |||
337 | https://lists.linux-foundation.org/mailman/listinfo/bugme-new | ||
338 | https://lists.linux-foundation.org/mailman/listinfo/bugme-janitors | ||
339 | 293 | ||
340 | 294 | ||
341 | 邮件列表 | 295 | 邮件列表 |
@@ -343,10 +297,14 @@ bugzilla.kernel.org是Linux内核开发者们用来跟踪内核Bug的网站。 | |||
343 | 297 | ||
344 | 正如上面的文档所描述,大多数的骨干内核开发者都加入了Linux Kernel邮件列 | 298 | 正如上面的文档所描述,大多数的骨干内核开发者都加入了Linux Kernel邮件列 |
345 | 表。如何订阅和退订列表的细节可以在这里找到: | 299 | 表。如何订阅和退订列表的细节可以在这里找到: |
300 | |||
346 | http://vger.kernel.org/vger-lists.html#linux-kernel | 301 | http://vger.kernel.org/vger-lists.html#linux-kernel |
302 | |||
347 | 网上很多地方都有这个邮件列表的存档(archive)。可以使用搜索引擎来找到这些 | 303 | 网上很多地方都有这个邮件列表的存档(archive)。可以使用搜索引擎来找到这些 |
348 | 存档。比如: | 304 | 存档。比如: |
305 | |||
349 | http://dir.gmane.org/gmane.linux.kernel | 306 | http://dir.gmane.org/gmane.linux.kernel |
307 | |||
350 | 在发信之前,我们强烈建议你先在存档中搜索你想要讨论的问题。很多已经被详细 | 308 | 在发信之前,我们强烈建议你先在存档中搜索你想要讨论的问题。很多已经被详细 |
351 | 讨论过的问题只在邮件列表的存档中可以找到。 | 309 | 讨论过的问题只在邮件列表的存档中可以找到。 |
352 | 310 | ||
@@ -354,10 +312,12 @@ bugzilla.kernel.org是Linux内核开发者们用来跟踪内核Bug的网站。 | |||
354 | MAINTAINERS文件中可以找到不同话题对应的邮件列表。 | 312 | MAINTAINERS文件中可以找到不同话题对应的邮件列表。 |
355 | 313 | ||
356 | 很多邮件列表架设在kernel.org服务器上。这些列表的信息可以在这里找到: | 314 | 很多邮件列表架设在kernel.org服务器上。这些列表的信息可以在这里找到: |
315 | |||
357 | http://vger.kernel.org/vger-lists.html | 316 | http://vger.kernel.org/vger-lists.html |
358 | 317 | ||
359 | 在使用这些邮件列表时,请记住保持良好的行为习惯。下面的链接提供了与这些列 | 318 | 在使用这些邮件列表时,请记住保持良好的行为习惯。下面的链接提供了与这些列 |
360 | 表(或任何其它邮件列表)交流的一些简单规则,虽然内容有点滥竽充数。 | 319 | 表(或任何其它邮件列表)交流的一些简单规则,虽然内容有点滥竽充数。 |
320 | |||
361 | http://www.albion.com/netiquette/ | 321 | http://www.albion.com/netiquette/ |
362 | 322 | ||
363 | 当有很多人回复你的邮件时,邮件的抄送列表会变得很长。请不要将任何人从抄送 | 323 | 当有很多人回复你的邮件时,邮件的抄送列表会变得很长。请不要将任何人从抄送 |
@@ -369,11 +329,12 @@ MAINTAINERS文件中可以找到不同话题对应的邮件列表。 | |||
369 | 这几行。将你的评论加在被引用的段落之间而不要放在邮件的顶部。 | 329 | 这几行。将你的评论加在被引用的段落之间而不要放在邮件的顶部。 |
370 | 330 | ||
371 | 如果你在邮件中附带补丁,请确认它们是可以直接阅读的纯文本(如 | 331 | 如果你在邮件中附带补丁,请确认它们是可以直接阅读的纯文本(如 |
372 | Documentation/process/submitting-patches.rst文档中所述)。内核开发者们不希望遇到附件 | 332 | :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>` |
373 | 或者被压缩了的补丁。只有这样才能保证他们可以直接评论你的每行代码。请确保 | 333 | 文档中所述)。内核开发者们不希望遇到附件或者被压缩了的补丁。只有这样才能 |
374 | 你使用的邮件发送程序不会修改空格和制表符。一个防范性的测试方法是先将邮件 | 334 | 保证他们可以直接评论你的每行代码。请确保你使用的邮件发送程序不会修改空格 |
375 | 发送给自己,然后自己尝试是否可以顺利地打上收到的补丁。如果测试不成功,请 | 335 | 和制表符。一个防范性的测试方法是先将邮件发送给自己,然后自己尝试是否可以 |
376 | 调整或者更换你的邮件发送程序直到它正确工作为止。 | 336 | 顺利地打上收到的补丁。如果测试不成功,请调整或者更换你的邮件发送程序直到 |
337 | 它正确工作为止。 | ||
377 | 338 | ||
378 | 总而言之,请尊重其他的邮件列表订阅者。 | 339 | 总而言之,请尊重其他的邮件列表订阅者。 |
379 | 340 | ||
@@ -383,6 +344,7 @@ Documentation/process/submitting-patches.rst文档中所述)。内核开发者 | |||
383 | 344 | ||
384 | 内核社区的目标就是提供尽善尽美的内核。所以当你提交补丁期望被接受进内核的 | 345 | 内核社区的目标就是提供尽善尽美的内核。所以当你提交补丁期望被接受进内核的 |
385 | 时候,它的技术价值以及其他方面都将被评审。那么你可能会得到什么呢? | 346 | 时候,它的技术价值以及其他方面都将被评审。那么你可能会得到什么呢? |
347 | |||
386 | - 批评 | 348 | - 批评 |
387 | - 评论 | 349 | - 评论 |
388 | - 要求修改 | 350 | - 要求修改 |
@@ -395,6 +357,7 @@ Documentation/process/submitting-patches.rst文档中所述)。内核开发者 | |||
395 | 没在茫茫信海中。 | 357 | 没在茫茫信海中。 |
396 | 358 | ||
397 | 你不应该做的事情: | 359 | 你不应该做的事情: |
360 | |||
398 | - 期望自己的补丁不受任何质疑就直接被接受 | 361 | - 期望自己的补丁不受任何质疑就直接被接受 |
399 | - 翻脸 | 362 | - 翻脸 |
400 | - 忽略别人的评论 | 363 | - 忽略别人的评论 |
@@ -414,7 +377,8 @@ Documentation/process/submitting-patches.rst文档中所述)。内核开发者 | |||
414 | 377 | ||
415 | 内核社区的工作模式同大多数传统公司开发队伍的工作模式并不相同。下面这些例 | 378 | 内核社区的工作模式同大多数传统公司开发队伍的工作模式并不相同。下面这些例 |
416 | 子,可以帮助你避免某些可能发生问题: | 379 | 子,可以帮助你避免某些可能发生问题: |
417 | 用这些话介绍你的修改提案会有好处: | 380 | 用这些话介绍你的修改提案会有好处: |
381 | |||
418 | - 它同时解决了多个问题 | 382 | - 它同时解决了多个问题 |
419 | - 它删除了2000行代码 | 383 | - 它删除了2000行代码 |
420 | - 这是补丁,它已经解释了我想要说明的 | 384 | - 这是补丁,它已经解释了我想要说明的 |
@@ -422,7 +386,8 @@ Documentation/process/submitting-patches.rst文档中所述)。内核开发者 | |||
422 | - 这是一系列小补丁用来…… | 386 | - 这是一系列小补丁用来…… |
423 | - 这个修改提高了普通机器的性能…… | 387 | - 这个修改提高了普通机器的性能…… |
424 | 388 | ||
425 | 应该避免如下的说法: | 389 | 应该避免如下的说法: |
390 | |||
426 | - 我们在AIX/ptx/Solaris就是这么做的,所以这么做肯定是好的…… | 391 | - 我们在AIX/ptx/Solaris就是这么做的,所以这么做肯定是好的…… |
427 | - 我做这行已经20年了,所以…… | 392 | - 我做这行已经20年了,所以…… |
428 | - 为了我们公司赚钱考虑必须这么做 | 393 | - 为了我们公司赚钱考虑必须这么做 |
@@ -495,6 +460,7 @@ Linux内核社区并不喜欢一下接收大段的代码。修改需要被恰当 | |||
495 | 当你发送补丁的时候,需要特别留意邮件正文的内容。因为这里的信息将会做为补 | 460 | 当你发送补丁的时候,需要特别留意邮件正文的内容。因为这里的信息将会做为补 |
496 | 丁的修改记录(ChangeLog),会被一直保留以备大家查阅。它需要完全地描述补丁, | 461 | 丁的修改记录(ChangeLog),会被一直保留以备大家查阅。它需要完全地描述补丁, |
497 | 包括: | 462 | 包括: |
463 | |||
498 | - 为什么需要这个修改 | 464 | - 为什么需要这个修改 |
499 | - 补丁的总体设计 | 465 | - 补丁的总体设计 |
500 | - 实现细节 | 466 | - 实现细节 |
@@ -510,7 +476,8 @@ Linux内核社区并不喜欢一下接收大段的代码。修改需要被恰当 | |||
510 | 很多人已经做到了,而他们都曾经和现在的你站在同样的起点上。 | 476 | 很多人已经做到了,而他们都曾经和现在的你站在同样的起点上。 |
511 | 477 | ||
512 | 478 | ||
513 | --------------- | 479 | 感谢 |
480 | ---- | ||
514 | 感谢Paolo Ciarrocchi允许“开发流程”部分基于他所写的文章 | 481 | 感谢Paolo Ciarrocchi允许“开发流程”部分基于他所写的文章 |
515 | (http://www.kerneltravel.net/newbie/2.6-development_process),感谢Randy | 482 | (http://www.kerneltravel.net/newbie/2.6-development_process),感谢Randy |
516 | Dunlap和Gerrit Huizenga完善了应该说和不该说的列表。感谢Pat Mochel, Hanna | 483 | Dunlap和Gerrit Huizenga完善了应该说和不该说的列表。感谢Pat Mochel, Hanna |
diff --git a/Documentation/translations/zh_CN/process/index.rst b/Documentation/translations/zh_CN/process/index.rst new file mode 100644 index 000000000000..be1e764a80d2 --- /dev/null +++ b/Documentation/translations/zh_CN/process/index.rst | |||
@@ -0,0 +1,60 @@ | |||
1 | .. raw:: latex | ||
2 | |||
3 | \renewcommand\thesection* | ||
4 | \renewcommand\thesubsection* | ||
5 | |||
6 | .. include:: ../disclaimer-zh_CN.rst | ||
7 | |||
8 | :Original: :ref:`Documentation/process/index.rst <process_index>` | ||
9 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
10 | |||
11 | .. _cn_process_index: | ||
12 | |||
13 | 与Linux 内核社区一起工作 | ||
14 | ======================== | ||
15 | |||
16 | 那么你想成为Linux内核开发人员? 欢迎! 不但从技术意义上讲有很多关于内核的知识 | ||
17 | 需要学,而且了解我们社区的工作方式也很重要。 阅读这些文章可以让您以更轻松地, | ||
18 | 麻烦最少的方式将更改合并到内核。 | ||
19 | |||
20 | 以下是每位开发人员应阅读的基本指南。 | ||
21 | |||
22 | .. toctree:: | ||
23 | :maxdepth: 1 | ||
24 | |||
25 | howto | ||
26 | code-of-conduct | ||
27 | code-of-conduct-interpretation | ||
28 | submitting-patches | ||
29 | programming-language | ||
30 | coding-style | ||
31 | development-process | ||
32 | email-clients | ||
33 | license-rules | ||
34 | |||
35 | 其它大多数开发人员感兴趣的社区指南: | ||
36 | |||
37 | |||
38 | .. toctree:: | ||
39 | :maxdepth: 1 | ||
40 | |||
41 | submitting-drivers | ||
42 | submit-checklist | ||
43 | stable-api-nonsense | ||
44 | stable-kernel-rules | ||
45 | management-style | ||
46 | |||
47 | 这些是一些总体技术指南,由于缺乏更好的地方,现在已经放在这里 | ||
48 | |||
49 | .. toctree:: | ||
50 | :maxdepth: 1 | ||
51 | |||
52 | magic-number | ||
53 | volatile-considered-harmful | ||
54 | |||
55 | .. only:: subproject and html | ||
56 | |||
57 | 目录 | ||
58 | ==== | ||
59 | |||
60 | * :ref:`genindex` | ||
diff --git a/Documentation/translations/zh_CN/process/license-rules.rst b/Documentation/translations/zh_CN/process/license-rules.rst new file mode 100644 index 000000000000..30c272b2a292 --- /dev/null +++ b/Documentation/translations/zh_CN/process/license-rules.rst | |||
@@ -0,0 +1,370 @@ | |||
1 | .. SPDX-License-Identifier: GPL-2.0 | ||
2 | |||
3 | .. include:: ../disclaimer-zh_CN.rst | ||
4 | |||
5 | :Original: :ref:`Documentation/process/license-rules.rst <kernel_licensing>` | ||
6 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
7 | |||
8 | .. _cn_kernel_licensing: | ||
9 | |||
10 | Linux内核许可规则 | ||
11 | ================= | ||
12 | |||
13 | Linux内核根据LICENSES/preferred/GPL-2.0中提供的GNU通用公共许可证版本2 | ||
14 | (GPL-2.0)的条款提供,并在LICENSES/exceptions/Linux-syscall-note中显式 | ||
15 | 描述了例外的系统调用,如COPYING文件中所述。 | ||
16 | |||
17 | 此文档文件提供了如何对每个源文件进行注释以使其许可证清晰明确的说明。 | ||
18 | 它不会取代内核的许可证。 | ||
19 | |||
20 | 内核源代码作为一个整体适用于COPYING文件中描述的许可证,但是单个源文件可以 | ||
21 | 具有不同的与GPL-20兼容的许可证:: | ||
22 | |||
23 | GPL-1.0+ : GNU通用公共许可证v1.0或更高版本 | ||
24 | GPL-2.0+ : GNU通用公共许可证v2.0或更高版本 | ||
25 | LGPL-2.0 : 仅限GNU库通用公共许可证v2 | ||
26 | LGPL-2.0+: GNU 库通用公共许可证v2或更高版本 | ||
27 | LGPL-2.1 : 仅限GNU宽通用公共许可证v2.1 | ||
28 | LGPL-2.1+: GNU宽通用公共许可证v2.1或更高版本 | ||
29 | |||
30 | 除此之外,个人文件可以在双重许可下提供,例如一个兼容的GPL变体,或者BSD, | ||
31 | MIT等许可。 | ||
32 | |||
33 | 用户空间API(UAPI)头文件描述了用户空间程序与内核的接口,这是一种特殊情况。 | ||
34 | 根据内核COPYING文件中的注释,syscall接口是一个明确的边界,它不会将GPL要求 | ||
35 | 扩展到任何使用它与内核通信的软件。由于UAPI头文件必须包含在创建在Linux内核 | ||
36 | 上运行的可执行文件的任何源文件中,因此此例外必须记录在特别的许可证表述中。 | ||
37 | |||
38 | 表达源文件许可证的常用方法是将匹配的样板文本添加到文件的顶部注释中。由于 | ||
39 | 格式,拼写错误等,这些“样板”很难通过那些在上下文中使用的验证许可证合规性 | ||
40 | 的工具。 | ||
41 | |||
42 | 样板文本的替代方法是在每个源文件中使用软件包数据交换(SPDX)许可证标识符。 | ||
43 | SPDX许可证标识符是机器可解析的,并且是用于提供文件内容的许可证的精确缩写。 | ||
44 | SPDX许可证标识符由Linux 基金会的SPDX 工作组管理,并得到了整个行业,工具 | ||
45 | 供应商和法律团队的合作伙伴的一致同意。有关详细信息,请参阅 | ||
46 | https://spdx.org/ | ||
47 | |||
48 | Linux内核需要所有源文件中的精确SPDX标识符。内核中使用的有效标识符在 | ||
49 | `许可标识符`_ 一节中进行了解释,并且已可以在 | ||
50 | https://spdx.org/licenses/ 上的官方SPDX许可证列表中检索,并附带许可证 | ||
51 | 文本。 | ||
52 | |||
53 | 许可标识符语法 | ||
54 | -------------- | ||
55 | |||
56 | 1.安置: | ||
57 | |||
58 | 内核文件中的SPDX许可证标识符应添加到可包含注释的文件中的第一行。对于大多 | ||
59 | 数文件,这是第一行,除了那些在第一行中需要'#!PATH_TO_INTERPRETER'的脚本。 | ||
60 | 对于这些脚本,SPDX标识符进入第二行。 | ||
61 | |||
62 | | | ||
63 | |||
64 | 2. 风格: | ||
65 | |||
66 | SPDX许可证标识符以注释的形式添加。注释样式取决于文件类型:: | ||
67 | |||
68 | C source: // SPDX-License-Identifier: <SPDX License Expression> | ||
69 | C header: /* SPDX-License-Identifier: <SPDX License Expression> */ | ||
70 | ASM: /* SPDX-License-Identifier: <SPDX License Expression> */ | ||
71 | scripts: # SPDX-License-Identifier: <SPDX License Expression> | ||
72 | .rst: .. SPDX-License-Identifier: <SPDX License Expression> | ||
73 | .dts{i}: // SPDX-License-Identifier: <SPDX License Expression> | ||
74 | |||
75 | 如果特定工具无法处理标准注释样式,则应使用工具接受的相应注释机制。这是在 | ||
76 | C 头文件中使用“/\*\*/”样式注释的原因。过去在使用生成的.lds文件中观察到 | ||
77 | 构建被破坏,其中'ld'无法解析C++注释。现在已经解决了这个问题,但仍然有较 | ||
78 | 旧的汇编程序工具无法处理C++样式的注释。 | ||
79 | |||
80 | | | ||
81 | |||
82 | 3. 句法: | ||
83 | |||
84 | <SPDX许可证表达式>是SPDX许可证列表中的SPDX短格式许可证标识符,或者在许可 | ||
85 | 证例外适用时由“WITH”分隔的两个SPDX短格式许可证标识符的组合。当应用多个许 | ||
86 | 可证时,表达式由分隔子表达式的关键字“AND”,“OR”组成,并由“(”,“)”包围。 | ||
87 | |||
88 | 带有“或更高”选项的[L]GPL等许可证的许可证标识符通过使用“+”来表示“或更高” | ||
89 | 选项来构建。:: | ||
90 | |||
91 | // SPDX-License-Identifier: GPL-2.0+ | ||
92 | // SPDX-License-Identifier: LGPL-2.1+ | ||
93 | |||
94 | 当需要修正的许可证时,应使用WITH。 例如,linux内核UAPI文件使用表达式:: | ||
95 | |||
96 | // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note | ||
97 | // SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note | ||
98 | |||
99 | 其它在内核中使用WITH例外的事例如下:: | ||
100 | |||
101 | // SPDX-License-Identifier: GPL-2.0 WITH mif-exception | ||
102 | // SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0 | ||
103 | |||
104 | 例外只能与特定的许可证标识符一起使用。有效的许可证标识符列在异常文本文件 | ||
105 | 的标记中。有关详细信息,请参阅 `许可标识符`_ 一章中的 `例外`_ 。 | ||
106 | |||
107 | 如果文件是双重许可且只选择一个许可证,则应使用OR。例如,一些dtsi文件在双 | ||
108 | 许可下可用:: | ||
109 | |||
110 | // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause | ||
111 | |||
112 | 内核中双许可文件中许可表达式的示例:: | ||
113 | |||
114 | // SPDX-License-Identifier: GPL-2.0 OR MIT | ||
115 | // SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause | ||
116 | // SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 | ||
117 | // SPDX-License-Identifier: GPL-2.0 OR MPL-1.1 | ||
118 | // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT | ||
119 | // SPDX-License-Identifier: GPL-1.0+ OR BSD-3-Clause OR OpenSSL | ||
120 | |||
121 | 如果文件具有多个许可证,其条款全部适用于使用该文件,则应使用AND。例如, | ||
122 | 如果代码是从另一个项目继承的,并且已经授予了将其放入内核的权限,但原始 | ||
123 | 许可条款需要保持有效:: | ||
124 | |||
125 | // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) AND MIT | ||
126 | |||
127 | 另一个需要遵守两套许可条款的例子是:: | ||
128 | |||
129 | // SPDX-License-Identifier: GPL-1.0+ AND LGPL-2.1+ | ||
130 | |||
131 | 许可标识符 | ||
132 | ---------- | ||
133 | |||
134 | 当前使用的许可证以及添加到内核的代码许可证可以分解为: | ||
135 | |||
136 | 1. _`优先许可`: | ||
137 | |||
138 | 应尽可能使用这些许可证,因为它们已知完全兼容并广泛使用。这些许可证在内核 | ||
139 | 目录:: | ||
140 | |||
141 | LICENSES/preferred/ | ||
142 | |||
143 | 此目录中的文件包含完整的许可证文本和 `元标记`_ 。文件名与SPDX许可证标识 | ||
144 | 符相同,后者应用于源文件中的许可证。 | ||
145 | |||
146 | 例如:: | ||
147 | |||
148 | LICENSES/preferred/GPL-2.0 | ||
149 | |||
150 | 包含GPLv2许可证文本和所需的元标签:: | ||
151 | |||
152 | LICENSES/preferred/MIT | ||
153 | |||
154 | 包含MIT许可证文本和所需的元标记 | ||
155 | |||
156 | _`元标记`: | ||
157 | |||
158 | 许可证文件中必须包含以下元标记: | ||
159 | |||
160 | - Valid-License-Identifier: | ||
161 | |||
162 | 一行或多行, 声明那些许可标识符在项目内有效, 以引用此特定许可的文本。通 | ||
163 | 常这是一个有效的标识符,但是例如对于带有'或更高'选项的许可证,两个标识 | ||
164 | 符都有效。 | ||
165 | |||
166 | - SPDX-URL: | ||
167 | |||
168 | SPDX页面的URL,其中包含与许可证相关的其他信息. | ||
169 | |||
170 | - Usage-Guidance: | ||
171 | |||
172 | 使用建议的自由格式文本。该文本必须包含SPDX许可证标识符的正确示例,因为 | ||
173 | 它们应根据 `许可标识符语法`_ 指南放入源文件中。 | ||
174 | |||
175 | - License-Text: | ||
176 | |||
177 | 此标记之后的所有文本都被视为原始许可文本 | ||
178 | |||
179 | 文件格式示例:: | ||
180 | |||
181 | Valid-License-Identifier: GPL-2.0 | ||
182 | Valid-License-Identifier: GPL-2.0+ | ||
183 | SPDX-URL: https://spdx.org/licenses/GPL-2.0.html | ||
184 | Usage-Guide: | ||
185 | To use this license in source code, put one of the following SPDX | ||
186 | tag/value pairs into a comment according to the placement | ||
187 | guidelines in the licensing rules documentation. | ||
188 | For 'GNU General Public License (GPL) version 2 only' use: | ||
189 | SPDX-License-Identifier: GPL-2.0 | ||
190 | For 'GNU General Public License (GPL) version 2 or any later version' use: | ||
191 | SPDX-License-Identifier: GPL-2.0+ | ||
192 | License-Text: | ||
193 | Full license text | ||
194 | |||
195 | :: | ||
196 | |||
197 | SPDX-License-Identifier: MIT | ||
198 | SPDX-URL: https://spdx.org/licenses/MIT.html | ||
199 | Usage-Guide: | ||
200 | To use this license in source code, put the following SPDX | ||
201 | tag/value pair into a comment according to the placement | ||
202 | guidelines in the licensing rules documentation. | ||
203 | SPDX-License-Identifier: MIT | ||
204 | License-Text: | ||
205 | Full license text | ||
206 | |||
207 | | | ||
208 | |||
209 | 2. 不推荐的许可证: | ||
210 | |||
211 | 这些许可证只应用于现有代码或从其他项目导入代码。这些许可证在内核目录:: | ||
212 | |||
213 | LICENSES/other/ | ||
214 | |||
215 | 此目录中的文件包含完整的许可证文本和 `元标记`_ 。文件名与SPDX许可证标识 | ||
216 | 符相同,后者应用于源文件中的许可证。 | ||
217 | |||
218 | 例如:: | ||
219 | |||
220 | LICENSES/other/ISC | ||
221 | |||
222 | 包含国际系统联合许可文本和所需的元标签:: | ||
223 | |||
224 | LICENSES/other/ZLib | ||
225 | |||
226 | 包含ZLIB许可文本和所需的元标签. | ||
227 | |||
228 | 元标签: | ||
229 | |||
230 | “其他”许可证的元标签要求与 `优先许可`_ 的要求相同。 | ||
231 | |||
232 | 文件格式示例:: | ||
233 | |||
234 | Valid-License-Identifier: ISC | ||
235 | SPDX-URL: https://spdx.org/licenses/ISC.html | ||
236 | Usage-Guide: | ||
237 | Usage of this license in the kernel for new code is discouraged | ||
238 | and it should solely be used for importing code from an already | ||
239 | existing project. | ||
240 | To use this license in source code, put the following SPDX | ||
241 | tag/value pair into a comment according to the placement | ||
242 | guidelines in the licensing rules documentation. | ||
243 | SPDX-License-Identifier: ISC | ||
244 | License-Text: | ||
245 | Full license text | ||
246 | |||
247 | | | ||
248 | |||
249 | 3. _`例外`: | ||
250 | |||
251 | 某些许可证可以修改,并允许原始许可证不具有的某些例外权利。这些例外在 | ||
252 | 内核目录:: | ||
253 | |||
254 | LICENSES/exceptions/ | ||
255 | |||
256 | 此目录中的文件包含完整的例外文本和所需的 `例外元标记`_ 。 | ||
257 | |||
258 | 例如:: | ||
259 | |||
260 | LICENSES/exceptions/Linux-syscall-note | ||
261 | |||
262 | 包含Linux内核的COPYING文件中记录的Linux系统调用例外,该文件用于UAPI | ||
263 | 头文件。例如:: | ||
264 | |||
265 | LICENSES/exceptions/GCC-exception-2.0 | ||
266 | |||
267 | 包含GCC'链接例外',它允许独立于其许可证的任何二进制文件与标记有此例外的 | ||
268 | 文件的编译版本链接。这是从GPL不兼容源代码创建可运行的可执行文件所必需的。 | ||
269 | |||
270 | _`例外元标记`: | ||
271 | |||
272 | 以下元标记必须在例外文件中可用: | ||
273 | |||
274 | - SPDX-Exception-Identifier: | ||
275 | |||
276 | 一个可与SPDX许可证标识符一起使用的例外标识符。 | ||
277 | |||
278 | - SPDX-URL: | ||
279 | |||
280 | SPDX页面的URL,其中包含与例外相关的其他信息。 | ||
281 | |||
282 | - SPDX-Licenses: | ||
283 | |||
284 | 以逗号分隔的例外可用的SPDX许可证标识符列表。 | ||
285 | |||
286 | - Usage-Guidance: | ||
287 | |||
288 | 使用建议的自由格式文本。必须在文本后面加上SPDX许可证标识符的正确示例, | ||
289 | 因为它们应根据 `许可标识符语法`_ 指南放入源文件中。 | ||
290 | |||
291 | - Exception-Text: | ||
292 | |||
293 | 此标记之后的所有文本都被视为原始异常文本 | ||
294 | |||
295 | 文件格式示例:: | ||
296 | |||
297 | SPDX-Exception-Identifier: Linux-syscall-note | ||
298 | SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html | ||
299 | SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+ | ||
300 | Usage-Guidance: | ||
301 | This exception is used together with one of the above SPDX-Licenses | ||
302 | to mark user-space API (uapi) header files so they can be included | ||
303 | into non GPL compliant user-space application code. | ||
304 | To use this exception add it with the keyword WITH to one of the | ||
305 | identifiers in the SPDX-Licenses tag: | ||
306 | SPDX-License-Identifier: <SPDX-License> WITH Linux-syscall-note | ||
307 | Exception-Text: | ||
308 | Full exception text | ||
309 | |||
310 | :: | ||
311 | |||
312 | SPDX-Exception-Identifier: GCC-exception-2.0 | ||
313 | SPDX-URL: https://spdx.org/licenses/GCC-exception-2.0.html | ||
314 | SPDX-Licenses: GPL-2.0, GPL-2.0+ | ||
315 | Usage-Guidance: | ||
316 | The "GCC Runtime Library exception 2.0" is used together with one | ||
317 | of the above SPDX-Licenses for code imported from the GCC runtime | ||
318 | library. | ||
319 | To use this exception add it with the keyword WITH to one of the | ||
320 | identifiers in the SPDX-Licenses tag: | ||
321 | SPDX-License-Identifier: <SPDX-License> WITH GCC-exception-2.0 | ||
322 | Exception-Text: | ||
323 | Full exception text | ||
324 | |||
325 | |||
326 | 所有SPDX许可证标识符和例外都必须在LICENSES子目录中具有相应的文件。这是允许 | ||
327 | 工具验证(例如checkpatch.pl)以及准备好从源读取和提取许可证所必需的, 这是 | ||
328 | 各种FOSS组织推荐的,例如 `FSFE REUSE initiative <https://reuse.software/>`_. | ||
329 | |||
330 | _`模块许可` | ||
331 | ----------------- | ||
332 | |||
333 | 可加载内核模块还需要MODULE_LICENSE()标记。此标记既不替代正确的源代码 | ||
334 | 许可证信息(SPDX-License-Identifier),也不以任何方式表示或确定提供模块 | ||
335 | 源代码的确切许可证。 | ||
336 | |||
337 | 此标记的唯一目的是提供足够的信息,该模块是否是自由软件或者是内核模块加 | ||
338 | 载器和用户空间工具的专有模块。 | ||
339 | |||
340 | MODULE_LICENSE()的有效许可证字符串是: | ||
341 | |||
342 | ============================= ============================================= | ||
343 | "GPL" 模块是根据GPL版本2许可的。这并不表示仅限于 | ||
344 | GPL-2.0或GPL-2.0或更高版本之间的任何区别。 | ||
345 | 最正确许可证信息只能通过相应源文件中的许可证 | ||
346 | 信息来确定 | ||
347 | |||
348 | "GPL v2" 和"GPL"相同,它的存在是因为历史原因。 | ||
349 | |||
350 | "GPL and additional rights" 表示模块源在GPL v2变体和MIT许可下双重许可的 | ||
351 | 历史变体。请不要在新代码中使用。 | ||
352 | |||
353 | "Dual MIT/GPL" 表达该模块在GPL v2变体或MIT许可证选择下双重 | ||
354 | 许可的正确方式。 | ||
355 | |||
356 | "Dual BSD/GPL" 该模块根据GPL v2变体或BSD许可证选择进行双重 | ||
357 | 许可。 BSD许可证的确切变体只能通过相应源文件 | ||
358 | 中的许可证信息来确定。 | ||
359 | |||
360 | "Dual MPL/GPL" 该模块根据GPL v2变体或Mozilla Public License | ||
361 | (MPL)选项进行双重许可。 MPL许可证的确切变体 | ||
362 | 只能通过相应的源文件中的许可证信息来确定。 | ||
363 | |||
364 | "Proprietary" 该模块属于专有许可。此字符串仅用于专有的第三 | ||
365 | 方模块,不能用于在内核树中具有源代码的模块。 | ||
366 | 以这种方式标记的模块在加载时会使用'P'标记污 | ||
367 | 染内核,并且内核模块加载器拒绝将这些模块链接 | ||
368 | 到使用EXPORT_SYMBOL_GPL()导出的符号。 | ||
369 | ============================= ============================================= | ||
370 | |||
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst new file mode 100644 index 000000000000..15c592518194 --- /dev/null +++ b/Documentation/translations/zh_CN/process/magic-number.rst | |||
@@ -0,0 +1,151 @@ | |||
1 | .. _cn_magicnumbers: | ||
2 | |||
3 | .. include:: ../disclaimer-zh_CN.rst | ||
4 | |||
5 | :Original: :ref:`Documentation/process/magic-number.rst <magicnumbers>` | ||
6 | |||
7 | 如果想评论或更新本文的内容,请直接发信到LKML。如果你使用英文交流有困难的话,也可 | ||
8 | 以向中文版维护者求助。如果本翻译更新不及时或者翻译存在问题,请联系中文版维护者:: | ||
9 | |||
10 | 中文版维护者: 贾威威 Jia Wei Wei <harryxiyou@gmail.com> | ||
11 | 中文版翻译者: 贾威威 Jia Wei Wei <harryxiyou@gmail.com> | ||
12 | 中文版校译者: 贾威威 Jia Wei Wei <harryxiyou@gmail.com> | ||
13 | |||
14 | Linux 魔术数 | ||
15 | ============ | ||
16 | |||
17 | 这个文件是有关当前使用的魔术值注册表。当你给一个结构添加了一个魔术值,你也应该把这个魔术值添加到这个文件,因为我们最好把用于各种结构的魔术值统一起来。 | ||
18 | |||
19 | 使用魔术值来保护内核数据结构是一个非常好的主意。这就允许你在运行期检查(a)一个结构是否已经被攻击,或者(b)你已经给一个例行程序通过了一个错误的结构。后一种情况特别地有用---特别是当你通过一个空指针指向结构体的时候。tty源码,例如,经常通过特定驱动使用这种方法并且反复地排列特定方面的结构。 | ||
20 | |||
21 | 使用魔术值的方法是在结构的开始处声明的,如下:: | ||
22 | |||
23 | struct tty_ldisc { | ||
24 | int magic; | ||
25 | ... | ||
26 | }; | ||
27 | |||
28 | 当你以后给内核添加增强功能的时候,请遵守这条规则!这样就会节省数不清的调试时间,特别是一些古怪的情况,例如,数组超出范围并且重新写了超出部分。遵守这个规则,这些情况可以被快速地,安全地避免。 | ||
29 | |||
30 | Theodore Ts'o | ||
31 | 31 Mar 94 | ||
32 | |||
33 | 给当前的Linux 2.1.55添加魔术表。 | ||
34 | |||
35 | Michael Chastain | ||
36 | <mailto:mec@shout.net> | ||
37 | 22 Sep 1997 | ||
38 | |||
39 | 现在应该最新的Linux 2.1.112.因为在特性冻结期间,不能在2.2.x前改变任何东西。这些条目被数域所排序。 | ||
40 | |||
41 | Krzysztof G.Baranowski | ||
42 | <mailto: kgb@knm.org.pl> | ||
43 | 29 Jul 1998 | ||
44 | |||
45 | 更新魔术表到Linux 2.5.45。刚好越过特性冻结,但是有可能还会有一些新的魔术值在2.6.x之前融入到内核中。 | ||
46 | |||
47 | Petr Baudis | ||
48 | <pasky@ucw.cz> | ||
49 | 03 Nov 2002 | ||
50 | |||
51 | 更新魔术表到Linux 2.5.74。 | ||
52 | |||
53 | Fabian Frederick | ||
54 | <ffrederick@users.sourceforge.net> | ||
55 | 09 Jul 2003 | ||
56 | |||
57 | ===================== ================ ======================== ========================================== | ||
58 | 魔术数名 数字 结构 文件 | ||
59 | ===================== ================ ======================== ========================================== | ||
60 | PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/pg.h`` | ||
61 | CMAGIC 0x0111 user ``include/linux/a.out.h`` | ||
62 | MKISS_DRIVER_MAGIC 0x04bf mkiss_channel ``drivers/net/mkiss.h`` | ||
63 | HDLC_MAGIC 0x239e n_hdlc ``drivers/char/n_hdlc.c`` | ||
64 | APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c`` | ||
65 | CYCLADES_MAGIC 0x4359 cyclades_port ``include/linux/cyclades.h`` | ||
66 | DB_MAGIC 0x4442 fc_info ``drivers/net/iph5526_novram.c`` | ||
67 | DL_MAGIC 0x444d fc_info ``drivers/net/iph5526_novram.c`` | ||
68 | FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h`` | ||
69 | FF_MAGIC 0x4646 fc_info ``drivers/net/iph5526_novram.c`` | ||
70 | ISICOM_MAGIC 0x4d54 isi_port ``include/linux/isicom.h`` | ||
71 | PTY_MAGIC 0x5001 ``drivers/char/pty.c`` | ||
72 | PPP_MAGIC 0x5002 ppp ``include/linux/if_pppvar.h`` | ||
73 | SERIAL_MAGIC 0x5301 async_struct ``include/linux/serial.h`` | ||
74 | SSTATE_MAGIC 0x5302 serial_state ``include/linux/serial.h`` | ||
75 | SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h`` | ||
76 | STRIP_MAGIC 0x5303 strip ``drivers/net/strip.c`` | ||
77 | X25_ASY_MAGIC 0x5303 x25_asy ``drivers/net/x25_asy.h`` | ||
78 | SIXPACK_MAGIC 0x5304 sixpack ``drivers/net/hamradio/6pack.h`` | ||
79 | AX25_MAGIC 0x5316 ax_disp ``drivers/net/mkiss.h`` | ||
80 | TTY_MAGIC 0x5401 tty_struct ``include/linux/tty.h`` | ||
81 | MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c`` | ||
82 | TTY_DRIVER_MAGIC 0x5402 tty_driver ``include/linux/tty_driver.h`` | ||
83 | MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c`` | ||
84 | TTY_LDISC_MAGIC 0x5403 tty_ldisc ``include/linux/tty_ldisc.h`` | ||
85 | USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h`` | ||
86 | FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c`` | ||
87 | USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth ``drivers/usb/class/bluetty.c`` | ||
88 | RFCOMM_TTY_MAGIC 0x6d02 ``net/bluetooth/rfcomm/tty.c`` | ||
89 | USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port ``drivers/usb/serial/usb-serial.h`` | ||
90 | CG_MAGIC 0x00090255 ufs_cylinder_group ``include/linux/ufs_fs.h`` | ||
91 | RPORT_MAGIC 0x00525001 r_port ``drivers/char/rocket_int.h`` | ||
92 | LSEMAGIC 0x05091998 lse ``drivers/fc4/fc.c`` | ||
93 | GDTIOCTL_MAGIC 0x06030f07 gdth_iowr_str ``drivers/scsi/gdth_ioctl.h`` | ||
94 | RIEBL_MAGIC 0x09051990 ``drivers/net/atarilance.c`` | ||
95 | NBD_REQUEST_MAGIC 0x12560953 nbd_request ``include/linux/nbd.h`` | ||
96 | RED_MAGIC2 0x170fc2a5 (any) ``mm/slab.c`` | ||
97 | BAYCOM_MAGIC 0x19730510 baycom_state ``drivers/net/baycom_epp.c`` | ||
98 | ISDN_X25IFACE_MAGIC 0x1e75a2b9 isdn_x25iface_proto_data ``drivers/isdn/isdn_x25iface.h`` | ||
99 | ECP_MAGIC 0x21504345 cdkecpsig ``include/linux/cdk.h`` | ||
100 | LSOMAGIC 0x27091997 lso ``drivers/fc4/fc.c`` | ||
101 | LSMAGIC 0x2a3b4d2a ls ``drivers/fc4/fc.c`` | ||
102 | WANPIPE_MAGIC 0x414C4453 sdla_{dump,exec} ``include/linux/wanpipe.h`` | ||
103 | CS_CARD_MAGIC 0x43525553 cs_card ``sound/oss/cs46xx.c`` | ||
104 | LABELCL_MAGIC 0x4857434c labelcl_info_s ``include/asm/ia64/sn/labelcl.h`` | ||
105 | ISDN_ASYNC_MAGIC 0x49344C01 modem_info ``include/linux/isdn.h`` | ||
106 | CTC_ASYNC_MAGIC 0x49344C01 ctc_tty_info ``drivers/s390/net/ctctty.c`` | ||
107 | ISDN_NET_MAGIC 0x49344C02 isdn_net_local_s ``drivers/isdn/i4l/isdn_net_lib.h`` | ||
108 | SAVEKMSG_MAGIC2 0x4B4D5347 savekmsg ``arch/*/amiga/config.c`` | ||
109 | CS_STATE_MAGIC 0x4c4f4749 cs_state ``sound/oss/cs46xx.c`` | ||
110 | SLAB_C_MAGIC 0x4f17a36d kmem_cache ``mm/slab.c`` | ||
111 | COW_MAGIC 0x4f4f4f4d cow_header_v1 ``arch/um/drivers/ubd_user.c`` | ||
112 | I810_CARD_MAGIC 0x5072696E i810_card ``sound/oss/i810_audio.c`` | ||
113 | TRIDENT_CARD_MAGIC 0x5072696E trident_card ``sound/oss/trident.c`` | ||
114 | ROUTER_MAGIC 0x524d4157 wan_device [in ``wanrouter.h`` pre 3.9] | ||
115 | SAVEKMSG_MAGIC1 0x53415645 savekmsg ``arch/*/amiga/config.c`` | ||
116 | GDA_MAGIC 0x58464552 gda ``arch/mips/include/asm/sn/gda.h`` | ||
117 | RED_MAGIC1 0x5a2cf071 (any) ``mm/slab.c`` | ||
118 | EEPROM_MAGIC_VALUE 0x5ab478d2 lanai_dev ``drivers/atm/lanai.c`` | ||
119 | HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h`` | ||
120 | PCXX_MAGIC 0x5c6df104 channel ``drivers/char/pcxx.h`` | ||
121 | KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h`` | ||
122 | I810_STATE_MAGIC 0x63657373 i810_state ``sound/oss/i810_audio.c`` | ||
123 | TRIDENT_STATE_MAGIC 0x63657373 trient_state ``sound/oss/trident.c`` | ||
124 | M3_CARD_MAGIC 0x646e6f50 m3_card ``sound/oss/maestro3.c`` | ||
125 | FW_HEADER_MAGIC 0x65726F66 fw_header ``drivers/atm/fore200e.h`` | ||
126 | SLOT_MAGIC 0x67267321 slot ``drivers/hotplug/cpqphp.h`` | ||
127 | SLOT_MAGIC 0x67267322 slot ``drivers/hotplug/acpiphp.h`` | ||
128 | LO_MAGIC 0x68797548 nbd_device ``include/linux/nbd.h`` | ||
129 | OPROFILE_MAGIC 0x6f70726f super_block ``drivers/oprofile/oprofilefs.h`` | ||
130 | M3_STATE_MAGIC 0x734d724d m3_state ``sound/oss/maestro3.c`` | ||
131 | VMALLOC_MAGIC 0x87654320 snd_alloc_track ``sound/core/memory.c`` | ||
132 | KMALLOC_MAGIC 0x87654321 snd_alloc_track ``sound/core/memory.c`` | ||
133 | PWC_MAGIC 0x89DC10AB pwc_device ``drivers/usb/media/pwc.h`` | ||
134 | NBD_REPLY_MAGIC 0x96744668 nbd_reply ``include/linux/nbd.h`` | ||
135 | ENI155_MAGIC 0xa54b872d midway_eprom ``drivers/atm/eni.h`` | ||
136 | CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h`` | ||
137 | DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram ``drivers/scsi/gdth.h`` | ||
138 | YAM_MAGIC 0xF10A7654 yam_port ``drivers/net/hamradio/yam.c`` | ||
139 | CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c`` | ||
140 | QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c`` | ||
141 | QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c`` | ||
142 | HTB_CMAGIC 0xFEFAFEF1 htb_class ``net/sched/sch_htb.c`` | ||
143 | NMI_MAGIC 0x48414d4d455201 nmi_s ``arch/mips/include/asm/sn/nmi.h`` | ||
144 | ===================== ================ ======================== ========================================== | ||
145 | |||
146 | |||
147 | 请注意,在声音记忆管理中仍然有一些特殊的为每个驱动定义的魔术值。查看include/sound/sndmagic.h来获取他们完整的列表信息。很多OSS声音驱动拥有自己从声卡PCI ID构建的魔术值-他们也没有被列在这里。 | ||
148 | |||
149 | IrDA子系统也使用了大量的自己的魔术值,查看include/net/irda/irda.h来获取他们完整的信息。 | ||
150 | |||
151 | HFS是另外一个比较大的使用魔术值的文件系统-你可以在fs/hfs/hfs.h中找到他们。 | ||
diff --git a/Documentation/translations/zh_CN/process/management-style.rst b/Documentation/translations/zh_CN/process/management-style.rst new file mode 100644 index 000000000000..a181fa56d19e --- /dev/null +++ b/Documentation/translations/zh_CN/process/management-style.rst | |||
@@ -0,0 +1,207 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/management-style.rst <managementstyle>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_managementstyle: | ||
7 | |||
8 | Linux内核管理风格 | ||
9 | ================= | ||
10 | |||
11 | 这是一个简短的文档,描述了Linux内核首选的(或胡编的,取决于您问谁)管理风格。 | ||
12 | 它的目的是在某种程度上参照 :ref:`process/coding-style.rst <codingstyle>` | ||
13 | 主要是为了避免反复回答 [#cnf1]_ 相同(或类似)的问题。 | ||
14 | |||
15 | 管理风格是非常个人化的,比简单的编码风格规则更难以量化,因此本文档可能与实 | ||
16 | 际情况有关,也可能与实际情况无关。起初它是一个玩笑,但这并不意味着它可能不 | ||
17 | 是真的。你得自己决定。 | ||
18 | |||
19 | 顺便说一句,在谈到“核心管理者”时,主要是技术负责人,而不是在公司内部进行传 | ||
20 | 统管理的人。如果你签署了采购订单或者对你的团队的预算有任何了解,你几乎肯定 | ||
21 | 不是一个核心管理者。这些建议可能适用于您,也可能不适用于您。 | ||
22 | |||
23 | 首先,我建议你购买“高效人的七个习惯”,而不是阅读它。烧了它,这是一个伟大的 | ||
24 | 象征性姿态。 | ||
25 | |||
26 | .. [#cnf1] 本文件并不是通过回答问题,而是通过让提问者痛苦地明白,我们不知道 | ||
27 | 答案是什么。 | ||
28 | |||
29 | 不管怎样,这里是: | ||
30 | |||
31 | .. _decisions: | ||
32 | |||
33 | 1)决策 | ||
34 | ------- | ||
35 | |||
36 | 每个人都认为管理者做决定,而且决策很重要。决定越大越痛苦,管理者就必须越高级。 | ||
37 | 这很明显,但事实并非如此。 | ||
38 | |||
39 | 游戏的名字是 **避免** 做出决定。尤其是,如果有人告诉你“选择(a)或(b), | ||
40 | 我们真的需要你来做决定”,你就是陷入麻烦的管理者。你管理的人比你更了解细节, | ||
41 | 所以如果他们来找你做技术决策,你完蛋了。你显然没有能力为他们做这个决定。 | ||
42 | |||
43 | (推论:如果你管理的人不比你更了解细节,你也会被搞砸,尽管原因完全不同。 | ||
44 | 也就是说,你的工作是错的,他们应该管理你的才智) | ||
45 | |||
46 | 所以游戏的名字是 **避免** 做出决定,至少是那些大而痛苦的决定。做一些小的 | ||
47 | 和非结果性的决定是很好的,并且使您看起来好像知道自己在做什么,所以内核管理者 | ||
48 | 需要做的是将那些大的和痛苦的决定变成那些没有人真正关心的小事情。 | ||
49 | |||
50 | 这有助于认识到一个大的决定和一个小的决定之间的关键区别是你是否可以在事后修正 | ||
51 | 你的决定。任何决定都可以通过始终确保如果你错了(而且你一定会错),你以后总是 | ||
52 | 可以通过回溯来弥补损失。突然间,你就要做两个无关紧要的决定,一个是错误的,另 | ||
53 | 一个是正确的。 | ||
54 | |||
55 | 人们甚至会认为这是真正的领导能力(咳,胡说,咳)。 | ||
56 | |||
57 | 因此,避免重大决策的关键在于避免做那些无法挽回的事情。不要被引导到一个你无法 | ||
58 | 逃离的角落。走投无路的老鼠可能很危险——走投无路的管理者真可怜。 | ||
59 | |||
60 | 事实证明,由于没有人会愚蠢到让内核管理者承担巨大的财政责任,所以通常很容易 | ||
61 | 回溯。既然你不可能浪费掉你无法偿还的巨额资金,你唯一可以回溯的就是技术决策, | ||
62 | 而回溯很容易:只要告诉大家你是个不称职的傻瓜,说对不起,然后撤销你去年让别 | ||
63 | 人所做的毫无价值的工作。突然间,你一年前做的决定不在是一个重大的决定,因为 | ||
64 | 它很容易被推翻。 | ||
65 | |||
66 | 事实证明,有些人对接受这种方法有困难,原因有两个: | ||
67 | |||
68 | - 承认你是个白痴比看起来更难。我们都喜欢保持形象,在公共场合说你错了有时 | ||
69 | 确实很难。 | ||
70 | - 如果有人告诉你,你去年所做的工作终究是不值得的,那么对那些可怜的低级工 | ||
71 | 程师来说也是很困难的,虽然实际的 **工作** 很容易删除,但你可能已经不可 | ||
72 | 挽回地失去了工程师的信任。记住:“不可撤销”是我们一开始就试图避免的, | ||
73 | 而你的决定终究是一个重大的决定。 | ||
74 | |||
75 | 令人欣慰的是,这两个原因都可以通过预先承认你没有任何线索,提前告诉人们你的 | ||
76 | 决定完全是初步的,而且可能是错误的事情来有效地缓解。你应该始终保留改变主意 | ||
77 | 的权利,并让人们 **意识** 到这一点。当你 **还没有** 做过真正愚蠢的事情的时 | ||
78 | 候,承认自己是愚蠢的要容易得多。 | ||
79 | |||
80 | 然后,当它真的被证明是愚蠢的时候,人们就转动他们的眼珠说“哎呀,下次不要了”。 | ||
81 | |||
82 | 这种对不称职的先发制人的承认,也可能使真正做这项工作的人也会三思是否值得做。 | ||
83 | 毕竟,如果他们不确定这是否是一个好主意,你肯定不应该通过向他们保证他们所做 | ||
84 | 的工作将会进入(内核)鼓励他们。在他们开始一项巨大的努力之前,至少让他们三 | ||
85 | 思而后行。 | ||
86 | |||
87 | 记住:他们最好比你更了解细节,而且他们通常认为他们对每件事都有答案。作为一 | ||
88 | 个管理者,你能做的最好的事情不是灌输自信,而是对他们所做的事情进行健康的批 | ||
89 | 判性思考。 | ||
90 | |||
91 | 顺便说一句,另一种避免做出决定的方法是看起来很可怜的抱怨 “我们不能两者兼 | ||
92 | 得吗?” 相信我,它是有效的。如果不清楚哪种方法更好,他们最终会弄清楚的。 | ||
93 | 最终的答案可能是两个团队都会因为这种情况而感到沮丧,以至于他们放弃了。 | ||
94 | |||
95 | 这听起来像是一个失败,但这通常是一个迹象,表明两个项目都有问题,而参与其中 | ||
96 | 的人不能做决定的原因是他们都是错误的。你最终会闻到玫瑰的味道,你避免了另一 | ||
97 | 个你本可以搞砸的决定。 | ||
98 | |||
99 | 2)人 | ||
100 | ----- | ||
101 | |||
102 | 大多数人都是白痴,做一名管理者意味着你必须处理好这件事,也许更重要的是, | ||
103 | **他们** 必须处理好你。 | ||
104 | |||
105 | 事实证明,虽然很容易纠正技术错误,但不容易纠正人格障碍。你只能和他们的和 | ||
106 | 你的(人格障碍)共处。 | ||
107 | |||
108 | 但是,为了做好作为内核管理者的准备,最好记住不要烧掉任何桥梁,不要轰炸任何 | ||
109 | 无辜的村民,也不要疏远太多的内核开发人员。事实证明,疏远人是相当容易的,而 | ||
110 | 亲近一个疏远的人是很难的。因此,“疏远”立即属于“不可逆”的范畴,并根据 | ||
111 | :ref:`decisions` 成为绝不可以做的事情。 | ||
112 | |||
113 | 这里只有几个简单的规则: | ||
114 | |||
115 | (1) 不要叫人笨蛋(至少不要在公共场合) | ||
116 | (2) 学习如何在忘记规则(1)时道歉 | ||
117 | |||
118 | 问题在于 #1 很容易去做,因为你可以用数百万种不同的方式说“你是一个笨蛋” [#cnf2]_ | ||
119 | 有时甚至没有意识到,而且几乎总是带着一种白热化的信念,认为你是对的。 | ||
120 | |||
121 | 你越确信自己是对的(让我们面对现实吧,你可以把几乎所有人都称为坏人,而且你 | ||
122 | 经常是对的),事后道歉就越难。 | ||
123 | |||
124 | 要解决此问题,您实际上只有两个选项: | ||
125 | |||
126 | - 非常擅长道歉 | ||
127 | - 把“爱”均匀地散开,没有人会真正感觉到自己被不公平地瞄准了。让它有足够的 | ||
128 | 创造性,他们甚至可能会觉得好笑。 | ||
129 | |||
130 | 选择永远保持礼貌是不存在的。没有人会相信一个如此明显地隐藏了他们真实性格的人。 | ||
131 | |||
132 | .. [#cnf2] 保罗·西蒙演唱了“离开爱人的50种方法”,因为坦率地说,“告诉开发者 | ||
133 | 他们是D*CKHEAD" 的100万种方法都无法确认。但我确信他已经这么想了。 | ||
134 | |||
135 | 3)人2 - 好人 | ||
136 | ------------- | ||
137 | |||
138 | 虽然大多数人都是白痴,但不幸的是,据此推论你也是白痴,尽管我们都自我感觉良 | ||
139 | 好,我们比普通人更好(让我们面对现实吧,没有人相信他们是普通人或低于普通人), | ||
140 | 我们也应该承认我们不是最锋利的刀,而且会有其他人比你更不像白痴。 | ||
141 | |||
142 | 有些人对聪明人反应不好。其他人利用它们。 | ||
143 | |||
144 | 作为内核维护人员,确保您在第二组中。接受他们,因为他们会让你的工作更容易。 | ||
145 | 特别是,他们能够为你做决定,这就是游戏的全部内容。 | ||
146 | |||
147 | 所以当你发现一个比你聪明的人时,就顺其自然吧。你的管理职责在很大程度上变成 | ||
148 | 了“听起来像是个好主意——去尝试吧”,或者“听起来不错,但是XXX呢?”“。第二个版 | ||
149 | 本尤其是一个很好的方法,要么学习一些关于“XXX”的新东西,要么通过指出一些聪明 | ||
150 | 人没有想到的东西来显得更具管理性。无论哪种情况,你都会赢。 | ||
151 | |||
152 | 要注意的一件事是认识到一个领域的伟大不一定会转化为其他领域。所以你可能会向 | ||
153 | 特定的方向刺激人们,但让我们面对现实吧,他们可能擅长他们所做的事情,而且对 | ||
154 | 其他事情都很差劲。好消息是,人们往往会自然而然地重拾他们擅长的东西,所以当 | ||
155 | 你向某个方向刺激他们时,你并不是在做不可逆转的事情,只是不要用力推。 | ||
156 | |||
157 | 4)责备 | ||
158 | ------- | ||
159 | |||
160 | 事情会出问题的,人们希望去责备人。贴标签,你就是受责备的人。 | ||
161 | |||
162 | 事实上,接受责备并不难,尤其是当人们意识到这不 **全是** 你的过错时。这让我 | ||
163 | 们找到了承担责任的最佳方式:为别人承担这件事。你会感觉很好,他们会感觉很好, | ||
164 | 没有受到指责. 那谁,失去了他们的全部36GB色情收藏的人,因为你的无能将勉强承 | ||
165 | 认,你至少没有试图逃避责任。 | ||
166 | |||
167 | 然后让真正搞砸了的开发人员(如果你能找到他们)私下知道他们搞砸了。不仅是为 | ||
168 | 了将来可以避免,而且为了让他们知道他们欠你一个人情。而且,也许更重要的是, | ||
169 | 他们也可能是能够解决问题的人。因为,让我们面对现实吧,肯定不是你。 | ||
170 | |||
171 | 承担责任也是你首先成为管理者的原因。这是让人们信任你,让你获得潜在的荣耀的 | ||
172 | 一部分,因为你就是那个会说“我搞砸了”的人。如果你已经遵循了以前的规则,你现 | ||
173 | 在已经很擅长说了。 | ||
174 | |||
175 | 5)应避免的事情 | ||
176 | --------------- | ||
177 | |||
178 | 有一件事人们甚至比被称为“笨蛋”更讨厌,那就是在一个神圣的声音中被称为“笨蛋”。 | ||
179 | 第一个你可以道歉,第二个你不会真正得到机会。即使你做得很好,他们也可能不再 | ||
180 | 倾听。 | ||
181 | |||
182 | 我们都认为自己比别人强,这意味着当别人装腔作势时,这会让我们很恼火。你也许 | ||
183 | 在道德和智力上比你周围的每个人都优越,但不要试图太明显,除非你真的打算激怒 | ||
184 | 某人 [#cnf3]_ | ||
185 | |||
186 | 同样,不要对事情太客气或太微妙。礼貌很容易落得落花流水,把问题隐藏起来, | ||
187 | 正如他们所说,“在互联网上,没人能听到你的含蓄。”用一个钝器把这一点锤进去, | ||
188 | 因为你不能真的依靠别人来获得你的观点。 | ||
189 | |||
190 | 一些幽默可以帮助缓和直率和道德化。过度到荒谬的地步,可以灌输一个观点,而不 | ||
191 | 会让接受者感到痛苦,他们只是认为你是愚蠢的。因此,它可以帮助我们摆脱对批评 | ||
192 | 的个人心理障碍。 | ||
193 | |||
194 | .. [#cnf3] 提示:与你的工作没有直接关系的网络新闻组是消除你对他人不满的好 | ||
195 | 方法。偶尔写些侮辱性的帖子,打个喷嚏,让你的情绪得到净化。别把牢骚带回家 | ||
196 | |||
197 | 6)为什么是我? | ||
198 | --------------- | ||
199 | |||
200 | 既然你的主要责任似乎是为别人的错误承担责任,并且让别人痛苦地明白你是不称职 | ||
201 | 的,那么显而易见的问题之一就变成了为什么首先要这样做。 | ||
202 | |||
203 | 首先,虽然你可能会或可能不会听到十几岁女孩(或男孩,让我们不要在这里评判或 | ||
204 | 性别歧视)敲你的更衣室门,你会得到一个巨大的个人成就感为“负责”。别介意你真 | ||
205 | 的在领导别人,你要跟上别人,尽可能快地追赶他们。每个人都会认为你是负责人。 | ||
206 | |||
207 | 如果你可以做到这个, 这是个伟大的工作! | ||
diff --git a/Documentation/translations/zh_CN/process/programming-language.rst b/Documentation/translations/zh_CN/process/programming-language.rst new file mode 100644 index 000000000000..51fd4ef48ea1 --- /dev/null +++ b/Documentation/translations/zh_CN/process/programming-language.rst | |||
@@ -0,0 +1,41 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/programming-language.rst <programming_language>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_programming_language: | ||
7 | |||
8 | 程序设计语言 | ||
9 | ============ | ||
10 | |||
11 | 内核是用C语言 [c-language]_ 编写的。更准确地说,内核通常是用 ``gcc`` [gcc]_ | ||
12 | 在 ``-std=gnu89`` [gcc-c-dialect-options]_ 下编译的:ISO C90的 GNU 方言( | ||
13 | 包括一些C99特性) | ||
14 | |||
15 | 这种方言包含对语言 [gnu-extensions]_ 的许多扩展,当然,它们许多都在内核中使用。 | ||
16 | |||
17 | 对于一些体系结构,有一些使用 ``clang`` [clang]_ 和 ``icc`` [icc]_ 编译内核 | ||
18 | 的支持,尽管在编写此文档时还没有完成,仍需要第三方补丁。 | ||
19 | |||
20 | 属性 | ||
21 | ---- | ||
22 | |||
23 | 在整个内核中使用的一个常见扩展是属性(attributes) [gcc-attribute-syntax]_ | ||
24 | 属性允许将实现定义的语义引入语言实体(如变量、函数或类型),而无需对语言进行 | ||
25 | 重大的语法更改(例如添加新关键字) [n2049]_ | ||
26 | |||
27 | 在某些情况下,属性是可选的(即不支持这些属性的编译器仍然应该生成正确的代码, | ||
28 | 即使其速度较慢或执行的编译时检查/诊断次数不够) | ||
29 | |||
30 | 内核定义了伪关键字(例如, ``pure`` ),而不是直接使用GNU属性语法(例如, | ||
31 | ``__attribute__((__pure__))`` ),以检测可以使用哪些关键字和/或缩短代码, 具体 | ||
32 | 请参阅 ``include/linux/compiler_attributes.h`` | ||
33 | |||
34 | .. [c-language] http://www.open-std.org/jtc1/sc22/wg14/www/standards | ||
35 | .. [gcc] https://gcc.gnu.org | ||
36 | .. [clang] https://clang.llvm.org | ||
37 | .. [icc] https://software.intel.com/en-us/c-compilers | ||
38 | .. [gcc-c-dialect-options] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html | ||
39 | .. [gnu-extensions] https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html | ||
40 | .. [gcc-attribute-syntax] https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html | ||
41 | .. [n2049] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2049.pdf | ||
diff --git a/Documentation/translations/zh_CN/stable_api_nonsense.txt b/Documentation/translations/zh_CN/process/stable-api-nonsense.rst index a2b27fab382c..b4ddb6e88d9d 100644 --- a/Documentation/translations/zh_CN/stable_api_nonsense.txt +++ b/Documentation/translations/zh_CN/process/stable-api-nonsense.rst | |||
@@ -1,26 +1,18 @@ | |||
1 | Chinese translated version of Documentation/process/stable-api-nonsense.rst | 1 | .. _cn_stable_api_nonsense: |
2 | 2 | ||
3 | If you have any comment or update to the content, please contact the | 3 | .. include:: ../disclaimer-zh_CN.rst |
4 | original document maintainer directly. However, if you have problem | ||
5 | communicating in English you can also ask the Chinese maintainer for help. | ||
6 | Contact the Chinese maintainer, if this translation is outdated or there | ||
7 | is problem with translation. | ||
8 | 4 | ||
9 | Maintainer: Greg Kroah-Hartman <greg@kroah.com> | 5 | :Original: :ref:`Documentation/process/stable-api-nonsense.rst |
10 | Chinese maintainer: TripleX Chung <zhongyu@18mail.cn> | 6 | <stable_api_nonsense>` |
11 | --------------------------------------------------------------------- | ||
12 | Documentation/process/stable-api-nonsense.rst 的中文翻译 | ||
13 | 7 | ||
14 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | 8 | 译者:: |
15 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
16 | 译存在问题,请联系中文版维护者。 | ||
17 | 9 | ||
18 | 英文版维护者: Greg Kroah-Hartman <greg@kroah.com> | 10 | 中文版维护者: 钟宇 TripleX Chung <xxx.phy@gmail.com> |
19 | 中文版护者: 钟宇 TripleX Chung <zhongyu@18mail.cn> | 11 | 中文版: 钟宇 TripleX Chung <xxx.phy@gmail.com> |
20 | 中文版翻译者: 宇 TripleX Chung <zhongyu@18mail.cn> | 12 | 中文版校译者: 李 Li Yang <leoyang.li@nxp.com> |
21 | 中文版校译者: 李阳 Li Yang <leoli@freescale.com> | 13 | |
22 | 以为文 | 14 | Linux 内驱动 |
23 | --------------------------------------------------------------------- | 15 | ================== |
24 | 16 | ||
25 | 写作本文档的目的,是为了解释为什么Linux既没有二进制内核接口,也没有稳定 | 17 | 写作本文档的目的,是为了解释为什么Linux既没有二进制内核接口,也没有稳定 |
26 | 的内核接口。这里所说的内核接口,是指内核里的接口,而不是内核和用户空间 | 18 | 的内核接口。这里所说的内核接口,是指内核里的接口,而不是内核和用户空间 |
@@ -59,18 +51,22 @@ Linux能成为强壮,稳定,成熟的操作系统,这也是你最开始选 | |||
59 | -------------- | 51 | -------------- |
60 | 假如我们有一个稳定的内核源代码接口,那么自然而然的,我们就拥有了稳定的 | 52 | 假如我们有一个稳定的内核源代码接口,那么自然而然的,我们就拥有了稳定的 |
61 | 二进制接口,是这样的吗?错。让我们看看关于Linux内核的几点事实: | 53 | 二进制接口,是这样的吗?错。让我们看看关于Linux内核的几点事实: |
54 | |||
62 | - 取决于所用的C编译器的版本,不同的内核数据结构里的结构体的对齐方 | 55 | - 取决于所用的C编译器的版本,不同的内核数据结构里的结构体的对齐方 |
63 | 式会有差别,代码中不同函数的表现形式也不一样(函数是不是被inline编译取 | 56 | 式会有差别,代码中不同函数的表现形式也不一样(函数是不是被inline |
64 | 决于编译器行为)。不同的函数的表现形式并不重要,但是数据结构内部的对齐 | 57 | 编译取决于编译器行为)。不同的函数的表现形式并不重要,但是数据 |
65 | 方式很关键。 | 58 | 结构内部的对齐方式很关键。 |
59 | |||
66 | - 取决于内核的配置选项,不同的选项会让内核的很多东西发生改变: | 60 | - 取决于内核的配置选项,不同的选项会让内核的很多东西发生改变: |
61 | |||
67 | - 同一个结构体可能包含不同的成员变量 | 62 | - 同一个结构体可能包含不同的成员变量 |
68 | - 有的函数可能根本不会被实现(比如编译的时候没有选择SMP支持 | 63 | - 有的函数可能根本不会被实现(比如编译的时候没有选择SMP支持 |
69 | ,一些锁函数就会被定义成空函数)。 | 64 | 一些锁函数就会被定义成空函数)。 |
70 | - 内核使用的内存会以不同的方式对齐,这取决于不同的内核配置选 | 65 | - 内核使用的内存会以不同的方式对齐,这取决于不同的内核配置选 |
71 | 项。 | 66 | 项。 |
67 | |||
72 | - Linux可以在很多的不同体系结构的处理器上运行。在某个体系结构上编 | 68 | - Linux可以在很多的不同体系结构的处理器上运行。在某个体系结构上编 |
73 | 译好的二进制驱动程序,不可能在另外一个体系结构上正确的运行。 | 69 | 译好的二进制驱动程序,不可能在另外一个体系结构上正确的运行。 |
74 | 70 | ||
75 | 对于一个特定的内核,满足这些条件并不难,使用同一个C编译器和同样的内核配 | 71 | 对于一个特定的内核,满足这些条件并不难,使用同一个C编译器和同样的内核配 |
76 | 置选项来编译驱动程序模块就可以了。这对于给一个特定Linux发布的特定版本提 | 72 | 置选项来编译驱动程序模块就可以了。这对于给一个特定Linux发布的特定版本提 |
@@ -90,7 +86,7 @@ Linux能成为强壮,稳定,成熟的操作系统,这也是你最开始选 | |||
90 | 86 | ||
91 | 如果有人不将他的内核驱动程序,放入公版内核的源代码树,而又想让驱动程序 | 87 | 如果有人不将他的内核驱动程序,放入公版内核的源代码树,而又想让驱动程序 |
92 | 一直保持在最新的内核中可用,那么这个话题将会变得没完没了。 | 88 | 一直保持在最新的内核中可用,那么这个话题将会变得没完没了。 |
93 | 内核开发是持续而且快节奏的,从来都不会慢下来。内核开发人员在当前接口中 | 89 | 内核开发是持续而且快节奏的,从来都不会慢下来。内核开发人员在当前接口中 |
94 | 找到bug,或者找到更好的实现方式。一旦发现这些,他们就很快会去修改当前的 | 90 | 找到bug,或者找到更好的实现方式。一旦发现这些,他们就很快会去修改当前的 |
95 | 接口。修改接口意味着,函数名可能会改变,结构体可能被扩充或者删减,函数 | 91 | 接口。修改接口意味着,函数名可能会改变,结构体可能被扩充或者删减,函数 |
96 | 的参数也可能发生改变。一旦接口被修改,内核中使用这些接口的地方需要同时 | 92 | 的参数也可能发生改变。一旦接口被修改,内核中使用这些接口的地方需要同时 |
@@ -98,21 +94,22 @@ Linux能成为强壮,稳定,成熟的操作系统,这也是你最开始选 | |||
98 | 94 | ||
99 | 举一个例子,内核的USB驱动程序接口在USB子系统的整个生命周期中,至少经历 | 95 | 举一个例子,内核的USB驱动程序接口在USB子系统的整个生命周期中,至少经历 |
100 | 了三次重写。这些重写解决以下问题: | 96 | 了三次重写。这些重写解决以下问题: |
97 | |||
101 | - 把数据流从同步模式改成非同步模式,这个改动减少了一些驱动程序的 | 98 | - 把数据流从同步模式改成非同步模式,这个改动减少了一些驱动程序的 |
102 | 复杂度,提高了所有USB驱动程序的吞吐率,这样几乎所有的USB设备都能以最大 | 99 | 复杂度,提高了所有USB驱动程序的吞吐率,这样几乎所有的USB设备都 |
103 | 速率工作了。 | 100 | 能以最大速率工作了。 |
104 | - 修改了USB核心代码中为USB驱动分配数据包内存的方式,所有的驱动都 | 101 | - 修改了USB核心代码中为USB驱动分配数据包内存的方式,所有的驱动都 |
105 | 需要提供更多的参数给USB核心,以修正了很多已经被记录在案的死锁。 | 102 | 需要提供更多的参数给USB核心,以修正了很多已经被记录在案的死锁。 |
106 | 103 | ||
107 | 这和一些封闭源代码的操作系统形成鲜明的对比,在那些操作系统上,不得不额 | 104 | 这和一些封闭源代码的操作系统形成鲜明的对比,在那些操作系统上,不得不额 |
108 | 外的维护旧的USB接口。这导致了一个可能性,新的开发者依然会不小心使用旧的 | 105 | 外的维护旧的USB接口。这导致了一个可能性,新的开发者依然会不小心使用旧的 |
109 | 接口,以不恰当的方式编写代码,进而影响到操作系统的稳定性。 | 106 | 接口,以不恰当的方式编写代码,进而影响到操作系统的稳定性。 |
110 | 在上面的例子中,所有的开发者都同意这些重要的改动,在这样的情况下修改代 | 107 | 在上面的例子中,所有的开发者都同意这些重要的改动,在这样的情况下修改代 |
111 | 价很低。如果Linux保持一个稳定的内核源代码接口,那么就得创建一个新的接口 | 108 | 价很低。如果Linux保持一个稳定的内核源代码接口,那么就得创建一个新的接口 |
112 | ;旧的,有问题的接口必须一直维护,给Linux USB开发者带来额外的工作。既然 | 109 | ;旧的,有问题的接口必须一直维护,给Linux USB开发者带来额外的工作。既然 |
113 | 所有的Linux USB驱动的作者都是利用自己的时间工作,那么要求他们去做毫无意 | 110 | 所有的Linux USB驱动的作者都是利用自己的时间工作,那么要求他们去做毫无意 |
114 | 义的免费额外工作,是不可能的。 | 111 | 义的免费额外工作,是不可能的。 |
115 | 安全问题对Linux来说十分重要。一个安全问题被发现,就会在短时间内得到修 | 112 | 安全问题对Linux来说十分重要。一个安全问题被发现,就会在短时间内得到修 |
116 | 正。在很多情况下,这将导致Linux内核中的一些接口被重写,以从根本上避免安 | 113 | 正。在很多情况下,这将导致Linux内核中的一些接口被重写,以从根本上避免安 |
117 | 全问题。一旦接口被重写,所有使用这些接口的驱动程序,必须同时得到修正, | 114 | 全问题。一旦接口被重写,所有使用这些接口的驱动程序,必须同时得到修正, |
118 | 以确定安全问题已经得到修复并且不可能在未来还有同样的安全问题。如果内核 | 115 | 以确定安全问题已经得到修复并且不可能在未来还有同样的安全问题。如果内核 |
@@ -124,7 +121,7 @@ Linux能成为强壮,稳定,成熟的操作系统,这也是你最开始选 | |||
124 | 121 | ||
125 | 122 | ||
126 | 要做什么 | 123 | 要做什么 |
127 | ------- | 124 | -------- |
128 | 125 | ||
129 | 如果你写了一个Linux内核驱动,但是它还不在Linux源代码树里,作为一个开发 | 126 | 如果你写了一个Linux内核驱动,但是它还不在Linux源代码树里,作为一个开发 |
130 | 者,你应该怎么做?为每个发布的每个版本提供一个二进制驱动,那简直是一个 | 127 | 者,你应该怎么做?为每个发布的每个版本提供一个二进制驱动,那简直是一个 |
@@ -137,20 +134,21 @@ Linux能成为强壮,稳定,成熟的操作系统,这也是你最开始选 | |||
137 | 做什么事情。 | 134 | 做什么事情。 |
138 | 135 | ||
139 | 把驱动放到内核源代码树里会有很多的好处: | 136 | 把驱动放到内核源代码树里会有很多的好处: |
137 | |||
140 | - 驱动的质量会提升,而维护成本(对原始作者来说)会下降。 | 138 | - 驱动的质量会提升,而维护成本(对原始作者来说)会下降。 |
141 | - 其他人会给驱动添加新特性。 | 139 | - 其他人会给驱动添加新特性。 |
142 | - 其他人会找到驱动中的bug并修复。 | 140 | - 其他人会找到驱动中的bug并修复。 |
143 | - 其他人会在驱动中找到性能优化的机会。 | 141 | - 其他人会在驱动中找到性能优化的机会。 |
144 | - 当外部的接口的改变需要修改驱动程序的时候,其他人会修改驱动程序 | 142 | - 当外部的接口的改变需要修改驱动程序的时候,其他人会修改驱动程序 |
145 | 。 | ||
146 | - 不需要联系任何发行商,这个驱动会自动的随着所有的Linux发布一起发 | 143 | - 不需要联系任何发行商,这个驱动会自动的随着所有的Linux发布一起发 |
147 | 布。 | 144 | 布。 |
148 | 145 | ||
149 | 和别的操作系统相比,Linux为更多不同的设备提供现成的驱动,而且能在更多不 | 146 | 和别的操作系统相比,Linux为更多不同的设备提供现成的驱动,而且能在更多不 |
150 | 同体系结构的处理器上支持这些设备。这个经过考验的开发模式,必然是错不了 | 147 | 同体系结构的处理器上支持这些设备。这个经过考验的开发模式,必然是错不了 |
151 | 的 :) | 148 | 的 :) |
152 | 149 | ||
153 | ------------- | 150 | 感谢 |
151 | ---- | ||
154 | 感谢 Randy Dunlap, Andrew Morton, David Brownell, Hanna Linder, | 152 | 感谢 Randy Dunlap, Andrew Morton, David Brownell, Hanna Linder, |
155 | Robert Love, and Nishanth Aravamudan 对于本文档早期版本的评审和建议。 | 153 | Robert Love, and Nishanth Aravamudan 对于本文档早期版本的评审和建议。 |
156 | 154 | ||
diff --git a/Documentation/translations/zh_CN/stable_kernel_rules.txt b/Documentation/translations/zh_CN/process/stable-kernel-rules.rst index db4ba5a0c39a..fba361f2ddfd 100644 --- a/Documentation/translations/zh_CN/stable_kernel_rules.txt +++ b/Documentation/translations/zh_CN/process/stable-kernel-rules.rst | |||
@@ -1,31 +1,26 @@ | |||
1 | Chinese translated version of Documentation/process/stable-kernel-rules.rst | 1 | .. _cn_stable_kernel_rules: |
2 | 2 | ||
3 | If you have any comment or update to the content, please contact the | 3 | .. include:: ../disclaimer-zh_CN.rst |
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | 4 | ||
9 | Chinese maintainer: TripleX Chung <triplex@zh-kernel.org> | 5 | :Original: :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` |
10 | --------------------------------------------------------------------- | ||
11 | Documentation/process/stable-kernel-rules.rst 的中文翻译 | ||
12 | 6 | ||
13 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | 7 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 |
14 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | 8 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 |
15 | 译存在问题,请联系中文版维护者。 | 9 | 译存在问题,请联系中文版维护者:: |
16 | 10 | ||
11 | 中文版维护者: 钟宇 TripleX Chung <xxx.phy@gmail.com> | ||
12 | 中文版翻译者: 钟宇 TripleX Chung <xxx.phy@gmail.com> | ||
13 | 中文版校译者: | ||
14 | - 李阳 Li Yang <leoyang.li@nxp.com> | ||
15 | - Kangkai Yin <e12051@motorola.com> | ||
17 | 16 | ||
18 | 中文版维护者: 钟宇 TripleX Chung <triplex@zh-kernel.org> | 17 | 所有你想知道的事情 - 关于linux稳定版发布 |
19 | 中文版翻译者: 钟宇 TripleX Chung <triplex@zh-kernel.org> | 18 | ======================================== |
20 | 中文版校译者: 李阳 Li Yang <leo@zh-kernel.org> | ||
21 | Kangkai Yin <e12051@motorola.com> | ||
22 | |||
23 | 以下为正文 | ||
24 | --------------------------------------------------------------------- | ||
25 | 19 | ||
26 | 关于Linux 2.6稳定版发布,所有你想知道的事情。 | 20 | 关于Linux 2.6稳定版发布,所有你想知道的事情。 |
27 | 21 | ||
28 | 关于哪些类型的补丁可以被接收进入稳定版代码树,哪些不可以的规则: | 22 | 关于哪些类型的补丁可以被接收进入稳定版代码树,哪些不可以的规则: |
23 | ---------------------------------------------------------------- | ||
29 | 24 | ||
30 | - 必须是显而易见的正确,并且经过测试的。 | 25 | - 必须是显而易见的正确,并且经过测试的。 |
31 | - 连同上下文,不能大于100行。 | 26 | - 连同上下文,不能大于100行。 |
@@ -38,9 +33,10 @@ Documentation/process/stable-kernel-rules.rst 的中文翻译 | |||
38 | - 没有“理论上的竞争条件”,除非能给出竞争条件如何被利用的解释。 | 33 | - 没有“理论上的竞争条件”,除非能给出竞争条件如何被利用的解释。 |
39 | - 不能存在任何的“琐碎的”修正(拼写修正,去掉多余空格之类的)。 | 34 | - 不能存在任何的“琐碎的”修正(拼写修正,去掉多余空格之类的)。 |
40 | - 必须被相关子系统的维护者接受。 | 35 | - 必须被相关子系统的维护者接受。 |
41 | - 必须遵循Documentation/process/submitting-patches.rst里的规则。 | 36 | - 必须遵循Documentation/translations/zh_CN/process/submitting-patches.rst里的规则。 |
42 | 37 | ||
43 | 向稳定版代码树提交补丁的过程: | 38 | 向稳定版代码树提交补丁的过程: |
39 | ------------------------------ | ||
44 | 40 | ||
45 | - 在确认了补丁符合以上的规则后,将补丁发送到stable@vger.kernel.org。 | 41 | - 在确认了补丁符合以上的规则后,将补丁发送到stable@vger.kernel.org。 |
46 | - 如果补丁被接受到队列里,发送者会收到一个ACK回复,如果没有被接受,收 | 42 | - 如果补丁被接受到队列里,发送者会收到一个ACK回复,如果没有被接受,收 |
@@ -49,6 +45,7 @@ Documentation/process/stable-kernel-rules.rst 的中文翻译 | |||
49 | - 安全方面的补丁不要发到这个列表,应该发送到security@kernel.org。 | 45 | - 安全方面的补丁不要发到这个列表,应该发送到security@kernel.org。 |
50 | 46 | ||
51 | 审查周期: | 47 | 审查周期: |
48 | ---------- | ||
52 | 49 | ||
53 | - 当稳定版的维护者决定开始一个审查周期,补丁将被发送到审查委员会,以 | 50 | - 当稳定版的维护者决定开始一个审查周期,补丁将被发送到审查委员会,以 |
54 | 及被补丁影响的领域的维护者(除非提交者就是该领域的维护者)并且抄送 | 51 | 及被补丁影响的领域的维护者(除非提交者就是该领域的维护者)并且抄送 |
@@ -63,4 +60,5 @@ Documentation/process/stable-kernel-rules.rst 的中文翻译 | |||
63 | 通常的审查周期。请联系内核安全小组以获得关于这个过程的更多细节。 | 60 | 通常的审查周期。请联系内核安全小组以获得关于这个过程的更多细节。 |
64 | 61 | ||
65 | 审查委员会: | 62 | 审查委员会: |
63 | ------------ | ||
66 | - 由一些自愿承担这项任务的内核开发者,和几个非志愿的组成。 | 64 | - 由一些自愿承担这项任务的内核开发者,和几个非志愿的组成。 |
diff --git a/Documentation/translations/zh_CN/process/submit-checklist.rst b/Documentation/translations/zh_CN/process/submit-checklist.rst new file mode 100644 index 000000000000..89061aa8fdbe --- /dev/null +++ b/Documentation/translations/zh_CN/process/submit-checklist.rst | |||
@@ -0,0 +1,107 @@ | |||
1 | .. include:: ../disclaimer-zh_CN.rst | ||
2 | |||
3 | :Original: :ref:`Documentation/process/submit-checklist.rst <submitchecklist>` | ||
4 | :Translator: Alex Shi <alex.shi@linux.alibaba.com> | ||
5 | |||
6 | .. _cn_submitchecklist: | ||
7 | |||
8 | Linux内核补丁提交清单 | ||
9 | ~~~~~~~~~~~~~~~~~~~~~ | ||
10 | |||
11 | 如果开发人员希望看到他们的内核补丁提交更快地被接受,那么他们应该做一些基本 | ||
12 | 的事情。 | ||
13 | |||
14 | 这些都是在 | ||
15 | :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>` | ||
16 | 和其他有关提交Linux内核补丁的文档中提供的。 | ||
17 | |||
18 | 1) 如果使用工具,则包括定义/声明该工具的文件。不要依赖于其他头文件拉入您使用 | ||
19 | 的头文件。 | ||
20 | |||
21 | 2) 干净的编译: | ||
22 | |||
23 | a) 使用适用或修改的 ``CONFIG`` 选项 ``=y``、``=m`` 和 ``=n`` 。没有GCC | ||
24 | 警告/错误,没有链接器警告/错误。 | ||
25 | |||
26 | b) 通过allnoconfig、allmodconfig | ||
27 | |||
28 | c) 使用 ``O=builddir`` 时可以成功编译 | ||
29 | |||
30 | 3) 通过使用本地交叉编译工具或其他一些构建场在多个CPU体系结构上构建。 | ||
31 | |||
32 | 4) PPC64是一种很好的交叉编译检查体系结构,因为它倾向于对64位的数使用无符号 | ||
33 | 长整型。 | ||
34 | |||
35 | 5) 如下所述 :ref:`Documentation/translations/zh_CN/process/coding-style.rst <cn_codingstyle>`. | ||
36 | 检查您的补丁是否为常规样式。在提交( ``scripts/check patch.pl`` )之前, | ||
37 | 使用补丁样式检查器检查是否有轻微的冲突。您应该能够处理您的补丁中存在的所有 | ||
38 | 违规行为。 | ||
39 | |||
40 | 6) 任何新的或修改过的 ``CONFIG`` 选项都不会弄脏配置菜单,并默认为关闭,除非 | ||
41 | 它们符合 ``Documentation/kbuild/kconfig-language.txt`` 中记录的异常条件, | ||
42 | 菜单属性:默认值. | ||
43 | |||
44 | 7) 所有新的 ``kconfig`` 选项都有帮助文本。 | ||
45 | |||
46 | 8) 已仔细审查了相关的 ``Kconfig`` 组合。这很难用测试来纠正——脑力在这里是有 | ||
47 | 回报的。 | ||
48 | |||
49 | 9) 用 sparse 检查干净。 | ||
50 | |||
51 | 10) 使用 ``make checkstack`` 和 ``make namespacecheck`` 并修复他们发现的任何 | ||
52 | 问题。 | ||
53 | |||
54 | .. note:: | ||
55 | |||
56 | ``checkstack`` 并没有明确指出问题,但是任何一个在堆栈上使用超过512 | ||
57 | 字节的函数都可以进行更改。 | ||
58 | |||
59 | 11) 包括 :ref:`kernel-doc <kernel_doc>` 内核文档以记录全局内核API。(静态函数 | ||
60 | 不需要,但也可以。)使用 ``make htmldocs`` 或 ``make pdfdocs`` 检查 | ||
61 | :ref:`kernel-doc <kernel_doc>` 并修复任何问题。 | ||
62 | |||
63 | 12) 通过以下选项同时启用的测试 ``CONFIG_PREEMPT``, ``CONFIG_DEBUG_PREEMPT``, | ||
64 | ``CONFIG_DEBUG_SLAB``, ``CONFIG_DEBUG_PAGEALLOC``, ``CONFIG_DEBUG_MUTEXES``, | ||
65 | ``CONFIG_DEBUG_SPINLOCK``, ``CONFIG_DEBUG_ATOMIC_SLEEP``, | ||
66 | ``CONFIG_PROVE_RCU`` and ``CONFIG_DEBUG_OBJECTS_RCU_HEAD`` | ||
67 | |||
68 | 13) 已经过构建和运行时测试,包括有或没有 ``CONFIG_SMP``, ``CONFIG_PREEMPT``. | ||
69 | |||
70 | 14) 如果补丁程序影响IO/磁盘等:使用或不使用 ``CONFIG_LBDAF`` 进行测试。 | ||
71 | |||
72 | 15) 所有代码路径都已在启用所有lockdep功能的情况下运行。 | ||
73 | |||
74 | 16) 所有新的/proc条目都记录在 ``Documentation/`` | ||
75 | |||
76 | 17) 所有新的内核引导参数都记录在 | ||
77 | Documentation/admin-guide/kernel-parameters.rst 中。 | ||
78 | |||
79 | 18) 所有新的模块参数都记录在 ``MODULE_PARM_DESC()`` | ||
80 | |||
81 | 19) 所有新的用户空间接口都记录在 ``Documentation/ABI/`` 中。有关详细信息, | ||
82 | 请参阅 ``Documentation/ABI/README`` 。更改用户空间接口的补丁应该抄送 | ||
83 | linux-api@vger.kernel.org。 | ||
84 | |||
85 | 20) 检查是否全部通过 ``make headers_check`` 。 | ||
86 | |||
87 | 21) 已通过至少注入slab和page分配失败进行检查。请参阅 ``Documentation/fault-injection/`` | ||
88 | 如果新代码是实质性的,那么添加子系统特定的故障注入可能是合适的。 | ||
89 | |||
90 | 22) 新添加的代码已经用 ``gcc -W`` 编译(使用 ``make EXTRA-CFLAGS=-W`` )。这 | ||
91 | 将产生大量噪声,但对于查找诸如“警告:有符号和无符号之间的比较”之类的错误 | ||
92 | 很有用。 | ||
93 | |||
94 | 23) 在它被合并到-mm补丁集中之后进行测试,以确保它仍然与所有其他排队的补丁以 | ||
95 | 及VM、VFS和其他子系统中的各种更改一起工作。 | ||
96 | |||
97 | 24) 所有内存屏障例如 ``barrier()``, ``rmb()``, ``wmb()`` 都需要源代码中的注 | ||
98 | 释来解释它们正在执行的操作及其原因的逻辑。 | ||
99 | |||
100 | 25) 如果补丁添加了任何ioctl,那么也要更新 ``Documentation/ioctl/ioctl-number.txt`` | ||
101 | |||
102 | 26) 如果修改后的源代码依赖或使用与以下 ``Kconfig`` 符号相关的任何内核API或 | ||
103 | 功能,则在禁用相关 ``Kconfig`` 符号和/或 ``=m`` (如果该选项可用)的情况 | ||
104 | 下测试以下多个构建[并非所有这些都同时存在,只是它们的各种/随机组合]: | ||
105 | |||
106 | ``CONFIG_SMP``, ``CONFIG_SYSFS``, ``CONFIG_PROC_FS``, ``CONFIG_INPUT``, ``CONFIG_PCI``, ``CONFIG_BLOCK``, ``CONFIG_PM``, ``CONFIG_MAGIC_SYSRQ``, | ||
107 | ``CONFIG_NET``, ``CONFIG_INET=n`` (但是后者伴随 ``CONFIG_NET=y``). | ||
diff --git a/Documentation/translations/zh_CN/SubmittingDrivers b/Documentation/translations/zh_CN/process/submitting-drivers.rst index 15e73562f710..72c6cd935821 100644 --- a/Documentation/translations/zh_CN/SubmittingDrivers +++ b/Documentation/translations/zh_CN/process/submitting-drivers.rst | |||
@@ -1,36 +1,28 @@ | |||
1 | Chinese translated version of Documentation/process/submitting-drivers.rst | 1 | .. _cn_submittingdrivers: |
2 | 2 | ||
3 | If you have any comment or update to the content, please contact the | 3 | .. include:: ../disclaimer-zh_CN.rst |
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | 4 | ||
9 | Chinese maintainer: Li Yang <leo@zh-kernel.org> | 5 | :Original: :ref:`Documentation/process/submitting-drivers.rst |
10 | --------------------------------------------------------------------- | 6 | <submittingdrivers>` |
11 | Documentation/process/submitting-drivers.rst 的中文翻译 | ||
12 | 7 | ||
13 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | 8 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 |
14 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | 9 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 |
15 | 译存在问题,请联系中文版维护者。 | 10 | 译存在问题,请联系中文版维护者:: |
16 | 11 | ||
17 | 中文版维护者: 李阳 Li Yang <leo@zh-kernel.org> | 12 | 中文版维护者: 李阳 Li Yang <leoyang.li@nxp.com> |
18 | 中文版翻译者: 李阳 Li Yang <leo@zh-kernel.org> | 13 | 中文版翻译者: 李阳 Li Yang <leoyang.li@nxp.com> |
19 | 中文版校译者: 陈琦 Maggie Chen <chenqi@beyondsoft.com> | 14 | 中文版校译者: 陈琦 Maggie Chen <chenqi@beyondsoft.com> |
20 | 王聪 Wang Cong <xiyou.wangcong@gmail.com> | 15 | 王聪 Wang Cong <xiyou.wangcong@gmail.com> |
21 | 张巍 Zhang Wei <Wei.Zhang@freescale.com> | 16 | 张巍 Zhang Wei <wezhang@outlook.com> |
22 | |||
23 | 以下为正文 | ||
24 | --------------------------------------------------------------------- | ||
25 | 17 | ||
26 | 如何向 Linux 内核提交驱动程序 | 18 | 如何向 Linux 内核提交驱动程序 |
27 | ----------------------------- | 19 | ============================= |
28 | 20 | ||
29 | 这篇文档将会解释如何向不同的内核源码树提交设备驱动程序。请注意,如果你感 | 21 | 这篇文档将会解释如何向不同的内核源码树提交设备驱动程序。请注意,如果你感 |
30 | 兴趣的是显卡驱动程序,你也许应该访问 XFree86 项目(http://www.xfree86.org/) | 22 | 兴趣的是显卡驱动程序,你也许应该访问 XFree86 项目(http://www.xfree86.org/) |
31 | 和/或 X.org 项目 (http://x.org)。 | 23 | 和/或 X.org 项目 (http://x.org)。 |
32 | 24 | ||
33 | 另请参阅 Documentation/process/submitting-patches.rst 文档。 | 25 | 另请参阅 Documentation/Documentation/translations/zh_CN/process/submitting-patches.rst 文档。 |
34 | 26 | ||
35 | 27 | ||
36 | 分配设备号 | 28 | 分配设备号 |
@@ -145,9 +137,13 @@ Linux 设备驱动程序,第三版(探讨 2.6.10 版内核): | |||
145 | 137 | ||
146 | LWN.net: | 138 | LWN.net: |
147 | 每周内核开发活动摘要 - http://lwn.net/ | 139 | 每周内核开发活动摘要 - http://lwn.net/ |
140 | |||
148 | 2.6 版中 API 的变更: | 141 | 2.6 版中 API 的变更: |
142 | |||
149 | http://lwn.net/Articles/2.6-kernel-api/ | 143 | http://lwn.net/Articles/2.6-kernel-api/ |
144 | |||
150 | 将旧版内核的驱动程序移植到 2.6 版: | 145 | 将旧版内核的驱动程序移植到 2.6 版: |
146 | |||
151 | http://lwn.net/Articles/driver-porting/ | 147 | http://lwn.net/Articles/driver-porting/ |
152 | 148 | ||
153 | 内核新手(KernelNewbies): | 149 | 内核新手(KernelNewbies): |
diff --git a/Documentation/translations/zh_CN/process/submitting-patches.rst b/Documentation/translations/zh_CN/process/submitting-patches.rst new file mode 100644 index 000000000000..437c23b367bb --- /dev/null +++ b/Documentation/translations/zh_CN/process/submitting-patches.rst | |||
@@ -0,0 +1,682 @@ | |||
1 | .. _cn_submittingpatches: | ||
2 | |||
3 | .. include:: ../disclaimer-zh_CN.rst | ||
4 | |||
5 | :Original: :ref:`Documentation/process/submitting-patches.rst <submittingpatches>` | ||
6 | |||
7 | 译者:: | ||
8 | |||
9 | 中文版维护者: 钟宇 TripleX Chung <xxx.phy@gmail.com> | ||
10 | 中文版翻译者: 钟宇 TripleX Chung <xxx.phy@gmail.com> | ||
11 | 时奎亮 Alex Shi <alex.shi@linux.alibaba.com> | ||
12 | 中文版校译者: 李阳 Li Yang <leoyang.li@nxp.com> | ||
13 | 王聪 Wang Cong <xiyou.wangcong@gmail.com> | ||
14 | |||
15 | |||
16 | 如何让你的改动进入内核 | ||
17 | ====================== | ||
18 | |||
19 | 对于想要将改动提交到 Linux 内核的个人或者公司来说,如果不熟悉“规矩”, | ||
20 | 提交的流程会让人畏惧。本文档收集了一系列建议,这些建议可以大大的提高你 | ||
21 | 的改动被接受的机会. | ||
22 | |||
23 | 以下文档含有大量简洁的建议, 具体请见: | ||
24 | :ref:`Documentation/process <development_process_main>` | ||
25 | 同样,:ref:`Documentation/translations/zh_CN/process/submit-checklist.rst <cn_submitchecklist>` | ||
26 | 给出在提交代码前需要检查的项目的列表。如果你在提交一个驱动程序,那么 | ||
27 | 同时阅读一下: | ||
28 | :ref:`Documentation/process/submitting-drivers.rst <submittingdrivers>` | ||
29 | |||
30 | 其中许多步骤描述了Git版本控制系统的默认行为;如果您使用Git来准备补丁, | ||
31 | 您将发现它为您完成的大部分机械工作,尽管您仍然需要准备和记录一组合理的 | ||
32 | 补丁。一般来说,使用git将使您作为内核开发人员的生活更轻松。 | ||
33 | |||
34 | |||
35 | 0) 获取当前源码树 | ||
36 | ----------------- | ||
37 | |||
38 | 如果您没有一个可以使用当前内核源代码的存储库,请使用git获取一个。您将要 | ||
39 | 从主线存储库开始,它可以通过以下方式获取:: | ||
40 | |||
41 | git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git | ||
42 | |||
43 | 但是,请注意,您可能不希望直接针对主线树进行开发。大多数子系统维护人员运 | ||
44 | 行自己的树,并希望看到针对这些树准备的补丁。请参见MAINTAINERS文件中子系 | ||
45 | 统的 **T:** 项以查找该树,或者简单地询问维护者该树是否未在其中列出。 | ||
46 | |||
47 | 仍然可以通过tarballs下载内核版本(如下一节所述),但这是进行内核开发的 | ||
48 | 一种困难的方式。 | ||
49 | |||
50 | 1) "diff -up" | ||
51 | ------------- | ||
52 | |||
53 | 使用 "diff -up" 或者 "diff -uprN" 来创建补丁。 | ||
54 | |||
55 | 所有内核的改动,都是以补丁的形式呈现的,补丁由 diff(1) 生成。创建补丁的 | ||
56 | 时候,要确认它是以 "unified diff" 格式创建的,这种格式由 diff(1) 的 '-u' | ||
57 | 参数生成。而且,请使用 '-p' 参数,那样会显示每个改动所在的C函数,使得 | ||
58 | 产生的补丁容易读得多。补丁应该基于内核源代码树的根目录,而不是里边的任 | ||
59 | 何子目录。 | ||
60 | |||
61 | 为一个单独的文件创建补丁,一般来说这样做就够了:: | ||
62 | |||
63 | SRCTREE=linux | ||
64 | MYFILE=drivers/net/mydriver.c | ||
65 | |||
66 | cd $SRCTREE | ||
67 | cp $MYFILE $MYFILE.orig | ||
68 | vi $MYFILE # make your change | ||
69 | cd .. | ||
70 | diff -up $SRCTREE/$MYFILE{.orig,} > /tmp/patch | ||
71 | |||
72 | 为多个文件创建补丁,你可以解开一个没有修改过的内核源代码树,然后和你自 | ||
73 | 己的代码树之间做 diff 。例如:: | ||
74 | |||
75 | MYSRC=/devel/linux | ||
76 | |||
77 | tar xvfz linux-3.19.tar.gz | ||
78 | mv linux-3.19 linux-3.19-vanilla | ||
79 | diff -uprN -X linux-3.19-vanilla/Documentation/dontdiff \ | ||
80 | linux-3.19-vanilla $MYSRC > /tmp/patch | ||
81 | |||
82 | "dontdiff" 是内核在编译的时候产生的文件的列表,列表中的文件在 diff(1) | ||
83 | 产生的补丁里会被跳过。 | ||
84 | |||
85 | 确定你的补丁里没有包含任何不属于这次补丁提交的额外文件。记得在用diff(1) | ||
86 | 生成补丁之后,审阅一次补丁,以确保准确。 | ||
87 | |||
88 | 如果你的改动很散乱,你应该研究一下如何将补丁分割成独立的部分,将改动分 | ||
89 | 割成一系列合乎逻辑的步骤。这样更容易让其他内核开发者审核,如果你想你的 | ||
90 | 补丁被接受,这是很重要的。请参阅: | ||
91 | :ref:`cn_split_changes` | ||
92 | |||
93 | 如果你用 ``git`` , ``git rebase -i`` 可以帮助你这一点。如果你不用 ``git``, | ||
94 | ``quilt`` <http://savannah.nongnu.org/projects/quilt> 另外一个流行的选择。 | ||
95 | |||
96 | .. _cn_describe_changes: | ||
97 | |||
98 | 2) 描述你的改动 | ||
99 | --------------- | ||
100 | |||
101 | 描述你的问题。无论您的补丁是一行错误修复还是5000行新功能,都必须有一个潜在 | ||
102 | 的问题激励您完成这项工作。让审稿人相信有一个问题值得解决,让他们读完第一段 | ||
103 | 是有意义的。 | ||
104 | |||
105 | 描述用户可见的影响。直接崩溃和锁定是相当有说服力的,但并不是所有的错误都那么 | ||
106 | 明目张胆。即使在代码审查期间发现了这个问题,也要描述一下您认为它可能对用户产 | ||
107 | 生的影响。请记住,大多数Linux安装运行的内核来自二级稳定树或特定于供应商/产品 | ||
108 | 的树,只从上游精选特定的补丁,因此请包含任何可以帮助您将更改定位到下游的内容: | ||
109 | 触发的场景、DMESG的摘录、崩溃描述、性能回归、延迟尖峰、锁定等。 | ||
110 | |||
111 | 量化优化和权衡。如果您声称在性能、内存消耗、堆栈占用空间或二进制大小方面有所 | ||
112 | 改进,请包括支持它们的数字。但也要描述不明显的成本。优化通常不是免费的,而是 | ||
113 | 在CPU、内存和可读性之间进行权衡;或者,探索性的工作,在不同的工作负载之间进 | ||
114 | 行权衡。请描述优化的预期缺点,以便审阅者可以权衡成本和收益。 | ||
115 | |||
116 | 一旦问题建立起来,就要详细地描述一下您实际在做什么。对于审阅者来说,用简单的 | ||
117 | 英语描述代码的变化是很重要的,以验证代码的行为是否符合您的意愿。 | ||
118 | |||
119 | 如果您将补丁描述写在一个表单中,这个表单可以很容易地作为“提交日志”放入Linux | ||
120 | 的源代码管理系统git中,那么维护人员将非常感谢您。见 :ref:`cn_explicit_in_reply_to`. | ||
121 | |||
122 | 每个补丁只解决一个问题。如果你的描述开始变长,这就表明你可能需要拆分你的补丁。 | ||
123 | 请见 :ref:`cn_split_changes` | ||
124 | |||
125 | 提交或重新提交修补程序或修补程序系列时,请包括完整的修补程序说明和理由。不要 | ||
126 | 只说这是补丁(系列)的第几版。不要期望子系统维护人员引用更早的补丁版本或引用 | ||
127 | URL来查找补丁描述并将其放入补丁中。也就是说,补丁(系列)及其描述应该是独立的。 | ||
128 | 这对维护人员和审查人员都有好处。一些评审者可能甚至没有收到补丁的早期版本。 | ||
129 | |||
130 | 描述你在命令语气中的变化,例如“make xyzzy do frotz”而不是“[这个补丁]make | ||
131 | xyzzy do frotz”或“[我]changed xyzzy to do frotz”,就好像你在命令代码库改变 | ||
132 | 它的行为一样。 | ||
133 | |||
134 | 如果修补程序修复了一个记录的bug条目,请按编号和URL引用该bug条目。如果补丁来 | ||
135 | 自邮件列表讨论,请给出邮件列表存档的URL;使用带有 ``Message-ID`` 的 | ||
136 | https://lkml.kernel.org/ 重定向,以确保链接不会过时。 | ||
137 | |||
138 | 但是,在没有外部资源的情况下,尽量让你的解释可理解。除了提供邮件列表存档或 | ||
139 | bug的URL之外,还要总结需要提交补丁的相关讨论要点。 | ||
140 | |||
141 | 如果您想要引用一个特定的提交,不要只引用提交的 SHA-1 ID。还请包括提交的一行 | ||
142 | 摘要,以便于审阅者了解它是关于什么的。例如:: | ||
143 | |||
144 | Commit e21d2170f36602ae2708 ("video: remove unnecessary | ||
145 | platform_set_drvdata()") removed the unnecessary | ||
146 | platform_set_drvdata(), but left the variable "dev" unused, | ||
147 | delete it. | ||
148 | |||
149 | 您还应该确保至少使用前12位 SHA-1 ID. 内核存储库包含*许多*对象,使与较短的ID | ||
150 | 发生冲突的可能性很大。记住,即使现在不会与您的六个字符ID发生冲突,这种情况 | ||
151 | 可能五年后改变。 | ||
152 | |||
153 | 如果修补程序修复了特定提交中的错误,例如,使用 ``git bisct`` ,请使用带有前 | ||
154 | 12个字符SHA-1 ID 的"Fixes:"标记和单行摘要。为了简化不要将标记拆分为多个, | ||
155 | 行、标记不受分析脚本“75列换行”规则的限制。例如:: | ||
156 | |||
157 | Fixes: 54a4f0239f2e ("KVM: MMU: make kvm_mmu_zap_page() return the number of pages it actually freed") | ||
158 | |||
159 | 下列 ``git config`` 设置可以添加让 ``git log``, ``git show`` 漂亮的显示格式:: | ||
160 | |||
161 | [core] | ||
162 | abbrev = 12 | ||
163 | [pretty] | ||
164 | fixes = Fixes: %h (\"%s\") | ||
165 | |||
166 | .. _cn_split_changes: | ||
167 | |||
168 | 3) 拆分你的改动 | ||
169 | --------------- | ||
170 | |||
171 | 将每个逻辑更改分隔成一个单独的补丁。 | ||
172 | |||
173 | 例如,如果你的改动里同时有bug修正和性能优化,那么把这些改动拆分到两个或 | ||
174 | 者更多的补丁文件中。如果你的改动包含对API的修改,并且修改了驱动程序来适 | ||
175 | 应这些新的API,那么把这些修改分成两个补丁。 | ||
176 | |||
177 | 另一方面,如果你将一个单独的改动做成多个补丁文件,那么将它们合并成一个 | ||
178 | 单独的补丁文件。这样一个逻辑上单独的改动只被包含在一个补丁文件里。 | ||
179 | |||
180 | 如果有一个补丁依赖另外一个补丁来完成它的改动,那没问题。简单的在你的补 | ||
181 | 丁描述里指出“这个补丁依赖某补丁”就好了。 | ||
182 | |||
183 | 在将您的更改划分为一系列补丁时,要特别注意确保内核在系列中的每个补丁之后 | ||
184 | 都能正常构建和运行。使用 ``git bisect`` 来追踪问题的开发者可能会在任何时 | ||
185 | 候分割你的补丁系列;如果你在中间引入错误,他们不会感谢你。 | ||
186 | |||
187 | 如果你不能将补丁浓缩成更少的文件,那么每次大约发送出15个,然后等待审查 | ||
188 | 和集成。 | ||
189 | |||
190 | 4) 检查你的更改风格 | ||
191 | ------------------- | ||
192 | |||
193 | 检查您的补丁是否存在基本样式冲突,详细信息可在 | ||
194 | :ref:`Documentation/translations/zh_CN/process/coding-style.rst <cn_codingstyle>` | ||
195 | 中找到。如果不这样做,只会浪费审稿人的时间,并且会导致你的补丁被拒绝,甚至 | ||
196 | 可能没有被阅读。 | ||
197 | |||
198 | 一个重要的例外是在将代码从一个文件移动到另一个文件时——在这种情况下,您不应 | ||
199 | 该在移动代码的同一个补丁中修改移动的代码。这清楚地描述了移动代码和您的更改 | ||
200 | 的行为。这大大有助于审查实际差异,并允许工具更好地跟踪代码本身的历史。 | ||
201 | |||
202 | 在提交之前,使用补丁样式检查程序检查补丁(scripts/check patch.pl)。不过, | ||
203 | 请注意,样式检查程序应该被视为一个指南,而不是作为人类判断的替代品。如果您 | ||
204 | 的代码看起来更好,但有违规行为,那么最好不要使用它。 | ||
205 | |||
206 | 检查者报告三个级别: | ||
207 | |||
208 | - ERROR:很可能出错的事情 | ||
209 | - WARNING:需要仔细审查的事项 | ||
210 | - CHECK:需要思考的事情 | ||
211 | |||
212 | 您应该能够判断您的补丁中存在的所有违规行为。 | ||
213 | |||
214 | 5) 选择补丁收件人 | ||
215 | ----------------- | ||
216 | |||
217 | 您应该总是在任何补丁上复制相应的子系统维护人员,以获得他们维护的代码;查看 | ||
218 | 维护人员文件和源代码修订历史记录,以了解这些维护人员是谁。脚本 | ||
219 | scripts/get_Maintainer.pl在这个步骤中非常有用。如果您找不到正在工作的子系统 | ||
220 | 的维护人员,那么Andrew Morton(akpm@linux-foundation.org)将充当最后的维护 | ||
221 | 人员。 | ||
222 | |||
223 | 您通常还应该选择至少一个邮件列表来接收补丁集的。linux-kernel@vger.kernel.org | ||
224 | 作为最后一个解决办法的列表,但是这个列表上的体积已经引起了许多开发人员的拒绝。 | ||
225 | 在MAINTAINERS文件中查找子系统特定的列表;您的补丁可能会在那里得到更多的关注。 | ||
226 | 不过,请不要发送垃圾邮件到无关的列表。 | ||
227 | |||
228 | 许多与内核相关的列表托管在vger.kernel.org上;您可以在 | ||
229 | http://vger.kernel.org/vger-lists.html 上找到它们的列表。不过,也有与内核相关 | ||
230 | 的列表托管在其他地方。 | ||
231 | |||
232 | 不要一次发送超过15个补丁到vger邮件列表!!!! | ||
233 | |||
234 | Linus Torvalds 是决定改动能否进入 Linux 内核的最终裁决者。他的 e-mail | ||
235 | 地址是 <torvalds@linux-foundation.org> 。他收到的 e-mail 很多,所以一般 | ||
236 | 的说,最好别给他发 e-mail。 | ||
237 | |||
238 | 如果您有修复可利用安全漏洞的补丁,请将该补丁发送到 security@kernel.org。对于 | ||
239 | 严重的bug,可以考虑短期暂停以允许分销商向用户发布补丁;在这种情况下,显然不应 | ||
240 | 将补丁发送到任何公共列表。 | ||
241 | |||
242 | 修复已发布内核中严重错误的补丁程序应该指向稳定版维护人员,方法是放这样的一行:: | ||
243 | |||
244 | Cc: stable@vger.kernel.org | ||
245 | |||
246 | 进入补丁的签准区(注意,不是电子邮件收件人)。除了这个文件之外,您还应该阅读 | ||
247 | :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` | ||
248 | |||
249 | 但是,请注意,一些子系统维护人员希望得出他们自己的结论,即哪些补丁应该被放到 | ||
250 | 稳定的树上。尤其是网络维护人员,不希望看到单个开发人员在补丁中添加像上面这样 | ||
251 | 的行。 | ||
252 | |||
253 | 如果更改影响到用户和内核接口,请向手册页维护人员(如维护人员文件中所列)发送 | ||
254 | 手册页补丁,或至少发送更改通知,以便一些信息进入手册页。还应将用户空间API | ||
255 | 更改复制到 linux-api@vger.kernel.org。 | ||
256 | |||
257 | 对于小的补丁,你也许会CC到搜集琐碎补丁的邮件列表(Trivial Patch Monkey) | ||
258 | trivial@kernel.org,那里专门收集琐碎的补丁。下面这样的补丁会被看作“琐碎的” | ||
259 | 补丁: | ||
260 | |||
261 | - 文档的拼写修正。 | ||
262 | - 修正会影响到 grep(1) 的拼写。 | ||
263 | - 警告信息修正(频繁的打印无用的警告是不好的。) | ||
264 | - 编译错误修正(代码逻辑的确是对的,只是编译有问题。) | ||
265 | - 运行时修正(只要真的修正了错误。) | ||
266 | - 移除使用了被废弃的函数/宏的代码(例如 check_region。) | ||
267 | - 联系方式和文档修正。 | ||
268 | - 用可移植的代码替换不可移植的代码(即使在体系结构相关的代码中,既然有 | ||
269 | - 人拷贝,只要它是琐碎的) | ||
270 | - 任何文件的作者/维护者对该文件的改动(例如 patch monkey 在重传模式下) | ||
271 | |||
272 | (译注,关于“琐碎补丁”的一些说明:因为原文的这一部分写得比较简单,所以不得不 | ||
273 | 违例写一下译注。"trivial"这个英文单词的本意是“琐碎的,不重要的。”但是在这里 | ||
274 | 有稍微有一些变化,例如对一些明显的NULL指针的修正,属于运行时修正,会被归类 | ||
275 | 到琐碎补丁里。虽然NULL指针的修正很重要,但是这样的修正往往很小而且很容易得到 | ||
276 | 检验,所以也被归入琐碎补丁。琐碎补丁更精确的归类应该是 | ||
277 | “simple, localized & easy to verify”,也就是说简单的,局部的和易于检验的。 | ||
278 | trivial@kernel.org邮件列表的目的是针对这样的补丁,为提交者提供一个中心,来 | ||
279 | 降低提交的门槛。) | ||
280 | |||
281 | 6) 没有 MIME 编码,没有链接,没有压缩,没有附件,只有纯文本 | ||
282 | ----------------------------------------------------------- | ||
283 | |||
284 | Linus 和其他的内核开发者需要阅读和评论你提交的改动。对于内核开发者来说 | ||
285 | ,可以“引用”你的改动很重要,使用一般的 e-mail 工具,他们就可以在你的 | ||
286 | 代码的任何位置添加评论。 | ||
287 | |||
288 | 因为这个原因,所有的提交的补丁都是 e-mail 中“内嵌”的。 | ||
289 | |||
290 | .. warning:: | ||
291 | 如果你使用剪切-粘贴你的补丁,小心你的编辑器的自动换行功能破坏你的补丁 | ||
292 | |||
293 | 不要将补丁作为 MIME 编码的附件,不管是否压缩。很多流行的 e-mail 软件不 | ||
294 | 是任何时候都将 MIME 编码的附件当作纯文本发送的,这会使得别人无法在你的 | ||
295 | 代码中加评论。另外,MIME 编码的附件会让 Linus 多花一点时间来处理,这就 | ||
296 | 降低了你的改动被接受的可能性。 | ||
297 | |||
298 | 例外:如果你的邮递员弄坏了补丁,那么有人可能会要求你使用mime重新发送补丁 | ||
299 | |||
300 | 请参阅 :ref:`Documentation/translations/zh_CN/process/email-clients.rst <cn_email_clients>` | ||
301 | 以获取有关配置电子邮件客户端以使其不受影响地发送修补程序的提示。 | ||
302 | |||
303 | 7) e-mail 的大小 | ||
304 | ---------------- | ||
305 | |||
306 | 大的改动对邮件列表不合适,对某些维护者也不合适。如果你的补丁,在不压缩 | ||
307 | 的情况下,超过了300kB,那么你最好将补丁放在一个能通过 internet 访问的服 | ||
308 | 务器上,然后用指向你的补丁的 URL 替代。但是请注意,如果您的补丁超过了 | ||
309 | 300kb,那么它几乎肯定需要被破坏。 | ||
310 | |||
311 | 8)回复评审意见 | ||
312 | --------------- | ||
313 | |||
314 | 你的补丁几乎肯定会得到评审者对补丁改进方法的评论。您必须对这些评论作出 | ||
315 | 回应;让补丁被忽略的一个好办法就是忽略审阅者的意见。不会导致代码更改的 | ||
316 | 意见或问题几乎肯定会带来注释或变更日志的改变,以便下一个评审者更好地了解 | ||
317 | 正在发生的事情。 | ||
318 | |||
319 | 一定要告诉审稿人你在做什么改变,并感谢他们的时间。代码审查是一个累人且 | ||
320 | 耗时的过程,审查人员有时会变得暴躁。即使在这种情况下,也要礼貌地回应并 | ||
321 | 解决他们指出的问题。 | ||
322 | |||
323 | 9)不要泄气或不耐烦 | ||
324 | ------------------- | ||
325 | |||
326 | 提交更改后,请耐心等待。审阅者是忙碌的人,可能无法立即访问您的修补程序。 | ||
327 | |||
328 | 曾几何时,补丁曾在没有评论的情况下消失在空白中,但开发过程比现在更加顺利。 | ||
329 | 您应该在一周左右的时间内收到评论;如果没有收到评论,请确保您已将补丁发送 | ||
330 | 到正确的位置。在重新提交或联系审阅者之前至少等待一周-在诸如合并窗口之类的 | ||
331 | 繁忙时间可能更长。 | ||
332 | |||
333 | 10)主题中包含 PATCH | ||
334 | -------------------- | ||
335 | |||
336 | 由于到linus和linux内核的电子邮件流量很高,通常会在主题行前面加上[PATCH] | ||
337 | 前缀. 这使Linus和其他内核开发人员更容易将补丁与其他电子邮件讨论区分开。 | ||
338 | |||
339 | 11)签署你的作品-开发者原始认证 | ||
340 | ------------------------------- | ||
341 | |||
342 | 为了加强对谁做了何事的追踪,尤其是对那些透过好几层的维护者的补丁,我们 | ||
343 | 建议在发送出去的补丁上加一个 “sign-off” 的过程。 | ||
344 | |||
345 | "sign-off" 是在补丁的注释的最后的简单的一行文字,认证你编写了它或者其他 | ||
346 | 人有权力将它作为开放源代码的补丁传递。规则很简单:如果你能认证如下信息: | ||
347 | |||
348 | 开发者来源证书 1.1 | ||
349 | ^^^^^^^^^^^^^^^^^^ | ||
350 | |||
351 | 对于本项目的贡献,我认证如下信息: | ||
352 | |||
353 | (a)这些贡献是完全或者部分的由我创建,我有权利以文件中指出 | ||
354 | 的开放源代码许可证提交它;或者 | ||
355 | (b)这些贡献基于以前的工作,据我所知,这些以前的工作受恰当的开放 | ||
356 | 源代码许可证保护,而且,根据许可证,我有权提交修改后的贡献, | ||
357 | 无论是完全还是部分由我创造,这些贡献都使用同一个开放源代码许可证 | ||
358 | (除非我被允许用其它的许可证),正如文件中指出的;或者 | ||
359 | (c)这些贡献由认证(a),(b)或者(c)的人直接提供给我,而 | ||
360 | 且我没有修改它。 | ||
361 | (d)我理解并同意这个项目和贡献是公开的,贡献的记录(包括我 | ||
362 | 一起提交的个人记录,包括 sign-off )被永久维护并且可以和这个项目 | ||
363 | 或者开放源代码的许可证同步地再发行。 | ||
364 | |||
365 | 那么加入这样一行:: | ||
366 | |||
367 | Signed-off-by: Random J Developer <random@developer.example.org> | ||
368 | |||
369 | 使用你的真名(抱歉,不能使用假名或者匿名。) | ||
370 | |||
371 | 有人在最后加上标签。现在这些东西会被忽略,但是你可以这样做,来标记公司 | ||
372 | 内部的过程,或者只是指出关于 sign-off 的一些特殊细节。 | ||
373 | |||
374 | 如果您是子系统或分支维护人员,有时需要稍微修改收到的补丁,以便合并它们, | ||
375 | 因为树和提交者中的代码不完全相同。如果你严格遵守规则(c),你应该要求提交者 | ||
376 | 重新发布,但这完全是在浪费时间和精力。规则(b)允许您调整代码,但是更改一个 | ||
377 | 提交者的代码并让他认可您的错误是非常不礼貌的。要解决此问题,建议在最后一个 | ||
378 | 由签名行和您的行之间添加一行,指示更改的性质。虽然这并不是强制性的,但似乎 | ||
379 | 在描述前加上您的邮件和/或姓名(全部用方括号括起来),这足以让人注意到您对最 | ||
380 | 后一分钟的更改负有责任。例如:: | ||
381 | |||
382 | Signed-off-by: Random J Developer <random@developer.example.org> | ||
383 | [lucky@maintainer.example.org: struct foo moved from foo.c to foo.h] | ||
384 | Signed-off-by: Lucky K Maintainer <lucky@maintainer.example.org> | ||
385 | |||
386 | 如果您维护一个稳定的分支机构,同时希望对作者进行致谢、跟踪更改、合并修复并 | ||
387 | 保护提交者不受投诉,那么这种做法尤其有用。请注意,在任何情况下都不能更改作者 | ||
388 | 的ID(From 头),因为它是出现在更改日志中的标识。 | ||
389 | |||
390 | 对回合(back-porters)的特别说明:在提交消息的顶部(主题行之后)插入一个补丁 | ||
391 | 的起源指示似乎是一种常见且有用的实践,以便于跟踪。例如,下面是我们在3.x稳定 | ||
392 | 版本中看到的内容:: | ||
393 | |||
394 | Date: Tue Oct 7 07:26:38 2014 -0400 | ||
395 | |||
396 | libata: Un-break ATA blacklist | ||
397 | |||
398 | commit 1c40279960bcd7d52dbdf1d466b20d24b99176c8 upstream. | ||
399 | |||
400 | 还有, 这里是一个旧版内核中的一个回合补丁:: | ||
401 | |||
402 | Date: Tue May 13 22:12:27 2008 +0200 | ||
403 | |||
404 | wireless, airo: waitbusy() won't delay | ||
405 | |||
406 | [backport of 2.6 commit b7acbdfbd1f277c1eb23f344f899cfa4cd0bf36a] | ||
407 | |||
408 | 12)何时使用Acked-by:,CC:,和Co-Developed by: | ||
409 | ---------------------------------------------- | ||
410 | |||
411 | Singed-off-by: 标记表示签名者参与了补丁的开发,或者他/她在补丁的传递路径中。 | ||
412 | |||
413 | 如果一个人没有直接参与补丁的准备或处理,但希望表示并记录他们对补丁的批准, | ||
414 | 那么他们可以要求在补丁的变更日志中添加一个 Acked-by: | ||
415 | |||
416 | Acked-by:通常由受影响代码的维护者使用,当该维护者既没有贡献也没有转发补丁时。 | ||
417 | |||
418 | Acked-by: 不像签字人那样正式。这是一个记录,确认人至少审查了补丁,并表示接受。 | ||
419 | 因此,补丁合并有时会手动将Acker的“Yep,looks good to me”转换为 Acked-By:(但 | ||
420 | 请注意,通常最好要求一个明确的Ack)。 | ||
421 | |||
422 | Acked-by:不一定表示对整个补丁的确认。例如,如果一个补丁影响多个子系统,并且 | ||
423 | 有一个:来自一个子系统维护者,那么这通常表示只确认影响维护者代码的部分。这里 | ||
424 | 应该仔细判断。如有疑问,应参考邮件列表档案中的原始讨论。 | ||
425 | |||
426 | 如果某人有机会对补丁进行评论,但没有提供此类评论,您可以选择在补丁中添加 ``Cc:`` | ||
427 | 这是唯一一个标签,它可以在没有被它命名的人显式操作的情况下添加,但它应该表明 | ||
428 | 这个人是在补丁上抄送的。讨论中包含了潜在利益相关方。 | ||
429 | |||
430 | Co-developed-by: 声明补丁是由多个开发人员共同创建的;当几个人在一个补丁上工 | ||
431 | 作时,它用于将属性赋予共同作者(除了 From: 所赋予的作者之外)。因为 | ||
432 | Co-developed-by: 表示作者身份,所以每个共同开发人:必须紧跟在相关合作作者的 | ||
433 | 签名之后。标准的签核程序要求:标记的签核顺序应尽可能反映补丁的时间历史,而不 | ||
434 | 管作者是通过 From :还是由 Co-developed-by: 共同开发的。值得注意的是,最后一 | ||
435 | 个签字人:必须始终是提交补丁的开发人员。 | ||
436 | |||
437 | 注意,当作者也是电子邮件标题“发件人:”行中列出的人时,“From: ” 标记是可选的。 | ||
438 | |||
439 | 作者提交的补丁程序示例:: | ||
440 | |||
441 | <changelog> | ||
442 | |||
443 | Co-developed-by: First Co-Author <first@coauthor.example.org> | ||
444 | Signed-off-by: First Co-Author <first@coauthor.example.org> | ||
445 | Co-developed-by: Second Co-Author <second@coauthor.example.org> | ||
446 | Signed-off-by: Second Co-Author <second@coauthor.example.org> | ||
447 | Signed-off-by: From Author <from@author.example.org> | ||
448 | |||
449 | 合作开发者提交的补丁示例:: | ||
450 | |||
451 | From: From Author <from@author.example.org> | ||
452 | |||
453 | <changelog> | ||
454 | |||
455 | Co-developed-by: Random Co-Author <random@coauthor.example.org> | ||
456 | Signed-off-by: Random Co-Author <random@coauthor.example.org> | ||
457 | Signed-off-by: From Author <from@author.example.org> | ||
458 | Co-developed-by: Submitting Co-Author <sub@coauthor.example.org> | ||
459 | Signed-off-by: Submitting Co-Author <sub@coauthor.example.org> | ||
460 | |||
461 | |||
462 | 13)使用报告人:、测试人:、审核人:、建议人:、修复人: | ||
463 | -------------------------------------------------------- | ||
464 | |||
465 | Reported-by: 给那些发现错误并报告错误的人致谢,它希望激励他们在将来再次帮助 | ||
466 | 我们。请注意,如果bug是以私有方式报告的,那么在使用Reported-by标记之前,请 | ||
467 | 先请求权限。 | ||
468 | |||
469 | Tested-by: 标记表示补丁已由指定的人(在某些环境中)成功测试。这个标签通知 | ||
470 | 维护人员已经执行了一些测试,为将来的补丁提供了一种定位测试人员的方法,并确 | ||
471 | 保测试人员的信誉。 | ||
472 | |||
473 | Reviewed-by:相反,根据审查人的声明,表明该补丁已被审查并被认为是可接受的: | ||
474 | |||
475 | |||
476 | 审查人的监督声明 | ||
477 | ^^^^^^^^^^^^^^^^ | ||
478 | |||
479 | 通过提供我的 Reviewed-by,我声明: | ||
480 | |||
481 | (a) 我已经对这个补丁进行了一次技术审查,以评估它是否适合被包含到 | ||
482 | 主线内核中。 | ||
483 | |||
484 | (b) 与补丁相关的任何问题、顾虑或问题都已反馈给提交者。我对提交者对 | ||
485 | 我的评论的回应感到满意。 | ||
486 | |||
487 | (c) 虽然这一提交可能会改进一些东西,但我相信,此时,(1)对内核 | ||
488 | 进行了有价值的修改,(2)没有包含争论中涉及的已知问题。 | ||
489 | |||
490 | (d) 虽然我已经审查了补丁并认为它是健全的,但我不会(除非另有明确 | ||
491 | 说明)作出任何保证或保证它将在任何给定情况下实现其规定的目的 | ||
492 | 或正常运行。 | ||
493 | |||
494 | Reviewed-by 是一种观点声明,即补丁是对内核的适当修改,没有任何遗留的严重技术 | ||
495 | 问题。任何感兴趣的审阅者(完成工作的人)都可以为一个补丁提供一个 Review-by | ||
496 | 标签。此标签用于向审阅者提供致谢,并通知维护者已在修补程序上完成的审阅程度。 | ||
497 | Reviewed-by: 当由已知了解主题区域并执行彻底检查的审阅者提供时,通常会增加 | ||
498 | 补丁进入内核的可能性。 | ||
499 | |||
500 | Suggested-by: 表示补丁的想法是由指定的人提出的,并确保将此想法归功于指定的 | ||
501 | 人。请注意,未经许可,不得添加此标签,特别是如果该想法未在公共论坛上发布。 | ||
502 | 这就是说,如果我们勤快地致谢我们的创意者,他们很有希望在未来得到鼓舞,再次 | ||
503 | 帮助我们。 | ||
504 | |||
505 | Fixes: 指示补丁在以前的提交中修复了一个问题。它可以很容易地确定错误的来源, | ||
506 | 这有助于检查错误修复。这个标记还帮助稳定内核团队确定应该接收修复的稳定内核 | ||
507 | 版本。这是指示补丁修复的错误的首选方法。请参阅 :ref:`cn_describe_changes` | ||
508 | 描述您的更改以了解更多详细信息。 | ||
509 | |||
510 | .. _cn_the_canonical_patch_format: | ||
511 | |||
512 | 12)标准补丁格式 | ||
513 | ---------------- | ||
514 | |||
515 | 本节描述如何格式化补丁本身。请注意,如果您的补丁存储在 ``Git`` 存储库中,则 | ||
516 | 可以使用 ``git format-patch`` 进行正确的补丁格式设置。但是,这些工具无法创建 | ||
517 | 必要的文本,因此请务必阅读下面的说明。 | ||
518 | |||
519 | 标准的补丁,标题行是:: | ||
520 | |||
521 | Subject: [PATCH 001/123] 子系统:一句话概述 | ||
522 | |||
523 | 标准补丁的信体存在如下部分: | ||
524 | |||
525 | - 一个 "from" 行指出补丁作者。后跟空行(仅当发送修补程序的人不是作者时才需要)。 | ||
526 | |||
527 | - 解释的正文,行以75列包装,这将被复制到永久变更日志来描述这个补丁。 | ||
528 | |||
529 | - 一个空行 | ||
530 | |||
531 | - 上面描述的“Signed-off-by” 行,也将出现在更改日志中。 | ||
532 | |||
533 | - 只包含 ``---`` 的标记线。 | ||
534 | |||
535 | - 任何其他不适合放在变更日志的注释。 | ||
536 | |||
537 | - 实际补丁( ``diff`` 输出)。 | ||
538 | |||
539 | 标题行的格式,使得对标题行按字母序排序非常的容易 - 很多 e-mail 客户端都 | ||
540 | 可以支持 - 因为序列号是用零填充的,所以按数字排序和按字母排序是一样的。 | ||
541 | |||
542 | e-mail 标题中的“子系统”标识哪个内核子系统将被打补丁。 | ||
543 | |||
544 | e-mail 标题中的“一句话概述”扼要的描述 e-mail 中的补丁。“一句话概述” | ||
545 | 不应该是一个文件名。对于一个补丁系列(“补丁系列”指一系列的多个相关补 | ||
546 | 丁),不要对每个补丁都使用同样的“一句话概述”。 | ||
547 | |||
548 | 记住 e-mail 的“一句话概述”会成为该补丁的全局唯一标识。它会蔓延到 git | ||
549 | 的改动记录里。然后“一句话概述”会被用在开发者的讨论里,用来指代这个补 | ||
550 | 丁。用户将希望通过 google 来搜索"一句话概述"来找到那些讨论这个补丁的文 | ||
551 | 章。当人们在两三个月后使用诸如 ``gitk`` 或 ``git log --oneline`` 之类 | ||
552 | 的工具查看数千个补丁时,也会很快看到它。 | ||
553 | |||
554 | 出于这些原因,概述必须不超过70-75个字符,并且必须描述补丁的更改以及为 | ||
555 | 什么需要补丁。既要简洁又要描述性很有挑战性,但写得好的概述应该这样做。 | ||
556 | |||
557 | 概述的前缀可以用方括号括起来:“Subject: [PATCH <tag>...] <概述>”。标记 | ||
558 | 不被视为概述的一部分,而是描述应该如何处理补丁。如果补丁的多个版本已发 | ||
559 | 送出来以响应评审(即“v1,v2,v3”)或“rfc”,以指示评审请求,那么通用标记 | ||
560 | 可能包括版本描述符。如果一个补丁系列中有四个补丁,那么各个补丁可以这样 | ||
561 | 编号:1/4、2/4、3/4、4/4。这可以确保开发人员了解补丁应用的顺序,并且他们 | ||
562 | 已经查看或应用了补丁系列中的所有补丁。 | ||
563 | |||
564 | 一些标题的例子:: | ||
565 | |||
566 | Subject: [patch 2/5] ext2: improve scalability of bitmap searching | ||
567 | Subject: [PATCHv2 001/207] x86: fix eflags tracking | ||
568 | |||
569 | "From" 行是信体里的最上面一行,具有如下格式: | ||
570 | From: Patch Author <author@example.com> | ||
571 | |||
572 | "From" 行指明在永久改动日志里,谁会被确认为作者。如果没有 "From" 行,那 | ||
573 | 么邮件头里的 "From: " 行会被用来决定改动日志中的作者。 | ||
574 | |||
575 | 说明的主题将会被提交到永久的源代码改动日志里,因此对那些早已经不记得和 | ||
576 | 这个补丁相关的讨论细节的有能力的读者来说,是有意义的。包括补丁程序定位 | ||
577 | 错误的(内核日志消息、OOPS消息等)症状,对于搜索提交日志以寻找适用补丁的人 | ||
578 | 尤其有用。如果一个补丁修复了一个编译失败,那么可能不需要包含所有编译失败; | ||
579 | 只要足够让搜索补丁的人能够找到它就行了。与概述一样,既要简洁又要描述性。 | ||
580 | |||
581 | "---" 标记行对于补丁处理工具要找到哪里是改动日志信息的结束,是不可缺少 | ||
582 | 的。 | ||
583 | |||
584 | 对于 "---" 标记之后的额外注解,一个好的用途就是用来写 diffstat,用来显 | ||
585 | 示修改了什么文件和每个文件都增加和删除了多少行。diffstat 对于比较大的补 | ||
586 | 丁特别有用。其余那些只是和时刻或者开发者相关的注解,不合适放到永久的改 | ||
587 | 动日志里的,也应该放这里。 | ||
588 | 使用 diffstat的选项 "-p 1 -w 70" 这样文件名就会从内核源代码树的目录开始 | ||
589 | ,不会占用太宽的空间(很容易适合80列的宽度,也许会有一些缩进。) | ||
590 | |||
591 | 在后面的参考资料中能看到适当的补丁格式的更多细节。 | ||
592 | |||
593 | .. _cn_explicit_in_reply_to: | ||
594 | |||
595 | 15) 明确回复邮件头(In-Reply-To) | ||
596 | ------------------------------- | ||
597 | |||
598 | 手动添加回复补丁的的标题头(In-Reply_To:) 是有帮助的(例如,使用 ``git send-email`` ) | ||
599 | 将补丁与以前的相关讨论关联起来,例如,将bug修复程序链接到电子邮件和bug报告。 | ||
600 | 但是,对于多补丁系列,最好避免在回复时使用链接到该系列的旧版本。这样, | ||
601 | 补丁的多个版本就不会成为电子邮件客户端中无法管理的引用序列。如果链接有用, | ||
602 | 可以使用 https://lkml.kernel.org/ 重定向器(例如,在封面电子邮件文本中) | ||
603 | 链接到补丁系列的早期版本。 | ||
604 | |||
605 | 16) 发送git pull请求 | ||
606 | -------------------- | ||
607 | |||
608 | 如果您有一系列补丁,那么让维护人员通过git pull操作将它们直接拉入子系统存储 | ||
609 | 库可能是最方便的。但是,请注意,从开发人员那里获取补丁比从邮件列表中获取补 | ||
610 | 丁需要更高的信任度。因此,许多子系统维护人员不愿意接受请求,特别是来自新的 | ||
611 | 未知开发人员的请求。如果有疑问,您可以在封面邮件中使用pull 请求作为补丁系列 | ||
612 | 正常发布的一个选项,让维护人员可以选择使用其中之一。 | ||
613 | |||
614 | pull 请求的主题行中应该有[Git Pull]。请求本身应该在一行中包含存储库名称和 | ||
615 | 感兴趣的分支;它应该看起来像:: | ||
616 | |||
617 | Please pull from | ||
618 | |||
619 | git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus | ||
620 | |||
621 | to get these changes: | ||
622 | |||
623 | |||
624 | pull 请求还应该包含一条整体消息,说明请求中将包含什么,一个补丁本身的 ``Git shortlog`` | ||
625 | 以及一个显示补丁系列整体效果的 ``diffstat`` 。当然,将所有这些信息收集在一起 | ||
626 | 的最简单方法是让 ``git`` 使用 ``git request-pull`` 命令为您完成这些工作。 | ||
627 | |||
628 | 一些维护人员(包括Linus)希望看到来自已签名提交的请求;这增加了他们对你的 | ||
629 | 请求信心。特别是,在没有签名标签的情况下,Linus 不会从像 Github 这样的公共 | ||
630 | 托管站点拉请求。 | ||
631 | |||
632 | 创建此类签名的第一步是生成一个 GNRPG 密钥,并由一个或多个核心内核开发人员对 | ||
633 | 其进行签名。这一步对新开发人员来说可能很困难,但没有办法绕过它。参加会议是 | ||
634 | 找到可以签署您的密钥的开发人员的好方法。 | ||
635 | |||
636 | 一旦您在Git 中准备了一个您希望有人拉的补丁系列,就用 ``git tag -s`` 创建一 | ||
637 | 个签名标记。这将创建一个新标记,标识该系列中的最后一次提交,并包含用您的私 | ||
638 | 钥创建的签名。您还可以将changelog样式的消息添加到标记中;这是一个描述拉请求 | ||
639 | 整体效果的理想位置。 | ||
640 | |||
641 | 如果维护人员将要从中提取的树不是您正在使用的存储库,请不要忘记将已签名的标记 | ||
642 | 显式推送到公共树。 | ||
643 | |||
644 | 生成拉请求时,请使用已签名的标记作为目标。这样的命令可以实现:: | ||
645 | |||
646 | git request-pull master git://my.public.tree/linux.git my-signed-tag | ||
647 | |||
648 | 参考文献 | ||
649 | -------- | ||
650 | |||
651 | Andrew Morton, "The perfect patch" (tpp). | ||
652 | <http://www.ozlabs.org/~akpm/stuff/tpp.txt> | ||
653 | |||
654 | Jeff Garzik, "Linux kernel patch submission format". | ||
655 | <http://linux.yyz.us/patch-format.html> | ||
656 | |||
657 | Greg Kroah-Hartman, "How to piss off a kernel subsystem maintainer". | ||
658 | <http://www.kroah.com/log/linux/maintainer.html> | ||
659 | |||
660 | <http://www.kroah.com/log/linux/maintainer-02.html> | ||
661 | |||
662 | <http://www.kroah.com/log/linux/maintainer-03.html> | ||
663 | |||
664 | <http://www.kroah.com/log/linux/maintainer-04.html> | ||
665 | |||
666 | <http://www.kroah.com/log/linux/maintainer-05.html> | ||
667 | |||
668 | <http://www.kroah.com/log/linux/maintainer-06.html> | ||
669 | |||
670 | NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people! | ||
671 | <https://lkml.org/lkml/2005/7/11/336> | ||
672 | |||
673 | Kernel Documentation/process/coding-style.rst: | ||
674 | :ref:`Documentation/translations/zh_CN/process/coding-style.rst <cn_codingstyle>` | ||
675 | |||
676 | Linus Torvalds's mail on the canonical patch format: | ||
677 | <http://lkml.org/lkml/2005/4/7/183> | ||
678 | |||
679 | Andi Kleen, "On submitting kernel patches" | ||
680 | Some strategies to get difficult or controversial changes in. | ||
681 | |||
682 | http://halobates.de/on-submitting-patches.pdf | ||
diff --git a/Documentation/translations/zh_CN/volatile-considered-harmful.txt b/Documentation/translations/zh_CN/process/volatile-considered-harmful.rst index 475125967197..48b32ce58ef1 100644 --- a/Documentation/translations/zh_CN/volatile-considered-harmful.txt +++ b/Documentation/translations/zh_CN/process/volatile-considered-harmful.rst | |||
@@ -1,30 +1,23 @@ | |||
1 | Chinese translated version of Documentation/process/volatile-considered-harmful.rst | 1 | .. _cn_volatile_considered_harmful: |
2 | 2 | ||
3 | If you have any comment or update to the content, please contact the | 3 | .. include:: ../disclaimer-zh_CN.rst |
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | 4 | ||
9 | Maintainer: Jonathan Corbet <corbet@lwn.net> | 5 | :Original: :ref:`Documentation/process/volatile-considered-harmful.rst |
10 | Chinese maintainer: Bryan Wu <bryan.wu@analog.com> | 6 | <volatile_considered_harmful>` |
11 | --------------------------------------------------------------------- | ||
12 | Documentation/process/volatile-considered-harmful.rst 的中文翻译 | ||
13 | 7 | ||
14 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | 8 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 |
15 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | 9 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 |
16 | 译存在问题,请联系中文版维护者。 | 10 | 译存在问题,请联系中文版维护者:: |
17 | 11 | ||
18 | 英文版维护者: Jonathan Corbet <corbet@lwn.net> | 12 | 英文版维护者: Jonathan Corbet <corbet@lwn.net> |
19 | 中文版维护者: 伍鹏 Bryan Wu <bryan.wu@analog.com> | 13 | 中文版维护者: 伍鹏 Bryan Wu <bryan.wu@analog.com> |
20 | 中文版翻译者: 伍鹏 Bryan Wu <bryan.wu@analog.com> | 14 | 中文版翻译者: 伍鹏 Bryan Wu <bryan.wu@analog.com> |
21 | 中文版校译者: 张汉辉 Eugene Teo <eugeneteo@kernel.sg> | 15 | 中文版校译者: 张汉辉 Eugene Teo <eugeneteo@kernel.sg> |
22 | 杨瑞 Dave Young <hidave.darkstar@gmail.com> | 16 | 杨瑞 Dave Young <hidave.darkstar@gmail.com> |
23 | 以下为正文 | 17 | 时奎亮 Alex Shi <alex.shi@linux.alibaba.com> |
24 | --------------------------------------------------------------------- | ||
25 | 18 | ||
26 | 为什么不应该使用“volatile”类型 | 19 | 为什么不应该使用“volatile”类型 |
27 | ------------------------------ | 20 | ============================== |
28 | 21 | ||
29 | C程序员通常认为volatile表示某个变量可以在当前执行的线程之外被改变;因此,在内核 | 22 | C程序员通常认为volatile表示某个变量可以在当前执行的线程之外被改变;因此,在内核 |
30 | 中用到共享数据结构时,常常会有C程序员喜欢使用volatile这类变量。换句话说,他们经 | 23 | 中用到共享数据结构时,常常会有C程序员喜欢使用volatile这类变量。换句话说,他们经 |
@@ -41,7 +34,7 @@ C程序员通常认为volatile表示某个变量可以在当前执行的线程 | |||
41 | 必要再使用volatile。如果仍然必须使用volatile,那么几乎可以肯定在代码的某处有一 | 34 | 必要再使用volatile。如果仍然必须使用volatile,那么几乎可以肯定在代码的某处有一 |
42 | 个bug。在正确设计的内核代码中,volatile能带来的仅仅是使事情变慢。 | 35 | 个bug。在正确设计的内核代码中,volatile能带来的仅仅是使事情变慢。 |
43 | 36 | ||
44 | 思考一下这段典型的内核代码: | 37 | 思考一下这段典型的内核代码:: |
45 | 38 | ||
46 | spin_lock(&the_lock); | 39 | spin_lock(&the_lock); |
47 | do_something_on(&shared_data); | 40 | do_something_on(&shared_data); |
@@ -66,7 +59,7 @@ volatile的存储类型最初是为那些内存映射的I/O寄存器而定义。 | |||
66 | 是必需的。 | 59 | 是必需的。 |
67 | 60 | ||
68 | 另一种引起用户可能使用volatile的情况是当处理器正忙着等待一个变量的值。正确执行一 | 61 | 另一种引起用户可能使用volatile的情况是当处理器正忙着等待一个变量的值。正确执行一 |
69 | 个忙等待的方法是: | 62 | 个忙等待的方法是:: |
70 | 63 | ||
71 | while (my_variable != what_i_want) | 64 | while (my_variable != what_i_want) |
72 | cpu_relax(); | 65 | cpu_relax(); |
diff --git a/Documentation/translations/zh_CN/sparse.txt b/Documentation/translations/zh_CN/sparse.txt index 2f728962a8e2..47fc4a06ebe8 100644 --- a/Documentation/translations/zh_CN/sparse.txt +++ b/Documentation/translations/zh_CN/sparse.txt | |||
@@ -6,7 +6,7 @@ communicating in English you can also ask the Chinese maintainer for | |||
6 | help. Contact the Chinese maintainer if this translation is outdated | 6 | help. Contact the Chinese maintainer if this translation is outdated |
7 | or if there is a problem with the translation. | 7 | or if there is a problem with the translation. |
8 | 8 | ||
9 | Chinese maintainer: Li Yang <leo@zh-kernel.org> | 9 | Chinese maintainer: Li Yang <leoyang.li@nxp.com> |
10 | --------------------------------------------------------------------- | 10 | --------------------------------------------------------------------- |
11 | Documentation/dev-tools/sparse.rst 的中文翻译 | 11 | Documentation/dev-tools/sparse.rst 的中文翻译 |
12 | 12 | ||
@@ -14,8 +14,8 @@ Documentation/dev-tools/sparse.rst 的中文翻译 | |||
14 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | 14 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 |
15 | 译存在问题,请联系中文版维护者。 | 15 | 译存在问题,请联系中文版维护者。 |
16 | 16 | ||
17 | 中文版维护者: 李阳 Li Yang <leo@zh-kernel.org> | 17 | 中文版维护者: 李阳 Li Yang <leoyang.li@nxp.com> |
18 | 中文版翻译者: 李阳 Li Yang <leo@zh-kernel.org> | 18 | 中文版翻译者: 李阳 Li Yang <leoyang.li@nxp.com> |
19 | 19 | ||
20 | 20 | ||
21 | 以下为正文 | 21 | 以下为正文 |
diff --git a/Documentation/unaligned-memory-access.txt b/Documentation/unaligned-memory-access.txt index 51b4ff031586..1ee82419d8aa 100644 --- a/Documentation/unaligned-memory-access.txt +++ b/Documentation/unaligned-memory-access.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | ========================= | 1 | ========================= |
2 | UNALIGNED MEMORY ACCESSES | 2 | Unaligned Memory Accesses |
3 | ========================= | 3 | ========================= |
4 | 4 | ||
5 | :Author: Daniel Drake <dsd@gentoo.org>, | 5 | :Author: Daniel Drake <dsd@gentoo.org>, |
diff --git a/Documentation/userspace-api/seccomp_filter.rst b/Documentation/userspace-api/seccomp_filter.rst index b1b846d8a094..bd9165241b6c 100644 --- a/Documentation/userspace-api/seccomp_filter.rst +++ b/Documentation/userspace-api/seccomp_filter.rst | |||
@@ -123,9 +123,9 @@ In precedence order, they are: | |||
123 | to userland as the errno without executing the system call. | 123 | to userland as the errno without executing the system call. |
124 | 124 | ||
125 | ``SECCOMP_RET_USER_NOTIF``: | 125 | ``SECCOMP_RET_USER_NOTIF``: |
126 | Results in a ``struct seccomp_notif`` message sent on the userspace | 126 | Results in a ``struct seccomp_notif`` message sent on the userspace |
127 | notification fd, if it is attached, or ``-ENOSYS`` if it is not. See below | 127 | notification fd, if it is attached, or ``-ENOSYS`` if it is not. See |
128 | on discussion of how to handle user notifications. | 128 | below on discussion of how to handle user notifications. |
129 | 129 | ||
130 | ``SECCOMP_RET_TRACE``: | 130 | ``SECCOMP_RET_TRACE``: |
131 | When returned, this value will cause the kernel to attempt to | 131 | When returned, this value will cause the kernel to attempt to |
@@ -133,7 +133,7 @@ In precedence order, they are: | |||
133 | call. If there is no tracer present, ``-ENOSYS`` is returned to | 133 | call. If there is no tracer present, ``-ENOSYS`` is returned to |
134 | userland and the system call is not executed. | 134 | userland and the system call is not executed. |
135 | 135 | ||
136 | A tracer will be notified if it requests ``PTRACE_O_TRACESECCOM``P | 136 | A tracer will be notified if it requests ``PTRACE_O_TRACESECCOMP`` |
137 | using ``ptrace(PTRACE_SETOPTIONS)``. The tracer will be notified | 137 | using ``ptrace(PTRACE_SETOPTIONS)``. The tracer will be notified |
138 | of a ``PTRACE_EVENT_SECCOMP`` and the ``SECCOMP_RET_DATA`` portion of | 138 | of a ``PTRACE_EVENT_SECCOMP`` and the ``SECCOMP_RET_DATA`` portion of |
139 | the BPF program return value will be available to the tracer | 139 | the BPF program return value will be available to the tracer |
diff --git a/Documentation/video-output.txt b/Documentation/video-output.txt index e517011be4f9..56d6fa2e2368 100644 --- a/Documentation/video-output.txt +++ b/Documentation/video-output.txt | |||
@@ -1,34 +1,34 @@ | |||
1 | Video Output Switcher Control | ||
2 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
1 | 3 | ||
2 | Video Output Switcher Control | 4 | 2006 luming.yu@intel.com |
3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
4 | 2006 luming.yu@intel.com | ||
5 | 5 | ||
6 | The output sysfs class driver provides an abstract video output layer that | 6 | The output sysfs class driver provides an abstract video output layer that |
7 | can be used to hook platform specific methods to enable/disable video output | 7 | can be used to hook platform specific methods to enable/disable video output |
8 | device through common sysfs interface. For example, on my IBM ThinkPad T42 | 8 | device through common sysfs interface. For example, on my IBM ThinkPad T42 |
9 | laptop, The ACPI video driver registered its output devices and read/write | 9 | laptop, The ACPI video driver registered its output devices and read/write |
10 | method for 'state' with output sysfs class. The user interface under sysfs is: | 10 | method for 'state' with output sysfs class. The user interface under sysfs is:: |
11 | 11 | ||
12 | linux:/sys/class/video_output # tree . | 12 | linux:/sys/class/video_output # tree . |
13 | . | 13 | . |
14 | |-- CRT0 | 14 | |-- CRT0 |
15 | | |-- device -> ../../../devices/pci0000:00/0000:00:01.0 | 15 | | |-- device -> ../../../devices/pci0000:00/0000:00:01.0 |
16 | | |-- state | 16 | | |-- state |
17 | | |-- subsystem -> ../../../class/video_output | 17 | | |-- subsystem -> ../../../class/video_output |
18 | | `-- uevent | 18 | | `-- uevent |
19 | |-- DVI0 | 19 | |-- DVI0 |
20 | | |-- device -> ../../../devices/pci0000:00/0000:00:01.0 | 20 | | |-- device -> ../../../devices/pci0000:00/0000:00:01.0 |
21 | | |-- state | 21 | | |-- state |
22 | | |-- subsystem -> ../../../class/video_output | 22 | | |-- subsystem -> ../../../class/video_output |
23 | | `-- uevent | 23 | | `-- uevent |
24 | |-- LCD0 | 24 | |-- LCD0 |
25 | | |-- device -> ../../../devices/pci0000:00/0000:00:01.0 | 25 | | |-- device -> ../../../devices/pci0000:00/0000:00:01.0 |
26 | | |-- state | 26 | | |-- state |
27 | | |-- subsystem -> ../../../class/video_output | 27 | | |-- subsystem -> ../../../class/video_output |
28 | | `-- uevent | 28 | | `-- uevent |
29 | `-- TV0 | 29 | `-- TV0 |
30 | |-- device -> ../../../devices/pci0000:00/0000:00:01.0 | 30 | |-- device -> ../../../devices/pci0000:00/0000:00:01.0 |
31 | |-- state | 31 | |-- state |
32 | |-- subsystem -> ../../../class/video_output | 32 | |-- subsystem -> ../../../class/video_output |
33 | `-- uevent | 33 | `-- uevent |
34 | 34 | ||
diff --git a/Documentation/vm/hugetlbfs_reserv.rst b/Documentation/vm/hugetlbfs_reserv.rst index 9d200762114f..f143954e0d05 100644 --- a/Documentation/vm/hugetlbfs_reserv.rst +++ b/Documentation/vm/hugetlbfs_reserv.rst | |||
@@ -85,10 +85,10 @@ Reservation Map Location (Private or Shared) | |||
85 | A huge page mapping or segment is either private or shared. If private, | 85 | A huge page mapping or segment is either private or shared. If private, |
86 | it is typically only available to a single address space (task). If shared, | 86 | it is typically only available to a single address space (task). If shared, |
87 | it can be mapped into multiple address spaces (tasks). The location and | 87 | it can be mapped into multiple address spaces (tasks). The location and |
88 | semantics of the reservation map is significantly different for two types | 88 | semantics of the reservation map is significantly different for the two types |
89 | of mappings. Location differences are: | 89 | of mappings. Location differences are: |
90 | 90 | ||
91 | - For private mappings, the reservation map hangs off the the VMA structure. | 91 | - For private mappings, the reservation map hangs off the VMA structure. |
92 | Specifically, vma->vm_private_data. This reserve map is created at the | 92 | Specifically, vma->vm_private_data. This reserve map is created at the |
93 | time the mapping (mmap(MAP_PRIVATE)) is created. | 93 | time the mapping (mmap(MAP_PRIVATE)) is created. |
94 | - For shared mappings, the reservation map hangs off the inode. Specifically, | 94 | - For shared mappings, the reservation map hangs off the inode. Specifically, |
@@ -109,15 +109,15 @@ These operations result in a call to the routine hugetlb_reserve_pages():: | |||
109 | struct vm_area_struct *vma, | 109 | struct vm_area_struct *vma, |
110 | vm_flags_t vm_flags) | 110 | vm_flags_t vm_flags) |
111 | 111 | ||
112 | The first thing hugetlb_reserve_pages() does is check for the NORESERVE | 112 | The first thing hugetlb_reserve_pages() does is check if the NORESERVE |
113 | flag was specified in either the shmget() or mmap() call. If NORESERVE | 113 | flag was specified in either the shmget() or mmap() call. If NORESERVE |
114 | was specified, then this routine returns immediately as no reservation | 114 | was specified, then this routine returns immediately as no reservations |
115 | are desired. | 115 | are desired. |
116 | 116 | ||
117 | The arguments 'from' and 'to' are huge page indices into the mapping or | 117 | The arguments 'from' and 'to' are huge page indices into the mapping or |
118 | underlying file. For shmget(), 'from' is always 0 and 'to' corresponds to | 118 | underlying file. For shmget(), 'from' is always 0 and 'to' corresponds to |
119 | the length of the segment/mapping. For mmap(), the offset argument could | 119 | the length of the segment/mapping. For mmap(), the offset argument could |
120 | be used to specify the offset into the underlying file. In such a case | 120 | be used to specify the offset into the underlying file. In such a case, |
121 | the 'from' and 'to' arguments have been adjusted by this offset. | 121 | the 'from' and 'to' arguments have been adjusted by this offset. |
122 | 122 | ||
123 | One of the big differences between PRIVATE and SHARED mappings is the way | 123 | One of the big differences between PRIVATE and SHARED mappings is the way |
@@ -138,7 +138,8 @@ to indicate this VMA owns the reservations. | |||
138 | 138 | ||
139 | The reservation map is consulted to determine how many huge page reservations | 139 | The reservation map is consulted to determine how many huge page reservations |
140 | are needed for the current mapping/segment. For private mappings, this is | 140 | are needed for the current mapping/segment. For private mappings, this is |
141 | always the value (to - from). However, for shared mappings it is possible that some reservations may already exist within the range (to - from). See the | 141 | always the value (to - from). However, for shared mappings it is possible that |
142 | some reservations may already exist within the range (to - from). See the | ||
142 | section :ref:`Reservation Map Modifications <resv_map_modifications>` | 143 | section :ref:`Reservation Map Modifications <resv_map_modifications>` |
143 | for details on how this is accomplished. | 144 | for details on how this is accomplished. |
144 | 145 | ||
@@ -165,7 +166,7 @@ these counters. | |||
165 | If there were enough free huge pages and the global count resv_huge_pages | 166 | If there were enough free huge pages and the global count resv_huge_pages |
166 | was adjusted, then the reservation map associated with the mapping is | 167 | was adjusted, then the reservation map associated with the mapping is |
167 | modified to reflect the reservations. In the case of a shared mapping, a | 168 | modified to reflect the reservations. In the case of a shared mapping, a |
168 | file_region will exist that includes the range 'from' 'to'. For private | 169 | file_region will exist that includes the range 'from' - 'to'. For private |
169 | mappings, no modifications are made to the reservation map as lack of an | 170 | mappings, no modifications are made to the reservation map as lack of an |
170 | entry indicates a reservation exists. | 171 | entry indicates a reservation exists. |
171 | 172 | ||
@@ -239,7 +240,7 @@ subpool accounting when the page is freed. | |||
239 | The routine vma_commit_reservation() is then called to adjust the reserve | 240 | The routine vma_commit_reservation() is then called to adjust the reserve |
240 | map based on the consumption of the reservation. In general, this involves | 241 | map based on the consumption of the reservation. In general, this involves |
241 | ensuring the page is represented within a file_region structure of the region | 242 | ensuring the page is represented within a file_region structure of the region |
242 | map. For shared mappings where the the reservation was present, an entry | 243 | map. For shared mappings where the reservation was present, an entry |
243 | in the reserve map already existed so no change is made. However, if there | 244 | in the reserve map already existed so no change is made. However, if there |
244 | was no reservation in a shared mapping or this was a private mapping a new | 245 | was no reservation in a shared mapping or this was a private mapping a new |
245 | entry must be created. | 246 | entry must be created. |
diff --git a/Documentation/vm/index.rst b/Documentation/vm/index.rst index b58cc3bfe777..e8d943b21cf9 100644 --- a/Documentation/vm/index.rst +++ b/Documentation/vm/index.rst | |||
@@ -37,6 +37,7 @@ descriptions of data structures and algorithms. | |||
37 | hwpoison | 37 | hwpoison |
38 | hugetlbfs_reserv | 38 | hugetlbfs_reserv |
39 | ksm | 39 | ksm |
40 | memory-model | ||
40 | mmu_notifier | 41 | mmu_notifier |
41 | numa | 42 | numa |
42 | overcommit-accounting | 43 | overcommit-accounting |
diff --git a/Documentation/vm/memory-model.rst b/Documentation/vm/memory-model.rst new file mode 100644 index 000000000000..382f72ace1fc --- /dev/null +++ b/Documentation/vm/memory-model.rst | |||
@@ -0,0 +1,183 @@ | |||
1 | .. SPDX-License-Identifier: GPL-2.0 | ||
2 | |||
3 | .. _physical_memory_model: | ||
4 | |||
5 | ===================== | ||
6 | Physical Memory Model | ||
7 | ===================== | ||
8 | |||
9 | Physical memory in a system may be addressed in different ways. The | ||
10 | simplest case is when the physical memory starts at address 0 and | ||
11 | spans a contiguous range up to the maximal address. It could be, | ||
12 | however, that this range contains small holes that are not accessible | ||
13 | for the CPU. Then there could be several contiguous ranges at | ||
14 | completely distinct addresses. And, don't forget about NUMA, where | ||
15 | different memory banks are attached to different CPUs. | ||
16 | |||
17 | Linux abstracts this diversity using one of the three memory models: | ||
18 | FLATMEM, DISCONTIGMEM and SPARSEMEM. Each architecture defines what | ||
19 | memory models it supports, what the default memory model is and | ||
20 | whether it is possible to manually override that default. | ||
21 | |||
22 | .. note:: | ||
23 | At time of this writing, DISCONTIGMEM is considered deprecated, | ||
24 | although it is still in use by several architectures. | ||
25 | |||
26 | All the memory models track the status of physical page frames using | ||
27 | :c:type:`struct page` arranged in one or more arrays. | ||
28 | |||
29 | Regardless of the selected memory model, there exists one-to-one | ||
30 | mapping between the physical page frame number (PFN) and the | ||
31 | corresponding `struct page`. | ||
32 | |||
33 | Each memory model defines :c:func:`pfn_to_page` and :c:func:`page_to_pfn` | ||
34 | helpers that allow the conversion from PFN to `struct page` and vice | ||
35 | versa. | ||
36 | |||
37 | FLATMEM | ||
38 | ======= | ||
39 | |||
40 | The simplest memory model is FLATMEM. This model is suitable for | ||
41 | non-NUMA systems with contiguous, or mostly contiguous, physical | ||
42 | memory. | ||
43 | |||
44 | In the FLATMEM memory model, there is a global `mem_map` array that | ||
45 | maps the entire physical memory. For most architectures, the holes | ||
46 | have entries in the `mem_map` array. The `struct page` objects | ||
47 | corresponding to the holes are never fully initialized. | ||
48 | |||
49 | To allocate the `mem_map` array, architecture specific setup code | ||
50 | should call :c:func:`free_area_init_node` function or its convenience | ||
51 | wrapper :c:func:`free_area_init`. Yet, the mappings array is not | ||
52 | usable until the call to :c:func:`memblock_free_all` that hands all | ||
53 | the memory to the page allocator. | ||
54 | |||
55 | If an architecture enables `CONFIG_ARCH_HAS_HOLES_MEMORYMODEL` option, | ||
56 | it may free parts of the `mem_map` array that do not cover the | ||
57 | actual physical pages. In such case, the architecture specific | ||
58 | :c:func:`pfn_valid` implementation should take the holes in the | ||
59 | `mem_map` into account. | ||
60 | |||
61 | With FLATMEM, the conversion between a PFN and the `struct page` is | ||
62 | straightforward: `PFN - ARCH_PFN_OFFSET` is an index to the | ||
63 | `mem_map` array. | ||
64 | |||
65 | The `ARCH_PFN_OFFSET` defines the first page frame number for | ||
66 | systems with physical memory starting at address different from 0. | ||
67 | |||
68 | DISCONTIGMEM | ||
69 | ============ | ||
70 | |||
71 | The DISCONTIGMEM model treats the physical memory as a collection of | ||
72 | `nodes` similarly to how Linux NUMA support does. For each node Linux | ||
73 | constructs an independent memory management subsystem represented by | ||
74 | `struct pglist_data` (or `pg_data_t` for short). Among other | ||
75 | things, `pg_data_t` holds the `node_mem_map` array that maps | ||
76 | physical pages belonging to that node. The `node_start_pfn` field of | ||
77 | `pg_data_t` is the number of the first page frame belonging to that | ||
78 | node. | ||
79 | |||
80 | The architecture setup code should call :c:func:`free_area_init_node` for | ||
81 | each node in the system to initialize the `pg_data_t` object and its | ||
82 | `node_mem_map`. | ||
83 | |||
84 | Every `node_mem_map` behaves exactly as FLATMEM's `mem_map` - | ||
85 | every physical page frame in a node has a `struct page` entry in the | ||
86 | `node_mem_map` array. When DISCONTIGMEM is enabled, a portion of the | ||
87 | `flags` field of the `struct page` encodes the node number of the | ||
88 | node hosting that page. | ||
89 | |||
90 | The conversion between a PFN and the `struct page` in the | ||
91 | DISCONTIGMEM model became slightly more complex as it has to determine | ||
92 | which node hosts the physical page and which `pg_data_t` object | ||
93 | holds the `struct page`. | ||
94 | |||
95 | Architectures that support DISCONTIGMEM provide :c:func:`pfn_to_nid` | ||
96 | to convert PFN to the node number. The opposite conversion helper | ||
97 | :c:func:`page_to_nid` is generic as it uses the node number encoded in | ||
98 | page->flags. | ||
99 | |||
100 | Once the node number is known, the PFN can be used to index | ||
101 | appropriate `node_mem_map` array to access the `struct page` and | ||
102 | the offset of the `struct page` from the `node_mem_map` plus | ||
103 | `node_start_pfn` is the PFN of that page. | ||
104 | |||
105 | SPARSEMEM | ||
106 | ========= | ||
107 | |||
108 | SPARSEMEM is the most versatile memory model available in Linux and it | ||
109 | is the only memory model that supports several advanced features such | ||
110 | as hot-plug and hot-remove of the physical memory, alternative memory | ||
111 | maps for non-volatile memory devices and deferred initialization of | ||
112 | the memory map for larger systems. | ||
113 | |||
114 | The SPARSEMEM model presents the physical memory as a collection of | ||
115 | sections. A section is represented with :c:type:`struct mem_section` | ||
116 | that contains `section_mem_map` that is, logically, a pointer to an | ||
117 | array of struct pages. However, it is stored with some other magic | ||
118 | that aids the sections management. The section size and maximal number | ||
119 | of section is specified using `SECTION_SIZE_BITS` and | ||
120 | `MAX_PHYSMEM_BITS` constants defined by each architecture that | ||
121 | supports SPARSEMEM. While `MAX_PHYSMEM_BITS` is an actual width of a | ||
122 | physical address that an architecture supports, the | ||
123 | `SECTION_SIZE_BITS` is an arbitrary value. | ||
124 | |||
125 | The maximal number of sections is denoted `NR_MEM_SECTIONS` and | ||
126 | defined as | ||
127 | |||
128 | .. math:: | ||
129 | |||
130 | NR\_MEM\_SECTIONS = 2 ^ {(MAX\_PHYSMEM\_BITS - SECTION\_SIZE\_BITS)} | ||
131 | |||
132 | The `mem_section` objects are arranged in a two-dimensional array | ||
133 | called `mem_sections`. The size and placement of this array depend | ||
134 | on `CONFIG_SPARSEMEM_EXTREME` and the maximal possible number of | ||
135 | sections: | ||
136 | |||
137 | * When `CONFIG_SPARSEMEM_EXTREME` is disabled, the `mem_sections` | ||
138 | array is static and has `NR_MEM_SECTIONS` rows. Each row holds a | ||
139 | single `mem_section` object. | ||
140 | * When `CONFIG_SPARSEMEM_EXTREME` is enabled, the `mem_sections` | ||
141 | array is dynamically allocated. Each row contains PAGE_SIZE worth of | ||
142 | `mem_section` objects and the number of rows is calculated to fit | ||
143 | all the memory sections. | ||
144 | |||
145 | The architecture setup code should call :c:func:`memory_present` for | ||
146 | each active memory range or use :c:func:`memblocks_present` or | ||
147 | :c:func:`sparse_memory_present_with_active_regions` wrappers to | ||
148 | initialize the memory sections. Next, the actual memory maps should be | ||
149 | set up using :c:func:`sparse_init`. | ||
150 | |||
151 | With SPARSEMEM there are two possible ways to convert a PFN to the | ||
152 | corresponding `struct page` - a "classic sparse" and "sparse | ||
153 | vmemmap". The selection is made at build time and it is determined by | ||
154 | the value of `CONFIG_SPARSEMEM_VMEMMAP`. | ||
155 | |||
156 | The classic sparse encodes the section number of a page in page->flags | ||
157 | and uses high bits of a PFN to access the section that maps that page | ||
158 | frame. Inside a section, the PFN is the index to the array of pages. | ||
159 | |||
160 | The sparse vmemmap uses a virtually mapped memory map to optimize | ||
161 | pfn_to_page and page_to_pfn operations. There is a global `struct | ||
162 | page *vmemmap` pointer that points to a virtually contiguous array of | ||
163 | `struct page` objects. A PFN is an index to that array and the the | ||
164 | offset of the `struct page` from `vmemmap` is the PFN of that | ||
165 | page. | ||
166 | |||
167 | To use vmemmap, an architecture has to reserve a range of virtual | ||
168 | addresses that will map the physical pages containing the memory | ||
169 | map and make sure that `vmemmap` points to that range. In addition, | ||
170 | the architecture should implement :c:func:`vmemmap_populate` method | ||
171 | that will allocate the physical memory and create page tables for the | ||
172 | virtual memory map. If an architecture does not have any special | ||
173 | requirements for the vmemmap mappings, it can use default | ||
174 | :c:func:`vmemmap_populate_basepages` provided by the generic memory | ||
175 | management. | ||
176 | |||
177 | The virtually mapped memory map allows storing `struct page` objects | ||
178 | for persistent memory devices in pre-allocated storage on those | ||
179 | devices. This storage is represented with :c:type:`struct vmem_altmap` | ||
180 | that is eventually passed to vmemmap_populate() through a long chain | ||
181 | of function calls. The vmemmap_populate() implementation may use the | ||
182 | `vmem_altmap` along with :c:func:`altmap_alloc_block_buf` helper to | ||
183 | allocate memory map on the persistent memory device. | ||
diff --git a/Documentation/vm/numa.rst b/Documentation/vm/numa.rst index 185d8a568168..5cae13e9a08b 100644 --- a/Documentation/vm/numa.rst +++ b/Documentation/vm/numa.rst | |||
@@ -109,8 +109,8 @@ System administrators and application designers can restrict a task's migration | |||
109 | to improve NUMA locality using various CPU affinity command line interfaces, | 109 | to improve NUMA locality using various CPU affinity command line interfaces, |
110 | such as taskset(1) and numactl(1), and program interfaces such as | 110 | such as taskset(1) and numactl(1), and program interfaces such as |
111 | sched_setaffinity(2). Further, one can modify the kernel's default local | 111 | sched_setaffinity(2). Further, one can modify the kernel's default local |
112 | allocation behavior using Linux NUMA memory policy. | 112 | allocation behavior using Linux NUMA memory policy. [see |
113 | [see Documentation/admin-guide/mm/numa_memory_policy.rst.] | 113 | :ref:`Documentation/admin-guide/mm/numa_memory_policy.rst <numa_memory_policy>`]. |
114 | 114 | ||
115 | System administrators can restrict the CPUs and nodes' memories that a non- | 115 | System administrators can restrict the CPUs and nodes' memories that a non- |
116 | privileged user can specify in the scheduling or NUMA commands and functions | 116 | privileged user can specify in the scheduling or NUMA commands and functions |
diff --git a/Documentation/vm/transhuge.rst b/Documentation/vm/transhuge.rst index a8cf6809e36e..37c57ca32629 100644 --- a/Documentation/vm/transhuge.rst +++ b/Documentation/vm/transhuge.rst | |||
@@ -4,8 +4,9 @@ | |||
4 | Transparent Hugepage Support | 4 | Transparent Hugepage Support |
5 | ============================ | 5 | ============================ |
6 | 6 | ||
7 | This document describes design principles Transparent Hugepage (THP) | 7 | This document describes design principles for Transparent Hugepage (THP) |
8 | Support and its interaction with other parts of the memory management. | 8 | support and its interaction with other parts of the memory management |
9 | system. | ||
9 | 10 | ||
10 | Design principles | 11 | Design principles |
11 | ================= | 12 | ================= |
@@ -37,31 +38,25 @@ get_user_pages and follow_page | |||
37 | 38 | ||
38 | get_user_pages and follow_page if run on a hugepage, will return the | 39 | get_user_pages and follow_page if run on a hugepage, will return the |
39 | head or tail pages as usual (exactly as they would do on | 40 | head or tail pages as usual (exactly as they would do on |
40 | hugetlbfs). Most gup users will only care about the actual physical | 41 | hugetlbfs). Most GUP users will only care about the actual physical |
41 | address of the page and its temporary pinning to release after the I/O | 42 | address of the page and its temporary pinning to release after the I/O |
42 | is complete, so they won't ever notice the fact the page is huge. But | 43 | is complete, so they won't ever notice the fact the page is huge. But |
43 | if any driver is going to mangle over the page structure of the tail | 44 | if any driver is going to mangle over the page structure of the tail |
44 | page (like for checking page->mapping or other bits that are relevant | 45 | page (like for checking page->mapping or other bits that are relevant |
45 | for the head page and not the tail page), it should be updated to jump | 46 | for the head page and not the tail page), it should be updated to jump |
46 | to check head page instead. Taking reference on any head/tail page would | 47 | to check head page instead. Taking a reference on any head/tail page would |
47 | prevent page from being split by anyone. | 48 | prevent the page from being split by anyone. |
48 | 49 | ||
49 | .. note:: | 50 | .. note:: |
50 | these aren't new constraints to the GUP API, and they match the | 51 | these aren't new constraints to the GUP API, and they match the |
51 | same constrains that applies to hugetlbfs too, so any driver capable | 52 | same constraints that apply to hugetlbfs too, so any driver capable |
52 | of handling GUP on hugetlbfs will also work fine on transparent | 53 | of handling GUP on hugetlbfs will also work fine on transparent |
53 | hugepage backed mappings. | 54 | hugepage backed mappings. |
54 | 55 | ||
55 | In case you can't handle compound pages if they're returned by | 56 | In case you can't handle compound pages if they're returned by |
56 | follow_page, the FOLL_SPLIT bit can be specified as parameter to | 57 | follow_page, the FOLL_SPLIT bit can be specified as a parameter to |
57 | follow_page, so that it will split the hugepages before returning | 58 | follow_page, so that it will split the hugepages before returning |
58 | them. Migration for example passes FOLL_SPLIT as parameter to | 59 | them. |
59 | follow_page because it's not hugepage aware and in fact it can't work | ||
60 | at all on hugetlbfs (but it instead works fine on transparent | ||
61 | hugepages thanks to FOLL_SPLIT). migration simply can't deal with | ||
62 | hugepages being returned (as it's not only checking the pfn of the | ||
63 | page and pinning it during the copy but it pretends to migrate the | ||
64 | memory in regular page sizes and with regular pte/pmd mappings). | ||
65 | 60 | ||
66 | Graceful fallback | 61 | Graceful fallback |
67 | ================= | 62 | ================= |
@@ -72,11 +67,11 @@ pmd_offset. It's trivial to make the code transparent hugepage aware | |||
72 | by just grepping for "pmd_offset" and adding split_huge_pmd where | 67 | by just grepping for "pmd_offset" and adding split_huge_pmd where |
73 | missing after pmd_offset returns the pmd. Thanks to the graceful | 68 | missing after pmd_offset returns the pmd. Thanks to the graceful |
74 | fallback design, with a one liner change, you can avoid to write | 69 | fallback design, with a one liner change, you can avoid to write |
75 | hundred if not thousand of lines of complex code to make your code | 70 | hundreds if not thousands of lines of complex code to make your code |
76 | hugepage aware. | 71 | hugepage aware. |
77 | 72 | ||
78 | If you're not walking pagetables but you run into a physical hugepage | 73 | If you're not walking pagetables but you run into a physical hugepage |
79 | but you can't handle it natively in your code, you can split it by | 74 | that you can't handle natively in your code, you can split it by |
80 | calling split_huge_page(page). This is what the Linux VM does before | 75 | calling split_huge_page(page). This is what the Linux VM does before |
81 | it tries to swapout the hugepage for example. split_huge_page() can fail | 76 | it tries to swapout the hugepage for example. split_huge_page() can fail |
82 | if the page is pinned and you must handle this correctly. | 77 | if the page is pinned and you must handle this correctly. |
@@ -103,18 +98,18 @@ split_huge_page() or split_huge_pmd() has a cost. | |||
103 | 98 | ||
104 | To make pagetable walks huge pmd aware, all you need to do is to call | 99 | To make pagetable walks huge pmd aware, all you need to do is to call |
105 | pmd_trans_huge() on the pmd returned by pmd_offset. You must hold the | 100 | pmd_trans_huge() on the pmd returned by pmd_offset. You must hold the |
106 | mmap_sem in read (or write) mode to be sure an huge pmd cannot be | 101 | mmap_sem in read (or write) mode to be sure a huge pmd cannot be |
107 | created from under you by khugepaged (khugepaged collapse_huge_page | 102 | created from under you by khugepaged (khugepaged collapse_huge_page |
108 | takes the mmap_sem in write mode in addition to the anon_vma lock). If | 103 | takes the mmap_sem in write mode in addition to the anon_vma lock). If |
109 | pmd_trans_huge returns false, you just fallback in the old code | 104 | pmd_trans_huge returns false, you just fallback in the old code |
110 | paths. If instead pmd_trans_huge returns true, you have to take the | 105 | paths. If instead pmd_trans_huge returns true, you have to take the |
111 | page table lock (pmd_lock()) and re-run pmd_trans_huge. Taking the | 106 | page table lock (pmd_lock()) and re-run pmd_trans_huge. Taking the |
112 | page table lock will prevent the huge pmd to be converted into a | 107 | page table lock will prevent the huge pmd being converted into a |
113 | regular pmd from under you (split_huge_pmd can run in parallel to the | 108 | regular pmd from under you (split_huge_pmd can run in parallel to the |
114 | pagetable walk). If the second pmd_trans_huge returns false, you | 109 | pagetable walk). If the second pmd_trans_huge returns false, you |
115 | should just drop the page table lock and fallback to the old code as | 110 | should just drop the page table lock and fallback to the old code as |
116 | before. Otherwise you can proceed to process the huge pmd and the | 111 | before. Otherwise, you can proceed to process the huge pmd and the |
117 | hugepage natively. Once finished you can drop the page table lock. | 112 | hugepage natively. Once finished, you can drop the page table lock. |
118 | 113 | ||
119 | Refcounts and transparent huge pages | 114 | Refcounts and transparent huge pages |
120 | ==================================== | 115 | ==================================== |
@@ -122,61 +117,61 @@ Refcounts and transparent huge pages | |||
122 | Refcounting on THP is mostly consistent with refcounting on other compound | 117 | Refcounting on THP is mostly consistent with refcounting on other compound |
123 | pages: | 118 | pages: |
124 | 119 | ||
125 | - get_page()/put_page() and GUP operate in head page's ->_refcount. | 120 | - get_page()/put_page() and GUP operate on head page's ->_refcount. |
126 | 121 | ||
127 | - ->_refcount in tail pages is always zero: get_page_unless_zero() never | 122 | - ->_refcount in tail pages is always zero: get_page_unless_zero() never |
128 | succeed on tail pages. | 123 | succeeds on tail pages. |
129 | 124 | ||
130 | - map/unmap of the pages with PTE entry increment/decrement ->_mapcount | 125 | - map/unmap of the pages with PTE entry increment/decrement ->_mapcount |
131 | on relevant sub-page of the compound page. | 126 | on relevant sub-page of the compound page. |
132 | 127 | ||
133 | - map/unmap of the whole compound page accounted in compound_mapcount | 128 | - map/unmap of the whole compound page is accounted for in compound_mapcount |
134 | (stored in first tail page). For file huge pages, we also increment | 129 | (stored in first tail page). For file huge pages, we also increment |
135 | ->_mapcount of all sub-pages in order to have race-free detection of | 130 | ->_mapcount of all sub-pages in order to have race-free detection of |
136 | last unmap of subpages. | 131 | last unmap of subpages. |
137 | 132 | ||
138 | PageDoubleMap() indicates that the page is *possibly* mapped with PTEs. | 133 | PageDoubleMap() indicates that the page is *possibly* mapped with PTEs. |
139 | 134 | ||
140 | For anonymous pages PageDoubleMap() also indicates ->_mapcount in all | 135 | For anonymous pages, PageDoubleMap() also indicates ->_mapcount in all |
141 | subpages is offset up by one. This additional reference is required to | 136 | subpages is offset up by one. This additional reference is required to |
142 | get race-free detection of unmap of subpages when we have them mapped with | 137 | get race-free detection of unmap of subpages when we have them mapped with |
143 | both PMDs and PTEs. | 138 | both PMDs and PTEs. |
144 | 139 | ||
145 | This is optimization required to lower overhead of per-subpage mapcount | 140 | This optimization is required to lower the overhead of per-subpage mapcount |
146 | tracking. The alternative is alter ->_mapcount in all subpages on each | 141 | tracking. The alternative is to alter ->_mapcount in all subpages on each |
147 | map/unmap of the whole compound page. | 142 | map/unmap of the whole compound page. |
148 | 143 | ||
149 | For anonymous pages, we set PG_double_map when a PMD of the page got split | 144 | For anonymous pages, we set PG_double_map when a PMD of the page is split |
150 | for the first time, but still have PMD mapping. The additional references | 145 | for the first time, but still have a PMD mapping. The additional references |
151 | go away with last compound_mapcount. | 146 | go away with the last compound_mapcount. |
152 | 147 | ||
153 | File pages get PG_double_map set on first map of the page with PTE and | 148 | File pages get PG_double_map set on the first map of the page with PTE and |
154 | goes away when the page gets evicted from page cache. | 149 | goes away when the page gets evicted from the page cache. |
155 | 150 | ||
156 | split_huge_page internally has to distribute the refcounts in the head | 151 | split_huge_page internally has to distribute the refcounts in the head |
157 | page to the tail pages before clearing all PG_head/tail bits from the page | 152 | page to the tail pages before clearing all PG_head/tail bits from the page |
158 | structures. It can be done easily for refcounts taken by page table | 153 | structures. It can be done easily for refcounts taken by page table |
159 | entries. But we don't have enough information on how to distribute any | 154 | entries, but we don't have enough information on how to distribute any |
160 | additional pins (i.e. from get_user_pages). split_huge_page() fails any | 155 | additional pins (i.e. from get_user_pages). split_huge_page() fails any |
161 | requests to split pinned huge page: it expects page count to be equal to | 156 | requests to split pinned huge pages: it expects page count to be equal to |
162 | sum of mapcount of all sub-pages plus one (split_huge_page caller must | 157 | the sum of mapcount of all sub-pages plus one (split_huge_page caller must |
163 | have reference for head page). | 158 | have a reference to the head page). |
164 | 159 | ||
165 | split_huge_page uses migration entries to stabilize page->_refcount and | 160 | split_huge_page uses migration entries to stabilize page->_refcount and |
166 | page->_mapcount of anonymous pages. File pages just got unmapped. | 161 | page->_mapcount of anonymous pages. File pages just get unmapped. |
167 | 162 | ||
168 | We safe against physical memory scanners too: the only legitimate way | 163 | We are safe against physical memory scanners too: the only legitimate way |
169 | scanner can get reference to a page is get_page_unless_zero(). | 164 | a scanner can get a reference to a page is get_page_unless_zero(). |
170 | 165 | ||
171 | All tail pages have zero ->_refcount until atomic_add(). This prevents the | 166 | All tail pages have zero ->_refcount until atomic_add(). This prevents the |
172 | scanner from getting a reference to the tail page up to that point. After the | 167 | scanner from getting a reference to the tail page up to that point. After the |
173 | atomic_add() we don't care about the ->_refcount value. We already known how | 168 | atomic_add() we don't care about the ->_refcount value. We already know how |
174 | many references should be uncharged from the head page. | 169 | many references should be uncharged from the head page. |
175 | 170 | ||
176 | For head page get_page_unless_zero() will succeed and we don't mind. It's | 171 | For head page get_page_unless_zero() will succeed and we don't mind. It's |
177 | clear where reference should go after split: it will stay on head page. | 172 | clear where references should go after split: it will stay on the head page. |
178 | 173 | ||
179 | Note that split_huge_pmd() doesn't have any limitation on refcounting: | 174 | Note that split_huge_pmd() doesn't have any limitations on refcounting: |
180 | pmd can be split at any point and never fails. | 175 | pmd can be split at any point and never fails. |
181 | 176 | ||
182 | Partial unmap and deferred_split_huge_page() | 177 | Partial unmap and deferred_split_huge_page() |
@@ -188,10 +183,10 @@ in page_remove_rmap() and queue the THP for splitting if memory pressure | |||
188 | comes. Splitting will free up unused subpages. | 183 | comes. Splitting will free up unused subpages. |
189 | 184 | ||
190 | Splitting the page right away is not an option due to locking context in | 185 | Splitting the page right away is not an option due to locking context in |
191 | the place where we can detect partial unmap. It's also might be | 186 | the place where we can detect partial unmap. It also might be |
192 | counterproductive since in many cases partial unmap happens during exit(2) if | 187 | counterproductive since in many cases partial unmap happens during exit(2) if |
193 | a THP crosses a VMA boundary. | 188 | a THP crosses a VMA boundary. |
194 | 189 | ||
195 | Function deferred_split_huge_page() is used to queue page for splitting. | 190 | The function deferred_split_huge_page() is used to queue a page for splitting. |
196 | The splitting itself will happen when we get memory pressure via shrinker | 191 | The splitting itself will happen when we get memory pressure via shrinker |
197 | interface. | 192 | interface. |
diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt index f4c2a97bfdbd..223e484a1304 100644 --- a/Documentation/x86/boot.txt +++ b/Documentation/x86/boot.txt | |||
@@ -61,6 +61,10 @@ Protocol 2.12: (Kernel 3.8) Added the xloadflags field and extension fields | |||
61 | to struct boot_params for loading bzImage and ramdisk | 61 | to struct boot_params for loading bzImage and ramdisk |
62 | above 4G in 64bit. | 62 | above 4G in 64bit. |
63 | 63 | ||
64 | Protocol 2.13: (Kernel 3.14) Support 32- and 64-bit flags being set in | ||
65 | xloadflags to support booting a 64-bit kernel from 32-bit | ||
66 | EFI | ||
67 | |||
64 | **** MEMORY LAYOUT | 68 | **** MEMORY LAYOUT |
65 | 69 | ||
66 | The traditional memory map for the kernel loader, used for Image or | 70 | The traditional memory map for the kernel loader, used for Image or |
diff --git a/LICENSES/other/GPL-1.0 b/LICENSES/deprecated/GPL-1.0 index 3a4fa969e4c2..3a4fa969e4c2 100644 --- a/LICENSES/other/GPL-1.0 +++ b/LICENSES/deprecated/GPL-1.0 | |||
diff --git a/LICENSES/other/ISC b/LICENSES/deprecated/ISC index 8953c3142079..8953c3142079 100644 --- a/LICENSES/other/ISC +++ b/LICENSES/deprecated/ISC | |||
diff --git a/LICENSES/other/Linux-OpenIB b/LICENSES/deprecated/Linux-OpenIB index 1ad85f6b3a89..1ad85f6b3a89 100644 --- a/LICENSES/other/Linux-OpenIB +++ b/LICENSES/deprecated/Linux-OpenIB | |||
diff --git a/LICENSES/other/X11 b/LICENSES/deprecated/X11 index fe4353fd0000..fe4353fd0000 100644 --- a/LICENSES/other/X11 +++ b/LICENSES/deprecated/X11 | |||
diff --git a/LICENSES/other/Apache-2.0 b/LICENSES/dual/Apache-2.0 index 7cd903f573e5..6e89ddeab187 100644 --- a/LICENSES/other/Apache-2.0 +++ b/LICENSES/dual/Apache-2.0 | |||
@@ -1,6 +1,10 @@ | |||
1 | Valid-License-Identifier: Apache-2.0 | 1 | Valid-License-Identifier: Apache-2.0 |
2 | SPDX-URL: https://spdx.org/licenses/Apache-2.0.html | 2 | SPDX-URL: https://spdx.org/licenses/Apache-2.0.html |
3 | Usage-Guide: | 3 | Usage-Guide: |
4 | Do NOT use. The Apache-2.0 is not GPL2 compatible. It may only be used | ||
5 | for dual-licensed files where the other license is GPL2 compatible. | ||
6 | If you end up using this it MUST be used together with a GPL2 compatible | ||
7 | license using "OR". | ||
4 | To use the Apache License version 2.0 put the following SPDX tag/value | 8 | To use the Apache License version 2.0 put the following SPDX tag/value |
5 | pair into a comment according to the placement guidelines in the | 9 | pair into a comment according to the placement guidelines in the |
6 | licensing rules documentation: | 10 | licensing rules documentation: |
diff --git a/LICENSES/other/CDDL-1.0 b/LICENSES/dual/CDDL-1.0 index 25f614276ddd..b0ca1016db79 100644 --- a/LICENSES/other/CDDL-1.0 +++ b/LICENSES/dual/CDDL-1.0 | |||
@@ -1,8 +1,8 @@ | |||
1 | Valid-License-Identifier: CDDL-1.0 | 1 | Valid-License-Identifier: CDDL-1.0 |
2 | SPDX-URL: https://spdx.org/licenses/CDDL-1.0.html | 2 | SPDX-URL: https://spdx.org/licenses/CDDL-1.0.html |
3 | Usage-Guide: | 3 | Usage-Guide: |
4 | Do NOT use. The CDDL-1.0 is not GPL compatible. It may only be used for | 4 | Do NOT use. The CDDL-1.0 is not GPL2 compatible. It may only be used for |
5 | dual-licensed files where the other license is GPL compatible. | 5 | dual-licensed files where the other license is GPL2 compatible. |
6 | If you end up using this it MUST be used together with a GPL2 compatible | 6 | If you end up using this it MUST be used together with a GPL2 compatible |
7 | license using "OR". | 7 | license using "OR". |
8 | To use the Common Development and Distribution License 1.0 put the | 8 | To use the Common Development and Distribution License 1.0 put the |
diff --git a/LICENSES/other/MPL-1.1 b/LICENSES/dual/MPL-1.1 index 568b6049efe6..61706859e1b2 100644 --- a/LICENSES/other/MPL-1.1 +++ b/LICENSES/dual/MPL-1.1 | |||
@@ -1,6 +1,10 @@ | |||
1 | Valid-License-Identifier: MPL-1.1 | 1 | Valid-License-Identifier: MPL-1.1 |
2 | SPDX-URL: https://spdx.org/licenses/MPL-1.1.html | 2 | SPDX-URL: https://spdx.org/licenses/MPL-1.1.html |
3 | Usage-Guide: | 3 | Usage-Guide: |
4 | Do NOT use. The MPL-1.1 is not GPL2 compatible. It may only be used for | ||
5 | dual-licensed files where the other license is GPL2 compatible. | ||
6 | If you end up using this it MUST be used together with a GPL2 compatible | ||
7 | license using "OR". | ||
4 | To use the Mozilla Public License version 1.1 put the following SPDX | 8 | To use the Mozilla Public License version 1.1 put the following SPDX |
5 | tag/value pair into a comment according to the placement guidelines in | 9 | tag/value pair into a comment according to the placement guidelines in |
6 | the licensing rules documentation: | 10 | the licensing rules documentation: |
diff --git a/MAINTAINERS b/MAINTAINERS index e897d9521000..4244dd341eb7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3737,8 +3737,8 @@ F: scripts/checkpatch.pl | |||
3737 | 3737 | ||
3738 | CHINESE DOCUMENTATION | 3738 | CHINESE DOCUMENTATION |
3739 | M: Harry Wei <harryxiyou@gmail.com> | 3739 | M: Harry Wei <harryxiyou@gmail.com> |
3740 | M: Alex Shi <alex.shi@linux.alibaba.com> | ||
3740 | L: xiyoulinuxkernelgroup@googlegroups.com (subscribers-only) | 3741 | L: xiyoulinuxkernelgroup@googlegroups.com (subscribers-only) |
3741 | L: linux-kernel@zh-kernel.org (moderated for non-subscribers) | ||
3742 | S: Maintained | 3742 | S: Maintained |
3743 | F: Documentation/translations/zh_CN/ | 3743 | F: Documentation/translations/zh_CN/ |
3744 | 3744 | ||
diff --git a/include/linux/wait.h b/include/linux/wait.h index 5f3efabc36f4..b6f77cf60dd7 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -101,7 +101,7 @@ init_waitqueue_func_entry(struct wait_queue_entry *wq_entry, wait_queue_func_t f | |||
101 | * lead to sporadic and non-obvious failure. | 101 | * lead to sporadic and non-obvious failure. |
102 | * | 102 | * |
103 | * Use either while holding wait_queue_head::lock or when used for wakeups | 103 | * Use either while holding wait_queue_head::lock or when used for wakeups |
104 | * with an extra smp_mb() like: | 104 | * with an extra smp_mb() like:: |
105 | * | 105 | * |
106 | * CPU0 - waker CPU1 - waiter | 106 | * CPU0 - waker CPU1 - waiter |
107 | * | 107 | * |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a09333fd7cef..bb28b178d929 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -2687,6 +2687,24 @@ sub process { | |||
2687 | } else { | 2687 | } else { |
2688 | $signatures{$sig_nospace} = 1; | 2688 | $signatures{$sig_nospace} = 1; |
2689 | } | 2689 | } |
2690 | |||
2691 | # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email | ||
2692 | if ($sign_off =~ /^co-developed-by:$/i) { | ||
2693 | if ($email eq $author) { | ||
2694 | WARN("BAD_SIGN_OFF", | ||
2695 | "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline); | ||
2696 | } | ||
2697 | if (!defined $lines[$linenr]) { | ||
2698 | WARN("BAD_SIGN_OFF", | ||
2699 | "Co-developed-by: must be immediately followed by Signed-off-by:\n" . "$here\n" . $rawline); | ||
2700 | } elsif ($rawlines[$linenr] !~ /^\s*signed-off-by:\s*(.*)/i) { | ||
2701 | WARN("BAD_SIGN_OFF", | ||
2702 | "Co-developed-by: must be immediately followed by Signed-off-by:\n" . "$here\n" . $rawline . "\n" .$rawlines[$linenr]); | ||
2703 | } elsif ($1 ne $email) { | ||
2704 | WARN("BAD_SIGN_OFF", | ||
2705 | "Co-developed-by and Signed-off-by: name/email do not match \n" . "$here\n" . $rawline . "\n" .$rawlines[$linenr]); | ||
2706 | } | ||
2707 | } | ||
2690 | } | 2708 | } |
2691 | 2709 | ||
2692 | # Check email subject for common tools that don't need to be mentioned | 2710 | # Check email subject for common tools that don't need to be mentioned |
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check index ad9db6821824..63e9542656f1 100755 --- a/scripts/documentation-file-ref-check +++ b/scripts/documentation-file-ref-check | |||
@@ -30,6 +30,34 @@ print "Finding broken references. This may take a while... " if ($fix); | |||
30 | 30 | ||
31 | my %broken_ref; | 31 | my %broken_ref; |
32 | 32 | ||
33 | my $doc_fix = 0; | ||
34 | |||
35 | open IN, "git grep ':doc:\`' Documentation/|" | ||
36 | or die "Failed to run git grep"; | ||
37 | while (<IN>) { | ||
38 | next if (!m,^([^:]+):.*\:doc\:\`([^\`]+)\`,); | ||
39 | |||
40 | my $d = $1; | ||
41 | my $doc_ref = $2; | ||
42 | |||
43 | my $f = $doc_ref; | ||
44 | |||
45 | $d =~ s,(.*/).*,$1,; | ||
46 | $f =~ s,.*\<([^\>]+)\>,$1,; | ||
47 | |||
48 | $f ="$d$f.rst"; | ||
49 | |||
50 | next if (grep -e, glob("$f")); | ||
51 | |||
52 | if ($fix && !$doc_fix) { | ||
53 | print STDERR "\nWARNING: Currently, can't fix broken :doc:`` fields\n"; | ||
54 | } | ||
55 | $doc_fix++; | ||
56 | |||
57 | print STDERR "$f: :doc:`$doc_ref`\n"; | ||
58 | } | ||
59 | close IN; | ||
60 | |||
33 | open IN, "git grep 'Documentation/'|" | 61 | open IN, "git grep 'Documentation/'|" |
34 | or die "Failed to run git grep"; | 62 | or die "Failed to run git grep"; |
35 | while (<IN>) { | 63 | while (<IN>) { |
@@ -38,6 +66,9 @@ while (<IN>) { | |||
38 | my $f = $1; | 66 | my $f = $1; |
39 | my $ln = $2; | 67 | my $ln = $2; |
40 | 68 | ||
69 | # On linux-next, discard the Next/ directory | ||
70 | next if ($f =~ m,^Next/,); | ||
71 | |||
41 | # Makefiles and scripts contain nasty expressions to parse docs | 72 | # Makefiles and scripts contain nasty expressions to parse docs |
42 | next if ($f =~ m/Makefile/ || $f =~ m/\.sh$/); | 73 | next if ($f =~ m/Makefile/ || $f =~ m/\.sh$/); |
43 | 74 | ||
@@ -100,6 +131,7 @@ while (<IN>) { | |||
100 | } | 131 | } |
101 | } | 132 | } |
102 | } | 133 | } |
134 | close IN; | ||
103 | 135 | ||
104 | exit 0 if (!$fix); | 136 | exit 0 if (!$fix); |
105 | 137 | ||
diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install index 067459760a7b..f6a5c0bae31e 100755 --- a/scripts/sphinx-pre-install +++ b/scripts/sphinx-pre-install | |||
@@ -532,6 +532,7 @@ sub check_needs() | |||
532 | check_program("dot", 1); | 532 | check_program("dot", 1); |
533 | check_program("convert", 1); | 533 | check_program("convert", 1); |
534 | check_program("rsvg-convert", 1) if ($pdf); | 534 | check_program("rsvg-convert", 1) if ($pdf); |
535 | check_program("latexmk", 1) if ($pdf); | ||
535 | 536 | ||
536 | check_distros(); | 537 | check_distros(); |
537 | 538 | ||
diff --git a/tools/objtool/Documentation/stack-validation.txt b/tools/objtool/Documentation/stack-validation.txt index 3995735a878f..8df526c80b65 100644 --- a/tools/objtool/Documentation/stack-validation.txt +++ b/tools/objtool/Documentation/stack-validation.txt | |||
@@ -111,7 +111,7 @@ c) Higher live patching compatibility rate | |||
111 | be detectable). Objtool makes that possible. | 111 | be detectable). Objtool makes that possible. |
112 | 112 | ||
113 | For more details, see the livepatch documentation in the Linux kernel | 113 | For more details, see the livepatch documentation in the Linux kernel |
114 | source tree at Documentation/livepatch/livepatch.txt. | 114 | source tree at Documentation/livepatch/livepatch.rst. |
115 | 115 | ||
116 | Rules | 116 | Rules |
117 | ----- | 117 | ----- |