aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-01-31 22:25:25 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-01-31 22:25:25 -0500
commit255442c93843f52b6891b21d0b485bf2c97f93c3 (patch)
tree8fd1daa752dbfa4721f64421ab7d4e695605d9f7
parentd76e0a050e0f5e7c00e6d334f758178bbc16eb98 (diff)
parentae17a87dd7c79fa742ef5dcf06d1095eec4e1925 (diff)
Merge tag 'docs-4.16' of git://git.lwn.net/linux
Pull documentation updates from Jonathan Corbet: "Documentation updates for 4.16. New stuff includes refcount_t documentation, errseq documentation, kernel-doc support for nested structure definitions, the removal of lots of crufty kernel-doc support for unused formats, SPDX tag documentation, the beginnings of a manual for subsystem maintainers, and lots of fixes and updates. As usual, some of the changesets reach outside of Documentation/ to effect kerneldoc comment fixes. It also adds the new LICENSES directory, of which Thomas promises I do not need to be the maintainer" * tag 'docs-4.16' of git://git.lwn.net/linux: (65 commits) linux-next: docs-rst: Fix typos in kfigure.py linux-next: DOC: HWPOISON: Fix path to debugfs in hwpoison.txt Documentation: Fix misconversion of #if docs: add index entry for networking/msg_zerocopy Documentation: security/credentials.rst: explain need to sort group_list LICENSES: Add MPL-1.1 license LICENSES: Add the GPL 1.0 license LICENSES: Add Linux syscall note exception LICENSES: Add the MIT license LICENSES: Add the BSD-3-clause "Clear" license LICENSES: Add the BSD 3-clause "New" or "Revised" License LICENSES: Add the BSD 2-clause "Simplified" license LICENSES: Add the LGPL-2.1 license LICENSES: Add the LGPL 2.0 license LICENSES: Add the GPL 2.0 license Documentation: Add license-rules.rst to describe how to properly identify file licenses scripts: kernel_doc: better handle show warnings logic fs/*/Kconfig: drop links to 404-compliant http://acl.bestbits.at doc: md: Fix a file name to md-fault.c in fault-injection.txt errseq: Add to documentation tree ...
-rw-r--r--Documentation/00-INDEX4
-rw-r--r--Documentation/admin-guide/kernel-parameters.txt3
-rw-r--r--Documentation/admin-guide/mono.rst6
-rw-r--r--Documentation/conf.py1
-rw-r--r--Documentation/core-api/errseq.rst (renamed from Documentation/errseq.rst)20
-rw-r--r--Documentation/core-api/index.rst3
-rw-r--r--Documentation/core-api/kernel-api.rst15
-rw-r--r--Documentation/core-api/printk-formats.rst (renamed from Documentation/printk-formats.txt)227
-rw-r--r--Documentation/core-api/refcount-vs-atomic.rst150
-rw-r--r--Documentation/doc-guide/kernel-doc.rst360
-rw-r--r--Documentation/driver-api/basics.rst21
-rw-r--r--Documentation/driver-api/usb/usb3-debug-port.rst52
-rw-r--r--Documentation/driver-api/usb/writing_usb_driver.rst2
-rw-r--r--Documentation/fault-injection/fault-injection.txt2
-rw-r--r--Documentation/filesystems/ext2.txt2
-rw-r--r--Documentation/filesystems/ext4.txt7
-rw-r--r--Documentation/filesystems/vfat.txt2
-rw-r--r--Documentation/i2c/dev-interface17
-rw-r--r--Documentation/index.rst13
-rw-r--r--Documentation/kbuild/kconfig-language.txt21
-rw-r--r--Documentation/kernel-doc-nano-HOWTO.txt322
-rw-r--r--Documentation/kernel-hacking/hacking.rst6
-rw-r--r--Documentation/maintainer/conf.py10
-rw-r--r--Documentation/maintainer/configure-git.rst34
-rw-r--r--Documentation/maintainer/index.rst14
-rw-r--r--Documentation/maintainer/pull-requests.rst178
-rw-r--r--Documentation/process/kernel-enforcement-statement.rst3
-rw-r--r--Documentation/process/license-rules.rst370
-rw-r--r--Documentation/process/submit-checklist.rst4
-rw-r--r--Documentation/security/credentials.rst7
-rw-r--r--Documentation/security/self-protection.rst15
-rw-r--r--Documentation/sphinx/kfigure.py6
-rw-r--r--Documentation/sysctl/kernel.txt17
-rw-r--r--Documentation/trace/ftrace-uses.rst60
-rw-r--r--Documentation/usb/chipidea.txt12
-rw-r--r--Documentation/vm/hwpoison.txt2
-rw-r--r--Documentation/w1/w1.generic2
-rw-r--r--LICENSES/exceptions/Linux-syscall-note25
-rw-r--r--LICENSES/other/GPL-1.0260
-rw-r--r--LICENSES/other/MPL-1.1478
-rw-r--r--LICENSES/preferred/BSD-2-Clause32
-rw-r--r--LICENSES/preferred/BSD-3-Clause36
-rw-r--r--LICENSES/preferred/BSD-3-Clause-Clear41
-rw-r--r--LICENSES/preferred/GPL-2.0353
-rw-r--r--LICENSES/preferred/LGPL-2.0487
-rw-r--r--LICENSES/preferred/LGPL-2.1503
-rw-r--r--LICENSES/preferred/MIT30
-rw-r--r--drivers/w1/w1_netlink.h6
-rw-r--r--fs/9p/Kconfig3
-rw-r--r--fs/Kconfig6
-rw-r--r--fs/btrfs/Kconfig3
-rw-r--r--fs/ceph/Kconfig3
-rw-r--r--fs/cifs/Kconfig15
-rw-r--r--fs/ext2/Kconfig6
-rw-r--r--fs/ext4/Kconfig3
-rw-r--r--fs/f2fs/Kconfig6
-rw-r--r--fs/hfsplus/Kconfig3
-rw-r--r--fs/jffs2/Kconfig6
-rw-r--r--fs/jfs/Kconfig3
-rw-r--r--fs/reiserfs/Kconfig6
-rw-r--r--fs/xfs/Kconfig3
-rw-r--r--include/linux/errseq.h2
-rw-r--r--include/linux/refcount.h2
-rw-r--r--lib/errseq.c37
-rw-r--r--lib/uuid.c34
-rw-r--r--lib/vsprintf.c5
-rwxr-xr-xscripts/kernel-doc1506
67 files changed, 3887 insertions, 2006 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index 3bec49c33bbb..7f3a0728ccf2 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -228,8 +228,6 @@ isdn/
228 - directory with info on the Linux ISDN support, and supported cards. 228 - directory with info on the Linux ISDN support, and supported cards.
229kbuild/ 229kbuild/
230 - directory with info about the kernel build process. 230 - directory with info about the kernel build process.
231kernel-doc-nano-HOWTO.txt
232 - outdated info about kernel-doc documentation.
233kdump/ 231kdump/
234 - directory with mini HowTo on getting the crash dump code to work. 232 - directory with mini HowTo on getting the crash dump code to work.
235doc-guide/ 233doc-guide/
@@ -346,8 +344,6 @@ prctl/
346 - directory with info on the priveledge control subsystem 344 - directory with info on the priveledge control subsystem
347preempt-locking.txt 345preempt-locking.txt
348 - info on locking under a preemptive kernel. 346 - info on locking under a preemptive kernel.
349printk-formats.txt
350 - how to get printk format specifiers right
351process/ 347process/
352 - how to work with the mainline kernel development process. 348 - how to work with the mainline kernel development process.
353pps/ 349pps/
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index b98048b56ada..dc63e5bddf78 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2538,6 +2538,9 @@
2538 This is useful when you use a panic=... timeout and 2538 This is useful when you use a panic=... timeout and
2539 need the box quickly up again. 2539 need the box quickly up again.
2540 2540
2541 These settings can be accessed at runtime via
2542 the nmi_watchdog and hardlockup_panic sysctls.
2543
2541 netpoll.carrier_timeout= 2544 netpoll.carrier_timeout=
2542 [NET] Specifies amount of time (in seconds) that 2545 [NET] Specifies amount of time (in seconds) that
2543 netpoll should wait for a carrier. By default netpoll 2546 netpoll should wait for a carrier. By default netpoll
diff --git a/Documentation/admin-guide/mono.rst b/Documentation/admin-guide/mono.rst
index cdddc099af64..59e6d59f0ed9 100644
--- a/Documentation/admin-guide/mono.rst
+++ b/Documentation/admin-guide/mono.rst
@@ -9,14 +9,14 @@ This will allow you to execute Mono-based .NET binaries just like any
9other program after you have done the following: 9other program after you have done the following:
10 10
111) You MUST FIRST install the Mono CLR support, either by downloading 111) You MUST FIRST install the Mono CLR support, either by downloading
12 a binary package, a source tarball or by installing from CVS. Binary 12 a binary package, a source tarball or by installing from Git. Binary
13 packages for several distributions can be found at: 13 packages for several distributions can be found at:
14 14
15 http://go-mono.com/download.html 15 http://www.mono-project.com/download/
16 16
17 Instructions for compiling Mono can be found at: 17 Instructions for compiling Mono can be found at:
18 18
19 http://www.go-mono.com/compiling.html 19 http://www.mono-project.com/docs/compiling-mono/linux/
20 20
21 Once the Mono CLR support has been installed, just check that 21 Once the Mono CLR support has been installed, just check that
22 ``/usr/bin/mono`` (which could be located elsewhere, for example 22 ``/usr/bin/mono`` (which could be located elsewhere, for example
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 63857d33778c..62ac5a9f3a9f 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -88,7 +88,6 @@ finally:
88 if makefile_version and makefile_patchlevel: 88 if makefile_version and makefile_patchlevel:
89 version = release = makefile_version + '.' + makefile_patchlevel 89 version = release = makefile_version + '.' + makefile_patchlevel
90 else: 90 else:
91 sys.stderr.write('Warning: Could not extract kernel version\n')
92 version = release = "unknown version" 91 version = release = "unknown version"
93 92
94# The language for content autogenerated by Sphinx. Refer to documentation 93# The language for content autogenerated by Sphinx. Refer to documentation
diff --git a/Documentation/errseq.rst b/Documentation/core-api/errseq.rst
index 4c29bd5afbc5..ff332e272405 100644
--- a/Documentation/errseq.rst
+++ b/Documentation/core-api/errseq.rst
@@ -1,5 +1,7 @@
1=====================
1The errseq_t datatype 2The errseq_t datatype
2===================== 3=====================
4
3An errseq_t is a way of recording errors in one place, and allowing any 5An errseq_t is a way of recording errors in one place, and allowing any
4number of "subscribers" to tell whether it has changed since a previous 6number of "subscribers" to tell whether it has changed since a previous
5point where it was sampled. 7point where it was sampled.
@@ -21,12 +23,13 @@ a flag to tell whether the value has been sampled since a new value was
21recorded. That allows us to avoid bumping the counter if no one has 23recorded. That allows us to avoid bumping the counter if no one has
22sampled it since the last time an error was recorded. 24sampled it since the last time an error was recorded.
23 25
24Thus we end up with a value that looks something like this:: 26Thus we end up with a value that looks something like this:
25 27
26 bit: 31..13 12 11..0 28+--------------------------------------+----+------------------------+
27 +-----------------+----+----------------+ 29| 31..13 | 12 | 11..0 |
28 | counter | SF | errno | 30+--------------------------------------+----+------------------------+
29 +-----------------+----+----------------+ 31| counter | SF | errno |
32+--------------------------------------+----+------------------------+
30 33
31The general idea is for "watchers" to sample an errseq_t value and keep 34The general idea is for "watchers" to sample an errseq_t value and keep
32it as a running cursor. That value can later be used to tell whether 35it as a running cursor. That value can later be used to tell whether
@@ -42,6 +45,7 @@ has ever been an error set since it was first initialized.
42 45
43API usage 46API usage
44========= 47=========
48
45Let me tell you a story about a worker drone. Now, he's a good worker 49Let me tell you a story about a worker drone. Now, he's a good worker
46overall, but the company is a little...management heavy. He has to 50overall, but the company is a little...management heavy. He has to
47report to 77 supervisors today, and tomorrow the "big boss" is coming in 51report to 77 supervisors today, and tomorrow the "big boss" is coming in
@@ -125,6 +129,7 @@ not usable by anyone else.
125 129
126Serializing errseq_t cursor updates 130Serializing errseq_t cursor updates
127=================================== 131===================================
132
128Note that the errseq_t API does not protect the errseq_t cursor during a 133Note that the errseq_t API does not protect the errseq_t cursor during a
129check_and_advance_operation. Only the canonical error code is handled 134check_and_advance_operation. Only the canonical error code is handled
130atomically. In a situation where more than one task might be using the 135atomically. In a situation where more than one task might be using the
@@ -147,3 +152,8 @@ errseq_check_and_advance after taking the lock. e.g.::
147 152
148That avoids the spinlock in the common case where nothing has changed 153That avoids the spinlock in the common case where nothing has changed
149since the last time it was checked. 154since the last time it was checked.
155
156Functions
157=========
158
159.. kernel-doc:: lib/errseq.c
diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
index d5bbe035316d..1b1fd01990b5 100644
--- a/Documentation/core-api/index.rst
+++ b/Documentation/core-api/index.rst
@@ -14,6 +14,7 @@ Core utilities
14 kernel-api 14 kernel-api
15 assoc_array 15 assoc_array
16 atomic_ops 16 atomic_ops
17 refcount-vs-atomic
17 cpu_hotplug 18 cpu_hotplug
18 local_ops 19 local_ops
19 workqueue 20 workqueue
@@ -21,6 +22,8 @@ Core utilities
21 flexible-arrays 22 flexible-arrays
22 librs 23 librs
23 genalloc 24 genalloc
25 errseq
26 printk-formats
24 27
25Interfaces for kernel debugging 28Interfaces for kernel debugging
26=============================== 29===============================
diff --git a/Documentation/core-api/kernel-api.rst b/Documentation/core-api/kernel-api.rst
index 2d9da6c40a4d..e7fadf02c511 100644
--- a/Documentation/core-api/kernel-api.rst
+++ b/Documentation/core-api/kernel-api.rst
@@ -139,6 +139,21 @@ Division Functions
139.. kernel-doc:: lib/gcd.c 139.. kernel-doc:: lib/gcd.c
140 :export: 140 :export:
141 141
142Sorting
143-------
144
145.. kernel-doc:: lib/sort.c
146 :export:
147
148.. kernel-doc:: lib/list_sort.c
149 :export:
150
151UUID/GUID
152---------
153
154.. kernel-doc:: lib/uuid.c
155 :export:
156
142Memory Management in Linux 157Memory Management in Linux
143========================== 158==========================
144 159
diff --git a/Documentation/printk-formats.txt b/Documentation/core-api/printk-formats.rst
index aa0a776c817a..258b46435320 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/core-api/printk-formats.rst
@@ -5,6 +5,7 @@ How to get printk format specifiers right
5:Author: Randy Dunlap <rdunlap@infradead.org> 5:Author: Randy Dunlap <rdunlap@infradead.org>
6:Author: Andrew Murray <amurray@mpc-data.co.uk> 6:Author: Andrew Murray <amurray@mpc-data.co.uk>
7 7
8
8Integer types 9Integer types
9============= 10=============
10 11
@@ -25,39 +26,45 @@ Integer types
25 s64 %lld or %llx 26 s64 %lld or %llx
26 u64 %llu or %llx 27 u64 %llu or %llx
27 28
28If <type> is dependent on a config option for its size (e.g., ``sector_t``, 29
29``blkcnt_t``) or is architecture-dependent for its size (e.g., ``tcflag_t``), 30If <type> is dependent on a config option for its size (e.g., sector_t,
30use a format specifier of its largest possible type and explicitly cast to it. 31blkcnt_t) or is architecture-dependent for its size (e.g., tcflag_t), use a
32format specifier of its largest possible type and explicitly cast to it.
31 33
32Example:: 34Example::
33 35
34 printk("test: sector number/total blocks: %llu/%llu\n", 36 printk("test: sector number/total blocks: %llu/%llu\n",
35 (unsigned long long)sector, (unsigned long long)blockcount); 37 (unsigned long long)sector, (unsigned long long)blockcount);
36 38
37Reminder: ``sizeof()`` result is of type ``size_t``. 39Reminder: sizeof() returns type size_t.
38 40
39The kernel's printf does not support ``%n``. For obvious reasons, floating 41The kernel's printf does not support %n. Floating point formats (%e, %f,
40point formats (``%e, %f, %g, %a``) are also not recognized. Use of any 42%g, %a) are also not recognized, for obvious reasons. Use of any
41unsupported specifier or length qualifier results in a WARN and early 43unsupported specifier or length qualifier results in a WARN and early
42return from vsnprintf. 44return from vsnprintf().
43
44Raw pointer value SHOULD be printed with %p. The kernel supports
45the following extended format specifiers for pointer types:
46 45
47Pointer Types 46Pointer types
48============= 47=============
49 48
50Pointers printed without a specifier extension (i.e unadorned %p) are 49A raw pointer value may be printed with %p which will hash the address
51hashed to give a unique identifier without leaking kernel addresses to user 50before printing. The kernel also supports extended specifiers for printing
52space. On 64 bit machines the first 32 bits are zeroed. If you _really_ 51pointers of different types.
53want the address see %px below. 52
53Plain Pointers
54--------------
54 55
55:: 56::
56 57
57 %p abcdef12 or 00000000abcdef12 58 %p abcdef12 or 00000000abcdef12
58 59
60Pointers printed without a specifier extension (i.e unadorned %p) are
61hashed to prevent leaking information about the kernel memory layout. This
62has the added benefit of providing a unique identifier. On 64-bit machines
63the first 32 bits are zeroed. If you *really* want the address see %px
64below.
65
59Symbols/Function Pointers 66Symbols/Function Pointers
60========================= 67-------------------------
61 68
62:: 69::
63 70
@@ -69,6 +76,7 @@ Symbols/Function Pointers
69 %ps versatile_init 76 %ps versatile_init
70 %pB prev_fn_of_versatile_init+0x88/0x88 77 %pB prev_fn_of_versatile_init+0x88/0x88
71 78
79
72The ``F`` and ``f`` specifiers are for printing function pointers, 80The ``F`` and ``f`` specifiers are for printing function pointers,
73for example, f->func, &gettimeofday. They have the same result as 81for example, f->func, &gettimeofday. They have the same result as
74``S`` and ``s`` specifiers. But they do an extra conversion on 82``S`` and ``s`` specifiers. But they do an extra conversion on
@@ -77,14 +85,14 @@ are actually function descriptors.
77 85
78The ``S`` and ``s`` specifiers can be used for printing symbols 86The ``S`` and ``s`` specifiers can be used for printing symbols
79from direct addresses, for example, __builtin_return_address(0), 87from direct addresses, for example, __builtin_return_address(0),
80(void *)regs->ip. They result in the symbol name with (``S``) or 88(void *)regs->ip. They result in the symbol name with (S) or
81without (``s``) offsets. If KALLSYMS are disabled then the symbol 89without (s) offsets. If KALLSYMS are disabled then the symbol
82address is printed instead. 90address is printed instead.
83 91
84The ``B`` specifier results in the symbol name with offsets and should be 92The ``B`` specifier results in the symbol name with offsets and should be
85used when printing stack backtraces. The specifier takes into 93used when printing stack backtraces. The specifier takes into
86consideration the effect of compiler optimisations which may occur 94consideration the effect of compiler optimisations which may occur
87when tail-call``s are used and marked with the noreturn GCC attribute. 95when tail-calls are used and marked with the noreturn GCC attribute.
88 96
89Examples:: 97Examples::
90 98
@@ -97,33 +105,32 @@ Examples::
97 printk(" %s%pB\n", (reliable ? "" : "? "), (void *)*stack); 105 printk(" %s%pB\n", (reliable ? "" : "? "), (void *)*stack);
98 106
99Kernel Pointers 107Kernel Pointers
100=============== 108---------------
101 109
102:: 110::
103 111
104 %pK 01234567 or 0123456789abcdef 112 %pK 01234567 or 0123456789abcdef
105 113
106For printing kernel pointers which should be hidden from unprivileged 114For printing kernel pointers which should be hidden from unprivileged
107users. The behaviour of ``%pK`` depends on the ``kptr_restrict sysctl`` - see 115users. The behaviour of %pK depends on the kptr_restrict sysctl - see
108Documentation/sysctl/kernel.txt for more details. 116Documentation/sysctl/kernel.txt for more details.
109 117
110Unmodified Addresses 118Unmodified Addresses
111==================== 119--------------------
112 120
113:: 121::
114 122
115 %px 01234567 or 0123456789abcdef 123 %px 01234567 or 0123456789abcdef
116 124
117For printing pointers when you _really_ want to print the address. Please 125For printing pointers when you *really* want to print the address. Please
118consider whether or not you are leaking sensitive information about the 126consider whether or not you are leaking sensitive information about the
119Kernel layout in memory before printing pointers with %px. %px is 127kernel memory layout before printing pointers with %px. %px is functionally
120functionally equivalent to %lx. %px is preferred to %lx because it is more 128equivalent to %lx (or %lu). %px is preferred because it is more uniquely
121uniquely grep'able. If, in the future, we need to modify the way the Kernel 129grep'able. If in the future we need to modify the way the kernel handles
122handles printing pointers it will be nice to be able to find the call 130printing pointers we will be better equipped to find the call sites.
123sites.
124 131
125Struct Resources 132Struct Resources
126================ 133----------------
127 134
128:: 135::
129 136
@@ -133,32 +140,37 @@ Struct Resources
133 [mem 0x0000000060000000-0x000000006fffffff pref] 140 [mem 0x0000000060000000-0x000000006fffffff pref]
134 141
135For printing struct resources. The ``R`` and ``r`` specifiers result in a 142For printing struct resources. The ``R`` and ``r`` specifiers result in a
136printed resource with (``R``) or without (``r``) a decoded flags member. 143printed resource with (R) or without (r) a decoded flags member.
144
137Passed by reference. 145Passed by reference.
138 146
139Physical addresses types ``phys_addr_t`` 147Physical address types phys_addr_t
140======================================== 148----------------------------------
141 149
142:: 150::
143 151
144 %pa[p] 0x01234567 or 0x0123456789abcdef 152 %pa[p] 0x01234567 or 0x0123456789abcdef
145 153
146For printing a ``phys_addr_t`` type (and its derivatives, such as 154For printing a phys_addr_t type (and its derivatives, such as
147``resource_size_t``) which can vary based on build options, regardless of 155resource_size_t) which can vary based on build options, regardless of the
148the width of the CPU data path. Passed by reference. 156width of the CPU data path.
157
158Passed by reference.
149 159
150DMA addresses types ``dma_addr_t`` 160DMA address types dma_addr_t
151================================== 161----------------------------
152 162
153:: 163::
154 164
155 %pad 0x01234567 or 0x0123456789abcdef 165 %pad 0x01234567 or 0x0123456789abcdef
156 166
157For printing a ``dma_addr_t`` type which can vary based on build options, 167For printing a dma_addr_t type which can vary based on build options,
158regardless of the width of the CPU data path. Passed by reference. 168regardless of the width of the CPU data path.
169
170Passed by reference.
159 171
160Raw buffer as an escaped string 172Raw buffer as an escaped string
161=============================== 173-------------------------------
162 174
163:: 175::
164 176
@@ -168,8 +180,8 @@ For printing raw buffer as an escaped string. For the following buffer::
168 180
169 1b 62 20 5c 43 07 22 90 0d 5d 181 1b 62 20 5c 43 07 22 90 0d 5d
170 182
171few examples show how the conversion would be done (the result string 183A few examples show how the conversion would be done (excluding surrounding
172without surrounding quotes):: 184quotes)::
173 185
174 %*pE "\eb \C\a"\220\r]" 186 %*pE "\eb \C\a"\220\r]"
175 %*pEhp "\x1bb \C\x07"\x90\x0d]" 187 %*pEhp "\x1bb \C\x07"\x90\x0d]"
@@ -179,23 +191,23 @@ The conversion rules are applied according to an optional combination
179of flags (see :c:func:`string_escape_mem` kernel documentation for the 191of flags (see :c:func:`string_escape_mem` kernel documentation for the
180details): 192details):
181 193
182 - ``a`` - ESCAPE_ANY 194 - a - ESCAPE_ANY
183 - ``c`` - ESCAPE_SPECIAL 195 - c - ESCAPE_SPECIAL
184 - ``h`` - ESCAPE_HEX 196 - h - ESCAPE_HEX
185 - ``n`` - ESCAPE_NULL 197 - n - ESCAPE_NULL
186 - ``o`` - ESCAPE_OCTAL 198 - o - ESCAPE_OCTAL
187 - ``p`` - ESCAPE_NP 199 - p - ESCAPE_NP
188 - ``s`` - ESCAPE_SPACE 200 - s - ESCAPE_SPACE
189 201
190By default ESCAPE_ANY_NP is used. 202By default ESCAPE_ANY_NP is used.
191 203
192ESCAPE_ANY_NP is the sane choice for many cases, in particularly for 204ESCAPE_ANY_NP is the sane choice for many cases, in particularly for
193printing SSIDs. 205printing SSIDs.
194 206
195If field width is omitted the 1 byte only will be escaped. 207If field width is omitted then 1 byte only will be escaped.
196 208
197Raw buffer as a hex string 209Raw buffer as a hex string
198========================== 210--------------------------
199 211
200:: 212::
201 213
@@ -204,12 +216,12 @@ Raw buffer as a hex string
204 %*phD 00-01-02- ... -3f 216 %*phD 00-01-02- ... -3f
205 %*phN 000102 ... 3f 217 %*phN 000102 ... 3f
206 218
207For printing a small buffers (up to 64 bytes long) as a hex string with 219For printing small buffers (up to 64 bytes long) as a hex string with a
208certain separator. For the larger buffers consider to use 220certain separator. For larger buffers consider using
209:c:func:`print_hex_dump`. 221:c:func:`print_hex_dump`.
210 222
211MAC/FDDI addresses 223MAC/FDDI addresses
212================== 224------------------
213 225
214:: 226::
215 227
@@ -220,11 +232,11 @@ MAC/FDDI addresses
220 %pmR 050403020100 232 %pmR 050403020100
221 233
222For printing 6-byte MAC/FDDI addresses in hex notation. The ``M`` and ``m`` 234For printing 6-byte MAC/FDDI addresses in hex notation. The ``M`` and ``m``
223specifiers result in a printed address with (``M``) or without (``m``) byte 235specifiers result in a printed address with (M) or without (m) byte
224separators. The default byte separator is the colon (``:``). 236separators. The default byte separator is the colon (:).
225 237
226Where FDDI addresses are concerned the ``F`` specifier can be used after 238Where FDDI addresses are concerned the ``F`` specifier can be used after
227the ``M`` specifier to use dash (``-``) separators instead of the default 239the ``M`` specifier to use dash (-) separators instead of the default
228separator. 240separator.
229 241
230For Bluetooth addresses the ``R`` specifier shall be used after the ``M`` 242For Bluetooth addresses the ``R`` specifier shall be used after the ``M``
@@ -234,7 +246,7 @@ of Bluetooth addresses which are in the little endian order.
234Passed by reference. 246Passed by reference.
235 247
236IPv4 addresses 248IPv4 addresses
237============== 249--------------
238 250
239:: 251::
240 252
@@ -243,8 +255,8 @@ IPv4 addresses
243 %p[Ii]4[hnbl] 255 %p[Ii]4[hnbl]
244 256
245For printing IPv4 dot-separated decimal addresses. The ``I4`` and ``i4`` 257For printing IPv4 dot-separated decimal addresses. The ``I4`` and ``i4``
246specifiers result in a printed address with (``i4``) or without (``I4``) 258specifiers result in a printed address with (i4) or without (I4) leading
247leading zeros. 259zeros.
248 260
249The additional ``h``, ``n``, ``b``, and ``l`` specifiers are used to specify 261The additional ``h``, ``n``, ``b``, and ``l`` specifiers are used to specify
250host, network, big or little endian order addresses respectively. Where 262host, network, big or little endian order addresses respectively. Where
@@ -253,7 +265,7 @@ no specifier is provided the default network/big endian order is used.
253Passed by reference. 265Passed by reference.
254 266
255IPv6 addresses 267IPv6 addresses
256============== 268--------------
257 269
258:: 270::
259 271
@@ -262,7 +274,7 @@ IPv6 addresses
262 %pI6c 1:2:3:4:5:6:7:8 274 %pI6c 1:2:3:4:5:6:7:8
263 275
264For printing IPv6 network-order 16-bit hex addresses. The ``I6`` and ``i6`` 276For printing IPv6 network-order 16-bit hex addresses. The ``I6`` and ``i6``
265specifiers result in a printed address with (``I6``) or without (``i6``) 277specifiers result in a printed address with (I6) or without (i6)
266colon-separators. Leading zeros are always used. 278colon-separators. Leading zeros are always used.
267 279
268The additional ``c`` specifier can be used with the ``I`` specifier to 280The additional ``c`` specifier can be used with the ``I`` specifier to
@@ -272,7 +284,7 @@ http://tools.ietf.org/html/rfc5952
272Passed by reference. 284Passed by reference.
273 285
274IPv4/IPv6 addresses (generic, with port, flowinfo, scope) 286IPv4/IPv6 addresses (generic, with port, flowinfo, scope)
275========================================================= 287---------------------------------------------------------
276 288
277:: 289::
278 290
@@ -282,8 +294,8 @@ IPv4/IPv6 addresses (generic, with port, flowinfo, scope)
282 %pISpc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345 294 %pISpc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345
283 %p[Ii]S[pfschnbl] 295 %p[Ii]S[pfschnbl]
284 296
285For printing an IP address without the need to distinguish whether it``s 297For printing an IP address without the need to distinguish whether it's of
286of type AF_INET or AF_INET6, a pointer to a valid ``struct sockaddr``, 298type AF_INET or AF_INET6. A pointer to a valid struct sockaddr,
287specified through ``IS`` or ``iS``, can be passed to this format specifier. 299specified through ``IS`` or ``iS``, can be passed to this format specifier.
288 300
289The additional ``p``, ``f``, and ``s`` specifiers are used to specify port 301The additional ``p``, ``f``, and ``s`` specifiers are used to specify port
@@ -309,7 +321,7 @@ Further examples::
309 %pISpfc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345/123456789 321 %pISpfc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345/123456789
310 322
311UUID/GUID addresses 323UUID/GUID addresses
312=================== 324-------------------
313 325
314:: 326::
315 327
@@ -318,33 +330,33 @@ UUID/GUID addresses
318 %pUl 03020100-0504-0706-0809-0a0b0c0e0e0f 330 %pUl 03020100-0504-0706-0809-0a0b0c0e0e0f
319 %pUL 03020100-0504-0706-0809-0A0B0C0E0E0F 331 %pUL 03020100-0504-0706-0809-0A0B0C0E0E0F
320 332
321For printing 16-byte UUID/GUIDs addresses. The additional 'l', 'L', 333For printing 16-byte UUID/GUIDs addresses. The additional ``l``, ``L``,
322'b' and 'B' specifiers are used to specify a little endian order in 334``b`` and ``B`` specifiers are used to specify a little endian order in
323lower ('l') or upper case ('L') hex characters - and big endian order 335lower (l) or upper case (L) hex notation - and big endian order in lower (b)
324in lower ('b') or upper case ('B') hex characters. 336or upper case (B) hex notation.
325 337
326Where no additional specifiers are used the default big endian 338Where no additional specifiers are used the default big endian
327order with lower case hex characters will be printed. 339order with lower case hex notation will be printed.
328 340
329Passed by reference. 341Passed by reference.
330 342
331dentry names 343dentry names
332============ 344------------
333 345
334:: 346::
335 347
336 %pd{,2,3,4} 348 %pd{,2,3,4}
337 %pD{,2,3,4} 349 %pD{,2,3,4}
338 350
339For printing dentry name; if we race with :c:func:`d_move`, the name might be 351For printing dentry name; if we race with :c:func:`d_move`, the name might
340a mix of old and new ones, but it won't oops. ``%pd`` dentry is a safer 352be a mix of old and new ones, but it won't oops. %pd dentry is a safer
341equivalent of ``%s`` ``dentry->d_name.name`` we used to use, ``%pd<n>`` prints 353equivalent of %s dentry->d_name.name we used to use, %pd<n> prints ``n``
342``n`` last components. ``%pD`` does the same thing for struct file. 354last components. %pD does the same thing for struct file.
343 355
344Passed by reference. 356Passed by reference.
345 357
346block_device names 358block_device names
347================== 359------------------
348 360
349:: 361::
350 362
@@ -353,7 +365,7 @@ block_device names
353For printing name of block_device pointers. 365For printing name of block_device pointers.
354 366
355struct va_format 367struct va_format
356================ 368----------------
357 369
358:: 370::
359 371
@@ -375,31 +387,27 @@ correctness of the format string and va_list arguments.
375Passed by reference. 387Passed by reference.
376 388
377kobjects 389kobjects
378======== 390--------
379 391
380:: 392::
381 393
382 %pO 394 %pOF[fnpPcCF]
383 395
384 Base specifier for kobject based structs. Must be followed with
385 character for specific type of kobject as listed below:
386 396
387 Device tree nodes: 397For printing kobject based structs (device nodes). Default behaviour is
398equivalent to %pOFf.
388 399
389 %pOF[fnpPcCF] 400 - f - device node full_name
401 - n - device node name
402 - p - device node phandle
403 - P - device node path spec (name + @unit)
404 - F - device node flags
405 - c - major compatible string
406 - C - full compatible string
390 407
391 For printing device tree nodes. The optional arguments are: 408The separator when using multiple arguments is ':'
392 f device node full_name
393 n device node name
394 p device node phandle
395 P device node path spec (name + @unit)
396 F device node flags
397 c major compatible string
398 C full compatible string
399 Without any arguments prints full_name (same as %pOFf)
400 The separator when using multiple arguments is ':'
401 409
402 Examples: 410Examples::
403 411
404 %pOF /foo/bar@0 - Node full name 412 %pOF /foo/bar@0 - Node full name
405 %pOFf /foo/bar@0 - Same as above 413 %pOFf /foo/bar@0 - Same as above
@@ -412,11 +420,10 @@ kobjects
412 P - Populated 420 P - Populated
413 B - Populated bus 421 B - Populated bus
414 422
415 Passed by reference. 423Passed by reference.
416
417 424
418struct clk 425struct clk
419========== 426----------
420 427
421:: 428::
422 429
@@ -424,14 +431,14 @@ struct clk
424 %pCn pll1 431 %pCn pll1
425 %pCr 1560000000 432 %pCr 1560000000
426 433
427For printing struct clk structures. ``%pC`` and ``%pCn`` print the name 434For printing struct clk structures. %pC and %pCn print the name
428(Common Clock Framework) or address (legacy clock framework) of the 435(Common Clock Framework) or address (legacy clock framework) of the
429structure; ``%pCr`` prints the current clock rate. 436structure; %pCr prints the current clock rate.
430 437
431Passed by reference. 438Passed by reference.
432 439
433bitmap and its derivatives such as cpumask and nodemask 440bitmap and its derivatives such as cpumask and nodemask
434======================================================= 441-------------------------------------------------------
435 442
436:: 443::
437 444
@@ -439,13 +446,13 @@ bitmap and its derivatives such as cpumask and nodemask
439 %*pbl 0,3-6,8-10 446 %*pbl 0,3-6,8-10
440 447
441For printing bitmap and its derivatives such as cpumask and nodemask, 448For printing bitmap and its derivatives such as cpumask and nodemask,
442``%*pb`` output the bitmap with field width as the number of bits and ``%*pbl`` 449%*pb outputs the bitmap with field width as the number of bits and %*pbl
443output the bitmap as range list with field width as the number of bits. 450output the bitmap as range list with field width as the number of bits.
444 451
445Passed by reference. 452Passed by reference.
446 453
447Flags bitfields such as page flags, gfp_flags 454Flags bitfields such as page flags, gfp_flags
448============================================= 455---------------------------------------------
449 456
450:: 457::
451 458
@@ -459,14 +466,14 @@ character. Currently supported are [p]age flags, [v]ma_flags (both
459expect ``unsigned long *``) and [g]fp_flags (expects ``gfp_t *``). The flag 466expect ``unsigned long *``) and [g]fp_flags (expects ``gfp_t *``). The flag
460names and print order depends on the particular type. 467names and print order depends on the particular type.
461 468
462Note that this format should not be used directly in :c:func:`TP_printk()` part 469Note that this format should not be used directly in the
463of a tracepoint. Instead, use the ``show_*_flags()`` functions from 470:c:func:`TP_printk()` part of a tracepoint. Instead, use the show_*_flags()
464<trace/events/mmflags.h>. 471functions from <trace/events/mmflags.h>.
465 472
466Passed by reference. 473Passed by reference.
467 474
468Network device features 475Network device features
469======================= 476-----------------------
470 477
471:: 478::
472 479
@@ -476,8 +483,10 @@ For printing netdev_features_t.
476 483
477Passed by reference. 484Passed by reference.
478 485
479If you add other ``%p`` extensions, please extend lib/test_printf.c with 486Thanks
480one or more test cases, if at all feasible. 487======
481 488
489If you add other %p extensions, please extend <lib/test_printf.c> with
490one or more test cases, if at all feasible.
482 491
483Thank you for your cooperation and attention. 492Thank you for your cooperation and attention.
diff --git a/Documentation/core-api/refcount-vs-atomic.rst b/Documentation/core-api/refcount-vs-atomic.rst
new file mode 100644
index 000000000000..83351c258cdb
--- /dev/null
+++ b/Documentation/core-api/refcount-vs-atomic.rst
@@ -0,0 +1,150 @@
1===================================
2refcount_t API compared to atomic_t
3===================================
4
5.. contents:: :local:
6
7Introduction
8============
9
10The goal of refcount_t API is to provide a minimal API for implementing
11an object's reference counters. While a generic architecture-independent
12implementation from lib/refcount.c uses atomic operations underneath,
13there are a number of differences between some of the ``refcount_*()`` and
14``atomic_*()`` functions with regards to the memory ordering guarantees.
15This document outlines the differences and provides respective examples
16in order to help maintainers validate their code against the change in
17these memory ordering guarantees.
18
19The terms used through this document try to follow the formal LKMM defined in
20github.com/aparri/memory-model/blob/master/Documentation/explanation.txt
21
22memory-barriers.txt and atomic_t.txt provide more background to the
23memory ordering in general and for atomic operations specifically.
24
25Relevant types of memory ordering
26=================================
27
28.. note:: The following section only covers some of the memory
29 ordering types that are relevant for the atomics and reference
30 counters and used through this document. For a much broader picture
31 please consult memory-barriers.txt document.
32
33In the absence of any memory ordering guarantees (i.e. fully unordered)
34atomics & refcounters only provide atomicity and
35program order (po) relation (on the same CPU). It guarantees that
36each ``atomic_*()`` and ``refcount_*()`` operation is atomic and instructions
37are executed in program order on a single CPU.
38This is implemented using :c:func:`READ_ONCE`/:c:func:`WRITE_ONCE` and
39compare-and-swap primitives.
40
41A strong (full) memory ordering guarantees that all prior loads and
42stores (all po-earlier instructions) on the same CPU are completed
43before any po-later instruction is executed on the same CPU.
44It also guarantees that all po-earlier stores on the same CPU
45and all propagated stores from other CPUs must propagate to all
46other CPUs before any po-later instruction is executed on the original
47CPU (A-cumulative property). This is implemented using :c:func:`smp_mb`.
48
49A RELEASE memory ordering guarantees that all prior loads and
50stores (all po-earlier instructions) on the same CPU are completed
51before the operation. It also guarantees that all po-earlier
52stores on the same CPU and all propagated stores from other CPUs
53must propagate to all other CPUs before the release operation
54(A-cumulative property). This is implemented using
55:c:func:`smp_store_release`.
56
57A control dependency (on success) for refcounters guarantees that
58if a reference for an object was successfully obtained (reference
59counter increment or addition happened, function returned true),
60then further stores are ordered against this operation.
61Control dependency on stores are not implemented using any explicit
62barriers, but rely on CPU not to speculate on stores. This is only
63a single CPU relation and provides no guarantees for other CPUs.
64
65
66Comparison of functions
67=======================
68
69case 1) - non-"Read/Modify/Write" (RMW) ops
70-------------------------------------------
71
72Function changes:
73
74 * :c:func:`atomic_set` --> :c:func:`refcount_set`
75 * :c:func:`atomic_read` --> :c:func:`refcount_read`
76
77Memory ordering guarantee changes:
78
79 * none (both fully unordered)
80
81
82case 2) - increment-based ops that return no value
83--------------------------------------------------
84
85Function changes:
86
87 * :c:func:`atomic_inc` --> :c:func:`refcount_inc`
88 * :c:func:`atomic_add` --> :c:func:`refcount_add`
89
90Memory ordering guarantee changes:
91
92 * none (both fully unordered)
93
94case 3) - decrement-based RMW ops that return no value
95------------------------------------------------------
96
97Function changes:
98
99 * :c:func:`atomic_dec` --> :c:func:`refcount_dec`
100
101Memory ordering guarantee changes:
102
103 * fully unordered --> RELEASE ordering
104
105
106case 4) - increment-based RMW ops that return a value
107-----------------------------------------------------
108
109Function changes:
110
111 * :c:func:`atomic_inc_not_zero` --> :c:func:`refcount_inc_not_zero`
112 * no atomic counterpart --> :c:func:`refcount_add_not_zero`
113
114Memory ordering guarantees changes:
115
116 * fully ordered --> control dependency on success for stores
117
118.. note:: We really assume here that necessary ordering is provided as a
119 result of obtaining pointer to the object!
120
121
122case 5) - decrement-based RMW ops that return a value
123-----------------------------------------------------
124
125Function changes:
126
127 * :c:func:`atomic_dec_and_test` --> :c:func:`refcount_dec_and_test`
128 * :c:func:`atomic_sub_and_test` --> :c:func:`refcount_sub_and_test`
129 * no atomic counterpart --> :c:func:`refcount_dec_if_one`
130 * ``atomic_add_unless(&var, -1, 1)`` --> ``refcount_dec_not_one(&var)``
131
132Memory ordering guarantees changes:
133
134 * fully ordered --> RELEASE ordering + control dependency
135
136.. note:: :c:func:`atomic_add_unless` only provides full order on success.
137
138
139case 6) - lock-based RMW
140------------------------
141
142Function changes:
143
144 * :c:func:`atomic_dec_and_lock` --> :c:func:`refcount_dec_and_lock`
145 * :c:func:`atomic_dec_and_mutex_lock` --> :c:func:`refcount_dec_and_mutex_lock`
146
147Memory ordering guarantees changes:
148
149 * fully ordered --> RELEASE ordering + control dependency + hold
150 :c:func:`spin_lock` on success
diff --git a/Documentation/doc-guide/kernel-doc.rst b/Documentation/doc-guide/kernel-doc.rst
index 0268335414ce..722d4525f7cf 100644
--- a/Documentation/doc-guide/kernel-doc.rst
+++ b/Documentation/doc-guide/kernel-doc.rst
@@ -112,16 +112,17 @@ Example kernel-doc function comment::
112 112
113 /** 113 /**
114 * foobar() - Brief description of foobar. 114 * foobar() - Brief description of foobar.
115 * @arg: Description of argument of foobar. 115 * @argument1: Description of parameter argument1 of foobar.
116 * @argument2: Description of parameter argument2 of foobar.
116 * 117 *
117 * Longer description of foobar. 118 * Longer description of foobar.
118 * 119 *
119 * Return: Description of return value of foobar. 120 * Return: Description of return value of foobar.
120 */ 121 */
121 int foobar(int arg) 122 int foobar(int argument1, char *argument2)
122 123
123The format is similar for documentation for structures, enums, paragraphs, 124The format is similar for documentation for structures, enums, paragraphs,
124etc. See the sections below for details. 125etc. See the sections below for specific details of each type.
125 126
126The kernel-doc structure is extracted from the comments, and proper `Sphinx C 127The kernel-doc structure is extracted from the comments, and proper `Sphinx C
127Domain`_ function and type descriptions with anchors are generated for them. The 128Domain`_ function and type descriptions with anchors are generated for them. The
@@ -130,6 +131,226 @@ cross-references. See below for details.
130 131
131.. _Sphinx C Domain: http://www.sphinx-doc.org/en/stable/domains.html 132.. _Sphinx C Domain: http://www.sphinx-doc.org/en/stable/domains.html
132 133
134
135Parameters and member arguments
136-------------------------------
137
138The kernel-doc function comments describe each parameter to the function and
139function typedefs or each member of struct/union, in order, with the
140``@argument:`` descriptions. For each non-private member argument, one
141``@argument`` definition is needed.
142
143The ``@argument:`` descriptions begin on the very next line following
144the opening brief function description line, with no intervening blank
145comment lines.
146
147The ``@argument:`` descriptions may span multiple lines.
148
149.. note::
150
151 If the ``@argument`` description has multiple lines, the continuation
152 of the description should be starting exactly at the same column as
153 the previous line, e. g.::
154
155 * @argument: some long description
156 * that continues on next lines
157
158 or::
159
160 * @argument:
161 * some long description
162 * that continues on next lines
163
164If a function or typedef parameter argument is ``...`` (e. g. a variable
165number of arguments), its description should be listed in kernel-doc
166notation as::
167
168 * @...: description
169
170Private members
171~~~~~~~~~~~~~~~
172
173Inside a struct or union description, you can use the ``private:`` and
174``public:`` comment tags. Structure fields that are inside a ``private:``
175area are not listed in the generated output documentation.
176
177The ``private:`` and ``public:`` tags must begin immediately following a
178``/*`` comment marker. They may optionally include comments between the
179``:`` and the ending ``*/`` marker.
180
181Example::
182
183 /**
184 * struct my_struct - short description
185 * @a: first member
186 * @b: second member
187 * @d: fourth member
188 *
189 * Longer description
190 */
191 struct my_struct {
192 int a;
193 int b;
194 /* private: internal use only */
195 int c;
196 /* public: the next one is public */
197 int d;
198 };
199
200Function documentation
201----------------------
202
203The general format of a function and function-like macro kernel-doc comment is::
204
205 /**
206 * function_name() - Brief description of function.
207 * @arg1: Describe the first argument.
208 * @arg2: Describe the second argument.
209 * One can provide multiple line descriptions
210 * for arguments.
211 *
212 * A longer description, with more discussion of the function function_name()
213 * that might be useful to those using or modifying it. Begins with an
214 * empty comment line, and may include additional embedded empty
215 * comment lines.
216 *
217 * The longer description may have multiple paragraphs.
218 *
219 * Return: Describe the return value of foobar.
220 *
221 * The return value description can also have multiple paragraphs, and should
222 * be placed at the end of the comment block.
223 */
224
225The brief description following the function name may span multiple lines, and
226ends with an argument description, a blank comment line, or the end of the
227comment block.
228
229Return values
230~~~~~~~~~~~~~
231
232The return value, if any, should be described in a dedicated section
233named ``Return``.
234
235.. note::
236
237 #) The multi-line descriptive text you provide does *not* recognize
238 line breaks, so if you try to format some text nicely, as in::
239
240 * Return:
241 * 0 - OK
242 * -EINVAL - invalid argument
243 * -ENOMEM - out of memory
244
245 this will all run together and produce::
246
247 Return: 0 - OK -EINVAL - invalid argument -ENOMEM - out of memory
248
249 So, in order to produce the desired line breaks, you need to use a
250 ReST list, e. g.::
251
252 * Return:
253 * * 0 - OK to runtime suspend the device
254 * * -EBUSY - Device should not be runtime suspended
255
256 #) If the descriptive text you provide has lines that begin with
257 some phrase followed by a colon, each of those phrases will be taken
258 as a new section heading, with probably won't produce the desired
259 effect.
260
261Structure, union, and enumeration documentation
262-----------------------------------------------
263
264The general format of a struct, union, and enum kernel-doc comment is::
265
266 /**
267 * struct struct_name - Brief description.
268 * @argument: Description of member member_name.
269 *
270 * Description of the structure.
271 */
272
273On the above, ``struct`` is used to mean structs. You can also use ``union``
274and ``enum`` to describe unions and enums. ``argument`` is used
275to mean struct and union member names as well as enumerations in an enum.
276
277The brief description following the structure name may span multiple lines, and
278ends with a member description, a blank comment line, or the end of the
279comment block.
280
281The kernel-doc data structure comments describe each member of the structure,
282in order, with the member descriptions.
283
284Nested structs/unions
285~~~~~~~~~~~~~~~~~~~~~
286
287It is possible to document nested structs unions, like::
288
289 /**
290 * struct nested_foobar - a struct with nested unions and structs
291 * @arg1: - first argument of anonymous union/anonymous struct
292 * @arg2: - second argument of anonymous union/anonymous struct
293 * @arg3: - third argument of anonymous union/anonymous struct
294 * @arg4: - fourth argument of anonymous union/anonymous struct
295 * @bar.st1.arg1 - first argument of struct st1 on union bar
296 * @bar.st1.arg2 - second argument of struct st1 on union bar
297 * @bar.st2.arg1 - first argument of struct st2 on union bar
298 * @bar.st2.arg2 - second argument of struct st2 on union bar
299 struct nested_foobar {
300 /* Anonymous union/struct*/
301 union {
302 struct {
303 int arg1;
304 int arg2;
305 }
306 struct {
307 void *arg3;
308 int arg4;
309 }
310 }
311 union {
312 struct {
313 int arg1;
314 int arg2;
315 } st1;
316 struct {
317 void *arg1;
318 int arg2;
319 } st2;
320 } bar;
321 };
322
323.. note::
324
325 #) When documenting nested structs or unions, if the struct/union ``foo``
326 is named, the argument ``bar`` inside it should be documented as
327 ``@foo.bar:``
328 #) When the nested struct/union is anonymous, the argument ``bar`` on it
329 should be documented as ``@bar:``
330
331Typedef documentation
332---------------------
333
334The general format of a typedef kernel-doc comment is::
335
336 /**
337 * typedef type_name - Brief description.
338 *
339 * Description of the type.
340 */
341
342Typedefs with function prototypes can also be documented::
343
344 /**
345 * typedef type_name - Brief description.
346 * @arg1: description of arg1
347 * @arg2: description of arg2
348 *
349 * Description of the type.
350 */
351 typedef void (*type_name)(struct v4l2_ctrl *arg1, void *arg2);
352
353
133Highlights and cross-references 354Highlights and cross-references
134------------------------------- 355-------------------------------
135 356
@@ -201,70 +422,7 @@ cross-references.
201 422
202For further details, please refer to the `Sphinx C Domain`_ documentation. 423For further details, please refer to the `Sphinx C Domain`_ documentation.
203 424
204Function documentation
205----------------------
206
207The general format of a function and function-like macro kernel-doc comment is::
208
209 /**
210 * function_name() - Brief description of function.
211 * @arg1: Describe the first argument.
212 * @arg2: Describe the second argument.
213 * One can provide multiple line descriptions
214 * for arguments.
215 *
216 * A longer description, with more discussion of the function function_name()
217 * that might be useful to those using or modifying it. Begins with an
218 * empty comment line, and may include additional embedded empty
219 * comment lines.
220 *
221 * The longer description may have multiple paragraphs.
222 *
223 * Return: Describe the return value of foobar.
224 *
225 * The return value description can also have multiple paragraphs, and should
226 * be placed at the end of the comment block.
227 */
228
229The brief description following the function name may span multiple lines, and
230ends with an ``@argument:`` description, a blank comment line, or the end of the
231comment block.
232
233The kernel-doc function comments describe each parameter to the function, in
234order, with the ``@argument:`` descriptions. The ``@argument:`` descriptions
235must begin on the very next line following the opening brief function
236description line, with no intervening blank comment lines. The ``@argument:``
237descriptions may span multiple lines. The continuation lines may contain
238indentation. If a function parameter is ``...`` (varargs), it should be listed
239in kernel-doc notation as: ``@...:``.
240
241The return value, if any, should be described in a dedicated section at the end
242of the comment starting with "Return:".
243
244Structure, union, and enumeration documentation
245-----------------------------------------------
246
247The general format of a struct, union, and enum kernel-doc comment is::
248
249 /**
250 * struct struct_name - Brief description.
251 * @member_name: Description of member member_name.
252 *
253 * Description of the structure.
254 */
255
256Below, "struct" is used to mean structs, unions and enums, and "member" is used
257to mean struct and union members as well as enumerations in an enum.
258
259The brief description following the structure name may span multiple lines, and
260ends with a ``@member:`` description, a blank comment line, or the end of the
261comment block.
262 425
263The kernel-doc data structure comments describe each member of the structure, in
264order, with the ``@member:`` descriptions. The ``@member:`` descriptions must
265begin on the very next line following the opening brief function description
266line, with no intervening blank comment lines. The ``@member:`` descriptions may
267span multiple lines. The continuation lines may contain indentation.
268 426
269In-line member documentation comments 427In-line member documentation comments
270~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 428~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -294,42 +452,6 @@ on a line of their own, like all other kernel-doc comments::
294 int foobar; 452 int foobar;
295 } 453 }
296 454
297Private members
298~~~~~~~~~~~~~~~
299
300Inside a struct description, you can use the "private:" and "public:" comment
301tags. Structure fields that are inside a "private:" area are not listed in the
302generated output documentation. The "private:" and "public:" tags must begin
303immediately following a ``/*`` comment marker. They may optionally include
304comments between the ``:`` and the ending ``*/`` marker.
305
306Example::
307
308 /**
309 * struct my_struct - short description
310 * @a: first member
311 * @b: second member
312 *
313 * Longer description
314 */
315 struct my_struct {
316 int a;
317 int b;
318 /* private: internal use only */
319 int c;
320 };
321
322
323Typedef documentation
324---------------------
325
326The general format of a typedef kernel-doc comment is::
327
328 /**
329 * typedef type_name - Brief description.
330 *
331 * Description of the type.
332 */
333 455
334Overview documentation comments 456Overview documentation comments
335------------------------------- 457-------------------------------
@@ -376,3 +498,37 @@ file.
376 498
377Data structures visible in kernel include files should also be documented using 499Data structures visible in kernel include files should also be documented using
378kernel-doc formatted comments. 500kernel-doc formatted comments.
501
502How to use kernel-doc to generate man pages
503-------------------------------------------
504
505If you just want to use kernel-doc to generate man pages you can do this
506from the Kernel git tree::
507
508 $ scripts/kernel-doc -man $(git grep -l '/\*\*' |grep -v Documentation/) | ./split-man.pl /tmp/man
509
510Using the small ``split-man.pl`` script below::
511
512
513 #!/usr/bin/perl
514
515 if ($#ARGV < 0) {
516 die "where do I put the results?\n";
517 }
518
519 mkdir $ARGV[0],0777;
520 $state = 0;
521 while (<STDIN>) {
522 if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) {
523 if ($state == 1) { close OUT }
524 $state = 1;
525 $fn = "$ARGV[0]/$1.9";
526 print STDERR "Creating $fn\n";
527 open OUT, ">$fn" or die "can't open $fn: $!\n";
528 print OUT $_;
529 } elsif ($state != 0) {
530 print OUT $_;
531 }
532 }
533
534 close OUT;
diff --git a/Documentation/driver-api/basics.rst b/Documentation/driver-api/basics.rst
index 73fa7d42bbba..826e85d50a16 100644
--- a/Documentation/driver-api/basics.rst
+++ b/Documentation/driver-api/basics.rst
@@ -13,12 +13,6 @@ Driver device table
13.. kernel-doc:: include/linux/mod_devicetable.h 13.. kernel-doc:: include/linux/mod_devicetable.h
14 :internal: 14 :internal:
15 15
16Atomic and pointer manipulation
17-------------------------------
18
19.. kernel-doc:: arch/x86/include/asm/atomic.h
20 :internal:
21
22Delaying, scheduling, and timer routines 16Delaying, scheduling, and timer routines
23---------------------------------------- 17----------------------------------------
24 18
@@ -85,6 +79,21 @@ Internal Functions
85.. kernel-doc:: kernel/kthread.c 79.. kernel-doc:: kernel/kthread.c
86 :export: 80 :export:
87 81
82Reference counting
83------------------
84
85.. kernel-doc:: include/linux/refcount.h
86 :internal:
87
88.. kernel-doc:: lib/refcount.c
89 :export:
90
91Atomics
92-------
93
94.. kernel-doc:: arch/x86/include/asm/atomic.h
95 :internal:
96
88Kernel objects manipulation 97Kernel objects manipulation
89--------------------------- 98---------------------------
90 99
diff --git a/Documentation/driver-api/usb/usb3-debug-port.rst b/Documentation/driver-api/usb/usb3-debug-port.rst
index feb1a36a65b7..b9fd131f4723 100644
--- a/Documentation/driver-api/usb/usb3-debug-port.rst
+++ b/Documentation/driver-api/usb/usb3-debug-port.rst
@@ -98,3 +98,55 @@ you to check the sanity of the setup.
98 cat /dev/ttyUSB0 98 cat /dev/ttyUSB0
99 done 99 done
100 ===== end of bash scripts =============== 100 ===== end of bash scripts ===============
101
102Serial TTY
103==========
104
105The DbC support has been added to the xHCI driver. You can get a
106debug device provided by the DbC at runtime.
107
108In order to use this, you need to make sure your kernel has been
109configured to support USB_XHCI_DBGCAP. A sysfs attribute under
110the xHCI device node is used to enable or disable DbC. By default,
111DbC is disabled::
112
113 root@target:/sys/bus/pci/devices/0000:00:14.0# cat dbc
114 disabled
115
116Enable DbC with the following command::
117
118 root@target:/sys/bus/pci/devices/0000:00:14.0# echo enable > dbc
119
120You can check the DbC state at anytime::
121
122 root@target:/sys/bus/pci/devices/0000:00:14.0# cat dbc
123 enabled
124
125Connect the debug target to the debug host with a USB 3.0 super-
126speed A-to-A debugging cable. You can see /dev/ttyDBC0 created
127on the debug target. You will see below kernel message lines::
128
129 root@target: tail -f /var/log/kern.log
130 [ 182.730103] xhci_hcd 0000:00:14.0: DbC connected
131 [ 191.169420] xhci_hcd 0000:00:14.0: DbC configured
132 [ 191.169597] xhci_hcd 0000:00:14.0: DbC now attached to /dev/ttyDBC0
133
134Accordingly, the DbC state has been brought up to::
135
136 root@target:/sys/bus/pci/devices/0000:00:14.0# cat dbc
137 configured
138
139On the debug host, you will see the debug device has been enumerated.
140You will see below kernel message lines::
141
142 root@host: tail -f /var/log/kern.log
143 [ 79.454780] usb 2-2.1: new SuperSpeed USB device number 3 using xhci_hcd
144 [ 79.475003] usb 2-2.1: LPM exit latency is zeroed, disabling LPM.
145 [ 79.475389] usb 2-2.1: New USB device found, idVendor=1d6b, idProduct=0010
146 [ 79.475390] usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
147 [ 79.475391] usb 2-2.1: Product: Linux USB Debug Target
148 [ 79.475392] usb 2-2.1: Manufacturer: Linux Foundation
149 [ 79.475393] usb 2-2.1: SerialNumber: 0001
150
151The debug device works now. You can use any communication or debugging
152program to talk between the host and the target.
diff --git a/Documentation/driver-api/usb/writing_usb_driver.rst b/Documentation/driver-api/usb/writing_usb_driver.rst
index 69f077dcdb78..4fe1c06b6a13 100644
--- a/Documentation/driver-api/usb/writing_usb_driver.rst
+++ b/Documentation/driver-api/usb/writing_usb_driver.rst
@@ -321,6 +321,6 @@ linux-usb-devel Mailing List Archives:
321http://marc.theaimsgroup.com/?l=linux-usb-devel 321http://marc.theaimsgroup.com/?l=linux-usb-devel
322 322
323Programming Guide for Linux USB Device Drivers: 323Programming Guide for Linux USB Device Drivers:
324http://usb.cs.tum.edu/usbdoc 324http://lmu.web.psi.ch/docu/manuals/software_manuals/linux_sl/usb_linux_programming_guide.pdf
325 325
326USB Home Page: http://www.usb.org 326USB Home Page: http://www.usb.org
diff --git a/Documentation/fault-injection/fault-injection.txt b/Documentation/fault-injection/fault-injection.txt
index f4a32463ca48..de1dc35fe500 100644
--- a/Documentation/fault-injection/fault-injection.txt
+++ b/Documentation/fault-injection/fault-injection.txt
@@ -1,7 +1,7 @@
1Fault injection capabilities infrastructure 1Fault injection capabilities infrastructure
2=========================================== 2===========================================
3 3
4See also drivers/md/faulty.c and "every_nth" module option for scsi_debug. 4See also drivers/md/md-faulty.c and "every_nth" module option for scsi_debug.
5 5
6 6
7Available fault injection capabilities 7Available fault injection capabilities
diff --git a/Documentation/filesystems/ext2.txt b/Documentation/filesystems/ext2.txt
index 55755395d3dc..81c0becab225 100644
--- a/Documentation/filesystems/ext2.txt
+++ b/Documentation/filesystems/ext2.txt
@@ -49,12 +49,10 @@ sb=n Use alternate superblock at this location.
49 49
50user_xattr Enable "user." POSIX Extended Attributes 50user_xattr Enable "user." POSIX Extended Attributes
51 (requires CONFIG_EXT2_FS_XATTR). 51 (requires CONFIG_EXT2_FS_XATTR).
52 See also http://acl.bestbits.at
53nouser_xattr Don't support "user." extended attributes. 52nouser_xattr Don't support "user." extended attributes.
54 53
55acl Enable POSIX Access Control Lists support 54acl Enable POSIX Access Control Lists support
56 (requires CONFIG_EXT2_FS_POSIX_ACL). 55 (requires CONFIG_EXT2_FS_POSIX_ACL).
57 See also http://acl.bestbits.at
58noacl Don't support POSIX ACLs. 56noacl Don't support POSIX ACLs.
59 57
60nobh Do not attach buffer_heads to file pagecache. 58nobh Do not attach buffer_heads to file pagecache.
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
index 75236c0c2ac2..8cd63e16f171 100644
--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -202,15 +202,14 @@ inode_readahead_blks=n This tuning parameter controls the maximum
202 the buffer cache. The default value is 32 blocks. 202 the buffer cache. The default value is 32 blocks.
203 203
204nouser_xattr Disables Extended User Attributes. See the 204nouser_xattr Disables Extended User Attributes. See the
205 attr(5) manual page and http://acl.bestbits.at/ 205 attr(5) manual page for more information about
206 for more information about extended attributes. 206 extended attributes.
207 207
208noacl This option disables POSIX Access Control List 208noacl This option disables POSIX Access Control List
209 support. If ACL support is enabled in the kernel 209 support. If ACL support is enabled in the kernel
210 configuration (CONFIG_EXT4_FS_POSIX_ACL), ACL is 210 configuration (CONFIG_EXT4_FS_POSIX_ACL), ACL is
211 enabled by default on mount. See the acl(5) manual 211 enabled by default on mount. See the acl(5) manual
212 page and http://acl.bestbits.at/ for more information 212 page for more information about acl.
213 about acl.
214 213
215bsddf (*) Make 'df' act like BSD. 214bsddf (*) Make 'df' act like BSD.
216minixdf Make 'df' act like Minix. 215minixdf Make 'df' act like Minix.
diff --git a/Documentation/filesystems/vfat.txt b/Documentation/filesystems/vfat.txt
index cf51360e3a9f..91031298beb1 100644
--- a/Documentation/filesystems/vfat.txt
+++ b/Documentation/filesystems/vfat.txt
@@ -344,4 +344,4 @@ the following:
344 characters in the final slot are set to Unicode 0xFFFF. 344 characters in the final slot are set to Unicode 0xFFFF.
345 345
346Finally, note that the extended name is stored in Unicode. Each Unicode 346Finally, note that the extended name is stored in Unicode. Each Unicode
347character takes two bytes. 347character takes either two or four bytes, UTF-16LE encoded.
diff --git a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface
index 5ff19447ac44..d04e6e4964ee 100644
--- a/Documentation/i2c/dev-interface
+++ b/Documentation/i2c/dev-interface
@@ -17,13 +17,16 @@ i2c-10, ...). All 256 minor device numbers are reserved for i2c.
17C example 17C example
18========= 18=========
19 19
20So let's say you want to access an i2c adapter from a C program. The 20So let's say you want to access an i2c adapter from a C program.
21first thing to do is "#include <linux/i2c-dev.h>". Please note that 21First, you need to include these two headers:
22there are two files named "i2c-dev.h" out there, one is distributed 22
23with the Linux kernel and is meant to be included from kernel 23 #include <linux/i2c-dev.h>
24driver code, the other one is distributed with i2c-tools and is 24 #include <i2c/smbus.h>
25meant to be included from user-space programs. You obviously want 25
26the second one here. 26(Please note that there are two files named "i2c-dev.h" out there. One is
27distributed with the Linux kernel and the other one is included in the
28source tree of i2c-tools. They used to be different in content but since 2012
29they're identical. You should use "linux/i2c-dev.h").
27 30
28Now, you have to decide which adapter you want to access. You should 31Now, you have to decide which adapter you want to access. You should
29inspect /sys/class/i2c-dev/ or run "i2cdetect -l" to decide this. 32inspect /sys/class/i2c-dev/ or run "i2cdetect -l" to decide this.
diff --git a/Documentation/index.rst b/Documentation/index.rst
index cb7f1ba5b3b1..ef5080cbf009 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -13,6 +13,18 @@ documents into a coherent whole. Please note that improvements to the
13documentation are welcome; join the linux-doc list at vger.kernel.org if 13documentation are welcome; join the linux-doc list at vger.kernel.org if
14you want to help out. 14you want to help out.
15 15
16Licensing documentation
17-----------------------
18
19The following describes the license of the Linux kernel source code
20(GPLv2), how to properly mark the license of individual files in the source
21tree, as well as links to the full license text.
22
23.. toctree::
24 :maxdepth: 2
25
26 process/license-rules.rst
27
16User-oriented documentation 28User-oriented documentation
17--------------------------- 29---------------------------
18 30
@@ -52,6 +64,7 @@ merged much easier.
52 dev-tools/index 64 dev-tools/index
53 doc-guide/index 65 doc-guide/index
54 kernel-hacking/index 66 kernel-hacking/index
67 maintainer/index
55 68
56Kernel API documentation 69Kernel API documentation
57------------------------ 70------------------------
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index c4a293a03c33..f5b9493f04ad 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -77,6 +77,27 @@ applicable everywhere (see syntax).
77 Optionally, dependencies only for this default value can be added with 77 Optionally, dependencies only for this default value can be added with
78 "if". 78 "if".
79 79
80 The default value deliberately defaults to 'n' in order to avoid bloating the
81 build. With few exceptions, new config options should not change this. The
82 intent is for "make oldconfig" to add as little as possible to the config from
83 release to release.
84
85 Note:
86 Things that merit "default y/m" include:
87
88 a) A new Kconfig option for something that used to always be built
89 should be "default y".
90
91 b) A new gatekeeping Kconfig option that hides/shows other Kconfig
92 options (but does not generate any code of its own), should be
93 "default y" so people will see those other options.
94
95 c) Sub-driver behavior or similar options for a driver that is
96 "default n". This allows you to provide sane defaults.
97
98 d) Hardware or infrastructure that everybody expects, such as CONFIG_NET
99 or CONFIG_BLOCK. These are rare exceptions.
100
80- type definition + default value: 101- type definition + default value:
81 "def_bool"/"def_tristate" <expr> ["if" <expr>] 102 "def_bool"/"def_tristate" <expr> ["if" <expr>]
82 This is a shorthand notation for a type definition plus a value. 103 This is a shorthand notation for a type definition plus a value.
diff --git a/Documentation/kernel-doc-nano-HOWTO.txt b/Documentation/kernel-doc-nano-HOWTO.txt
deleted file mode 100644
index c23e2c5ab80d..000000000000
--- a/Documentation/kernel-doc-nano-HOWTO.txt
+++ /dev/null
@@ -1,322 +0,0 @@
1NOTE: this document is outdated and will eventually be removed. See
2Documentation/doc-guide/ for current information.
3
4kernel-doc nano-HOWTO
5=====================
6
7How to format kernel-doc comments
8---------------------------------
9
10In order to provide embedded, 'C' friendly, easy to maintain,
11but consistent and extractable documentation of the functions and
12data structures in the Linux kernel, the Linux kernel has adopted
13a consistent style for documenting functions and their parameters,
14and structures and their members.
15
16The format for this documentation is called the kernel-doc format.
17It is documented in this Documentation/kernel-doc-nano-HOWTO.txt file.
18
19This style embeds the documentation within the source files, using
20a few simple conventions. The scripts/kernel-doc perl script, the
21Documentation/sphinx/kerneldoc.py Sphinx extension and other tools understand
22these conventions, and are used to extract this embedded documentation
23into various documents.
24
25In order to provide good documentation of kernel functions and data
26structures, please use the following conventions to format your
27kernel-doc comments in Linux kernel source.
28
29We definitely need kernel-doc formatted documentation for functions
30that are exported to loadable modules using EXPORT_SYMBOL.
31
32We also look to provide kernel-doc formatted documentation for
33functions externally visible to other kernel files (not marked
34"static").
35
36We also recommend providing kernel-doc formatted documentation
37for private (file "static") routines, for consistency of kernel
38source code layout. But this is lower priority and at the
39discretion of the MAINTAINER of that kernel source file.
40
41Data structures visible in kernel include files should also be
42documented using kernel-doc formatted comments.
43
44The opening comment mark "/**" is reserved for kernel-doc comments.
45Only comments so marked will be considered by the kernel-doc scripts,
46and any comment so marked must be in kernel-doc format. Do not use
47"/**" to be begin a comment block unless the comment block contains
48kernel-doc formatted comments. The closing comment marker for
49kernel-doc comments can be either "*/" or "**/", but "*/" is
50preferred in the Linux kernel tree.
51
52Kernel-doc comments should be placed just before the function
53or data structure being described.
54
55Example kernel-doc function comment:
56
57/**
58 * foobar() - short function description of foobar
59 * @arg1: Describe the first argument to foobar.
60 * @arg2: Describe the second argument to foobar.
61 * One can provide multiple line descriptions
62 * for arguments.
63 *
64 * A longer description, with more discussion of the function foobar()
65 * that might be useful to those using or modifying it. Begins with
66 * empty comment line, and may include additional embedded empty
67 * comment lines.
68 *
69 * The longer description can have multiple paragraphs.
70 *
71 * Return: Describe the return value of foobar.
72 */
73
74The short description following the subject can span multiple lines
75and ends with an @argument description, an empty line or the end of
76the comment block.
77
78The @argument descriptions must begin on the very next line following
79this opening short function description line, with no intervening
80empty comment lines.
81
82If a function parameter is "..." (varargs), it should be listed in
83kernel-doc notation as:
84 * @...: description
85
86The return value, if any, should be described in a dedicated section
87named "Return".
88
89Example kernel-doc data structure comment.
90
91/**
92 * struct blah - the basic blah structure
93 * @mem1: describe the first member of struct blah
94 * @mem2: describe the second member of struct blah,
95 * perhaps with more lines and words.
96 *
97 * Longer description of this structure.
98 */
99
100The kernel-doc function comments describe each parameter to the
101function, in order, with the @name lines.
102
103The kernel-doc data structure comments describe each structure member
104in the data structure, with the @name lines.
105
106The longer description formatting is "reflowed", losing your line
107breaks. So presenting carefully formatted lists within these
108descriptions won't work so well; derived documentation will lose
109the formatting.
110
111See the section below "How to add extractable documentation to your
112source files" for more details and notes on how to format kernel-doc
113comments.
114
115Components of the kernel-doc system
116-----------------------------------
117
118Many places in the source tree have extractable documentation in the
119form of block comments above functions. The components of this system
120are:
121
122- scripts/kernel-doc
123
124 This is a perl script that hunts for the block comments and can mark
125 them up directly into DocBook, ReST, man, text, and HTML. (No, not
126 texinfo.)
127
128- scripts/docproc.c
129
130 This is a program for converting SGML template files into SGML
131 files. When a file is referenced it is searched for symbols
132 exported (EXPORT_SYMBOL), to be able to distinguish between internal
133 and external functions.
134 It invokes kernel-doc, giving it the list of functions that
135 are to be documented.
136 Additionally it is used to scan the SGML template files to locate
137 all the files referenced herein. This is used to generate dependency
138 information as used by make.
139
140- Makefile
141
142 The targets 'xmldocs', 'latexdocs', 'pdfdocs', 'epubdocs'and 'htmldocs'
143 are used to build XML DocBook files, LaTeX files, PDF files,
144 ePub files and html files in Documentation/.
145
146How to extract the documentation
147--------------------------------
148
149If you just want to read the ready-made books on the various
150subsystems, just type 'make epubdocs', or 'make pdfdocs', or 'make htmldocs',
151depending on your preference. If you would rather read a different format,
152you can type 'make xmldocs' and then use DocBook tools to convert
153Documentation/output/*.xml to a format of your choice (for example,
154'db2html ...' if 'make htmldocs' was not defined).
155
156If you want to see man pages instead, you can do this:
157
158$ cd linux
159$ scripts/kernel-doc -man $(find -name '*.c') | split-man.pl /tmp/man
160$ scripts/kernel-doc -man $(find -name '*.h') | split-man.pl /tmp/man
161
162Here is split-man.pl:
163
164-->
165#!/usr/bin/perl
166
167if ($#ARGV < 0) {
168 die "where do I put the results?\n";
169}
170
171mkdir $ARGV[0],0777;
172$state = 0;
173while (<STDIN>) {
174 if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) {
175 if ($state == 1) { close OUT }
176 $state = 1;
177 $fn = "$ARGV[0]/$1.9";
178 print STDERR "Creating $fn\n";
179 open OUT, ">$fn" or die "can't open $fn: $!\n";
180 print OUT $_;
181 } elsif ($state != 0) {
182 print OUT $_;
183 }
184}
185
186close OUT;
187<--
188
189If you just want to view the documentation for one function in one
190file, you can do this:
191
192$ scripts/kernel-doc -man -function fn file | nroff -man | less
193
194or this:
195
196$ scripts/kernel-doc -text -function fn file
197
198
199How to add extractable documentation to your source files
200---------------------------------------------------------
201
202The format of the block comment is like this:
203
204/**
205 * function_name(:)? (- short description)?
206(* @parameterx(space)*: (description of parameter x)?)*
207(* a blank line)?
208 * (Description:)? (Description of function)?
209 * (section header: (section description)? )*
210(*)?*/
211
212All "description" text can span multiple lines, although the
213function_name & its short description are traditionally on a single line.
214Description text may also contain blank lines (i.e., lines that contain
215only a "*").
216
217"section header:" names must be unique per function (or struct,
218union, typedef, enum).
219
220Use the section header "Return" for sections describing the return value
221of a function.
222
223Avoid putting a spurious blank line after the function name, or else the
224description will be repeated!
225
226All descriptive text is further processed, scanning for the following special
227patterns, which are highlighted appropriately.
228
229'funcname()' - function
230'$ENVVAR' - environment variable
231'&struct_name' - name of a structure (up to two words including 'struct')
232'@parameter' - name of a parameter
233'%CONST' - name of a constant.
234
235NOTE 1: The multi-line descriptive text you provide does *not* recognize
236line breaks, so if you try to format some text nicely, as in:
237
238 Return:
239 0 - cool
240 1 - invalid arg
241 2 - out of memory
242
243this will all run together and produce:
244
245 Return: 0 - cool 1 - invalid arg 2 - out of memory
246
247NOTE 2: If the descriptive text you provide has lines that begin with
248some phrase followed by a colon, each of those phrases will be taken as
249a new section heading, which means you should similarly try to avoid text
250like:
251
252 Return:
253 0: cool
254 1: invalid arg
255 2: out of memory
256
257every line of which would start a new section. Again, probably not
258what you were after.
259
260Take a look around the source tree for examples.
261
262
263kernel-doc for structs, unions, enums, and typedefs
264---------------------------------------------------
265
266Beside functions you can also write documentation for structs, unions,
267enums and typedefs. Instead of the function name you must write the name
268of the declaration; the struct/union/enum/typedef must always precede
269the name. Nesting of declarations is not supported.
270Use the argument mechanism to document members or constants.
271
272Inside a struct description, you can use the "private:" and "public:"
273comment tags. Structure fields that are inside a "private:" area
274are not listed in the generated output documentation. The "private:"
275and "public:" tags must begin immediately following a "/*" comment
276marker. They may optionally include comments between the ":" and the
277ending "*/" marker.
278
279Example:
280
281/**
282 * struct my_struct - short description
283 * @a: first member
284 * @b: second member
285 *
286 * Longer description
287 */
288struct my_struct {
289 int a;
290 int b;
291/* private: internal use only */
292 int c;
293};
294
295
296Including documentation blocks in source files
297----------------------------------------------
298
299To facilitate having source code and comments close together, you can
300include kernel-doc documentation blocks that are free-form comments
301instead of being kernel-doc for functions, structures, unions,
302enums, or typedefs. This could be used for something like a
303theory of operation for a driver or library code, for example.
304
305This is done by using a DOC: section keyword with a section title. E.g.:
306
307/**
308 * DOC: Theory of Operation
309 *
310 * The whizbang foobar is a dilly of a gizmo. It can do whatever you
311 * want it to do, at any time. It reads your mind. Here's how it works.
312 *
313 * foo bar splat
314 *
315 * The only drawback to this gizmo is that is can sometimes damage
316 * hardware, software, or its subject(s).
317 */
318
319DOC: sections are used in ReST files.
320
321Tim.
322*/ <twaugh@redhat.com>
diff --git a/Documentation/kernel-hacking/hacking.rst b/Documentation/kernel-hacking/hacking.rst
index daf3883b2694..9999c8468293 100644
--- a/Documentation/kernel-hacking/hacking.rst
+++ b/Documentation/kernel-hacking/hacking.rst
@@ -523,7 +523,7 @@ this expression is true, or ``-ERESTARTSYS`` if a signal is received. The
523Waking Up Queued Tasks 523Waking Up Queued Tasks
524---------------------- 524----------------------
525 525
526Call :c:func:`wake_up()` (``include/linux/wait.h``);, which will wake 526Call :c:func:`wake_up()` (``include/linux/wait.h``), which will wake
527up every process in the queue. The exception is if one has 527up every process in the queue. The exception is if one has
528``TASK_EXCLUSIVE`` set, in which case the remainder of the queue will 528``TASK_EXCLUSIVE`` set, in which case the remainder of the queue will
529not be woken. There are other variants of this basic function available 529not be woken. There are other variants of this basic function available
@@ -690,8 +690,8 @@ not provide the necessary runtime environment and the include files are
690not tested for it. It is still possible, but not recommended. If you 690not tested for it. It is still possible, but not recommended. If you
691really want to do this, forget about exceptions at least. 691really want to do this, forget about exceptions at least.
692 692
693NUMif 693#if
694----- 694---
695 695
696It is generally considered cleaner to use macros in header files (or at 696It is generally considered cleaner to use macros in header files (or at
697the top of .c files) to abstract away functions rather than using \`#if' 697the top of .c files) to abstract away functions rather than using \`#if'
diff --git a/Documentation/maintainer/conf.py b/Documentation/maintainer/conf.py
new file mode 100644
index 000000000000..81e9eb7a7884
--- /dev/null
+++ b/Documentation/maintainer/conf.py
@@ -0,0 +1,10 @@
1# -*- coding: utf-8; mode: python -*-
2
3project = 'Linux Kernel Development Documentation'
4
5tags.add("subproject")
6
7latex_documents = [
8 ('index', 'maintainer.tex', 'Linux Kernel Development Documentation',
9 'The kernel development community', 'manual'),
10]
diff --git a/Documentation/maintainer/configure-git.rst b/Documentation/maintainer/configure-git.rst
new file mode 100644
index 000000000000..78bbbb0d2c84
--- /dev/null
+++ b/Documentation/maintainer/configure-git.rst
@@ -0,0 +1,34 @@
1.. _configuregit:
2
3Configure Git
4=============
5
6This chapter describes maintainer level git configuration.
7
8Tagged branches used in :ref:`Documentation/maintainer/pull-requests.rst
9<pullrequests>` should be signed with the developers public GPG key. Signed
10tags can be created by passing the ``-u`` flag to ``git tag``. However,
11since you would *usually* use the same key for the same project, you can
12set it once with
13::
14
15 git config user.signingkey "keyname"
16
17Alternatively, edit your ``.git/config`` or ``~/.gitconfig`` file by hand:
18::
19
20 [user]
21 name = Jane Developer
22 email = jd@domain.org
23 signingkey = jd@domain.org
24
25You may need to tell ``git`` to use ``gpg2``
26::
27
28 [gpg]
29 program = /path/to/gpg2
30
31You may also like to tell ``gpg`` which ``tty`` to use (add to your shell rc file)
32::
33
34 export GPG_TTY=$(tty)
diff --git a/Documentation/maintainer/index.rst b/Documentation/maintainer/index.rst
new file mode 100644
index 000000000000..2a14916930cb
--- /dev/null
+++ b/Documentation/maintainer/index.rst
@@ -0,0 +1,14 @@
1==========================
2Kernel Maintainer Handbook
3==========================
4
5This document is the humble beginning of a manual for kernel maintainers.
6There is a lot yet to go here! Please feel free to propose (and write)
7additions to this manual.
8
9.. toctree::
10 :maxdepth: 2
11
12 configure-git
13 pull-requests
14
diff --git a/Documentation/maintainer/pull-requests.rst b/Documentation/maintainer/pull-requests.rst
new file mode 100644
index 000000000000..a19db3458b56
--- /dev/null
+++ b/Documentation/maintainer/pull-requests.rst
@@ -0,0 +1,178 @@
1.. _pullrequests:
2
3Creating Pull Requests
4======================
5
6This chapter describes how maintainers can create and submit pull requests
7to other maintainers. This is useful for transferring changes from one
8maintainers tree to another maintainers tree.
9
10This document was written by Tobin C. Harding (who at that time, was not an
11experienced maintainer) primarily from comments made by Greg Kroah-Hartman
12and Linus Torvalds on LKML. Suggestions and fixes by Jonathan Corbet and
13Mauro Carvalho Chehab. Misrepresentation was unintentional but inevitable,
14please direct abuse to Tobin C. Harding <me@tobin.cc>.
15
16Original email thread::
17
18 http://lkml.kernel.org/r/20171114110500.GA21175@kroah.com
19
20
21Create Branch
22-------------
23
24To start with you will need to have all the changes you wish to include in
25the pull request on a separate branch. Typically you will base this branch
26off of a branch in the developers tree whom you intend to send the pull
27request to.
28
29In order to create the pull request you must first tag the branch that you
30have just created. It is recommended that you choose a meaningful tag name,
31in a way that you and others can understand, even after some time. A good
32practice is to include in the name an indicator of the sybsystem of origin
33and the target kernel version.
34
35Greg offers the following. A pull request with miscellaneous stuff for
36drivers/char, to be applied at the Kernel version 4.15-rc1 could be named
37as ``char-misc-4.15-rc1``. If such tag would be produced from a branch
38named ``char-misc-next``, you would be using the following command::
39
40 git tag -s char-misc-4.15-rc1 char-misc-next
41
42that will create a signed tag called ``char-misc-4.15-rc1`` based on the
43last commit in the ``char-misc-next`` branch, and sign it with your gpg key
44(see :ref:`Documentation/maintainer/configure_git.rst <configuregit>`).
45
46Linus will only accept pull requests based on a signed tag. Other
47maintainers may differ.
48
49When you run the above command ``git`` will drop you into an editor and ask
50you to describe the tag. In this case, you are describing a pull request,
51so outline what is contained here, why it should be merged, and what, if
52any, testing has been done. All of this information will end up in the tag
53itself, and then in the merge commit that the maintainer makes if/when they
54merge the pull request. So write it up well, as it will be in the kernel
55tree for forever.
56
57As said by Linus::
58
59 Anyway, at least to me, the important part is the *message*. I want
60 to understand what I'm pulling, and why I should pull it. I also
61 want to use that message as the message for the merge, so it should
62 not just make sense to me, but make sense as a historical record
63 too.
64
65 Note that if there is something odd about the pull request, that
66 should very much be in the explanation. If you're touching files
67 that you don't maintain, explain _why_. I will see it in the
68 diffstat anyway, and if you didn't mention it, I'll just be extra
69 suspicious. And when you send me new stuff after the merge window
70 (or even bug-fixes, but ones that look scary), explain not just
71 what they do and why they do it, but explain the _timing_. What
72 happened that this didn't go through the merge window..
73
74 I will take both what you write in the email pull request _and_ in
75 the signed tag, so depending on your workflow, you can either
76 describe your work in the signed tag (which will also automatically
77 make it into the pull request email), or you can make the signed
78 tag just a placeholder with nothing interesting in it, and describe
79 the work later when you actually send me the pull request.
80
81 And yes, I will edit the message. Partly because I tend to do just
82 trivial formatting (the whole indentation and quoting etc), but
83 partly because part of the message may make sense for me at pull
84 time (describing the conflicts and your personal issues for sending
85 it right now), but may not make sense in the context of a merge
86 commit message, so I will try to make it all make sense. I will
87 also fix any speeling mistaeks and bad grammar I notice,
88 particularly for non-native speakers (but also for native ones
89 ;^). But I may miss some, or even add some.
90
91 Linus
92
93Greg gives, as an example pull request::
94
95 Char/Misc patches for 4.15-rc1
96
97 Here is the big char/misc patch set for the 4.15-rc1 merge window.
98 Contained in here is the normal set of new functions added to all
99 of these crazy drivers, as well as the following brand new
100 subsystems:
101 - time_travel_controller: Finally a set of drivers for the
102 latest time travel bus architecture that provides i/o to
103 the CPU before it asked for it, allowing uninterrupted
104 processing
105 - relativity_shifters: due to the affect that the
106 time_travel_controllers have on the overall system, there
107 was a need for a new set of relativity shifter drivers to
108 accommodate the newly formed black holes that would
109 threaten to suck CPUs into them. This subsystem handles
110 this in a way to successfully neutralize the problems.
111 There is a Kconfig option to force these to be enabled
112 when needed, so problems should not occur.
113
114 All of these patches have been successfully tested in the latest
115 linux-next releases, and the original problems that it found have
116 all been resolved (apologies to anyone living near Canberra for the
117 lack of the Kconfig options in the earlier versions of the
118 linux-next tree creations.)
119
120 Signed-off-by: Your-name-here <your_email@domain>
121
122
123The tag message format is just like a git commit id. One line at the top
124for a "summary subject" and be sure to sign-off at the bottom.
125
126Now that you have a local signed tag, you need to push it up to where it
127can be retrieved::
128
129 git push origin char-misc-4.15-rc1
130
131
132Create Pull Request
133-------------------
134
135The last thing to do is create the pull request message. ``git`` handily
136will do this for you with the ``git request-pull`` command, but it needs a
137bit of help determining what you want to pull, and on what to base the pull
138against (to show the correct changes to be pulled and the diffstat). The
139following command(s) will generate a pull request::
140
141 git request-pull master git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ char-misc-4.15-rc1
142
143Quoting Greg::
144
145 This is asking git to compare the difference from the
146 'char-misc-4.15-rc1' tag location, to the head of the 'master'
147 branch (which in my case points to the last location in Linus's
148 tree that I diverged from, usually a -rc release) and to use the
149 git:// protocol to pull from. If you wish to use https://, that
150 can be used here instead as well (but note that some people behind
151 firewalls will have problems with https git pulls).
152
153 If the char-misc-4.15-rc1 tag is not present in the repo that I am
154 asking to be pulled from, git will complain saying it is not there,
155 a handy way to remember to actually push it to a public location.
156
157 The output of 'git request-pull' will contain the location of the
158 git tree and specific tag to pull from, and the full text
159 description of that tag (which is why you need to provide good
160 information in that tag). It will also create a diffstat of the
161 pull request, and a shortlog of the individual commits that the
162 pull request will provide.
163
164Linus responded that he tends to prefer the ``git://`` protocol. Other
165maintainers may have different preferences. Also, note that if you are
166creating pull requests without a signed tag then ``https://`` may be a
167better choice. Please see the original thread for the full discussion.
168
169
170Submit Pull Request
171-------------------
172
173A pull request is submitted in the same way as an ordinary patch. Send as
174inline email to the maintainer and CC LKML and any sub-system specific
175lists if required. Pull requests to Linus typically have a subject line
176something like::
177
178 [GIT PULL] <subsystem> changes for v4.15-rc1
diff --git a/Documentation/process/kernel-enforcement-statement.rst b/Documentation/process/kernel-enforcement-statement.rst
index bfa6a78103d8..6816c12d6956 100644
--- a/Documentation/process/kernel-enforcement-statement.rst
+++ b/Documentation/process/kernel-enforcement-statement.rst
@@ -68,6 +68,7 @@ we might work for today, have in the past, or will in the future.
68 - Paul Burton 68 - Paul Burton
69 - Javier Martinez Canillas 69 - Javier Martinez Canillas
70 - Rob Clark 70 - Rob Clark
71 - Kees Cook (Google)
71 - Jonathan Corbet 72 - Jonathan Corbet
72 - Dennis Dalessandro 73 - Dennis Dalessandro
73 - Vivien Didelot (Savoir-faire Linux) 74 - Vivien Didelot (Savoir-faire Linux)
@@ -137,6 +138,7 @@ we might work for today, have in the past, or will in the future.
137 - Anna Schumaker 138 - Anna Schumaker
138 - Jes Sorensen 139 - Jes Sorensen
139 - K.Y. Srinivasan 140 - K.Y. Srinivasan
141 - David Sterba (SUSE)
140 - Heiko Stuebner 142 - Heiko Stuebner
141 - Jiri Kosina (SUSE) 143 - Jiri Kosina (SUSE)
142 - Willy Tarreau 144 - Willy Tarreau
@@ -144,6 +146,7 @@ we might work for today, have in the past, or will in the future.
144 - Linus Torvalds 146 - Linus Torvalds
145 - Thierry Reding 147 - Thierry Reding
146 - Rik van Riel 148 - Rik van Riel
149 - Luis R. Rodriguez
147 - Geert Uytterhoeven (Glider bvba) 150 - Geert Uytterhoeven (Glider bvba)
148 - Eduardo Valentin (Amazon.com) 151 - Eduardo Valentin (Amazon.com)
149 - Daniel Vetter 152 - Daniel Vetter
diff --git a/Documentation/process/license-rules.rst b/Documentation/process/license-rules.rst
new file mode 100644
index 000000000000..408f77dc6157
--- /dev/null
+++ b/Documentation/process/license-rules.rst
@@ -0,0 +1,370 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3Linux kernel licensing rules
4============================
5
6The Linux Kernel is provided under the terms of the GNU General Public
7License version 2 only (GPL-2.0), as published by the Free Software
8Foundation, and provided in the COPYING file. This documentation file is
9not meant to replace the COPYING file, but provides a description of how
10each source file should be annotated to make the licensing it is governed
11under clear and unambiguous.
12
13The license in the COPYING file applies to the kernel source as a whole,
14though individual source files can have a different license which is
15required to be compatible with the GPL-2.0::
16
17 GPL-1.0+ : GNU General Public License v1.0 or later
18 GPL-2.0+ : GNU General Public License v2.0 or later
19 LGPL-2.0 : GNU Library General Public License v2 only
20 LGPL-2.0+ : GNU Library General Public License v2 or later
21 LGPL-2.1 : GNU Lesser General Public License v2.1 only
22 LGPL-2.1+ : GNU Lesser General Public License v2.1 or later
23
24Aside from that, individual files can be provided under a dual license,
25e.g. one of the compatible GPL variants and alternatively under a
26permissive license like BSD, MIT etc.
27
28The User-space API (UAPI) header files, which describe the interface of
29user-space programs to the kernel are a special case. According to the
30note in the kernel COPYING file, the syscall interface is a clear boundary,
31which does not extend the GPL requirements to any software which uses it to
32communicate with the kernel. Because the UAPI headers must be includable
33into any source files which create an executable running on the Linux
34kernel, the exception must be documented by a special license expression.
35
36The common way of expressing the license of a source file is to add the
37matching boilerplate text into the top comment of the file. Due to
38formatting, typos etc. these "boilerplates" are hard to validate for
39tools which are used in the context of license compliance.
40
41An alternative to boilerplate text is the use of Software Package Data
42Exchange (SPDX) license identifiers in each source file. SPDX license
43identifiers are machine parsable and precise shorthands for the license
44under which the content of the file is contributed. SPDX license
45identifiers are managed by the SPDX Workgroup at the Linux Foundation and
46have been agreed on by partners throughout the industry, tool vendors, and
47legal teams. For further information see https://spdx.org/
48
49The Linux kernel requires the precise SPDX identifier in all source files.
50The valid identifiers used in the kernel are explained in the section
51`License identifiers`_ and have been retrieved from the official SPDX
52license list at https://spdx.org/licenses/ along with the license texts.
53
54License identifier syntax
55-------------------------
56
571. Placement:
58
59 The SPDX license identifier in kernel files shall be added at the first
60 possible line in a file which can contain a comment. For the majority
61 or files this is the first line, except for scripts which require the
62 '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX
63 identifier goes into the second line.
64
65|
66
672. Style:
68
69 The SPDX license identifier is added in form of a comment. The comment
70 style depends on the file type::
71
72 C source: // SPDX-License-Identifier: <SPDX License Expression>
73 C header: /* SPDX-License-Identifier: <SPDX License Expression> */
74 ASM: /* SPDX-License-Identifier: <SPDX License Expression> */
75 scripts: # SPDX-License-Identifier: <SPDX License Expression>
76 .rst: .. SPDX-License-Identifier: <SPDX License Expression>
77 .dts{i}: // SPDX-License-Identifier: <SPDX License Expression>
78
79 If a specific tool cannot handle the standard comment style, then the
80 appropriate comment mechanism which the tool accepts shall be used. This
81 is the reason for having the "/\* \*/" style comment in C header
82 files. There was build breakage observed with generated .lds files where
83 'ld' failed to parse the C++ comment. This has been fixed by now, but
84 there are still older assembler tools which cannot handle C++ style
85 comments.
86
87|
88
893. Syntax:
90
91 A <SPDX License Expression> is either an SPDX short form license
92 identifier found on the SPDX License List, or the combination of two
93 SPDX short form license identifiers separated by "WITH" when a license
94 exception applies. When multiple licenses apply, an expression consists
95 of keywords "AND", "OR" separating sub-expressions and surrounded by
96 "(", ")" .
97
98 License identifiers for licenses like [L]GPL with the 'or later' option
99 are constructed by using a "+" for indicating the 'or later' option.::
100
101 // SPDX-License-Identifier: GPL-2.0+
102 // SPDX-License-Identifier: LGPL-2.1+
103
104 WITH should be used when there is a modifier to a license needed.
105 For example, the linux kernel UAPI files use the expression::
106
107 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
108 // SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note
109
110 Other examples using WITH exceptions found in the kernel are::
111
112 // SPDX-License-Identifier: GPL-2.0 WITH mif-exception
113 // SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0
114
115 Exceptions can only be used with particular License identifiers. The
116 valid License identifiers are listed in the tags of the exception text
117 file. For details see the point `Exceptions`_ in the chapter `License
118 identifiers`_.
119
120 OR should be used if the file is dual licensed and only one license is
121 to be selected. For example, some dtsi files are available under dual
122 licenses::
123
124 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
125
126 Examples from the kernel for license expressions in dual licensed files::
127
128 // SPDX-License-Identifier: GPL-2.0 OR MIT
129 // SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
130 // SPDX-License-Identifier: GPL-2.0 OR Apache-2.0
131 // SPDX-License-Identifier: GPL-2.0 OR MPL-1.1
132 // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT
133 // SPDX-License-Identifier: GPL-1.0+ OR BSD-3-Clause OR OpenSSL
134
135 AND should be used if the file has multiple licenses whose terms all
136 apply to use the file. For example, if code is inherited from another
137 project and permission has been given to put it in the kernel, but the
138 original license terms need to remain in effect::
139
140 // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) AND MIT
141
142 Another other example where both sets of license terms need to be
143 adhered to is::
144
145 // SPDX-License-Identifier: GPL-1.0+ AND LGPL-2.1+
146
147License identifiers
148-------------------
149
150The licenses currently used, as well as the licenses for code added to the
151kernel, can be broken down into:
152
1531. _`Preferred licenses`:
154
155 Whenever possible these licenses should be used as they are known to be
156 fully compatible and widely used. These licenses are available from the
157 directory::
158
159 LICENSES/preferred/
160
161 in the kernel source tree.
162
163 The files in this directory contain the full license text and
164 `Metatags`_. The file names are identical to the SPDX license
165 identifier which shall be used for the license in source files.
166
167 Examples::
168
169 LICENSES/preferred/GPL-2.0
170
171 Contains the GPL version 2 license text and the required metatags::
172
173 LICENSES/preferred/MIT
174
175 Contains the MIT license text and the required metatags
176
177 _`Metatags`:
178
179 The following meta tags must be available in a license file:
180
181 - Valid-License-Identifier:
182
183 One or more lines which declare which License Identifiers are valid
184 inside the project to reference this particular license text. Usually
185 this is a single valid identifier, but e.g. for licenses with the 'or
186 later' options two identifiers are valid.
187
188 - SPDX-URL:
189
190 The URL of the SPDX page which contains additional information related
191 to the license.
192
193 - Usage-Guidance:
194
195 Freeform text for usage advice. The text must include correct examples
196 for the SPDX license identifiers as they should be put into source
197 files according to the `License identifier syntax`_ guidelines.
198
199 - License-Text:
200
201 All text after this tag is treated as the original license text
202
203 File format examples::
204
205 Valid-License-Identifier: GPL-2.0
206 Valid-License-Identifier: GPL-2.0+
207 SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
208 Usage-Guide:
209 To use this license in source code, put one of the following SPDX
210 tag/value pairs into a comment according to the placement
211 guidelines in the licensing rules documentation.
212 For 'GNU General Public License (GPL) version 2 only' use:
213 SPDX-License-Identifier: GPL-2.0
214 For 'GNU General Public License (GPL) version 2 or any later version' use:
215 SPDX-License-Identifier: GPL-2.0+
216 License-Text:
217 Full license text
218
219 ::
220
221 SPDX-License-Identifier: MIT
222 SPDX-URL: https://spdx.org/licenses/MIT.html
223 Usage-Guide:
224 To use this license in source code, put the following SPDX
225 tag/value pair into a comment according to the placement
226 guidelines in the licensing rules documentation.
227 SPDX-License-Identifier: MIT
228 License-Text:
229 Full license text
230
231|
232
2332. Not recommended licenses:
234
235 These licenses should only be used for existing code or for importing
236 code from a different project. These licenses are available from the
237 directory::
238
239 LICENSES/other/
240
241 in the kernel source tree.
242
243 The files in this directory contain the full license text and
244 `Metatags`_. The file names are identical to the SPDX license
245 identifier which shall be used for the license in source files.
246
247 Examples::
248
249 LICENSES/other/ISC
250
251 Contains the Internet Systems Consortium license text and the required
252 metatags::
253
254 LICENSES/other/ZLib
255
256 Contains the ZLIB license text and the required metatags.
257
258 Metatags:
259
260 The metatag requirements for 'other' licenses are identical to the
261 requirements of the `Preferred licenses`_.
262
263 File format example::
264
265 Valid-License-Identifier: ISC
266 SPDX-URL: https://spdx.org/licenses/ISC.html
267 Usage-Guide:
268 Usage of this license in the kernel for new code is discouraged
269 and it should solely be used for importing code from an already
270 existing project.
271 To use this license in source code, put the following SPDX
272 tag/value pair into a comment according to the placement
273 guidelines in the licensing rules documentation.
274 SPDX-License-Identifier: ISC
275 License-Text:
276 Full license text
277
278|
279
2803. _`Exceptions`:
281
282 Some licenses can be amended with exceptions which grant certain rights
283 which the original license does not. These exceptions are available
284 from the directory::
285
286 LICENSES/exceptions/
287
288 in the kernel source tree. The files in this directory contain the full
289 exception text and the required `Exception Metatags`_.
290
291 Examples::
292
293 LICENSES/exceptions/Linux-syscall-note
294
295 Contains the Linux syscall exception as documented in the COPYING
296 file of the Linux kernel, which is used for UAPI header files.
297 e.g. /\* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note \*/::
298
299 LICENSES/exceptions/GCC-exception-2.0
300
301 Contains the GCC 'linking exception' which allows to link any binary
302 independent of its license against the compiled version of a file marked
303 with this exception. This is required for creating runnable executables
304 from source code which is not compatible with the GPL.
305
306 _`Exception Metatags`:
307
308 The following meta tags must be available in an exception file:
309
310 - SPDX-Exception-Identifier:
311
312 One exception identifier which can be used with SPDX license
313 identifiers.
314
315 - SPDX-URL:
316
317 The URL of the SPDX page which contains additional information related
318 to the exception.
319
320 - SPDX-Licenses:
321
322 A comma separated list of SPDX license identifiers for which the
323 exception can be used.
324
325 - Usage-Guidance:
326
327 Freeform text for usage advice. The text must be followed by correct
328 examples for the SPDX license identifiers as they should be put into
329 source files according to the `License identifier syntax`_ guidelines.
330
331 - Exception-Text:
332
333 All text after this tag is treated as the original exception text
334
335 File format examples::
336
337 SPDX-Exception-Identifier: Linux-syscall-note
338 SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html
339 SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+
340 Usage-Guidance:
341 This exception is used together with one of the above SPDX-Licenses
342 to mark user-space API (uapi) header files so they can be included
343 into non GPL compliant user-space application code.
344 To use this exception add it with the keyword WITH to one of the
345 identifiers in the SPDX-Licenses tag:
346 SPDX-License-Identifier: <SPDX-License> WITH Linux-syscall-note
347 Exception-Text:
348 Full exception text
349
350 ::
351
352 SPDX-Exception-Identifier: GCC-exception-2.0
353 SPDX-URL: https://spdx.org/licenses/GCC-exception-2.0.html
354 SPDX-Licenses: GPL-2.0, GPL-2.0+
355 Usage-Guidance:
356 The "GCC Runtime Library exception 2.0" is used together with one
357 of the above SPDX-Licenses for code imported from the GCC runtime
358 library.
359 To use this exception add it with the keyword WITH to one of the
360 identifiers in the SPDX-Licenses tag:
361 SPDX-License-Identifier: <SPDX-License> WITH GCC-exception-2.0
362 Exception-Text:
363 Full exception text
364
365
366All SPDX license identifiers and exceptions must have a corresponding file
367in the LICENSE subdirectories. This is required to allow tool
368verification (e.g. checkpatch.pl) and to have the licenses ready to read
369and extract right from the source, which is recommended by various FOSS
370organizations, e.g. the `FSFE REUSE initiative <https://reuse.software/>`_.
diff --git a/Documentation/process/submit-checklist.rst b/Documentation/process/submit-checklist.rst
index a0d9d34bfb6d..367353c54949 100644
--- a/Documentation/process/submit-checklist.rst
+++ b/Documentation/process/submit-checklist.rst
@@ -37,7 +37,9 @@ and elsewhere regarding submitting Linux kernel patches.
37 You should be able to justify all violations that remain in 37 You should be able to justify all violations that remain in
38 your patch. 38 your patch.
39 39
406) Any new or modified ``CONFIG`` options don't muck up the config menu. 406) Any new or modified ``CONFIG`` options do not muck up the config menu and
41 default to off unless they meet the exception criteria documented in
42 ``Documentation/kbuild/kconfig-language.txt`` Menu attributes: default value.
41 43
427) All new ``Kconfig`` options have help text. 447) All new ``Kconfig`` options have help text.
43 45
diff --git a/Documentation/security/credentials.rst b/Documentation/security/credentials.rst
index 66a2e24939d8..5bb7125faeee 100644
--- a/Documentation/security/credentials.rst
+++ b/Documentation/security/credentials.rst
@@ -451,6 +451,13 @@ checks and hooks done. Both the current and the proposed sets of credentials
451are available for this purpose as current_cred() will return the current set 451are available for this purpose as current_cred() will return the current set
452still at this point. 452still at this point.
453 453
454When replacing the group list, the new list must be sorted before it
455is added to the credential, as a binary search is used to test for
456membership. In practice, this means :c:func:`groups_sort` should be
457called before :c:func:`set_groups` or :c:func:`set_current_groups`.
458:c:func:`groups_sort)` must not be called on a ``struct group_list`` which
459is shared as it may permute elements as part of the sorting process
460even if the array is already sorted.
454 461
455When the credential set is ready, it should be committed to the current process 462When the credential set is ready, it should be committed to the current process
456by calling:: 463by calling::
diff --git a/Documentation/security/self-protection.rst b/Documentation/security/self-protection.rst
index 60c8bd8b77bf..0f53826c78b9 100644
--- a/Documentation/security/self-protection.rst
+++ b/Documentation/security/self-protection.rst
@@ -270,6 +270,21 @@ attacks, it is important to defend against exposure of both kernel memory
270addresses and kernel memory contents (since they may contain kernel 270addresses and kernel memory contents (since they may contain kernel
271addresses or other sensitive things like canary values). 271addresses or other sensitive things like canary values).
272 272
273Kernel addresses
274----------------
275
276Printing kernel addresses to userspace leaks sensitive information about
277the kernel memory layout. Care should be exercised when using any printk
278specifier that prints the raw address, currently %px, %p[ad], (and %p[sSb]
279in certain circumstances [*]). Any file written to using one of these
280specifiers should be readable only by privileged processes.
281
282Kernels 4.14 and older printed the raw address using %p. As of 4.15-rc1
283addresses printed with the specifier %p are hashed before printing.
284
285[*] If KALLSYMS is enabled and symbol lookup fails, the raw address is
286printed. If KALLSYMS is not enabled the raw address is printed.
287
273Unique identifiers 288Unique identifiers
274------------------ 289------------------
275 290
diff --git a/Documentation/sphinx/kfigure.py b/Documentation/sphinx/kfigure.py
index cef4ad19624c..b97228d2cc0e 100644
--- a/Documentation/sphinx/kfigure.py
+++ b/Documentation/sphinx/kfigure.py
@@ -81,7 +81,7 @@ __version__ = '1.0.0'
81# ------------- 81# -------------
82 82
83def which(cmd): 83def which(cmd):
84 """Searches the ``cmd`` in the ``PATH`` enviroment. 84 """Searches the ``cmd`` in the ``PATH`` environment.
85 85
86 This *which* searches the PATH for executable ``cmd`` . First match is 86 This *which* searches the PATH for executable ``cmd`` . First match is
87 returned, if nothing is found, ``None` is returned. 87 returned, if nothing is found, ``None` is returned.
@@ -419,7 +419,7 @@ def visit_kernel_render(self, node):
419 419
420 tmp_ext = RENDER_MARKUP_EXT.get(srclang, None) 420 tmp_ext = RENDER_MARKUP_EXT.get(srclang, None)
421 if tmp_ext is None: 421 if tmp_ext is None:
422 app.warn('kernel-render: "%s" unknow / include raw.' % (srclang)) 422 app.warn('kernel-render: "%s" unknown / include raw.' % (srclang))
423 return 423 return
424 424
425 if not dot_cmd and tmp_ext == '.dot': 425 if not dot_cmd and tmp_ext == '.dot':
@@ -482,7 +482,7 @@ class KernelRender(Figure):
482 srclang = self.arguments[0].strip() 482 srclang = self.arguments[0].strip()
483 if srclang not in RENDER_MARKUP_EXT.keys(): 483 if srclang not in RENDER_MARKUP_EXT.keys():
484 return [self.state_machine.reporter.warning( 484 return [self.state_machine.reporter.warning(
485 'Unknow source language "%s", use one of: %s.' % ( 485 'Unknown source language "%s", use one of: %s.' % (
486 srclang, ",".join(RENDER_MARKUP_EXT.keys())), 486 srclang, ",".join(RENDER_MARKUP_EXT.keys())),
487 line=self.lineno)] 487 line=self.lineno)]
488 488
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index 694968c7523c..412314eebda6 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -34,6 +34,7 @@ show up in /proc/sys/kernel:
34- hostname 34- hostname
35- hotplug 35- hotplug
36- hardlockup_all_cpu_backtrace 36- hardlockup_all_cpu_backtrace
37- hardlockup_panic
37- hung_task_panic 38- hung_task_panic
38- hung_task_check_count 39- hung_task_check_count
39- hung_task_timeout_secs 40- hung_task_timeout_secs
@@ -313,6 +314,19 @@ will be initiated.
3131: on detection capture more debug information. 3141: on detection capture more debug information.
314============================================================== 315==============================================================
315 316
317hardlockup_panic:
318
319This parameter can be used to control whether the kernel panics
320when a hard lockup is detected.
321
322 0 - don't panic on hard lockup
323 1 - panic on hard lockup
324
325See Documentation/lockup-watchdogs.txt for more information. This can
326also be set using the nmi_watchdog kernel parameter.
327
328==============================================================
329
316hotplug: 330hotplug:
317 331
318Path for the hotplug policy agent. 332Path for the hotplug policy agent.
@@ -377,7 +391,8 @@ kptr_restrict:
377This toggle indicates whether restrictions are placed on 391This toggle indicates whether restrictions are placed on
378exposing kernel addresses via /proc and other interfaces. 392exposing kernel addresses via /proc and other interfaces.
379 393
380When kptr_restrict is set to (0), the default, there are no restrictions. 394When kptr_restrict is set to 0 (the default) the address is hashed before
395printing. (This is the equivalent to %p.)
381 396
382When kptr_restrict is set to (1), kernel pointers printed using the %pK 397When kptr_restrict is set to (1), kernel pointers printed using the %pK
383format specifier will be replaced with 0's unless the user has CAP_SYSLOG 398format specifier will be replaced with 0's unless the user has CAP_SYSLOG
diff --git a/Documentation/trace/ftrace-uses.rst b/Documentation/trace/ftrace-uses.rst
index 8494a801d341..3aed560a12ee 100644
--- a/Documentation/trace/ftrace-uses.rst
+++ b/Documentation/trace/ftrace-uses.rst
@@ -42,9 +42,9 @@ as well as what protections the callback will perform and not require
42ftrace to handle. 42ftrace to handle.
43 43
44There is only one field that is needed to be set when registering 44There is only one field that is needed to be set when registering
45an ftrace_ops with ftrace:: 45an ftrace_ops with ftrace:
46 46
47.. code-block: c 47.. code-block:: c
48 48
49 struct ftrace_ops ops = { 49 struct ftrace_ops ops = {
50 .func = my_callback_func, 50 .func = my_callback_func,
@@ -81,12 +81,12 @@ may take some time to finish.
81The callback function 81The callback function
82===================== 82=====================
83 83
84The prototype of the callback function is as follows (as of v4.14):: 84The prototype of the callback function is as follows (as of v4.14):
85 85
86.. code-block: c 86.. code-block:: c
87 87
88 void callback_func(unsigned long ip, unsigned long parent_ip, 88 void callback_func(unsigned long ip, unsigned long parent_ip,
89 struct ftrace_ops *op, struct pt_regs *regs); 89 struct ftrace_ops *op, struct pt_regs *regs);
90 90
91@ip 91@ip
92 This is the instruction pointer of the function that is being traced. 92 This is the instruction pointer of the function that is being traced.
@@ -176,10 +176,10 @@ Filtering which functions to trace
176If a callback is only to be called from specific functions, a filter must be 176If a callback is only to be called from specific functions, a filter must be
177set up. The filters are added by name, or ip if it is known. 177set up. The filters are added by name, or ip if it is known.
178 178
179.. code-block: c 179.. code-block:: c
180 180
181 int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, 181 int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf,
182 int len, int reset); 182 int len, int reset);
183 183
184@ops 184@ops
185 The ops to set the filter with 185 The ops to set the filter with
@@ -202,9 +202,9 @@ See Filter Commands in :file:`Documentation/trace/ftrace.txt`.
202 202
203To just trace the schedule function:: 203To just trace the schedule function::
204 204
205.. code-block: c 205.. code-block:: c
206 206
207 ret = ftrace_set_filter(&ops, "schedule", strlen("schedule"), 0); 207 ret = ftrace_set_filter(&ops, "schedule", strlen("schedule"), 0);
208 208
209To add more functions, call the ftrace_set_filter() more than once with the 209To add more functions, call the ftrace_set_filter() more than once with the
210@reset parameter set to zero. To remove the current filter set and replace it 210@reset parameter set to zero. To remove the current filter set and replace it
@@ -212,17 +212,17 @@ with new functions defined by @buf, have @reset be non-zero.
212 212
213To remove all the filtered functions and trace all functions:: 213To remove all the filtered functions and trace all functions::
214 214
215.. code-block: c 215.. code-block:: c
216 216
217 ret = ftrace_set_filter(&ops, NULL, 0, 1); 217 ret = ftrace_set_filter(&ops, NULL, 0, 1);
218 218
219 219
220Sometimes more than one function has the same name. To trace just a specific 220Sometimes more than one function has the same name. To trace just a specific
221function in this case, ftrace_set_filter_ip() can be used. 221function in this case, ftrace_set_filter_ip() can be used.
222 222
223.. code-block: c 223.. code-block:: c
224 224
225 ret = ftrace_set_filter_ip(&ops, ip, 0, 0); 225 ret = ftrace_set_filter_ip(&ops, ip, 0, 0);
226 226
227Although the ip must be the address where the call to fentry or mcount is 227Although the ip must be the address where the call to fentry or mcount is
228located in the function. This function is used by perf and kprobes that 228located in the function. This function is used by perf and kprobes that
@@ -237,10 +237,10 @@ be called by any function.
237An empty "notrace" list means to allow all functions defined by the filter 237An empty "notrace" list means to allow all functions defined by the filter
238to be traced. 238to be traced.
239 239
240.. code-block: c 240.. code-block:: c
241 241
242 int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, 242 int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
243 int len, int reset); 243 int len, int reset);
244 244
245This takes the same parameters as ftrace_set_filter() but will add the 245This takes the same parameters as ftrace_set_filter() but will add the
246functions it finds to not be traced. This is a separate list from the 246functions it finds to not be traced. This is a separate list from the
@@ -251,7 +251,7 @@ that match @buf to it.
251 251
252Clearing the "notrace" list is the same as clearing the filter list 252Clearing the "notrace" list is the same as clearing the filter list
253 253
254.. code-block: c 254.. code-block:: c
255 255
256 ret = ftrace_set_notrace(&ops, NULL, 0, 1); 256 ret = ftrace_set_notrace(&ops, NULL, 0, 1);
257 257
@@ -264,29 +264,29 @@ If a filter is in place, and the @reset is non-zero, and @buf contains a
264matching glob to functions, the switch will happen during the time of 264matching glob to functions, the switch will happen during the time of
265the ftrace_set_filter() call. At no time will all functions call the callback. 265the ftrace_set_filter() call. At no time will all functions call the callback.
266 266
267.. code-block: c 267.. code-block:: c
268 268
269 ftrace_set_filter(&ops, "schedule", strlen("schedule"), 1); 269 ftrace_set_filter(&ops, "schedule", strlen("schedule"), 1);
270 270
271 register_ftrace_function(&ops); 271 register_ftrace_function(&ops);
272 272
273 msleep(10); 273 msleep(10);
274 274
275 ftrace_set_filter(&ops, "try_to_wake_up", strlen("try_to_wake_up"), 1); 275 ftrace_set_filter(&ops, "try_to_wake_up", strlen("try_to_wake_up"), 1);
276 276
277is not the same as: 277is not the same as:
278 278
279.. code-block: c 279.. code-block:: c
280 280
281 ftrace_set_filter(&ops, "schedule", strlen("schedule"), 1); 281 ftrace_set_filter(&ops, "schedule", strlen("schedule"), 1);
282 282
283 register_ftrace_function(&ops); 283 register_ftrace_function(&ops);
284 284
285 msleep(10); 285 msleep(10);
286 286
287 ftrace_set_filter(&ops, NULL, 0, 1); 287 ftrace_set_filter(&ops, NULL, 0, 1);
288 288
289 ftrace_set_filter(&ops, "try_to_wake_up", strlen("try_to_wake_up"), 0); 289 ftrace_set_filter(&ops, "try_to_wake_up", strlen("try_to_wake_up"), 0);
290 290
291As the latter will have a short time where all functions will call 291As the latter will have a short time where all functions will call
292the callback, between the time of the reset, and the time of the 292the callback, between the time of the reset, and the time of the
diff --git a/Documentation/usb/chipidea.txt b/Documentation/usb/chipidea.txt
index edf7cdfddc88..d1eedc01b00a 100644
--- a/Documentation/usb/chipidea.txt
+++ b/Documentation/usb/chipidea.txt
@@ -23,13 +23,13 @@ cat /sys/kernel/debug/ci_hdrc.0/registers
232) Connect 2 boards with usb cable with one end is micro A plug, the other end 232) Connect 2 boards with usb cable with one end is micro A plug, the other end
24 is micro B plug. 24 is micro B plug.
25 25
26 The A-device(with micro A plug inserted) should enumrate B-device. 26 The A-device(with micro A plug inserted) should enumerate B-device.
27 27
283) Role switch 283) Role switch
29 On B-device: 29 On B-device:
30 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req 30 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
31 31
32 B-device should take host role and enumrate A-device. 32 B-device should take host role and enumerate A-device.
33 33
344) A-device switch back to host. 344) A-device switch back to host.
35 On B-device: 35 On B-device:
@@ -40,13 +40,13 @@ cat /sys/kernel/debug/ci_hdrc.0/registers
40 side by answering the polling from B-Host, this can be done on A-device: 40 side by answering the polling from B-Host, this can be done on A-device:
41 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req 41 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
42 42
43 A-device should switch back to host and enumrate B-device. 43 A-device should switch back to host and enumerate B-device.
44 44
455) Remove B-device(unplug micro B plug) and insert again in 10 seconds, 455) Remove B-device(unplug micro B plug) and insert again in 10 seconds,
46 A-device should enumrate B-device again. 46 A-device should enumerate B-device again.
47 47
486) Remove B-device(unplug micro B plug) and insert again after 10 seconds, 486) Remove B-device(unplug micro B plug) and insert again after 10 seconds,
49 A-device should NOT enumrate B-device. 49 A-device should NOT enumerate B-device.
50 50
51 if A-device wants to use bus: 51 if A-device wants to use bus:
52 On A-device: 52 On A-device:
@@ -67,7 +67,7 @@ cat /sys/kernel/debug/ci_hdrc.0/registers
67 On B-device: 67 On B-device:
68 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req 68 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
69 69
70 A-device should resume usb bus and enumrate B-device. 70 A-device should resume usb bus and enumerate B-device.
71 71
721.3 Reference document 721.3 Reference document
73---------------------- 73----------------------
diff --git a/Documentation/vm/hwpoison.txt b/Documentation/vm/hwpoison.txt
index 6ae89a9edf2a..e912d7eee769 100644
--- a/Documentation/vm/hwpoison.txt
+++ b/Documentation/vm/hwpoison.txt
@@ -104,7 +104,7 @@ madvise(MADV_HWPOISON, ....)
104 104
105hwpoison-inject module through debugfs 105hwpoison-inject module through debugfs
106 106
107/sys/debug/hwpoison/ 107/sys/kernel/debug/hwpoison/
108 108
109corrupt-pfn 109corrupt-pfn
110 110
diff --git a/Documentation/w1/w1.generic b/Documentation/w1/w1.generic
index b3ffaf8cfab2..c51b1ab012d0 100644
--- a/Documentation/w1/w1.generic
+++ b/Documentation/w1/w1.generic
@@ -76,7 +76,7 @@ See struct w1_bus_master definition in w1.h for details.
76 76
77w1 master sysfs interface 77w1 master sysfs interface
78------------------------------------------------------------------ 78------------------------------------------------------------------
79<xx-xxxxxxxxxxxxx> - A directory for a found device. The format is family-serial 79<xx-xxxxxxxxxxxx> - A directory for a found device. The format is family-serial
80bus - (standard) symlink to the w1 bus 80bus - (standard) symlink to the w1 bus
81driver - (standard) symlink to the w1 driver 81driver - (standard) symlink to the w1 driver
82w1_master_add - (rw) manually register a slave device 82w1_master_add - (rw) manually register a slave device
diff --git a/LICENSES/exceptions/Linux-syscall-note b/LICENSES/exceptions/Linux-syscall-note
new file mode 100644
index 000000000000..6b60b61be4e9
--- /dev/null
+++ b/LICENSES/exceptions/Linux-syscall-note
@@ -0,0 +1,25 @@
1SPDX-Exception-Identifier: Linux-syscall-note
2SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html
3SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+
4Usage-Guide:
5 This exception is used together with one of the above SPDX-Licenses
6 to mark user space API (uapi) header files so they can be included
7 into non GPL compliant user space application code.
8 To use this exception add it with the keyword WITH to one of the
9 identifiers in the SPDX-Licenses tag:
10 SPDX-License-Identifier: <SPDX-License> WITH Linux-syscall-note
11License-Text:
12
13 NOTE! This copyright does *not* cover user programs that use kernel
14 services by normal system calls - this is merely considered normal use
15 of the kernel, and does *not* fall under the heading of "derived work".
16 Also note that the GPL below is copyrighted by the Free Software
17 Foundation, but the instance of code that it refers to (the Linux
18 kernel) is copyrighted by me and others who actually wrote it.
19
20 Also note that the only valid version of the GPL as far as the kernel
21 is concerned is _this_ particular version of the license (ie v2, not
22 v2.2 or v3.x or whatever), unless explicitly otherwise stated.
23
24 Linus Torvalds
25
diff --git a/LICENSES/other/GPL-1.0 b/LICENSES/other/GPL-1.0
new file mode 100644
index 000000000000..3a4fa969e4c2
--- /dev/null
+++ b/LICENSES/other/GPL-1.0
@@ -0,0 +1,260 @@
1Valid-License-Identifier: GPL-1.0+
2SPDX-URL: https://spdx.org/licenses/GPL-1.0.html
3Usage-Guide:
4 The GNU General Public License (GPL) version 1 should not be used in new
5 code. For existing kernel code the 'or any later version' option is
6 required to be compatible with the general license of the project: GPLv2.
7 To use the license in source code, put the following SPDX tag/value pair
8 into a comment according to the placement guidelines in the licensing
9 rules documentation:
10 SPDX-License-Identifier: GPL-1.0+
11License-Text:
12
13 GNU GENERAL PUBLIC LICENSE
14 Version 1, February 1989
15
16 Copyright (C) 1989 Free Software Foundation, Inc.
17 675 Mass Ave, Cambridge, MA 02139, USA
18 Everyone is permitted to copy and distribute verbatim copies
19 of this license document, but changing it is not allowed.
20
21 Preamble
22
23 The license agreements of most software companies try to keep users
24at the mercy of those companies. By contrast, our General Public
25License is intended to guarantee your freedom to share and change free
26software--to make sure the software is free for all its users. The
27General Public License applies to the Free Software Foundation's
28software and to any other program whose authors commit to using it.
29You can use it for your programs, too.
30
31 When we speak of free software, we are referring to freedom, not
32price. Specifically, the General Public License is designed to make
33sure that you have the freedom to give away or sell copies of free
34software, that you receive source code or can get it if you want it,
35that you can change the software or use pieces of it in new free
36programs; and that you know you can do these things.
37
38 To protect your rights, we need to make restrictions that forbid
39anyone to deny you these rights or to ask you to surrender the rights.
40These restrictions translate to certain responsibilities for you if you
41distribute copies of the software, or if you modify it.
42
43 For example, if you distribute copies of a such a program, whether
44gratis or for a fee, you must give the recipients all the rights that
45you have. You must make sure that they, too, receive or can get the
46source code. And you must tell them their rights.
47
48 We protect your rights with two steps: (1) copyright the software, and
49(2) offer you this license which gives you legal permission to copy,
50distribute and/or modify the software.
51
52 Also, for each author's protection and ours, we want to make certain
53that everyone understands that there is no warranty for this free
54software. If the software is modified by someone else and passed on, we
55want its recipients to know that what they have is not the original, so
56that any problems introduced by others will not reflect on the original
57authors' reputations.
58
59 The precise terms and conditions for copying, distribution and
60modification follow.
61
62 GNU GENERAL PUBLIC LICENSE
63 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
64
65 0. This License Agreement applies to any program or other work which
66contains a notice placed by the copyright holder saying it may be
67distributed under the terms of this General Public License. The
68"Program", below, refers to any such program or work, and a "work based
69on the Program" means either the Program or any work containing the
70Program or a portion of it, either verbatim or with modifications. Each
71licensee is addressed as "you".
72
73 1. You may copy and distribute verbatim copies of the Program's source
74code as you receive it, in any medium, provided that you conspicuously and
75appropriately publish on each copy an appropriate copyright notice and
76disclaimer of warranty; keep intact all the notices that refer to this
77General Public License and to the absence of any warranty; and give any
78other recipients of the Program a copy of this General Public License
79along with the Program. You may charge a fee for the physical act of
80transferring a copy.
81
82 2. You may modify your copy or copies of the Program or any portion of
83it, and copy and distribute such modifications under the terms of Paragraph
841 above, provided that you also do the following:
85
86 a) cause the modified files to carry prominent notices stating that
87 you changed the files and the date of any change; and
88
89 b) cause the whole of any work that you distribute or publish, that
90 in whole or in part contains the Program or any part thereof, either
91 with or without modifications, to be licensed at no charge to all
92 third parties under the terms of this General Public License (except
93 that you may choose to grant warranty protection to some or all
94 third parties, at your option).
95
96 c) If the modified program normally reads commands interactively when
97 run, you must cause it, when started running for such interactive use
98 in the simplest and most usual way, to print or display an
99 announcement including an appropriate copyright notice and a notice
100 that there is no warranty (or else, saying that you provide a
101 warranty) and that users may redistribute the program under these
102 conditions, and telling the user how to view a copy of this General
103 Public License.
104
105 d) You may charge a fee for the physical act of transferring a
106 copy, and you may at your option offer warranty protection in
107 exchange for a fee.
108
109Mere aggregation of another independent work with the Program (or its
110derivative) on a volume of a storage or distribution medium does not bring
111the other work under the scope of these terms.
112
113 3. You may copy and distribute the Program (or a portion or derivative of
114it, under Paragraph 2) in object code or executable form under the terms of
115Paragraphs 1 and 2 above provided that you also do one of the following:
116
117 a) accompany it with the complete corresponding machine-readable
118 source code, which must be distributed under the terms of
119 Paragraphs 1 and 2 above; or,
120
121 b) accompany it with a written offer, valid for at least three
122 years, to give any third party free (except for a nominal charge
123 for the cost of distribution) a complete machine-readable copy of the
124 corresponding source code, to be distributed under the terms of
125 Paragraphs 1 and 2 above; or,
126
127 c) accompany it with the information you received as to where the
128 corresponding source code may be obtained. (This alternative is
129 allowed only for noncommercial distribution and only if you
130 received the program in object code or executable form alone.)
131
132Source code for a work means the preferred form of the work for making
133modifications to it. For an executable file, complete source code means
134all the source code for all modules it contains; but, as a special
135exception, it need not include source code for modules which are standard
136libraries that accompany the operating system on which the executable
137file runs, or for standard header files or definitions files that
138accompany that operating system.
139
140 4. You may not copy, modify, sublicense, distribute or transfer the
141Program except as expressly provided under this General Public License.
142Any attempt otherwise to copy, modify, sublicense, distribute or transfer
143the Program is void, and will automatically terminate your rights to use
144the Program under this License. However, parties who have received
145copies, or rights to use copies, from you under this General Public
146License will not have their licenses terminated so long as such parties
147remain in full compliance.
148
149 5. By copying, distributing or modifying the Program (or any work based
150on the Program) you indicate your acceptance of this license to do so,
151and all its terms and conditions.
152
153 6. Each time you redistribute the Program (or any work based on the
154Program), the recipient automatically receives a license from the original
155licensor to copy, distribute or modify the Program subject to these
156terms and conditions. You may not impose any further restrictions on the
157recipients' exercise of the rights granted herein.
158
159 7. The Free Software Foundation may publish revised and/or new versions
160of the General Public License from time to time. Such new versions will
161be similar in spirit to the present version, but may differ in detail to
162address new problems or concerns.
163
164Each version is given a distinguishing version number. If the Program
165specifies a version number of the license which applies to it and "any
166later version", you have the option of following the terms and conditions
167either of that version or of any later version published by the Free
168Software Foundation. If the Program does not specify a version number of
169the license, you may choose any version ever published by the Free Software
170Foundation.
171
172 8. If you wish to incorporate parts of the Program into other free
173programs whose distribution conditions are different, write to the author
174to ask for permission. For software which is copyrighted by the Free
175Software Foundation, write to the Free Software Foundation; we sometimes
176make exceptions for this. Our decision will be guided by the two goals
177of preserving the free status of all derivatives of our free software and
178of promoting the sharing and reuse of software generally.
179
180 NO WARRANTY
181
182 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
183FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
184OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
185PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
186OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
187MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
188TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
189PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
190REPAIR OR CORRECTION.
191
192 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
193WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
194REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
195INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
196OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
197TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
198YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
199PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
200POSSIBILITY OF SUCH DAMAGES.
201
202 END OF TERMS AND CONDITIONS
203
204 Appendix: How to Apply These Terms to Your New Programs
205
206 If you develop a new program, and you want it to be of the greatest
207possible use to humanity, the best way to achieve this is to make it
208free software which everyone can redistribute and change under these
209terms.
210
211 To do so, attach the following notices to the program. It is safest to
212attach them to the start of each source file to most effectively convey
213the exclusion of warranty; and each file should have at least the
214"copyright" line and a pointer to where the full notice is found.
215
216 <one line to give the program's name and a brief idea of what it does.>
217 Copyright (C) 19yy <name of author>
218
219 This program is free software; you can redistribute it and/or modify
220 it under the terms of the GNU General Public License as published by
221 the Free Software Foundation; either version 1, or (at your option)
222 any later version.
223
224 This program is distributed in the hope that it will be useful,
225 but WITHOUT ANY WARRANTY; without even the implied warranty of
226 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
227 GNU General Public License for more details.
228
229 You should have received a copy of the GNU General Public License
230 along with this program; if not, write to the Free Software
231 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
232
233Also add information on how to contact you by electronic and paper mail.
234
235If the program is interactive, make it output a short notice like this
236when it starts in an interactive mode:
237
238 Gnomovision version 69, Copyright (C) 19xx name of author
239 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
240 This is free software, and you are welcome to redistribute it
241 under certain conditions; type `show c' for details.
242
243The hypothetical commands `show w' and `show c' should show the
244appropriate parts of the General Public License. Of course, the
245commands you use may be called something other than `show w' and `show
246c'; they could even be mouse-clicks or menu items--whatever suits your
247program.
248
249You should also get your employer (if you work as a programmer) or your
250school, if any, to sign a "copyright disclaimer" for the program, if
251necessary. Here a sample; alter the names:
252
253 Yoyodyne, Inc., hereby disclaims all copyright interest in the
254 program `Gnomovision' (a program to direct compilers to make passes
255 at assemblers) written by James Hacker.
256
257 <signature of Ty Coon>, 1 April 1989
258 Ty Coon, President of Vice
259
260That's all there is to it!
diff --git a/LICENSES/other/MPL-1.1 b/LICENSES/other/MPL-1.1
new file mode 100644
index 000000000000..568b6049efe6
--- /dev/null
+++ b/LICENSES/other/MPL-1.1
@@ -0,0 +1,478 @@
1Valid-License-Identifier: MPL-1.1
2SPDX-URL: https://spdx.org/licenses/MPL-1.1.html
3Usage-Guide:
4 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
6 the licensing rules documentation:
7 SPDX-License-Identifier: MPL-1.1
8License-Text:
9
10 MOZILLA PUBLIC LICENSE
11 Version 1.1
12
13 ---------------
14
151. Definitions.
16
17 1.0.1. "Commercial Use" means distribution or otherwise making the
18 Covered Code available to a third party.
19
20 1.1. "Contributor" means each entity that creates or contributes to
21 the creation of Modifications.
22
23 1.2. "Contributor Version" means the combination of the Original
24 Code, prior Modifications used by a Contributor, and the Modifications
25 made by that particular Contributor.
26
27 1.3. "Covered Code" means the Original Code or Modifications or the
28 combination of the Original Code and Modifications, in each case
29 including portions thereof.
30
31 1.4. "Electronic Distribution Mechanism" means a mechanism generally
32 accepted in the software development community for the electronic
33 transfer of data.
34
35 1.5. "Executable" means Covered Code in any form other than Source
36 Code.
37
38 1.6. "Initial Developer" means the individual or entity identified
39 as the Initial Developer in the Source Code notice required by Exhibit
40 A.
41
42 1.7. "Larger Work" means a work which combines Covered Code or
43 portions thereof with code not governed by the terms of this License.
44
45 1.8. "License" means this document.
46
47 1.8.1. "Licensable" means having the right to grant, to the maximum
48 extent possible, whether at the time of the initial grant or
49 subsequently acquired, any and all of the rights conveyed herein.
50
51 1.9. "Modifications" means any addition to or deletion from the
52 substance or structure of either the Original Code or any previous
53 Modifications. When Covered Code is released as a series of files, a
54 Modification is:
55 A. Any addition to or deletion from the contents of a file
56 containing Original Code or previous Modifications.
57
58 B. Any new file that contains any part of the Original Code or
59 previous Modifications.
60
61 1.10. "Original Code" means Source Code of computer software code
62 which is described in the Source Code notice required by Exhibit A as
63 Original Code, and which, at the time of its release under this
64 License is not already Covered Code governed by this License.
65
66 1.10.1. "Patent Claims" means any patent claim(s), now owned or
67 hereafter acquired, including without limitation, method, process,
68 and apparatus claims, in any patent Licensable by grantor.
69
70 1.11. "Source Code" means the preferred form of the Covered Code for
71 making modifications to it, including all modules it contains, plus
72 any associated interface definition files, scripts used to control
73 compilation and installation of an Executable, or source code
74 differential comparisons against either the Original Code or another
75 well known, available Covered Code of the Contributor's choice. The
76 Source Code can be in a compressed or archival form, provided the
77 appropriate decompression or de-archiving software is widely available
78 for no charge.
79
80 1.12. "You" (or "Your") means an individual or a legal entity
81 exercising rights under, and complying with all of the terms of, this
82 License or a future version of this License issued under Section 6.1.
83 For legal entities, "You" includes any entity which controls, is
84 controlled by, or is under common control with You. For purposes of
85 this definition, "control" means (a) the power, direct or indirect,
86 to cause the direction or management of such entity, whether by
87 contract or otherwise, or (b) ownership of more than fifty percent
88 (50%) of the outstanding shares or beneficial ownership of such
89 entity.
90
912. Source Code License.
92
93 2.1. The Initial Developer Grant.
94 The Initial Developer hereby grants You a world-wide, royalty-free,
95 non-exclusive license, subject to third party intellectual property
96 claims:
97 (a) under intellectual property rights (other than patent or
98 trademark) Licensable by Initial Developer to use, reproduce,
99 modify, display, perform, sublicense and distribute the Original
100 Code (or portions thereof) with or without Modifications, and/or
101 as part of a Larger Work; and
102
103 (b) under Patents Claims infringed by the making, using or
104 selling of Original Code, to make, have made, use, practice,
105 sell, and offer for sale, and/or otherwise dispose of the
106 Original Code (or portions thereof).
107
108 (c) the licenses granted in this Section 2.1(a) and (b) are
109 effective on the date Initial Developer first distributes
110 Original Code under the terms of this License.
111
112 (d) Notwithstanding Section 2.1(b) above, no patent license is
113 granted: 1) for code that You delete from the Original Code; 2)
114 separate from the Original Code; or 3) for infringements caused
115 by: i) the modification of the Original Code or ii) the
116 combination of the Original Code with other software or devices.
117
118 2.2. Contributor Grant.
119 Subject to third party intellectual property claims, each Contributor
120 hereby grants You a world-wide, royalty-free, non-exclusive license
121
122 (a) under intellectual property rights (other than patent or
123 trademark) Licensable by Contributor, to use, reproduce, modify,
124 display, perform, sublicense and distribute the Modifications
125 created by such Contributor (or portions thereof) either on an
126 unmodified basis, with other Modifications, as Covered Code
127 and/or as part of a Larger Work; and
128
129 (b) under Patent Claims infringed by the making, using, or
130 selling of Modifications made by that Contributor either alone
131 and/or in combination with its Contributor Version (or portions
132 of such combination), to make, use, sell, offer for sale, have
133 made, and/or otherwise dispose of: 1) Modifications made by that
134 Contributor (or portions thereof); and 2) the combination of
135 Modifications made by that Contributor with its Contributor
136 Version (or portions of such combination).
137
138 (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
139 effective on the date Contributor first makes Commercial Use of
140 the Covered Code.
141
142 (d) Notwithstanding Section 2.2(b) above, no patent license is
143 granted: 1) for any code that Contributor has deleted from the
144 Contributor Version; 2) separate from the Contributor Version;
145 3) for infringements caused by: i) third party modifications of
146 Contributor Version or ii) the combination of Modifications made
147 by that Contributor with other software (except as part of the
148 Contributor Version) or other devices; or 4) under Patent Claims
149 infringed by Covered Code in the absence of Modifications made by
150 that Contributor.
151
1523. Distribution Obligations.
153
154 3.1. Application of License.
155 The Modifications which You create or to which You contribute are
156 governed by the terms of this License, including without limitation
157 Section 2.2. The Source Code version of Covered Code may be
158 distributed only under the terms of this License or a future version
159 of this License released under Section 6.1, and You must include a
160 copy of this License with every copy of the Source Code You
161 distribute. You may not offer or impose any terms on any Source Code
162 version that alters or restricts the applicable version of this
163 License or the recipients' rights hereunder. However, You may include
164 an additional document offering the additional rights described in
165 Section 3.5.
166
167 3.2. Availability of Source Code.
168 Any Modification which You create or to which You contribute must be
169 made available in Source Code form under the terms of this License
170 either on the same media as an Executable version or via an accepted
171 Electronic Distribution Mechanism to anyone to whom you made an
172 Executable version available; and if made available via Electronic
173 Distribution Mechanism, must remain available for at least twelve (12)
174 months after the date it initially became available, or at least six
175 (6) months after a subsequent version of that particular Modification
176 has been made available to such recipients. You are responsible for
177 ensuring that the Source Code version remains available even if the
178 Electronic Distribution Mechanism is maintained by a third party.
179
180 3.3. Description of Modifications.
181 You must cause all Covered Code to which You contribute to contain a
182 file documenting the changes You made to create that Covered Code and
183 the date of any change. You must include a prominent statement that
184 the Modification is derived, directly or indirectly, from Original
185 Code provided by the Initial Developer and including the name of the
186 Initial Developer in (a) the Source Code, and (b) in any notice in an
187 Executable version or related documentation in which You describe the
188 origin or ownership of the Covered Code.
189
190 3.4. Intellectual Property Matters
191 (a) Third Party Claims.
192 If Contributor has knowledge that a license under a third party's
193 intellectual property rights is required to exercise the rights
194 granted by such Contributor under Sections 2.1 or 2.2,
195 Contributor must include a text file with the Source Code
196 distribution titled "LEGAL" which describes the claim and the
197 party making the claim in sufficient detail that a recipient will
198 know whom to contact. If Contributor obtains such knowledge after
199 the Modification is made available as described in Section 3.2,
200 Contributor shall promptly modify the LEGAL file in all copies
201 Contributor makes available thereafter and shall take other steps
202 (such as notifying appropriate mailing lists or newsgroups)
203 reasonably calculated to inform those who received the Covered
204 Code that new knowledge has been obtained.
205
206 (b) Contributor APIs.
207 If Contributor's Modifications include an application programming
208 interface and Contributor has knowledge of patent licenses which
209 are reasonably necessary to implement that API, Contributor must
210 also include this information in the LEGAL file.
211
212 (c) Representations.
213 Contributor represents that, except as disclosed pursuant to
214 Section 3.4(a) above, Contributor believes that Contributor's
215 Modifications are Contributor's original creation(s) and/or
216 Contributor has sufficient rights to grant the rights conveyed by
217 this License.
218
219 3.5. Required Notices.
220 You must duplicate the notice in Exhibit A in each file of the Source
221 Code. If it is not possible to put such notice in a particular Source
222 Code file due to its structure, then You must include such notice in a
223 location (such as a relevant directory) where a user would be likely
224 to look for such a notice. If You created one or more Modification(s)
225 You may add your name as a Contributor to the notice described in
226 Exhibit A. You must also duplicate this License in any documentation
227 for the Source Code where You describe recipients' rights or ownership
228 rights relating to Covered Code. You may choose to offer, and to
229 charge a fee for, warranty, support, indemnity or liability
230 obligations to one or more recipients of Covered Code. However, You
231 may do so only on Your own behalf, and not on behalf of the Initial
232 Developer or any Contributor. You must make it absolutely clear than
233 any such warranty, support, indemnity or liability obligation is
234 offered by You alone, and You hereby agree to indemnify the Initial
235 Developer and every Contributor for any liability incurred by the
236 Initial Developer or such Contributor as a result of warranty,
237 support, indemnity or liability terms You offer.
238
239 3.6. Distribution of Executable Versions.
240 You may distribute Covered Code in Executable form only if the
241 requirements of Section 3.1-3.5 have been met for that Covered Code,
242 and if You include a notice stating that the Source Code version of
243 the Covered Code is available under the terms of this License,
244 including a description of how and where You have fulfilled the
245 obligations of Section 3.2. The notice must be conspicuously included
246 in any notice in an Executable version, related documentation or
247 collateral in which You describe recipients' rights relating to the
248 Covered Code. You may distribute the Executable version of Covered
249 Code or ownership rights under a license of Your choice, which may
250 contain terms different from this License, provided that You are in
251 compliance with the terms of this License and that the license for the
252 Executable version does not attempt to limit or alter the recipient's
253 rights in the Source Code version from the rights set forth in this
254 License. If You distribute the Executable version under a different
255 license You must make it absolutely clear that any terms which differ
256 from this License are offered by You alone, not by the Initial
257 Developer or any Contributor. You hereby agree to indemnify the
258 Initial Developer and every Contributor for any liability incurred by
259 the Initial Developer or such Contributor as a result of any such
260 terms You offer.
261
262 3.7. Larger Works.
263 You may create a Larger Work by combining Covered Code with other code
264 not governed by the terms of this License and distribute the Larger
265 Work as a single product. In such a case, You must make sure the
266 requirements of this License are fulfilled for the Covered Code.
267
2684. Inability to Comply Due to Statute or Regulation.
269
270 If it is impossible for You to comply with any of the terms of this
271 License with respect to some or all of the Covered Code due to
272 statute, judicial order, or regulation then You must: (a) comply with
273 the terms of this License to the maximum extent possible; and (b)
274 describe the limitations and the code they affect. Such description
275 must be included in the LEGAL file described in Section 3.4 and must
276 be included with all distributions of the Source Code. Except to the
277 extent prohibited by statute or regulation, such description must be
278 sufficiently detailed for a recipient of ordinary skill to be able to
279 understand it.
280
2815. Application of this License.
282
283 This License applies to code to which the Initial Developer has
284 attached the notice in Exhibit A and to related Covered Code.
285
2866. Versions of the License.
287
288 6.1. New Versions.
289 Netscape Communications Corporation ("Netscape") may publish revised
290 and/or new versions of the License from time to time. Each version
291 will be given a distinguishing version number.
292
293 6.2. Effect of New Versions.
294 Once Covered Code has been published under a particular version of the
295 License, You may always continue to use it under the terms of that
296 version. You may also choose to use such Covered Code under the terms
297 of any subsequent version of the License published by Netscape. No one
298 other than Netscape has the right to modify the terms applicable to
299 Covered Code created under this License.
300
301 6.3. Derivative Works.
302 If You create or use a modified version of this License (which you may
303 only do in order to apply it to code which is not already Covered Code
304 governed by this License), You must (a) rename Your license so that
305 the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
306 "MPL", "NPL" or any confusingly similar phrase do not appear in your
307 license (except to note that your license differs from this License)
308 and (b) otherwise make it clear that Your version of the license
309 contains terms which differ from the Mozilla Public License and
310 Netscape Public License. (Filling in the name of the Initial
311 Developer, Original Code or Contributor in the notice described in
312 Exhibit A shall not of themselves be deemed to be modifications of
313 this License.)
314
3157. DISCLAIMER OF WARRANTY.
316
317 COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
318 WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
319 WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
320 DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
321 THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
322 IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
323 YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
324 COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
325 OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
326 ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
327
3288. TERMINATION.
329
330 8.1. This License and the rights granted hereunder will terminate
331 automatically if You fail to comply with terms herein and fail to cure
332 such breach within 30 days of becoming aware of the breach. All
333 sublicenses to the Covered Code which are properly granted shall
334 survive any termination of this License. Provisions which, by their
335 nature, must remain in effect beyond the termination of this License
336 shall survive.
337
338 8.2. If You initiate litigation by asserting a patent infringement
339 claim (excluding declatory judgment actions) against Initial Developer
340 or a Contributor (the Initial Developer or Contributor against whom
341 You file such action is referred to as "Participant") alleging that:
342
343 (a) such Participant's Contributor Version directly or indirectly
344 infringes any patent, then any and all rights granted by such
345 Participant to You under Sections 2.1 and/or 2.2 of this License
346 shall, upon 60 days notice from Participant terminate prospectively,
347 unless if within 60 days after receipt of notice You either: (i)
348 agree in writing to pay Participant a mutually agreeable reasonable
349 royalty for Your past and future use of Modifications made by such
350 Participant, or (ii) withdraw Your litigation claim with respect to
351 the Contributor Version against such Participant. If within 60 days
352 of notice, a reasonable royalty and payment arrangement are not
353 mutually agreed upon in writing by the parties or the litigation claim
354 is not withdrawn, the rights granted by Participant to You under
355 Sections 2.1 and/or 2.2 automatically terminate at the expiration of
356 the 60 day notice period specified above.
357
358 (b) any software, hardware, or device, other than such Participant's
359 Contributor Version, directly or indirectly infringes any patent, then
360 any rights granted to You by such Participant under Sections 2.1(b)
361 and 2.2(b) are revoked effective as of the date You first made, used,
362 sold, distributed, or had made, Modifications made by that
363 Participant.
364
365 8.3. If You assert a patent infringement claim against Participant
366 alleging that such Participant's Contributor Version directly or
367 indirectly infringes any patent where such claim is resolved (such as
368 by license or settlement) prior to the initiation of patent
369 infringement litigation, then the reasonable value of the licenses
370 granted by such Participant under Sections 2.1 or 2.2 shall be taken
371 into account in determining the amount or value of any payment or
372 license.
373
374 8.4. In the event of termination under Sections 8.1 or 8.2 above,
375 all end user license agreements (excluding distributors and resellers)
376 which have been validly granted by You or any distributor hereunder
377 prior to termination shall survive termination.
378
3799. LIMITATION OF LIABILITY.
380
381 UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
382 (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
383 DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
384 OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
385 ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
386 CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
387 WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
388 COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
389 INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
390 LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
391 RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
392 PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
393 EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
394 THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
395
39610. U.S. GOVERNMENT END USERS.
397
398 The Covered Code is a "commercial item," as that term is defined in
399 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
400 software" and "commercial computer software documentation," as such
401 terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
402 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
403 all U.S. Government End Users acquire Covered Code with only those
404 rights set forth herein.
405
40611. MISCELLANEOUS.
407
408 This License represents the complete agreement concerning subject
409 matter hereof. If any provision of this License is held to be
410 unenforceable, such provision shall be reformed only to the extent
411 necessary to make it enforceable. This License shall be governed by
412 California law provisions (except to the extent applicable law, if
413 any, provides otherwise), excluding its conflict-of-law provisions.
414 With respect to disputes in which at least one party is a citizen of,
415 or an entity chartered or registered to do business in the United
416 States of America, any litigation relating to this License shall be
417 subject to the jurisdiction of the Federal Courts of the Northern
418 District of California, with venue lying in Santa Clara County,
419 California, with the losing party responsible for costs, including
420 without limitation, court costs and reasonable attorneys' fees and
421 expenses. The application of the United Nations Convention on
422 Contracts for the International Sale of Goods is expressly excluded.
423 Any law or regulation which provides that the language of a contract
424 shall be construed against the drafter shall not apply to this
425 License.
426
42712. RESPONSIBILITY FOR CLAIMS.
428
429 As between Initial Developer and the Contributors, each party is
430 responsible for claims and damages arising, directly or indirectly,
431 out of its utilization of rights under this License and You agree to
432 work with Initial Developer and Contributors to distribute such
433 responsibility on an equitable basis. Nothing herein is intended or
434 shall be deemed to constitute any admission of liability.
435
43613. MULTIPLE-LICENSED CODE.
437
438 Initial Developer may designate portions of the Covered Code as
439 "Multiple-Licensed". "Multiple-Licensed" means that the Initial
440 Developer permits you to utilize portions of the Covered Code under
441 Your choice of the MPL or the alternative licenses, if any, specified
442 by the Initial Developer in the file described in Exhibit A.
443
444EXHIBIT A -Mozilla Public License.
445
446 ``The contents of this file are subject to the Mozilla Public License
447 Version 1.1 (the "License"); you may not use this file except in
448 compliance with the License. You may obtain a copy of the License at
449 https://www.mozilla.org/MPL/
450
451 Software distributed under the License is distributed on an "AS IS"
452 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
453 License for the specific language governing rights and limitations
454 under the License.
455
456 The Original Code is ______________________________________.
457
458 The Initial Developer of the Original Code is ________________________.
459 Portions created by ______________________ are Copyright (C) ______
460 _______________________. All Rights Reserved.
461
462 Contributor(s): ______________________________________.
463
464 Alternatively, the contents of this file may be used under the terms
465 of the _____ license (the "[___] License"), in which case the
466 provisions of [______] License are applicable instead of those
467 above. If you wish to allow use of your version of this file only
468 under the terms of the [____] License and not to allow others to use
469 your version of this file under the MPL, indicate your decision by
470 deleting the provisions above and replace them with the notice and
471 other provisions required by the [___] License. If you do not delete
472 the provisions above, a recipient may use your version of this file
473 under either the MPL or the [___] License."
474
475 [NOTE: The text of this Exhibit A may differ slightly from the text of
476 the notices in the Source Code files of the Original Code. You should
477 use the text of this Exhibit A rather than the text found in the
478 Original Code Source Code for Your Modifications.]
diff --git a/LICENSES/preferred/BSD-2-Clause b/LICENSES/preferred/BSD-2-Clause
new file mode 100644
index 000000000000..da366e2ce50b
--- /dev/null
+++ b/LICENSES/preferred/BSD-2-Clause
@@ -0,0 +1,32 @@
1Valid-License-Identifier: BSD-2-Clause
2SPDX-URL: https://spdx.org/licenses/BSD-2-Clause.html
3Usage-Guide:
4 To use the BSD 2-clause "Simplified" License put the following SPDX
5 tag/value pair into a comment according to the placement guidelines in
6 the licensing rules documentation:
7 SPDX-License-Identifier: BSD-2-Clause
8License-Text:
9
10Copyright (c) <year> <owner> . All rights reserved.
11
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14
151. Redistributions of source code must retain the above copyright notice,
16 this list of conditions and the following disclaimer.
17
182. Redistributions in binary form must reproduce the above copyright
19 notice, this list of conditions and the following disclaimer in the
20 documentation and/or other materials provided with the distribution.
21
22THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENSES/preferred/BSD-3-Clause b/LICENSES/preferred/BSD-3-Clause
new file mode 100644
index 000000000000..34c7f057c8d5
--- /dev/null
+++ b/LICENSES/preferred/BSD-3-Clause
@@ -0,0 +1,36 @@
1Valid-License-Identifier: BSD-3-Clause
2SPDX-URL: https://spdx.org/licenses/BSD-3-Clause.html
3Usage-Guide:
4 To use the BSD 3-clause "New" or "Revised" License put the following SPDX
5 tag/value pair into a comment according to the placement guidelines in
6 the licensing rules documentation:
7 SPDX-License-Identifier: BSD-3-Clause
8License-Text:
9
10Copyright (c) <year> <owner> . All rights reserved.
11
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14
151. Redistributions of source code must retain the above copyright notice,
16 this list of conditions and the following disclaimer.
17
182. Redistributions in binary form must reproduce the above copyright
19 notice, this list of conditions and the following disclaimer in the
20 documentation and/or other materials provided with the distribution.
21
223. Neither the name of the copyright holder nor the names of its
23 contributors may be used to endorse or promote products derived from this
24 software without specific prior written permission.
25
26THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENSES/preferred/BSD-3-Clause-Clear b/LICENSES/preferred/BSD-3-Clause-Clear
new file mode 100644
index 000000000000..e53b56092b90
--- /dev/null
+++ b/LICENSES/preferred/BSD-3-Clause-Clear
@@ -0,0 +1,41 @@
1Valid-License-Identifier: BSD-3-Clause-Clear
2SPDX-URL: https://spdx.org/licenses/BSD-3-Clause-Clear.html
3Usage-Guide:
4 To use the BSD 3-clause "Clear" License put the following SPDX
5 tag/value pair into a comment according to the placement guidelines in
6 the licensing rules documentation:
7 SPDX-License-Identifier: BSD-3-Clause-Clear
8License-Text:
9
10The Clear BSD License
11
12Copyright (c) [xxxx]-[xxxx] [Owner Organization]
13All rights reserved.
14
15Redistribution and use in source and binary forms, with or without
16modification, are permitted (subject to the limitations in the disclaimer
17below) provided that the following conditions are met:
18
19 * Redistributions of source code must retain the above copyright notice,
20 this list of conditions and the following disclaimer.
21
22 * Redistributions in binary form must reproduce the above copyright
23 notice, this list of conditions and the following disclaimer in the
24 documentation and/or other materials provided with the distribution.
25
26 * Neither the name of [Owner Organization] nor the names of its
27 contributors may be used to endorse or promote products derived from
28 this software without specific prior written permission.
29
30NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
31THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
32CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
33NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
34PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
35OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
36EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
37PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
38OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
40OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
41ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENSES/preferred/GPL-2.0 b/LICENSES/preferred/GPL-2.0
new file mode 100644
index 000000000000..b8db91d3a1cb
--- /dev/null
+++ b/LICENSES/preferred/GPL-2.0
@@ -0,0 +1,353 @@
1Valid-License-Identifier: GPL-2.0
2Valid-License-Identifier: GPL-2.0+
3SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
4Usage-Guide:
5 To use this license in source code, put one of the following SPDX
6 tag/value pairs into a comment according to the placement
7 guidelines in the licensing rules documentation.
8 For 'GNU General Public License (GPL) version 2 only' use:
9 SPDX-License-Identifier: GPL-2.0
10 For 'GNU General Public License (GPL) version 2 or any later version' use:
11 SPDX-License-Identifier: GPL-2.0+
12License-Text:
13
14 GNU GENERAL PUBLIC LICENSE
15 Version 2, June 1991
16
17 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
18 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 Everyone is permitted to copy and distribute verbatim copies
20 of this license document, but changing it is not allowed.
21
22 Preamble
23
24 The licenses for most software are designed to take away your
25freedom to share and change it. By contrast, the GNU General Public
26License is intended to guarantee your freedom to share and change free
27software--to make sure the software is free for all its users. This
28General Public License applies to most of the Free Software
29Foundation's software and to any other program whose authors commit to
30using it. (Some other Free Software Foundation software is covered by
31the GNU Library General Public License instead.) You can apply it to
32your programs, too.
33
34 When we speak of free software, we are referring to freedom, not
35price. Our General Public Licenses are designed to make sure that you
36have the freedom to distribute copies of free software (and charge for
37this service if you wish), that you receive source code or can get it
38if you want it, that you can change the software or use pieces of it
39in new free programs; and that you know you can do these things.
40
41 To protect your rights, we need to make restrictions that forbid
42anyone to deny you these rights or to ask you to surrender the rights.
43These restrictions translate to certain responsibilities for you if you
44distribute copies of the software, or if you modify it.
45
46 For example, if you distribute copies of such a program, whether
47gratis or for a fee, you must give the recipients all the rights that
48you have. You must make sure that they, too, receive or can get the
49source code. And you must show them these terms so they know their
50rights.
51
52 We protect your rights with two steps: (1) copyright the software, and
53(2) offer you this license which gives you legal permission to copy,
54distribute and/or modify the software.
55
56 Also, for each author's protection and ours, we want to make certain
57that everyone understands that there is no warranty for this free
58software. If the software is modified by someone else and passed on, we
59want its recipients to know that what they have is not the original, so
60that any problems introduced by others will not reflect on the original
61authors' reputations.
62
63 Finally, any free program is threatened constantly by software
64patents. We wish to avoid the danger that redistributors of a free
65program will individually obtain patent licenses, in effect making the
66program proprietary. To prevent this, we have made it clear that any
67patent must be licensed for everyone's free use or not licensed at all.
68
69 The precise terms and conditions for copying, distribution and
70modification follow.
71
72 GNU GENERAL PUBLIC LICENSE
73 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
74
75 0. This License applies to any program or other work which contains
76a notice placed by the copyright holder saying it may be distributed
77under the terms of this General Public License. The "Program", below,
78refers to any such program or work, and a "work based on the Program"
79means either the Program or any derivative work under copyright law:
80that is to say, a work containing the Program or a portion of it,
81either verbatim or with modifications and/or translated into another
82language. (Hereinafter, translation is included without limitation in
83the term "modification".) Each licensee is addressed as "you".
84
85Activities other than copying, distribution and modification are not
86covered by this License; they are outside its scope. The act of
87running the Program is not restricted, and the output from the Program
88is covered only if its contents constitute a work based on the
89Program (independent of having been made by running the Program).
90Whether that is true depends on what the Program does.
91
92 1. You may copy and distribute verbatim copies of the Program's
93source code as you receive it, in any medium, provided that you
94conspicuously and appropriately publish on each copy an appropriate
95copyright notice and disclaimer of warranty; keep intact all the
96notices that refer to this License and to the absence of any warranty;
97and give any other recipients of the Program a copy of this License
98along with the Program.
99
100You may charge a fee for the physical act of transferring a copy, and
101you may at your option offer warranty protection in exchange for a fee.
102
103 2. You may modify your copy or copies of the Program or any portion
104of it, thus forming a work based on the Program, and copy and
105distribute such modifications or work under the terms of Section 1
106above, provided that you also meet all of these conditions:
107
108 a) You must cause the modified files to carry prominent notices
109 stating that you changed the files and the date of any change.
110
111 b) You must cause any work that you distribute or publish, that in
112 whole or in part contains or is derived from the Program or any
113 part thereof, to be licensed as a whole at no charge to all third
114 parties under the terms of this License.
115
116 c) If the modified program normally reads commands interactively
117 when run, you must cause it, when started running for such
118 interactive use in the most ordinary way, to print or display an
119 announcement including an appropriate copyright notice and a
120 notice that there is no warranty (or else, saying that you provide
121 a warranty) and that users may redistribute the program under
122 these conditions, and telling the user how to view a copy of this
123 License. (Exception: if the Program itself is interactive but
124 does not normally print such an announcement, your work based on
125 the Program is not required to print an announcement.)
126
127These requirements apply to the modified work as a whole. If
128identifiable sections of that work are not derived from the Program,
129and can be reasonably considered independent and separate works in
130themselves, then this License, and its terms, do not apply to those
131sections when you distribute them as separate works. But when you
132distribute the same sections as part of a whole which is a work based
133on the Program, the distribution of the whole must be on the terms of
134this License, whose permissions for other licensees extend to the
135entire whole, and thus to each and every part regardless of who wrote it.
136
137Thus, it is not the intent of this section to claim rights or contest
138your rights to work written entirely by you; rather, the intent is to
139exercise the right to control the distribution of derivative or
140collective works based on the Program.
141
142In addition, mere aggregation of another work not based on the Program
143with the Program (or with a work based on the Program) on a volume of
144a storage or distribution medium does not bring the other work under
145the scope of this License.
146
147 3. You may copy and distribute the Program (or a work based on it,
148under Section 2) in object code or executable form under the terms of
149Sections 1 and 2 above provided that you also do one of the following:
150
151 a) Accompany it with the complete corresponding machine-readable
152 source code, which must be distributed under the terms of Sections
153 1 and 2 above on a medium customarily used for software interchange; or,
154
155 b) Accompany it with a written offer, valid for at least three
156 years, to give any third party, for a charge no more than your
157 cost of physically performing source distribution, a complete
158 machine-readable copy of the corresponding source code, to be
159 distributed under the terms of Sections 1 and 2 above on a medium
160 customarily used for software interchange; or,
161
162 c) Accompany it with the information you received as to the offer
163 to distribute corresponding source code. (This alternative is
164 allowed only for noncommercial distribution and only if you
165 received the program in object code or executable form with such
166 an offer, in accord with Subsection b above.)
167
168The source code for a work means the preferred form of the work for
169making modifications to it. For an executable work, complete source
170code means all the source code for all modules it contains, plus any
171associated interface definition files, plus the scripts used to
172control compilation and installation of the executable. However, as a
173special exception, the source code distributed need not include
174anything that is normally distributed (in either source or binary
175form) with the major components (compiler, kernel, and so on) of the
176operating system on which the executable runs, unless that component
177itself accompanies the executable.
178
179If distribution of executable or object code is made by offering
180access to copy from a designated place, then offering equivalent
181access to copy the source code from the same place counts as
182distribution of the source code, even though third parties are not
183compelled to copy the source along with the object code.
184
185 4. You may not copy, modify, sublicense, or distribute the Program
186except as expressly provided under this License. Any attempt
187otherwise to copy, modify, sublicense or distribute the Program is
188void, and will automatically terminate your rights under this License.
189However, parties who have received copies, or rights, from you under
190this License will not have their licenses terminated so long as such
191parties remain in full compliance.
192
193 5. You are not required to accept this License, since you have not
194signed it. However, nothing else grants you permission to modify or
195distribute the Program or its derivative works. These actions are
196prohibited by law if you do not accept this License. Therefore, by
197modifying or distributing the Program (or any work based on the
198Program), you indicate your acceptance of this License to do so, and
199all its terms and conditions for copying, distributing or modifying
200the Program or works based on it.
201
202 6. Each time you redistribute the Program (or any work based on the
203Program), the recipient automatically receives a license from the
204original licensor to copy, distribute or modify the Program subject to
205these terms and conditions. You may not impose any further
206restrictions on the recipients' exercise of the rights granted herein.
207You are not responsible for enforcing compliance by third parties to
208this License.
209
210 7. If, as a consequence of a court judgment or allegation of patent
211infringement or for any other reason (not limited to patent issues),
212conditions are imposed on you (whether by court order, agreement or
213otherwise) that contradict the conditions of this License, they do not
214excuse you from the conditions of this License. If you cannot
215distribute so as to satisfy simultaneously your obligations under this
216License and any other pertinent obligations, then as a consequence you
217may not distribute the Program at all. For example, if a patent
218license would not permit royalty-free redistribution of the Program by
219all those who receive copies directly or indirectly through you, then
220the only way you could satisfy both it and this License would be to
221refrain entirely from distribution of the Program.
222
223If any portion of this section is held invalid or unenforceable under
224any particular circumstance, the balance of the section is intended to
225apply and the section as a whole is intended to apply in other
226circumstances.
227
228It is not the purpose of this section to induce you to infringe any
229patents or other property right claims or to contest validity of any
230such claims; this section has the sole purpose of protecting the
231integrity of the free software distribution system, which is
232implemented by public license practices. Many people have made
233generous contributions to the wide range of software distributed
234through that system in reliance on consistent application of that
235system; it is up to the author/donor to decide if he or she is willing
236to distribute software through any other system and a licensee cannot
237impose that choice.
238
239This section is intended to make thoroughly clear what is believed to
240be a consequence of the rest of this License.
241
242 8. If the distribution and/or use of the Program is restricted in
243certain countries either by patents or by copyrighted interfaces, the
244original copyright holder who places the Program under this License
245may add an explicit geographical distribution limitation excluding
246those countries, so that distribution is permitted only in or among
247countries not thus excluded. In such case, this License incorporates
248the limitation as if written in the body of this License.
249
250 9. The Free Software Foundation may publish revised and/or new versions
251of the General Public License from time to time. Such new versions will
252be similar in spirit to the present version, but may differ in detail to
253address new problems or concerns.
254
255Each version is given a distinguishing version number. If the Program
256specifies a version number of this License which applies to it and "any
257later version", you have the option of following the terms and conditions
258either of that version or of any later version published by the Free
259Software Foundation. If the Program does not specify a version number of
260this License, you may choose any version ever published by the Free Software
261Foundation.
262
263 10. If you wish to incorporate parts of the Program into other free
264programs whose distribution conditions are different, write to the author
265to ask for permission. For software which is copyrighted by the Free
266Software Foundation, write to the Free Software Foundation; we sometimes
267make exceptions for this. Our decision will be guided by the two goals
268of preserving the free status of all derivatives of our free software and
269of promoting the sharing and reuse of software generally.
270
271 NO WARRANTY
272
273 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
274FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
275OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
276PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
277OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
278MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
279TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
280PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
281REPAIR OR CORRECTION.
282
283 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
284WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
285REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
286INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
287OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
288TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
289YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
290PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
291POSSIBILITY OF SUCH DAMAGES.
292
293 END OF TERMS AND CONDITIONS
294
295 How to Apply These Terms to Your New Programs
296
297 If you develop a new program, and you want it to be of the greatest
298possible use to the public, the best way to achieve this is to make it
299free software which everyone can redistribute and change under these terms.
300
301 To do so, attach the following notices to the program. It is safest
302to attach them to the start of each source file to most effectively
303convey the exclusion of warranty; and each file should have at least
304the "copyright" line and a pointer to where the full notice is found.
305
306 <one line to give the program's name and a brief idea of what it does.>
307 Copyright (C) <year> <name of author>
308
309 This program is free software; you can redistribute it and/or modify
310 it under the terms of the GNU General Public License as published by
311 the Free Software Foundation; either version 2 of the License, or
312 (at your option) any later version.
313
314 This program is distributed in the hope that it will be useful,
315 but WITHOUT ANY WARRANTY; without even the implied warranty of
316 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
317 GNU General Public License for more details.
318
319 You should have received a copy of the GNU General Public License
320 along with this program; if not, write to the Free Software
321 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
322
323
324Also add information on how to contact you by electronic and paper mail.
325
326If the program is interactive, make it output a short notice like this
327when it starts in an interactive mode:
328
329 Gnomovision version 69, Copyright (C) year name of author
330 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
331 This is free software, and you are welcome to redistribute it
332 under certain conditions; type `show c' for details.
333
334The hypothetical commands `show w' and `show c' should show the appropriate
335parts of the General Public License. Of course, the commands you use may
336be called something other than `show w' and `show c'; they could even be
337mouse-clicks or menu items--whatever suits your program.
338
339You should also get your employer (if you work as a programmer) or your
340school, if any, to sign a "copyright disclaimer" for the program, if
341necessary. Here is a sample; alter the names:
342
343 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
344 `Gnomovision' (which makes passes at compilers) written by James Hacker.
345
346 <signature of Ty Coon>, 1 April 1989
347 Ty Coon, President of Vice
348
349This General Public License does not permit incorporating your program into
350proprietary programs. If your program is a subroutine library, you may
351consider it more useful to permit linking proprietary applications with the
352library. If this is what you want to do, use the GNU Library General
353Public License instead of this License.
diff --git a/LICENSES/preferred/LGPL-2.0 b/LICENSES/preferred/LGPL-2.0
new file mode 100644
index 000000000000..957d798fe037
--- /dev/null
+++ b/LICENSES/preferred/LGPL-2.0
@@ -0,0 +1,487 @@
1Valid-License-Identifier: LGPL-2.0
2Valid-License-Identifier: LGPL-2.0+
3SPDX-URL: https://spdx.org/licenses/LGPL-2.0.html
4Usage-Guide:
5 To use this license in source code, put one of the following SPDX
6 tag/value pairs into a comment according to the placement
7 guidelines in the licensing rules documentation.
8 For 'GNU Library General Public License (LGPL) version 2.0 only' use:
9 SPDX-License-Identifier: LGPL-2.0
10 For 'GNU Library General Public License (LGPL) version 2.0 or any later
11 version' use:
12 SPDX-License-Identifier: LGPL-2.0+
13License-Text:
14
15GNU LIBRARY GENERAL PUBLIC LICENSE
16Version 2, June 1991
17
18Copyright (C) 1991 Free Software Foundation, Inc.
1951 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20
21Everyone is permitted to copy and distribute verbatim copies of this
22license document, but changing it is not allowed.
23
24[This is the first released version of the library GPL. It is numbered 2
25because it goes with version 2 of the ordinary GPL.]
26
27Preamble
28
29The licenses for most software are designed to take away your freedom to
30share and change it. By contrast, the GNU General Public Licenses are
31intended to guarantee your freedom to share and change free software--to
32make sure the software is free for all its users.
33
34This license, the Library General Public License, applies to some specially
35designated Free Software Foundation software, and to any other libraries
36whose authors decide to use it. You can use it for your libraries, too.
37
38When we speak of free software, we are referring to freedom, not price. Our
39General Public Licenses are designed to make sure that you have the freedom
40to distribute copies of free software (and charge for this service if you
41wish), that you receive source code or can get it if you want it, that you
42can change the software or use pieces of it in new free programs; and that
43you know you can do these things.
44
45To protect your rights, we need to make restrictions that forbid anyone to
46deny you these rights or to ask you to surrender the rights. These
47restrictions translate to certain responsibilities for you if you
48distribute copies of the library, or if you modify it.
49
50For example, if you distribute copies of the library, whether gratis or for
51a fee, you must give the recipients all the rights that we gave you. You
52must make sure that they, too, receive or can get the source code. If you
53link a program with the library, you must provide complete object files to
54the recipients so that they can relink them with the library, after making
55changes to the library and recompiling it. And you must show them these
56terms so they know their rights.
57
58Our method of protecting your rights has two steps: (1) copyright the
59library, and (2) offer you this license which gives you legal permission to
60copy, distribute and/or modify the library.
61
62Also, for each distributor's protection, we want to make certain that
63everyone understands that there is no warranty for this free library. If
64the library is modified by someone else and passed on, we want its
65recipients to know that what they have is not the original version, so that
66any problems introduced by others will not reflect on the original authors'
67reputations.
68
69Finally, any free program is threatened constantly by software patents. We
70wish to avoid the danger that companies distributing free software will
71individually obtain patent licenses, thus in effect transforming the
72program into proprietary software. To prevent this, we have made it clear
73that any patent must be licensed for everyone's free use or not licensed at
74all.
75
76Most GNU software, including some libraries, is covered by the ordinary GNU
77General Public License, which was designed for utility programs. This
78license, the GNU Library General Public License, applies to certain
79designated libraries. This license is quite different from the ordinary
80one; be sure to read it in full, and don't assume that anything in it is
81the same as in the ordinary license.
82
83The reason we have a separate public license for some libraries is that
84they blur the distinction we usually make between modifying or adding to a
85program and simply using it. Linking a program with a library, without
86changing the library, is in some sense simply using the library, and is
87analogous to running a utility program or application program. However, in
88a textual and legal sense, the linked executable is a combined work, a
89derivative of the original library, and the ordinary General Public License
90treats it as such.
91
92Because of this blurred distinction, using the ordinary General Public
93License for libraries did not effectively promote software sharing, because
94most developers did not use the libraries. We concluded that weaker
95conditions might promote sharing better.
96
97However, unrestricted linking of non-free programs would deprive the users
98of those programs of all benefit from the free status of the libraries
99themselves. This Library General Public License is intended to permit
100developers of non-free programs to use free libraries, while preserving
101your freedom as a user of such programs to change the free libraries that
102are incorporated in them. (We have not seen how to achieve this as regards
103changes in header files, but we have achieved it as regards changes in the
104actual functions of the Library.) The hope is that this will lead to faster
105development of free libraries.
106
107The precise terms and conditions for copying, distribution and modification
108follow. Pay close attention to the difference between a "work based on the
109library" and a "work that uses the library". The former contains code
110derived from the library, while the latter only works together with the
111library.
112
113Note that it is possible for a library to be covered by the ordinary
114General Public License rather than by this special one.
115
116TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
117
1180. This License Agreement applies to any software library which contains a
119 notice placed by the copyright holder or other authorized party saying
120 it may be distributed under the terms of this Library General Public
121 License (also called "this License"). Each licensee is addressed as
122 "you".
123
124 A "library" means a collection of software functions and/or data
125 prepared so as to be conveniently linked with application programs
126 (which use some of those functions and data) to form executables.
127
128 The "Library", below, refers to any such software library or work which
129 has been distributed under these terms. A "work based on the Library"
130 means either the Library or any derivative work under copyright law:
131 that is to say, a work containing the Library or a portion of it, either
132 verbatim or with modifications and/or translated straightforwardly into
133 another language. (Hereinafter, translation is included without
134 limitation in the term "modification".)
135
136 "Source code" for a work means the preferred form of the work for making
137 modifications to it. For a library, complete source code means all the
138 source code for all modules it contains, plus any associated interface
139 definition files, plus the scripts used to control compilation and
140 installation of the library.
141
142 Activities other than copying, distribution and modification are not
143 covered by this License; they are outside its scope. The act of running
144 a program using the Library is not restricted, and output from such a
145 program is covered only if its contents constitute a work based on the
146 Library (independent of the use of the Library in a tool for writing
147 it). Whether that is true depends on what the Library does and what the
148 program that uses the Library does.
149
1501. You may copy and distribute verbatim copies of the Library's complete
151 source code as you receive it, in any medium, provided that you
152 conspicuously and appropriately publish on each copy an appropriate
153 copyright notice and disclaimer of warranty; keep intact all the notices
154 that refer to this License and to the absence of any warranty; and
155 distribute a copy of this License along with the Library.
156
157 You may charge a fee for the physical act of transferring a copy, and
158 you may at your option offer warranty protection in exchange for a fee.
159
1602. You may modify your copy or copies of the Library or any portion of it,
161 thus forming a work based on the Library, and copy and distribute such
162 modifications or work under the terms of Section 1 above, provided that
163 you also meet all of these conditions:
164
165 a) The modified work must itself be a software library.
166
167 b) You must cause the files modified to carry prominent notices stating
168 that you changed the files and the date of any change.
169
170 c) You must cause the whole of the work to be licensed at no charge to
171 all third parties under the terms of this License.
172
173 d) If a facility in the modified Library refers to a function or a table
174 of data to be supplied by an application program that uses the
175 facility, other than as an argument passed when the facility is
176 invoked, then you must make a good faith effort to ensure that, in
177 the event an application does not supply such function or table, the
178 facility still operates, and performs whatever part of its purpose
179 remains meaningful.
180
181 (For example, a function in a library to compute square roots has a
182 purpose that is entirely well-defined independent of the
183 application. Therefore, Subsection 2d requires that any
184 application-supplied function or table used by this function must be
185 optional: if the application does not supply it, the square root
186 function must still compute square roots.)
187
188 These requirements apply to the modified work as a whole. If
189 identifiable sections of that work are not derived from the Library, and
190 can be reasonably considered independent and separate works in
191 themselves, then this License, and its terms, do not apply to those
192 sections when you distribute them as separate works. But when you
193 distribute the same sections as part of a whole which is a work based on
194 the Library, the distribution of the whole must be on the terms of this
195 License, whose permissions for other licensees extend to the entire
196 whole, and thus to each and every part regardless of who wrote it.
197
198 Thus, it is not the intent of this section to claim rights or contest
199 your rights to work written entirely by you; rather, the intent is to
200 exercise the right to control the distribution of derivative or
201 collective works based on the Library.
202
203 In addition, mere aggregation of another work not based on the Library
204 with the Library (or with a work based on the Library) on a volume of a
205 storage or distribution medium does not bring the other work under the
206 scope of this License.
207
2083. You may opt to apply the terms of the ordinary GNU General Public
209 License instead of this License to a given copy of the Library. To do
210 this, you must alter all the notices that refer to this License, so that
211 they refer to the ordinary GNU General Public License, version 2,
212 instead of to this License. (If a newer version than version 2 of the
213 ordinary GNU General Public License has appeared, then you can specify
214 that version instead if you wish.) Do not make any other change in these
215 notices.
216
217 Once this change is made in a given copy, it is irreversible for that
218 copy, so the ordinary GNU General Public License applies to all
219 subsequent copies and derivative works made from that copy.
220
221 This option is useful when you wish to copy part of the code of the
222 Library into a program that is not a library.
223
2244. You may copy and distribute the Library (or a portion or derivative of
225 it, under Section 2) in object code or executable form under the terms
226 of Sections 1 and 2 above provided that you accompany it with the
227 complete corresponding machine-readable source code, which must be
228 distributed under the terms of Sections 1 and 2 above on a medium
229 customarily used for software interchange.
230
231 If distribution of object code is made by offering access to copy from a
232 designated place, then offering equivalent access to copy the source
233 code from the same place satisfies the requirement to distribute the
234 source code, even though third parties are not compelled to copy the
235 source along with the object code.
236
2375. A program that contains no derivative of any portion of the Library, but
238 is designed to work with the Library by being compiled or linked with
239 it, is called a "work that uses the Library". Such a work, in isolation,
240 is not a derivative work of the Library, and therefore falls outside the
241 scope of this License.
242
243 However, linking a "work that uses the Library" with the Library creates
244 an executable that is a derivative of the Library (because it contains
245 portions of the Library), rather than a "work that uses the
246 library". The executable is therefore covered by this License. Section 6
247 states terms for distribution of such executables.
248
249 When a "work that uses the Library" uses material from a header file
250 that is part of the Library, the object code for the work may be a
251 derivative work of the Library even though the source code is
252 not. Whether this is true is especially significant if the work can be
253 linked without the Library, or if the work is itself a library. The
254 threshold for this to be true is not precisely defined by law.
255
256 If such an object file uses only numerical parameters, data structure
257 layouts and accessors, and small macros and small inline functions (ten
258 lines or less in length), then the use of the object file is
259 unrestricted, regardless of whether it is legally a derivative
260 work. (Executables containing this object code plus portions of the
261 Library will still fall under Section 6.)
262
263 Otherwise, if the work is a derivative of the Library, you may
264 distribute the object code for the work under the terms of Section
265 6. Any executables containing that work also fall under Section 6,
266 whether or not they are linked directly with the Library itself.
267
2686. As an exception to the Sections above, you may also compile or link a
269 "work that uses the Library" with the Library to produce a work
270 containing portions of the Library, and distribute that work under terms
271 of your choice, provided that the terms permit modification of the work
272 for the customer's own use and reverse engineering for debugging such
273 modifications.
274
275 You must give prominent notice with each copy of the work that the
276 Library is used in it and that the Library and its use are covered by
277 this License. You must supply a copy of this License. If the work during
278 execution displays copyright notices, you must include the copyright
279 notice for the Library among them, as well as a reference directing the
280 user to the copy of this License. Also, you must do one of these things:
281
282 a) Accompany the work with the complete corresponding machine-readable
283 source code for the Library including whatever changes were used in
284 the work (which must be distributed under Sections 1 and 2 above);
285 and, if the work is an executable linked with the Library, with the
286 complete machine-readable "work that uses the Library", as object
287 code and/or source code, so that the user can modify the Library and
288 then relink to produce a modified executable containing the modified
289 Library. (It is understood that the user who changes the contents of
290 definitions files in the Library will not necessarily be able to
291 recompile the application to use the modified definitions.)
292
293 b) Accompany the work with a written offer, valid for at least three
294 years, to give the same user the materials specified in Subsection
295 6a, above, for a charge no more than the cost of performing this
296 distribution.
297
298 c) If distribution of the work is made by offering access to copy from a
299 designated place, offer equivalent access to copy the above specified
300 materials from the same place.
301
302 d) Verify that the user has already received a copy of these materials
303 or that you have already sent this user a copy.
304
305 For an executable, the required form of the "work that uses the Library"
306 must include any data and utility programs needed for reproducing the
307 executable from it. However, as a special exception, the source code
308 distributed need not include anything that is normally distributed (in
309 either source or binary form) with the major components (compiler,
310 kernel, and so on) of the operating system on which the executable runs,
311 unless that component itself accompanies the executable.
312
313 It may happen that this requirement contradicts the license restrictions
314 of other proprietary libraries that do not normally accompany the
315 operating system. Such a contradiction means you cannot use both them
316 and the Library together in an executable that you distribute.
317
3187. You may place library facilities that are a work based on the Library
319 side-by-side in a single library together with other library facilities
320 not covered by this License, and distribute such a combined library,
321 provided that the separate distribution of the work based on the Library
322 and of the other library facilities is otherwise permitted, and provided
323 that you do these two things:
324
325 a) Accompany the combined library with a copy of the same work based on
326 the Library, uncombined with any other library facilities. This must
327 be distributed under the terms of the Sections above.
328
329 b) Give prominent notice with the combined library of the fact that part
330 of it is a work based on the Library, and explaining where to find
331 the accompanying uncombined form of the same work.
332
3338. You may not copy, modify, sublicense, link with, or distribute the
334 Library except as expressly provided under this License. Any attempt
335 otherwise to copy, modify, sublicense, link with, or distribute the
336 Library is void, and will automatically terminate your rights under this
337 License. However, parties who have received copies, or rights, from you
338 under this License will not have their licenses terminated so long as
339 such parties remain in full compliance.
340
3419. You are not required to accept this License, since you have not signed
342 it. However, nothing else grants you permission to modify or distribute
343 the Library or its derivative works. These actions are prohibited by law
344 if you do not accept this License. Therefore, by modifying or
345 distributing the Library (or any work based on the Library), you
346 indicate your acceptance of this License to do so, and all its terms and
347 conditions for copying, distributing or modifying the Library or works
348 based on it.
349
35010. Each time you redistribute the Library (or any work based on the
351 Library), the recipient automatically receives a license from the
352 original licensor to copy, distribute, link with or modify the Library
353 subject to these terms and conditions. You may not impose any further
354 restrictions on the recipients' exercise of the rights granted
355 herein. You are not responsible for enforcing compliance by third
356 parties to this License.
357
35811. If, as a consequence of a court judgment or allegation of patent
359 infringement or for any other reason (not limited to patent issues),
360 conditions are imposed on you (whether by court order, agreement or
361 otherwise) that contradict the conditions of this License, they do not
362 excuse you from the conditions of this License. If you cannot
363 distribute so as to satisfy simultaneously your obligations under this
364 License and any other pertinent obligations, then as a consequence you
365 may not distribute the Library at all. For example, if a patent license
366 would not permit royalty-free redistribution of the Library by all
367 those who receive copies directly or indirectly through you, then the
368 only way you could satisfy both it and this License would be to refrain
369 entirely from distribution of the Library.
370
371 If any portion of this section is held invalid or unenforceable under
372 any particular circumstance, the balance of the section is intended to
373 apply, and the section as a whole is intended to apply in other
374 circumstances.
375
376 It is not the purpose of this section to induce you to infringe any
377 patents or other property right claims or to contest validity of any
378 such claims; this section has the sole purpose of protecting the
379 integrity of the free software distribution system which is implemented
380 by public license practices. Many people have made generous
381 contributions to the wide range of software distributed through that
382 system in reliance on consistent application of that system; it is up
383 to the author/donor to decide if he or she is willing to distribute
384 software through any other system and a licensee cannot impose that
385 choice.
386
387 This section is intended to make thoroughly clear what is believed to
388 be a consequence of the rest of this License.
389
39012. If the distribution and/or use of the Library is restricted in certain
391 countries either by patents or by copyrighted interfaces, the original
392 copyright holder who places the Library under this License may add an
393 explicit geographical distribution limitation excluding those
394 countries, so that distribution is permitted only in or among countries
395 not thus excluded. In such case, this License incorporates the
396 limitation as if written in the body of this License.
397
39813. The Free Software Foundation may publish revised and/or new versions of
399 the Library General Public License from time to time. Such new versions
400 will be similar in spirit to the present version, but may differ in
401 detail to address new problems or concerns.
402
403 Each version is given a distinguishing version number. If the Library
404 specifies a version number of this License which applies to it and "any
405 later version", you have the option of following the terms and
406 conditions either of that version or of any later version published by
407 the Free Software Foundation. If the Library does not specify a license
408 version number, you may choose any version ever published by the Free
409 Software Foundation.
410
41114. If you wish to incorporate parts of the Library into other free
412 programs whose distribution conditions are incompatible with these,
413 write to the author to ask for permission. For software which is
414 copyrighted by the Free Software Foundation, write to the Free Software
415 Foundation; we sometimes make exceptions for this. Our decision will be
416 guided by the two goals of preserving the free status of all
417 derivatives of our free software and of promoting the sharing and reuse
418 of software generally.
419
420NO WARRANTY
421
42215. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
423 FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
424 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
425 PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
426 EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
427 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
428 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH
429 YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
430 NECESSARY SERVICING, REPAIR OR CORRECTION.
431
43216. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
433 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
434 REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
435 DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
436 DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY
437 (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
438 INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
439 THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR
440 OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
441
442END OF TERMS AND CONDITIONS
443
444How to Apply These Terms to Your New Libraries
445
446If you develop a new library, and you want it to be of the greatest
447possible use to the public, we recommend making it free software that
448everyone can redistribute and change. You can do so by permitting
449redistribution under these terms (or, alternatively, under the terms of the
450ordinary General Public License).
451
452To apply these terms, attach the following notices to the library. It is
453safest to attach them to the start of each source file to most effectively
454convey the exclusion of warranty; and each file should have at least the
455"copyright" line and a pointer to where the full notice is found.
456
457one line to give the library's name and an idea of what it does.
458Copyright (C) year name of author
459
460This library is free software; you can redistribute it and/or modify it
461under the terms of the GNU Library General Public License as published by
462the Free Software Foundation; either version 2 of the License, or (at your
463option) any later version.
464
465This library is distributed in the hope that it will be useful, but WITHOUT
466ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
467FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
468License for more details.
469
470You should have received a copy of the GNU Library General Public License
471along with this library; if not, write to the Free Software Foundation,
472Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
473
474Also add information on how to contact you by electronic and paper mail.
475
476You should also get your employer (if you work as a programmer) or your
477school, if any, to sign a "copyright disclaimer" for the library, if
478necessary. Here is a sample; alter the names:
479
480Yoyodyne, Inc., hereby disclaims all copyright interest in
481the library `Frob' (a library for tweaking knobs) written
482by James Random Hacker.
483
484signature of Ty Coon, 1 April 1990
485Ty Coon, President of Vice
486
487That's all there is to it!
diff --git a/LICENSES/preferred/LGPL-2.1 b/LICENSES/preferred/LGPL-2.1
new file mode 100644
index 000000000000..27bb4342a3e8
--- /dev/null
+++ b/LICENSES/preferred/LGPL-2.1
@@ -0,0 +1,503 @@
1Valid-License-Identifier: LGPL-2.1
2Valid-License-Identifier: LGPL-2.1+
3SPDX-URL: https://spdx.org/licenses/LGPL-2.1.html
4Usage-Guide:
5 To use this license in source code, put one of the following SPDX
6 tag/value pairs into a comment according to the placement
7 guidelines in the licensing rules documentation.
8 For 'GNU Lesser General Public License (LGPL) version 2.1 only' use:
9 SPDX-License-Identifier: LGPL-2.1
10 For 'GNU Lesser General Public License (LGPL) version 2.1 or any later
11 version' use:
12 SPDX-License-Identifier: LGPL-2.1+
13License-Text:
14
15GNU LESSER GENERAL PUBLIC LICENSE
16Version 2.1, February 1999
17
18Copyright (C) 1991, 1999 Free Software Foundation, Inc.
1951 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
21Everyone is permitted to copy and distribute verbatim copies of this
22license document, but changing it is not allowed.
23
24[This is the first released version of the Lesser GPL. It also counts as
25the successor of the GNU Library Public License, version 2, hence the
26version number 2.1.]
27
28Preamble
29
30The licenses for most software are designed to take away your freedom to
31share and change it. By contrast, the GNU General Public Licenses are
32intended to guarantee your freedom to share and change free software--to
33make sure the software is free for all its users.
34
35This license, the Lesser General Public License, applies to some specially
36designated software packages--typically libraries--of the Free Software
37Foundation and other authors who decide to use it. You can use it too, but
38we suggest you first think carefully about whether this license or the
39ordinary General Public License is the better strategy to use in any
40particular case, based on the explanations below.
41
42When we speak of free software, we are referring to freedom of use, not
43price. Our General Public Licenses are designed to make sure that you have
44the freedom to distribute copies of free software (and charge for this
45service if you wish); that you receive source code or can get it if you
46want it; that you can change the software and use pieces of it in new free
47programs; and that you are informed that you can do these things.
48
49To protect your rights, we need to make restrictions that forbid
50distributors to deny you these rights or to ask you to surrender these
51rights. These restrictions translate to certain responsibilities for you if
52you distribute copies of the library or if you modify it.
53
54For example, if you distribute copies of the library, whether gratis or for
55a fee, you must give the recipients all the rights that we gave you. You
56must make sure that they, too, receive or can get the source code. If you
57link other code with the library, you must provide complete object files to
58the recipients, so that they can relink them with the library after making
59changes to the library and recompiling it. And you must show them these
60terms so they know their rights.
61
62We protect your rights with a two-step method: (1) we copyright the
63library, and (2) we offer you this license, which gives you legal
64permission to copy, distribute and/or modify the library.
65
66To protect each distributor, we want to make it very clear that there is no
67warranty for the free library. Also, if the library is modified by someone
68else and passed on, the recipients should know that what they have is not
69the original version, so that the original author's reputation will not be
70affected by problems that might be introduced by others.
71
72Finally, software patents pose a constant threat to the existence of any
73free program. We wish to make sure that a company cannot effectively
74restrict the users of a free program by obtaining a restrictive license
75from a patent holder. Therefore, we insist that any patent license obtained
76for a version of the library must be consistent with the full freedom of
77use specified in this license.
78
79Most GNU software, including some libraries, is covered by the ordinary GNU
80General Public License. This license, the GNU Lesser General Public
81License, applies to certain designated libraries, and is quite different
82from the ordinary General Public License. We use this license for certain
83libraries in order to permit linking those libraries into non-free
84programs.
85
86When a program is linked with a library, whether statically or using a
87shared library, the combination of the two is legally speaking a combined
88work, a derivative of the original library. The ordinary General Public
89License therefore permits such linking only if the entire combination fits
90its criteria of freedom. The Lesser General Public License permits more lax
91criteria for linking other code with the library.
92
93We call this license the "Lesser" General Public License because it does
94Less to protect the user's freedom than the ordinary General Public
95License. It also provides other free software developers Less of an
96advantage over competing non-free programs. These disadvantages are the
97reason we use the ordinary General Public License for many
98libraries. However, the Lesser license provides advantages in certain
99special circumstances.
100
101For example, on rare occasions, there may be a special need to encourage
102the widest possible use of a certain library, so that it becomes a de-facto
103standard. To achieve this, non-free programs must be allowed to use the
104library. A more frequent case is that a free library does the same job as
105widely used non-free libraries. In this case, there is little to gain by
106limiting the free library to free software only, so we use the Lesser
107General Public License.
108
109In other cases, permission to use a particular library in non-free programs
110enables a greater number of people to use a large body of free
111software. For example, permission to use the GNU C Library in non-free
112programs enables many more people to use the whole GNU operating system, as
113well as its variant, the GNU/Linux operating system.
114
115Although the Lesser General Public License is Less protective of the users'
116freedom, it does ensure that the user of a program that is linked with the
117Library has the freedom and the wherewithal to run that program using a
118modified version of the Library.
119
120The precise terms and conditions for copying, distribution and modification
121follow. Pay close attention to the difference between a "work based on the
122library" and a "work that uses the library". The former contains code
123derived from the library, whereas the latter must be combined with the
124library in order to run.
125
126TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
127
1280. This License Agreement applies to any software library or other program
129 which contains a notice placed by the copyright holder or other
130 authorized party saying it may be distributed under the terms of this
131 Lesser General Public License (also called "this License"). Each
132 licensee is addressed as "you".
133
134 A "library" means a collection of software functions and/or data
135 prepared so as to be conveniently linked with application programs
136 (which use some of those functions and data) to form executables.
137
138 The "Library", below, refers to any such software library or work which
139 has been distributed under these terms. A "work based on the Library"
140 means either the Library or any derivative work under copyright law:
141 that is to say, a work containing the Library or a portion of it, either
142 verbatim or with modifications and/or translated straightforwardly into
143 another language. (Hereinafter, translation is included without
144 limitation in the term "modification".)
145
146 "Source code" for a work means the preferred form of the work for making
147 modifications to it. For a library, complete source code means all the
148 source code for all modules it contains, plus any associated interface
149 definition files, plus the scripts used to control compilation and
150 installation of the library.
151
152 Activities other than copying, distribution and modification are not
153 covered by this License; they are outside its scope. The act of running
154 a program using the Library is not restricted, and output from such a
155 program is covered only if its contents constitute a work based on the
156 Library (independent of the use of the Library in a tool for writing
157 it). Whether that is true depends on what the Library does and what the
158 program that uses the Library does.
159
1601. You may copy and distribute verbatim copies of the Library's complete
161 source code as you receive it, in any medium, provided that you
162 conspicuously and appropriately publish on each copy an appropriate
163 copyright notice and disclaimer of warranty; keep intact all the notices
164 that refer to this License and to the absence of any warranty; and
165 distribute a copy of this License along with the Library.
166
167 You may charge a fee for the physical act of transferring a copy, and
168 you may at your option offer warranty protection in exchange for a fee.
169
1702. You may modify your copy or copies of the Library or any portion of it,
171 thus forming a work based on the Library, and copy and distribute such
172 modifications or work under the terms of Section 1 above, provided that
173 you also meet all of these conditions:
174
175 a) The modified work must itself be a software library.
176
177 b) You must cause the files modified to carry prominent notices stating
178 that you changed the files and the date of any change.
179
180 c) You must cause the whole of the work to be licensed at no charge to
181 all third parties under the terms of this License.
182
183 d) If a facility in the modified Library refers to a function or a table
184 of data to be supplied by an application program that uses the
185 facility, other than as an argument passed when the facility is
186 invoked, then you must make a good faith effort to ensure that, in
187 the event an application does not supply such function or table, the
188 facility still operates, and performs whatever part of its purpose
189 remains meaningful.
190
191 (For example, a function in a library to compute square roots has a
192 purpose that is entirely well-defined independent of the
193 application. Therefore, Subsection 2d requires that any
194 application-supplied function or table used by this function must be
195 optional: if the application does not supply it, the square root
196 function must still compute square roots.)
197
198 These requirements apply to the modified work as a whole. If
199 identifiable sections of that work are not derived from the Library, and
200 can be reasonably considered independent and separate works in
201 themselves, then this License, and its terms, do not apply to those
202 sections when you distribute them as separate works. But when you
203 distribute the same sections as part of a whole which is a work based on
204 the Library, the distribution of the whole must be on the terms of this
205 License, whose permissions for other licensees extend to the entire
206 whole, and thus to each and every part regardless of who wrote it.
207
208 Thus, it is not the intent of this section to claim rights or contest
209 your rights to work written entirely by you; rather, the intent is to
210 exercise the right to control the distribution of derivative or
211 collective works based on the Library.
212
213 In addition, mere aggregation of another work not based on the Library
214 with the Library (or with a work based on the Library) on a volume of a
215 storage or distribution medium does not bring the other work under the
216 scope of this License.
217
2183. You may opt to apply the terms of the ordinary GNU General Public
219 License instead of this License to a given copy of the Library. To do
220 this, you must alter all the notices that refer to this License, so that
221 they refer to the ordinary GNU General Public License, version 2,
222 instead of to this License. (If a newer version than version 2 of the
223 ordinary GNU General Public License has appeared, then you can specify
224 that version instead if you wish.) Do not make any other change in these
225 notices.
226
227 Once this change is made in a given copy, it is irreversible for that
228 copy, so the ordinary GNU General Public License applies to all
229 subsequent copies and derivative works made from that copy.
230
231 This option is useful when you wish to copy part of the code of the
232 Library into a program that is not a library.
233
2344. You may copy and distribute the Library (or a portion or derivative of
235 it, under Section 2) in object code or executable form under the terms
236 of Sections 1 and 2 above provided that you accompany it with the
237 complete corresponding machine-readable source code, which must be
238 distributed under the terms of Sections 1 and 2 above on a medium
239 customarily used for software interchange.
240
241 If distribution of object code is made by offering access to copy from a
242 designated place, then offering equivalent access to copy the source
243 code from the same place satisfies the requirement to distribute the
244 source code, even though third parties are not compelled to copy the
245 source along with the object code.
246
2475. A program that contains no derivative of any portion of the Library, but
248 is designed to work with the Library by being compiled or linked with
249 it, is called a "work that uses the Library". Such a work, in isolation,
250 is not a derivative work of the Library, and therefore falls outside the
251 scope of this License.
252
253 However, linking a "work that uses the Library" with the Library creates
254 an executable that is a derivative of the Library (because it contains
255 portions of the Library), rather than a "work that uses the
256 library". The executable is therefore covered by this License. Section 6
257 states terms for distribution of such executables.
258
259 When a "work that uses the Library" uses material from a header file
260 that is part of the Library, the object code for the work may be a
261 derivative work of the Library even though the source code is
262 not. Whether this is true is especially significant if the work can be
263 linked without the Library, or if the work is itself a library. The
264 threshold for this to be true is not precisely defined by law.
265
266 If such an object file uses only numerical parameters, data structure
267 layouts and accessors, and small macros and small inline functions (ten
268 lines or less in length), then the use of the object file is
269 unrestricted, regardless of whether it is legally a derivative
270 work. (Executables containing this object code plus portions of the
271 Library will still fall under Section 6.)
272
273 Otherwise, if the work is a derivative of the Library, you may
274 distribute the object code for the work under the terms of Section
275 6. Any executables containing that work also fall under Section 6,
276 whether or not they are linked directly with the Library itself.
277
2786. As an exception to the Sections above, you may also combine or link a
279 "work that uses the Library" with the Library to produce a work
280 containing portions of the Library, and distribute that work under terms
281 of your choice, provided that the terms permit modification of the work
282 for the customer's own use and reverse engineering for debugging such
283 modifications.
284
285 You must give prominent notice with each copy of the work that the
286 Library is used in it and that the Library and its use are covered by
287 this License. You must supply a copy of this License. If the work during
288 execution displays copyright notices, you must include the copyright
289 notice for the Library among them, as well as a reference directing the
290 user to the copy of this License. Also, you must do one of these things:
291
292 a) Accompany the work with the complete corresponding machine-readable
293 source code for the Library including whatever changes were used in
294 the work (which must be distributed under Sections 1 and 2 above);
295 and, if the work is an executable linked with the Library, with the
296 complete machine-readable "work that uses the Library", as object
297 code and/or source code, so that the user can modify the Library and
298 then relink to produce a modified executable containing the modified
299 Library. (It is understood that the user who changes the contents of
300 definitions files in the Library will not necessarily be able to
301 recompile the application to use the modified definitions.)
302
303 b) Use a suitable shared library mechanism for linking with the
304 Library. A suitable mechanism is one that (1) uses at run time a copy
305 of the library already present on the user's computer system, rather
306 than copying library functions into the executable, and (2) will
307 operate properly with a modified version of the library, if the user
308 installs one, as long as the modified version is interface-compatible
309 with the version that the work was made with.
310
311 c) Accompany the work with a written offer, valid for at least three
312 years, to give the same user the materials specified in Subsection
313 6a, above, for a charge no more than the cost of performing this
314 distribution.
315
316 d) If distribution of the work is made by offering access to copy from a
317 designated place, offer equivalent access to copy the above specified
318 materials from the same place.
319
320 e) Verify that the user has already received a copy of these materials
321 or that you have already sent this user a copy.
322
323 For an executable, the required form of the "work that uses the Library"
324 must include any data and utility programs needed for reproducing the
325 executable from it. However, as a special exception, the materials to be
326 distributed need not include anything that is normally distributed (in
327 either source or binary form) with the major components (compiler,
328 kernel, and so on) of the operating system on which the executable runs,
329 unless that component itself accompanies the executable.
330
331 It may happen that this requirement contradicts the license restrictions
332 of other proprietary libraries that do not normally accompany the
333 operating system. Such a contradiction means you cannot use both them
334 and the Library together in an executable that you distribute.
335
3367. You may place library facilities that are a work based on the Library
337 side-by-side in a single library together with other library facilities
338 not covered by this License, and distribute such a combined library,
339 provided that the separate distribution of the work based on the Library
340 and of the other library facilities is otherwise permitted, and provided
341 that you do these two things:
342
343 a) Accompany the combined library with a copy of the same work based on
344 the Library, uncombined with any other library facilities. This must
345 be distributed under the terms of the Sections above.
346
347 b) Give prominent notice with the combined library of the fact that part
348 of it is a work based on the Library, and explaining where to find
349 the accompanying uncombined form of the same work.
350
3518. You may not copy, modify, sublicense, link with, or distribute the
352 Library except as expressly provided under this License. Any attempt
353 otherwise to copy, modify, sublicense, link with, or distribute the
354 Library is void, and will automatically terminate your rights under this
355 License. However, parties who have received copies, or rights, from you
356 under this License will not have their licenses terminated so long as
357 such parties remain in full compliance.
358
3599. You are not required to accept this License, since you have not signed
360 it. However, nothing else grants you permission to modify or distribute
361 the Library or its derivative works. These actions are prohibited by law
362 if you do not accept this License. Therefore, by modifying or
363 distributing the Library (or any work based on the Library), you
364 indicate your acceptance of this License to do so, and all its terms and
365 conditions for copying, distributing or modifying the Library or works
366 based on it.
367
36810. Each time you redistribute the Library (or any work based on the
369 Library), the recipient automatically receives a license from the
370 original licensor to copy, distribute, link with or modify the Library
371 subject to these terms and conditions. You may not impose any further
372 restrictions on the recipients' exercise of the rights granted
373 herein. You are not responsible for enforcing compliance by third
374 parties with this License.
375
37611. If, as a consequence of a court judgment or allegation of patent
377 infringement or for any other reason (not limited to patent issues),
378 conditions are imposed on you (whether by court order, agreement or
379 otherwise) that contradict the conditions of this License, they do not
380 excuse you from the conditions of this License. If you cannot
381 distribute so as to satisfy simultaneously your obligations under this
382 License and any other pertinent obligations, then as a consequence you
383 may not distribute the Library at all. For example, if a patent license
384 would not permit royalty-free redistribution of the Library by all
385 those who receive copies directly or indirectly through you, then the
386 only way you could satisfy both it and this License would be to refrain
387 entirely from distribution of the Library.
388
389 If any portion of this section is held invalid or unenforceable under
390 any particular circumstance, the balance of the section is intended to
391 apply, and the section as a whole is intended to apply in other
392 circumstances.
393
394 It is not the purpose of this section to induce you to infringe any
395 patents or other property right claims or to contest validity of any
396 such claims; this section has the sole purpose of protecting the
397 integrity of the free software distribution system which is implemented
398 by public license practices. Many people have made generous
399 contributions to the wide range of software distributed through that
400 system in reliance on consistent application of that system; it is up
401 to the author/donor to decide if he or she is willing to distribute
402 software through any other system and a licensee cannot impose that
403 choice.
404
405 This section is intended to make thoroughly clear what is believed to
406 be a consequence of the rest of this License.
407
40812. If the distribution and/or use of the Library is restricted in certain
409 countries either by patents or by copyrighted interfaces, the original
410 copyright holder who places the Library under this License may add an
411 explicit geographical distribution limitation excluding those
412 countries, so that distribution is permitted only in or among countries
413 not thus excluded. In such case, this License incorporates the
414 limitation as if written in the body of this License.
415
41613. The Free Software Foundation may publish revised and/or new versions of
417 the Lesser General Public License from time to time. Such new versions
418 will be similar in spirit to the present version, but may differ in
419 detail to address new problems or concerns.
420
421 Each version is given a distinguishing version number. If the Library
422 specifies a version number of this License which applies to it and "any
423 later version", you have the option of following the terms and
424 conditions either of that version or of any later version published by
425 the Free Software Foundation. If the Library does not specify a license
426 version number, you may choose any version ever published by the Free
427 Software Foundation.
428
42914. If you wish to incorporate parts of the Library into other free
430 programs whose distribution conditions are incompatible with these,
431 write to the author to ask for permission. For software which is
432 copyrighted by the Free Software Foundation, write to the Free Software
433 Foundation; we sometimes make exceptions for this. Our decision will be
434 guided by the two goals of preserving the free status of all
435 derivatives of our free software and of promoting the sharing and reuse
436 of software generally.
437
438NO WARRANTY
439
44015. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
441 FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
442 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
443 PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
444 EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
445 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
446 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH
447 YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
448 NECESSARY SERVICING, REPAIR OR CORRECTION.
449
45016. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
451 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
452 REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
453 DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
454 DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY
455 (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
456 INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
457 THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR
458 OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
459
460END OF TERMS AND CONDITIONS
461
462How to Apply These Terms to Your New Libraries
463
464If you develop a new library, and you want it to be of the greatest
465possible use to the public, we recommend making it free software that
466everyone can redistribute and change. You can do so by permitting
467redistribution under these terms (or, alternatively, under the terms of the
468ordinary General Public License).
469
470To apply these terms, attach the following notices to the library. It is
471safest to attach them to the start of each source file to most effectively
472convey the exclusion of warranty; and each file should have at least the
473"copyright" line and a pointer to where the full notice is found.
474
475one line to give the library's name and an idea of what it does.
476Copyright (C) year name of author
477
478This library is free software; you can redistribute it and/or modify it
479under the terms of the GNU Lesser General Public License as published by
480the Free Software Foundation; either version 2.1 of the License, or (at
481your option) any later version.
482
483This library is distributed in the hope that it will be useful, but WITHOUT
484ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
485FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
486for more details.
487
488You should have received a copy of the GNU Lesser General Public License
489along with this library; if not, write to the Free Software Foundation,
490Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add
491information on how to contact you by electronic and paper mail.
492
493You should also get your employer (if you work as a programmer) or your
494school, if any, to sign a "copyright disclaimer" for the library, if
495necessary. Here is a sample; alter the names:
496
497Yoyodyne, Inc., hereby disclaims all copyright interest in
498the library `Frob' (a library for tweaking knobs) written
499by James Random Hacker.
500
501signature of Ty Coon, 1 April 1990
502Ty Coon, President of Vice
503That's all there is to it!
diff --git a/LICENSES/preferred/MIT b/LICENSES/preferred/MIT
new file mode 100644
index 000000000000..f33a68ceb3ea
--- /dev/null
+++ b/LICENSES/preferred/MIT
@@ -0,0 +1,30 @@
1Valid-License-Identifier: MIT
2SPDX-URL: https://spdx.org/licenses/MIT.html
3Usage-Guide:
4 To use the MIT License put the following SPDX tag/value pair into a
5 comment according to the placement guidelines in the licensing rules
6 documentation:
7 SPDX-License-Identifier: MIT
8License-Text:
9
10MIT License
11
12Copyright (c) <year> <copyright holders>
13
14Permission is hereby granted, free of charge, to any person obtaining a
15copy of this software and associated documentation files (the "Software"),
16to deal in the Software without restriction, including without limitation
17the rights to use, copy, modify, merge, publish, distribute, sublicense,
18and/or sell copies of the Software, and to permit persons to whom the
19Software is furnished to do so, subject to the following conditions:
20
21The above copyright notice and this permission notice shall be included in
22all copies or substantial portions of the Software.
23
24THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30DEALINGS IN THE SOFTWARE.
diff --git a/drivers/w1/w1_netlink.h b/drivers/w1/w1_netlink.h
index a36661cd1f05..f876772c0fb4 100644
--- a/drivers/w1/w1_netlink.h
+++ b/drivers/w1/w1_netlink.h
@@ -59,7 +59,11 @@ enum w1_netlink_message_types {
59 * @type: one of enum w1_netlink_message_types 59 * @type: one of enum w1_netlink_message_types
60 * @status: kernel feedback for success 0 or errno failure value 60 * @status: kernel feedback for success 0 or errno failure value
61 * @len: length of data following w1_netlink_msg 61 * @len: length of data following w1_netlink_msg
62 * @id: union holding master bus id (msg.id) and slave device id (id[8]). 62 * @id: union holding bus master id (msg.id) and slave device id (id[8]).
63 * @id.id: Slave ID (8 bytes)
64 * @id.mst: bus master identification
65 * @id.mst.id: bus master ID
66 * @id.mst.res: bus master reserved
63 * @data: start address of any following data 67 * @data: start address of any following data
64 * 68 *
65 * The base message structure for w1 messages over netlink. 69 * The base message structure for w1 messages over netlink.
diff --git a/fs/9p/Kconfig b/fs/9p/Kconfig
index 6489e1fc1afd..11045d8e356a 100644
--- a/fs/9p/Kconfig
+++ b/fs/9p/Kconfig
@@ -25,9 +25,6 @@ config 9P_FS_POSIX_ACL
25 POSIX Access Control Lists (ACLs) support permissions for users and 25 POSIX Access Control Lists (ACLs) support permissions for users and
26 groups beyond the owner/group/world scheme. 26 groups beyond the owner/group/world scheme.
27 27
28 To learn more about Access Control Lists, visit the POSIX ACLs for
29 Linux website <http://acl.bestbits.at/>.
30
31 If you don't know what Access Control Lists are, say N 28 If you don't know what Access Control Lists are, say N
32 29
33endif 30endif
diff --git a/fs/Kconfig b/fs/Kconfig
index 7aee6d699fd6..0ed56752f208 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -167,17 +167,13 @@ config TMPFS_POSIX_ACL
167 files for sound to work properly. In short, if you're not sure, 167 files for sound to work properly. In short, if you're not sure,
168 say Y. 168 say Y.
169 169
170 To learn more about Access Control Lists, visit the POSIX ACLs for
171 Linux website <http://acl.bestbits.at/>.
172
173config TMPFS_XATTR 170config TMPFS_XATTR
174 bool "Tmpfs extended attributes" 171 bool "Tmpfs extended attributes"
175 depends on TMPFS 172 depends on TMPFS
176 default n 173 default n
177 help 174 help
178 Extended attributes are name:value pairs associated with inodes by 175 Extended attributes are name:value pairs associated with inodes by
179 the kernel or by users (see the attr(5) manual page, or visit 176 the kernel or by users (see the attr(5) manual page for details).
180 <http://acl.bestbits.at/> for details).
181 177
182 Currently this enables support for the trusted.* and 178 Currently this enables support for the trusted.* and
183 security.* namespaces. 179 security.* namespaces.
diff --git a/fs/btrfs/Kconfig b/fs/btrfs/Kconfig
index 2e558227931a..273351ee4c46 100644
--- a/fs/btrfs/Kconfig
+++ b/fs/btrfs/Kconfig
@@ -38,9 +38,6 @@ config BTRFS_FS_POSIX_ACL
38 POSIX Access Control Lists (ACLs) support permissions for users and 38 POSIX Access Control Lists (ACLs) support permissions for users and
39 groups beyond the owner/group/world scheme. 39 groups beyond the owner/group/world scheme.
40 40
41 To learn more about Access Control Lists, visit the POSIX ACLs for
42 Linux website <http://acl.bestbits.at/>.
43
44 If you don't know what Access Control Lists are, say N 41 If you don't know what Access Control Lists are, say N
45 42
46config BTRFS_FS_CHECK_INTEGRITY 43config BTRFS_FS_CHECK_INTEGRITY
diff --git a/fs/ceph/Kconfig b/fs/ceph/Kconfig
index 264e9bf83ff3..52095f473464 100644
--- a/fs/ceph/Kconfig
+++ b/fs/ceph/Kconfig
@@ -34,7 +34,4 @@ config CEPH_FS_POSIX_ACL
34 POSIX Access Control Lists (ACLs) support permissions for users and 34 POSIX Access Control Lists (ACLs) support permissions for users and
35 groups beyond the owner/group/world scheme. 35 groups beyond the owner/group/world scheme.
36 36
37 To learn more about Access Control Lists, visit the POSIX ACLs for
38 Linux website <http://acl.bestbits.at/>.
39
40 If you don't know what Access Control Lists are, say N 37 If you don't know what Access Control Lists are, say N
diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig
index c71971c01c63..687da62daf4e 100644
--- a/fs/cifs/Kconfig
+++ b/fs/cifs/Kconfig
@@ -108,14 +108,13 @@ config CIFS_XATTR
108 depends on CIFS 108 depends on CIFS
109 help 109 help
110 Extended attributes are name:value pairs associated with inodes by 110 Extended attributes are name:value pairs associated with inodes by
111 the kernel or by users (see the attr(5) manual page, or visit 111 the kernel or by users (see the attr(5) manual page for details).
112 <http://acl.bestbits.at/> for details). CIFS maps the name of 112 CIFS maps the name of extended attributes beginning with the user
113 extended attributes beginning with the user namespace prefix 113 namespace prefix to SMB/CIFS EAs. EAs are stored on Windows
114 to SMB/CIFS EAs. EAs are stored on Windows servers without the 114 servers without the user namespace prefix, but their names are
115 user namespace prefix, but their names are seen by Linux cifs clients 115 seen by Linux cifs clients prefaced by the user namespace prefix.
116 prefaced by the user namespace prefix. The system namespace 116 The system namespace (used by some filesystems to store ACLs) is
117 (used by some filesystems to store ACLs) is not supported at 117 not supported at this time.
118 this time.
119 118
120 If unsure, say Y. 119 If unsure, say Y.
121 120
diff --git a/fs/ext2/Kconfig b/fs/ext2/Kconfig
index c634874e12d9..894e4c53d1d2 100644
--- a/fs/ext2/Kconfig
+++ b/fs/ext2/Kconfig
@@ -13,8 +13,7 @@ config EXT2_FS_XATTR
13 depends on EXT2_FS 13 depends on EXT2_FS
14 help 14 help
15 Extended attributes are name:value pairs associated with inodes by 15 Extended attributes are name:value pairs associated with inodes by
16 the kernel or by users (see the attr(5) manual page, or visit 16 the kernel or by users (see the attr(5) manual page for details).
17 <http://acl.bestbits.at/> for details).
18 17
19 If unsure, say N. 18 If unsure, say N.
20 19
@@ -26,9 +25,6 @@ config EXT2_FS_POSIX_ACL
26 Posix Access Control Lists (ACLs) support permissions for users and 25 Posix Access Control Lists (ACLs) support permissions for users and
27 groups beyond the owner/group/world scheme. 26 groups beyond the owner/group/world scheme.
28 27
29 To learn more about Access Control Lists, visit the Posix ACLs for
30 Linux website <http://acl.bestbits.at/>.
31
32 If you don't know what Access Control Lists are, say N 28 If you don't know what Access Control Lists are, say N
33 29
34config EXT2_FS_SECURITY 30config EXT2_FS_SECURITY
diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
index 73b850f5659c..a453cc87082b 100644
--- a/fs/ext4/Kconfig
+++ b/fs/ext4/Kconfig
@@ -82,9 +82,6 @@ config EXT4_FS_POSIX_ACL
82 POSIX Access Control Lists (ACLs) support permissions for users and 82 POSIX Access Control Lists (ACLs) support permissions for users and
83 groups beyond the owner/group/world scheme. 83 groups beyond the owner/group/world scheme.
84 84
85 To learn more about Access Control Lists, visit the POSIX ACLs for
86 Linux website <http://acl.bestbits.at/>.
87
88 If you don't know what Access Control Lists are, say N 85 If you don't know what Access Control Lists are, say N
89 86
90config EXT4_FS_SECURITY 87config EXT4_FS_SECURITY
diff --git a/fs/f2fs/Kconfig b/fs/f2fs/Kconfig
index 378c221d68a9..9a20ef42fadd 100644
--- a/fs/f2fs/Kconfig
+++ b/fs/f2fs/Kconfig
@@ -35,8 +35,7 @@ config F2FS_FS_XATTR
35 default y 35 default y
36 help 36 help
37 Extended attributes are name:value pairs associated with inodes by 37 Extended attributes are name:value pairs associated with inodes by
38 the kernel or by users (see the attr(5) manual page, or visit 38 the kernel or by users (see the attr(5) manual page for details).
39 <http://acl.bestbits.at/> for details).
40 39
41 If unsure, say N. 40 If unsure, say N.
42 41
@@ -49,9 +48,6 @@ config F2FS_FS_POSIX_ACL
49 Posix Access Control Lists (ACLs) support permissions for users and 48 Posix Access Control Lists (ACLs) support permissions for users and
50 groups beyond the owner/group/world scheme. 49 groups beyond the owner/group/world scheme.
51 50
52 To learn more about Access Control Lists, visit the POSIX ACLs for
53 Linux website <http://acl.bestbits.at/>.
54
55 If you don't know what Access Control Lists are, say N 51 If you don't know what Access Control Lists are, say N
56 52
57config F2FS_FS_SECURITY 53config F2FS_FS_SECURITY
diff --git a/fs/hfsplus/Kconfig b/fs/hfsplus/Kconfig
index 24bc20fd42f7..7cc8b4acf66a 100644
--- a/fs/hfsplus/Kconfig
+++ b/fs/hfsplus/Kconfig
@@ -20,9 +20,6 @@ config HFSPLUS_FS_POSIX_ACL
20 POSIX Access Control Lists (ACLs) support permissions for users and 20 POSIX Access Control Lists (ACLs) support permissions for users and
21 groups beyond the owner/group/world scheme. 21 groups beyond the owner/group/world scheme.
22 22
23 To learn more about Access Control Lists, visit the POSIX ACLs for
24 Linux website <http://acl.bestbits.at/>.
25
26 It needs to understand that POSIX ACLs are treated only under 23 It needs to understand that POSIX ACLs are treated only under
27 Linux. POSIX ACLs doesn't mean something under Mac OS X. 24 Linux. POSIX ACLs doesn't mean something under Mac OS X.
28 Mac OS X beginning with version 10.4 ("Tiger") support NFSv4 ACLs, 25 Mac OS X beginning with version 10.4 ("Tiger") support NFSv4 ACLs,
diff --git a/fs/jffs2/Kconfig b/fs/jffs2/Kconfig
index d8bb6c411e96..ad850c5bf2ca 100644
--- a/fs/jffs2/Kconfig
+++ b/fs/jffs2/Kconfig
@@ -68,8 +68,7 @@ config JFFS2_FS_XATTR
68 default n 68 default n
69 help 69 help
70 Extended attributes are name:value pairs associated with inodes by 70 Extended attributes are name:value pairs associated with inodes by
71 the kernel or by users (see the attr(5) manual page, or visit 71 the kernel or by users (see the attr(5) manual page for details).
72 <http://acl.bestbits.at/> for details).
73 72
74 If unsure, say N. 73 If unsure, say N.
75 74
@@ -82,9 +81,6 @@ config JFFS2_FS_POSIX_ACL
82 Posix Access Control Lists (ACLs) support permissions for users and 81 Posix Access Control Lists (ACLs) support permissions for users and
83 groups beyond the owner/group/world scheme. 82 groups beyond the owner/group/world scheme.
84 83
85 To learn more about Access Control Lists, visit the Posix ACLs for
86 Linux website <http://acl.bestbits.at/>.
87
88 If you don't know what Access Control Lists are, say N 84 If you don't know what Access Control Lists are, say N
89 85
90config JFFS2_FS_SECURITY 86config JFFS2_FS_SECURITY
diff --git a/fs/jfs/Kconfig b/fs/jfs/Kconfig
index 57cef19951db..851de78fdabb 100644
--- a/fs/jfs/Kconfig
+++ b/fs/jfs/Kconfig
@@ -16,9 +16,6 @@ config JFS_POSIX_ACL
16 Posix Access Control Lists (ACLs) support permissions for users and 16 Posix Access Control Lists (ACLs) support permissions for users and
17 groups beyond the owner/group/world scheme. 17 groups beyond the owner/group/world scheme.
18 18
19 To learn more about Access Control Lists, visit the Posix ACLs for
20 Linux website <http://acl.bestbits.at/>.
21
22 If you don't know what Access Control Lists are, say N 19 If you don't know what Access Control Lists are, say N
23 20
24config JFS_SECURITY 21config JFS_SECURITY
diff --git a/fs/reiserfs/Kconfig b/fs/reiserfs/Kconfig
index 7cd46666ba2c..86e71c0caf48 100644
--- a/fs/reiserfs/Kconfig
+++ b/fs/reiserfs/Kconfig
@@ -57,8 +57,7 @@ config REISERFS_FS_XATTR
57 depends on REISERFS_FS 57 depends on REISERFS_FS
58 help 58 help
59 Extended attributes are name:value pairs associated with inodes by 59 Extended attributes are name:value pairs associated with inodes by
60 the kernel or by users (see the attr(5) manual page, or visit 60 the kernel or by users (see the attr(5) manual page for details).
61 <http://acl.bestbits.at/> for details).
62 61
63 If unsure, say N. 62 If unsure, say N.
64 63
@@ -70,9 +69,6 @@ config REISERFS_FS_POSIX_ACL
70 Posix Access Control Lists (ACLs) support permissions for users and 69 Posix Access Control Lists (ACLs) support permissions for users and
71 groups beyond the owner/group/world scheme. 70 groups beyond the owner/group/world scheme.
72 71
73 To learn more about Access Control Lists, visit the Posix ACLs for
74 Linux website <http://acl.bestbits.at/>.
75
76 If you don't know what Access Control Lists are, say N 72 If you don't know what Access Control Lists are, say N
77 73
78config REISERFS_FS_SECURITY 74config REISERFS_FS_SECURITY
diff --git a/fs/xfs/Kconfig b/fs/xfs/Kconfig
index f42fcf1b5465..46bcf0e649f5 100644
--- a/fs/xfs/Kconfig
+++ b/fs/xfs/Kconfig
@@ -48,9 +48,6 @@ config XFS_POSIX_ACL
48 POSIX Access Control Lists (ACLs) support permissions for users and 48 POSIX Access Control Lists (ACLs) support permissions for users and
49 groups beyond the owner/group/world scheme. 49 groups beyond the owner/group/world scheme.
50 50
51 To learn more about Access Control Lists, visit the POSIX ACLs for
52 Linux website <http://acl.bestbits.at/>.
53
54 If you don't know what Access Control Lists are, say N. 51 If you don't know what Access Control Lists are, say N.
55 52
56config XFS_RT 53config XFS_RT
diff --git a/include/linux/errseq.h b/include/linux/errseq.h
index 6ffae9c5052d..fc2777770768 100644
--- a/include/linux/errseq.h
+++ b/include/linux/errseq.h
@@ -1,6 +1,6 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 */
2/* 2/*
3 * See Documentation/errseq.rst and lib/errseq.c 3 * See Documentation/core-api/errseq.rst and lib/errseq.c
4 */ 4 */
5#ifndef _LINUX_ERRSEQ_H 5#ifndef _LINUX_ERRSEQ_H
6#define _LINUX_ERRSEQ_H 6#define _LINUX_ERRSEQ_H
diff --git a/include/linux/refcount.h b/include/linux/refcount.h
index e8286585e149..4193c41e383a 100644
--- a/include/linux/refcount.h
+++ b/include/linux/refcount.h
@@ -8,7 +8,7 @@
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9 9
10/** 10/**
11 * refcount_t - variant of atomic_t specialized for reference counts 11 * struct refcount_t - variant of atomic_t specialized for reference counts
12 * @refs: atomic_t counter field 12 * @refs: atomic_t counter field
13 * 13 *
14 * The counter saturates at UINT_MAX and will not move once 14 * The counter saturates at UINT_MAX and will not move once
diff --git a/lib/errseq.c b/lib/errseq.c
index 79cc66897db4..df782418b333 100644
--- a/lib/errseq.c
+++ b/lib/errseq.c
@@ -46,14 +46,14 @@
46 * @eseq: errseq_t field that should be set 46 * @eseq: errseq_t field that should be set
47 * @err: error to set (must be between -1 and -MAX_ERRNO) 47 * @err: error to set (must be between -1 and -MAX_ERRNO)
48 * 48 *
49 * This function sets the error in *eseq, and increments the sequence counter 49 * This function sets the error in @eseq, and increments the sequence counter
50 * if the last sequence was sampled at some point in the past. 50 * if the last sequence was sampled at some point in the past.
51 * 51 *
52 * Any error set will always overwrite an existing error. 52 * Any error set will always overwrite an existing error.
53 * 53 *
54 * We do return the latest value here, primarily for debugging purposes. The 54 * Return: The previous value, primarily for debugging purposes. The
55 * return value should not be used as a previously sampled value in later calls 55 * return value should not be used as a previously sampled value in later
56 * as it will not have the SEEN flag set. 56 * calls as it will not have the SEEN flag set.
57 */ 57 */
58errseq_t errseq_set(errseq_t *eseq, int err) 58errseq_t errseq_set(errseq_t *eseq, int err)
59{ 59{
@@ -108,11 +108,13 @@ errseq_t errseq_set(errseq_t *eseq, int err)
108EXPORT_SYMBOL(errseq_set); 108EXPORT_SYMBOL(errseq_set);
109 109
110/** 110/**
111 * errseq_sample - grab current errseq_t value 111 * errseq_sample() - Grab current errseq_t value.
112 * @eseq: pointer to errseq_t to be sampled 112 * @eseq: Pointer to errseq_t to be sampled.
113 * 113 *
114 * This function allows callers to sample an errseq_t value, marking it as 114 * This function allows callers to sample an errseq_t value, marking it as
115 * "seen" if required. 115 * "seen" if required.
116 *
117 * Return: The current errseq value.
116 */ 118 */
117errseq_t errseq_sample(errseq_t *eseq) 119errseq_t errseq_sample(errseq_t *eseq)
118{ 120{
@@ -134,15 +136,15 @@ errseq_t errseq_sample(errseq_t *eseq)
134EXPORT_SYMBOL(errseq_sample); 136EXPORT_SYMBOL(errseq_sample);
135 137
136/** 138/**
137 * errseq_check - has an error occurred since a particular sample point? 139 * errseq_check() - Has an error occurred since a particular sample point?
138 * @eseq: pointer to errseq_t value to be checked 140 * @eseq: Pointer to errseq_t value to be checked.
139 * @since: previously-sampled errseq_t from which to check 141 * @since: Previously-sampled errseq_t from which to check.
140 * 142 *
141 * Grab the value that eseq points to, and see if it has changed "since" 143 * Grab the value that eseq points to, and see if it has changed @since
142 * the given value was sampled. The "since" value is not advanced, so there 144 * the given value was sampled. The @since value is not advanced, so there
143 * is no need to mark the value as seen. 145 * is no need to mark the value as seen.
144 * 146 *
145 * Returns the latest error set in the errseq_t or 0 if it hasn't changed. 147 * Return: The latest error set in the errseq_t or 0 if it hasn't changed.
146 */ 148 */
147int errseq_check(errseq_t *eseq, errseq_t since) 149int errseq_check(errseq_t *eseq, errseq_t since)
148{ 150{
@@ -155,11 +157,11 @@ int errseq_check(errseq_t *eseq, errseq_t since)
155EXPORT_SYMBOL(errseq_check); 157EXPORT_SYMBOL(errseq_check);
156 158
157/** 159/**
158 * errseq_check_and_advance - check an errseq_t and advance to current value 160 * errseq_check_and_advance() - Check an errseq_t and advance to current value.
159 * @eseq: pointer to value being checked and reported 161 * @eseq: Pointer to value being checked and reported.
160 * @since: pointer to previously-sampled errseq_t to check against and advance 162 * @since: Pointer to previously-sampled errseq_t to check against and advance.
161 * 163 *
162 * Grab the eseq value, and see whether it matches the value that "since" 164 * Grab the eseq value, and see whether it matches the value that @since
163 * points to. If it does, then just return 0. 165 * points to. If it does, then just return 0.
164 * 166 *
165 * If it doesn't, then the value has changed. Set the "seen" flag, and try to 167 * If it doesn't, then the value has changed. Set the "seen" flag, and try to
@@ -170,6 +172,9 @@ EXPORT_SYMBOL(errseq_check);
170 * value. The caller must provide that if necessary. Because of this, callers 172 * value. The caller must provide that if necessary. Because of this, callers
171 * may want to do a lockless errseq_check before taking the lock and calling 173 * may want to do a lockless errseq_check before taking the lock and calling
172 * this. 174 * this.
175 *
176 * Return: Negative errno if one has been stored, or 0 if no new error has
177 * occurred.
173 */ 178 */
174int errseq_check_and_advance(errseq_t *eseq, errseq_t *since) 179int errseq_check_and_advance(errseq_t *eseq, errseq_t *since)
175{ 180{
diff --git a/lib/uuid.c b/lib/uuid.c
index 680b9fb9ba09..2290b9f001a9 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -29,15 +29,14 @@ EXPORT_SYMBOL(uuid_null);
29const u8 guid_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15}; 29const u8 guid_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
30const u8 uuid_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; 30const u8 uuid_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
31 31
32/*************************************************************** 32/**
33 * generate_random_uuid - generate a random UUID
34 * @uuid: where to put the generated UUID
35 *
33 * Random UUID interface 36 * Random UUID interface
34 * 37 *
35 * Used here for a Boot ID, but can be useful for other kernel 38 * Used to create a Boot ID or a filesystem UUID/GUID, but can be
36 * drivers. 39 * useful for other kernel drivers.
37 ***************************************************************/
38
39/*
40 * Generate random UUID
41 */ 40 */
42void generate_random_uuid(unsigned char uuid[16]) 41void generate_random_uuid(unsigned char uuid[16])
43{ 42{
@@ -73,16 +72,17 @@ void uuid_gen(uuid_t *bu)
73EXPORT_SYMBOL_GPL(uuid_gen); 72EXPORT_SYMBOL_GPL(uuid_gen);
74 73
75/** 74/**
76 * uuid_is_valid - checks if UUID string valid 75 * uuid_is_valid - checks if a UUID string is valid
77 * @uuid: UUID string to check 76 * @uuid: UUID string to check
78 * 77 *
79 * Description: 78 * Description:
80 * It checks if the UUID string is following the format: 79 * It checks if the UUID string is following the format:
81 * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 80 * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
82 * where x is a hex digit. 81 *
83 * 82 * where x is a hex digit.
84 * Return: true if input is valid UUID string. 83 *
85 */ 84 * Return: true if input is valid UUID string.
85 */
86bool uuid_is_valid(const char *uuid) 86bool uuid_is_valid(const char *uuid)
87{ 87{
88 unsigned int i; 88 unsigned int i;
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 01c3957b2de6..2b18135446dc 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1834,7 +1834,8 @@ static char *ptr_to_id(char *buf, char *end, void *ptr, struct printf_spec spec)
1834 * 1834 *
1835 * - 'x' For printing the address. Equivalent to "%lx". 1835 * - 'x' For printing the address. Equivalent to "%lx".
1836 * 1836 *
1837 * ** Please update also Documentation/printk-formats.txt when making changes ** 1837 * ** When making changes please also update:
1838 * Documentation/core-api/printk-formats.rst
1838 * 1839 *
1839 * Note: The difference between 'S' and 'F' is that on ia64 and ppc64 1840 * Note: The difference between 'S' and 'F' is that on ia64 and ppc64
1840 * function pointers are really function descriptors, which contain a 1841 * function pointers are really function descriptors, which contain a
@@ -2194,7 +2195,7 @@ set_precision(struct printf_spec *spec, int prec)
2194 * - ``%n`` is unsupported 2195 * - ``%n`` is unsupported
2195 * - ``%p*`` is handled by pointer() 2196 * - ``%p*`` is handled by pointer()
2196 * 2197 *
2197 * See pointer() or Documentation/printk-formats.txt for more 2198 * See pointer() or Documentation/core-api/printk-formats.rst for more
2198 * extensive description. 2199 * extensive description.
2199 * 2200 *
2200 * **Please update the documentation in both places when making changes** 2201 * **Please update the documentation in both places when making changes**
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index df0f045a9a89..fee8952037b1 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -48,16 +48,11 @@ Read C language source or header FILEs, extract embedded documentation comments,
48and print formatted documentation to standard output. 48and print formatted documentation to standard output.
49 49
50The documentation comments are identified by "/**" opening comment mark. See 50The documentation comments are identified by "/**" opening comment mark. See
51Documentation/kernel-doc-nano-HOWTO.txt for the documentation comment syntax. 51Documentation/doc-guide/kernel-doc.rst for the documentation comment syntax.
52 52
53Output format selection (mutually exclusive): 53Output format selection (mutually exclusive):
54 -docbook Output DocBook format.
55 -html Output HTML format.
56 -html5 Output HTML5 format.
57 -list Output symbol list format. This is for use by docproc.
58 -man Output troff manual page format. This is the default. 54 -man Output troff manual page format. This is the default.
59 -rst Output reStructuredText format. 55 -rst Output reStructuredText format.
60 -text Output plain text format.
61 -none Do not output documentation, only warnings. 56 -none Do not output documentation, only warnings.
62 57
63Output selection (mutually exclusive): 58Output selection (mutually exclusive):
@@ -216,7 +211,7 @@ my $anon_struct_union = 0;
216my $type_constant = '\b``([^\`]+)``\b'; 211my $type_constant = '\b``([^\`]+)``\b';
217my $type_constant2 = '\%([-_\w]+)'; 212my $type_constant2 = '\%([-_\w]+)';
218my $type_func = '(\w+)\(\)'; 213my $type_func = '(\w+)\(\)';
219my $type_param = '\@(\w+(\.\.\.)?)'; 214my $type_param = '\@(\w*(\.\w+)*(\.\.\.)?)';
220my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params 215my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params
221my $type_env = '(\$\w+)'; 216my $type_env = '(\$\w+)';
222my $type_enum = '\&(enum\s*([_\w]+))'; 217my $type_enum = '\&(enum\s*([_\w]+))';
@@ -225,84 +220,11 @@ my $type_typedef = '\&(typedef\s*([_\w]+))';
225my $type_union = '\&(union\s*([_\w]+))'; 220my $type_union = '\&(union\s*([_\w]+))';
226my $type_member = '\&([_\w]+)(\.|->)([_\w]+)'; 221my $type_member = '\&([_\w]+)(\.|->)([_\w]+)';
227my $type_fallback = '\&([_\w]+)'; 222my $type_fallback = '\&([_\w]+)';
228my $type_enum_xml = '\&amp;(enum\s*([_\w]+))';
229my $type_struct_xml = '\&amp;(struct\s*([_\w]+))';
230my $type_typedef_xml = '\&amp;(typedef\s*([_\w]+))';
231my $type_union_xml = '\&amp;(union\s*([_\w]+))';
232my $type_member_xml = '\&amp;([_\w]+)(\.|-\&gt;)([_\w]+)';
233my $type_fallback_xml = '\&amp([_\w]+)';
234my $type_member_func = $type_member . '\(\)'; 223my $type_member_func = $type_member . '\(\)';
235 224
236# Output conversion substitutions. 225# Output conversion substitutions.
237# One for each output format 226# One for each output format
238 227
239# these work fairly well
240my @highlights_html = (
241 [$type_constant, "<i>\$1</i>"],
242 [$type_constant2, "<i>\$1</i>"],
243 [$type_func, "<b>\$1</b>"],
244 [$type_enum_xml, "<i>\$1</i>"],
245 [$type_struct_xml, "<i>\$1</i>"],
246 [$type_typedef_xml, "<i>\$1</i>"],
247 [$type_union_xml, "<i>\$1</i>"],
248 [$type_env, "<b><i>\$1</i></b>"],
249 [$type_param, "<tt><b>\$1</b></tt>"],
250 [$type_member_xml, "<tt><i>\$1</i>\$2\$3</tt>"],
251 [$type_fallback_xml, "<i>\$1</i>"]
252 );
253my $local_lt = "\\\\\\\\lt:";
254my $local_gt = "\\\\\\\\gt:";
255my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>"
256
257# html version 5
258my @highlights_html5 = (
259 [$type_constant, "<span class=\"const\">\$1</span>"],
260 [$type_constant2, "<span class=\"const\">\$1</span>"],
261 [$type_func, "<span class=\"func\">\$1</span>"],
262 [$type_enum_xml, "<span class=\"enum\">\$1</span>"],
263 [$type_struct_xml, "<span class=\"struct\">\$1</span>"],
264 [$type_typedef_xml, "<span class=\"typedef\">\$1</span>"],
265 [$type_union_xml, "<span class=\"union\">\$1</span>"],
266 [$type_env, "<span class=\"env\">\$1</span>"],
267 [$type_param, "<span class=\"param\">\$1</span>]"],
268 [$type_member_xml, "<span class=\"literal\"><span class=\"struct\">\$1</span>\$2<span class=\"member\">\$3</span></span>"],
269 [$type_fallback_xml, "<span class=\"struct\">\$1</span>"]
270 );
271my $blankline_html5 = $local_lt . "br /" . $local_gt;
272
273# XML, docbook format
274my @highlights_xml = (
275 ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"],
276 [$type_constant, "<constant>\$1</constant>"],
277 [$type_constant2, "<constant>\$1</constant>"],
278 [$type_enum_xml, "<type>\$1</type>"],
279 [$type_struct_xml, "<structname>\$1</structname>"],
280 [$type_typedef_xml, "<type>\$1</type>"],
281 [$type_union_xml, "<structname>\$1</structname>"],
282 [$type_param, "<parameter>\$1</parameter>"],
283 [$type_func, "<function>\$1</function>"],
284 [$type_env, "<envar>\$1</envar>"],
285 [$type_member_xml, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"],
286 [$type_fallback_xml, "<structname>\$1</structname>"]
287 );
288my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n";
289
290# gnome, docbook format
291my @highlights_gnome = (
292 [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"],
293 [$type_constant2, "<replaceable class=\"option\">\$1</replaceable>"],
294 [$type_func, "<function>\$1</function>"],
295 [$type_enum, "<type>\$1</type>"],
296 [$type_struct, "<structname>\$1</structname>"],
297 [$type_typedef, "<type>\$1</type>"],
298 [$type_union, "<structname>\$1</structname>"],
299 [$type_env, "<envar>\$1</envar>"],
300 [$type_param, "<parameter>\$1</parameter>" ],
301 [$type_member, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"],
302 [$type_fallback, "<structname>\$1</structname>"]
303 );
304my $blankline_gnome = "</para><para>\n";
305
306# these are pretty rough 228# these are pretty rough
307my @highlights_man = ( 229my @highlights_man = (
308 [$type_constant, "\$1"], 230 [$type_constant, "\$1"],
@@ -318,21 +240,6 @@ my @highlights_man = (
318 ); 240 );
319my $blankline_man = ""; 241my $blankline_man = "";
320 242
321# text-mode
322my @highlights_text = (
323 [$type_constant, "\$1"],
324 [$type_constant2, "\$1"],
325 [$type_func, "\$1"],
326 [$type_enum, "\$1"],
327 [$type_struct, "\$1"],
328 [$type_typedef, "\$1"],
329 [$type_union, "\$1"],
330 [$type_param, "\$1"],
331 [$type_member, "\$1\$2\$3"],
332 [$type_fallback, "\$1"]
333 );
334my $blankline_text = "";
335
336# rst-mode 243# rst-mode
337my @highlights_rst = ( 244my @highlights_rst = (
338 [$type_constant, "``\$1``"], 245 [$type_constant, "``\$1``"],
@@ -352,21 +259,6 @@ my @highlights_rst = (
352 ); 259 );
353my $blankline_rst = "\n"; 260my $blankline_rst = "\n";
354 261
355# list mode
356my @highlights_list = (
357 [$type_constant, "\$1"],
358 [$type_constant2, "\$1"],
359 [$type_func, "\$1"],
360 [$type_enum, "\$1"],
361 [$type_struct, "\$1"],
362 [$type_typedef, "\$1"],
363 [$type_union, "\$1"],
364 [$type_param, "\$1"],
365 [$type_member, "\$1"],
366 [$type_fallback, "\$1"]
367 );
368my $blankline_list = "";
369
370# read arguments 262# read arguments
371if ($#ARGV == -1) { 263if ($#ARGV == -1) {
372 usage(); 264 usage();
@@ -376,12 +268,12 @@ my $kernelversion;
376my $dohighlight = ""; 268my $dohighlight = "";
377 269
378my $verbose = 0; 270my $verbose = 0;
379my $output_mode = "man"; 271my $output_mode = "rst";
380my $output_preformatted = 0; 272my $output_preformatted = 0;
381my $no_doc_sections = 0; 273my $no_doc_sections = 0;
382my $enable_lineno = 0; 274my $enable_lineno = 0;
383my @highlights = @highlights_man; 275my @highlights = @highlights_rst;
384my $blankline = $blankline_man; 276my $blankline = $blankline_rst;
385my $modulename = "Kernel API"; 277my $modulename = "Kernel API";
386 278
387use constant { 279use constant {
@@ -499,71 +391,51 @@ my $undescribed = "-- undescribed --";
499 391
500reset_state(); 392reset_state();
501 393
502while ($ARGV[0] =~ m/^-(.*)/) { 394while ($ARGV[0] =~ m/^--?(.*)/) {
503 my $cmd = shift @ARGV; 395 my $cmd = $1;
504 if ($cmd eq "-html") { 396 shift @ARGV;
505 $output_mode = "html"; 397 if ($cmd eq "man") {
506 @highlights = @highlights_html;
507 $blankline = $blankline_html;
508 } elsif ($cmd eq "-html5") {
509 $output_mode = "html5";
510 @highlights = @highlights_html5;
511 $blankline = $blankline_html5;
512 } elsif ($cmd eq "-man") {
513 $output_mode = "man"; 398 $output_mode = "man";
514 @highlights = @highlights_man; 399 @highlights = @highlights_man;
515 $blankline = $blankline_man; 400 $blankline = $blankline_man;
516 } elsif ($cmd eq "-text") { 401 } elsif ($cmd eq "rst") {
517 $output_mode = "text";
518 @highlights = @highlights_text;
519 $blankline = $blankline_text;
520 } elsif ($cmd eq "-rst") {
521 $output_mode = "rst"; 402 $output_mode = "rst";
522 @highlights = @highlights_rst; 403 @highlights = @highlights_rst;
523 $blankline = $blankline_rst; 404 $blankline = $blankline_rst;
524 } elsif ($cmd eq "-docbook") { 405 } elsif ($cmd eq "none") {
525 $output_mode = "xml";
526 @highlights = @highlights_xml;
527 $blankline = $blankline_xml;
528 } elsif ($cmd eq "-list") {
529 $output_mode = "list";
530 @highlights = @highlights_list;
531 $blankline = $blankline_list;
532 } elsif ($cmd eq "-gnome") {
533 $output_mode = "gnome";
534 @highlights = @highlights_gnome;
535 $blankline = $blankline_gnome;
536 } elsif ($cmd eq "-none") {
537 $output_mode = "none"; 406 $output_mode = "none";
538 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document 407 } elsif ($cmd eq "module") { # not needed for XML, inherits from calling document
539 $modulename = shift @ARGV; 408 $modulename = shift @ARGV;
540 } elsif ($cmd eq "-function") { # to only output specific functions 409 } elsif ($cmd eq "function") { # to only output specific functions
541 $output_selection = OUTPUT_INCLUDE; 410 $output_selection = OUTPUT_INCLUDE;
542 $function = shift @ARGV; 411 $function = shift @ARGV;
543 $function_table{$function} = 1; 412 $function_table{$function} = 1;
544 } elsif ($cmd eq "-nofunction") { # output all except specific functions 413 } elsif ($cmd eq "nofunction") { # output all except specific functions
545 $output_selection = OUTPUT_EXCLUDE; 414 $output_selection = OUTPUT_EXCLUDE;
546 $function = shift @ARGV; 415 $function = shift @ARGV;
547 $function_table{$function} = 1; 416 $function_table{$function} = 1;
548 } elsif ($cmd eq "-export") { # only exported symbols 417 } elsif ($cmd eq "export") { # only exported symbols
549 $output_selection = OUTPUT_EXPORTED; 418 $output_selection = OUTPUT_EXPORTED;
550 %function_table = (); 419 %function_table = ();
551 } elsif ($cmd eq "-internal") { # only non-exported symbols 420 } elsif ($cmd eq "internal") { # only non-exported symbols
552 $output_selection = OUTPUT_INTERNAL; 421 $output_selection = OUTPUT_INTERNAL;
553 %function_table = (); 422 %function_table = ();
554 } elsif ($cmd eq "-export-file") { 423 } elsif ($cmd eq "export-file") {
555 my $file = shift @ARGV; 424 my $file = shift @ARGV;
556 push(@export_file_list, $file); 425 push(@export_file_list, $file);
557 } elsif ($cmd eq "-v") { 426 } elsif ($cmd eq "v") {
558 $verbose = 1; 427 $verbose = 1;
559 } elsif (($cmd eq "-h") || ($cmd eq "--help")) { 428 } elsif (($cmd eq "h") || ($cmd eq "help")) {
560 usage(); 429 usage();
561 } elsif ($cmd eq '-no-doc-sections') { 430 } elsif ($cmd eq 'no-doc-sections') {
562 $no_doc_sections = 1; 431 $no_doc_sections = 1;
563 } elsif ($cmd eq '-enable-lineno') { 432 } elsif ($cmd eq 'enable-lineno') {
564 $enable_lineno = 1; 433 $enable_lineno = 1;
565 } elsif ($cmd eq '-show-not-found') { 434 } elsif ($cmd eq 'show-not-found') {
566 $show_not_found = 1; 435 $show_not_found = 1;
436 } else {
437 # Unknown argument
438 usage();
567 } 439 }
568} 440}
569 441
@@ -670,22 +542,11 @@ sub output_highlight {
670# confess "output_highlight got called with no args?\n"; 542# confess "output_highlight got called with no args?\n";
671# } 543# }
672 544
673 if ($output_mode eq "html" || $output_mode eq "html5" ||
674 $output_mode eq "xml") {
675 $contents = local_unescape($contents);
676 # convert data read & converted thru xml_escape() into &xyz; format:
677 $contents =~ s/\\\\\\/\&/g;
678 }
679# print STDERR "contents b4:$contents\n"; 545# print STDERR "contents b4:$contents\n";
680 eval $dohighlight; 546 eval $dohighlight;
681 die $@ if $@; 547 die $@ if $@;
682# print STDERR "contents af:$contents\n"; 548# print STDERR "contents af:$contents\n";
683 549
684# strip whitespaces when generating html5
685 if ($output_mode eq "html5") {
686 $contents =~ s/^\s+//;
687 $contents =~ s/\s+$//;
688 }
689 foreach $line (split "\n", $contents) { 550 foreach $line (split "\n", $contents) {
690 if (! $output_preformatted) { 551 if (! $output_preformatted) {
691 $line =~ s/^\s*//; 552 $line =~ s/^\s*//;
@@ -706,817 +567,6 @@ sub output_highlight {
706 } 567 }
707} 568}
708 569
709# output sections in html
710sub output_section_html(%) {
711 my %args = %{$_[0]};
712 my $section;
713
714 foreach $section (@{$args{'sectionlist'}}) {
715 print "<h3>$section</h3>\n";
716 print "<blockquote>\n";
717 output_highlight($args{'sections'}{$section});
718 print "</blockquote>\n";
719 }
720}
721
722# output enum in html
723sub output_enum_html(%) {
724 my %args = %{$_[0]};
725 my ($parameter);
726 my $count;
727 print "<h2>enum " . $args{'enum'} . "</h2>\n";
728
729 print "<b>enum " . $args{'enum'} . "</b> {<br>\n";
730 $count = 0;
731 foreach $parameter (@{$args{'parameterlist'}}) {
732 print " <b>" . $parameter . "</b>";
733 if ($count != $#{$args{'parameterlist'}}) {
734 $count++;
735 print ",\n";
736 }
737 print "<br>";
738 }
739 print "};<br>\n";
740
741 print "<h3>Constants</h3>\n";
742 print "<dl>\n";
743 foreach $parameter (@{$args{'parameterlist'}}) {
744 print "<dt><b>" . $parameter . "</b>\n";
745 print "<dd>";
746 output_highlight($args{'parameterdescs'}{$parameter});
747 }
748 print "</dl>\n";
749 output_section_html(@_);
750 print "<hr>\n";
751}
752
753# output typedef in html
754sub output_typedef_html(%) {
755 my %args = %{$_[0]};
756 my ($parameter);
757 my $count;
758 print "<h2>typedef " . $args{'typedef'} . "</h2>\n";
759
760 print "<b>typedef " . $args{'typedef'} . "</b>\n";
761 output_section_html(@_);
762 print "<hr>\n";
763}
764
765# output struct in html
766sub output_struct_html(%) {
767 my %args = %{$_[0]};
768 my ($parameter);
769
770 print "<h2>" . $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "</h2>\n";
771 print "<b>" . $args{'type'} . " " . $args{'struct'} . "</b> {<br>\n";
772 foreach $parameter (@{$args{'parameterlist'}}) {
773 if ($parameter =~ /^#/) {
774 print "$parameter<br>\n";
775 next;
776 }
777 my $parameter_name = $parameter;
778 $parameter_name =~ s/\[.*//;
779
780 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
781 $type = $args{'parametertypes'}{$parameter};
782 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
783 # pointer-to-function
784 print "&nbsp; &nbsp; <i>$1</i><b>$parameter</b>) <i>($2)</i>;<br>\n";
785 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
786 # bitfield
787 print "&nbsp; &nbsp; <i>$1</i> <b>$parameter</b>$2;<br>\n";
788 } else {
789 print "&nbsp; &nbsp; <i>$type</i> <b>$parameter</b>;<br>\n";
790 }
791 }
792 print "};<br>\n";
793
794 print "<h3>Members</h3>\n";
795 print "<dl>\n";
796 foreach $parameter (@{$args{'parameterlist'}}) {
797 ($parameter =~ /^#/) && next;
798
799 my $parameter_name = $parameter;
800 $parameter_name =~ s/\[.*//;
801
802 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
803 print "<dt><b>" . $parameter . "</b>\n";
804 print "<dd>";
805 output_highlight($args{'parameterdescs'}{$parameter_name});
806 }
807 print "</dl>\n";
808 output_section_html(@_);
809 print "<hr>\n";
810}
811
812# output function in html
813sub output_function_html(%) {
814 my %args = %{$_[0]};
815 my ($parameter, $section);
816 my $count;
817
818 print "<h2>" . $args{'function'} . " - " . $args{'purpose'} . "</h2>\n";
819 print "<i>" . $args{'functiontype'} . "</i>\n";
820 print "<b>" . $args{'function'} . "</b>\n";
821 print "(";
822 $count = 0;
823 foreach $parameter (@{$args{'parameterlist'}}) {
824 $type = $args{'parametertypes'}{$parameter};
825 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
826 # pointer-to-function
827 print "<i>$1</i><b>$parameter</b>) <i>($2)</i>";
828 } else {
829 print "<i>" . $type . "</i> <b>" . $parameter . "</b>";
830 }
831 if ($count != $#{$args{'parameterlist'}}) {
832 $count++;
833 print ",\n";
834 }
835 }
836 print ")\n";
837
838 print "<h3>Arguments</h3>\n";
839 print "<dl>\n";
840 foreach $parameter (@{$args{'parameterlist'}}) {
841 my $parameter_name = $parameter;
842 $parameter_name =~ s/\[.*//;
843
844 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
845 print "<dt><b>" . $parameter . "</b>\n";
846 print "<dd>";
847 output_highlight($args{'parameterdescs'}{$parameter_name});
848 }
849 print "</dl>\n";
850 output_section_html(@_);
851 print "<hr>\n";
852}
853
854# output DOC: block header in html
855sub output_blockhead_html(%) {
856 my %args = %{$_[0]};
857 my ($parameter, $section);
858 my $count;
859
860 foreach $section (@{$args{'sectionlist'}}) {
861 print "<h3>$section</h3>\n";
862 print "<ul>\n";
863 output_highlight($args{'sections'}{$section});
864 print "</ul>\n";
865 }
866 print "<hr>\n";
867}
868
869# output sections in html5
870sub output_section_html5(%) {
871 my %args = %{$_[0]};
872 my $section;
873
874 foreach $section (@{$args{'sectionlist'}}) {
875 print "<section>\n";
876 print "<h1>$section</h1>\n";
877 print "<p>\n";
878 output_highlight($args{'sections'}{$section});
879 print "</p>\n";
880 print "</section>\n";
881 }
882}
883
884# output enum in html5
885sub output_enum_html5(%) {
886 my %args = %{$_[0]};
887 my ($parameter);
888 my $count;
889 my $html5id;
890
891 $html5id = $args{'enum'};
892 $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
893 print "<article class=\"enum\" id=\"enum:". $html5id . "\">";
894 print "<h1>enum " . $args{'enum'} . "</h1>\n";
895 print "<ol class=\"code\">\n";
896 print "<li>";
897 print "<span class=\"keyword\">enum</span> ";
898 print "<span class=\"identifier\">" . $args{'enum'} . "</span> {";
899 print "</li>\n";
900 $count = 0;
901 foreach $parameter (@{$args{'parameterlist'}}) {
902 print "<li class=\"indent\">";
903 print "<span class=\"param\">" . $parameter . "</span>";
904 if ($count != $#{$args{'parameterlist'}}) {
905 $count++;
906 print ",";
907 }
908 print "</li>\n";
909 }
910 print "<li>};</li>\n";
911 print "</ol>\n";
912
913 print "<section>\n";
914 print "<h1>Constants</h1>\n";
915 print "<dl>\n";
916 foreach $parameter (@{$args{'parameterlist'}}) {
917 print "<dt>" . $parameter . "</dt>\n";
918 print "<dd>";
919 output_highlight($args{'parameterdescs'}{$parameter});
920 print "</dd>\n";
921 }
922 print "</dl>\n";
923 print "</section>\n";
924 output_section_html5(@_);
925 print "</article>\n";
926}
927
928# output typedef in html5
929sub output_typedef_html5(%) {
930 my %args = %{$_[0]};
931 my ($parameter);
932 my $count;
933 my $html5id;
934
935 $html5id = $args{'typedef'};
936 $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
937 print "<article class=\"typedef\" id=\"typedef:" . $html5id . "\">\n";
938 print "<h1>typedef " . $args{'typedef'} . "</h1>\n";
939
940 print "<ol class=\"code\">\n";
941 print "<li>";
942 print "<span class=\"keyword\">typedef</span> ";
943 print "<span class=\"identifier\">" . $args{'typedef'} . "</span>";
944 print "</li>\n";
945 print "</ol>\n";
946 output_section_html5(@_);
947 print "</article>\n";
948}
949
950# output struct in html5
951sub output_struct_html5(%) {
952 my %args = %{$_[0]};
953 my ($parameter);
954 my $html5id;
955
956 $html5id = $args{'struct'};
957 $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
958 print "<article class=\"struct\" id=\"struct:" . $html5id . "\">\n";
959 print "<hgroup>\n";
960 print "<h1>" . $args{'type'} . " " . $args{'struct'} . "</h1>";
961 print "<h2>". $args{'purpose'} . "</h2>\n";
962 print "</hgroup>\n";
963 print "<ol class=\"code\">\n";
964 print "<li>";
965 print "<span class=\"type\">" . $args{'type'} . "</span> ";
966 print "<span class=\"identifier\">" . $args{'struct'} . "</span> {";
967 print "</li>\n";
968 foreach $parameter (@{$args{'parameterlist'}}) {
969 print "<li class=\"indent\">";
970 if ($parameter =~ /^#/) {
971 print "<span class=\"param\">" . $parameter ."</span>\n";
972 print "</li>\n";
973 next;
974 }
975 my $parameter_name = $parameter;
976 $parameter_name =~ s/\[.*//;
977
978 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
979 $type = $args{'parametertypes'}{$parameter};
980 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
981 # pointer-to-function
982 print "<span class=\"type\">$1</span> ";
983 print "<span class=\"param\">$parameter</span>";
984 print "<span class=\"type\">)</span> ";
985 print "(<span class=\"args\">$2</span>);";
986 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
987 # bitfield
988 print "<span class=\"type\">$1</span> ";
989 print "<span class=\"param\">$parameter</span>";
990 print "<span class=\"bits\">$2</span>;";
991 } else {
992 print "<span class=\"type\">$type</span> ";
993 print "<span class=\"param\">$parameter</span>;";
994 }
995 print "</li>\n";
996 }
997 print "<li>};</li>\n";
998 print "</ol>\n";
999
1000 print "<section>\n";
1001 print "<h1>Members</h1>\n";
1002 print "<dl>\n";
1003 foreach $parameter (@{$args{'parameterlist'}}) {
1004 ($parameter =~ /^#/) && next;
1005
1006 my $parameter_name = $parameter;
1007 $parameter_name =~ s/\[.*//;
1008
1009 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1010 print "<dt>" . $parameter . "</dt>\n";
1011 print "<dd>";
1012 output_highlight($args{'parameterdescs'}{$parameter_name});
1013 print "</dd>\n";
1014 }
1015 print "</dl>\n";
1016 print "</section>\n";
1017 output_section_html5(@_);
1018 print "</article>\n";
1019}
1020
1021# output function in html5
1022sub output_function_html5(%) {
1023 my %args = %{$_[0]};
1024 my ($parameter, $section);
1025 my $count;
1026 my $html5id;
1027
1028 $html5id = $args{'function'};
1029 $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
1030 print "<article class=\"function\" id=\"func:". $html5id . "\">\n";
1031 print "<hgroup>\n";
1032 print "<h1>" . $args{'function'} . "</h1>";
1033 print "<h2>" . $args{'purpose'} . "</h2>\n";
1034 print "</hgroup>\n";
1035 print "<ol class=\"code\">\n";
1036 print "<li>";
1037 print "<span class=\"type\">" . $args{'functiontype'} . "</span> ";
1038 print "<span class=\"identifier\">" . $args{'function'} . "</span> (";
1039 print "</li>";
1040 $count = 0;
1041 foreach $parameter (@{$args{'parameterlist'}}) {
1042 print "<li class=\"indent\">";
1043 $type = $args{'parametertypes'}{$parameter};
1044 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1045 # pointer-to-function
1046 print "<span class=\"type\">$1</span> ";
1047 print "<span class=\"param\">$parameter</span>";
1048 print "<span class=\"type\">)</span> ";
1049 print "(<span class=\"args\">$2</span>)";
1050 } else {
1051 print "<span class=\"type\">$type</span> ";
1052 print "<span class=\"param\">$parameter</span>";
1053 }
1054 if ($count != $#{$args{'parameterlist'}}) {
1055 $count++;
1056 print ",";
1057 }
1058 print "</li>\n";
1059 }
1060 print "<li>)</li>\n";
1061 print "</ol>\n";
1062
1063 print "<section>\n";
1064 print "<h1>Arguments</h1>\n";
1065 print "<p>\n";
1066 print "<dl>\n";
1067 foreach $parameter (@{$args{'parameterlist'}}) {
1068 my $parameter_name = $parameter;
1069 $parameter_name =~ s/\[.*//;
1070
1071 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1072 print "<dt>" . $parameter . "</dt>\n";
1073 print "<dd>";
1074 output_highlight($args{'parameterdescs'}{$parameter_name});
1075 print "</dd>\n";
1076 }
1077 print "</dl>\n";
1078 print "</section>\n";
1079 output_section_html5(@_);
1080 print "</article>\n";
1081}
1082
1083# output DOC: block header in html5
1084sub output_blockhead_html5(%) {
1085 my %args = %{$_[0]};
1086 my ($parameter, $section);
1087 my $count;
1088 my $html5id;
1089
1090 foreach $section (@{$args{'sectionlist'}}) {
1091 $html5id = $section;
1092 $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
1093 print "<article class=\"doc\" id=\"doc:". $html5id . "\">\n";
1094 print "<h1>$section</h1>\n";
1095 print "<p>\n";
1096 output_highlight($args{'sections'}{$section});
1097 print "</p>\n";
1098 }
1099 print "</article>\n";
1100}
1101
1102sub output_section_xml(%) {
1103 my %args = %{$_[0]};
1104 my $section;
1105 # print out each section
1106 $lineprefix=" ";
1107 foreach $section (@{$args{'sectionlist'}}) {
1108 print "<refsect1>\n";
1109 print "<title>$section</title>\n";
1110 if ($section =~ m/EXAMPLE/i) {
1111 print "<informalexample><programlisting>\n";
1112 $output_preformatted = 1;
1113 } else {
1114 print "<para>\n";
1115 }
1116 output_highlight($args{'sections'}{$section});
1117 $output_preformatted = 0;
1118 if ($section =~ m/EXAMPLE/i) {
1119 print "</programlisting></informalexample>\n";
1120 } else {
1121 print "</para>\n";
1122 }
1123 print "</refsect1>\n";
1124 }
1125}
1126
1127# output function in XML DocBook
1128sub output_function_xml(%) {
1129 my %args = %{$_[0]};
1130 my ($parameter, $section);
1131 my $count;
1132 my $id;
1133
1134 $id = "API-" . $args{'function'};
1135 $id =~ s/[^A-Za-z0-9]/-/g;
1136
1137 print "<refentry id=\"$id\">\n";
1138 print "<refentryinfo>\n";
1139 print " <title>LINUX</title>\n";
1140 print " <productname>Kernel Hackers Manual</productname>\n";
1141 print " <date>$man_date</date>\n";
1142 print "</refentryinfo>\n";
1143 print "<refmeta>\n";
1144 print " <refentrytitle><phrase>" . $args{'function'} . "</phrase></refentrytitle>\n";
1145 print " <manvolnum>9</manvolnum>\n";
1146 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
1147 print "</refmeta>\n";
1148 print "<refnamediv>\n";
1149 print " <refname>" . $args{'function'} . "</refname>\n";
1150 print " <refpurpose>\n";
1151 print " ";
1152 output_highlight ($args{'purpose'});
1153 print " </refpurpose>\n";
1154 print "</refnamediv>\n";
1155
1156 print "<refsynopsisdiv>\n";
1157 print " <title>Synopsis</title>\n";
1158 print " <funcsynopsis><funcprototype>\n";
1159 print " <funcdef>" . $args{'functiontype'} . " ";
1160 print "<function>" . $args{'function'} . " </function></funcdef>\n";
1161
1162 $count = 0;
1163 if ($#{$args{'parameterlist'}} >= 0) {
1164 foreach $parameter (@{$args{'parameterlist'}}) {
1165 $type = $args{'parametertypes'}{$parameter};
1166 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1167 # pointer-to-function
1168 print " <paramdef>$1<parameter>$parameter</parameter>)\n";
1169 print " <funcparams>$2</funcparams></paramdef>\n";
1170 } else {
1171 print " <paramdef>" . $type;
1172 print " <parameter>$parameter</parameter></paramdef>\n";
1173 }
1174 }
1175 } else {
1176 print " <void/>\n";
1177 }
1178 print " </funcprototype></funcsynopsis>\n";
1179 print "</refsynopsisdiv>\n";
1180
1181 # print parameters
1182 print "<refsect1>\n <title>Arguments</title>\n";
1183 if ($#{$args{'parameterlist'}} >= 0) {
1184 print " <variablelist>\n";
1185 foreach $parameter (@{$args{'parameterlist'}}) {
1186 my $parameter_name = $parameter;
1187 $parameter_name =~ s/\[.*//;
1188 $type = $args{'parametertypes'}{$parameter};
1189
1190 print " <varlistentry>\n <term><parameter>$type $parameter</parameter></term>\n";
1191 print " <listitem>\n <para>\n";
1192 $lineprefix=" ";
1193 output_highlight($args{'parameterdescs'}{$parameter_name});
1194 print " </para>\n </listitem>\n </varlistentry>\n";
1195 }
1196 print " </variablelist>\n";
1197 } else {
1198 print " <para>\n None\n </para>\n";
1199 }
1200 print "</refsect1>\n";
1201
1202 output_section_xml(@_);
1203 print "</refentry>\n\n";
1204}
1205
1206# output struct in XML DocBook
1207sub output_struct_xml(%) {
1208 my %args = %{$_[0]};
1209 my ($parameter, $section);
1210 my $id;
1211
1212 $id = "API-struct-" . $args{'struct'};
1213 $id =~ s/[^A-Za-z0-9]/-/g;
1214
1215 print "<refentry id=\"$id\">\n";
1216 print "<refentryinfo>\n";
1217 print " <title>LINUX</title>\n";
1218 print " <productname>Kernel Hackers Manual</productname>\n";
1219 print " <date>$man_date</date>\n";
1220 print "</refentryinfo>\n";
1221 print "<refmeta>\n";
1222 print " <refentrytitle><phrase>" . $args{'type'} . " " . $args{'struct'} . "</phrase></refentrytitle>\n";
1223 print " <manvolnum>9</manvolnum>\n";
1224 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
1225 print "</refmeta>\n";
1226 print "<refnamediv>\n";
1227 print " <refname>" . $args{'type'} . " " . $args{'struct'} . "</refname>\n";
1228 print " <refpurpose>\n";
1229 print " ";
1230 output_highlight ($args{'purpose'});
1231 print " </refpurpose>\n";
1232 print "</refnamediv>\n";
1233
1234 print "<refsynopsisdiv>\n";
1235 print " <title>Synopsis</title>\n";
1236 print " <programlisting>\n";
1237 print $args{'type'} . " " . $args{'struct'} . " {\n";
1238 foreach $parameter (@{$args{'parameterlist'}}) {
1239 if ($parameter =~ /^#/) {
1240 my $prm = $parameter;
1241 # convert data read & converted thru xml_escape() into &xyz; format:
1242 # This allows us to have #define macros interspersed in a struct.
1243 $prm =~ s/\\\\\\/\&/g;
1244 print "$prm\n";
1245 next;
1246 }
1247
1248 my $parameter_name = $parameter;
1249 $parameter_name =~ s/\[.*//;
1250
1251 defined($args{'parameterdescs'}{$parameter_name}) || next;
1252 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1253 $type = $args{'parametertypes'}{$parameter};
1254 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1255 # pointer-to-function
1256 print " $1 $parameter) ($2);\n";
1257 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
1258 # bitfield
1259 print " $1 $parameter$2;\n";
1260 } else {
1261 print " " . $type . " " . $parameter . ";\n";
1262 }
1263 }
1264 print "};";
1265 print " </programlisting>\n";
1266 print "</refsynopsisdiv>\n";
1267
1268 print " <refsect1>\n";
1269 print " <title>Members</title>\n";
1270
1271 if ($#{$args{'parameterlist'}} >= 0) {
1272 print " <variablelist>\n";
1273 foreach $parameter (@{$args{'parameterlist'}}) {
1274 ($parameter =~ /^#/) && next;
1275
1276 my $parameter_name = $parameter;
1277 $parameter_name =~ s/\[.*//;
1278
1279 defined($args{'parameterdescs'}{$parameter_name}) || next;
1280 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1281 $type = $args{'parametertypes'}{$parameter};
1282 print " <varlistentry>";
1283 print " <term><literal>$type $parameter</literal></term>\n";
1284 print " <listitem><para>\n";
1285 output_highlight($args{'parameterdescs'}{$parameter_name});
1286 print " </para></listitem>\n";
1287 print " </varlistentry>\n";
1288 }
1289 print " </variablelist>\n";
1290 } else {
1291 print " <para>\n None\n </para>\n";
1292 }
1293 print " </refsect1>\n";
1294
1295 output_section_xml(@_);
1296
1297 print "</refentry>\n\n";
1298}
1299
1300# output enum in XML DocBook
1301sub output_enum_xml(%) {
1302 my %args = %{$_[0]};
1303 my ($parameter, $section);
1304 my $count;
1305 my $id;
1306
1307 $id = "API-enum-" . $args{'enum'};
1308 $id =~ s/[^A-Za-z0-9]/-/g;
1309
1310 print "<refentry id=\"$id\">\n";
1311 print "<refentryinfo>\n";
1312 print " <title>LINUX</title>\n";
1313 print " <productname>Kernel Hackers Manual</productname>\n";
1314 print " <date>$man_date</date>\n";
1315 print "</refentryinfo>\n";
1316 print "<refmeta>\n";
1317 print " <refentrytitle><phrase>enum " . $args{'enum'} . "</phrase></refentrytitle>\n";
1318 print " <manvolnum>9</manvolnum>\n";
1319 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
1320 print "</refmeta>\n";
1321 print "<refnamediv>\n";
1322 print " <refname>enum " . $args{'enum'} . "</refname>\n";
1323 print " <refpurpose>\n";
1324 print " ";
1325 output_highlight ($args{'purpose'});
1326 print " </refpurpose>\n";
1327 print "</refnamediv>\n";
1328
1329 print "<refsynopsisdiv>\n";
1330 print " <title>Synopsis</title>\n";
1331 print " <programlisting>\n";
1332 print "enum " . $args{'enum'} . " {\n";
1333 $count = 0;
1334 foreach $parameter (@{$args{'parameterlist'}}) {
1335 print " $parameter";
1336 if ($count != $#{$args{'parameterlist'}}) {
1337 $count++;
1338 print ",";
1339 }
1340 print "\n";
1341 }
1342 print "};";
1343 print " </programlisting>\n";
1344 print "</refsynopsisdiv>\n";
1345
1346 print "<refsect1>\n";
1347 print " <title>Constants</title>\n";
1348 print " <variablelist>\n";
1349 foreach $parameter (@{$args{'parameterlist'}}) {
1350 my $parameter_name = $parameter;
1351 $parameter_name =~ s/\[.*//;
1352
1353 print " <varlistentry>";
1354 print " <term>$parameter</term>\n";
1355 print " <listitem><para>\n";
1356 output_highlight($args{'parameterdescs'}{$parameter_name});
1357 print " </para></listitem>\n";
1358 print " </varlistentry>\n";
1359 }
1360 print " </variablelist>\n";
1361 print "</refsect1>\n";
1362
1363 output_section_xml(@_);
1364
1365 print "</refentry>\n\n";
1366}
1367
1368# output typedef in XML DocBook
1369sub output_typedef_xml(%) {
1370 my %args = %{$_[0]};
1371 my ($parameter, $section);
1372 my $id;
1373
1374 $id = "API-typedef-" . $args{'typedef'};
1375 $id =~ s/[^A-Za-z0-9]/-/g;
1376
1377 print "<refentry id=\"$id\">\n";
1378 print "<refentryinfo>\n";
1379 print " <title>LINUX</title>\n";
1380 print " <productname>Kernel Hackers Manual</productname>\n";
1381 print " <date>$man_date</date>\n";
1382 print "</refentryinfo>\n";
1383 print "<refmeta>\n";
1384 print " <refentrytitle><phrase>typedef " . $args{'typedef'} . "</phrase></refentrytitle>\n";
1385 print " <manvolnum>9</manvolnum>\n";
1386 print "</refmeta>\n";
1387 print "<refnamediv>\n";
1388 print " <refname>typedef " . $args{'typedef'} . "</refname>\n";
1389 print " <refpurpose>\n";
1390 print " ";
1391 output_highlight ($args{'purpose'});
1392 print " </refpurpose>\n";
1393 print "</refnamediv>\n";
1394
1395 print "<refsynopsisdiv>\n";
1396 print " <title>Synopsis</title>\n";
1397 print " <synopsis>typedef " . $args{'typedef'} . ";</synopsis>\n";
1398 print "</refsynopsisdiv>\n";
1399
1400 output_section_xml(@_);
1401
1402 print "</refentry>\n\n";
1403}
1404
1405# output in XML DocBook
1406sub output_blockhead_xml(%) {
1407 my %args = %{$_[0]};
1408 my ($parameter, $section);
1409 my $count;
1410
1411 my $id = $args{'module'};
1412 $id =~ s/[^A-Za-z0-9]/-/g;
1413
1414 # print out each section
1415 $lineprefix=" ";
1416 foreach $section (@{$args{'sectionlist'}}) {
1417 if (!$args{'content-only'}) {
1418 print "<refsect1>\n <title>$section</title>\n";
1419 }
1420 if ($section =~ m/EXAMPLE/i) {
1421 print "<example><para>\n";
1422 $output_preformatted = 1;
1423 } else {
1424 print "<para>\n";
1425 }
1426 output_highlight($args{'sections'}{$section});
1427 $output_preformatted = 0;
1428 if ($section =~ m/EXAMPLE/i) {
1429 print "</para></example>\n";
1430 } else {
1431 print "</para>";
1432 }
1433 if (!$args{'content-only'}) {
1434 print "\n</refsect1>\n";
1435 }
1436 }
1437
1438 print "\n\n";
1439}
1440
1441# output in XML DocBook
1442sub output_function_gnome {
1443 my %args = %{$_[0]};
1444 my ($parameter, $section);
1445 my $count;
1446 my $id;
1447
1448 $id = $args{'module'} . "-" . $args{'function'};
1449 $id =~ s/[^A-Za-z0-9]/-/g;
1450
1451 print "<sect2>\n";
1452 print " <title id=\"$id\">" . $args{'function'} . "</title>\n";
1453
1454 print " <funcsynopsis>\n";
1455 print " <funcdef>" . $args{'functiontype'} . " ";
1456 print "<function>" . $args{'function'} . " ";
1457 print "</function></funcdef>\n";
1458
1459 $count = 0;
1460 if ($#{$args{'parameterlist'}} >= 0) {
1461 foreach $parameter (@{$args{'parameterlist'}}) {
1462 $type = $args{'parametertypes'}{$parameter};
1463 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1464 # pointer-to-function
1465 print " <paramdef>$1 <parameter>$parameter</parameter>)\n";
1466 print " <funcparams>$2</funcparams></paramdef>\n";
1467 } else {
1468 print " <paramdef>" . $type;
1469 print " <parameter>$parameter</parameter></paramdef>\n";
1470 }
1471 }
1472 } else {
1473 print " <void>\n";
1474 }
1475 print " </funcsynopsis>\n";
1476 if ($#{$args{'parameterlist'}} >= 0) {
1477 print " <informaltable pgwide=\"1\" frame=\"none\" role=\"params\">\n";
1478 print "<tgroup cols=\"2\">\n";
1479 print "<colspec colwidth=\"2*\">\n";
1480 print "<colspec colwidth=\"8*\">\n";
1481 print "<tbody>\n";
1482 foreach $parameter (@{$args{'parameterlist'}}) {
1483 my $parameter_name = $parameter;
1484 $parameter_name =~ s/\[.*//;
1485
1486 print " <row><entry align=\"right\"><parameter>$parameter</parameter></entry>\n";
1487 print " <entry>\n";
1488 $lineprefix=" ";
1489 output_highlight($args{'parameterdescs'}{$parameter_name});
1490 print " </entry></row>\n";
1491 }
1492 print " </tbody></tgroup></informaltable>\n";
1493 } else {
1494 print " <para>\n None\n </para>\n";
1495 }
1496
1497 # print out each section
1498 $lineprefix=" ";
1499 foreach $section (@{$args{'sectionlist'}}) {
1500 print "<simplesect>\n <title>$section</title>\n";
1501 if ($section =~ m/EXAMPLE/i) {
1502 print "<example><programlisting>\n";
1503 $output_preformatted = 1;
1504 } else {
1505 }
1506 print "<para>\n";
1507 output_highlight($args{'sections'}{$section});
1508 $output_preformatted = 0;
1509 print "</para>\n";
1510 if ($section =~ m/EXAMPLE/i) {
1511 print "</programlisting></example>\n";
1512 } else {
1513 }
1514 print " </simplesect>\n";
1515 }
1516
1517 print "</sect2>\n\n";
1518}
1519
1520## 570##
1521# output function in man 571# output function in man
1522sub output_function_man(%) { 572sub output_function_man(%) {
@@ -1620,32 +670,12 @@ sub output_struct_man(%) {
1620 print ".SH NAME\n"; 670 print ".SH NAME\n";
1621 print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n"; 671 print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n";
1622 672
673 my $declaration = $args{'definition'};
674 $declaration =~ s/\t/ /g;
675 $declaration =~ s/\n/"\n.br\n.BI \"/g;
1623 print ".SH SYNOPSIS\n"; 676 print ".SH SYNOPSIS\n";
1624 print $args{'type'} . " " . $args{'struct'} . " {\n.br\n"; 677 print $args{'type'} . " " . $args{'struct'} . " {\n.br\n";
1625 678 print ".BI \"$declaration\n};\n.br\n\n";
1626 foreach my $parameter (@{$args{'parameterlist'}}) {
1627 if ($parameter =~ /^#/) {
1628 print ".BI \"$parameter\"\n.br\n";
1629 next;
1630 }
1631 my $parameter_name = $parameter;
1632 $parameter_name =~ s/\[.*//;
1633
1634 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1635 $type = $args{'parametertypes'}{$parameter};
1636 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1637 # pointer-to-function
1638 print ".BI \" " . $1 . "\" " . $parameter . " \") (" . $2 . ")" . "\"\n;\n";
1639 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
1640 # bitfield
1641 print ".BI \" " . $1 . "\ \" " . $parameter . $2 . " \"" . "\"\n;\n";
1642 } else {
1643 $type =~ s/([^\*])$/$1 /;
1644 print ".BI \" " . $type . "\" " . $parameter . " \"" . "\"\n;\n";
1645 }
1646 print "\n.br\n";
1647 }
1648 print "};\n.br\n";
1649 679
1650 print ".SH Members\n"; 680 print ".SH Members\n";
1651 foreach $parameter (@{$args{'parameterlist'}}) { 681 foreach $parameter (@{$args{'parameterlist'}}) {
@@ -1695,161 +725,6 @@ sub output_blockhead_man(%) {
1695} 725}
1696 726
1697## 727##
1698# output in text
1699sub output_function_text(%) {
1700 my %args = %{$_[0]};
1701 my ($parameter, $section);
1702 my $start;
1703
1704 print "Name:\n\n";
1705 print $args{'function'} . " - " . $args{'purpose'} . "\n";
1706
1707 print "\nSynopsis:\n\n";
1708 if ($args{'functiontype'} ne "") {
1709 $start = $args{'functiontype'} . " " . $args{'function'} . " (";
1710 } else {
1711 $start = $args{'function'} . " (";
1712 }
1713 print $start;
1714
1715 my $count = 0;
1716 foreach my $parameter (@{$args{'parameterlist'}}) {
1717 $type = $args{'parametertypes'}{$parameter};
1718 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1719 # pointer-to-function
1720 print $1 . $parameter . ") (" . $2;
1721 } else {
1722 print $type . " " . $parameter;
1723 }
1724 if ($count != $#{$args{'parameterlist'}}) {
1725 $count++;
1726 print ",\n";
1727 print " " x length($start);
1728 } else {
1729 print ");\n\n";
1730 }
1731 }
1732
1733 print "Arguments:\n\n";
1734 foreach $parameter (@{$args{'parameterlist'}}) {
1735 my $parameter_name = $parameter;
1736 $parameter_name =~ s/\[.*//;
1737
1738 print $parameter . "\n\t" . $args{'parameterdescs'}{$parameter_name} . "\n";
1739 }
1740 output_section_text(@_);
1741}
1742
1743#output sections in text
1744sub output_section_text(%) {
1745 my %args = %{$_[0]};
1746 my $section;
1747
1748 print "\n";
1749 foreach $section (@{$args{'sectionlist'}}) {
1750 print "$section:\n\n";
1751 output_highlight($args{'sections'}{$section});
1752 }
1753 print "\n\n";
1754}
1755
1756# output enum in text
1757sub output_enum_text(%) {
1758 my %args = %{$_[0]};
1759 my ($parameter);
1760 my $count;
1761 print "Enum:\n\n";
1762
1763 print "enum " . $args{'enum'} . " - " . $args{'purpose'} . "\n\n";
1764 print "enum " . $args{'enum'} . " {\n";
1765 $count = 0;
1766 foreach $parameter (@{$args{'parameterlist'}}) {
1767 print "\t$parameter";
1768 if ($count != $#{$args{'parameterlist'}}) {
1769 $count++;
1770 print ",";
1771 }
1772 print "\n";
1773 }
1774 print "};\n\n";
1775
1776 print "Constants:\n\n";
1777 foreach $parameter (@{$args{'parameterlist'}}) {
1778 print "$parameter\n\t";
1779 print $args{'parameterdescs'}{$parameter} . "\n";
1780 }
1781
1782 output_section_text(@_);
1783}
1784
1785# output typedef in text
1786sub output_typedef_text(%) {
1787 my %args = %{$_[0]};
1788 my ($parameter);
1789 my $count;
1790 print "Typedef:\n\n";
1791
1792 print "typedef " . $args{'typedef'} . " - " . $args{'purpose'} . "\n";
1793 output_section_text(@_);
1794}
1795
1796# output struct as text
1797sub output_struct_text(%) {
1798 my %args = %{$_[0]};
1799 my ($parameter);
1800
1801 print $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "\n\n";
1802 print $args{'type'} . " " . $args{'struct'} . " {\n";
1803 foreach $parameter (@{$args{'parameterlist'}}) {
1804 if ($parameter =~ /^#/) {
1805 print "$parameter\n";
1806 next;
1807 }
1808
1809 my $parameter_name = $parameter;
1810 $parameter_name =~ s/\[.*//;
1811
1812 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1813 $type = $args{'parametertypes'}{$parameter};
1814 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1815 # pointer-to-function
1816 print "\t$1 $parameter) ($2);\n";
1817 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
1818 # bitfield
1819 print "\t$1 $parameter$2;\n";
1820 } else {
1821 print "\t" . $type . " " . $parameter . ";\n";
1822 }
1823 }
1824 print "};\n\n";
1825
1826 print "Members:\n\n";
1827 foreach $parameter (@{$args{'parameterlist'}}) {
1828 ($parameter =~ /^#/) && next;
1829
1830 my $parameter_name = $parameter;
1831 $parameter_name =~ s/\[.*//;
1832
1833 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1834 print "$parameter\n\t";
1835 print $args{'parameterdescs'}{$parameter_name} . "\n";
1836 }
1837 print "\n";
1838 output_section_text(@_);
1839}
1840
1841sub output_blockhead_text(%) {
1842 my %args = %{$_[0]};
1843 my ($parameter, $section);
1844
1845 foreach $section (@{$args{'sectionlist'}}) {
1846 print " $section:\n";
1847 print " -> ";
1848 output_highlight($args{'sections'}{$section});
1849 }
1850}
1851
1852##
1853# output in restructured text 728# output in restructured text
1854# 729#
1855 730
@@ -2038,29 +913,9 @@ sub output_struct_rst(%) {
2038 913
2039 print "**Definition**\n\n"; 914 print "**Definition**\n\n";
2040 print "::\n\n"; 915 print "::\n\n";
2041 print " " . $args{'type'} . " " . $args{'struct'} . " {\n"; 916 my $declaration = $args{'definition'};
2042 foreach $parameter (@{$args{'parameterlist'}}) { 917 $declaration =~ s/\t/ /g;
2043 if ($parameter =~ /^#/) { 918 print " " . $args{'type'} . " " . $args{'struct'} . " {\n$declaration };\n\n";
2044 print " " . "$parameter\n";
2045 next;
2046 }
2047
2048 my $parameter_name = $parameter;
2049 $parameter_name =~ s/\[.*//;
2050
2051 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
2052 $type = $args{'parametertypes'}{$parameter};
2053 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
2054 # pointer-to-function
2055 print " $1 $parameter) ($2);\n";
2056 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
2057 # bitfield
2058 print " $1 $parameter$2;\n";
2059 } else {
2060 print " " . $type . " " . $parameter . ";\n";
2061 }
2062 }
2063 print " };\n\n";
2064 919
2065 print "**Members**\n\n"; 920 print "**Members**\n\n";
2066 $lineprefix = " "; 921 $lineprefix = " ";
@@ -2083,44 +938,6 @@ sub output_struct_rst(%) {
2083 output_section_rst(@_); 938 output_section_rst(@_);
2084} 939}
2085 940
2086
2087## list mode output functions
2088
2089sub output_function_list(%) {
2090 my %args = %{$_[0]};
2091
2092 print $args{'function'} . "\n";
2093}
2094
2095# output enum in list
2096sub output_enum_list(%) {
2097 my %args = %{$_[0]};
2098 print $args{'enum'} . "\n";
2099}
2100
2101# output typedef in list
2102sub output_typedef_list(%) {
2103 my %args = %{$_[0]};
2104 print $args{'typedef'} . "\n";
2105}
2106
2107# output struct as list
2108sub output_struct_list(%) {
2109 my %args = %{$_[0]};
2110
2111 print $args{'struct'} . "\n";
2112}
2113
2114sub output_blockhead_list(%) {
2115 my %args = %{$_[0]};
2116 my ($parameter, $section);
2117
2118 foreach $section (@{$args{'sectionlist'}}) {
2119 print "DOC: $section\n";
2120 }
2121}
2122
2123
2124## none mode output functions 941## none mode output functions
2125 942
2126sub output_function_none(%) { 943sub output_function_none(%) {
@@ -2186,39 +1003,128 @@ sub dump_union($$) {
2186sub dump_struct($$) { 1003sub dump_struct($$) {
2187 my $x = shift; 1004 my $x = shift;
2188 my $file = shift; 1005 my $file = shift;
2189 my $nested;
2190 1006
2191 if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { 1007 if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) {
2192 my $decl_type = $1; 1008 my $decl_type = $1;
2193 $declaration_name = $2; 1009 $declaration_name = $2;
2194 my $members = $3; 1010 my $members = $3;
2195 1011
2196 # ignore embedded structs or unions
2197 $members =~ s/({.*})//g;
2198 $nested = $1;
2199
2200 # ignore members marked private: 1012 # ignore members marked private:
2201 $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi; 1013 $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi;
2202 $members =~ s/\/\*\s*private:.*//gosi; 1014 $members =~ s/\/\*\s*private:.*//gosi;
2203 # strip comments: 1015 # strip comments:
2204 $members =~ s/\/\*.*?\*\///gos; 1016 $members =~ s/\/\*.*?\*\///gos;
2205 $nested =~ s/\/\*.*?\*\///gos;
2206 # strip attributes 1017 # strip attributes
2207 $members =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i; 1018 $members =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i;
2208 $members =~ s/__aligned\s*\([^;]*\)//gos; 1019 $members =~ s/__aligned\s*\([^;]*\)//gos;
2209 $members =~ s/\s*CRYPTO_MINALIGN_ATTR//gos; 1020 $members =~ s/\s*CRYPTO_MINALIGN_ATTR//gos;
2210 # replace DECLARE_BITMAP 1021 # replace DECLARE_BITMAP
2211 $members =~ s/DECLARE_BITMAP\s*\(([^,)]+), ([^,)]+)\)/unsigned long $1\[BITS_TO_LONGS($2)\]/gos; 1022 $members =~ s/DECLARE_BITMAP\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[BITS_TO_LONGS($2)\]/gos;
2212 # replace DECLARE_HASHTABLE 1023 # replace DECLARE_HASHTABLE
2213 $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+), ([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos; 1024 $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos;
2214 1025 # replace DECLARE_KFIFO
2215 create_parameterlist($members, ';', $file); 1026 $members =~ s/DECLARE_KFIFO\s*\(([^,)]+),\s*([^,)]+),\s*([^,)]+)\)/$2 \*$1/gos;
2216 check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual, $nested); 1027 # replace DECLARE_KFIFO_PTR
2217 1028 $members =~ s/DECLARE_KFIFO_PTR\s*\(([^,)]+),\s*([^,)]+)\)/$2 \*$1/gos;
1029
1030 my $declaration = $members;
1031
1032 # Split nested struct/union elements as newer ones
1033 while ($members =~ m/(struct|union)([^\{\};]+)\{([^\{\}]*)\}([^\{\}\;]*)\;/) {
1034 my $newmember;
1035 my $maintype = $1;
1036 my $ids = $4;
1037 my $content = $3;
1038 foreach my $id(split /,/, $ids) {
1039 $newmember .= "$maintype $id; ";
1040
1041 $id =~ s/[:\[].*//;
1042 $id =~ s/^\s*\**(\S+)\s*/$1/;
1043 foreach my $arg (split /;/, $content) {
1044 next if ($arg =~ m/^\s*$/);
1045 if ($arg =~ m/^([^\(]+\(\*?\s*)([\w\.]*)(\s*\).*)/) {
1046 # pointer-to-function
1047 my $type = $1;
1048 my $name = $2;
1049 my $extra = $3;
1050 next if (!$name);
1051 if ($id =~ m/^\s*$/) {
1052 # anonymous struct/union
1053 $newmember .= "$type$name$extra; ";
1054 } else {
1055 $newmember .= "$type$id.$name$extra; ";
1056 }
1057 } else {
1058 my $type;
1059 my $names;
1060 $arg =~ s/^\s+//;
1061 $arg =~ s/\s+$//;
1062 # Handle bitmaps
1063 $arg =~ s/:\s*\d+\s*//g;
1064 # Handle arrays
1065 $arg =~ s/\[\S+\]//g;
1066 # The type may have multiple words,
1067 # and multiple IDs can be defined, like:
1068 # const struct foo, *bar, foobar
1069 # So, we remove spaces when parsing the
1070 # names, in order to match just names
1071 # and commas for the names
1072 $arg =~ s/\s*,\s*/,/g;
1073 if ($arg =~ m/(.*)\s+([\S+,]+)/) {
1074 $type = $1;
1075 $names = $2;
1076 } else {
1077 $newmember .= "$arg; ";
1078 next;
1079 }
1080 foreach my $name (split /,/, $names) {
1081 $name =~ s/^\s*\**(\S+)\s*/$1/;
1082 next if (($name =~ m/^\s*$/));
1083 if ($id =~ m/^\s*$/) {
1084 # anonymous struct/union
1085 $newmember .= "$type $name; ";
1086 } else {
1087 $newmember .= "$type $id.$name; ";
1088 }
1089 }
1090 }
1091 }
1092 }
1093 $members =~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)}([^\{\}\;]*)\;/$newmember/;
1094 }
1095
1096 # Ignore other nested elements, like enums
1097 $members =~ s/({[^\{\}]*})//g;
1098
1099 create_parameterlist($members, ';', $file, $declaration_name);
1100 check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual);
1101
1102 # Adjust declaration for better display
1103 $declaration =~ s/([{;])/$1\n/g;
1104 $declaration =~ s/}\s+;/};/g;
1105 # Better handle inlined enums
1106 do {} while ($declaration =~ s/(enum\s+{[^}]+),([^\n])/$1,\n$2/);
1107
1108 my @def_args = split /\n/, $declaration;
1109 my $level = 1;
1110 $declaration = "";
1111 foreach my $clause (@def_args) {
1112 $clause =~ s/^\s+//;
1113 $clause =~ s/\s+$//;
1114 $clause =~ s/\s+/ /;
1115 next if (!$clause);
1116 $level-- if ($clause =~ m/(})/ && $level > 1);
1117 if (!($clause =~ m/^\s*#/)) {
1118 $declaration .= "\t" x $level;
1119 }
1120 $declaration .= "\t" . $clause . "\n";
1121 $level++ if ($clause =~ m/({)/ && !($clause =~m/}/));
1122 }
2218 output_declaration($declaration_name, 1123 output_declaration($declaration_name,
2219 'struct', 1124 'struct',
2220 {'struct' => $declaration_name, 1125 {'struct' => $declaration_name,
2221 'module' => $modulename, 1126 'module' => $modulename,
1127 'definition' => $declaration,
2222 'parameterlist' => \@parameterlist, 1128 'parameterlist' => \@parameterlist,
2223 'parameterdescs' => \%parameterdescs, 1129 'parameterdescs' => \%parameterdescs,
2224 'parametertypes' => \%parametertypes, 1130 'parametertypes' => \%parametertypes,
@@ -2234,6 +1140,44 @@ sub dump_struct($$) {
2234 } 1140 }
2235} 1141}
2236 1142
1143
1144sub show_warnings($$) {
1145 my $functype = shift;
1146 my $name = shift;
1147
1148 return 1 if ($output_selection == OUTPUT_ALL);
1149
1150 if ($output_selection == OUTPUT_EXPORTED) {
1151 if (defined($function_table{$name})) {
1152 return 1;
1153 } else {
1154 return 0;
1155 }
1156 }
1157 if ($output_selection == OUTPUT_INTERNAL) {
1158 if (!($functype eq "function" && defined($function_table{$name}))) {
1159 return 1;
1160 } else {
1161 return 0;
1162 }
1163 }
1164 if ($output_selection == OUTPUT_INCLUDE) {
1165 if (defined($function_table{$name})) {
1166 return 1;
1167 } else {
1168 return 0;
1169 }
1170 }
1171 if ($output_selection == OUTPUT_EXCLUDE) {
1172 if (!defined($function_table{$name})) {
1173 return 1;
1174 } else {
1175 return 0;
1176 }
1177 }
1178 die("Please add the new output type at show_warnings()");
1179}
1180
2237sub dump_enum($$) { 1181sub dump_enum($$) {
2238 my $x = shift; 1182 my $x = shift;
2239 my $file = shift; 1183 my $file = shift;
@@ -2254,16 +1198,18 @@ sub dump_enum($$) {
2254 push @parameterlist, $arg; 1198 push @parameterlist, $arg;
2255 if (!$parameterdescs{$arg}) { 1199 if (!$parameterdescs{$arg}) {
2256 $parameterdescs{$arg} = $undescribed; 1200 $parameterdescs{$arg} = $undescribed;
2257 print STDERR "${file}:$.: warning: Enum value '$arg' ". 1201 if (show_warnings("enum", $declaration_name)) {
2258 "not described in enum '$declaration_name'\n"; 1202 print STDERR "${file}:$.: warning: Enum value '$arg' not described in enum '$declaration_name'\n";
1203 }
2259 } 1204 }
2260 $_members{$arg} = 1; 1205 $_members{$arg} = 1;
2261 } 1206 }
2262 1207
2263 while (my ($k, $v) = each %parameterdescs) { 1208 while (my ($k, $v) = each %parameterdescs) {
2264 if (!exists($_members{$k})) { 1209 if (!exists($_members{$k})) {
2265 print STDERR "${file}:$.: warning: Excess enum value " . 1210 if (show_warnings("enum", $declaration_name)) {
2266 "'$k' description in '$declaration_name'\n"; 1211 print STDERR "${file}:$.: warning: Excess enum value '$k' description in '$declaration_name'\n";
1212 }
2267 } 1213 }
2268 } 1214 }
2269 1215
@@ -2299,7 +1245,7 @@ sub dump_typedef($$) {
2299 $declaration_name = $2; 1245 $declaration_name = $2;
2300 my $args = $3; 1246 my $args = $3;
2301 1247
2302 create_parameterlist($args, ',', $file); 1248 create_parameterlist($args, ',', $file, $declaration_name);
2303 1249
2304 output_declaration($declaration_name, 1250 output_declaration($declaration_name,
2305 'function', 1251 'function',
@@ -2348,10 +1294,11 @@ sub save_struct_actual($) {
2348 $struct_actual = $struct_actual . $actual . " "; 1294 $struct_actual = $struct_actual . $actual . " ";
2349} 1295}
2350 1296
2351sub create_parameterlist($$$) { 1297sub create_parameterlist($$$$) {
2352 my $args = shift; 1298 my $args = shift;
2353 my $splitter = shift; 1299 my $splitter = shift;
2354 my $file = shift; 1300 my $file = shift;
1301 my $declaration_name = shift;
2355 my $type; 1302 my $type;
2356 my $param; 1303 my $param;
2357 1304
@@ -2376,12 +1323,12 @@ sub create_parameterlist($$$) {
2376 } elsif ($arg =~ m/\(.+\)\s*\(/) { 1323 } elsif ($arg =~ m/\(.+\)\s*\(/) {
2377 # pointer-to-function 1324 # pointer-to-function
2378 $arg =~ tr/#/,/; 1325 $arg =~ tr/#/,/;
2379 $arg =~ m/[^\(]+\(\*?\s*(\w*)\s*\)/; 1326 $arg =~ m/[^\(]+\(\*?\s*([\w\.]*)\s*\)/;
2380 $param = $1; 1327 $param = $1;
2381 $type = $arg; 1328 $type = $arg;
2382 $type =~ s/([^\(]+\(\*?)\s*$param/$1/; 1329 $type =~ s/([^\(]+\(\*?)\s*$param/$1/;
2383 save_struct_actual($param); 1330 save_struct_actual($param);
2384 push_parameter($param, $type, $file); 1331 push_parameter($param, $type, $file, $declaration_name);
2385 } elsif ($arg) { 1332 } elsif ($arg) {
2386 $arg =~ s/\s*:\s*/:/g; 1333 $arg =~ s/\s*:\s*/:/g;
2387 $arg =~ s/\s*\[/\[/g; 1334 $arg =~ s/\s*\[/\[/g;
@@ -2406,27 +1353,28 @@ sub create_parameterlist($$$) {
2406 foreach $param (@args) { 1353 foreach $param (@args) {
2407 if ($param =~ m/^(\*+)\s*(.*)/) { 1354 if ($param =~ m/^(\*+)\s*(.*)/) {
2408 save_struct_actual($2); 1355 save_struct_actual($2);
2409 push_parameter($2, "$type $1", $file); 1356 push_parameter($2, "$type $1", $file, $declaration_name);
2410 } 1357 }
2411 elsif ($param =~ m/(.*?):(\d+)/) { 1358 elsif ($param =~ m/(.*?):(\d+)/) {
2412 if ($type ne "") { # skip unnamed bit-fields 1359 if ($type ne "") { # skip unnamed bit-fields
2413 save_struct_actual($1); 1360 save_struct_actual($1);
2414 push_parameter($1, "$type:$2", $file) 1361 push_parameter($1, "$type:$2", $file, $declaration_name)
2415 } 1362 }
2416 } 1363 }
2417 else { 1364 else {
2418 save_struct_actual($param); 1365 save_struct_actual($param);
2419 push_parameter($param, $type, $file); 1366 push_parameter($param, $type, $file, $declaration_name);
2420 } 1367 }
2421 } 1368 }
2422 } 1369 }
2423 } 1370 }
2424} 1371}
2425 1372
2426sub push_parameter($$$) { 1373sub push_parameter($$$$) {
2427 my $param = shift; 1374 my $param = shift;
2428 my $type = shift; 1375 my $type = shift;
2429 my $file = shift; 1376 my $file = shift;
1377 my $declaration_name = shift;
2430 1378
2431 if (($anon_struct_union == 1) && ($type eq "") && 1379 if (($anon_struct_union == 1) && ($type eq "") &&
2432 ($param eq "}")) { 1380 ($param eq "}")) {
@@ -2463,21 +1411,15 @@ sub push_parameter($$$) {
2463 # warn if parameter has no description 1411 # warn if parameter has no description
2464 # (but ignore ones starting with # as these are not parameters 1412 # (but ignore ones starting with # as these are not parameters
2465 # but inline preprocessor statements); 1413 # but inline preprocessor statements);
2466 # also ignore unnamed structs/unions; 1414 # Note: It will also ignore void params and unnamed structs/unions
2467 if (!$anon_struct_union) {
2468 if (!defined $parameterdescs{$param} && $param !~ /^#/) { 1415 if (!defined $parameterdescs{$param} && $param !~ /^#/) {
1416 $parameterdescs{$param} = $undescribed;
2469 1417
2470 $parameterdescs{$param} = $undescribed; 1418 if (show_warnings($type, $declaration_name)) {
2471 1419 print STDERR
2472 if (($type eq 'function') || ($type eq 'enum')) { 1420 "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n";
2473 print STDERR "${file}:$.: warning: Function parameter ". 1421 ++$warnings;
2474 "or member '$param' not " . 1422 }
2475 "described in '$declaration_name'\n";
2476 }
2477 print STDERR "${file}:$.: warning:" .
2478 " No description found for parameter '$param'\n";
2479 ++$warnings;
2480 }
2481 } 1423 }
2482 1424
2483 $param = xml_escape($param); 1425 $param = xml_escape($param);
@@ -2496,8 +1438,8 @@ sub push_parameter($$$) {
2496 $parametertypes{$param} = $type; 1438 $parametertypes{$param} = $type;
2497} 1439}
2498 1440
2499sub check_sections($$$$$$) { 1441sub check_sections($$$$$) {
2500 my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck, $nested) = @_; 1442 my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck) = @_;
2501 my @sects = split ' ', $sectcheck; 1443 my @sects = split ' ', $sectcheck;
2502 my @prms = split ' ', $prmscheck; 1444 my @prms = split ' ', $prmscheck;
2503 my $err; 1445 my $err;
@@ -2531,14 +1473,6 @@ sub check_sections($$$$$$) {
2531 "'$sects[$sx]' " . 1473 "'$sects[$sx]' " .
2532 "description in '$decl_name'\n"; 1474 "description in '$decl_name'\n";
2533 ++$warnings; 1475 ++$warnings;
2534 } else {
2535 if ($nested !~ m/\Q$sects[$sx]\E/) {
2536 print STDERR "${file}:$.: warning: " .
2537 "Excess $decl_type member " .
2538 "'$sects[$sx]' " .
2539 "description in '$decl_name'\n";
2540 ++$warnings;
2541 }
2542 } 1476 }
2543 } 1477 }
2544 } 1478 }
@@ -2642,14 +1576,14 @@ sub dump_function($$) {
2642 $declaration_name = $2; 1576 $declaration_name = $2;
2643 my $args = $3; 1577 my $args = $3;
2644 1578
2645 create_parameterlist($args, ',', $file); 1579 create_parameterlist($args, ',', $file, $declaration_name);
2646 } else { 1580 } else {
2647 print STDERR "${file}:$.: warning: cannot understand function prototype: '$prototype'\n"; 1581 print STDERR "${file}:$.: warning: cannot understand function prototype: '$prototype'\n";
2648 return; 1582 return;
2649 } 1583 }
2650 1584
2651 my $prms = join " ", @parameterlist; 1585 my $prms = join " ", @parameterlist;
2652 check_sections($file, $declaration_name, "function", $sectcheck, $prms, ""); 1586 check_sections($file, $declaration_name, "function", $sectcheck, $prms);
2653 1587
2654 # This check emits a lot of warnings at the moment, because many 1588 # This check emits a lot of warnings at the moment, because many
2655 # functions don't have a 'Return' doc section. So until the number 1589 # functions don't have a 'Return' doc section. So until the number
@@ -2718,7 +1652,7 @@ sub tracepoint_munge($) {
2718sub syscall_munge() { 1652sub syscall_munge() {
2719 my $void = 0; 1653 my $void = 0;
2720 1654
2721 $prototype =~ s@[\r\n\t]+@ @gos; # strip newlines/CR's/tabs 1655 $prototype =~ s@[\r\n]+@ @gos; # strip newlines/CR's
2722## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) { 1656## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) {
2723 if ($prototype =~ m/SYSCALL_DEFINE0/) { 1657 if ($prototype =~ m/SYSCALL_DEFINE0/) {
2724 $void = 1; 1658 $void = 1;
@@ -2823,7 +1757,7 @@ sub process_proto_type($$) {
2823# just before actual output; (this is done by local_unescape()) 1757# just before actual output; (this is done by local_unescape())
2824sub xml_escape($) { 1758sub xml_escape($) {
2825 my $text = shift; 1759 my $text = shift;
2826 if (($output_mode eq "text") || ($output_mode eq "man")) { 1760 if ($output_mode eq "man") {
2827 return $text; 1761 return $text;
2828 } 1762 }
2829 $text =~ s/\&/\\\\\\amp;/g; 1763 $text =~ s/\&/\\\\\\amp;/g;
@@ -2835,7 +1769,7 @@ sub xml_escape($) {
2835# xml_unescape: reverse the effects of xml_escape 1769# xml_unescape: reverse the effects of xml_escape
2836sub xml_unescape($) { 1770sub xml_unescape($) {
2837 my $text = shift; 1771 my $text = shift;
2838 if (($output_mode eq "text") || ($output_mode eq "man")) { 1772 if ($output_mode eq "man") {
2839 return $text; 1773 return $text;
2840 } 1774 }
2841 $text =~ s/\\\\\\amp;/\&/g; 1775 $text =~ s/\\\\\\amp;/\&/g;
@@ -2848,7 +1782,7 @@ sub xml_unescape($) {
2848# local escape strings look like: '\\\\menmonic:' (that's 4 backslashes) 1782# local escape strings look like: '\\\\menmonic:' (that's 4 backslashes)
2849sub local_unescape($) { 1783sub local_unescape($) {
2850 my $text = shift; 1784 my $text = shift;
2851 if (($output_mode eq "text") || ($output_mode eq "man")) { 1785 if ($output_mode eq "man") {
2852 return $text; 1786 return $text;
2853 } 1787 }
2854 $text =~ s/\\\\\\\\lt:/</g; 1788 $text =~ s/\\\\\\\\lt:/</g;
@@ -2917,6 +1851,8 @@ sub process_file($) {
2917 while (s/\\\s*$//) { 1851 while (s/\\\s*$//) {
2918 $_ .= <IN>; 1852 $_ .= <IN>;
2919 } 1853 }
1854 # Replace tabs by spaces
1855 while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};
2920 if ($state == STATE_NORMAL) { 1856 if ($state == STATE_NORMAL) {
2921 if (/$doc_start/o) { 1857 if (/$doc_start/o) {
2922 $state = STATE_NAME; # next line is always the function name 1858 $state = STATE_NAME; # next line is always the function name
@@ -3016,8 +1952,7 @@ sub process_file($) {
3016 $in_purpose = 0; 1952 $in_purpose = 0;
3017 $contents = $newcontents; 1953 $contents = $newcontents;
3018 $new_start_line = $.; 1954 $new_start_line = $.;
3019 while ((substr($contents, 0, 1) eq " ") || 1955 while (substr($contents, 0, 1) eq " ") {
3020 substr($contents, 0, 1) eq "\t") {
3021 $contents = substr($contents, 1); 1956 $contents = substr($contents, 1);
3022 } 1957 }
3023 if ($contents ne "") { 1958 if ($contents ne "") {
@@ -3086,8 +2021,7 @@ sub process_file($) {
3086 $contents = $2; 2021 $contents = $2;
3087 $new_start_line = $.; 2022 $new_start_line = $.;
3088 if ($contents ne "") { 2023 if ($contents ne "") {
3089 while ((substr($contents, 0, 1) eq " ") || 2024 while (substr($contents, 0, 1) eq " ") {
3090 substr($contents, 0, 1) eq "\t") {
3091 $contents = substr($contents, 1); 2025 $contents = substr($contents, 1);
3092 } 2026 }
3093 $contents .= "\n"; 2027 $contents .= "\n";
@@ -3170,34 +2104,6 @@ sub process_file($) {
3170 if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) { 2104 if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) {
3171 print STDERR " Was looking for '$_'.\n" for keys %function_table; 2105 print STDERR " Was looking for '$_'.\n" for keys %function_table;
3172 } 2106 }
3173 if ($output_mode eq "xml") {
3174 # The template wants at least one RefEntry here; make one.
3175 print "<refentry>\n";
3176 print " <refnamediv>\n";
3177 print " <refname>\n";
3178 print " ${orig_file}\n";
3179 print " </refname>\n";
3180 print " <refpurpose>\n";
3181 print " Document generation inconsistency\n";
3182 print " </refpurpose>\n";
3183 print " </refnamediv>\n";
3184 print " <refsect1>\n";
3185 print " <title>\n";
3186 print " Oops\n";
3187 print " </title>\n";
3188 print " <warning>\n";
3189 print " <para>\n";
3190 print " The template for this document tried to insert\n";
3191 print " the structured comment from the file\n";
3192 print " <filename>${orig_file}</filename> at this point,\n";
3193 print " but none was found.\n";
3194 print " This dummy section is inserted to allow\n";
3195 print " generation to continue.\n";
3196 print " </para>\n";
3197 print " </warning>\n";
3198 print " </refsect1>\n";
3199 print "</refentry>\n";
3200 }
3201 } 2107 }
3202} 2108}
3203 2109