Commit 255442c9 authored by Linus Torvalds's avatar Linus Torvalds

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
  ...
parents d76e0a05 ae17a87d
...@@ -228,8 +228,6 @@ isdn/ ...@@ -228,8 +228,6 @@ isdn/
- directory with info on the Linux ISDN support, and supported cards. - directory with info on the Linux ISDN support, and supported cards.
kbuild/ kbuild/
- directory with info about the kernel build process. - directory with info about the kernel build process.
kernel-doc-nano-HOWTO.txt
- outdated info about kernel-doc documentation.
kdump/ kdump/
- directory with mini HowTo on getting the crash dump code to work. - directory with mini HowTo on getting the crash dump code to work.
doc-guide/ doc-guide/
...@@ -346,8 +344,6 @@ prctl/ ...@@ -346,8 +344,6 @@ prctl/
- directory with info on the priveledge control subsystem - directory with info on the priveledge control subsystem
preempt-locking.txt preempt-locking.txt
- info on locking under a preemptive kernel. - info on locking under a preemptive kernel.
printk-formats.txt
- how to get printk format specifiers right
process/ process/
- how to work with the mainline kernel development process. - how to work with the mainline kernel development process.
pps/ pps/
......
...@@ -2538,6 +2538,9 @@ ...@@ -2538,6 +2538,9 @@
This is useful when you use a panic=... timeout and This is useful when you use a panic=... timeout and
need the box quickly up again. need the box quickly up again.
These settings can be accessed at runtime via
the nmi_watchdog and hardlockup_panic sysctls.
netpoll.carrier_timeout= netpoll.carrier_timeout=
[NET] Specifies amount of time (in seconds) that [NET] Specifies amount of time (in seconds) that
netpoll should wait for a carrier. By default netpoll netpoll should wait for a carrier. By default netpoll
......
...@@ -9,14 +9,14 @@ This will allow you to execute Mono-based .NET binaries just like any ...@@ -9,14 +9,14 @@ This will allow you to execute Mono-based .NET binaries just like any
other program after you have done the following: other program after you have done the following:
1) You MUST FIRST install the Mono CLR support, either by downloading 1) You MUST FIRST install the Mono CLR support, either by downloading
a binary package, a source tarball or by installing from CVS. Binary a binary package, a source tarball or by installing from Git. Binary
packages for several distributions can be found at: packages for several distributions can be found at:
http://go-mono.com/download.html http://www.mono-project.com/download/
Instructions for compiling Mono can be found at: Instructions for compiling Mono can be found at:
http://www.go-mono.com/compiling.html http://www.mono-project.com/docs/compiling-mono/linux/
Once the Mono CLR support has been installed, just check that Once the Mono CLR support has been installed, just check that
``/usr/bin/mono`` (which could be located elsewhere, for example ``/usr/bin/mono`` (which could be located elsewhere, for example
......
...@@ -88,7 +88,6 @@ finally: ...@@ -88,7 +88,6 @@ finally:
if makefile_version and makefile_patchlevel: if makefile_version and makefile_patchlevel:
version = release = makefile_version + '.' + makefile_patchlevel version = release = makefile_version + '.' + makefile_patchlevel
else: else:
sys.stderr.write('Warning: Could not extract kernel version\n')
version = release = "unknown version" version = release = "unknown version"
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
......
=====================
The errseq_t datatype The errseq_t datatype
===================== =====================
An errseq_t is a way of recording errors in one place, and allowing any An errseq_t is a way of recording errors in one place, and allowing any
number of "subscribers" to tell whether it has changed since a previous number of "subscribers" to tell whether it has changed since a previous
point where it was sampled. point where it was sampled.
...@@ -21,12 +23,13 @@ a flag to tell whether the value has been sampled since a new value was ...@@ -21,12 +23,13 @@ a flag to tell whether the value has been sampled since a new value was
recorded. That allows us to avoid bumping the counter if no one has recorded. That allows us to avoid bumping the counter if no one has
sampled it since the last time an error was recorded. sampled it since the last time an error was recorded.
Thus we end up with a value that looks something like this:: Thus we end up with a value that looks something like this:
bit: 31..13 12 11..0 +--------------------------------------+----+------------------------+
+-----------------+----+----------------+ | 31..13 | 12 | 11..0 |
| counter | SF | errno | +--------------------------------------+----+------------------------+
+-----------------+----+----------------+ | counter | SF | errno |
+--------------------------------------+----+------------------------+
The general idea is for "watchers" to sample an errseq_t value and keep The general idea is for "watchers" to sample an errseq_t value and keep
it as a running cursor. That value can later be used to tell whether it 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,6 +45,7 @@ has ever been an error set since it was first initialized.
API usage API usage
========= =========
Let me tell you a story about a worker drone. Now, he's a good worker Let me tell you a story about a worker drone. Now, he's a good worker
overall, but the company is a little...management heavy. He has to overall, but the company is a little...management heavy. He has to
report to 77 supervisors today, and tomorrow the "big boss" is coming in report to 77 supervisors today, and tomorrow the "big boss" is coming in
...@@ -125,6 +129,7 @@ not usable by anyone else. ...@@ -125,6 +129,7 @@ not usable by anyone else.
Serializing errseq_t cursor updates Serializing errseq_t cursor updates
=================================== ===================================
Note that the errseq_t API does not protect the errseq_t cursor during a Note that the errseq_t API does not protect the errseq_t cursor during a
check_and_advance_operation. Only the canonical error code is handled check_and_advance_operation. Only the canonical error code is handled
atomically. In a situation where more than one task might be using the atomically. 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,3 +152,8 @@ errseq_check_and_advance after taking the lock. e.g.::
That avoids the spinlock in the common case where nothing has changed That avoids the spinlock in the common case where nothing has changed
since the last time it was checked. since the last time it was checked.
Functions
=========
.. kernel-doc:: lib/errseq.c
...@@ -14,6 +14,7 @@ Core utilities ...@@ -14,6 +14,7 @@ Core utilities
kernel-api kernel-api
assoc_array assoc_array
atomic_ops atomic_ops
refcount-vs-atomic
cpu_hotplug cpu_hotplug
local_ops local_ops
workqueue workqueue
...@@ -21,6 +22,8 @@ Core utilities ...@@ -21,6 +22,8 @@ Core utilities
flexible-arrays flexible-arrays
librs librs
genalloc genalloc
errseq
printk-formats
Interfaces for kernel debugging Interfaces for kernel debugging
=============================== ===============================
......
...@@ -139,6 +139,21 @@ Division Functions ...@@ -139,6 +139,21 @@ Division Functions
.. kernel-doc:: lib/gcd.c .. kernel-doc:: lib/gcd.c
:export: :export:
Sorting
-------
.. kernel-doc:: lib/sort.c
:export:
.. kernel-doc:: lib/list_sort.c
:export:
UUID/GUID
---------
.. kernel-doc:: lib/uuid.c
:export:
Memory Management in Linux Memory Management in Linux
========================== ==========================
......
...@@ -5,6 +5,7 @@ How to get printk format specifiers right ...@@ -5,6 +5,7 @@ How to get printk format specifiers right
:Author: Randy Dunlap <rdunlap@infradead.org> :Author: Randy Dunlap <rdunlap@infradead.org>
:Author: Andrew Murray <amurray@mpc-data.co.uk> :Author: Andrew Murray <amurray@mpc-data.co.uk>
Integer types Integer types
============= =============
...@@ -25,39 +26,45 @@ Integer types ...@@ -25,39 +26,45 @@ Integer types
s64 %lld or %llx s64 %lld or %llx
u64 %llu or %llx u64 %llu or %llx
If <type> is dependent on a config option for its size (e.g., ``sector_t``,
``blkcnt_t``) or is architecture-dependent for its size (e.g., ``tcflag_t``), If <type> is dependent on a config option for its size (e.g., sector_t,
use a format specifier of its largest possible type and explicitly cast to it. blkcnt_t) or is architecture-dependent for its size (e.g., tcflag_t), use a
format specifier of its largest possible type and explicitly cast to it.
Example:: Example::
printk("test: sector number/total blocks: %llu/%llu\n", printk("test: sector number/total blocks: %llu/%llu\n",
(unsigned long long)sector, (unsigned long long)blockcount); (unsigned long long)sector, (unsigned long long)blockcount);
Reminder: ``sizeof()`` result is of type ``size_t``. Reminder: sizeof() returns type size_t.
The kernel's printf does not support ``%n``. For obvious reasons, floating The kernel's printf does not support %n. Floating point formats (%e, %f,
point formats (``%e, %f, %g, %a``) are also not recognized. Use of any %g, %a) are also not recognized, for obvious reasons. Use of any
unsupported specifier or length qualifier results in a WARN and early unsupported specifier or length qualifier results in a WARN and early
return from vsnprintf. return from vsnprintf().
Raw pointer value SHOULD be printed with %p. The kernel supports
the following extended format specifiers for pointer types:
Pointer Types Pointer types
============= =============
Pointers printed without a specifier extension (i.e unadorned %p) are A raw pointer value may be printed with %p which will hash the address
hashed to give a unique identifier without leaking kernel addresses to user before printing. The kernel also supports extended specifiers for printing
space. On 64 bit machines the first 32 bits are zeroed. If you _really_ pointers of different types.
want the address see %px below.
Plain Pointers
--------------
:: ::
%p abcdef12 or 00000000abcdef12 %p abcdef12 or 00000000abcdef12
Pointers printed without a specifier extension (i.e unadorned %p) are
hashed to prevent leaking information about the kernel memory layout. This
has the added benefit of providing a unique identifier. On 64-bit machines
the first 32 bits are zeroed. If you *really* want the address see %px
below.
Symbols/Function Pointers Symbols/Function Pointers
========================= -------------------------
:: ::
...@@ -69,6 +76,7 @@ Symbols/Function Pointers ...@@ -69,6 +76,7 @@ Symbols/Function Pointers
%ps versatile_init %ps versatile_init
%pB prev_fn_of_versatile_init+0x88/0x88 %pB prev_fn_of_versatile_init+0x88/0x88
The ``F`` and ``f`` specifiers are for printing function pointers, The ``F`` and ``f`` specifiers are for printing function pointers,
for example, f->func, &gettimeofday. They have the same result as for example, f->func, &gettimeofday. They have the same result as
``S`` and ``s`` specifiers. But they do an extra conversion on ``S`` and ``s`` specifiers. But they do an extra conversion on
...@@ -77,14 +85,14 @@ are actually function descriptors. ...@@ -77,14 +85,14 @@ are actually function descriptors.
The ``S`` and ``s`` specifiers can be used for printing symbols The ``S`` and ``s`` specifiers can be used for printing symbols
from direct addresses, for example, __builtin_return_address(0), from direct addresses, for example, __builtin_return_address(0),
(void *)regs->ip. They result in the symbol name with (``S``) or (void *)regs->ip. They result in the symbol name with (S) or
without (``s``) offsets. If KALLSYMS are disabled then the symbol without (s) offsets. If KALLSYMS are disabled then the symbol
address is printed instead. address is printed instead.
The ``B`` specifier results in the symbol name with offsets and should be The ``B`` specifier results in the symbol name with offsets and should be
used when printing stack backtraces. The specifier takes into used when printing stack backtraces. The specifier takes into
consideration the effect of compiler optimisations which may occur consideration the effect of compiler optimisations which may occur
when tail-call``s are used and marked with the noreturn GCC attribute. when tail-calls are used and marked with the noreturn GCC attribute.
Examples:: Examples::
...@@ -97,33 +105,32 @@ Examples:: ...@@ -97,33 +105,32 @@ Examples::
printk(" %s%pB\n", (reliable ? "" : "? "), (void *)*stack); printk(" %s%pB\n", (reliable ? "" : "? "), (void *)*stack);
Kernel Pointers Kernel Pointers
=============== ---------------
:: ::
%pK 01234567 or 0123456789abcdef %pK 01234567 or 0123456789abcdef
For printing kernel pointers which should be hidden from unprivileged For printing kernel pointers which should be hidden from unprivileged
users. The behaviour of ``%pK`` depends on the ``kptr_restrict sysctl`` - see users. The behaviour of %pK depends on the kptr_restrict sysctl - see
Documentation/sysctl/kernel.txt for more details. Documentation/sysctl/kernel.txt for more details.
Unmodified Addresses Unmodified Addresses
==================== --------------------
:: ::
%px 01234567 or 0123456789abcdef %px 01234567 or 0123456789abcdef
For printing pointers when you _really_ want to print the address. Please For printing pointers when you *really* want to print the address. Please
consider whether or not you are leaking sensitive information about the consider whether or not you are leaking sensitive information about the
Kernel layout in memory before printing pointers with %px. %px is kernel memory layout before printing pointers with %px. %px is functionally
functionally equivalent to %lx. %px is preferred to %lx because it is more equivalent to %lx (or %lu). %px is preferred because it is more uniquely
uniquely grep'able. If, in the future, we need to modify the way the Kernel grep'able. If in the future we need to modify the way the kernel handles
handles printing pointers it will be nice to be able to find the call printing pointers we will be better equipped to find the call sites.
sites.
Struct Resources Struct Resources
================ ----------------
:: ::
...@@ -133,32 +140,37 @@ Struct Resources ...@@ -133,32 +140,37 @@ Struct Resources
[mem 0x0000000060000000-0x000000006fffffff pref] [mem 0x0000000060000000-0x000000006fffffff pref]
For printing struct resources. The ``R`` and ``r`` specifiers result in a For printing struct resources. The ``R`` and ``r`` specifiers result in a
printed resource with (``R``) or without (``r``) a decoded flags member. printed resource with (R) or without (r) a decoded flags member.
Passed by reference. Passed by reference.
Physical addresses types ``phys_addr_t`` Physical address types phys_addr_t
======================================== ----------------------------------
:: ::
%pa[p] 0x01234567 or 0x0123456789abcdef %pa[p] 0x01234567 or 0x0123456789abcdef
For printing a ``phys_addr_t`` type (and its derivatives, such as For printing a phys_addr_t type (and its derivatives, such as
``resource_size_t``) which can vary based on build options, regardless of resource_size_t) which can vary based on build options, regardless of the
the width of the CPU data path. Passed by reference. width of the CPU data path.
Passed by reference.
DMA addresses types ``dma_addr_t`` DMA address types dma_addr_t
================================== ----------------------------
:: ::
%pad 0x01234567 or 0x0123456789abcdef %pad 0x01234567 or 0x0123456789abcdef
For printing a ``dma_addr_t`` type which can vary based on build options, For printing a dma_addr_t type which can vary based on build options,
regardless of the width of the CPU data path. Passed by reference. regardless of the width of the CPU data path.
Passed by reference.
Raw buffer as an escaped string Raw buffer as an escaped string
=============================== -------------------------------
:: ::
...@@ -168,8 +180,8 @@ For printing raw buffer as an escaped string. For the following buffer:: ...@@ -168,8 +180,8 @@ For printing raw buffer as an escaped string. For the following buffer::
1b 62 20 5c 43 07 22 90 0d 5d 1b 62 20 5c 43 07 22 90 0d 5d
few examples show how the conversion would be done (the result string A few examples show how the conversion would be done (excluding surrounding
without surrounding quotes):: quotes)::
%*pE "\eb \C\a"\220\r]" %*pE "\eb \C\a"\220\r]"
%*pEhp "\x1bb \C\x07"\x90\x0d]" %*pEhp "\x1bb \C\x07"\x90\x0d]"
...@@ -179,23 +191,23 @@ The conversion rules are applied according to an optional combination ...@@ -179,23 +191,23 @@ The conversion rules are applied according to an optional combination
of flags (see :c:func:`string_escape_mem` kernel documentation for the of flags (see :c:func:`string_escape_mem` kernel documentation for the
details): details):
- ``a`` - ESCAPE_ANY - a - ESCAPE_ANY
- ``c`` - ESCAPE_SPECIAL - c - ESCAPE_SPECIAL
- ``h`` - ESCAPE_HEX - h - ESCAPE_HEX
- ``n`` - ESCAPE_NULL - n - ESCAPE_NULL
- ``o`` - ESCAPE_OCTAL - o - ESCAPE_OCTAL
- ``p`` - ESCAPE_NP - p - ESCAPE_NP
- ``s`` - ESCAPE_SPACE - s - ESCAPE_SPACE
By default ESCAPE_ANY_NP is used. By default ESCAPE_ANY_NP is used.
ESCAPE_ANY_NP is the sane choice for many cases, in particularly for ESCAPE_ANY_NP is the sane choice for many cases, in particularly for
printing SSIDs. printing SSIDs.
If field width is omitted the 1 byte only will be escaped. If field width is omitted then 1 byte only will be escaped.
Raw buffer as a hex string Raw buffer as a hex string
========================== --------------------------
:: ::
...@@ -204,12 +216,12 @@ Raw buffer as a hex string ...@@ -204,12 +216,12 @@ Raw buffer as a hex string
%*phD 00-01-02- ... -3f %*phD 00-01-02- ... -3f
%*phN 000102 ... 3f %*phN 000102 ... 3f
For printing a small buffers (up to 64 bytes long) as a hex string with For printing small buffers (up to 64 bytes long) as a hex string with a
certain separator. For the larger buffers consider to use certain separator. For larger buffers consider using
:c:func:`print_hex_dump`. :c:func:`print_hex_dump`.
MAC/FDDI addresses MAC/FDDI addresses
================== ------------------
:: ::
...@@ -220,11 +232,11 @@ MAC/FDDI addresses ...@@ -220,11 +232,11 @@ MAC/FDDI addresses
%pmR 050403020100 %pmR 050403020100
For printing 6-byte MAC/FDDI addresses in hex notation. The ``M`` and ``m`` For printing 6-byte MAC/FDDI addresses in hex notation. The ``M`` and ``m``
specifiers result in a printed address with (``M``) or without (``m``) byte specifiers result in a printed address with (M) or without (m) byte
separators. The default byte separator is the colon (``:``). separators. The default byte separator is the colon (:).
Where FDDI addresses are concerned the ``F`` specifier can be used after Where FDDI addresses are concerned the ``F`` specifier can be used after
the ``M`` specifier to use dash (``-``) separators instead of the default the ``M`` specifier to use dash (-) separators instead of the default
separator. separator.
For Bluetooth addresses the ``R`` specifier shall be used after the ``M`` For 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. ...@@ -234,7 +246,7 @@ of Bluetooth addresses which are in the little endian order.
Passed by reference. Passed by reference.
IPv4 addresses IPv4 addresses
============== --------------
:: ::
...@@ -243,8 +255,8 @@ IPv4 addresses ...@@ -243,8 +255,8 @@ IPv4 addresses
%p[Ii]4[hnbl] %p[Ii]4[hnbl]
For printing IPv4 dot-separated decimal addresses. The ``I4`` and ``i4`` For printing IPv4 dot-separated decimal addresses. The ``I4`` and ``i4``
specifiers result in a printed address with (``i4``) or without (``I4``) specifiers result in a printed address with (i4) or without (I4) leading
leading zeros. zeros.
The additional ``h``, ``n``, ``b``, and ``l`` specifiers are used to specify The additional ``h``, ``n``, ``b``, and ``l`` specifiers are used to specify
host, network, big or little endian order addresses respectively. Where host, 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. ...@@ -253,7 +265,7 @@ no specifier is provided the default network/big endian order is used.
Passed by reference. Passed by reference.
IPv6 addresses IPv6 addresses
============== --------------
:: ::
...@@ -262,7 +274,7 @@ IPv6 addresses ...@@ -262,7 +274,7 @@ IPv6 addresses
%pI6c 1:2:3:4:5:6:7:8 %pI6c 1:2:3:4:5:6:7:8
For printing IPv6 network-order 16-bit hex addresses. The ``I6`` and ``i6`` For printing IPv6 network-order 16-bit hex addresses. The ``I6`` and ``i6``
specifiers result in a printed address with (``I6``) or without (``i6``) specifiers result in a printed address with (I6) or without (i6)
colon-separators. Leading zeros are always used. colon-separators. Leading zeros are always used.
The additional ``c`` specifier can be used with the ``I`` specifier to The additional ``c`` specifier can be used with the ``I`` specifier to
...@@ -272,7 +284,7 @@ http://tools.ietf.org/html/rfc5952 ...@@ -272,7 +284,7 @@ http://tools.ietf.org/html/rfc5952
Passed by reference. Passed by reference.
IPv4/IPv6 addresses (generic, with port, flowinfo, scope) IPv4/IPv6 addresses (generic, with port, flowinfo, scope)
========================================================= ---------------------------------------------------------
:: ::
...@@ -282,8 +294,8 @@ IPv4/IPv6 addresses (generic, with port, flowinfo, scope) ...@@ -282,8 +294,8 @@ IPv4/IPv6 addresses (generic, with port, flowinfo, scope)
%pISpc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345 %pISpc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345
%p[Ii]S[pfschnbl] %p[Ii]S[pfschnbl]
For printing an IP address without the need to distinguish whether it``s For printing an IP address without the need to distinguish whether it's of
of type AF_INET or AF_INET6, a pointer to a valid ``struct sockaddr``, type AF_INET or AF_INET6. A pointer to a valid struct sockaddr,
specified through ``IS`` or ``iS``, can be passed to this format specifier. specified through ``IS`` or ``iS``, can be passed to this format specifier.
The additional ``p``, ``f``, and ``s`` specifiers are used to specify port The additional ``p``, ``f``, and ``s`` specifiers are used to specify port
...@@ -309,7 +321,7 @@ Further examples:: ...@@ -309,7 +321,7 @@ Further examples::
%pISpfc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345/123456789 %pISpfc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345/123456789
UUID/GUID addresses UUID/GUID addresses
=================== -------------------
:: ::
...@@ -318,33 +330,33 @@ UUID/GUID addresses ...@@ -318,33 +330,33 @@ UUID/GUID addresses
%pUl 03020100-0504-0706-0809-0a0b0c0e0e0f %pUl 03020100-0504-0706-0809-0a0b0c0e0e0f
%pUL 03020100-0504-0706-0809-0A0B0C0E0E0F %pUL 03020100-0504-0706-0809-0A0B0C0E0E0F
For printing 16-byte UUID/GUIDs addresses. The additional 'l', 'L', For printing 16-byte UUID/GUIDs addresses. The additional ``l``, ``L``,
'b' and 'B' specifiers are used to specify a little endian order in ``b`` and ``B`` specifiers are used to specify a little endian order in
lower ('l') or upper case ('L') hex characters - and big endian order lower (l) or upper case (L) hex notation - and big endian order in lower (b)
in lower ('b') or upper case ('B') hex characters. or upper case (B) hex notation.
Where no additional specifiers are used the default big endian Where no additional specifiers are used the default big endian
order with lower case hex characters will be printed. order with lower case hex notation will be printed.
Passed by reference. Passed by reference.
dentry names dentry names
============ ------------
:: ::
%pd{,2,3,4} %pd{,2,3,4}
%pD{,2,3,4} %pD{,2,3,4}
For printing dentry name; if we race with :c:func:`d_move`, the name might be For printing dentry name; if we race with :c:func:`d_move`, the name might
a mix of old and new ones, but it won't oops. ``%pd`` dentry is a safer be a mix of old and new ones, but it won't oops. %pd dentry is a safer
equivalent of ``%s`` ``dentry->d_name.name`` we used to use, ``%pd<n>`` prints equivalent of %s dentry->d_name.name we used to use, %pd<n> prints ``n``
``n`` last components. ``%pD`` does the same thing for struct file. last components. %pD does the same thing for struct file.
Passed by reference. Passed by reference.
block_device names block_device names
================== ------------------
:: ::
...@@ -353,7 +365,7 @@ block_device names ...@@ -353,7 +365,7 @@ block_device names
For printing name of block_device pointers. For printing name of block_device pointers.
struct va_format struct va_format
================ ----------------
:: ::
...@@ -375,31 +387,27 @@ correctness of the format string and va_list arguments. ...@@ -375,31 +387,27 @@ correctness of the format string and va_list arguments.
Passed by reference. Passed by reference.
kobjects kobjects
======== --------
:: ::
%pO %pOF[fnpPcCF]
Base specifier for kobject based structs. Must be followed with
character for specific type of kobject as listed below:
Device tree nodes: For printing kobject based structs (device nodes). Default behaviour is
equivalent to %pOFf.
%pOF[fnpPcCF] - f - device node full_name
- n - device node name
- p - device node phandle
- P - device node path spec (name + @unit)
- F - device node flags
- c - major compatible string
- C - full compatible string
For printing device tree nodes. The optional arguments are: The separator when using multiple arguments is ':'
f device node full_name
n device node name
p device node phandle
P device node path spec (name + @unit)
F device node flags
c major compatible string
C full compatible string
Without any arguments prints full_name (same as %pOFf)
The separator when using multiple arguments is ':'
Examples: Examples::
%pOF /foo/bar@0 - Node full name %pOF /foo/bar@0 - Node full name
%pOFf /foo/bar@0 - Same as above %pOFf /foo/bar@0 - Same as above
...@@ -412,11 +420,10 @@ kobjects ...@@ -412,11 +420,10 @@ kobjects
P - Populated P - Populated
B - Populated bus B - Populated bus
Passed by reference. Passed by reference.
struct clk struct clk
========== ----------
:: ::
...@@ -424,14 +431,14 @@ struct clk ...@@ -424,14 +431,14 @@ struct clk
%pCn pll1 %pCn pll1
%pCr 1560000000 %pCr 1560000000
For printing struct clk structures. ``%pC`` and ``%pCn`` print the name For printing struct clk structures. %pC and %pCn print the name
(Common Clock Framework) or address (legacy clock framework) of the (Common Clock Framework) or address (legacy clock framework) of the
structure; ``%pCr`` prints the current clock rate. structure; %pCr prints the current clock rate.
Passed by reference. Passed by reference.
bitmap and its derivatives such as cpumask and nodemask bitmap and its derivatives such as cpumask and nodemask
======================================================= -------------------------------------------------------
:: ::
...@@ -439,13 +446,13 @@ bitmap and its derivatives such as cpumask and nodemask ...@@ -439,13 +446,13 @@ bitmap and its derivatives such as cpumask and nodemask
%*pbl 0,3-6,8-10 %*pbl 0,3-6,8-10
For printing bitmap and its derivatives such as cpumask and nodemask, For printing bitmap and its derivatives such as cpumask and nodemask,
``%*pb`` output the bitmap with field width as the number of bits and ``%*pbl`` %*pb outputs the bitmap with field width as the number of bits and %*pbl
output the bitmap as range list with field width as the number of bits. output the bitmap as range list with field width as the number of bits.
Passed by reference. Passed by reference.
Flags bitfields such as page flags, gfp_flags Flags bitfields such as page flags, gfp_flags
============================================= ---------------------------------------------
:: ::
...@@ -459,14 +466,14 @@ character. Currently supported are [p]age flags, [v]ma_flags (both ...@@ -459,14 +466,14 @@ character. Currently supported are [p]age flags, [v]ma_flags (both
expect ``unsigned long *``) and [g]fp_flags (expects ``gfp_t *``). The flag expect ``unsigned long *``) and [g]fp_flags (expects ``gfp_t *``). The flag
names and print order depends on the particular type. names and print order depends on the particular type.
Note that this format should not be used directly in :c:func:`TP_printk()` part Note that this format should not be used directly in the
of a tracepoint. Instead, use the ``show_*_flags()`` functions from :c:func:`TP_printk()` part of a tracepoint. Instead, use the show_*_flags()
<trace/events/mmflags.h>. functions from <trace/events/mmflags.h>.
Passed by reference. Passed by reference.
Network device features Network device features
======================= -----------------------
:: ::
...@@ -476,8 +483,10 @@ For printing netdev_features_t. ...@@ -476,8 +483,10 @@ For printing netdev_features_t.
Passed by reference. Passed by reference.
If you add other ``%p`` extensions, please extend lib/test_printf.c with Thanks
one or more test cases, if at all feasible. ======
If you add other %p extensions, please extend <lib/test_printf.c> with
one or more test cases, if at all feasible.
Thank you for your cooperation and attention. Thank you for your cooperation and attention.
===================================
refcount_t API compared to atomic_t
===================================
.. contents:: :local:
Introduction
============
The goal of refcount_t API is to provide a minimal API for implementing
an object's reference counters. While a generic architecture-independent
implementation from lib/refcount.c uses atomic operations underneath,
there are a number of differences between some of the ``refcount_*()`` and
``atomic_*()`` functions with regards to the memory ordering guarantees.
This document outlines the differences and provides respective examples
in order to help maintainers validate their code against the change in
these memory ordering guarantees.
The terms used through this document try to follow the formal LKMM defined in
github.com/aparri/memory-model/blob/master/Documentation/explanation.txt
memory-barriers.txt and atomic_t.txt provide more background to the
memory ordering in general and for atomic operations specifically.
Relevant types of memory ordering
=================================
.. note:: The following section only covers some of the memory
ordering types that are relevant for the atomics and reference
counters and used through this document. For a much broader picture
please consult memory-barriers.txt document.
In the absence of any memory ordering guarantees (i.e. fully unordered)
atomics & refcounters only provide atomicity and
program order (po) relation (on the same CPU). It guarantees that
each ``atomic_*()`` and ``refcount_*()`` operation is atomic and instructions
are executed in program order on a single CPU.
This is implemented using :c:func:`READ_ONCE`/:c:func:`WRITE_ONCE` and
compare-and-swap primitives.
A strong (full) memory ordering guarantees that all prior loads and
stores (all po-earlier instructions) on the same CPU are completed
before any po-later instruction is executed on the same CPU.
It also guarantees that all po-earlier stores on the same CPU
and all propagated stores from other CPUs must propagate to all
other CPUs before any po-later instruction is executed on the original
CPU (A-cumulative property). This is implemented using :c:func:`smp_mb`.
A RELEASE memory ordering guarantees that all prior loads and
stores (all po-earlier instructions) on the same CPU are completed
before the operation. It also guarantees that all po-earlier
stores on the same CPU and all propagated stores from other CPUs
must propagate to all other CPUs before the release operation
(A-cumulative property). This is implemented using
:c:func:`smp_store_release`.
A control dependency (on success) for refcounters guarantees that
if a reference for an object was successfully obtained (reference
counter increment or addition happened, function returned true),
then further stores are ordered against this operation.
Control dependency on stores are not implemented using any explicit
barriers, but rely on CPU not to speculate on stores. This is only
a single CPU relation and provides no guarantees for other CPUs.
Comparison of functions
=======================
case 1) - non-"Read/Modify/Write" (RMW) ops
-------------------------------------------
Function changes:
* :c:func:`atomic_set` --> :c:func:`refcount_set`
* :c:func:`atomic_read` --> :c:func:`refcount_read`
Memory ordering guarantee changes:
* none (both fully unordered)
case 2) - increment-based ops that return no value
--------------------------------------------------
Function changes:
* :c:func:`atomic_inc` --> :c:func:`refcount_inc`
* :c:func:`atomic_add` --> :c:func:`refcount_add`
Memory ordering guarantee changes:
* none (both fully unordered)
case 3) - decrement-based RMW ops that return no value
------------------------------------------------------
Function changes:
* :c:func:`atomic_dec` --> :c:func:`refcount_dec`
Memory ordering guarantee changes:
* fully unordered --> RELEASE ordering
case 4) - increment-based RMW ops that return a value
-----------------------------------------------------
Function changes:
* :c:func:`atomic_inc_not_zero` --> :c:func:`refcount_inc_not_zero`
* no atomic counterpart --> :c:func:`refcount_add_not_zero`
Memory ordering guarantees changes:
* fully ordered --> control dependency on success for stores
.. note:: We really assume here that necessary ordering is provided as a
result of obtaining pointer to the object!
case 5) - decrement-based RMW ops that return a value
-----------------------------------------------------
Function changes:
* :c:func:`atomic_dec_and_test` --> :c:func:`refcount_dec_and_test`
* :c:func:`atomic_sub_and_test` --> :c:func:`refcount_sub_and_test`
* no atomic counterpart --> :c:func:`refcount_dec_if_one`
* ``atomic_add_unless(&var, -1, 1)`` --> ``refcount_dec_not_one(&var)``
Memory ordering guarantees changes:
* fully ordered --> RELEASE ordering + control dependency
.. note:: :c:func:`atomic_add_unless` only provides full order on success.
case 6) - lock-based RMW
------------------------
Function changes:
* :c:func:`atomic_dec_and_lock` --> :c:func:`refcount_dec_and_lock`
* :c:func:`atomic_dec_and_mutex_lock` --> :c:func:`refcount_dec_and_mutex_lock`
Memory ordering guarantees changes:
* fully ordered --> RELEASE ordering + control dependency + hold
:c:func:`spin_lock` on success
...@@ -112,16 +112,17 @@ Example kernel-doc function comment:: ...@@ -112,16 +112,17 @@ Example kernel-doc function comment::
/** /**
* foobar() - Brief description of foobar. * foobar() - Brief description of foobar.
* @arg: Description of argument of foobar. * @argument1: Description of parameter argument1 of foobar.
* @argument2: Description of parameter argument2 of foobar.
* *
* Longer description of foobar. * Longer description of foobar.
* *
* Return: Description of return value of foobar. * Return: Description of return value of foobar.
*/ */
int foobar(int arg) int foobar(int argument1, char *argument2)
The format is similar for documentation for structures, enums, paragraphs, The format is similar for documentation for structures, enums, paragraphs,
etc. See the sections below for details. etc. See the sections below for specific details of each type.
The kernel-doc structure is extracted from the comments, and proper `Sphinx C The kernel-doc structure is extracted from the comments, and proper `Sphinx C
Domain`_ function and type descriptions with anchors are generated for them. The Domain`_ function and type descriptions with anchors are generated for them. The
...@@ -130,6 +131,226 @@ cross-references. See below for details. ...@@ -130,6 +131,226 @@ cross-references. See below for details.
.. _Sphinx C Domain: http://www.sphinx-doc.org/en/stable/domains.html .. _Sphinx C Domain: http://www.sphinx-doc.org/en/stable/domains.html
Parameters and member arguments
-------------------------------
The kernel-doc function comments describe each parameter to the function and
function typedefs or each member of struct/union, in order, with the
``@argument:`` descriptions. For each non-private member argument, one
``@argument`` definition is needed.
The ``@argument:`` descriptions begin on the very next line following
the opening brief function description line, with no intervening blank
comment lines.
The ``@argument:`` descriptions may span multiple lines.
.. note::
If the ``@argument`` description has multiple lines, the continuation
of the description should be starting exactly at the same column as
the previous line, e. g.::
* @argument: some long description
* that continues on next lines
or::
* @argument:
* some long description
* that continues on next lines
If a function or typedef parameter argument is ``...`` (e. g. a variable
number of arguments), its description should be listed in kernel-doc
notation as::
* @...: description
Private members
~~~~~~~~~~~~~~~
Inside a struct or union description, you can use the ``private:`` and
``public:`` comment tags. Structure fields that are inside a ``private:``
area are not listed in the generated output documentation.
The ``private:`` and ``public:`` tags must begin immediately following a
``/*`` comment marker. They may optionally include comments between the
``:`` and the ending ``*/`` marker.
Example::
/**
* struct my_struct - short description
* @a: first member
* @b: second member
* @d: fourth member
*
* Longer description
*/
struct my_struct {
int a;
int b;
/* private: internal use only */
int c;
/* public: the next one is public */
int d;
};
Function documentation
----------------------
The general format of a function and function-like macro kernel-doc comment is::
/**
* function_name() - Brief description of function.
* @arg1: Describe the first argument.
* @arg2: Describe the second argument.
* One can provide multiple line descriptions
* for arguments.
*
* A longer description, with more discussion of the function function_name()
* that might be useful to those using or modifying it. Begins with an
* empty comment line, and may include additional embedded empty
* comment lines.
*
* The longer description may have multiple paragraphs.
*
* Return: Describe the return value of foobar.
*
* The return value description can also have multiple paragraphs, and should
* be placed at the end of the comment block.
*/
The brief description following the function name may span multiple lines, and
ends with an argument description, a blank comment line, or the end of the
comment block.
Return values
~~~~~~~~~~~~~
The return value, if any, should be described in a dedicated section
named ``Return``.
.. note::
#) The multi-line descriptive text you provide does *not* recognize
line breaks, so if you try to format some text nicely, as in::
* Return:
* 0 - OK
* -EINVAL - invalid argument
* -ENOMEM - out of memory
this will all run together and produce::
Return: 0 - OK -EINVAL - invalid argument -ENOMEM - out of memory
So, in order to produce the desired line breaks, you need to use a
ReST list, e. g.::
* Return:
* * 0 - OK to runtime suspend the device
* * -EBUSY - Device should not be runtime suspended
#) If the descriptive text you provide has lines that begin with
some phrase followed by a colon, each of those phrases will be taken
as a new section heading, with probably won't produce the desired
effect.
Structure, union, and enumeration documentation
-----------------------------------------------
The general format of a struct, union, and enum kernel-doc comment is::
/**
* struct struct_name - Brief description.
* @argument: Description of member member_name.
*
* Description of the structure.
*/
On the above, ``struct`` is used to mean structs. You can also use ``union``
and ``enum`` to describe unions and enums. ``argument`` is used
to mean struct and union member names as well as enumerations in an enum.
The brief description following the structure name may span multiple lines, and
ends with a member description, a blank comment line, or the end of the
comment block.
The kernel-doc data structure comments describe each member of the structure,
in order, with the member descriptions.
Nested structs/unions
~~~~~~~~~~~~~~~~~~~~~
It is possible to document nested structs unions, like::
/**
* struct nested_foobar - a struct with nested unions and structs
* @arg1: - first argument of anonymous union/anonymous struct
* @arg2: - second argument of anonymous union/anonymous struct
* @arg3: - third argument of anonymous union/anonymous struct
* @arg4: - fourth argument of anonymous union/anonymous struct
* @bar.st1.arg1 - first argument of struct st1 on union bar
* @bar.st1.arg2 - second argument of struct st1 on union bar
* @bar.st2.arg1 - first argument of struct st2 on union bar
* @bar.st2.arg2 - second argument of struct st2 on union bar
struct nested_foobar {
/* Anonymous union/struct*/
union {
struct {
int arg1;
int arg2;
}
struct {
void *arg3;
int arg4;
}
}
union {
struct {
int arg1;
int arg2;
} st1;
struct {
void *arg1;
int arg2;
} st2;
} bar;
};
.. note::
#) When documenting nested structs or unions, if the struct/union ``foo``
is named, the argument ``bar`` inside it should be documented as
``@foo.bar:``
#) When the nested struct/union is anonymous, the argument ``bar`` on it
should be documented as ``@bar:``
Typedef documentation
---------------------
The general format of a typedef kernel-doc comment is::
/**
* typedef type_name - Brief description.
*
* Description of the type.
*/
Typedefs with function prototypes can also be documented::
/**
* typedef type_name - Brief description.
* @arg1: description of arg1
* @arg2: description of arg2
*
* Description of the type.
*/
typedef void (*type_name)(struct v4l2_ctrl *arg1, void *arg2);
Highlights and cross-references Highlights and cross-references
------------------------------- -------------------------------
...@@ -201,70 +422,7 @@ cross-references. ...@@ -201,70 +422,7 @@ cross-references.
For further details, please refer to the `Sphinx C Domain`_ documentation. For further details, please refer to the `Sphinx C Domain`_ documentation.
Function documentation
----------------------
The general format of a function and function-like macro kernel-doc comment is::
/**
* function_name() - Brief description of function.
* @arg1: Describe the first argument.
* @arg2: Describe the second argument.
* One can provide multiple line descriptions
* for arguments.
*
* A longer description, with more discussion of the function function_name()
* that might be useful to those using or modifying it. Begins with an
* empty comment line, and may include additional embedded empty
* comment lines.
*
* The longer description may have multiple paragraphs.
*
* Return: Describe the return value of foobar.
*
* The return value description can also have multiple paragraphs, and should
* be placed at the end of the comment block.
*/
The brief description following the function name may span multiple lines, and
ends with an ``@argument:`` description, a blank comment line, or the end of the
comment block.
The kernel-doc function comments describe each parameter to the function, in
order, with the ``@argument:`` descriptions. The ``@argument:`` descriptions
must begin on the very next line following the opening brief function
description line, with no intervening blank comment lines. The ``@argument:``
descriptions may span multiple lines. The continuation lines may contain
indentation. If a function parameter is ``...`` (varargs), it should be listed
in kernel-doc notation as: ``@...:``.
The return value, if any, should be described in a dedicated section at the end
of the comment starting with "Return:".
Structure, union, and enumeration documentation
-----------------------------------------------
The general format of a struct, union, and enum kernel-doc comment is::
/**
* struct struct_name - Brief description.
* @member_name: Description of member member_name.
*
* Description of the structure.
*/
Below, "struct" is used to mean structs, unions and enums, and "member" is used
to mean struct and union members as well as enumerations in an enum.
The brief description following the structure name may span multiple lines, and
ends with a ``@member:`` description, a blank comment line, or the end of the
comment block.
The kernel-doc data structure comments describe each member of the structure, in
order, with the ``@member:`` descriptions. The ``@member:`` descriptions must
begin on the very next line following the opening brief function description
line, with no intervening blank comment lines. The ``@member:`` descriptions may
span multiple lines. The continuation lines may contain indentation.
In-line member documentation comments In-line member documentation comments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -294,42 +452,6 @@ on a line of their own, like all other kernel-doc comments:: ...@@ -294,42 +452,6 @@ on a line of their own, like all other kernel-doc comments::
int foobar; int foobar;
} }
Private members
~~~~~~~~~~~~~~~
Inside a struct description, you can use the "private:" and "public:" comment
tags. Structure fields that are inside a "private:" area are not listed in the
generated output documentation. The "private:" and "public:" tags must begin
immediately following a ``/*`` comment marker. They may optionally include
comments between the ``:`` and the ending ``*/`` marker.
Example::
/**
* struct my_struct - short description
* @a: first member
* @b: second member
*
* Longer description
*/
struct my_struct {
int a;
int b;
/* private: internal use only */
int c;
};
Typedef documentation
---------------------
The general format of a typedef kernel-doc comment is::
/**
* typedef type_name - Brief description.
*
* Description of the type.
*/
Overview documentation comments Overview documentation comments
------------------------------- -------------------------------
...@@ -376,3 +498,37 @@ file. ...@@ -376,3 +498,37 @@ file.
Data structures visible in kernel include files should also be documented using Data structures visible in kernel include files should also be documented using
kernel-doc formatted comments. kernel-doc formatted comments.
How to use kernel-doc to generate man pages
-------------------------------------------
If you just want to use kernel-doc to generate man pages you can do this
from the Kernel git tree::
$ scripts/kernel-doc -man $(git grep -l '/\*\*' |grep -v Documentation/) | ./split-man.pl /tmp/man
Using the small ``split-man.pl`` script below::
#!/usr/bin/perl
if ($#ARGV < 0) {
die "where do I put the results?\n";
}
mkdir $ARGV[0],0777;
$state = 0;
while (<STDIN>) {
if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) {
if ($state == 1) { close OUT }
$state = 1;
$fn = "$ARGV[0]/$1.9";
print STDERR "Creating $fn\n";
open OUT, ">$fn" or die "can't open $fn: $!\n";
print OUT $_;
} elsif ($state != 0) {
print OUT $_;
}
}
close OUT;
...@@ -13,12 +13,6 @@ Driver device table ...@@ -13,12 +13,6 @@ Driver device table
.. kernel-doc:: include/linux/mod_devicetable.h .. kernel-doc:: include/linux/mod_devicetable.h
:internal: :internal:
Atomic and pointer manipulation
-------------------------------
.. kernel-doc:: arch/x86/include/asm/atomic.h
:internal:
Delaying, scheduling, and timer routines Delaying, scheduling, and timer routines
---------------------------------------- ----------------------------------------
...@@ -85,6 +79,21 @@ Internal Functions ...@@ -85,6 +79,21 @@ Internal Functions
.. kernel-doc:: kernel/kthread.c .. kernel-doc:: kernel/kthread.c
:export: :export:
Reference counting
------------------
.. kernel-doc:: include/linux/refcount.h
:internal:
.. kernel-doc:: lib/refcount.c
:export:
Atomics
-------
.. kernel-doc:: arch/x86/include/asm/atomic.h
:internal:
Kernel objects manipulation Kernel objects manipulation
--------------------------- ---------------------------
......
...@@ -98,3 +98,55 @@ you to check the sanity of the setup. ...@@ -98,3 +98,55 @@ you to check the sanity of the setup.
cat /dev/ttyUSB0 cat /dev/ttyUSB0
done done
===== end of bash scripts =============== ===== end of bash scripts ===============
Serial TTY
==========
The DbC support has been added to the xHCI driver. You can get a
debug device provided by the DbC at runtime.
In order to use this, you need to make sure your kernel has been
configured to support USB_XHCI_DBGCAP. A sysfs attribute under
the xHCI device node is used to enable or disable DbC. By default,
DbC is disabled::
root@target:/sys/bus/pci/devices/0000:00:14.0# cat dbc
disabled
Enable DbC with the following command::
root@target:/sys/bus/pci/devices/0000:00:14.0# echo enable > dbc
You can check the DbC state at anytime::
root@target:/sys/bus/pci/devices/0000:00:14.0# cat dbc
enabled
Connect the debug target to the debug host with a USB 3.0 super-
speed A-to-A debugging cable. You can see /dev/ttyDBC0 created
on the debug target. You will see below kernel message lines::
root@target: tail -f /var/log/kern.log
[ 182.730103] xhci_hcd 0000:00:14.0: DbC connected
[ 191.169420] xhci_hcd 0000:00:14.0: DbC configured
[ 191.169597] xhci_hcd 0000:00:14.0: DbC now attached to /dev/ttyDBC0
Accordingly, the DbC state has been brought up to::
root@target:/sys/bus/pci/devices/0000:00:14.0# cat dbc
configured
On the debug host, you will see the debug device has been enumerated.
You will see below kernel message lines::
root@host: tail -f /var/log/kern.log
[ 79.454780] usb 2-2.1: new SuperSpeed USB device number 3 using xhci_hcd
[ 79.475003] usb 2-2.1: LPM exit latency is zeroed, disabling LPM.
[ 79.475389] usb 2-2.1: New USB device found, idVendor=1d6b, idProduct=0010
[ 79.475390] usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 79.475391] usb 2-2.1: Product: Linux USB Debug Target
[ 79.475392] usb 2-2.1: Manufacturer: Linux Foundation
[ 79.475393] usb 2-2.1: SerialNumber: 0001
The debug device works now. You can use any communication or debugging
program to talk between the host and the target.
...@@ -321,6 +321,6 @@ linux-usb-devel Mailing List Archives: ...@@ -321,6 +321,6 @@ linux-usb-devel Mailing List Archives:
http://marc.theaimsgroup.com/?l=linux-usb-devel http://marc.theaimsgroup.com/?l=linux-usb-devel
Programming Guide for Linux USB Device Drivers: Programming Guide for Linux USB Device Drivers:
http://usb.cs.tum.edu/usbdoc http://lmu.web.psi.ch/docu/manuals/software_manuals/linux_sl/usb_linux_programming_guide.pdf
USB Home Page: http://www.usb.org USB Home Page: http://www.usb.org
Fault injection capabilities infrastructure Fault injection capabilities infrastructure
=========================================== ===========================================
See also drivers/md/faulty.c and "every_nth" module option for scsi_debug. See also drivers/md/md-faulty.c and "every_nth" module option for scsi_debug.
Available fault injection capabilities Available fault injection capabilities
......
...@@ -49,12 +49,10 @@ sb=n Use alternate superblock at this location. ...@@ -49,12 +49,10 @@ sb=n Use alternate superblock at this location.
user_xattr Enable "user." POSIX Extended Attributes user_xattr Enable "user." POSIX Extended Attributes
(requires CONFIG_EXT2_FS_XATTR). (requires CONFIG_EXT2_FS_XATTR).
See also http://acl.bestbits.at
nouser_xattr Don't support "user." extended attributes. nouser_xattr Don't support "user." extended attributes.
acl Enable POSIX Access Control Lists support acl Enable POSIX Access Control Lists support
(requires CONFIG_EXT2_FS_POSIX_ACL). (requires CONFIG_EXT2_FS_POSIX_ACL).
See also http://acl.bestbits.at
noacl Don't support POSIX ACLs. noacl Don't support POSIX ACLs.
nobh Do not attach buffer_heads to file pagecache. nobh Do not attach buffer_heads to file pagecache.
......
...@@ -202,15 +202,14 @@ inode_readahead_blks=n This tuning parameter controls the maximum ...@@ -202,15 +202,14 @@ inode_readahead_blks=n This tuning parameter controls the maximum
the buffer cache. The default value is 32 blocks. the buffer cache. The default value is 32 blocks.
nouser_xattr Disables Extended User Attributes. See the nouser_xattr Disables Extended User Attributes. See the
attr(5) manual page and http://acl.bestbits.at/ attr(5) manual page for more information about
for more information about extended attributes. extended attributes.
noacl This option disables POSIX Access Control List noacl This option disables POSIX Access Control List
support. If ACL support is enabled in the kernel support. If ACL support is enabled in the kernel
configuration (CONFIG_EXT4_FS_POSIX_ACL), ACL is configuration (CONFIG_EXT4_FS_POSIX_ACL), ACL is
enabled by default on mount. See the acl(5) manual enabled by default on mount. See the acl(5) manual
page and http://acl.bestbits.at/ for more information page for more information about acl.
about acl.
bsddf (*) Make 'df' act like BSD. bsddf (*) Make 'df' act like BSD.
minixdf Make 'df' act like Minix. minixdf Make 'df' act like Minix.
......
...@@ -344,4 +344,4 @@ the following: ...@@ -344,4 +344,4 @@ the following:
characters in the final slot are set to Unicode 0xFFFF. characters in the final slot are set to Unicode 0xFFFF.
Finally, note that the extended name is stored in Unicode. Each Unicode Finally, note that the extended name is stored in Unicode. Each Unicode
character takes two bytes. character takes either two or four bytes, UTF-16LE encoded.
...@@ -17,13 +17,16 @@ i2c-10, ...). All 256 minor device numbers are reserved for i2c. ...@@ -17,13 +17,16 @@ i2c-10, ...). All 256 minor device numbers are reserved for i2c.
C example C example
========= =========
So let's say you want to access an i2c adapter from a C program. The So let's say you want to access an i2c adapter from a C program.
first thing to do is "#include <linux/i2c-dev.h>". Please note that First, you need to include these two headers:
there are two files named "i2c-dev.h" out there, one is distributed
with the Linux kernel and is meant to be included from kernel #include <linux/i2c-dev.h>
driver code, the other one is distributed with i2c-tools and is #include <i2c/smbus.h>
meant to be included from user-space programs. You obviously want
the second one here. (Please note that there are two files named "i2c-dev.h" out there. One is
distributed with the Linux kernel and the other one is included in the
source tree of i2c-tools. They used to be different in content but since 2012
they're identical. You should use "linux/i2c-dev.h").
Now, you have to decide which adapter you want to access. You should Now, you have to decide which adapter you want to access. You should
inspect /sys/class/i2c-dev/ or run "i2cdetect -l" to decide this. inspect /sys/class/i2c-dev/ or run "i2cdetect -l" to decide this.
......
...@@ -13,6 +13,18 @@ documents into a coherent whole. Please note that improvements to the ...@@ -13,6 +13,18 @@ documents into a coherent whole. Please note that improvements to the
documentation are welcome; join the linux-doc list at vger.kernel.org if documentation are welcome; join the linux-doc list at vger.kernel.org if
you want to help out. you want to help out.
Licensing documentation
-----------------------
The following describes the license of the Linux kernel source code
(GPLv2), how to properly mark the license of individual files in the source
tree, as well as links to the full license text.
.. toctree::
:maxdepth: 2
process/license-rules.rst
User-oriented documentation User-oriented documentation
--------------------------- ---------------------------
...@@ -52,6 +64,7 @@ merged much easier. ...@@ -52,6 +64,7 @@ merged much easier.
dev-tools/index dev-tools/index
doc-guide/index doc-guide/index
kernel-hacking/index kernel-hacking/index
maintainer/index
Kernel API documentation Kernel API documentation
------------------------ ------------------------
......
...@@ -77,6 +77,27 @@ applicable everywhere (see syntax). ...@@ -77,6 +77,27 @@ applicable everywhere (see syntax).
Optionally, dependencies only for this default value can be added with Optionally, dependencies only for this default value can be added with
"if". "if".
The default value deliberately defaults to 'n' in order to avoid bloating the
build. With few exceptions, new config options should not change this. The
intent is for "make oldconfig" to add as little as possible to the config from
release to release.
Note:
Things that merit "default y/m" include:
a) A new Kconfig option for something that used to always be built
should be "default y".
b) A new gatekeeping Kconfig option that hides/shows other Kconfig
options (but does not generate any code of its own), should be
"default y" so people will see those other options.
c) Sub-driver behavior or similar options for a driver that is
"default n". This allows you to provide sane defaults.
d) Hardware or infrastructure that everybody expects, such as CONFIG_NET
or CONFIG_BLOCK. These are rare exceptions.
- type definition + default value: - type definition + default value:
"def_bool"/"def_tristate" <expr> ["if" <expr>] "def_bool"/"def_tristate" <expr> ["if" <expr>]
This is a shorthand notation for a type definition plus a value. This is a shorthand notation for a type definition plus a value.
......
NOTE: this document is outdated and will eventually be removed. See
Documentation/doc-guide/ for current information.
kernel-doc nano-HOWTO
=====================
How to format kernel-doc comments
---------------------------------
In order to provide embedded, 'C' friendly, easy to maintain,
but consistent and extractable documentation of the functions and
data structures in the Linux kernel, the Linux kernel has adopted
a consistent style for documenting functions and their parameters,
and structures and their members.
The format for this documentation is called the kernel-doc format.
It is documented in this Documentation/kernel-doc-nano-HOWTO.txt file.
This style embeds the documentation within the source files, using
a few simple conventions. The scripts/kernel-doc perl script, the
Documentation/sphinx/kerneldoc.py Sphinx extension and other tools understand
these conventions, and are used to extract this embedded documentation
into various documents.
In order to provide good documentation of kernel functions and data
structures, please use the following conventions to format your
kernel-doc comments in Linux kernel source.
We definitely need kernel-doc formatted documentation for functions
that are exported to loadable modules using EXPORT_SYMBOL.
We also look to provide kernel-doc formatted documentation for
functions externally visible to other kernel files (not marked
"static").
We also recommend providing kernel-doc formatted documentation
for private (file "static") routines, for consistency of kernel
source code layout. But this is lower priority and at the
discretion of the MAINTAINER of that kernel source file.
Data structures visible in kernel include files should also be
documented using kernel-doc formatted comments.
The opening comment mark "/**" is reserved for kernel-doc comments.
Only comments so marked will be considered by the kernel-doc scripts,
and any comment so marked must be in kernel-doc format. Do not use
"/**" to be begin a comment block unless the comment block contains
kernel-doc formatted comments. The closing comment marker for
kernel-doc comments can be either "*/" or "**/", but "*/" is
preferred in the Linux kernel tree.
Kernel-doc comments should be placed just before the function
or data structure being described.
Example kernel-doc function comment:
/**
* foobar() - short function description of foobar
* @arg1: Describe the first argument to foobar.
* @arg2: Describe the second argument to foobar.
* One can provide multiple line descriptions
* for arguments.
*
* A longer description, with more discussion of the function foobar()
* that might be useful to those using or modifying it. Begins with
* empty comment line, and may include additional embedded empty
* comment lines.
*
* The longer description can have multiple paragraphs.
*
* Return: Describe the return value of foobar.
*/
The short description following the subject can span multiple lines
and ends with an @argument description, an empty line or the end of
the comment block.
The @argument descriptions must begin on the very next line following
this opening short function description line, with no intervening
empty comment lines.
If a function parameter is "..." (varargs), it should be listed in
kernel-doc notation as:
* @...: description
The return value, if any, should be described in a dedicated section
named "Return".
Example kernel-doc data structure comment.
/**
* struct blah - the basic blah structure
* @mem1: describe the first member of struct blah
* @mem2: describe the second member of struct blah,
* perhaps with more lines and words.
*
* Longer description of this structure.
*/
The kernel-doc function comments describe each parameter to the
function, in order, with the @name lines.
The kernel-doc data structure comments describe each structure member
in the data structure, with the @name lines.
The longer description formatting is "reflowed", losing your line
breaks. So presenting carefully formatted lists within these
descriptions won't work so well; derived documentation will lose
the formatting.
See the section below "How to add extractable documentation to your
source files" for more details and notes on how to format kernel-doc
comments.
Components of the kernel-doc system
-----------------------------------
Many places in the source tree have extractable documentation in the
form of block comments above functions. The components of this system
are:
- scripts/kernel-doc
This is a perl script that hunts for the block comments and can mark
them up directly into DocBook, ReST, man, text, and HTML. (No, not
texinfo.)
- scripts/docproc.c
This is a program for converting SGML template files into SGML
files. When a file is referenced it is searched for symbols
exported (EXPORT_SYMBOL), to be able to distinguish between internal
and external functions.
It invokes kernel-doc, giving it the list of functions that
are to be documented.
Additionally it is used to scan the SGML template files to locate
all the files referenced herein. This is used to generate dependency
information as used by make.
- Makefile
The targets 'xmldocs', 'latexdocs', 'pdfdocs', 'epubdocs'and 'htmldocs'
are used to build XML DocBook files, LaTeX files, PDF files,
ePub files and html files in Documentation/.
How to extract the documentation
--------------------------------
If you just want to read the ready-made books on the various
subsystems, just type 'make epubdocs', or 'make pdfdocs', or 'make htmldocs',
depending on your preference. If you would rather read a different format,
you can type 'make xmldocs' and then use DocBook tools to convert
Documentation/output/*.xml to a format of your choice (for example,
'db2html ...' if 'make htmldocs' was not defined).
If you want to see man pages instead, you can do this:
$ cd linux
$ scripts/kernel-doc -man $(find -name '*.c') | split-man.pl /tmp/man
$ scripts/kernel-doc -man $(find -name '*.h') | split-man.pl /tmp/man
Here is split-man.pl:
-->
#!/usr/bin/perl
if ($#ARGV < 0) {
die "where do I put the results?\n";
}
mkdir $ARGV[0],0777;
$state = 0;
while (<STDIN>) {
if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) {
if ($state == 1) { close OUT }
$state = 1;
$fn = "$ARGV[0]/$1.9";
print STDERR "Creating $fn\n";
open OUT, ">$fn" or die "can't open $fn: $!\n";
print OUT $_;
} elsif ($state != 0) {
print OUT $_;
}
}
close OUT;
<--
If you just want to view the documentation for one function in one
file, you can do this:
$ scripts/kernel-doc -man -function fn file | nroff -man | less
or this:
$ scripts/kernel-doc -text -function fn file
How to add extractable documentation to your source files
---------------------------------------------------------
The format of the block comment is like this:
/**
* function_name(:)? (- short description)?
(* @parameterx(space)*: (description of parameter x)?)*
(* a blank line)?
* (Description:)? (Description of function)?
* (section header: (section description)? )*
(*)?*/
All "description" text can span multiple lines, although the
function_name & its short description are traditionally on a single line.
Description text may also contain blank lines (i.e., lines that contain
only a "*").
"section header:" names must be unique per function (or struct,
union, typedef, enum).
Use the section header "Return" for sections describing the return value
of a function.
Avoid putting a spurious blank line after the function name, or else the
description will be repeated!
All descriptive text is further processed, scanning for the following special
patterns, which are highlighted appropriately.
'funcname()' - function
'$ENVVAR' - environment variable
'&struct_name' - name of a structure (up to two words including 'struct')
'@parameter' - name of a parameter
'%CONST' - name of a constant.
NOTE 1: The multi-line descriptive text you provide does *not* recognize
line breaks, so if you try to format some text nicely, as in:
Return:
0 - cool
1 - invalid arg
2 - out of memory
this will all run together and produce:
Return: 0 - cool 1 - invalid arg 2 - out of memory
NOTE 2: If the descriptive text you provide has lines that begin with
some phrase followed by a colon, each of those phrases will be taken as
a new section heading, which means you should similarly try to avoid text
like:
Return:
0: cool
1: invalid arg
2: out of memory
every line of which would start a new section. Again, probably not
what you were after.
Take a look around the source tree for examples.
kernel-doc for structs, unions, enums, and typedefs
---------------------------------------------------
Beside functions you can also write documentation for structs, unions,
enums and typedefs. Instead of the function name you must write the name
of the declaration; the struct/union/enum/typedef must always precede
the name. Nesting of declarations is not supported.
Use the argument mechanism to document members or constants.
Inside a struct description, you can use the "private:" and "public:"
comment tags. Structure fields that are inside a "private:" area
are not listed in the generated output documentation. The "private:"
and "public:" tags must begin immediately following a "/*" comment
marker. They may optionally include comments between the ":" and the
ending "*/" marker.
Example:
/**
* struct my_struct - short description
* @a: first member
* @b: second member
*
* Longer description
*/
struct my_struct {
int a;
int b;
/* private: internal use only */
int c;
};
Including documentation blocks in source files
----------------------------------------------
To facilitate having source code and comments close together, you can
include kernel-doc documentation blocks that are free-form comments
instead of being kernel-doc for functions, structures, unions,
enums, or typedefs. This could be used for something like a
theory of operation for a driver or library code, for example.
This is done by using a DOC: section keyword with a section title. E.g.:
/**
* DOC: Theory of Operation
*
* The whizbang foobar is a dilly of a gizmo. It can do whatever you
* want it to do, at any time. It reads your mind. Here's how it works.
*
* foo bar splat
*
* The only drawback to this gizmo is that is can sometimes damage
* hardware, software, or its subject(s).
*/
DOC: sections are used in ReST files.
Tim.
*/ <twaugh@redhat.com>
...@@ -523,7 +523,7 @@ this expression is true, or ``-ERESTARTSYS`` if a signal is received. The ...@@ -523,7 +523,7 @@ this expression is true, or ``-ERESTARTSYS`` if a signal is received. The
Waking Up Queued Tasks Waking Up Queued Tasks
---------------------- ----------------------
Call :c:func:`wake_up()` (``include/linux/wait.h``);, which will wake Call :c:func:`wake_up()` (``include/linux/wait.h``), which will wake
up every process in the queue. The exception is if one has up every process in the queue. The exception is if one has
``TASK_EXCLUSIVE`` set, in which case the remainder of the queue will ``TASK_EXCLUSIVE`` set, in which case the remainder of the queue will
not be woken. There are other variants of this basic function available not 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 ...@@ -690,8 +690,8 @@ not provide the necessary runtime environment and the include files are
not tested for it. It is still possible, but not recommended. If you not tested for it. It is still possible, but not recommended. If you
really want to do this, forget about exceptions at least. really want to do this, forget about exceptions at least.
NUMif #if
----- ---
It is generally considered cleaner to use macros in header files (or at It is generally considered cleaner to use macros in header files (or at
the top of .c files) to abstract away functions rather than using \`#if' the top of .c files) to abstract away functions rather than using \`#if'
......
# -*- coding: utf-8; mode: python -*-
project = 'Linux Kernel Development Documentation'
tags.add("subproject")
latex_documents = [
('index', 'maintainer.tex', 'Linux Kernel Development Documentation',
'The kernel development community', 'manual'),
]
.. _configuregit:
Configure Git
=============
This chapter describes maintainer level git configuration.
Tagged branches used in :ref:`Documentation/maintainer/pull-requests.rst
<pullrequests>` should be signed with the developers public GPG key. Signed
tags can be created by passing the ``-u`` flag to ``git tag``. However,
since you would *usually* use the same key for the same project, you can
set it once with
::
git config user.signingkey "keyname"
Alternatively, edit your ``.git/config`` or ``~/.gitconfig`` file by hand:
::
[user]
name = Jane Developer
email = jd@domain.org
signingkey = jd@domain.org
You may need to tell ``git`` to use ``gpg2``
::
[gpg]
program = /path/to/gpg2
You may also like to tell ``gpg`` which ``tty`` to use (add to your shell rc file)
::
export GPG_TTY=$(tty)
==========================
Kernel Maintainer Handbook
==========================
This document is the humble beginning of a manual for kernel maintainers.
There is a lot yet to go here! Please feel free to propose (and write)
additions to this manual.
.. toctree::
:maxdepth: 2
configure-git
pull-requests
.. _pullrequests:
Creating Pull Requests
======================
This chapter describes how maintainers can create and submit pull requests
to other maintainers. This is useful for transferring changes from one
maintainers tree to another maintainers tree.
This document was written by Tobin C. Harding (who at that time, was not an
experienced maintainer) primarily from comments made by Greg Kroah-Hartman
and Linus Torvalds on LKML. Suggestions and fixes by Jonathan Corbet and
Mauro Carvalho Chehab. Misrepresentation was unintentional but inevitable,
please direct abuse to Tobin C. Harding <me@tobin.cc>.
Original email thread::
http://lkml.kernel.org/r/20171114110500.GA21175@kroah.com
Create Branch
-------------
To start with you will need to have all the changes you wish to include in
the pull request on a separate branch. Typically you will base this branch
off of a branch in the developers tree whom you intend to send the pull
request to.
In order to create the pull request you must first tag the branch that you
have just created. It is recommended that you choose a meaningful tag name,
in a way that you and others can understand, even after some time. A good
practice is to include in the name an indicator of the sybsystem of origin
and the target kernel version.
Greg offers the following. A pull request with miscellaneous stuff for
drivers/char, to be applied at the Kernel version 4.15-rc1 could be named
as ``char-misc-4.15-rc1``. If such tag would be produced from a branch
named ``char-misc-next``, you would be using the following command::
git tag -s char-misc-4.15-rc1 char-misc-next
that will create a signed tag called ``char-misc-4.15-rc1`` based on the
last commit in the ``char-misc-next`` branch, and sign it with your gpg key
(see :ref:`Documentation/maintainer/configure_git.rst <configuregit>`).
Linus will only accept pull requests based on a signed tag. Other
maintainers may differ.
When you run the above command ``git`` will drop you into an editor and ask
you to describe the tag. In this case, you are describing a pull request,
so outline what is contained here, why it should be merged, and what, if
any, testing has been done. All of this information will end up in the tag
itself, and then in the merge commit that the maintainer makes if/when they
merge the pull request. So write it up well, as it will be in the kernel
tree for forever.
As said by Linus::
Anyway, at least to me, the important part is the *message*. I want
to understand what I'm pulling, and why I should pull it. I also
want to use that message as the message for the merge, so it should
not just make sense to me, but make sense as a historical record
too.
Note that if there is something odd about the pull request, that
should very much be in the explanation. If you're touching files
that you don't maintain, explain _why_. I will see it in the
diffstat anyway, and if you didn't mention it, I'll just be extra
suspicious. And when you send me new stuff after the merge window
(or even bug-fixes, but ones that look scary), explain not just
what they do and why they do it, but explain the _timing_. What
happened that this didn't go through the merge window..
I will take both what you write in the email pull request _and_ in
the signed tag, so depending on your workflow, you can either
describe your work in the signed tag (which will also automatically
make it into the pull request email), or you can make the signed
tag just a placeholder with nothing interesting in it, and describe
the work later when you actually send me the pull request.
And yes, I will edit the message. Partly because I tend to do just
trivial formatting (the whole indentation and quoting etc), but
partly because part of the message may make sense for me at pull
time (describing the conflicts and your personal issues for sending
it right now), but may not make sense in the context of a merge
commit message, so I will try to make it all make sense. I will
also fix any speeling mistaeks and bad grammar I notice,
particularly for non-native speakers (but also for native ones
;^). But I may miss some, or even add some.
Linus
Greg gives, as an example pull request::
Char/Misc patches for 4.15-rc1
Here is the big char/misc patch set for the 4.15-rc1 merge window.
Contained in here is the normal set of new functions added to all
of these crazy drivers, as well as the following brand new
subsystems:
- time_travel_controller: Finally a set of drivers for the
latest time travel bus architecture that provides i/o to
the CPU before it asked for it, allowing uninterrupted
processing
- relativity_shifters: due to the affect that the
time_travel_controllers have on the overall system, there
was a need for a new set of relativity shifter drivers to
accommodate the newly formed black holes that would
threaten to suck CPUs into them. This subsystem handles
this in a way to successfully neutralize the problems.
There is a Kconfig option to force these to be enabled
when needed, so problems should not occur.
All of these patches have been successfully tested in the latest
linux-next releases, and the original problems that it found have
all been resolved (apologies to anyone living near Canberra for the
lack of the Kconfig options in the earlier versions of the
linux-next tree creations.)
Signed-off-by: Your-name-here <your_email@domain>
The tag message format is just like a git commit id. One line at the top
for a "summary subject" and be sure to sign-off at the bottom.
Now that you have a local signed tag, you need to push it up to where it
can be retrieved::
git push origin char-misc-4.15-rc1
Create Pull Request
-------------------
The last thing to do is create the pull request message. ``git`` handily
will do this for you with the ``git request-pull`` command, but it needs a
bit of help determining what you want to pull, and on what to base the pull
against (to show the correct changes to be pulled and the diffstat). The
following command(s) will generate a pull request::
git request-pull master git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ char-misc-4.15-rc1
Quoting Greg::
This is asking git to compare the difference from the
'char-misc-4.15-rc1' tag location, to the head of the 'master'
branch (which in my case points to the last location in Linus's
tree that I diverged from, usually a -rc release) and to use the
git:// protocol to pull from. If you wish to use https://, that
can be used here instead as well (but note that some people behind
firewalls will have problems with https git pulls).
If the char-misc-4.15-rc1 tag is not present in the repo that I am
asking to be pulled from, git will complain saying it is not there,
a handy way to remember to actually push it to a public location.
The output of 'git request-pull' will contain the location of the
git tree and specific tag to pull from, and the full text
description of that tag (which is why you need to provide good
information in that tag). It will also create a diffstat of the
pull request, and a shortlog of the individual commits that the
pull request will provide.
Linus responded that he tends to prefer the ``git://`` protocol. Other
maintainers may have different preferences. Also, note that if you are
creating pull requests without a signed tag then ``https://`` may be a
better choice. Please see the original thread for the full discussion.
Submit Pull Request
-------------------
A pull request is submitted in the same way as an ordinary patch. Send as
inline email to the maintainer and CC LKML and any sub-system specific
lists if required. Pull requests to Linus typically have a subject line
something like::
[GIT PULL] <subsystem> changes for v4.15-rc1
...@@ -68,6 +68,7 @@ we might work for today, have in the past, or will in the future. ...@@ -68,6 +68,7 @@ we might work for today, have in the past, or will in the future.
- Paul Burton - Paul Burton
- Javier Martinez Canillas - Javier Martinez Canillas
- Rob Clark - Rob Clark
- Kees Cook (Google)
- Jonathan Corbet - Jonathan Corbet
- Dennis Dalessandro - Dennis Dalessandro
- Vivien Didelot (Savoir-faire Linux) - Vivien Didelot (Savoir-faire Linux)
...@@ -137,6 +138,7 @@ we might work for today, have in the past, or will in the future. ...@@ -137,6 +138,7 @@ we might work for today, have in the past, or will in the future.
- Anna Schumaker - Anna Schumaker
- Jes Sorensen - Jes Sorensen
- K.Y. Srinivasan - K.Y. Srinivasan
- David Sterba (SUSE)
- Heiko Stuebner - Heiko Stuebner
- Jiri Kosina (SUSE) - Jiri Kosina (SUSE)
- Willy Tarreau - Willy Tarreau
...@@ -144,6 +146,7 @@ we might work for today, have in the past, or will in the future. ...@@ -144,6 +146,7 @@ we might work for today, have in the past, or will in the future.
- Linus Torvalds - Linus Torvalds
- Thierry Reding - Thierry Reding
- Rik van Riel - Rik van Riel
- Luis R. Rodriguez
- Geert Uytterhoeven (Glider bvba) - Geert Uytterhoeven (Glider bvba)
- Eduardo Valentin (Amazon.com) - Eduardo Valentin (Amazon.com)
- Daniel Vetter - Daniel Vetter
......
.. SPDX-License-Identifier: GPL-2.0
Linux kernel licensing rules
============================
The Linux Kernel is provided under the terms of the GNU General Public
License version 2 only (GPL-2.0), as published by the Free Software
Foundation, and provided in the COPYING file. This documentation file is
not meant to replace the COPYING file, but provides a description of how
each source file should be annotated to make the licensing it is governed
under clear and unambiguous.
The license in the COPYING file applies to the kernel source as a whole,
though individual source files can have a different license which is
required to be compatible with the GPL-2.0::
GPL-1.0+ : GNU General Public License v1.0 or later
GPL-2.0+ : GNU General Public License v2.0 or later
LGPL-2.0 : GNU Library General Public License v2 only
LGPL-2.0+ : GNU Library General Public License v2 or later
LGPL-2.1 : GNU Lesser General Public License v2.1 only
LGPL-2.1+ : GNU Lesser General Public License v2.1 or later
Aside from that, individual files can be provided under a dual license,
e.g. one of the compatible GPL variants and alternatively under a
permissive license like BSD, MIT etc.
The User-space API (UAPI) header files, which describe the interface of
user-space programs to the kernel are a special case. According to the
note in the kernel COPYING file, the syscall interface is a clear boundary,
which does not extend the GPL requirements to any software which uses it to
communicate with the kernel. Because the UAPI headers must be includable
into any source files which create an executable running on the Linux
kernel, the exception must be documented by a special license expression.
The common way of expressing the license of a source file is to add the
matching boilerplate text into the top comment of the file. Due to
formatting, typos etc. these "boilerplates" are hard to validate for
tools which are used in the context of license compliance.
An alternative to boilerplate text is the use of Software Package Data
Exchange (SPDX) license identifiers in each source file. SPDX license
identifiers are machine parsable and precise shorthands for the license
under which the content of the file is contributed. SPDX license
identifiers are managed by the SPDX Workgroup at the Linux Foundation and
have been agreed on by partners throughout the industry, tool vendors, and
legal teams. For further information see https://spdx.org/
The Linux kernel requires the precise SPDX identifier in all source files.
The valid identifiers used in the kernel are explained in the section
`License identifiers`_ and have been retrieved from the official SPDX
license list at https://spdx.org/licenses/ along with the license texts.
License identifier syntax
-------------------------
1. Placement:
The SPDX license identifier in kernel files shall be added at the first
possible line in a file which can contain a comment. For the majority
or files this is the first line, except for scripts which require the
'#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX
identifier goes into the second line.
|
2. Style:
The SPDX license identifier is added in form of a comment. The comment
style depends on the file type::
C source: // SPDX-License-Identifier: <SPDX License Expression>
C header: /* SPDX-License-Identifier: <SPDX License Expression> */
ASM: /* SPDX-License-Identifier: <SPDX License Expression> */
scripts: # SPDX-License-Identifier: <SPDX License Expression>
.rst: .. SPDX-License-Identifier: <SPDX License Expression>
.dts{i}: // SPDX-License-Identifier: <SPDX License Expression>
If a specific tool cannot handle the standard comment style, then the
appropriate comment mechanism which the tool accepts shall be used. This
is the reason for having the "/\* \*/" style comment in C header
files. There was build breakage observed with generated .lds files where
'ld' failed to parse the C++ comment. This has been fixed by now, but
there are still older assembler tools which cannot handle C++ style
comments.
|
3. Syntax:
A <SPDX License Expression> is either an SPDX short form license
identifier found on the SPDX License List, or the combination of two
SPDX short form license identifiers separated by "WITH" when a license
exception applies. When multiple licenses apply, an expression consists
of keywords "AND", "OR" separating sub-expressions and surrounded by
"(", ")" .
License identifiers for licenses like [L]GPL with the 'or later' option
are constructed by using a "+" for indicating the 'or later' option.::
// SPDX-License-Identifier: GPL-2.0+
// SPDX-License-Identifier: LGPL-2.1+
WITH should be used when there is a modifier to a license needed.
For example, the linux kernel UAPI files use the expression::
// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
// SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note
Other examples using WITH exceptions found in the kernel are::
// SPDX-License-Identifier: GPL-2.0 WITH mif-exception
// SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0
Exceptions can only be used with particular License identifiers. The
valid License identifiers are listed in the tags of the exception text
file. For details see the point `Exceptions`_ in the chapter `License
identifiers`_.
OR should be used if the file is dual licensed and only one license is
to be selected. For example, some dtsi files are available under dual
licenses::
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
Examples from the kernel for license expressions in dual licensed files::
// SPDX-License-Identifier: GPL-2.0 OR MIT
// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
// SPDX-License-Identifier: GPL-2.0 OR Apache-2.0
// SPDX-License-Identifier: GPL-2.0 OR MPL-1.1
// SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT
// SPDX-License-Identifier: GPL-1.0+ OR BSD-3-Clause OR OpenSSL
AND should be used if the file has multiple licenses whose terms all
apply to use the file. For example, if code is inherited from another
project and permission has been given to put it in the kernel, but the
original license terms need to remain in effect::
// SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) AND MIT
Another other example where both sets of license terms need to be
adhered to is::
// SPDX-License-Identifier: GPL-1.0+ AND LGPL-2.1+
License identifiers
-------------------
The licenses currently used, as well as the licenses for code added to the
kernel, can be broken down into:
1. _`Preferred licenses`:
Whenever possible these licenses should be used as they are known to be
fully compatible and widely used. These licenses are available from the
directory::
LICENSES/preferred/
in the kernel source tree.
The files in this directory contain the full license text and
`Metatags`_. The file names are identical to the SPDX license
identifier which shall be used for the license in source files.
Examples::
LICENSES/preferred/GPL-2.0
Contains the GPL version 2 license text and the required metatags::
LICENSES/preferred/MIT
Contains the MIT license text and the required metatags
_`Metatags`:
The following meta tags must be available in a license file:
- Valid-License-Identifier:
One or more lines which declare which License Identifiers are valid
inside the project to reference this particular license text. Usually
this is a single valid identifier, but e.g. for licenses with the 'or
later' options two identifiers are valid.
- SPDX-URL:
The URL of the SPDX page which contains additional information related
to the license.
- Usage-Guidance:
Freeform text for usage advice. The text must include correct examples
for the SPDX license identifiers as they should be put into source
files according to the `License identifier syntax`_ guidelines.
- License-Text:
All text after this tag is treated as the original license text
File format examples::
Valid-License-Identifier: GPL-2.0
Valid-License-Identifier: GPL-2.0+
SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
Usage-Guide:
To use this license in source code, put one of the following SPDX
tag/value pairs into a comment according to the placement
guidelines in the licensing rules documentation.
For 'GNU General Public License (GPL) version 2 only' use:
SPDX-License-Identifier: GPL-2.0
For 'GNU General Public License (GPL) version 2 or any later version' use:
SPDX-License-Identifier: GPL-2.0+
License-Text:
Full license text
::
SPDX-License-Identifier: MIT
SPDX-URL: https://spdx.org/licenses/MIT.html
Usage-Guide:
To use this license in source code, put the following SPDX
tag/value pair into a comment according to the placement
guidelines in the licensing rules documentation.
SPDX-License-Identifier: MIT
License-Text:
Full license text
|
2. Not recommended licenses:
These licenses should only be used for existing code or for importing
code from a different project. These licenses are available from the
directory::
LICENSES/other/
in the kernel source tree.
The files in this directory contain the full license text and
`Metatags`_. The file names are identical to the SPDX license
identifier which shall be used for the license in source files.
Examples::
LICENSES/other/ISC
Contains the Internet Systems Consortium license text and the required
metatags::
LICENSES/other/ZLib
Contains the ZLIB license text and the required metatags.
Metatags:
The metatag requirements for 'other' licenses are identical to the
requirements of the `Preferred licenses`_.
File format example::
Valid-License-Identifier: ISC
SPDX-URL: https://spdx.org/licenses/ISC.html
Usage-Guide:
Usage of this license in the kernel for new code is discouraged
and it should solely be used for importing code from an already
existing project.
To use this license in source code, put the following SPDX
tag/value pair into a comment according to the placement
guidelines in the licensing rules documentation.
SPDX-License-Identifier: ISC
License-Text:
Full license text
|
3. _`Exceptions`:
Some licenses can be amended with exceptions which grant certain rights
which the original license does not. These exceptions are available
from the directory::
LICENSES/exceptions/
in the kernel source tree. The files in this directory contain the full
exception text and the required `Exception Metatags`_.
Examples::
LICENSES/exceptions/Linux-syscall-note
Contains the Linux syscall exception as documented in the COPYING
file of the Linux kernel, which is used for UAPI header files.
e.g. /\* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note \*/::
LICENSES/exceptions/GCC-exception-2.0
Contains the GCC 'linking exception' which allows to link any binary
independent of its license against the compiled version of a file marked
with this exception. This is required for creating runnable executables
from source code which is not compatible with the GPL.
_`Exception Metatags`:
The following meta tags must be available in an exception file:
- SPDX-Exception-Identifier:
One exception identifier which can be used with SPDX license
identifiers.
- SPDX-URL:
The URL of the SPDX page which contains additional information related
to the exception.
- SPDX-Licenses:
A comma separated list of SPDX license identifiers for which the
exception can be used.
- Usage-Guidance:
Freeform text for usage advice. The text must be followed by correct
examples for the SPDX license identifiers as they should be put into
source files according to the `License identifier syntax`_ guidelines.
- Exception-Text:
All text after this tag is treated as the original exception text
File format examples::
SPDX-Exception-Identifier: Linux-syscall-note
SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html
SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+
Usage-Guidance:
This exception is used together with one of the above SPDX-Licenses
to mark user-space API (uapi) header files so they can be included
into non GPL compliant user-space application code.
To use this exception add it with the keyword WITH to one of the
identifiers in the SPDX-Licenses tag:
SPDX-License-Identifier: <SPDX-License> WITH Linux-syscall-note
Exception-Text:
Full exception text
::
SPDX-Exception-Identifier: GCC-exception-2.0
SPDX-URL: https://spdx.org/licenses/GCC-exception-2.0.html
SPDX-Licenses: GPL-2.0, GPL-2.0+
Usage-Guidance:
The "GCC Runtime Library exception 2.0" is used together with one
of the above SPDX-Licenses for code imported from the GCC runtime
library.
To use this exception add it with the keyword WITH to one of the
identifiers in the SPDX-Licenses tag:
SPDX-License-Identifier: <SPDX-License> WITH GCC-exception-2.0
Exception-Text:
Full exception text
All SPDX license identifiers and exceptions must have a corresponding file
in the LICENSE subdirectories. This is required to allow tool
verification (e.g. checkpatch.pl) and to have the licenses ready to read
and extract right from the source, which is recommended by various FOSS
organizations, e.g. the `FSFE REUSE initiative <https://reuse.software/>`_.
...@@ -37,7 +37,9 @@ and elsewhere regarding submitting Linux kernel patches. ...@@ -37,7 +37,9 @@ and elsewhere regarding submitting Linux kernel patches.
You should be able to justify all violations that remain in You should be able to justify all violations that remain in
your patch. your patch.
6) Any new or modified ``CONFIG`` options don't muck up the config menu. 6) Any new or modified ``CONFIG`` options do not muck up the config menu and
default to off unless they meet the exception criteria documented in
``Documentation/kbuild/kconfig-language.txt`` Menu attributes: default value.
7) All new ``Kconfig`` options have help text. 7) All new ``Kconfig`` options have help text.
......
...@@ -451,6 +451,13 @@ checks and hooks done. Both the current and the proposed sets of credentials ...@@ -451,6 +451,13 @@ checks and hooks done. Both the current and the proposed sets of credentials
are available for this purpose as current_cred() will return the current set are available for this purpose as current_cred() will return the current set
still at this point. still at this point.
When replacing the group list, the new list must be sorted before it
is added to the credential, as a binary search is used to test for
membership. In practice, this means :c:func:`groups_sort` should be
called before :c:func:`set_groups` or :c:func:`set_current_groups`.
:c:func:`groups_sort)` must not be called on a ``struct group_list`` which
is shared as it may permute elements as part of the sorting process
even if the array is already sorted.
When the credential set is ready, it should be committed to the current process When the credential set is ready, it should be committed to the current process
by calling:: by calling::
......
...@@ -270,6 +270,21 @@ attacks, it is important to defend against exposure of both kernel memory ...@@ -270,6 +270,21 @@ attacks, it is important to defend against exposure of both kernel memory
addresses and kernel memory contents (since they may contain kernel addresses and kernel memory contents (since they may contain kernel
addresses or other sensitive things like canary values). addresses or other sensitive things like canary values).
Kernel addresses
----------------
Printing kernel addresses to userspace leaks sensitive information about
the kernel memory layout. Care should be exercised when using any printk
specifier that prints the raw address, currently %px, %p[ad], (and %p[sSb]
in certain circumstances [*]). Any file written to using one of these
specifiers should be readable only by privileged processes.
Kernels 4.14 and older printed the raw address using %p. As of 4.15-rc1
addresses printed with the specifier %p are hashed before printing.
[*] If KALLSYMS is enabled and symbol lookup fails, the raw address is
printed. If KALLSYMS is not enabled the raw address is printed.
Unique identifiers Unique identifiers
------------------ ------------------
......
...@@ -81,7 +81,7 @@ __version__ = '1.0.0' ...@@ -81,7 +81,7 @@ __version__ = '1.0.0'
# ------------- # -------------
def which(cmd): def which(cmd):
"""Searches the ``cmd`` in the ``PATH`` enviroment. """Searches the ``cmd`` in the ``PATH`` environment.
This *which* searches the PATH for executable ``cmd`` . First match is This *which* searches the PATH for executable ``cmd`` . First match is
returned, if nothing is found, ``None` is returned. returned, if nothing is found, ``None` is returned.
...@@ -419,7 +419,7 @@ def visit_kernel_render(self, node): ...@@ -419,7 +419,7 @@ def visit_kernel_render(self, node):
tmp_ext = RENDER_MARKUP_EXT.get(srclang, None) tmp_ext = RENDER_MARKUP_EXT.get(srclang, None)
if tmp_ext is None: if tmp_ext is None:
app.warn('kernel-render: "%s" unknow / include raw.' % (srclang)) app.warn('kernel-render: "%s" unknown / include raw.' % (srclang))
return return
if not dot_cmd and tmp_ext == '.dot': if not dot_cmd and tmp_ext == '.dot':
...@@ -482,7 +482,7 @@ class KernelRender(Figure): ...@@ -482,7 +482,7 @@ class KernelRender(Figure):
srclang = self.arguments[0].strip() srclang = self.arguments[0].strip()
if srclang not in RENDER_MARKUP_EXT.keys(): if srclang not in RENDER_MARKUP_EXT.keys():
return [self.state_machine.reporter.warning( return [self.state_machine.reporter.warning(
'Unknow source language "%s", use one of: %s.' % ( 'Unknown source language "%s", use one of: %s.' % (
srclang, ",".join(RENDER_MARKUP_EXT.keys())), srclang, ",".join(RENDER_MARKUP_EXT.keys())),
line=self.lineno)] line=self.lineno)]
......
...@@ -34,6 +34,7 @@ show up in /proc/sys/kernel: ...@@ -34,6 +34,7 @@ show up in /proc/sys/kernel:
- hostname - hostname
- hotplug - hotplug
- hardlockup_all_cpu_backtrace - hardlockup_all_cpu_backtrace
- hardlockup_panic
- hung_task_panic - hung_task_panic
- hung_task_check_count - hung_task_check_count
- hung_task_timeout_secs - hung_task_timeout_secs
...@@ -313,6 +314,19 @@ will be initiated. ...@@ -313,6 +314,19 @@ will be initiated.
1: on detection capture more debug information. 1: on detection capture more debug information.
============================================================== ==============================================================
hardlockup_panic:
This parameter can be used to control whether the kernel panics
when a hard lockup is detected.
0 - don't panic on hard lockup
1 - panic on hard lockup
See Documentation/lockup-watchdogs.txt for more information. This can
also be set using the nmi_watchdog kernel parameter.
==============================================================
hotplug: hotplug:
Path for the hotplug policy agent. Path for the hotplug policy agent.
...@@ -377,7 +391,8 @@ kptr_restrict: ...@@ -377,7 +391,8 @@ kptr_restrict:
This toggle indicates whether restrictions are placed on This toggle indicates whether restrictions are placed on
exposing kernel addresses via /proc and other interfaces. exposing kernel addresses via /proc and other interfaces.
When kptr_restrict is set to (0), the default, there are no restrictions. When kptr_restrict is set to 0 (the default) the address is hashed before
printing. (This is the equivalent to %p.)
When kptr_restrict is set to (1), kernel pointers printed using the %pK When kptr_restrict is set to (1), kernel pointers printed using the %pK
format specifier will be replaced with 0's unless the user has CAP_SYSLOG format specifier will be replaced with 0's unless the user has CAP_SYSLOG
......
...@@ -42,9 +42,9 @@ as well as what protections the callback will perform and not require ...@@ -42,9 +42,9 @@ as well as what protections the callback will perform and not require
ftrace to handle. ftrace to handle.
There is only one field that is needed to be set when registering There is only one field that is needed to be set when registering
an ftrace_ops with ftrace:: an ftrace_ops with ftrace:
.. code-block: c .. code-block:: c
struct ftrace_ops ops = { struct ftrace_ops ops = {
.func = my_callback_func, .func = my_callback_func,
...@@ -81,12 +81,12 @@ may take some time to finish. ...@@ -81,12 +81,12 @@ may take some time to finish.
The callback function The callback function
===================== =====================
The prototype of the callback function is as follows (as of v4.14):: The prototype of the callback function is as follows (as of v4.14):
.. code-block: c .. code-block:: c
void callback_func(unsigned long ip, unsigned long parent_ip, void callback_func(unsigned long ip, unsigned long parent_ip,
struct ftrace_ops *op, struct pt_regs *regs); struct ftrace_ops *op, struct pt_regs *regs);
@ip @ip
This is the instruction pointer of the function that is being traced. This is the instruction pointer of the function that is being traced.
...@@ -176,10 +176,10 @@ Filtering which functions to trace ...@@ -176,10 +176,10 @@ Filtering which functions to trace
If a callback is only to be called from specific functions, a filter must be If a callback is only to be called from specific functions, a filter must be
set up. The filters are added by name, or ip if it is known. set up. The filters are added by name, or ip if it is known.
.. code-block: c .. code-block:: c
int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf,
int len, int reset); int len, int reset);
@ops @ops
The ops to set the filter with The ops to set the filter with
...@@ -202,9 +202,9 @@ See Filter Commands in :file:`Documentation/trace/ftrace.txt`. ...@@ -202,9 +202,9 @@ See Filter Commands in :file:`Documentation/trace/ftrace.txt`.
To just trace the schedule function:: To just trace the schedule function::
.. code-block: c .. code-block:: c
ret = ftrace_set_filter(&ops, "schedule", strlen("schedule"), 0); ret = ftrace_set_filter(&ops, "schedule", strlen("schedule"), 0);
To add more functions, call the ftrace_set_filter() more than once with the To add more functions, call the ftrace_set_filter() more than once with the
@reset parameter set to zero. To remove the current filter set and replace it @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,17 +212,17 @@ with new functions defined by @buf, have @reset be non-zero.
To remove all the filtered functions and trace all functions:: To remove all the filtered functions and trace all functions::
.. code-block: c .. code-block:: c
ret = ftrace_set_filter(&ops, NULL, 0, 1); ret = ftrace_set_filter(&ops, NULL, 0, 1);
Sometimes more than one function has the same name. To trace just a specific Sometimes more than one function has the same name. To trace just a specific
function in this case, ftrace_set_filter_ip() can be used. function in this case, ftrace_set_filter_ip() can be used.
.. code-block: c .. code-block:: c
ret = ftrace_set_filter_ip(&ops, ip, 0, 0); ret = ftrace_set_filter_ip(&ops, ip, 0, 0);
Although the ip must be the address where the call to fentry or mcount is Although the ip must be the address where the call to fentry or mcount is
located in the function. This function is used by perf and kprobes that located in the function. This function is used by perf and kprobes that
...@@ -237,10 +237,10 @@ be called by any function. ...@@ -237,10 +237,10 @@ be called by any function.
An empty "notrace" list means to allow all functions defined by the filter An empty "notrace" list means to allow all functions defined by the filter
to be traced. to be traced.
.. code-block: c .. code-block:: c
int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
int len, int reset); int len, int reset);
This takes the same parameters as ftrace_set_filter() but will add the This takes the same parameters as ftrace_set_filter() but will add the
functions it finds to not be traced. This is a separate list from the functions it finds to not be traced. This is a separate list from the
...@@ -251,7 +251,7 @@ that match @buf to it. ...@@ -251,7 +251,7 @@ that match @buf to it.
Clearing the "notrace" list is the same as clearing the filter list Clearing the "notrace" list is the same as clearing the filter list
.. code-block: c .. code-block:: c
ret = ftrace_set_notrace(&ops, NULL, 0, 1); ret = ftrace_set_notrace(&ops, NULL, 0, 1);
...@@ -264,29 +264,29 @@ If a filter is in place, and the @reset is non-zero, and @buf contains a ...@@ -264,29 +264,29 @@ If a filter is in place, and the @reset is non-zero, and @buf contains a
matching glob to functions, the switch will happen during the time of matching glob to functions, the switch will happen during the time of
the ftrace_set_filter() call. At no time will all functions call the callback. the ftrace_set_filter() call. At no time will all functions call the callback.
.. code-block: c .. code-block:: c
ftrace_set_filter(&ops, "schedule", strlen("schedule"), 1); ftrace_set_filter(&ops, "schedule", strlen("schedule"), 1);
register_ftrace_function(&ops); register_ftrace_function(&ops);
msleep(10); msleep(10);
ftrace_set_filter(&ops, "try_to_wake_up", strlen("try_to_wake_up"), 1); ftrace_set_filter(&ops, "try_to_wake_up", strlen("try_to_wake_up"), 1);
is not the same as: is not the same as:
.. code-block: c .. code-block:: c
ftrace_set_filter(&ops, "schedule", strlen("schedule"), 1); ftrace_set_filter(&ops, "schedule", strlen("schedule"), 1);
register_ftrace_function(&ops); register_ftrace_function(&ops);
msleep(10); msleep(10);
ftrace_set_filter(&ops, NULL, 0, 1); ftrace_set_filter(&ops, NULL, 0, 1);
ftrace_set_filter(&ops, "try_to_wake_up", strlen("try_to_wake_up"), 0); ftrace_set_filter(&ops, "try_to_wake_up", strlen("try_to_wake_up"), 0);
As the latter will have a short time where all functions will call As the latter will have a short time where all functions will call
the callback, between the time of the reset, and the time of the the callback, between the time of the reset, and the time of the
......
...@@ -23,13 +23,13 @@ cat /sys/kernel/debug/ci_hdrc.0/registers ...@@ -23,13 +23,13 @@ cat /sys/kernel/debug/ci_hdrc.0/registers
2) Connect 2 boards with usb cable with one end is micro A plug, the other end 2) Connect 2 boards with usb cable with one end is micro A plug, the other end
is micro B plug. is micro B plug.
The A-device(with micro A plug inserted) should enumrate B-device. The A-device(with micro A plug inserted) should enumerate B-device.
3) Role switch 3) Role switch
On B-device: On B-device:
echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
B-device should take host role and enumrate A-device. B-device should take host role and enumerate A-device.
4) A-device switch back to host. 4) A-device switch back to host.
On B-device: On B-device:
...@@ -40,13 +40,13 @@ cat /sys/kernel/debug/ci_hdrc.0/registers ...@@ -40,13 +40,13 @@ cat /sys/kernel/debug/ci_hdrc.0/registers
side by answering the polling from B-Host, this can be done on A-device: side by answering the polling from B-Host, this can be done on A-device:
echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
A-device should switch back to host and enumrate B-device. A-device should switch back to host and enumerate B-device.
5) Remove B-device(unplug micro B plug) and insert again in 10 seconds, 5) Remove B-device(unplug micro B plug) and insert again in 10 seconds,
A-device should enumrate B-device again. A-device should enumerate B-device again.
6) Remove B-device(unplug micro B plug) and insert again after 10 seconds, 6) Remove B-device(unplug micro B plug) and insert again after 10 seconds,
A-device should NOT enumrate B-device. A-device should NOT enumerate B-device.
if A-device wants to use bus: if A-device wants to use bus:
On A-device: On A-device:
...@@ -67,7 +67,7 @@ cat /sys/kernel/debug/ci_hdrc.0/registers ...@@ -67,7 +67,7 @@ cat /sys/kernel/debug/ci_hdrc.0/registers
On B-device: On B-device:
echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
A-device should resume usb bus and enumrate B-device. A-device should resume usb bus and enumerate B-device.
1.3 Reference document 1.3 Reference document
---------------------- ----------------------
......
...@@ -104,7 +104,7 @@ madvise(MADV_HWPOISON, ....) ...@@ -104,7 +104,7 @@ madvise(MADV_HWPOISON, ....)
hwpoison-inject module through debugfs hwpoison-inject module through debugfs
/sys/debug/hwpoison/ /sys/kernel/debug/hwpoison/
corrupt-pfn corrupt-pfn
......
...@@ -76,7 +76,7 @@ See struct w1_bus_master definition in w1.h for details. ...@@ -76,7 +76,7 @@ See struct w1_bus_master definition in w1.h for details.
w1 master sysfs interface w1 master sysfs interface
------------------------------------------------------------------ ------------------------------------------------------------------
<xx-xxxxxxxxxxxxx> - A directory for a found device. The format is family-serial <xx-xxxxxxxxxxxx> - A directory for a found device. The format is family-serial
bus - (standard) symlink to the w1 bus bus - (standard) symlink to the w1 bus
driver - (standard) symlink to the w1 driver driver - (standard) symlink to the w1 driver
w1_master_add - (rw) manually register a slave device w1_master_add - (rw) manually register a slave device
......
SPDX-Exception-Identifier: Linux-syscall-note
SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html
SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+
Usage-Guide:
This exception is used together with one of the above SPDX-Licenses
to mark user space API (uapi) header files so they can be included
into non GPL compliant user space application code.
To use this exception add it with the keyword WITH to one of the
identifiers in the SPDX-Licenses tag:
SPDX-License-Identifier: <SPDX-License> WITH Linux-syscall-note
License-Text:
NOTE! This copyright does *not* cover user programs that use kernel
services by normal system calls - this is merely considered normal use
of the kernel, and does *not* fall under the heading of "derived work".
Also note that the GPL below is copyrighted by the Free Software
Foundation, but the instance of code that it refers to (the Linux
kernel) is copyrighted by me and others who actually wrote it.
Also note that the only valid version of the GPL as far as the kernel
is concerned is _this_ particular version of the license (ie v2, not
v2.2 or v3.x or whatever), unless explicitly otherwise stated.
Linus Torvalds
Valid-License-Identifier: GPL-1.0+
SPDX-URL: https://spdx.org/licenses/GPL-1.0.html
Usage-Guide:
The GNU General Public License (GPL) version 1 should not be used in new
code. For existing kernel code the 'or any later version' option is
required to be compatible with the general license of the project: GPLv2.
To use the license in source code, put the following SPDX tag/value pair
into a comment according to the placement guidelines in the licensing
rules documentation:
SPDX-License-Identifier: GPL-1.0+
License-Text:
GNU GENERAL PUBLIC LICENSE
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
When we speak of free software, we are referring to freedom, not
price. Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.
2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:
a) cause the modified files to carry prominent notices stating that
you changed the files and the date of any change; and
b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
Source code for a work means the preferred form of the work for making
modifications to it. For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.
4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License. However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.
5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.
7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.
8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
program `Gnomovision' (a program to direct compilers to make passes
at assemblers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
That's all there is to it!
Valid-License-Identifier: MPL-1.1
SPDX-URL: https://spdx.org/licenses/MPL-1.1.html
Usage-Guide:
To use the Mozilla Public License version 1.1 put the following SPDX
tag/value pair into a comment according to the placement guidelines in
the licensing rules documentation:
SPDX-License-Identifier: MPL-1.1
License-Text:
MOZILLA PUBLIC LICENSE
Version 1.1
---------------
1. Definitions.
1.0.1. "Commercial Use" means distribution or otherwise making the
Covered Code available to a third party.
1.1. "Contributor" means each entity that creates or contributes to
the creation of Modifications.
1.2. "Contributor Version" means the combination of the Original
Code, prior Modifications used by a Contributor, and the Modifications
made by that particular Contributor.
1.3. "Covered Code" means the Original Code or Modifications or the
combination of the Original Code and Modifications, in each case
including portions thereof.
1.4. "Electronic Distribution Mechanism" means a mechanism generally
accepted in the software development community for the electronic
transfer of data.
1.5. "Executable" means Covered Code in any form other than Source
Code.
1.6. "Initial Developer" means the individual or entity identified
as the Initial Developer in the Source Code notice required by Exhibit
A.
1.7. "Larger Work" means a work which combines Covered Code or
portions thereof with code not governed by the terms of this License.
1.8. "License" means this document.
1.8.1. "Licensable" means having the right to grant, to the maximum
extent possible, whether at the time of the initial grant or
subsequently acquired, any and all of the rights conveyed herein.
1.9. "Modifications" means any addition to or deletion from the
substance or structure of either the Original Code or any previous
Modifications. When Covered Code is released as a series of files, a
Modification is:
A. Any addition to or deletion from the contents of a file
containing Original Code or previous Modifications.
B. Any new file that contains any part of the Original Code or
previous Modifications.
1.10. "Original Code" means Source Code of computer software code
which is described in the Source Code notice required by Exhibit A as
Original Code, and which, at the time of its release under this
License is not already Covered Code governed by this License.
1.10.1. "Patent Claims" means any patent claim(s), now owned or
hereafter acquired, including without limitation, method, process,
and apparatus claims, in any patent Licensable by grantor.
1.11. "Source Code" means the preferred form of the Covered Code for
making modifications to it, including all modules it contains, plus
any associated interface definition files, scripts used to control
compilation and installation of an Executable, or source code
differential comparisons against either the Original Code or another
well known, available Covered Code of the Contributor's choice. The
Source Code can be in a compressed or archival form, provided the
appropriate decompression or de-archiving software is widely available
for no charge.
1.12. "You" (or "Your") means an individual or a legal entity
exercising rights under, and complying with all of the terms of, this
License or a future version of this License issued under Section 6.1.
For legal entities, "You" includes any entity which controls, is
controlled by, or is under common control with You. For purposes of
this definition, "control" means (a) the power, direct or indirect,
to cause the direction or management of such entity, whether by
contract or otherwise, or (b) ownership of more than fifty percent
(50%) of the outstanding shares or beneficial ownership of such
entity.
2. Source Code License.
2.1. The Initial Developer Grant.
The Initial Developer hereby grants You a world-wide, royalty-free,
non-exclusive license, subject to third party intellectual property
claims:
(a) under intellectual property rights (other than patent or
trademark) Licensable by Initial Developer to use, reproduce,
modify, display, perform, sublicense and distribute the Original
Code (or portions thereof) with or without Modifications, and/or
as part of a Larger Work; and
(b) under Patents Claims infringed by the making, using or
selling of Original Code, to make, have made, use, practice,
sell, and offer for sale, and/or otherwise dispose of the
Original Code (or portions thereof).
(c) the licenses granted in this Section 2.1(a) and (b) are
effective on the date Initial Developer first distributes
Original Code under the terms of this License.
(d) Notwithstanding Section 2.1(b) above, no patent license is
granted: 1) for code that You delete from the Original Code; 2)
separate from the Original Code; or 3) for infringements caused
by: i) the modification of the Original Code or ii) the
combination of the Original Code with other software or devices.
2.2. Contributor Grant.
Subject to third party intellectual property claims, each Contributor
hereby grants You a world-wide, royalty-free, non-exclusive license
(a) under intellectual property rights (other than patent or
trademark) Licensable by Contributor, to use, reproduce, modify,
display, perform, sublicense and distribute the Modifications
created by such Contributor (or portions thereof) either on an
unmodified basis, with other Modifications, as Covered Code
and/or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using, or
selling of Modifications made by that Contributor either alone
and/or in combination with its Contributor Version (or portions
of such combination), to make, use, sell, offer for sale, have
made, and/or otherwise dispose of: 1) Modifications made by that
Contributor (or portions thereof); and 2) the combination of
Modifications made by that Contributor with its Contributor
Version (or portions of such combination).
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
effective on the date Contributor first makes Commercial Use of
the Covered Code.
(d) Notwithstanding Section 2.2(b) above, no patent license is
granted: 1) for any code that Contributor has deleted from the
Contributor Version; 2) separate from the Contributor Version;
3) for infringements caused by: i) third party modifications of
Contributor Version or ii) the combination of Modifications made
by that Contributor with other software (except as part of the
Contributor Version) or other devices; or 4) under Patent Claims
infringed by Covered Code in the absence of Modifications made by
that Contributor.
3. Distribution Obligations.
3.1. Application of License.
The Modifications which You create or to which You contribute are
governed by the terms of this License, including without limitation
Section 2.2. The Source Code version of Covered Code may be
distributed only under the terms of this License or a future version
of this License released under Section 6.1, and You must include a
copy of this License with every copy of the Source Code You
distribute. You may not offer or impose any terms on any Source Code
version that alters or restricts the applicable version of this
License or the recipients' rights hereunder. However, You may include
an additional document offering the additional rights described in
Section 3.5.
3.2. Availability of Source Code.
Any Modification which You create or to which You contribute must be
made available in Source Code form under the terms of this License
either on the same media as an Executable version or via an accepted
Electronic Distribution Mechanism to anyone to whom you made an
Executable version available; and if made available via Electronic
Distribution Mechanism, must remain available for at least twelve (12)
months after the date it initially became available, or at least six
(6) months after a subsequent version of that particular Modification
has been made available to such recipients. You are responsible for
ensuring that the Source Code version remains available even if the
Electronic Distribution Mechanism is maintained by a third party.
3.3. Description of Modifications.
You must cause all Covered Code to which You contribute to contain a
file documenting the changes You made to create that Covered Code and
the date of any change. You must include a prominent statement that
the Modification is derived, directly or indirectly, from Original
Code provided by the Initial Developer and including the name of the
Initial Developer in (a) the Source Code, and (b) in any notice in an
Executable version or related documentation in which You describe the
origin or ownership of the Covered Code.
3.4. Intellectual Property Matters
(a) Third Party Claims.
If Contributor has knowledge that a license under a third party's
intellectual property rights is required to exercise the rights
granted by such Contributor under Sections 2.1 or 2.2,
Contributor must include a text file with the Source Code
distribution titled "LEGAL" which describes the claim and the
party making the claim in sufficient detail that a recipient will
know whom to contact. If Contributor obtains such knowledge after
the Modification is made available as described in Section 3.2,
Contributor shall promptly modify the LEGAL file in all copies
Contributor makes available thereafter and shall take other steps
(such as notifying appropriate mailing lists or newsgroups)
reasonably calculated to inform those who received the Covered
Code that new knowledge has been obtained.
(b) Contributor APIs.
If Contributor's Modifications include an application programming
interface and Contributor has knowledge of patent licenses which
are reasonably necessary to implement that API, Contributor must
also include this information in the LEGAL file.
(c) Representations.
Contributor represents that, except as disclosed pursuant to
Section 3.4(a) above, Contributor believes that Contributor's
Modifications are Contributor's original creation(s) and/or
Contributor has sufficient rights to grant the rights conveyed by
this License.
3.5. Required Notices.
You must duplicate the notice in Exhibit A in each file of the Source
Code. If it is not possible to put such notice in a particular Source
Code file due to its structure, then You must include such notice in a
location (such as a relevant directory) where a user would be likely
to look for such a notice. If You created one or more Modification(s)
You may add your name as a Contributor to the notice described in
Exhibit A. You must also duplicate this License in any documentation
for the Source Code where You describe recipients' rights or ownership
rights relating to Covered Code. You may choose to offer, and to
charge a fee for, warranty, support, indemnity or liability
obligations to one or more recipients of Covered Code. However, You
may do so only on Your own behalf, and not on behalf of the Initial
Developer or any Contributor. You must make it absolutely clear than
any such warranty, support, indemnity or liability obligation is
offered by You alone, and You hereby agree to indemnify the Initial
Developer and every Contributor for any liability incurred by the
Initial Developer or such Contributor as a result of warranty,
support, indemnity or liability terms You offer.
3.6. Distribution of Executable Versions.
You may distribute Covered Code in Executable form only if the
requirements of Section 3.1-3.5 have been met for that Covered Code,
and if You include a notice stating that the Source Code version of
the Covered Code is available under the terms of this License,
including a description of how and where You have fulfilled the
obligations of Section 3.2. The notice must be conspicuously included
in any notice in an Executable version, related documentation or
collateral in which You describe recipients' rights relating to the
Covered Code. You may distribute the Executable version of Covered
Code or ownership rights under a license of Your choice, which may
contain terms different from this License, provided that You are in
compliance with the terms of this License and that the license for the
Executable version does not attempt to limit or alter the recipient's
rights in the Source Code version from the rights set forth in this
License. If You distribute the Executable version under a different
license You must make it absolutely clear that any terms which differ
from this License are offered by You alone, not by the Initial
Developer or any Contributor. You hereby agree to indemnify the
Initial Developer and every Contributor for any liability incurred by
the Initial Developer or such Contributor as a result of any such
terms You offer.
3.7. Larger Works.
You may create a Larger Work by combining Covered Code with other code
not governed by the terms of this License and distribute the Larger
Work as a single product. In such a case, You must make sure the
requirements of this License are fulfilled for the Covered Code.
4. Inability to Comply Due to Statute or Regulation.
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Code due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description
must be included in the LEGAL file described in Section 3.4 and must
be included with all distributions of the Source Code. Except to the
extent prohibited by statute or regulation, such description must be
sufficiently detailed for a recipient of ordinary skill to be able to
understand it.
5. Application of this License.
This License applies to code to which the Initial Developer has
attached the notice in Exhibit A and to related Covered Code.
6. Versions of the License.
6.1. New Versions.
Netscape Communications Corporation ("Netscape") may publish revised
and/or new versions of the License from time to time. Each version
will be given a distinguishing version number.
6.2. Effect of New Versions.
Once Covered Code has been published under a particular version of the
License, You may always continue to use it under the terms of that
version. You may also choose to use such Covered Code under the terms
of any subsequent version of the License published by Netscape. No one
other than Netscape has the right to modify the terms applicable to
Covered Code created under this License.
6.3. Derivative Works.
If You create or use a modified version of this License (which you may
only do in order to apply it to code which is not already Covered Code
governed by this License), You must (a) rename Your license so that
the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
"MPL", "NPL" or any confusingly similar phrase do not appear in your
license (except to note that your license differs from this License)
and (b) otherwise make it clear that Your version of the license
contains terms which differ from the Mozilla Public License and
Netscape Public License. (Filling in the name of the Initial
Developer, Original Code or Contributor in the notice described in
Exhibit A shall not of themselves be deemed to be modifications of
this License.)
7. DISCLAIMER OF WARRANTY.
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
8. TERMINATION.
8.1. This License and the rights granted hereunder will terminate
automatically if You fail to comply with terms herein and fail to cure
such breach within 30 days of becoming aware of the breach. All
sublicenses to the Covered Code which are properly granted shall
survive any termination of this License. Provisions which, by their
nature, must remain in effect beyond the termination of this License
shall survive.
8.2. If You initiate litigation by asserting a patent infringement
claim (excluding declatory judgment actions) against Initial Developer
or a Contributor (the Initial Developer or Contributor against whom
You file such action is referred to as "Participant") alleging that:
(a) such Participant's Contributor Version directly or indirectly
infringes any patent, then any and all rights granted by such
Participant to You under Sections 2.1 and/or 2.2 of this License
shall, upon 60 days notice from Participant terminate prospectively,
unless if within 60 days after receipt of notice You either: (i)
agree in writing to pay Participant a mutually agreeable reasonable
royalty for Your past and future use of Modifications made by such
Participant, or (ii) withdraw Your litigation claim with respect to
the Contributor Version against such Participant. If within 60 days
of notice, a reasonable royalty and payment arrangement are not
mutually agreed upon in writing by the parties or the litigation claim
is not withdrawn, the rights granted by Participant to You under
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
the 60 day notice period specified above.
(b) any software, hardware, or device, other than such Participant's
Contributor Version, directly or indirectly infringes any patent, then
any rights granted to You by such Participant under Sections 2.1(b)
and 2.2(b) are revoked effective as of the date You first made, used,
sold, distributed, or had made, Modifications made by that
Participant.
8.3. If You assert a patent infringement claim against Participant
alleging that such Participant's Contributor Version directly or
indirectly infringes any patent where such claim is resolved (such as
by license or settlement) prior to the initiation of patent
infringement litigation, then the reasonable value of the licenses
granted by such Participant under Sections 2.1 or 2.2 shall be taken
into account in determining the amount or value of any payment or
license.
8.4. In the event of termination under Sections 8.1 or 8.2 above,
all end user license agreements (excluding distributors and resellers)
which have been validly granted by You or any distributor hereunder
prior to termination shall survive termination.
9. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
10. U.S. GOVERNMENT END USERS.
The Covered Code is a "commercial item," as that term is defined in
48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
software" and "commercial computer software documentation," as such
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
all U.S. Government End Users acquire Covered Code with only those
rights set forth herein.
11. MISCELLANEOUS.
This License represents the complete agreement concerning subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. This License shall be governed by
California law provisions (except to the extent applicable law, if
any, provides otherwise), excluding its conflict-of-law provisions.
With respect to disputes in which at least one party is a citizen of,
or an entity chartered or registered to do business in the United
States of America, any litigation relating to this License shall be
subject to the jurisdiction of the Federal Courts of the Northern
District of California, with venue lying in Santa Clara County,
California, with the losing party responsible for costs, including
without limitation, court costs and reasonable attorneys' fees and
expenses. The application of the United Nations Convention on
Contracts for the International Sale of Goods is expressly excluded.
Any law or regulation which provides that the language of a contract
shall be construed against the drafter shall not apply to this
License.
12. RESPONSIBILITY FOR CLAIMS.
As between Initial Developer and the Contributors, each party is
responsible for claims and damages arising, directly or indirectly,
out of its utilization of rights under this License and You agree to
work with Initial Developer and Contributors to distribute such
responsibility on an equitable basis. Nothing herein is intended or
shall be deemed to constitute any admission of liability.
13. MULTIPLE-LICENSED CODE.
Initial Developer may designate portions of the Covered Code as
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
Developer permits you to utilize portions of the Covered Code under
Your choice of the MPL or the alternative licenses, if any, specified
by the Initial Developer in the file described in Exhibit A.
EXHIBIT A -Mozilla Public License.
``The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
https://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
The Original Code is ______________________________________.
The Initial Developer of the Original Code is ________________________.
Portions created by ______________________ are Copyright (C) ______
_______________________. All Rights Reserved.
Contributor(s): ______________________________________.
Alternatively, the contents of this file may be used under the terms
of the _____ license (the "[___] License"), in which case the
provisions of [______] License are applicable instead of those
above. If you wish to allow use of your version of this file only
under the terms of the [____] License and not to allow others to use
your version of this file under the MPL, indicate your decision by
deleting the provisions above and replace them with the notice and
other provisions required by the [___] License. If you do not delete
the provisions above, a recipient may use your version of this file
under either the MPL or the [___] License."
[NOTE: The text of this Exhibit A may differ slightly from the text of
the notices in the Source Code files of the Original Code. You should
use the text of this Exhibit A rather than the text found in the
Original Code Source Code for Your Modifications.]
Valid-License-Identifier: BSD-2-Clause
SPDX-URL: https://spdx.org/licenses/BSD-2-Clause.html
Usage-Guide:
To use the BSD 2-clause "Simplified" License put the following SPDX
tag/value pair into a comment according to the placement guidelines in
the licensing rules documentation:
SPDX-License-Identifier: BSD-2-Clause
License-Text:
Copyright (c) <year> <owner> . All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Valid-License-Identifier: BSD-3-Clause
SPDX-URL: https://spdx.org/licenses/BSD-3-Clause.html
Usage-Guide:
To use the BSD 3-clause "New" or "Revised" License put the following SPDX
tag/value pair into a comment according to the placement guidelines in
the licensing rules documentation:
SPDX-License-Identifier: BSD-3-Clause
License-Text:
Copyright (c) <year> <owner> . All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Valid-License-Identifier: BSD-3-Clause-Clear
SPDX-URL: https://spdx.org/licenses/BSD-3-Clause-Clear.html
Usage-Guide:
To use the BSD 3-clause "Clear" License put the following SPDX
tag/value pair into a comment according to the placement guidelines in
the licensing rules documentation:
SPDX-License-Identifier: BSD-3-Clause-Clear
License-Text:
The Clear BSD License
Copyright (c) [xxxx]-[xxxx] [Owner Organization]
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted (subject to the limitations in the disclaimer
below) provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of [Owner Organization] nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Valid-License-Identifier: GPL-2.0
Valid-License-Identifier: GPL-2.0+
SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
Usage-Guide:
To use this license in source code, put one of the following SPDX
tag/value pairs into a comment according to the placement
guidelines in the licensing rules documentation.
For 'GNU General Public License (GPL) version 2 only' use:
SPDX-License-Identifier: GPL-2.0
For 'GNU General Public License (GPL) version 2 or any later version' use:
SPDX-License-Identifier: GPL-2.0+
License-Text:
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
Valid-License-Identifier: LGPL-2.0
Valid-License-Identifier: LGPL-2.0+
SPDX-URL: https://spdx.org/licenses/LGPL-2.0.html
Usage-Guide:
To use this license in source code, put one of the following SPDX
tag/value pairs into a comment according to the placement
guidelines in the licensing rules documentation.
For 'GNU Library General Public License (LGPL) version 2.0 only' use:
SPDX-License-Identifier: LGPL-2.0
For 'GNU Library General Public License (LGPL) version 2.0 or any later
version' use:
SPDX-License-Identifier: LGPL-2.0+
License-Text:
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is numbered 2
because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your freedom to
share and change it. By contrast, the GNU General Public Licenses are
intended to guarantee your freedom to share and change free software--to
make sure the software is free for all its users.
This license, the Library General Public License, applies to some specially
designated Free Software Foundation software, and to any other libraries
whose authors decide to use it. You can use it for your libraries, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for this service if you
wish), that you receive source code or can get it if you want it, that you
can change the software or use pieces of it in new free programs; and that
you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to
deny you these rights or to ask you to surrender the rights. These
restrictions translate to certain responsibilities for you if you
distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis or for
a fee, you must give the recipients all the rights that we gave you. You
must make sure that they, too, receive or can get the source code. If you
link a program with the library, you must provide complete object files to
the recipients so that they can relink them with the library, after making
changes to the library and recompiling it. And you must show them these
terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright the
library, and (2) offer you this license which gives you legal permission to
copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain that
everyone understands that there is no warranty for this free library. If
the library is modified by someone else and passed on, we want its
recipients to know that what they have is not the original version, so that
any problems introduced by others will not reflect on the original authors'
reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that companies distributing free software will
individually obtain patent licenses, thus in effect transforming the
program into proprietary software. To prevent this, we have made it clear
that any patent must be licensed for everyone's free use or not licensed at
all.
Most GNU software, including some libraries, is covered by the ordinary GNU
General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General Public
License for libraries did not effectively promote software sharing, because
most developers did not use the libraries. We concluded that weaker
conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the users
of those programs of all benefit from the free status of the libraries
themselves. This Library General Public License is intended to permit
developers of non-free programs to use free libraries, while preserving
your freedom as a user of such programs to change the free libraries that
are incorporated in them. (We have not seen how to achieve this as regards
changes in header files, but we have achieved it as regards changes in the
actual functions of the Library.) The hope is that this will lead to faster
development of free libraries.
The precise terms and conditions for copying, distribution and modification
follow. Pay close attention to the difference between a "work based on the
library" and a "work that uses the library". The former contains code
derived from the library, while the latter only works together with the
library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which contains a
notice placed by the copyright holder or other authorized party saying
it may be distributed under the terms of this Library General Public
License (also called "this License"). Each licensee is addressed as
"you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work which
has been distributed under these terms. A "work based on the Library"
means either the Library or any derivative work under copyright law:
that is to say, a work containing the Library or a portion of it, either
verbatim or with modifications and/or translated straightforwardly into
another language. (Hereinafter, translation is included without
limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for making
modifications to it. For a library, complete source code means all the
source code for all modules it contains, plus any associated interface
definition files, plus the scripts used to control compilation and
installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of running
a program using the Library is not restricted, and output from such a
program is covered only if its contents constitute a work based on the
Library (independent of the use of the Library in a tool for writing
it). Whether that is true depends on what the Library does and what the
program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's complete
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the notices
that refer to this License and to the absence of any warranty; and
distribute a copy of this License along with the Library.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Library or any portion of it,
thus forming a work based on the Library, and copy and distribute such
modifications or work under the terms of Section 1 above, provided that
you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices stating
that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no charge to
all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a table
of data to be supplied by an application program that uses the
facility, other than as an argument passed when the facility is
invoked, then you must make a good faith effort to ensure that, in
the event an application does not supply such function or table, the
facility still operates, and performs whatever part of its purpose
remains meaningful.
(For example, a function in a library to compute square roots has a
purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must be
optional: if the application does not supply it, the square root
function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library, and
can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based on
the Library, the distribution of the whole must be on the terms of this
License, whose permissions for other licensees extend to the entire
whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of a
storage or distribution medium does not bring the other work under the
scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so that
they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in these
notices.
Once this change is made in a given copy, it is irreversible for that
copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of the
Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or derivative of
it, under Section 2) in object code or executable form under the terms
of Sections 1 and 2 above provided that you accompany it with the
complete corresponding machine-readable source code, which must be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange.
If distribution of object code is made by offering access to copy from a
designated place, then offering equivalent access to copy the source
code from the same place satisfies the requirement to distribute the
source code, even though third parties are not compelled to copy the
source along with the object code.
5. A program that contains no derivative of any portion of the Library, but
is designed to work with the Library by being compiled or linked with
it, is called a "work that uses the Library". Such a work, in isolation,
is not a derivative work of the Library, and therefore falls outside the
scope of this License.
However, linking a "work that uses the Library" with the Library creates
an executable that is a derivative of the Library (because it contains
portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License. Section 6
states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is
not. Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data structure
layouts and accessors, and small macros and small inline functions (ten
lines or less in length), then the use of the object file is
unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section
6. Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or link a
"work that uses the Library" with the Library to produce a work
containing portions of the Library, and distribute that work under terms
of your choice, provided that the terms permit modification of the work
for the customer's own use and reverse engineering for debugging such
modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work during
execution displays copyright notices, you must include the copyright
notice for the Library among them, as well as a reference directing the
user to the copy of this License. Also, you must do one of these things:
a) Accompany the work with the complete corresponding machine-readable
source code for the Library including whatever changes were used in
the work (which must be distributed under Sections 1 and 2 above);
and, if the work is an executable linked with the Library, with the
complete machine-readable "work that uses the Library", as object
code and/or source code, so that the user can modify the Library and
then relink to produce a modified executable containing the modified
Library. (It is understood that the user who changes the contents of
definitions files in the Library will not necessarily be able to
recompile the application to use the modified definitions.)
b) Accompany the work with a written offer, valid for at least three
years, to give the same user the materials specified in Subsection
6a, above, for a charge no more than the cost of performing this
distribution.
c) If distribution of the work is made by offering access to copy from a
designated place, offer equivalent access to copy the above specified
materials from the same place.
d) Verify that the user has already received a copy of these materials
or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the Library"
must include any data and utility programs needed for reproducing the
executable from it. However, as a special exception, the source code
distributed need not include anything that is normally distributed (in
either source or binary form) with the major components (compiler,
kernel, and so on) of the operating system on which the executable runs,
unless that component itself accompanies the executable.
It may happen that this requirement contradicts the license restrictions
of other proprietary libraries that do not normally accompany the
operating system. Such a contradiction means you cannot use both them
and the Library together in an executable that you distribute.
7. You may place library facilities that are a work based on the Library
side-by-side in a single library together with other library facilities
not covered by this License, and distribute such a combined library,
provided that the separate distribution of the work based on the Library
and of the other library facilities is otherwise permitted, and provided
that you do these two things:
a) Accompany the combined library with a copy of the same work based on
the Library, uncombined with any other library facilities. This must
be distributed under the terms of the Sections above.
b) Give prominent notice with the combined library of the fact that part
of it is a work based on the Library, and explaining where to find
the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute the
Library except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, link with, or distribute the
Library is void, and will automatically terminate your rights under this
License. However, parties who have received copies, or rights, from you
under this License will not have their licenses terminated so long as
such parties remain in full compliance.
9. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute
the Library or its derivative works. These actions are prohibited by law
if you do not accept this License. Therefore, by modifying or
distributing the Library (or any work based on the Library), you
indicate your acceptance of this License to do so, and all its terms and
conditions for copying, distributing or modifying the Library or works
based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted
herein. You are not responsible for enforcing compliance by third
parties to this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent license
would not permit royalty-free redistribution of the Library by all
those who receive copies directly or indirectly through you, then the
only way you could satisfy both it and this License would be to refrain
entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply, and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is implemented
by public license practices. Many people have made generous
contributions to the wide range of software distributed through that
system in reliance on consistent application of that system; it is up
to the author/donor to decide if he or she is willing to distribute
software through any other system and a licensee cannot impose that
choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in certain
countries either by patents or by copyrighted interfaces, the original
copyright holder who places the Library under this License may add an
explicit geographical distribution limitation excluding those
countries, so that distribution is permitted only in or among countries
not thus excluded. In such case, this License incorporates the
limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new versions of
the Library General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in
detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a license
version number, you may choose any version ever published by the Free
Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free Software
Foundation; we sometimes make exceptions for this. Our decision will be
guided by the two goals of preserving the free status of all
derivatives of our free software and of promoting the sharing and reuse
of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH
YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY
(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR
OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
one line to give the library's name and an idea of what it does.
Copyright (C) year name of author
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
signature of Ty Coon, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
Valid-License-Identifier: LGPL-2.1
Valid-License-Identifier: LGPL-2.1+
SPDX-URL: https://spdx.org/licenses/LGPL-2.1.html
Usage-Guide:
To use this license in source code, put one of the following SPDX
tag/value pairs into a comment according to the placement
guidelines in the licensing rules documentation.
For 'GNU Lesser General Public License (LGPL) version 2.1 only' use:
SPDX-License-Identifier: LGPL-2.1
For 'GNU Lesser General Public License (LGPL) version 2.1 or any later
version' use:
SPDX-License-Identifier: LGPL-2.1+
License-Text:
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts as
the successor of the GNU Library Public License, version 2, hence the
version number 2.1.]
Preamble
The licenses for most software are designed to take away your freedom to
share and change it. By contrast, the GNU General Public Licenses are
intended to guarantee your freedom to share and change free software--to
make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some specially
designated software packages--typically libraries--of the Free Software
Foundation and other authors who decide to use it. You can use it too, but
we suggest you first think carefully about whether this license or the
ordinary General Public License is the better strategy to use in any
particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use, not
price. Our General Public Licenses are designed to make sure that you have
the freedom to distribute copies of free software (and charge for this
service if you wish); that you receive source code or can get it if you
want it; that you can change the software and use pieces of it in new free
programs; and that you are informed that you can do these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for you if
you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis or for
a fee, you must give the recipients all the rights that we gave you. You
must make sure that they, too, receive or can get the source code. If you
link other code with the library, you must provide complete object files to
the recipients, so that they can relink them with the library after making
changes to the library and recompiling it. And you must show them these
terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that there is no
warranty for the free library. Also, if the library is modified by someone
else and passed on, the recipients should know that what they have is not
the original version, so that the original author's reputation will not be
affected by problems that might be introduced by others.
Finally, software patents pose a constant threat to the existence of any
free program. We wish to make sure that a company cannot effectively
restrict the users of a free program by obtaining a restrictive license
from a patent holder. Therefore, we insist that any patent license obtained
for a version of the library must be consistent with the full freedom of
use specified in this license.
Most GNU software, including some libraries, is covered by the ordinary GNU
General Public License. This license, the GNU Lesser General Public
License, applies to certain designated libraries, and is quite different
from the ordinary General Public License. We use this license for certain
libraries in order to permit linking those libraries into non-free
programs.
When a program is linked with a library, whether statically or using a
shared library, the combination of the two is legally speaking a combined
work, a derivative of the original library. The ordinary General Public
License therefore permits such linking only if the entire combination fits
its criteria of freedom. The Lesser General Public License permits more lax
criteria for linking other code with the library.
We call this license the "Lesser" General Public License because it does
Less to protect the user's freedom than the ordinary General Public
License. It also provides other free software developers Less of an
advantage over competing non-free programs. These disadvantages are the
reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to encourage
the widest possible use of a certain library, so that it becomes a de-facto
standard. To achieve this, non-free programs must be allowed to use the
library. A more frequent case is that a free library does the same job as
widely used non-free libraries. In this case, there is little to gain by
limiting the free library to free software only, so we use the Lesser
General Public License.
In other cases, permission to use a particular library in non-free programs
enables a greater number of people to use a large body of free
software. For example, permission to use the GNU C Library in non-free
programs enables many more people to use the whole GNU operating system, as
well as its variant, the GNU/Linux operating system.
Although the Lesser General Public License is Less protective of the users'
freedom, it does ensure that the user of a program that is linked with the
Library has the freedom and the wherewithal to run that program using a
modified version of the Library.
The precise terms and conditions for copying, distribution and modification
follow. Pay close attention to the difference between a "work based on the
library" and a "work that uses the library". The former contains code
derived from the library, whereas the latter must be combined with the
library in order to run.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other program
which contains a notice placed by the copyright holder or other
authorized party saying it may be distributed under the terms of this
Lesser General Public License (also called "this License"). Each
licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work which
has been distributed under these terms. A "work based on the Library"
means either the Library or any derivative work under copyright law:
that is to say, a work containing the Library or a portion of it, either
verbatim or with modifications and/or translated straightforwardly into
another language. (Hereinafter, translation is included without
limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for making
modifications to it. For a library, complete source code means all the
source code for all modules it contains, plus any associated interface
definition files, plus the scripts used to control compilation and
installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of running
a program using the Library is not restricted, and output from such a
program is covered only if its contents constitute a work based on the
Library (independent of the use of the Library in a tool for writing
it). Whether that is true depends on what the Library does and what the
program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's complete
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the notices
that refer to this License and to the absence of any warranty; and
distribute a copy of this License along with the Library.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Library or any portion of it,
thus forming a work based on the Library, and copy and distribute such
modifications or work under the terms of Section 1 above, provided that
you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices stating
that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no charge to
all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a table
of data to be supplied by an application program that uses the
facility, other than as an argument passed when the facility is
invoked, then you must make a good faith effort to ensure that, in
the event an application does not supply such function or table, the
facility still operates, and performs whatever part of its purpose
remains meaningful.
(For example, a function in a library to compute square roots has a
purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must be
optional: if the application does not supply it, the square root
function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library, and
can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based on
the Library, the distribution of the whole must be on the terms of this
License, whose permissions for other licensees extend to the entire
whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of a
storage or distribution medium does not bring the other work under the
scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so that
they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in these
notices.
Once this change is made in a given copy, it is irreversible for that
copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of the
Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or derivative of
it, under Section 2) in object code or executable form under the terms
of Sections 1 and 2 above provided that you accompany it with the
complete corresponding machine-readable source code, which must be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange.
If distribution of object code is made by offering access to copy from a
designated place, then offering equivalent access to copy the source
code from the same place satisfies the requirement to distribute the
source code, even though third parties are not compelled to copy the
source along with the object code.
5. A program that contains no derivative of any portion of the Library, but
is designed to work with the Library by being compiled or linked with
it, is called a "work that uses the Library". Such a work, in isolation,
is not a derivative work of the Library, and therefore falls outside the
scope of this License.
However, linking a "work that uses the Library" with the Library creates
an executable that is a derivative of the Library (because it contains
portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License. Section 6
states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is
not. Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data structure
layouts and accessors, and small macros and small inline functions (ten
lines or less in length), then the use of the object file is
unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section
6. Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or link a
"work that uses the Library" with the Library to produce a work
containing portions of the Library, and distribute that work under terms
of your choice, provided that the terms permit modification of the work
for the customer's own use and reverse engineering for debugging such
modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work during
execution displays copyright notices, you must include the copyright
notice for the Library among them, as well as a reference directing the
user to the copy of this License. Also, you must do one of these things:
a) Accompany the work with the complete corresponding machine-readable
source code for the Library including whatever changes were used in
the work (which must be distributed under Sections 1 and 2 above);
and, if the work is an executable linked with the Library, with the
complete machine-readable "work that uses the Library", as object
code and/or source code, so that the user can modify the Library and
then relink to produce a modified executable containing the modified
Library. (It is understood that the user who changes the contents of
definitions files in the Library will not necessarily be able to
recompile the application to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a copy
of the library already present on the user's computer system, rather
than copying library functions into the executable, and (2) will
operate properly with a modified version of the library, if the user
installs one, as long as the modified version is interface-compatible
with the version that the work was made with.
c) Accompany the work with a written offer, valid for at least three
years, to give the same user the materials specified in Subsection
6a, above, for a charge no more than the cost of performing this
distribution.
d) If distribution of the work is made by offering access to copy from a
designated place, offer equivalent access to copy the above specified
materials from the same place.
e) Verify that the user has already received a copy of these materials
or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the Library"
must include any data and utility programs needed for reproducing the
executable from it. However, as a special exception, the materials to be
distributed need not include anything that is normally distributed (in
either source or binary form) with the major components (compiler,
kernel, and so on) of the operating system on which the executable runs,
unless that component itself accompanies the executable.
It may happen that this requirement contradicts the license restrictions
of other proprietary libraries that do not normally accompany the
operating system. Such a contradiction means you cannot use both them
and the Library together in an executable that you distribute.
7. You may place library facilities that are a work based on the Library
side-by-side in a single library together with other library facilities
not covered by this License, and distribute such a combined library,
provided that the separate distribution of the work based on the Library
and of the other library facilities is otherwise permitted, and provided
that you do these two things:
a) Accompany the combined library with a copy of the same work based on
the Library, uncombined with any other library facilities. This must
be distributed under the terms of the Sections above.
b) Give prominent notice with the combined library of the fact that part
of it is a work based on the Library, and explaining where to find
the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute the
Library except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, link with, or distribute the
Library is void, and will automatically terminate your rights under this
License. However, parties who have received copies, or rights, from you
under this License will not have their licenses terminated so long as
such parties remain in full compliance.
9. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute
the Library or its derivative works. These actions are prohibited by law
if you do not accept this License. Therefore, by modifying or
distributing the Library (or any work based on the Library), you
indicate your acceptance of this License to do so, and all its terms and
conditions for copying, distributing or modifying the Library or works
based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted
herein. You are not responsible for enforcing compliance by third
parties with this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent license
would not permit royalty-free redistribution of the Library by all
those who receive copies directly or indirectly through you, then the
only way you could satisfy both it and this License would be to refrain
entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply, and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is implemented
by public license practices. Many people have made generous
contributions to the wide range of software distributed through that
system in reliance on consistent application of that system; it is up
to the author/donor to decide if he or she is willing to distribute
software through any other system and a licensee cannot impose that
choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in certain
countries either by patents or by copyrighted interfaces, the original
copyright holder who places the Library under this License may add an
explicit geographical distribution limitation excluding those
countries, so that distribution is permitted only in or among countries
not thus excluded. In such case, this License incorporates the
limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new versions of
the Lesser General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in
detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a license
version number, you may choose any version ever published by the Free
Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free Software
Foundation; we sometimes make exceptions for this. Our decision will be
guided by the two goals of preserving the free status of all
derivatives of our free software and of promoting the sharing and reuse
of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH
YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY
(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR
OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
one line to give the library's name and an idea of what it does.
Copyright (C) year name of author
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add
information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
signature of Ty Coon, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
Valid-License-Identifier: MIT
SPDX-URL: https://spdx.org/licenses/MIT.html
Usage-Guide:
To use the MIT License put the following SPDX tag/value pair into a
comment according to the placement guidelines in the licensing rules
documentation:
SPDX-License-Identifier: MIT
License-Text:
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
...@@ -59,7 +59,11 @@ enum w1_netlink_message_types { ...@@ -59,7 +59,11 @@ enum w1_netlink_message_types {
* @type: one of enum w1_netlink_message_types * @type: one of enum w1_netlink_message_types
* @status: kernel feedback for success 0 or errno failure value * @status: kernel feedback for success 0 or errno failure value
* @len: length of data following w1_netlink_msg * @len: length of data following w1_netlink_msg
* @id: union holding master bus id (msg.id) and slave device id (id[8]). * @id: union holding bus master id (msg.id) and slave device id (id[8]).
* @id.id: Slave ID (8 bytes)
* @id.mst: bus master identification
* @id.mst.id: bus master ID
* @id.mst.res: bus master reserved
* @data: start address of any following data * @data: start address of any following data
* *
* The base message structure for w1 messages over netlink. * The base message structure for w1 messages over netlink.
......
...@@ -25,9 +25,6 @@ config 9P_FS_POSIX_ACL ...@@ -25,9 +25,6 @@ config 9P_FS_POSIX_ACL
POSIX Access Control Lists (ACLs) support permissions for users and POSIX Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme. groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the POSIX ACLs for
Linux website <http://acl.bestbits.at/>.
If you don't know what Access Control Lists are, say N If you don't know what Access Control Lists are, say N
endif endif
......
...@@ -167,17 +167,13 @@ config TMPFS_POSIX_ACL ...@@ -167,17 +167,13 @@ config TMPFS_POSIX_ACL
files for sound to work properly. In short, if you're not sure, files for sound to work properly. In short, if you're not sure,
say Y. say Y.
To learn more about Access Control Lists, visit the POSIX ACLs for
Linux website <http://acl.bestbits.at/>.
config TMPFS_XATTR config TMPFS_XATTR
bool "Tmpfs extended attributes" bool "Tmpfs extended attributes"
depends on TMPFS depends on TMPFS
default n default n
help help
Extended attributes are name:value pairs associated with inodes by Extended attributes are name:value pairs associated with inodes by
the kernel or by users (see the attr(5) manual page, or visit the kernel or by users (see the attr(5) manual page for details).
<http://acl.bestbits.at/> for details).
Currently this enables support for the trusted.* and Currently this enables support for the trusted.* and
security.* namespaces. security.* namespaces.
......
...@@ -38,9 +38,6 @@ config BTRFS_FS_POSIX_ACL ...@@ -38,9 +38,6 @@ config BTRFS_FS_POSIX_ACL
POSIX Access Control Lists (ACLs) support permissions for users and POSIX Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme. groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the POSIX ACLs for
Linux website <http://acl.bestbits.at/>.
If you don't know what Access Control Lists are, say N If you don't know what Access Control Lists are, say N
config BTRFS_FS_CHECK_INTEGRITY config BTRFS_FS_CHECK_INTEGRITY
......
...@@ -34,7 +34,4 @@ config CEPH_FS_POSIX_ACL ...@@ -34,7 +34,4 @@ config CEPH_FS_POSIX_ACL
POSIX Access Control Lists (ACLs) support permissions for users and POSIX Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme. groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the POSIX ACLs for
Linux website <http://acl.bestbits.at/>.
If you don't know what Access Control Lists are, say N If you don't know what Access Control Lists are, say N
...@@ -108,14 +108,13 @@ config CIFS_XATTR ...@@ -108,14 +108,13 @@ config CIFS_XATTR
depends on CIFS depends on CIFS
help help
Extended attributes are name:value pairs associated with inodes by Extended attributes are name:value pairs associated with inodes by
the kernel or by users (see the attr(5) manual page, or visit the kernel or by users (see the attr(5) manual page for details).
<http://acl.bestbits.at/> for details). CIFS maps the name of CIFS maps the name of extended attributes beginning with the user
extended attributes beginning with the user namespace prefix namespace prefix to SMB/CIFS EAs. EAs are stored on Windows
to SMB/CIFS EAs. EAs are stored on Windows servers without the servers without the user namespace prefix, but their names are
user namespace prefix, but their names are seen by Linux cifs clients seen by Linux cifs clients prefaced by the user namespace prefix.
prefaced by the user namespace prefix. The system namespace The system namespace (used by some filesystems to store ACLs) is
(used by some filesystems to store ACLs) is not supported at not supported at this time.
this time.
If unsure, say Y. If unsure, say Y.
......
...@@ -13,8 +13,7 @@ config EXT2_FS_XATTR ...@@ -13,8 +13,7 @@ config EXT2_FS_XATTR
depends on EXT2_FS depends on EXT2_FS
help help
Extended attributes are name:value pairs associated with inodes by Extended attributes are name:value pairs associated with inodes by
the kernel or by users (see the attr(5) manual page, or visit the kernel or by users (see the attr(5) manual page for details).
<http://acl.bestbits.at/> for details).
If unsure, say N. If unsure, say N.
...@@ -26,9 +25,6 @@ config EXT2_FS_POSIX_ACL ...@@ -26,9 +25,6 @@ config EXT2_FS_POSIX_ACL
Posix Access Control Lists (ACLs) support permissions for users and Posix Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme. groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the Posix ACLs for
Linux website <http://acl.bestbits.at/>.
If you don't know what Access Control Lists are, say N If you don't know what Access Control Lists are, say N
config EXT2_FS_SECURITY config EXT2_FS_SECURITY
......
...@@ -82,9 +82,6 @@ config EXT4_FS_POSIX_ACL ...@@ -82,9 +82,6 @@ config EXT4_FS_POSIX_ACL
POSIX Access Control Lists (ACLs) support permissions for users and POSIX Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme. groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the POSIX ACLs for
Linux website <http://acl.bestbits.at/>.
If you don't know what Access Control Lists are, say N If you don't know what Access Control Lists are, say N
config EXT4_FS_SECURITY config EXT4_FS_SECURITY
......
...@@ -35,8 +35,7 @@ config F2FS_FS_XATTR ...@@ -35,8 +35,7 @@ config F2FS_FS_XATTR
default y default y
help help
Extended attributes are name:value pairs associated with inodes by Extended attributes are name:value pairs associated with inodes by
the kernel or by users (see the attr(5) manual page, or visit the kernel or by users (see the attr(5) manual page for details).
<http://acl.bestbits.at/> for details).
If unsure, say N. If unsure, say N.
...@@ -49,9 +48,6 @@ config F2FS_FS_POSIX_ACL ...@@ -49,9 +48,6 @@ config F2FS_FS_POSIX_ACL
Posix Access Control Lists (ACLs) support permissions for users and Posix Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme. groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the POSIX ACLs for
Linux website <http://acl.bestbits.at/>.
If you don't know what Access Control Lists are, say N If you don't know what Access Control Lists are, say N
config F2FS_FS_SECURITY config F2FS_FS_SECURITY
......
...@@ -20,9 +20,6 @@ config HFSPLUS_FS_POSIX_ACL ...@@ -20,9 +20,6 @@ config HFSPLUS_FS_POSIX_ACL
POSIX Access Control Lists (ACLs) support permissions for users and POSIX Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme. groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the POSIX ACLs for
Linux website <http://acl.bestbits.at/>.
It needs to understand that POSIX ACLs are treated only under It needs to understand that POSIX ACLs are treated only under
Linux. POSIX ACLs doesn't mean something under Mac OS X. Linux. POSIX ACLs doesn't mean something under Mac OS X.
Mac OS X beginning with version 10.4 ("Tiger") support NFSv4 ACLs, Mac OS X beginning with version 10.4 ("Tiger") support NFSv4 ACLs,
......
...@@ -68,8 +68,7 @@ config JFFS2_FS_XATTR ...@@ -68,8 +68,7 @@ config JFFS2_FS_XATTR
default n default n
help help
Extended attributes are name:value pairs associated with inodes by Extended attributes are name:value pairs associated with inodes by
the kernel or by users (see the attr(5) manual page, or visit the kernel or by users (see the attr(5) manual page for details).
<http://acl.bestbits.at/> for details).
If unsure, say N. If unsure, say N.
...@@ -82,9 +81,6 @@ config JFFS2_FS_POSIX_ACL ...@@ -82,9 +81,6 @@ config JFFS2_FS_POSIX_ACL
Posix Access Control Lists (ACLs) support permissions for users and Posix Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme. groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the Posix ACLs for
Linux website <http://acl.bestbits.at/>.
If you don't know what Access Control Lists are, say N If you don't know what Access Control Lists are, say N
config JFFS2_FS_SECURITY config JFFS2_FS_SECURITY
......
...@@ -16,9 +16,6 @@ config JFS_POSIX_ACL ...@@ -16,9 +16,6 @@ config JFS_POSIX_ACL
Posix Access Control Lists (ACLs) support permissions for users and Posix Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme. groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the Posix ACLs for
Linux website <http://acl.bestbits.at/>.
If you don't know what Access Control Lists are, say N If you don't know what Access Control Lists are, say N
config JFS_SECURITY config JFS_SECURITY
......
...@@ -57,8 +57,7 @@ config REISERFS_FS_XATTR ...@@ -57,8 +57,7 @@ config REISERFS_FS_XATTR
depends on REISERFS_FS depends on REISERFS_FS
help help
Extended attributes are name:value pairs associated with inodes by Extended attributes are name:value pairs associated with inodes by
the kernel or by users (see the attr(5) manual page, or visit the kernel or by users (see the attr(5) manual page for details).
<http://acl.bestbits.at/> for details).
If unsure, say N. If unsure, say N.
...@@ -70,9 +69,6 @@ config REISERFS_FS_POSIX_ACL ...@@ -70,9 +69,6 @@ config REISERFS_FS_POSIX_ACL
Posix Access Control Lists (ACLs) support permissions for users and Posix Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme. groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the Posix ACLs for
Linux website <http://acl.bestbits.at/>.
If you don't know what Access Control Lists are, say N If you don't know what Access Control Lists are, say N
config REISERFS_FS_SECURITY config REISERFS_FS_SECURITY
......
...@@ -48,9 +48,6 @@ config XFS_POSIX_ACL ...@@ -48,9 +48,6 @@ config XFS_POSIX_ACL
POSIX Access Control Lists (ACLs) support permissions for users and POSIX Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme. groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the POSIX ACLs for
Linux website <http://acl.bestbits.at/>.
If you don't know what Access Control Lists are, say N. If you don't know what Access Control Lists are, say N.
config XFS_RT config XFS_RT
......
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
/* /*
* See Documentation/errseq.rst and lib/errseq.c * See Documentation/core-api/errseq.rst and lib/errseq.c
*/ */
#ifndef _LINUX_ERRSEQ_H #ifndef _LINUX_ERRSEQ_H
#define _LINUX_ERRSEQ_H #define _LINUX_ERRSEQ_H
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
/** /**
* refcount_t - variant of atomic_t specialized for reference counts * struct refcount_t - variant of atomic_t specialized for reference counts
* @refs: atomic_t counter field * @refs: atomic_t counter field
* *
* The counter saturates at UINT_MAX and will not move once * The counter saturates at UINT_MAX and will not move once
......
...@@ -46,14 +46,14 @@ ...@@ -46,14 +46,14 @@
* @eseq: errseq_t field that should be set * @eseq: errseq_t field that should be set
* @err: error to set (must be between -1 and -MAX_ERRNO) * @err: error to set (must be between -1 and -MAX_ERRNO)
* *
* This function sets the error in *eseq, and increments the sequence counter * This function sets the error in @eseq, and increments the sequence counter
* if the last sequence was sampled at some point in the past. * if the last sequence was sampled at some point in the past.
* *
* Any error set will always overwrite an existing error. * Any error set will always overwrite an existing error.
* *
* We do return the latest value here, primarily for debugging purposes. The * Return: The previous value, primarily for debugging purposes. The
* return value should not be used as a previously sampled value in later calls * return value should not be used as a previously sampled value in later
* as it will not have the SEEN flag set. * calls as it will not have the SEEN flag set.
*/ */
errseq_t errseq_set(errseq_t *eseq, int err) errseq_t errseq_set(errseq_t *eseq, int err)
{ {
...@@ -108,11 +108,13 @@ errseq_t errseq_set(errseq_t *eseq, int err) ...@@ -108,11 +108,13 @@ errseq_t errseq_set(errseq_t *eseq, int err)
EXPORT_SYMBOL(errseq_set); EXPORT_SYMBOL(errseq_set);
/** /**
* errseq_sample - grab current errseq_t value * errseq_sample() - Grab current errseq_t value.
* @eseq: pointer to errseq_t to be sampled * @eseq: Pointer to errseq_t to be sampled.
* *
* This function allows callers to sample an errseq_t value, marking it as * This function allows callers to sample an errseq_t value, marking it as
* "seen" if required. * "seen" if required.
*
* Return: The current errseq value.
*/ */
errseq_t errseq_sample(errseq_t *eseq) errseq_t errseq_sample(errseq_t *eseq)
{ {
...@@ -134,15 +136,15 @@ errseq_t errseq_sample(errseq_t *eseq) ...@@ -134,15 +136,15 @@ errseq_t errseq_sample(errseq_t *eseq)
EXPORT_SYMBOL(errseq_sample); EXPORT_SYMBOL(errseq_sample);
/** /**
* errseq_check - has an error occurred since a particular sample point? * errseq_check() - Has an error occurred since a particular sample point?
* @eseq: pointer to errseq_t value to be checked * @eseq: Pointer to errseq_t value to be checked.
* @since: previously-sampled errseq_t from which to check * @since: Previously-sampled errseq_t from which to check.
* *
* Grab the value that eseq points to, and see if it has changed "since" * Grab the value that eseq points to, and see if it has changed @since
* the given value was sampled. The "since" value is not advanced, so there * the given value was sampled. The @since value is not advanced, so there
* is no need to mark the value as seen. * is no need to mark the value as seen.
* *
* Returns the latest error set in the errseq_t or 0 if it hasn't changed. * Return: The latest error set in the errseq_t or 0 if it hasn't changed.
*/ */
int errseq_check(errseq_t *eseq, errseq_t since) int errseq_check(errseq_t *eseq, errseq_t since)
{ {
...@@ -155,11 +157,11 @@ int errseq_check(errseq_t *eseq, errseq_t since) ...@@ -155,11 +157,11 @@ int errseq_check(errseq_t *eseq, errseq_t since)
EXPORT_SYMBOL(errseq_check); EXPORT_SYMBOL(errseq_check);
/** /**
* errseq_check_and_advance - check an errseq_t and advance to current value * errseq_check_and_advance() - Check an errseq_t and advance to current value.
* @eseq: pointer to value being checked and reported * @eseq: Pointer to value being checked and reported.
* @since: pointer to previously-sampled errseq_t to check against and advance * @since: Pointer to previously-sampled errseq_t to check against and advance.
* *
* Grab the eseq value, and see whether it matches the value that "since" * Grab the eseq value, and see whether it matches the value that @since
* points to. If it does, then just return 0. * points to. If it does, then just return 0.
* *
* If it doesn't, then the value has changed. Set the "seen" flag, and try to * 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,6 +172,9 @@ EXPORT_SYMBOL(errseq_check);
* value. The caller must provide that if necessary. Because of this, callers * value. The caller must provide that if necessary. Because of this, callers
* may want to do a lockless errseq_check before taking the lock and calling * may want to do a lockless errseq_check before taking the lock and calling
* this. * this.
*
* Return: Negative errno if one has been stored, or 0 if no new error has
* occurred.
*/ */
int errseq_check_and_advance(errseq_t *eseq, errseq_t *since) int errseq_check_and_advance(errseq_t *eseq, errseq_t *since)
{ {
......
...@@ -29,15 +29,14 @@ EXPORT_SYMBOL(uuid_null); ...@@ -29,15 +29,14 @@ EXPORT_SYMBOL(uuid_null);
const u8 guid_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15}; const u8 guid_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
const u8 uuid_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; const u8 uuid_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
/*************************************************************** /**
* generate_random_uuid - generate a random UUID
* @uuid: where to put the generated UUID
*
* Random UUID interface * Random UUID interface
* *
* Used here for a Boot ID, but can be useful for other kernel * Used to create a Boot ID or a filesystem UUID/GUID, but can be
* drivers. * useful for other kernel drivers.
***************************************************************/
/*
* Generate random UUID
*/ */
void generate_random_uuid(unsigned char uuid[16]) void generate_random_uuid(unsigned char uuid[16])
{ {
...@@ -73,16 +72,17 @@ void uuid_gen(uuid_t *bu) ...@@ -73,16 +72,17 @@ void uuid_gen(uuid_t *bu)
EXPORT_SYMBOL_GPL(uuid_gen); EXPORT_SYMBOL_GPL(uuid_gen);
/** /**
* uuid_is_valid - checks if UUID string valid * uuid_is_valid - checks if a UUID string is valid
* @uuid: UUID string to check * @uuid: UUID string to check
* *
* Description: * Description:
* It checks if the UUID string is following the format: * It checks if the UUID string is following the format:
* xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
* where x is a hex digit. *
* * where x is a hex digit.
* Return: true if input is valid UUID string. *
*/ * Return: true if input is valid UUID string.
*/
bool uuid_is_valid(const char *uuid) bool uuid_is_valid(const char *uuid)
{ {
unsigned int i; unsigned int i;
......
...@@ -1834,7 +1834,8 @@ static char *ptr_to_id(char *buf, char *end, void *ptr, struct printf_spec spec) ...@@ -1834,7 +1834,8 @@ static char *ptr_to_id(char *buf, char *end, void *ptr, struct printf_spec spec)
* *
* - 'x' For printing the address. Equivalent to "%lx". * - 'x' For printing the address. Equivalent to "%lx".
* *
* ** Please update also Documentation/printk-formats.txt when making changes ** * ** When making changes please also update:
* Documentation/core-api/printk-formats.rst
* *
* Note: The difference between 'S' and 'F' is that on ia64 and ppc64 * Note: The difference between 'S' and 'F' is that on ia64 and ppc64
* function pointers are really function descriptors, which contain a * function pointers are really function descriptors, which contain a
...@@ -2194,7 +2195,7 @@ set_precision(struct printf_spec *spec, int prec) ...@@ -2194,7 +2195,7 @@ set_precision(struct printf_spec *spec, int prec)
* - ``%n`` is unsupported * - ``%n`` is unsupported
* - ``%p*`` is handled by pointer() * - ``%p*`` is handled by pointer()
* *
* See pointer() or Documentation/printk-formats.txt for more * See pointer() or Documentation/core-api/printk-formats.rst for more
* extensive description. * extensive description.
* *
* **Please update the documentation in both places when making changes** * **Please update the documentation in both places when making changes**
......
...@@ -48,16 +48,11 @@ Read C language source or header FILEs, extract embedded documentation comments, ...@@ -48,16 +48,11 @@ Read C language source or header FILEs, extract embedded documentation comments,
and print formatted documentation to standard output. and print formatted documentation to standard output.
The documentation comments are identified by "/**" opening comment mark. See The documentation comments are identified by "/**" opening comment mark. See
Documentation/kernel-doc-nano-HOWTO.txt for the documentation comment syntax. Documentation/doc-guide/kernel-doc.rst for the documentation comment syntax.
Output format selection (mutually exclusive): Output format selection (mutually exclusive):
-docbook Output DocBook format.
-html Output HTML format.
-html5 Output HTML5 format.
-list Output symbol list format. This is for use by docproc.
-man Output troff manual page format. This is the default. -man Output troff manual page format. This is the default.
-rst Output reStructuredText format. -rst Output reStructuredText format.
-text Output plain text format.
-none Do not output documentation, only warnings. -none Do not output documentation, only warnings.
Output selection (mutually exclusive): Output selection (mutually exclusive):
...@@ -216,7 +211,7 @@ my $anon_struct_union = 0; ...@@ -216,7 +211,7 @@ my $anon_struct_union = 0;
my $type_constant = '\b``([^\`]+)``\b'; my $type_constant = '\b``([^\`]+)``\b';
my $type_constant2 = '\%([-_\w]+)'; my $type_constant2 = '\%([-_\w]+)';
my $type_func = '(\w+)\(\)'; my $type_func = '(\w+)\(\)';
my $type_param = '\@(\w+(\.\.\.)?)'; my $type_param = '\@(\w*(\.\w+)*(\.\.\.)?)';
my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params
my $type_env = '(\$\w+)'; my $type_env = '(\$\w+)';
my $type_enum = '\&(enum\s*([_\w]+))'; my $type_enum = '\&(enum\s*([_\w]+))';
...@@ -225,84 +220,11 @@ my $type_typedef = '\&(typedef\s*([_\w]+))'; ...@@ -225,84 +220,11 @@ my $type_typedef = '\&(typedef\s*([_\w]+))';
my $type_union = '\&(union\s*([_\w]+))'; my $type_union = '\&(union\s*([_\w]+))';
my $type_member = '\&([_\w]+)(\.|->)([_\w]+)'; my $type_member = '\&([_\w]+)(\.|->)([_\w]+)';
my $type_fallback = '\&([_\w]+)'; my $type_fallback = '\&([_\w]+)';
my $type_enum_xml = '\&amp;(enum\s*([_\w]+))';
my $type_struct_xml = '\&amp;(struct\s*([_\w]+))';
my $type_typedef_xml = '\&amp;(typedef\s*([_\w]+))';
my $type_union_xml = '\&amp;(union\s*([_\w]+))';
my $type_member_xml = '\&amp;([_\w]+)(\.|-\&gt;)([_\w]+)';
my $type_fallback_xml = '\&amp([_\w]+)';
my $type_member_func = $type_member . '\(\)'; my $type_member_func = $type_member . '\(\)';
# Output conversion substitutions. # Output conversion substitutions.
# One for each output format # One for each output format
# these work fairly well
my @highlights_html = (
[$type_constant, "<i>\$1</i>"],
[$type_constant2, "<i>\$1</i>"],
[$type_func, "<b>\$1</b>"],
[$type_enum_xml, "<i>\$1</i>"],
[$type_struct_xml, "<i>\$1</i>"],
[$type_typedef_xml, "<i>\$1</i>"],
[$type_union_xml, "<i>\$1</i>"],
[$type_env, "<b><i>\$1</i></b>"],
[$type_param, "<tt><b>\$1</b></tt>"],
[$type_member_xml, "<tt><i>\$1</i>\$2\$3</tt>"],
[$type_fallback_xml, "<i>\$1</i>"]
);
my $local_lt = "\\\\\\\\lt:";
my $local_gt = "\\\\\\\\gt:";
my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>"
# html version 5
my @highlights_html5 = (
[$type_constant, "<span class=\"const\">\$1</span>"],
[$type_constant2, "<span class=\"const\">\$1</span>"],
[$type_func, "<span class=\"func\">\$1</span>"],
[$type_enum_xml, "<span class=\"enum\">\$1</span>"],
[$type_struct_xml, "<span class=\"struct\">\$1</span>"],
[$type_typedef_xml, "<span class=\"typedef\">\$1</span>"],
[$type_union_xml, "<span class=\"union\">\$1</span>"],
[$type_env, "<span class=\"env\">\$1</span>"],
[$type_param, "<span class=\"param\">\$1</span>]"],
[$type_member_xml, "<span class=\"literal\"><span class=\"struct\">\$1</span>\$2<span class=\"member\">\$3</span></span>"],
[$type_fallback_xml, "<span class=\"struct\">\$1</span>"]
);
my $blankline_html5 = $local_lt . "br /" . $local_gt;
# XML, docbook format
my @highlights_xml = (
["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"],
[$type_constant, "<constant>\$1</constant>"],
[$type_constant2, "<constant>\$1</constant>"],
[$type_enum_xml, "<type>\$1</type>"],
[$type_struct_xml, "<structname>\$1</structname>"],
[$type_typedef_xml, "<type>\$1</type>"],
[$type_union_xml, "<structname>\$1</structname>"],
[$type_param, "<parameter>\$1</parameter>"],
[$type_func, "<function>\$1</function>"],
[$type_env, "<envar>\$1</envar>"],
[$type_member_xml, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"],
[$type_fallback_xml, "<structname>\$1</structname>"]
);
my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n";
# gnome, docbook format
my @highlights_gnome = (
[$type_constant, "<replaceable class=\"option\">\$1</replaceable>"],
[$type_constant2, "<replaceable class=\"option\">\$1</replaceable>"],
[$type_func, "<function>\$1</function>"],
[$type_enum, "<type>\$1</type>"],
[$type_struct, "<structname>\$1</structname>"],
[$type_typedef, "<type>\$1</type>"],
[$type_union, "<structname>\$1</structname>"],
[$type_env, "<envar>\$1</envar>"],
[$type_param, "<parameter>\$1</parameter>" ],
[$type_member, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"],
[$type_fallback, "<structname>\$1</structname>"]
);
my $blankline_gnome = "</para><para>\n";
# these are pretty rough # these are pretty rough
my @highlights_man = ( my @highlights_man = (
[$type_constant, "\$1"], [$type_constant, "\$1"],
...@@ -318,21 +240,6 @@ my @highlights_man = ( ...@@ -318,21 +240,6 @@ my @highlights_man = (
); );
my $blankline_man = ""; my $blankline_man = "";
# text-mode
my @highlights_text = (
[$type_constant, "\$1"],
[$type_constant2, "\$1"],
[$type_func, "\$1"],
[$type_enum, "\$1"],
[$type_struct, "\$1"],
[$type_typedef, "\$1"],
[$type_union, "\$1"],
[$type_param, "\$1"],
[$type_member, "\$1\$2\$3"],
[$type_fallback, "\$1"]
);
my $blankline_text = "";
# rst-mode # rst-mode
my @highlights_rst = ( my @highlights_rst = (
[$type_constant, "``\$1``"], [$type_constant, "``\$1``"],
...@@ -352,21 +259,6 @@ my @highlights_rst = ( ...@@ -352,21 +259,6 @@ my @highlights_rst = (
); );
my $blankline_rst = "\n"; my $blankline_rst = "\n";
# list mode
my @highlights_list = (
[$type_constant, "\$1"],
[$type_constant2, "\$1"],
[$type_func, "\$1"],
[$type_enum, "\$1"],
[$type_struct, "\$1"],
[$type_typedef, "\$1"],
[$type_union, "\$1"],
[$type_param, "\$1"],
[$type_member, "\$1"],
[$type_fallback, "\$1"]
);
my $blankline_list = "";
# read arguments # read arguments
if ($#ARGV == -1) { if ($#ARGV == -1) {
usage(); usage();
...@@ -376,12 +268,12 @@ my $kernelversion; ...@@ -376,12 +268,12 @@ my $kernelversion;
my $dohighlight = ""; my $dohighlight = "";
my $verbose = 0; my $verbose = 0;
my $output_mode = "man"; my $output_mode = "rst";
my $output_preformatted = 0; my $output_preformatted = 0;
my $no_doc_sections = 0; my $no_doc_sections = 0;
my $enable_lineno = 0; my $enable_lineno = 0;
my @highlights = @highlights_man; my @highlights = @highlights_rst;
my $blankline = $blankline_man; my $blankline = $blankline_rst;
my $modulename = "Kernel API"; my $modulename = "Kernel API";
use constant { use constant {
...@@ -499,71 +391,51 @@ my $undescribed = "-- undescribed --"; ...@@ -499,71 +391,51 @@ my $undescribed = "-- undescribed --";
reset_state(); reset_state();
while ($ARGV[0] =~ m/^-(.*)/) { while ($ARGV[0] =~ m/^--?(.*)/) {
my $cmd = shift @ARGV; my $cmd = $1;
if ($cmd eq "-html") { shift @ARGV;
$output_mode = "html"; if ($cmd eq "man") {
@highlights = @highlights_html;
$blankline = $blankline_html;
} elsif ($cmd eq "-html5") {
$output_mode = "html5";
@highlights = @highlights_html5;
$blankline = $blankline_html5;
} elsif ($cmd eq "-man") {
$output_mode = "man"; $output_mode = "man";
@highlights = @highlights_man; @highlights = @highlights_man;
$blankline = $blankline_man; $blankline = $blankline_man;
} elsif ($cmd eq "-text") { } elsif ($cmd eq "rst") {
$output_mode = "text";
@highlights = @highlights_text;
$blankline = $blankline_text;
} elsif ($cmd eq "-rst") {
$output_mode = "rst"; $output_mode = "rst";
@highlights = @highlights_rst; @highlights = @highlights_rst;
$blankline = $blankline_rst; $blankline = $blankline_rst;
} elsif ($cmd eq "-docbook") { } elsif ($cmd eq "none") {
$output_mode = "xml";
@highlights = @highlights_xml;
$blankline = $blankline_xml;
} elsif ($cmd eq "-list") {
$output_mode = "list";
@highlights = @highlights_list;
$blankline = $blankline_list;
} elsif ($cmd eq "-gnome") {
$output_mode = "gnome";
@highlights = @highlights_gnome;
$blankline = $blankline_gnome;
} elsif ($cmd eq "-none") {
$output_mode = "none"; $output_mode = "none";
} elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document } elsif ($cmd eq "module") { # not needed for XML, inherits from calling document
$modulename = shift @ARGV; $modulename = shift @ARGV;
} elsif ($cmd eq "-function") { # to only output specific functions } elsif ($cmd eq "function") { # to only output specific functions
$output_selection = OUTPUT_INCLUDE; $output_selection = OUTPUT_INCLUDE;
$function = shift @ARGV; $function = shift @ARGV;
$function_table{$function} = 1; $function_table{$function} = 1;
} elsif ($cmd eq "-nofunction") { # output all except specific functions } elsif ($cmd eq "nofunction") { # output all except specific functions
$output_selection = OUTPUT_EXCLUDE; $output_selection = OUTPUT_EXCLUDE;
$function = shift @ARGV; $function = shift @ARGV;
$function_table{$function} = 1; $function_table{$function} = 1;
} elsif ($cmd eq "-export") { # only exported symbols } elsif ($cmd eq "export") { # only exported symbols
$output_selection = OUTPUT_EXPORTED; $output_selection = OUTPUT_EXPORTED;
%function_table = (); %function_table = ();
} elsif ($cmd eq "-internal") { # only non-exported symbols } elsif ($cmd eq "internal") { # only non-exported symbols
$output_selection = OUTPUT_INTERNAL; $output_selection = OUTPUT_INTERNAL;
%function_table = (); %function_table = ();
} elsif ($cmd eq "-export-file") { } elsif ($cmd eq "export-file") {
my $file = shift @ARGV; my $file = shift @ARGV;
push(@export_file_list, $file); push(@export_file_list, $file);
} elsif ($cmd eq "-v") { } elsif ($cmd eq "v") {
$verbose = 1; $verbose = 1;
} elsif (($cmd eq "-h") || ($cmd eq "--help")) { } elsif (($cmd eq "h") || ($cmd eq "help")) {
usage(); usage();
} elsif ($cmd eq '-no-doc-sections') { } elsif ($cmd eq 'no-doc-sections') {
$no_doc_sections = 1; $no_doc_sections = 1;
} elsif ($cmd eq '-enable-lineno') { } elsif ($cmd eq 'enable-lineno') {
$enable_lineno = 1; $enable_lineno = 1;
} elsif ($cmd eq '-show-not-found') { } elsif ($cmd eq 'show-not-found') {
$show_not_found = 1; $show_not_found = 1;
} else {
# Unknown argument
usage();
} }
} }
...@@ -670,22 +542,11 @@ sub output_highlight { ...@@ -670,22 +542,11 @@ sub output_highlight {
# confess "output_highlight got called with no args?\n"; # confess "output_highlight got called with no args?\n";
# } # }
if ($output_mode eq "html" || $output_mode eq "html5" ||
$output_mode eq "xml") {
$contents = local_unescape($contents);
# convert data read & converted thru xml_escape() into &xyz; format:
$contents =~ s/\\\\\\/\&/g;
}
# print STDERR "contents b4:$contents\n"; # print STDERR "contents b4:$contents\n";
eval $dohighlight; eval $dohighlight;
die $@ if $@; die $@ if $@;
# print STDERR "contents af:$contents\n"; # print STDERR "contents af:$contents\n";
# strip whitespaces when generating html5
if ($output_mode eq "html5") {
$contents =~ s/^\s+//;
$contents =~ s/\s+$//;
}
foreach $line (split "\n", $contents) { foreach $line (split "\n", $contents) {
if (! $output_preformatted) { if (! $output_preformatted) {
$line =~ s/^\s*//; $line =~ s/^\s*//;
...@@ -706,817 +567,6 @@ sub output_highlight { ...@@ -706,817 +567,6 @@ sub output_highlight {
} }
} }
# output sections in html
sub output_section_html(%) {
my %args = %{$_[0]};
my $section;
foreach $section (@{$args{'sectionlist'}}) {
print "<h3>$section</h3>\n";
print "<blockquote>\n";
output_highlight($args{'sections'}{$section});
print "</blockquote>\n";
}
}
# output enum in html
sub output_enum_html(%) {
my %args = %{$_[0]};
my ($parameter);
my $count;
print "<h2>enum " . $args{'enum'} . "</h2>\n";
print "<b>enum " . $args{'enum'} . "</b> {<br>\n";
$count = 0;
foreach $parameter (@{$args{'parameterlist'}}) {
print " <b>" . $parameter . "</b>";
if ($count != $#{$args{'parameterlist'}}) {
$count++;
print ",\n";
}
print "<br>";
}
print "};<br>\n";
print "<h3>Constants</h3>\n";
print "<dl>\n";
foreach $parameter (@{$args{'parameterlist'}}) {
print "<dt><b>" . $parameter . "</b>\n";
print "<dd>";
output_highlight($args{'parameterdescs'}{$parameter});
}
print "</dl>\n";
output_section_html(@_);
print "<hr>\n";
}
# output typedef in html
sub output_typedef_html(%) {
my %args = %{$_[0]};
my ($parameter);
my $count;
print "<h2>typedef " . $args{'typedef'} . "</h2>\n";
print "<b>typedef " . $args{'typedef'} . "</b>\n";
output_section_html(@_);
print "<hr>\n";
}
# output struct in html
sub output_struct_html(%) {
my %args = %{$_[0]};
my ($parameter);
print "<h2>" . $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "</h2>\n";
print "<b>" . $args{'type'} . " " . $args{'struct'} . "</b> {<br>\n";
foreach $parameter (@{$args{'parameterlist'}}) {
if ($parameter =~ /^#/) {
print "$parameter<br>\n";
next;
}
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
$type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function
print "&nbsp; &nbsp; <i>$1</i><b>$parameter</b>) <i>($2)</i>;<br>\n";
} elsif ($type =~ m/^(.*?)\s*(:.*)/) {
# bitfield
print "&nbsp; &nbsp; <i>$1</i> <b>$parameter</b>$2;<br>\n";
} else {
print "&nbsp; &nbsp; <i>$type</i> <b>$parameter</b>;<br>\n";
}
}
print "};<br>\n";
print "<h3>Members</h3>\n";
print "<dl>\n";
foreach $parameter (@{$args{'parameterlist'}}) {
($parameter =~ /^#/) && next;
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
print "<dt><b>" . $parameter . "</b>\n";
print "<dd>";
output_highlight($args{'parameterdescs'}{$parameter_name});
}
print "</dl>\n";
output_section_html(@_);
print "<hr>\n";
}
# output function in html
sub output_function_html(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
print "<h2>" . $args{'function'} . " - " . $args{'purpose'} . "</h2>\n";
print "<i>" . $args{'functiontype'} . "</i>\n";
print "<b>" . $args{'function'} . "</b>\n";
print "(";
$count = 0;
foreach $parameter (@{$args{'parameterlist'}}) {
$type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function
print "<i>$1</i><b>$parameter</b>) <i>($2)</i>";
} else {
print "<i>" . $type . "</i> <b>" . $parameter . "</b>";
}
if ($count != $#{$args{'parameterlist'}}) {
$count++;
print ",\n";
}
}
print ")\n";
print "<h3>Arguments</h3>\n";
print "<dl>\n";
foreach $parameter (@{$args{'parameterlist'}}) {
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
print "<dt><b>" . $parameter . "</b>\n";
print "<dd>";
output_highlight($args{'parameterdescs'}{$parameter_name});
}
print "</dl>\n";
output_section_html(@_);
print "<hr>\n";
}
# output DOC: block header in html
sub output_blockhead_html(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
foreach $section (@{$args{'sectionlist'}}) {
print "<h3>$section</h3>\n";
print "<ul>\n";
output_highlight($args{'sections'}{$section});
print "</ul>\n";
}
print "<hr>\n";
}
# output sections in html5
sub output_section_html5(%) {
my %args = %{$_[0]};
my $section;
foreach $section (@{$args{'sectionlist'}}) {
print "<section>\n";
print "<h1>$section</h1>\n";
print "<p>\n";
output_highlight($args{'sections'}{$section});
print "</p>\n";
print "</section>\n";
}
}
# output enum in html5
sub output_enum_html5(%) {
my %args = %{$_[0]};
my ($parameter);
my $count;
my $html5id;
$html5id = $args{'enum'};
$html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
print "<article class=\"enum\" id=\"enum:". $html5id . "\">";
print "<h1>enum " . $args{'enum'} . "</h1>\n";
print "<ol class=\"code\">\n";
print "<li>";
print "<span class=\"keyword\">enum</span> ";
print "<span class=\"identifier\">" . $args{'enum'} . "</span> {";
print "</li>\n";
$count = 0;
foreach $parameter (@{$args{'parameterlist'}}) {
print "<li class=\"indent\">";
print "<span class=\"param\">" . $parameter . "</span>";
if ($count != $#{$args{'parameterlist'}}) {
$count++;
print ",";
}
print "</li>\n";
}
print "<li>};</li>\n";
print "</ol>\n";
print "<section>\n";
print "<h1>Constants</h1>\n";
print "<dl>\n";
foreach $parameter (@{$args{'parameterlist'}}) {
print "<dt>" . $parameter . "</dt>\n";
print "<dd>";
output_highlight($args{'parameterdescs'}{$parameter});
print "</dd>\n";
}
print "</dl>\n";
print "</section>\n";
output_section_html5(@_);
print "</article>\n";
}
# output typedef in html5
sub output_typedef_html5(%) {
my %args = %{$_[0]};
my ($parameter);
my $count;
my $html5id;
$html5id = $args{'typedef'};
$html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
print "<article class=\"typedef\" id=\"typedef:" . $html5id . "\">\n";
print "<h1>typedef " . $args{'typedef'} . "</h1>\n";
print "<ol class=\"code\">\n";
print "<li>";
print "<span class=\"keyword\">typedef</span> ";
print "<span class=\"identifier\">" . $args{'typedef'} . "</span>";
print "</li>\n";
print "</ol>\n";
output_section_html5(@_);
print "</article>\n";
}
# output struct in html5
sub output_struct_html5(%) {
my %args = %{$_[0]};
my ($parameter);
my $html5id;
$html5id = $args{'struct'};
$html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
print "<article class=\"struct\" id=\"struct:" . $html5id . "\">\n";
print "<hgroup>\n";
print "<h1>" . $args{'type'} . " " . $args{'struct'} . "</h1>";
print "<h2>". $args{'purpose'} . "</h2>\n";
print "</hgroup>\n";
print "<ol class=\"code\">\n";
print "<li>";
print "<span class=\"type\">" . $args{'type'} . "</span> ";
print "<span class=\"identifier\">" . $args{'struct'} . "</span> {";
print "</li>\n";
foreach $parameter (@{$args{'parameterlist'}}) {
print "<li class=\"indent\">";
if ($parameter =~ /^#/) {
print "<span class=\"param\">" . $parameter ."</span>\n";
print "</li>\n";
next;
}
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
$type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function
print "<span class=\"type\">$1</span> ";
print "<span class=\"param\">$parameter</span>";
print "<span class=\"type\">)</span> ";
print "(<span class=\"args\">$2</span>);";
} elsif ($type =~ m/^(.*?)\s*(:.*)/) {
# bitfield
print "<span class=\"type\">$1</span> ";
print "<span class=\"param\">$parameter</span>";
print "<span class=\"bits\">$2</span>;";
} else {
print "<span class=\"type\">$type</span> ";
print "<span class=\"param\">$parameter</span>;";
}
print "</li>\n";
}
print "<li>};</li>\n";
print "</ol>\n";
print "<section>\n";
print "<h1>Members</h1>\n";
print "<dl>\n";
foreach $parameter (@{$args{'parameterlist'}}) {
($parameter =~ /^#/) && next;
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
print "<dt>" . $parameter . "</dt>\n";
print "<dd>";
output_highlight($args{'parameterdescs'}{$parameter_name});
print "</dd>\n";
}
print "</dl>\n";
print "</section>\n";
output_section_html5(@_);
print "</article>\n";
}
# output function in html5
sub output_function_html5(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
my $html5id;
$html5id = $args{'function'};
$html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
print "<article class=\"function\" id=\"func:". $html5id . "\">\n";
print "<hgroup>\n";
print "<h1>" . $args{'function'} . "</h1>";
print "<h2>" . $args{'purpose'} . "</h2>\n";
print "</hgroup>\n";
print "<ol class=\"code\">\n";
print "<li>";
print "<span class=\"type\">" . $args{'functiontype'} . "</span> ";
print "<span class=\"identifier\">" . $args{'function'} . "</span> (";
print "</li>";
$count = 0;
foreach $parameter (@{$args{'parameterlist'}}) {
print "<li class=\"indent\">";
$type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function
print "<span class=\"type\">$1</span> ";
print "<span class=\"param\">$parameter</span>";
print "<span class=\"type\">)</span> ";
print "(<span class=\"args\">$2</span>)";
} else {
print "<span class=\"type\">$type</span> ";
print "<span class=\"param\">$parameter</span>";
}
if ($count != $#{$args{'parameterlist'}}) {
$count++;
print ",";
}
print "</li>\n";
}
print "<li>)</li>\n";
print "</ol>\n";
print "<section>\n";
print "<h1>Arguments</h1>\n";
print "<p>\n";
print "<dl>\n";
foreach $parameter (@{$args{'parameterlist'}}) {
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
print "<dt>" . $parameter . "</dt>\n";
print "<dd>";
output_highlight($args{'parameterdescs'}{$parameter_name});
print "</dd>\n";
}
print "</dl>\n";
print "</section>\n";
output_section_html5(@_);
print "</article>\n";
}
# output DOC: block header in html5
sub output_blockhead_html5(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
my $html5id;
foreach $section (@{$args{'sectionlist'}}) {
$html5id = $section;
$html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
print "<article class=\"doc\" id=\"doc:". $html5id . "\">\n";
print "<h1>$section</h1>\n";
print "<p>\n";
output_highlight($args{'sections'}{$section});
print "</p>\n";
}
print "</article>\n";
}
sub output_section_xml(%) {
my %args = %{$_[0]};
my $section;
# print out each section
$lineprefix=" ";
foreach $section (@{$args{'sectionlist'}}) {
print "<refsect1>\n";
print "<title>$section</title>\n";
if ($section =~ m/EXAMPLE/i) {
print "<informalexample><programlisting>\n";
$output_preformatted = 1;
} else {
print "<para>\n";
}
output_highlight($args{'sections'}{$section});
$output_preformatted = 0;
if ($section =~ m/EXAMPLE/i) {
print "</programlisting></informalexample>\n";
} else {
print "</para>\n";
}
print "</refsect1>\n";
}
}
# output function in XML DocBook
sub output_function_xml(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
my $id;
$id = "API-" . $args{'function'};
$id =~ s/[^A-Za-z0-9]/-/g;
print "<refentry id=\"$id\">\n";
print "<refentryinfo>\n";
print " <title>LINUX</title>\n";
print " <productname>Kernel Hackers Manual</productname>\n";
print " <date>$man_date</date>\n";
print "</refentryinfo>\n";
print "<refmeta>\n";
print " <refentrytitle><phrase>" . $args{'function'} . "</phrase></refentrytitle>\n";
print " <manvolnum>9</manvolnum>\n";
print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
print "</refmeta>\n";
print "<refnamediv>\n";
print " <refname>" . $args{'function'} . "</refname>\n";
print " <refpurpose>\n";
print " ";
output_highlight ($args{'purpose'});
print " </refpurpose>\n";
print "</refnamediv>\n";
print "<refsynopsisdiv>\n";
print " <title>Synopsis</title>\n";
print " <funcsynopsis><funcprototype>\n";
print " <funcdef>" . $args{'functiontype'} . " ";
print "<function>" . $args{'function'} . " </function></funcdef>\n";
$count = 0;
if ($#{$args{'parameterlist'}} >= 0) {
foreach $parameter (@{$args{'parameterlist'}}) {
$type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function
print " <paramdef>$1<parameter>$parameter</parameter>)\n";
print " <funcparams>$2</funcparams></paramdef>\n";
} else {
print " <paramdef>" . $type;
print " <parameter>$parameter</parameter></paramdef>\n";
}
}
} else {
print " <void/>\n";
}
print " </funcprototype></funcsynopsis>\n";
print "</refsynopsisdiv>\n";
# print parameters
print "<refsect1>\n <title>Arguments</title>\n";
if ($#{$args{'parameterlist'}} >= 0) {
print " <variablelist>\n";
foreach $parameter (@{$args{'parameterlist'}}) {
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
$type = $args{'parametertypes'}{$parameter};
print " <varlistentry>\n <term><parameter>$type $parameter</parameter></term>\n";
print " <listitem>\n <para>\n";
$lineprefix=" ";
output_highlight($args{'parameterdescs'}{$parameter_name});
print " </para>\n </listitem>\n </varlistentry>\n";
}
print " </variablelist>\n";
} else {
print " <para>\n None\n </para>\n";
}
print "</refsect1>\n";
output_section_xml(@_);
print "</refentry>\n\n";
}
# output struct in XML DocBook
sub output_struct_xml(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $id;
$id = "API-struct-" . $args{'struct'};
$id =~ s/[^A-Za-z0-9]/-/g;
print "<refentry id=\"$id\">\n";
print "<refentryinfo>\n";
print " <title>LINUX</title>\n";
print " <productname>Kernel Hackers Manual</productname>\n";
print " <date>$man_date</date>\n";
print "</refentryinfo>\n";
print "<refmeta>\n";
print " <refentrytitle><phrase>" . $args{'type'} . " " . $args{'struct'} . "</phrase></refentrytitle>\n";
print " <manvolnum>9</manvolnum>\n";
print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
print "</refmeta>\n";
print "<refnamediv>\n";
print " <refname>" . $args{'type'} . " " . $args{'struct'} . "</refname>\n";
print " <refpurpose>\n";
print " ";
output_highlight ($args{'purpose'});
print " </refpurpose>\n";
print "</refnamediv>\n";
print "<refsynopsisdiv>\n";
print " <title>Synopsis</title>\n";
print " <programlisting>\n";
print $args{'type'} . " " . $args{'struct'} . " {\n";
foreach $parameter (@{$args{'parameterlist'}}) {
if ($parameter =~ /^#/) {
my $prm = $parameter;
# convert data read & converted thru xml_escape() into &xyz; format:
# This allows us to have #define macros interspersed in a struct.
$prm =~ s/\\\\\\/\&/g;
print "$prm\n";
next;
}
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
defined($args{'parameterdescs'}{$parameter_name}) || next;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
$type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function
print " $1 $parameter) ($2);\n";
} elsif ($type =~ m/^(.*?)\s*(:.*)/) {
# bitfield
print " $1 $parameter$2;\n";
} else {
print " " . $type . " " . $parameter . ";\n";
}
}
print "};";
print " </programlisting>\n";
print "</refsynopsisdiv>\n";
print " <refsect1>\n";
print " <title>Members</title>\n";
if ($#{$args{'parameterlist'}} >= 0) {
print " <variablelist>\n";
foreach $parameter (@{$args{'parameterlist'}}) {
($parameter =~ /^#/) && next;
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
defined($args{'parameterdescs'}{$parameter_name}) || next;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
$type = $args{'parametertypes'}{$parameter};
print " <varlistentry>";
print " <term><literal>$type $parameter</literal></term>\n";
print " <listitem><para>\n";
output_highlight($args{'parameterdescs'}{$parameter_name});
print " </para></listitem>\n";
print " </varlistentry>\n";
}
print " </variablelist>\n";
} else {
print " <para>\n None\n </para>\n";
}
print " </refsect1>\n";
output_section_xml(@_);
print "</refentry>\n\n";
}
# output enum in XML DocBook
sub output_enum_xml(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
my $id;
$id = "API-enum-" . $args{'enum'};
$id =~ s/[^A-Za-z0-9]/-/g;
print "<refentry id=\"$id\">\n";
print "<refentryinfo>\n";
print " <title>LINUX</title>\n";
print " <productname>Kernel Hackers Manual</productname>\n";
print " <date>$man_date</date>\n";
print "</refentryinfo>\n";
print "<refmeta>\n";
print " <refentrytitle><phrase>enum " . $args{'enum'} . "</phrase></refentrytitle>\n";
print " <manvolnum>9</manvolnum>\n";
print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
print "</refmeta>\n";
print "<refnamediv>\n";
print " <refname>enum " . $args{'enum'} . "</refname>\n";
print " <refpurpose>\n";
print " ";
output_highlight ($args{'purpose'});
print " </refpurpose>\n";
print "</refnamediv>\n";
print "<refsynopsisdiv>\n";
print " <title>Synopsis</title>\n";
print " <programlisting>\n";
print "enum " . $args{'enum'} . " {\n";
$count = 0;
foreach $parameter (@{$args{'parameterlist'}}) {
print " $parameter";
if ($count != $#{$args{'parameterlist'}}) {
$count++;
print ",";
}
print "\n";
}
print "};";
print " </programlisting>\n";
print "</refsynopsisdiv>\n";
print "<refsect1>\n";
print " <title>Constants</title>\n";
print " <variablelist>\n";
foreach $parameter (@{$args{'parameterlist'}}) {
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
print " <varlistentry>";
print " <term>$parameter</term>\n";
print " <listitem><para>\n";
output_highlight($args{'parameterdescs'}{$parameter_name});
print " </para></listitem>\n";
print " </varlistentry>\n";
}
print " </variablelist>\n";
print "</refsect1>\n";
output_section_xml(@_);
print "</refentry>\n\n";
}
# output typedef in XML DocBook
sub output_typedef_xml(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $id;
$id = "API-typedef-" . $args{'typedef'};
$id =~ s/[^A-Za-z0-9]/-/g;
print "<refentry id=\"$id\">\n";
print "<refentryinfo>\n";
print " <title>LINUX</title>\n";
print " <productname>Kernel Hackers Manual</productname>\n";
print " <date>$man_date</date>\n";
print "</refentryinfo>\n";
print "<refmeta>\n";
print " <refentrytitle><phrase>typedef " . $args{'typedef'} . "</phrase></refentrytitle>\n";
print " <manvolnum>9</manvolnum>\n";
print "</refmeta>\n";
print "<refnamediv>\n";
print " <refname>typedef " . $args{'typedef'} . "</refname>\n";
print " <refpurpose>\n";
print " ";
output_highlight ($args{'purpose'});
print " </refpurpose>\n";
print "</refnamediv>\n";
print "<refsynopsisdiv>\n";
print " <title>Synopsis</title>\n";
print " <synopsis>typedef " . $args{'typedef'} . ";</synopsis>\n";
print "</refsynopsisdiv>\n";
output_section_xml(@_);
print "</refentry>\n\n";
}
# output in XML DocBook
sub output_blockhead_xml(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
my $id = $args{'module'};
$id =~ s/[^A-Za-z0-9]/-/g;
# print out each section
$lineprefix=" ";
foreach $section (@{$args{'sectionlist'}}) {
if (!$args{'content-only'}) {
print "<refsect1>\n <title>$section</title>\n";
}
if ($section =~ m/EXAMPLE/i) {
print "<example><para>\n";
$output_preformatted = 1;
} else {
print "<para>\n";
}
output_highlight($args{'sections'}{$section});
$output_preformatted = 0;
if ($section =~ m/EXAMPLE/i) {
print "</para></example>\n";
} else {
print "</para>";
}
if (!$args{'content-only'}) {
print "\n</refsect1>\n";
}
}
print "\n\n";
}
# output in XML DocBook
sub output_function_gnome {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
my $id;
$id = $args{'module'} . "-" . $args{'function'};
$id =~ s/[^A-Za-z0-9]/-/g;
print "<sect2>\n";
print " <title id=\"$id\">" . $args{'function'} . "</title>\n";
print " <funcsynopsis>\n";
print " <funcdef>" . $args{'functiontype'} . " ";
print "<function>" . $args{'function'} . " ";
print "</function></funcdef>\n";
$count = 0;
if ($#{$args{'parameterlist'}} >= 0) {
foreach $parameter (@{$args{'parameterlist'}}) {
$type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function
print " <paramdef>$1 <parameter>$parameter</parameter>)\n";
print " <funcparams>$2</funcparams></paramdef>\n";
} else {
print " <paramdef>" . $type;
print " <parameter>$parameter</parameter></paramdef>\n";
}
}
} else {
print " <void>\n";
}
print " </funcsynopsis>\n";
if ($#{$args{'parameterlist'}} >= 0) {
print " <informaltable pgwide=\"1\" frame=\"none\" role=\"params\">\n";
print "<tgroup cols=\"2\">\n";
print "<colspec colwidth=\"2*\">\n";
print "<colspec colwidth=\"8*\">\n";
print "<tbody>\n";
foreach $parameter (@{$args{'parameterlist'}}) {
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
print " <row><entry align=\"right\"><parameter>$parameter</parameter></entry>\n";
print " <entry>\n";
$lineprefix=" ";
output_highlight($args{'parameterdescs'}{$parameter_name});
print " </entry></row>\n";
}
print " </tbody></tgroup></informaltable>\n";
} else {
print " <para>\n None\n </para>\n";
}
# print out each section
$lineprefix=" ";
foreach $section (@{$args{'sectionlist'}}) {
print "<simplesect>\n <title>$section</title>\n";
if ($section =~ m/EXAMPLE/i) {
print "<example><programlisting>\n";
$output_preformatted = 1;
} else {
}
print "<para>\n";
output_highlight($args{'sections'}{$section});
$output_preformatted = 0;
print "</para>\n";
if ($section =~ m/EXAMPLE/i) {
print "</programlisting></example>\n";
} else {
}
print " </simplesect>\n";
}
print "</sect2>\n\n";
}
## ##
# output function in man # output function in man
sub output_function_man(%) { sub output_function_man(%) {
...@@ -1620,32 +670,12 @@ sub output_struct_man(%) { ...@@ -1620,32 +670,12 @@ sub output_struct_man(%) {
print ".SH NAME\n"; print ".SH NAME\n";
print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n"; print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n";
my $declaration = $args{'definition'};
$declaration =~ s/\t/ /g;
$declaration =~ s/\n/"\n.br\n.BI \"/g;
print ".SH SYNOPSIS\n"; print ".SH SYNOPSIS\n";
print $args{'type'} . " " . $args{'struct'} . " {\n.br\n"; print $args{'type'} . " " . $args{'struct'} . " {\n.br\n";
print ".BI \"$declaration\n};\n.br\n\n";
foreach my $parameter (@{$args{'parameterlist'}}) {
if ($parameter =~ /^#/) {
print ".BI \"$parameter\"\n.br\n";
next;
}
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
$type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function
print ".BI \" " . $1 . "\" " . $parameter . " \") (" . $2 . ")" . "\"\n;\n";
} elsif ($type =~ m/^(.*?)\s*(:.*)/) {
# bitfield
print ".BI \" " . $1 . "\ \" " . $parameter . $2 . " \"" . "\"\n;\n";
} else {
$type =~ s/([^\*])$/$1 /;
print ".BI \" " . $type . "\" " . $parameter . " \"" . "\"\n;\n";
}
print "\n.br\n";
}
print "};\n.br\n";
print ".SH Members\n"; print ".SH Members\n";
foreach $parameter (@{$args{'parameterlist'}}) { foreach $parameter (@{$args{'parameterlist'}}) {
...@@ -1694,161 +724,6 @@ sub output_blockhead_man(%) { ...@@ -1694,161 +724,6 @@ sub output_blockhead_man(%) {
} }
} }
##
# output in text
sub output_function_text(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $start;
print "Name:\n\n";
print $args{'function'} . " - " . $args{'purpose'} . "\n";
print "\nSynopsis:\n\n";
if ($args{'functiontype'} ne "") {
$start = $args{'functiontype'} . " " . $args{'function'} . " (";
} else {
$start = $args{'function'} . " (";
}
print $start;
my $count = 0;
foreach my $parameter (@{$args{'parameterlist'}}) {
$type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function
print $1 . $parameter . ") (" . $2;
} else {
print $type . " " . $parameter;
}
if ($count != $#{$args{'parameterlist'}}) {
$count++;
print ",\n";
print " " x length($start);
} else {
print ");\n\n";
}
}
print "Arguments:\n\n";
foreach $parameter (@{$args{'parameterlist'}}) {
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
print $parameter . "\n\t" . $args{'parameterdescs'}{$parameter_name} . "\n";
}
output_section_text(@_);
}
#output sections in text
sub output_section_text(%) {
my %args = %{$_[0]};
my $section;
print "\n";
foreach $section (@{$args{'sectionlist'}}) {
print "$section:\n\n";
output_highlight($args{'sections'}{$section});
}
print "\n\n";
}
# output enum in text
sub output_enum_text(%) {
my %args = %{$_[0]};
my ($parameter);
my $count;
print "Enum:\n\n";
print "enum " . $args{'enum'} . " - " . $args{'purpose'} . "\n\n";
print "enum " . $args{'enum'} . " {\n";
$count = 0;
foreach $parameter (@{$args{'parameterlist'}}) {
print "\t$parameter";
if ($count != $#{$args{'parameterlist'}}) {
$count++;
print ",";
}
print "\n";
}
print "};\n\n";
print "Constants:\n\n";
foreach $parameter (@{$args{'parameterlist'}}) {
print "$parameter\n\t";
print $args{'parameterdescs'}{$parameter} . "\n";
}
output_section_text(@_);
}
# output typedef in text
sub output_typedef_text(%) {
my %args = %{$_[0]};
my ($parameter);
my $count;
print "Typedef:\n\n";
print "typedef " . $args{'typedef'} . " - " . $args{'purpose'} . "\n";
output_section_text(@_);
}
# output struct as text
sub output_struct_text(%) {
my %args = %{$_[0]};
my ($parameter);
print $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "\n\n";
print $args{'type'} . " " . $args{'struct'} . " {\n";
foreach $parameter (@{$args{'parameterlist'}}) {
if ($parameter =~ /^#/) {
print "$parameter\n";
next;
}
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
$type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function
print "\t$1 $parameter) ($2);\n";
} elsif ($type =~ m/^(.*?)\s*(:.*)/) {
# bitfield
print "\t$1 $parameter$2;\n";
} else {
print "\t" . $type . " " . $parameter . ";\n";
}
}
print "};\n\n";
print "Members:\n\n";
foreach $parameter (@{$args{'parameterlist'}}) {
($parameter =~ /^#/) && next;
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
print "$parameter\n\t";
print $args{'parameterdescs'}{$parameter_name} . "\n";
}
print "\n";
output_section_text(@_);
}
sub output_blockhead_text(%) {
my %args = %{$_[0]};
my ($parameter, $section);
foreach $section (@{$args{'sectionlist'}}) {
print " $section:\n";
print " -> ";
output_highlight($args{'sections'}{$section});
}
}
## ##
# output in restructured text # output in restructured text
# #
...@@ -2038,29 +913,9 @@ sub output_struct_rst(%) { ...@@ -2038,29 +913,9 @@ sub output_struct_rst(%) {
print "**Definition**\n\n"; print "**Definition**\n\n";
print "::\n\n"; print "::\n\n";
print " " . $args{'type'} . " " . $args{'struct'} . " {\n"; my $declaration = $args{'definition'};
foreach $parameter (@{$args{'parameterlist'}}) { $declaration =~ s/\t/ /g;
if ($parameter =~ /^#/) { print " " . $args{'type'} . " " . $args{'struct'} . " {\n$declaration };\n\n";
print " " . "$parameter\n";
next;
}
my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
$type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function
print " $1 $parameter) ($2);\n";
} elsif ($type =~ m/^(.*?)\s*(:.*)/) {
# bitfield
print " $1 $parameter$2;\n";
} else {
print " " . $type . " " . $parameter . ";\n";
}
}
print " };\n\n";
print "**Members**\n\n"; print "**Members**\n\n";
$lineprefix = " "; $lineprefix = " ";
...@@ -2083,44 +938,6 @@ sub output_struct_rst(%) { ...@@ -2083,44 +938,6 @@ sub output_struct_rst(%) {
output_section_rst(@_); output_section_rst(@_);
} }
## list mode output functions
sub output_function_list(%) {
my %args = %{$_[0]};
print $args{'function'} . "\n";
}
# output enum in list
sub output_enum_list(%) {
my %args = %{$_[0]};
print $args{'enum'} . "\n";
}
# output typedef in list
sub output_typedef_list(%) {
my %args = %{$_[0]};
print $args{'typedef'} . "\n";
}
# output struct as list
sub output_struct_list(%) {
my %args = %{$_[0]};
print $args{'struct'} . "\n";
}
sub output_blockhead_list(%) {
my %args = %{$_[0]};
my ($parameter, $section);
foreach $section (@{$args{'sectionlist'}}) {
print "DOC: $section\n";
}
}
## none mode output functions ## none mode output functions
sub output_function_none(%) { sub output_function_none(%) {
...@@ -2186,39 +1003,128 @@ sub dump_union($$) { ...@@ -2186,39 +1003,128 @@ sub dump_union($$) {
sub dump_struct($$) { sub dump_struct($$) {
my $x = shift; my $x = shift;
my $file = shift; my $file = shift;
my $nested;
if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) {
my $decl_type = $1; my $decl_type = $1;
$declaration_name = $2; $declaration_name = $2;
my $members = $3; my $members = $3;
# ignore embedded structs or unions
$members =~ s/({.*})//g;
$nested = $1;
# ignore members marked private: # ignore members marked private:
$members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi; $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi;
$members =~ s/\/\*\s*private:.*//gosi; $members =~ s/\/\*\s*private:.*//gosi;
# strip comments: # strip comments:
$members =~ s/\/\*.*?\*\///gos; $members =~ s/\/\*.*?\*\///gos;
$nested =~ s/\/\*.*?\*\///gos;
# strip attributes # strip attributes
$members =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i; $members =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i;
$members =~ s/__aligned\s*\([^;]*\)//gos; $members =~ s/__aligned\s*\([^;]*\)//gos;
$members =~ s/\s*CRYPTO_MINALIGN_ATTR//gos; $members =~ s/\s*CRYPTO_MINALIGN_ATTR//gos;
# replace DECLARE_BITMAP # replace DECLARE_BITMAP
$members =~ s/DECLARE_BITMAP\s*\(([^,)]+), ([^,)]+)\)/unsigned long $1\[BITS_TO_LONGS($2)\]/gos; $members =~ s/DECLARE_BITMAP\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[BITS_TO_LONGS($2)\]/gos;
# replace DECLARE_HASHTABLE # replace DECLARE_HASHTABLE
$members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+), ([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos; $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos;
# replace DECLARE_KFIFO
create_parameterlist($members, ';', $file); $members =~ s/DECLARE_KFIFO\s*\(([^,)]+),\s*([^,)]+),\s*([^,)]+)\)/$2 \*$1/gos;
check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual, $nested); # replace DECLARE_KFIFO_PTR
$members =~ s/DECLARE_KFIFO_PTR\s*\(([^,)]+),\s*([^,)]+)\)/$2 \*$1/gos;
my $declaration = $members;
# Split nested struct/union elements as newer ones
while ($members =~ m/(struct|union)([^\{\};]+)\{([^\{\}]*)\}([^\{\}\;]*)\;/) {
my $newmember;
my $maintype = $1;
my $ids = $4;
my $content = $3;
foreach my $id(split /,/, $ids) {
$newmember .= "$maintype $id; ";
$id =~ s/[:\[].*//;
$id =~ s/^\s*\**(\S+)\s*/$1/;
foreach my $arg (split /;/, $content) {
next if ($arg =~ m/^\s*$/);
if ($arg =~ m/^([^\(]+\(\*?\s*)([\w\.]*)(\s*\).*)/) {
# pointer-to-function
my $type = $1;
my $name = $2;
my $extra = $3;
next if (!$name);
if ($id =~ m/^\s*$/) {
# anonymous struct/union
$newmember .= "$type$name$extra; ";
} else {
$newmember .= "$type$id.$name$extra; ";
}
} else {
my $type;
my $names;
$arg =~ s/^\s+//;
$arg =~ s/\s+$//;
# Handle bitmaps
$arg =~ s/:\s*\d+\s*//g;
# Handle arrays
$arg =~ s/\[\S+\]//g;
# The type may have multiple words,
# and multiple IDs can be defined, like:
# const struct foo, *bar, foobar
# So, we remove spaces when parsing the
# names, in order to match just names
# and commas for the names
$arg =~ s/\s*,\s*/,/g;
if ($arg =~ m/(.*)\s+([\S+,]+)/) {
$type = $1;
$names = $2;
} else {
$newmember .= "$arg; ";
next;
}
foreach my $name (split /,/, $names) {
$name =~ s/^\s*\**(\S+)\s*/$1/;
next if (($name =~ m/^\s*$/));
if ($id =~ m/^\s*$/) {
# anonymous struct/union
$newmember .= "$type $name; ";
} else {
$newmember .= "$type $id.$name; ";
}
}
}
}
}
$members =~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)}([^\{\}\;]*)\;/$newmember/;
}
# Ignore other nested elements, like enums
$members =~ s/({[^\{\}]*})//g;
create_parameterlist($members, ';', $file, $declaration_name);
check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual);
# Adjust declaration for better display
$declaration =~ s/([{;])/$1\n/g;
$declaration =~ s/}\s+;/};/g;
# Better handle inlined enums
do {} while ($declaration =~ s/(enum\s+{[^}]+),([^\n])/$1,\n$2/);
my @def_args = split /\n/, $declaration;
my $level = 1;
$declaration = "";
foreach my $clause (@def_args) {
$clause =~ s/^\s+//;
$clause =~ s/\s+$//;
$clause =~ s/\s+/ /;
next if (!$clause);
$level-- if ($clause =~ m/(})/ && $level > 1);
if (!($clause =~ m/^\s*#/)) {
$declaration .= "\t" x $level;
}
$declaration .= "\t" . $clause . "\n";
$level++ if ($clause =~ m/({)/ && !($clause =~m/}/));
}
output_declaration($declaration_name, output_declaration($declaration_name,
'struct', 'struct',
{'struct' => $declaration_name, {'struct' => $declaration_name,
'module' => $modulename, 'module' => $modulename,
'definition' => $declaration,
'parameterlist' => \@parameterlist, 'parameterlist' => \@parameterlist,
'parameterdescs' => \%parameterdescs, 'parameterdescs' => \%parameterdescs,
'parametertypes' => \%parametertypes, 'parametertypes' => \%parametertypes,
...@@ -2234,6 +1140,44 @@ sub dump_struct($$) { ...@@ -2234,6 +1140,44 @@ sub dump_struct($$) {
} }
} }
sub show_warnings($$) {
my $functype = shift;
my $name = shift;
return 1 if ($output_selection == OUTPUT_ALL);
if ($output_selection == OUTPUT_EXPORTED) {
if (defined($function_table{$name})) {
return 1;
} else {
return 0;
}
}
if ($output_selection == OUTPUT_INTERNAL) {
if (!($functype eq "function" && defined($function_table{$name}))) {
return 1;
} else {
return 0;
}
}
if ($output_selection == OUTPUT_INCLUDE) {
if (defined($function_table{$name})) {
return 1;
} else {
return 0;
}
}
if ($output_selection == OUTPUT_EXCLUDE) {
if (!defined($function_table{$name})) {
return 1;
} else {
return 0;
}
}
die("Please add the new output type at show_warnings()");
}
sub dump_enum($$) { sub dump_enum($$) {
my $x = shift; my $x = shift;
my $file = shift; my $file = shift;
...@@ -2254,16 +1198,18 @@ sub dump_enum($$) { ...@@ -2254,16 +1198,18 @@ sub dump_enum($$) {
push @parameterlist, $arg; push @parameterlist, $arg;
if (!$parameterdescs{$arg}) { if (!$parameterdescs{$arg}) {
$parameterdescs{$arg} = $undescribed; $parameterdescs{$arg} = $undescribed;
print STDERR "${file}:$.: warning: Enum value '$arg' ". if (show_warnings("enum", $declaration_name)) {
"not described in enum '$declaration_name'\n"; print STDERR "${file}:$.: warning: Enum value '$arg' not described in enum '$declaration_name'\n";
}
} }
$_members{$arg} = 1; $_members{$arg} = 1;
} }
while (my ($k, $v) = each %parameterdescs) { while (my ($k, $v) = each %parameterdescs) {
if (!exists($_members{$k})) { if (!exists($_members{$k})) {
print STDERR "${file}:$.: warning: Excess enum value " . if (show_warnings("enum", $declaration_name)) {
"'$k' description in '$declaration_name'\n"; print STDERR "${file}:$.: warning: Excess enum value '$k' description in '$declaration_name'\n";
}
} }
} }
...@@ -2299,7 +1245,7 @@ sub dump_typedef($$) { ...@@ -2299,7 +1245,7 @@ sub dump_typedef($$) {
$declaration_name = $2; $declaration_name = $2;
my $args = $3; my $args = $3;
create_parameterlist($args, ',', $file); create_parameterlist($args, ',', $file, $declaration_name);
output_declaration($declaration_name, output_declaration($declaration_name,
'function', 'function',
...@@ -2348,10 +1294,11 @@ sub save_struct_actual($) { ...@@ -2348,10 +1294,11 @@ sub save_struct_actual($) {
$struct_actual = $struct_actual . $actual . " "; $struct_actual = $struct_actual . $actual . " ";
} }
sub create_parameterlist($$$) { sub create_parameterlist($$$$) {
my $args = shift; my $args = shift;
my $splitter = shift; my $splitter = shift;
my $file = shift; my $file = shift;
my $declaration_name = shift;
my $type; my $type;
my $param; my $param;
...@@ -2376,12 +1323,12 @@ sub create_parameterlist($$$) { ...@@ -2376,12 +1323,12 @@ sub create_parameterlist($$$) {
} elsif ($arg =~ m/\(.+\)\s*\(/) { } elsif ($arg =~ m/\(.+\)\s*\(/) {
# pointer-to-function # pointer-to-function
$arg =~ tr/#/,/; $arg =~ tr/#/,/;
$arg =~ m/[^\(]+\(\*?\s*(\w*)\s*\)/; $arg =~ m/[^\(]+\(\*?\s*([\w\.]*)\s*\)/;
$param = $1; $param = $1;
$type = $arg; $type = $arg;
$type =~ s/([^\(]+\(\*?)\s*$param/$1/; $type =~ s/([^\(]+\(\*?)\s*$param/$1/;
save_struct_actual($param); save_struct_actual($param);
push_parameter($param, $type, $file); push_parameter($param, $type, $file, $declaration_name);
} elsif ($arg) { } elsif ($arg) {
$arg =~ s/\s*:\s*/:/g; $arg =~ s/\s*:\s*/:/g;
$arg =~ s/\s*\[/\[/g; $arg =~ s/\s*\[/\[/g;
...@@ -2406,27 +1353,28 @@ sub create_parameterlist($$$) { ...@@ -2406,27 +1353,28 @@ sub create_parameterlist($$$) {
foreach $param (@args) { foreach $param (@args) {
if ($param =~ m/^(\*+)\s*(.*)/) { if ($param =~ m/^(\*+)\s*(.*)/) {
save_struct_actual($2); save_struct_actual($2);
push_parameter($2, "$type $1", $file); push_parameter($2, "$type $1", $file, $declaration_name);
} }
elsif ($param =~ m/(.*?):(\d+)/) { elsif ($param =~ m/(.*?):(\d+)/) {
if ($type ne "") { # skip unnamed bit-fields if ($type ne "") { # skip unnamed bit-fields
save_struct_actual($1); save_struct_actual($1);
push_parameter($1, "$type:$2", $file) push_parameter($1, "$type:$2", $file, $declaration_name)
} }
} }
else { else {
save_struct_actual($param); save_struct_actual($param);
push_parameter($param, $type, $file); push_parameter($param, $type, $file, $declaration_name);
} }
} }
} }
} }
} }
sub push_parameter($$$) { sub push_parameter($$$$) {
my $param = shift; my $param = shift;
my $type = shift; my $type = shift;
my $file = shift; my $file = shift;
my $declaration_name = shift;
if (($anon_struct_union == 1) && ($type eq "") && if (($anon_struct_union == 1) && ($type eq "") &&
($param eq "}")) { ($param eq "}")) {
...@@ -2463,21 +1411,15 @@ sub push_parameter($$$) { ...@@ -2463,21 +1411,15 @@ sub push_parameter($$$) {
# warn if parameter has no description # warn if parameter has no description
# (but ignore ones starting with # as these are not parameters # (but ignore ones starting with # as these are not parameters
# but inline preprocessor statements); # but inline preprocessor statements);
# also ignore unnamed structs/unions; # Note: It will also ignore void params and unnamed structs/unions
if (!$anon_struct_union) {
if (!defined $parameterdescs{$param} && $param !~ /^#/) { if (!defined $parameterdescs{$param} && $param !~ /^#/) {
$parameterdescs{$param} = $undescribed;
$parameterdescs{$param} = $undescribed; if (show_warnings($type, $declaration_name)) {
print STDERR
if (($type eq 'function') || ($type eq 'enum')) { "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n";
print STDERR "${file}:$.: warning: Function parameter ". ++$warnings;
"or member '$param' not " . }
"described in '$declaration_name'\n";
}
print STDERR "${file}:$.: warning:" .
" No description found for parameter '$param'\n";
++$warnings;
}
} }
$param = xml_escape($param); $param = xml_escape($param);
...@@ -2496,8 +1438,8 @@ sub push_parameter($$$) { ...@@ -2496,8 +1438,8 @@ sub push_parameter($$$) {
$parametertypes{$param} = $type; $parametertypes{$param} = $type;
} }
sub check_sections($$$$$$) { sub check_sections($$$$$) {
my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck, $nested) = @_; my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck) = @_;
my @sects = split ' ', $sectcheck; my @sects = split ' ', $sectcheck;
my @prms = split ' ', $prmscheck; my @prms = split ' ', $prmscheck;
my $err; my $err;
...@@ -2531,14 +1473,6 @@ sub check_sections($$$$$$) { ...@@ -2531,14 +1473,6 @@ sub check_sections($$$$$$) {
"'$sects[$sx]' " . "'$sects[$sx]' " .
"description in '$decl_name'\n"; "description in '$decl_name'\n";
++$warnings; ++$warnings;
} else {
if ($nested !~ m/\Q$sects[$sx]\E/) {
print STDERR "${file}:$.: warning: " .
"Excess $decl_type member " .
"'$sects[$sx]' " .
"description in '$decl_name'\n";
++$warnings;
}
} }
} }
} }
...@@ -2642,14 +1576,14 @@ sub dump_function($$) { ...@@ -2642,14 +1576,14 @@ sub dump_function($$) {
$declaration_name = $2; $declaration_name = $2;
my $args = $3; my $args = $3;
create_parameterlist($args, ',', $file); create_parameterlist($args, ',', $file, $declaration_name);
} else { } else {
print STDERR "${file}:$.: warning: cannot understand function prototype: '$prototype'\n"; print STDERR "${file}:$.: warning: cannot understand function prototype: '$prototype'\n";
return; return;
} }
my $prms = join " ", @parameterlist; my $prms = join " ", @parameterlist;
check_sections($file, $declaration_name, "function", $sectcheck, $prms, ""); check_sections($file, $declaration_name, "function", $sectcheck, $prms);
# This check emits a lot of warnings at the moment, because many # This check emits a lot of warnings at the moment, because many
# functions don't have a 'Return' doc section. So until the number # functions don't have a 'Return' doc section. So until the number
...@@ -2718,7 +1652,7 @@ sub tracepoint_munge($) { ...@@ -2718,7 +1652,7 @@ sub tracepoint_munge($) {
sub syscall_munge() { sub syscall_munge() {
my $void = 0; my $void = 0;
$prototype =~ s@[\r\n\t]+@ @gos; # strip newlines/CR's/tabs $prototype =~ s@[\r\n]+@ @gos; # strip newlines/CR's
## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) { ## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) {
if ($prototype =~ m/SYSCALL_DEFINE0/) { if ($prototype =~ m/SYSCALL_DEFINE0/) {
$void = 1; $void = 1;
...@@ -2823,7 +1757,7 @@ sub process_proto_type($$) { ...@@ -2823,7 +1757,7 @@ sub process_proto_type($$) {
# just before actual output; (this is done by local_unescape()) # just before actual output; (this is done by local_unescape())
sub xml_escape($) { sub xml_escape($) {
my $text = shift; my $text = shift;
if (($output_mode eq "text") || ($output_mode eq "man")) { if ($output_mode eq "man") {
return $text; return $text;
} }
$text =~ s/\&/\\\\\\amp;/g; $text =~ s/\&/\\\\\\amp;/g;
...@@ -2835,7 +1769,7 @@ sub xml_escape($) { ...@@ -2835,7 +1769,7 @@ sub xml_escape($) {
# xml_unescape: reverse the effects of xml_escape # xml_unescape: reverse the effects of xml_escape
sub xml_unescape($) { sub xml_unescape($) {
my $text = shift; my $text = shift;
if (($output_mode eq "text") || ($output_mode eq "man")) { if ($output_mode eq "man") {
return $text; return $text;
} }
$text =~ s/\\\\\\amp;/\&/g; $text =~ s/\\\\\\amp;/\&/g;
...@@ -2848,7 +1782,7 @@ sub xml_unescape($) { ...@@ -2848,7 +1782,7 @@ sub xml_unescape($) {
# local escape strings look like: '\\\\menmonic:' (that's 4 backslashes) # local escape strings look like: '\\\\menmonic:' (that's 4 backslashes)
sub local_unescape($) { sub local_unescape($) {
my $text = shift; my $text = shift;
if (($output_mode eq "text") || ($output_mode eq "man")) { if ($output_mode eq "man") {
return $text; return $text;
} }
$text =~ s/\\\\\\\\lt:/</g; $text =~ s/\\\\\\\\lt:/</g;
...@@ -2917,6 +1851,8 @@ sub process_file($) { ...@@ -2917,6 +1851,8 @@ sub process_file($) {
while (s/\\\s*$//) { while (s/\\\s*$//) {
$_ .= <IN>; $_ .= <IN>;
} }
# Replace tabs by spaces
while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};
if ($state == STATE_NORMAL) { if ($state == STATE_NORMAL) {
if (/$doc_start/o) { if (/$doc_start/o) {
$state = STATE_NAME; # next line is always the function name $state = STATE_NAME; # next line is always the function name
...@@ -3016,8 +1952,7 @@ sub process_file($) { ...@@ -3016,8 +1952,7 @@ sub process_file($) {
$in_purpose = 0; $in_purpose = 0;
$contents = $newcontents; $contents = $newcontents;
$new_start_line = $.; $new_start_line = $.;
while ((substr($contents, 0, 1) eq " ") || while (substr($contents, 0, 1) eq " ") {
substr($contents, 0, 1) eq "\t") {
$contents = substr($contents, 1); $contents = substr($contents, 1);
} }
if ($contents ne "") { if ($contents ne "") {
...@@ -3086,8 +2021,7 @@ sub process_file($) { ...@@ -3086,8 +2021,7 @@ sub process_file($) {
$contents = $2; $contents = $2;
$new_start_line = $.; $new_start_line = $.;
if ($contents ne "") { if ($contents ne "") {
while ((substr($contents, 0, 1) eq " ") || while (substr($contents, 0, 1) eq " ") {
substr($contents, 0, 1) eq "\t") {
$contents = substr($contents, 1); $contents = substr($contents, 1);
} }
$contents .= "\n"; $contents .= "\n";
...@@ -3170,34 +2104,6 @@ sub process_file($) { ...@@ -3170,34 +2104,6 @@ sub process_file($) {
if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) { if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) {
print STDERR " Was looking for '$_'.\n" for keys %function_table; print STDERR " Was looking for '$_'.\n" for keys %function_table;
} }
if ($output_mode eq "xml") {
# The template wants at least one RefEntry here; make one.
print "<refentry>\n";
print " <refnamediv>\n";
print " <refname>\n";
print " ${orig_file}\n";
print " </refname>\n";
print " <refpurpose>\n";
print " Document generation inconsistency\n";
print " </refpurpose>\n";
print " </refnamediv>\n";
print " <refsect1>\n";
print " <title>\n";
print " Oops\n";
print " </title>\n";
print " <warning>\n";
print " <para>\n";
print " The template for this document tried to insert\n";
print " the structured comment from the file\n";
print " <filename>${orig_file}</filename> at this point,\n";
print " but none was found.\n";
print " This dummy section is inserted to allow\n";
print " generation to continue.\n";
print " </para>\n";
print " </warning>\n";
print " </refsect1>\n";
print "</refentry>\n";
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment