Add support to generate ABI documentation at admin-guide
Subsystems (12)
PATCH 6/14 scripts/get_abi.pl: parse files with text at beginning
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
It sounds usefult o parse files with has some text at the beginning. Add support for it.
--- scripts/get_abi.pl | 59 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 5 deletions(-)
scripts/get_abi.pl +54 -5
@@ -55,7 +55,10 @@ sub parse_abi { my $what; my $new_what; my $tag; + my $label; my $ln; + my $has_file; + my $xrefs; print STDERR "Opening $file\n" if ($debug > 1); open IN, $file;
@@ -67,7 +70,7 @@ sub parse_abi { if (!($new_tag =~ m/(what|date|kernelversion|contact|description|users)/)) { if ($tag eq "description") { - $data{$what}->{$tag} .= "\n$content";; + $data{$what}->{$tag} .= "\n$content"; $data{$what}->{$tag} =~ s/\n+$//; next; } else {
@@ -83,6 +86,25 @@ sub parse_abi { $new_what = 1; } $tag = $new_tag; + + if ($has_file) { + $label = "abi_" . $content . " "; + $label =~ tr/A-Z/a-z/; + + # Convert special chars to "_" + $label =~s/[\x00-\x2f]+/_/g; + $label =~s/[\x3a-\x40]+/_/g; + $label =~s/[\x7b-\xff]+/_/g; + $label =~ s,_+,_,g; + $label =~ s,_$,,; + + $data{$what}->{label} .= $label; + + # Escape special chars from content + $content =~s/([\x00-\x1f\x21-\x2f\x3a-\x40\x7b-\xff])/\\$1/g; + + $xrefs .= "- :ref:`$content <$label>`\n\n"; + } next; }
@@ -104,8 +126,18 @@ sub parse_abi { next; } - # Silently ignore any headers before the database - next if (!$tag); + # Store any contents before the database + if (!$tag) { + next if (/^\n/); + + my $my_what = "File $name"; + $data{$my_what}->{what} = "File $name"; + $data{$my_what}->{type} = "File"; + $data{$my_what}->{file} = $name; + $data{$my_what}->{description} .= $_; + $has_file = 1; + next; + } if (m/^\s*(.*)/) { $data{$what}->{$tag} .= "\n$1";
@@ -117,6 +149,11 @@ sub parse_abi { parse_error($file, $ln, "Unexpected line:", $_); } close IN; + + if ($has_file) { + my $my_what = "File $name"; + $data{$my_what}->{xrefs} = $xrefs; + } } # Outputs the output on ReST format
@@ -128,8 +165,17 @@ sub output_rest { my $w = $what; $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g; + if ($data{$what}->{label}) { + my @labels = split(/\s/, $data{$what}->{label}); + foreach my $label (@labels) { + printf ".. _%s:\n\n", $label; + } + } + print "$w\n\n"; - print "- defined on file $file (type: $type)\n\n::\n\n"; + + print "- defined on file $file (type: $type)\n\n" if ($type ne "File"); + print "::\n\n"; my $desc = $data{$what}->{description}; $desc =~ s/^\s+//;
@@ -144,8 +190,11 @@ sub output_rest { if (!($desc =~ /^\s*$/)) { print " $desc\n\n"; } else { - print " DESCRIPTION MISSING\n\n"; + print " DESCRIPTION MISSING for $what\n\n"; } + + printf "Has the following ABI:\n\n%s", $data{$what}->{xrefs} if ($data{$what}->{xrefs}); + } }
Signature · 1 line
2.21.0
PATCH 3/14 ABI: sysfs-class-uwb_rc: remove a duplicated incomplete entry
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
There are two entries for /sys/class/uwb_rc/uwbN/<EUI-48>/BPST. The second one has a missing description.
Get rid of it.
--- Documentation/ABI/testing/sysfs-class-uwb_rc | 6 ------ 1 file changed, 6 deletions(-)
Documentation/ABI/testing/sysfs-class-uwb_rc +0 -6
@@ -125,12 +125,6 @@ Description: The EUI-48 of this device in colon separated hex octets. -What: /sys/class/uwb_rc/uwbN/<EUI-48>/BPST -Date: July 2008 -KernelVersion: 2.6.27 -Contact: [email protected] -Description: - What: /sys/class/uwb_rc/uwbN/<EUI-48>/IEs Date: July 2008 KernelVersion: 2.6.27
Signature · 1 line
2.21.0
PATCH 7/14 scripts/get_abi.pl: avoid use literal blocks when not needed
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
The usage of literal blocks make the document very complex, causing the browser to take a long time to load.
On most ABI descriptions, they're a plain text, and don't require a literal block.
So, add a logic there with identifies when a literal block is needed.
As, on literal blocks, we need to respect the original document space, the most complex part of this patch is to preserve the original spacing where needed.
--- scripts/get_abi.pl | 104 +++++++++++++++++++++++++++++++++------------ 1 file changed, 78 insertions(+), 26 deletions(-)
scripts/get_abi.pl +78 -26
@@ -59,29 +59,34 @@ sub parse_abi { my $ln; my $has_file; my $xrefs; + my $space; print STDERR "Opening $file\n" if ($debug > 1); open IN, $file; while(<IN>) { $ln++; - if (m/^(\S+):\s*(.*)/i) { + if (m/^(\S+)(:\s*)(.*)/i) { my $new_tag = lc($1); - my $content = $2; + my $sep = $2; + my $content = $3; if (!($new_tag =~ m/(what|date|kernelversion|contact|description|users)/)) { if ($tag eq "description") { - $data{$what}->{$tag} .= "\n$content"; - $data{$what}->{$tag} =~ s/\n+$//; - next; + # New "tag" is actually part of + # description. Don't consider it a tag + $new_tag = ""; } else { parse_error($file, $ln, "tag '$tag' is invalid", $_); } } if ($new_tag =~ m/what/) { + $space = ""; if ($tag =~ m/what/) { $what .= ", " . $content; } else { + parse_error($file, $ln, "What '$what' doesn't have a description", "") if ($what && !$data{$what}->{description}); + $what = $content; $new_what = 1; }
@@ -108,25 +113,38 @@ sub parse_abi { next; } - $tag = $new_tag; + if ($new_tag) { + $tag = $new_tag; - if ($new_what) { - $new_what = 0; + if ($new_what) { + $new_what = 0; - $data{$what}->{type} = $type; - $data{$what}->{file} = $name; - print STDERR "\twhat: $what\n" if ($debug > 1); - } + $data{$what}->{type} = $type; + $data{$what}->{file} = $name; + print STDERR "\twhat: $what\n" if ($debug > 1); + } - if (!$what) { - parse_error($file, $ln, "'What:' should come first:", $_); + if (!$what) { + parse_error($file, $ln, "'What:' should come first:", $_); + next; + } + if ($tag eq "description") { + next if ($content =~ m/^\s*$/); + if ($content =~ m/^(\s*)(.*)/) { + my $new_content = $2; + $space = $new_tag . $sep . $1; + while ($space =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} + $space =~ s/./ /g; + $data{$what}->{$tag} .= "$new_content\n"; + } + } else { + $data{$what}->{$tag} = $content; + } next; } - $data{$what}->{$tag} = $content; - next; } - # Store any contents before the database + # Store any contents before tags at the database if (!$tag) { next if (/^\n/);
@@ -139,6 +157,32 @@ sub parse_abi { next; } + if ($tag eq "description") { + if (!$data{$what}->{description}) { + next if (m/^\s*\n/); + if (m/^(\s*)(.*)/) { + $space = $1; + while ($space =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} + $data{$what}->{$tag} .= "$2\n"; + } + } else { + my $content = $_; + if (m/^\s*\n/) { + $data{$what}->{$tag} .= $content; + next; + } + + while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} + $space = "" if (!($content =~ s/^($space)//)); + + # Compress spaces with tabs + $content =~ s<^ {8}> <\t>; + $content =~ s<^ {1,7}\t> <\t>; + $content =~ s< {1,7}\t> <\t>; + $data{$what}->{$tag} .= $content; + } + next; + } if (m/^\s*(.*)/) { $data{$what}->{$tag} .= "\n$1"; $data{$what}->{$tag} =~ s/\n+$//;
@@ -165,6 +209,9 @@ sub output_rest { my $w = $what; $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g; + my $bar = $w; + $bar =~ s/./-/g; + if ($data{$what}->{label}) { my @labels = split(/\s/, $data{$what}->{label}); foreach my $label (@labels) {
@@ -172,10 +219,9 @@ sub output_rest { } } - print "$w\n\n"; + print "$w\n$bar\n\n"; print "- defined on file $file (type: $type)\n\n" if ($type ne "File"); - print "::\n\n"; my $desc = $data{$what}->{description}; $desc =~ s/^\s+//;
@@ -183,18 +229,24 @@ sub output_rest { # Remove title markups from the description, as they won't work $desc =~ s/\n[\-\*\=\^\~]+\n/\n/g; - # put everything inside a code block - $desc =~ s/\n/\n /g; - - if (!($desc =~ /^\s*$/)) { - print " $desc\n\n"; + if ($desc =~ m/\:\n/ || $desc =~ m/\n[\t ]+/ || $desc =~ m/[\x00-\x08\x0b-\x1f\x7b-\xff]/) { + # put everything inside a code block + $desc =~ s/\n/\n /g; + + print "::\n\n"; + print " $desc\n\n"; + } else { + # Escape any special chars from description + $desc =~s/([\x00-\x08\x0b-\x1f\x21-\x2a\x2d\x2f\x3c-\x40\x5c\x5e-\x60\x7b-\xff])/\\$1/g; + + print "$desc\n\n"; + } } else { - print " DESCRIPTION MISSING for $what\n\n"; + print "DESCRIPTION MISSING for $what\n\n"; } printf "Has the following ABI:\n\n%s", $data{$what}->{xrefs} if ($data{$what}->{xrefs}); - } }
Signature · 1 line
2.21.0
PATCH 14/14 docs: sphinx/kernel_abi.py: fix UTF-8 support
In reply to Mauro Carvalho ChehabThe parser breaks with UTF-8 characters with Sphinx 1.4.
--- Documentation/sphinx/kernel_abi.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Documentation/sphinx/kernel_abi.py +6 -4
@@ -1,4 +1,5 @@ -# -*- coding: utf-8; mode: python -*- +# coding=utf-8 +# u""" kernel-abi ~~~~~~~~~~
@@ -28,6 +29,7 @@ u""" """ +import codecs import sys import os from os import path
@@ -124,12 +126,12 @@ class KernelCmd(Directive): cmd , stdout = subprocess.PIPE , stderr = subprocess.PIPE - , universal_newlines = True , **kwargs ) out, err = proc.communicate() - if err: - self.warn(err) + + out, err = codecs.decode(out, 'utf-8'), codecs.decode(err, 'utf-8') + if proc.returncode != 0: raise self.severe( u"command '%s' failed with return code %d"
Signature · 1 line
2.21.0
cover Add support to generate ABI documentation at admin-guide
Greg,
As promised, I'm resending the patch series with adds the Kernel ABI to Documentation/admin-guide.
Those patches are basically the version 3 patchset I sent back in 2017, rebased on the top of linux-next (next-20190613), and with some fixes in order for it to work.
- The 4 initial patches to fix some ABI descriptions that are violating the syntax described at Documentation/ABI/README;
- The next 6 patches are the ones originally written in 2017 with a script with parses the ABI files;
- The 11th patch is a new one: it relaxes a little bit the parser in order to parse file headers that contains colons on it;
- The 12th patch adds the new script to the documentation build system, together with a new python Sphinx extension with calls it;
- The 13th patch fixes the python script when running with newer Sphinx versions (1.7 and upper);
- The final patch fixes an UTF-8 trouble. I noticed it only with Sphinx 1.4, but it could affect other versions too. So, I ended by changing the UTF-8 encoding logit to work version-independent, just like what happens with kerneldoc.py extension.
Mauro Carvalho Chehab (14):
ABI: fix some syntax issues at the ABI database
ABI: sysfs-driver-hid: the "What" field doesn't parse fine
ABI: sysfs-class-uwb_rc: remove a duplicated incomplete entry
ABI: better identificate tables
scripts: add an script to parse the ABI files scripts/get_abi.pl: parse files with text at beginning scripts/get_abi.pl: avoid use literal blocks when not needed scripts/get_abi.pl: split label naming from xref logic scripts/get_abi.pl: add support for searching for ABI symbols scripts/get_abi.pl: represent what in tables scripts/get_abi.pl: fix parse issues with some files
doc-rst: add ABI documentation to the admin-guide book sphinx/kernel_abi.py: make it compatible with Sphinx 1.7+
docs: sphinx/kernel_abi.py: fix UTF-8 support
.../ABI/obsolete/sysfs-driver-hid-roccat-pyra | 2 +- Documentation/ABI/testing/pstore | 2 +- .../sysfs-bus-event_source-devices-format | 2 +- .../ABI/testing/sysfs-bus-i2c-devices-hm6352 | 6 +- .../ABI/testing/sysfs-bus-iio-distance-srf08 | 4 +- .../testing/sysfs-bus-iio-proximity-as3935 | 4 +- .../ABI/testing/sysfs-bus-pci-devices-cciss | 22 +- .../testing/sysfs-bus-usb-devices-usbsevseg | 12 +- .../sysfs-class-backlight-driver-lm3533 | 6 +- Documentation/ABI/testing/sysfs-class-cxl | 6 +- Documentation/ABI/testing/sysfs-class-devfreq | 2 +- .../ABI/testing/sysfs-class-led-driver-lm3533 | 8 +- .../ABI/testing/sysfs-class-leds-gt683r | 4 +- .../ABI/testing/sysfs-class-powercap | 2 +- Documentation/ABI/testing/sysfs-class-uwb_rc | 6 - Documentation/ABI/testing/sysfs-driver-hid | 12 +- .../ABI/testing/sysfs-driver-hid-roccat-kone | 2 +- Documentation/ABI/testing/sysfs-kernel-fscaps | 2 +- .../ABI/testing/sysfs-kernel-vmcoreinfo | 2 +- Documentation/admin-guide/abi-obsolete.rst | 10 + Documentation/admin-guide/abi-removed.rst | 4 + Documentation/admin-guide/abi-stable.rst | 13 + Documentation/admin-guide/abi-testing.rst | 19 + Documentation/admin-guide/abi.rst | 11 + Documentation/admin-guide/index.rst | 1 + Documentation/conf.py | 2 +- Documentation/sphinx/kernel_abi.py | 172 +++++++ scripts/get_abi.pl | 450 ++++++++++++++++++ 28 files changed, 731 insertions(+), 57 deletions(-) create mode 100644 Documentation/admin-guide/abi-obsolete.rst create mode 100644 Documentation/admin-guide/abi-removed.rst create mode 100644 Documentation/admin-guide/abi-stable.rst create mode 100644 Documentation/admin-guide/abi-testing.rst create mode 100644 Documentation/admin-guide/abi.rst create mode 100644 Documentation/sphinx/kernel_abi.py create mode 100755 scripts/get_abi.pl
Signature · 1 line
2.21.0
PATCH 1/14 ABI: fix some syntax issues at the ABI database
From: Mauro Carvalho Chehab <[email protected]>
On those three files, the ABI representation described at README are violated.
- at sysfs-bus-iio-proximity-as3935:
a ':' character is missing after "What"
- at sysfs-class-devfreq:
there's a typo at Description
- at sysfs-class-cxl, it is using the ":" character at a file preamble, causing it to be misinterpreted as a tag.
- On the other files, instead of "What", they use "Where".
--- Documentation/ABI/testing/pstore | 2 +- .../sysfs-bus-event_source-devices-format | 2 +- .../ABI/testing/sysfs-bus-i2c-devices-hm6352 | 6 ++--- .../ABI/testing/sysfs-bus-iio-distance-srf08 | 4 ++-- .../testing/sysfs-bus-iio-proximity-as3935 | 4 ++-- .../ABI/testing/sysfs-bus-pci-devices-cciss | 22 +++++++++---------- .../testing/sysfs-bus-usb-devices-usbsevseg | 12 +++++----- Documentation/ABI/testing/sysfs-class-cxl | 6 ++--- Documentation/ABI/testing/sysfs-class-devfreq | 2 +- .../ABI/testing/sysfs-class-powercap | 2 +- Documentation/ABI/testing/sysfs-kernel-fscaps | 2 +- .../ABI/testing/sysfs-kernel-vmcoreinfo | 2 +- 12 files changed, 33 insertions(+), 33 deletions(-)
Documentation/ABI/testing/pstore +1 -1
@@ -1,4 +1,4 @@ -Where: /sys/fs/pstore/... (or /dev/pstore/...) +What: /sys/fs/pstore/... (or /dev/pstore/...) Date: March 2011 Kernel Version: 2.6.39 Contact: [email protected]
Documentation/ABI/testing/sysfs-bus-event_source-devices-format +1 -1
@@ -1,4 +1,4 @@ -Where: /sys/bus/event_source/devices/<dev>/format +What: /sys/bus/event_source/devices/<dev>/format Date: January 2012 Kernel Version: 3.3 Contact: Jiri Olsa <[email protected]>
Documentation/ABI/testing/sysfs-bus-i2c-devices-hm6352 +3 -3
@@ -1,18 +1,18 @@ -Where: /sys/bus/i2c/devices/.../heading0_input +What: /sys/bus/i2c/devices/.../heading0_input Date: April 2010 Kernel Version: 2.6.36? Contact: [email protected] Description: Reports the current heading from the compass as a floating point value in degrees. -Where: /sys/bus/i2c/devices/.../power_state +What: /sys/bus/i2c/devices/.../power_state Date: April 2010 Kernel Version: 2.6.36? Contact: [email protected] Description: Sets the power state of the device. 0 sets the device into sleep mode, 1 wakes it up. -Where: /sys/bus/i2c/devices/.../calibration +What: /sys/bus/i2c/devices/.../calibration Date: April 2010 Kernel Version: 2.6.36? Contact: [email protected]
Documentation/ABI/testing/sysfs-bus-iio-distance-srf08 +2 -2
@@ -1,4 +1,4 @@ -What /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity +What: /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity Date: January 2017 KernelVersion: 4.11 Contact: [email protected]
@@ -6,7 +6,7 @@ Description: Show or set the gain boost of the amp, from 0-31 range. default 31 -What /sys/bus/iio/devices/iio:deviceX/sensor_max_range +What: /sys/bus/iio/devices/iio:deviceX/sensor_max_range Date: January 2017 KernelVersion: 4.11 Contact: [email protected]
Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 +2 -2
@@ -1,4 +1,4 @@ -What /sys/bus/iio/devices/iio:deviceX/in_proximity_input +What: /sys/bus/iio/devices/iio:deviceX/in_proximity_input Date: March 2014 KernelVersion: 3.15 Contact: Matt Ranostay <[email protected]>
@@ -6,7 +6,7 @@ Description: Get the current distance in meters of storm (1km steps) 1000-40000 = distance in meters -What /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity +What: /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity Date: March 2014 KernelVersion: 3.15 Contact: Matt Ranostay <[email protected]>
Documentation/ABI/testing/sysfs-bus-pci-devices-cciss +11 -11
@@ -1,66 +1,66 @@ -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/model +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/model Date: March 2009 Kernel Version: 2.6.30 Contact: [email protected] Description: Displays the SCSI INQUIRY page 0 model for logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/rev +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/rev Date: March 2009 Kernel Version: 2.6.30 Contact: [email protected] Description: Displays the SCSI INQUIRY page 0 revision for logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/unique_id +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/unique_id Date: March 2009 Kernel Version: 2.6.30 Contact: [email protected] Description: Displays the SCSI INQUIRY page 83 serial number for logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/vendor +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/vendor Date: March 2009 Kernel Version: 2.6.30 Contact: [email protected] Description: Displays the SCSI INQUIRY page 0 vendor for logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/block:cciss!cXdY +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/block:cciss!cXdY Date: March 2009 Kernel Version: 2.6.30 Contact: [email protected] Description: A symbolic link to /sys/block/cciss!cXdY -Where: /sys/bus/pci/devices/<dev>/ccissX/rescan +What: /sys/bus/pci/devices/<dev>/ccissX/rescan Date: August 2009 Kernel Version: 2.6.31 Contact: [email protected] Description: Kicks of a rescan of the controller to discover logical drive topology changes. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/lunid +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/lunid Date: August 2009 Kernel Version: 2.6.31 Contact: [email protected] Description: Displays the 8-byte LUN ID used to address logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/raid_level +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/raid_level Date: August 2009 Kernel Version: 2.6.31 Contact: [email protected] Description: Displays the RAID level of logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/usage_count +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/usage_count Date: August 2009 Kernel Version: 2.6.31 Contact: [email protected] Description: Displays the usage count (number of opens) of logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/resettable +What: /sys/bus/pci/devices/<dev>/ccissX/resettable Date: February 2011 Kernel Version: 2.6.38 Contact: [email protected]
@@ -71,7 +71,7 @@ Description: Value of 1 indicates the controller can honor the reset_devices a dump device, as kdump requires resetting the device in order to work reliably. -Where: /sys/bus/pci/devices/<dev>/ccissX/transport_mode +What: /sys/bus/pci/devices/<dev>/ccissX/transport_mode Date: July 2011 Kernel Version: 3.0 Contact: [email protected]
Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg +6 -6
@@ -1,12 +1,12 @@ -Where: /sys/bus/usb/.../powered +What: /sys/bus/usb/.../powered Date: August 2008 Kernel Version: 2.6.26 Contact: Harrison Metzger <[email protected]> Description: Controls whether the device's display will powered. A value of 0 is off and a non-zero value is on. -Where: /sys/bus/usb/.../mode_msb -Where: /sys/bus/usb/.../mode_lsb +What: /sys/bus/usb/.../mode_msb +What: /sys/bus/usb/.../mode_lsb Date: August 2008 Kernel Version: 2.6.26 Contact: Harrison Metzger <[email protected]>
@@ -16,7 +16,7 @@ Description: Controls the devices display mode. for an 8 character display the values are MSB 0x08; LSB 0xFF. -Where: /sys/bus/usb/.../textmode +What: /sys/bus/usb/.../textmode Date: August 2008 Kernel Version: 2.6.26 Contact: Harrison Metzger <[email protected]>
@@ -25,13 +25,13 @@ Description: Controls the way the device interprets its text buffer. hex: each character is between 0-15 ascii: each character is between '0'-'9' and 'A'-'F'. -Where: /sys/bus/usb/.../text +What: /sys/bus/usb/.../text Date: August 2008 Kernel Version: 2.6.26 Contact: Harrison Metzger <[email protected]> Description: The text (or data) for the device to display -Where: /sys/bus/usb/.../decimals +What: /sys/bus/usb/.../decimals Date: August 2008 Kernel Version: 2.6.26 Contact: Harrison Metzger <[email protected]>
Documentation/ABI/testing/sysfs-class-cxl +3 -3
@@ -1,6 +1,6 @@ -Note: Attributes that are shared between devices are stored in the directory -pointed to by the symlink device/. -Example: The real path of the attribute /sys/class/cxl/afu0.0s/irqs_max is +Please notice that attributes that are shared between devices are stored in +the directory pointed to by the symlink device/. +For example, the real path of the attribute /sys/class/cxl/afu0.0s/irqs_max is /sys/class/cxl/afu0.0s/device/irqs_max, i.e. /sys/class/cxl/afu0.0/irqs_max.
Documentation/ABI/testing/sysfs-class-devfreq +1 -1
@@ -47,7 +47,7 @@ Description: What: /sys/class/devfreq/.../trans_stat Date: October 2012 Contact: MyungJoo Ham <[email protected]> -Descrtiption: +Description: This ABI shows the statistics of devfreq behavior on a specific device. It shows the time spent in each state and the number of transitions between states.
Documentation/ABI/testing/sysfs-class-powercap +1 -1
@@ -147,6 +147,6 @@ What: /sys/class/powercap/.../<power zone>/enabled Date: September 2013 KernelVersion: 3.13 Contact: [email protected] -Description +Description: This allows to enable/disable power capping at power zone level. This applies to current power zone and its children.
Documentation/ABI/testing/sysfs-kernel-fscaps +1 -1
@@ -2,7 +2,7 @@ What: /sys/kernel/fscaps Date: February 2011 KernelVersion: 2.6.38 Contact: Ludwig Nussel <[email protected]> -Description +Description: Shows whether file system capabilities are honored when executing a binary
Documentation/ABI/testing/sysfs-kernel-vmcoreinfo +1 -1
@@ -4,7 +4,7 @@ KernelVersion: 2.6.24 Contact: Ken'ichi Ohmichi <[email protected]> Kexec Mailing List <[email protected]> Vivek Goyal <[email protected]> -Description +Description: Shows physical address and size of vmcoreinfo ELF note. First value contains physical address of note in hex and second value contains the size of note in hex. This ELF
Signature · 1 line
2.21.0
PATCH 4/14 ABI: better identificate tables
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
When parsing via script, it is important to know if the script should consider a description as a literal block that should be displayed as-is, or if the description can be considered as a normal text.
Change descriptions to ensure that the preceding line of a table ends with a colon. That makes easy to identify the need of a literal block.
--- Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra | 2 +- .../ABI/testing/sysfs-class-backlight-driver-lm3533 | 6 +++--- Documentation/ABI/testing/sysfs-class-led-driver-lm3533 | 8 ++++---- Documentation/ABI/testing/sysfs-class-leds-gt683r | 4 ++-- Documentation/ABI/testing/sysfs-driver-hid-roccat-kone | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-)
Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra +1 -1
@@ -5,7 +5,7 @@ Description: It is possible to switch the cpi setting of the mouse with the press of a button. When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further - processed to receive the real dpi value. + processed to receive the real dpi value: VALUE DPI 1 400
Documentation/ABI/testing/sysfs-class-backlight-driver-lm3533 +3 -3
@@ -4,7 +4,7 @@ KernelVersion: 3.5 Contact: Johan Hovold <[email protected]> Description: Get the ALS output channel used as input in - ALS-current-control mode (0, 1), where + ALS-current-control mode (0, 1), where: 0 - out_current0 (backlight 0) 1 - out_current1 (backlight 1)
@@ -28,7 +28,7 @@ Date: April 2012 KernelVersion: 3.5 Contact: Johan Hovold <[email protected]> Description: - Set the brightness-mapping mode (0, 1), where + Set the brightness-mapping mode (0, 1), where: 0 - exponential mode 1 - linear mode
@@ -38,7 +38,7 @@ Date: April 2012 KernelVersion: 3.5 Contact: Johan Hovold <[email protected]> Description: - Set the PWM-input control mask (5 bits), where + Set the PWM-input control mask (5 bits), where: bit 5 - PWM-input enabled in Zone 4 bit 4 - PWM-input enabled in Zone 3
Documentation/ABI/testing/sysfs-class-led-driver-lm3533 +4 -4
@@ -4,7 +4,7 @@ KernelVersion: 3.5 Contact: Johan Hovold <[email protected]> Description: Set the ALS output channel to use as input in - ALS-current-control mode (1, 2), where + ALS-current-control mode (1, 2), where: 1 - out_current1 2 - out_current2
@@ -22,7 +22,7 @@ Date: April 2012 KernelVersion: 3.5 Contact: Johan Hovold <[email protected]> Description: - Set the pattern generator fall and rise times (0..7), where + Set the pattern generator fall and rise times (0..7), where: 0 - 2048 us 1 - 262 ms
@@ -45,7 +45,7 @@ Date: April 2012 KernelVersion: 3.5 Contact: Johan Hovold <[email protected]> Description: - Set the brightness-mapping mode (0, 1), where + Set the brightness-mapping mode (0, 1), where: 0 - exponential mode 1 - linear mode
@@ -55,7 +55,7 @@ Date: April 2012 KernelVersion: 3.5 Contact: Johan Hovold <[email protected]> Description: - Set the PWM-input control mask (5 bits), where + Set the PWM-input control mask (5 bits), where: bit 5 - PWM-input enabled in Zone 4 bit 4 - PWM-input enabled in Zone 3
Documentation/ABI/testing/sysfs-class-leds-gt683r +2 -2
@@ -5,7 +5,7 @@ Contact: Janne Kanniainen <[email protected]> Description: Set the mode of LEDs. You should notice that changing the mode of one LED will update the mode of its two sibling devices as - well. + well. Possible values are: 0 - normal 1 - audio
@@ -13,4 +13,4 @@ Description: Normal: LEDs are fully on when enabled Audio: LEDs brightness depends on sound level - Breathing: LEDs brightness varies at human breathing rate + Breathing: LEDs brightness varies at human breathing rate
Documentation/ABI/testing/sysfs-driver-hid-roccat-kone +1 -1
@@ -5,7 +5,7 @@ Description: It is possible to switch the dpi setting of the mouse with the press of a button. When read, this file returns the raw number of the actual dpi setting reported by the mouse. This number has to be further - processed to receive the real dpi value. + processed to receive the real dpi value: VALUE DPI 1 800
Signature · 1 line
2.21.0
PATCH 13/14 sphinx/kernel_abi.py: make it compatible with Sphinx 1.7+
In reply to Mauro Carvalho ChehabThe same way kerneldoc.py needed changes to work with newer Sphinx, this script needs the same changes.
--- Documentation/sphinx/kernel_abi.py | 31 ++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
Documentation/sphinx/kernel_abi.py +23 -8
@@ -33,7 +33,16 @@ import os from os import path import subprocess -from sphinx.ext.autodoc import AutodocReporter +# +# AutodocReporter is only good up to Sphinx 1.7 +# +import sphinx + +Use_SSI = sphinx.__version__[:3] >= '1.7' +if Use_SSI: + from sphinx.util.docutils import switch_source_input +else: + from sphinx.ext.autodoc import AutodocReporter from docutils import nodes from docutils.parsers.rst import Directive, directives
@@ -145,11 +154,17 @@ class KernelCmd(Directive): content.append(l, fname, c) buf = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter - self.state.memo.title_styles = [] - self.state.memo.section_level = 0 - self.state.memo.reporter = AutodocReporter(content, self.state.memo.reporter) - try: - self.state.nested_parse(content, 0, node, match_titles=1) - finally: - self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = buf + + if Use_SSI: + with switch_source_input(self.state, content): + self.state.nested_parse(content, 0, node, match_titles=1) + else: + self.state.memo.title_styles = [] + self.state.memo.section_level = 0 + self.state.memo.reporter = AutodocReporter(content, self.state.memo.reporter) + try: + self.state.nested_parse(content, 0, node, match_titles=1) + finally: + self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = buf + return node.children
Signature · 1 line
2.21.0
PATCH 8/14 scripts/get_abi.pl: split label naming from xref logic
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
Instead of using a ReST compilant label while parsing, move the label to ReST output. That makes the parsing logic more generic, allowing it to provide other types of output.
As a side effect, now all files used to generate the output will be output. We can later add command line arguments to filter.
--- scripts/get_abi.pl | 94 ++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 41 deletions(-)
scripts/get_abi.pl +53 -41
@@ -49,17 +49,23 @@ sub parse_abi { my $name = $file; $name =~ s,.*/,,; + my $nametag = "File $name"; + $data{$nametag}->{what} = "File $name"; + $data{$nametag}->{type} = "File"; + $data{$nametag}->{file} = $name; + $data{$nametag}->{is_file} = 1; + my $type = $file; $type =~ s,.*/(.*)/.*,$1,; my $what; my $new_what; my $tag; - my $label; my $ln; - my $has_file; my $xrefs; my $space; + my @labels; + my $label; print STDERR "Opening $file\n" if ($debug > 1); open IN, $file;
@@ -88,28 +94,13 @@ sub parse_abi { parse_error($file, $ln, "What '$what' doesn't have a description", "") if ($what && !$data{$what}->{description}); $what = $content; + $label = $content; $new_what = 1; } + push @labels, [($content, $label)]; $tag = $new_tag; - if ($has_file) { - $label = "abi_" . $content . " "; - $label =~ tr/A-Z/a-z/; - - # Convert special chars to "_" - $label =~s/[\x00-\x2f]+/_/g; - $label =~s/[\x3a-\x40]+/_/g; - $label =~s/[\x7b-\xff]+/_/g; - $label =~ s,_+,_,g; - $label =~ s,_$,,; - - $data{$what}->{label} .= $label; - - # Escape special chars from content - $content =~s/([\x00-\x1f\x21-\x2f\x3a-\x40\x7b-\xff])/\\$1/g; - - $xrefs .= "- :ref:`$content <$label>`\n\n"; - } + push @{$data{$nametag}->{xrefs}}, [($content, $label)] if ($data{$nametag}->{what}); next; }
@@ -117,6 +108,9 @@ sub parse_abi { $tag = $new_tag; if ($new_what) { + @{$data{$what}->{label}} = @labels if ($data{$nametag}->{what}); + @labels = (); + $label = ""; $new_what = 0; $data{$what}->{type} = $type;
@@ -145,15 +139,8 @@ sub parse_abi { } # Store any contents before tags at the database - if (!$tag) { - next if (/^\n/); - - my $my_what = "File $name"; - $data{$my_what}->{what} = "File $name"; - $data{$my_what}->{type} = "File"; - $data{$my_what}->{file} = $name; - $data{$my_what}->{description} .= $_; - $has_file = 1; + if (!$tag && $data{$nametag}->{what}) { + $data{$nametag}->{description} .= $_; next; }
@@ -192,12 +179,8 @@ sub parse_abi { # Everything else is error parse_error($file, $ln, "Unexpected line:", $_); } + $data{$nametag}->{description} =~ s/^\n+//; close IN; - - if ($has_file) { - my $my_what = "File $name"; - $data{$my_what}->{xrefs} = $xrefs; - } } # Outputs the output on ReST format
@@ -212,11 +195,22 @@ sub output_rest { my $bar = $w; $bar =~ s/./-/g; - if ($data{$what}->{label}) { - my @labels = split(/\s/, $data{$what}->{label}); - foreach my $label (@labels) { - printf ".. _%s:\n\n", $label; - } + foreach my $p (@{$data{$what}->{label}}) { + my ($content, $label) = @{$p}; + $label = "abi_" . $label . " "; + $label =~ tr/A-Z/a-z/; + + # Convert special chars to "_" + $label =~s/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xff])/_/g; + $label =~ s,_+,_,g; + $label =~ s,_$,,; + + $data{$what}->{label} .= $label; + + printf ".. _%s:\n\n", $label; + + # only one label is enough + last; } print "$w\n$bar\n\n";
@@ -243,10 +237,28 @@ sub output_rest { print "$desc\n\n"; } } else { - print "DESCRIPTION MISSING for $what\n\n"; + print "DESCRIPTION MISSING for $what\n\n" if (!$data{$what}->{is_file}); } - printf "Has the following ABI:\n\n%s", $data{$what}->{xrefs} if ($data{$what}->{xrefs}); + if ($data{$what}->{xrefs}) { + printf "Has the following ABI:\n\n"; + + foreach my $p(@{$data{$what}->{xrefs}}) { + my ($content, $label) = @{$p}; + $label = "abi_" . $label . " "; + $label =~ tr/A-Z/a-z/; + + # Convert special chars to "_" + $label =~s/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xff])/_/g; + $label =~ s,_+,_,g; + $label =~ s,_$,,; + + # Escape special chars from content + $content =~s/([\x00-\x1f\x21-\x2f\x3a-\x40\x7b-\xff])/\\$1/g; + + print "- :ref:`$content <$label>`\n\n"; + } + } } }
Signature · 1 line
2.21.0
PATCH 2/14 ABI: sysfs-driver-hid: the "What" field doesn't parse fine
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
The What: field on this ABI description use a different syntax than expected, causing it to not be properly parsed by script.
Fix it.
--- Documentation/ABI/testing/sysfs-driver-hid | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Documentation/ABI/testing/sysfs-driver-hid +6 -6
@@ -1,6 +1,6 @@ -What: For USB devices : /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/report_descriptor - For BT devices : /sys/class/bluetooth/hci<addr>/<hid-bus>:<vendor-id>:<product-id>.<num>/report_descriptor - Symlink : /sys/class/hidraw/hidraw<num>/device/report_descriptor +What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/report_descriptor +What: /sys/class/bluetooth/hci<addr>/<hid-bus>:<vendor-id>:<product-id>.<num>/report_descriptor +What: /sys/class/hidraw/hidraw<num>/device/report_descriptor Date: Jan 2011 KernelVersion: 2.0.39 Contact: Alan Ott <[email protected]>
@@ -9,9 +9,9 @@ Description: When read, this file returns the device's raw binary HID This file cannot be written. Users: HIDAPI library (http://www.signal11.us/oss/hidapi) -What: For USB devices : /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/country - For BT devices : /sys/class/bluetooth/hci<addr>/<hid-bus>:<vendor-id>:<product-id>.<num>/country - Symlink : /sys/class/hidraw/hidraw<num>/device/country +What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/country +What: /sys/class/bluetooth/hci<addr>/<hid-bus>:<vendor-id>:<product-id>.<num>/country +What: /sys/class/hidraw/hidraw<num>/device/country Date: February 2015 KernelVersion: 3.19 Contact: Olivier Gay <[email protected]>
Signature · 1 line
2.21.0
PATCH 9/14 scripts/get_abi.pl: add support for searching for ABI symbols
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
Change its syntax to allow switching between ReST output mode and a new search mode, with allows to seek for ABI symbols using regex.
--- scripts/get_abi.pl | 112 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 103 insertions(+), 9 deletions(-)
scripts/get_abi.pl +103 -9
@@ -9,9 +9,11 @@ use Fcntl ':mode'; my $help; my $man; my $debug; +my $prefix="Documentation/ABI"; GetOptions( "debug|d+" => \$debug, + "dir=s" => \$prefix, 'help|?' => \$help, man => \$man ) or pod2usage(2);
@@ -19,9 +21,12 @@ GetOptions( pod2usage(1) if $help; pod2usage(-exitstatus => 0, -verbose => 2) if $man; -pod2usage(2) if (scalar @ARGV != 1); +pod2usage(2) if (scalar @ARGV < 1 || @ARGV > 2); -my ($prefix) = @ARGV; +my ($cmd, $arg) = @ARGV; + +pod2usage(2) if ($cmd ne "search" && $cmd ne "rest"); +pod2usage(2) if ($cmd eq "search" && !$arg); require Data::Dumper if ($debug);
@@ -53,6 +58,7 @@ sub parse_abi { $data{$nametag}->{what} = "File $name"; $data{$nametag}->{type} = "File"; $data{$nametag}->{file} = $name; + $data{$nametag}->{filepath} = $file; $data{$nametag}->{is_file} = 1; my $type = $file;
@@ -115,6 +121,7 @@ sub parse_abi { $data{$what}->{type} = $type; $data{$what}->{file} = $name; + $data{$what}->{filepath} = $file; print STDERR "\twhat: $what\n" if ($debug > 1); }
@@ -183,7 +190,9 @@ sub parse_abi { close IN; } -# Outputs the output on ReST format +# +# Outputs the book on ReST format +# sub output_rest { foreach my $what (sort keys %data) { my $type = $data{$what}->{type};
@@ -262,6 +271,45 @@ sub output_rest { } } +# +# Searches for ABI symbols +# +sub search_symbols { + foreach my $what (sort keys %data) { + next if (!($what =~ m/($arg)/)); + + my $type = $data{$what}->{type}; + next if ($type eq "File"); + + my $file = $data{$what}->{filepath}; + + my $bar = $what; + $bar =~ s/./-/g; + + print "\n$what\n$bar\n\n"; + + my $kernelversion = $data{$what}->{kernelversion}; + my $contact = $data{$what}->{contact}; + my $users = $data{$what}->{users}; + my $date = $data{$what}->{date}; + my $desc = $data{$what}->{description}; + $kernelversion =~ s/^\s+//; + $contact =~ s/^\s+//; + $users =~ s/^\s+//; + $users =~ s/\n//g; + $date =~ s/^\s+//; + $desc =~ s/^\s+//; + + printf "Kernel version:\t\t%s\n", $kernelversion if ($kernelversion); + printf "Date:\t\t\t%s\n", $date if ($date); + printf "Contact:\t\t%s\n", $contact if ($contact); + printf "Users:\t\t\t%s\n", $users if ($users); + print "Defined on file:\t$file\n\n"; + print "Description:\n\n$desc"; + } +} + + # # Parses all ABI files located at $prefix dir #
@@ -270,9 +318,13 @@ find({wanted =>\&parse_abi, no_chdir => 1}, $prefix); print STDERR Data::Dumper->Dump([\%data], [qw(*data)]) if ($debug); # -# Outputs an ReST file with the ABI contents +# Handles the command # -output_rest +if ($cmd eq "rest") { + output_rest; +} else { + search_symbols; +} __END__
@@ -283,12 +335,27 @@ abi_book.pl - parse the Linux ABI files and produce a ReST book. =head1 SYNOPSIS -B<abi_book.pl> [--debug] <ABI_DIR>] +B<abi_book.pl> [--debug] <COMAND> [<ARGUMENT>] + +Where <COMMAND> can be: + +=over 8 + +B<search> [SEARCH_REGEX] - search for [SEARCH_REGEX] inside ABI + +B<rest> - output the ABI in ReST markup language + +=back =head1 OPTIONS =over 8 +=item B<--dir> + +Changes the location of the ABI search. By default, it uses +the Documentation/ABI directory. + =item B<--debug> Put the script in verbose mode, useful for debugging. Can be called multiple
@@ -306,8 +373,35 @@ Prints the manual page and exits. =head1 DESCRIPTION -Parse the Linux ABI files from ABI DIR (usually located at Documentation/ABI) -and produce a ReST book containing the Linux ABI. +Parse the Linux ABI files from ABI DIR (usually located at Documentation/ABI), +allowing to search for ABI symbols or to produce a ReST book containing +the Linux ABI documentation. + +=head1 EXAMPLES + +Search for all stable symbols with the word "usb": + +=over 8 + +$ scripts/get_abi.pl search usb --dir Documentation/ABI/stable + +=back + +Search for all symbols that match the regex expression "usb.*cap": + +=over 8 + +$ scripts/get_abi.pl search usb.*cap + +=back + +Output all obsoleted symbols in ReST format + +=over 8 + +$ scripts/get_abi.pl rest --dir Documentation/ABI/obsolete + +=back =head1 BUGS
@@ -315,7 +409,7 @@ Report bugs to Mauro Carvalho Chehab <[email protected]> =head1 COPYRIGHT -Copyright (c) 2016 by Mauro Carvalho Chehab <[email protected]>. +Copyright (c) 2016-2017 by Mauro Carvalho Chehab <[email protected]>. License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>.
Signature · 1 line
2.21.0
PATCH 11/14 scripts/get_abi.pl: fix parse issues with some files
In reply to Mauro Carvalho ChehabA few files are failing to parse:
Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats Documentation/ABI/testing/sysfs-class-pktcdvd Documentation/ABI/testing/sysfs-bus-nfit
On all three files, the problem is that there is a ":" character at the initial file description.
Improve the parse in order to handle those special cases.
--- scripts/get_abi.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/get_abi.pl +2 -2
@@ -87,7 +87,7 @@ sub parse_abi { # New "tag" is actually part of # description. Don't consider it a tag $new_tag = ""; - } else { + } elsif ($tag ne "") { parse_error($file, $ln, "tag '$tag' is invalid", $_); } }
@@ -110,7 +110,7 @@ sub parse_abi { next; } - if ($new_tag) { + if ($tag ne "" && $new_tag) { $tag = $new_tag; if ($new_what) {
Signature · 1 line
2.21.0
PATCH 12/14 doc-rst: add ABI documentation to the admin-guide book
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
As we don't want a generic Sphinx extension to execute commands, change the one proposed to Markus to call the abi_book.pl script.
Use a script to parse the Documentation/ABI directory and output it at the admin-guide.
--- Documentation/admin-guide/abi-obsolete.rst | 10 ++ Documentation/admin-guide/abi-removed.rst | 4 + Documentation/admin-guide/abi-stable.rst | 13 ++ Documentation/admin-guide/abi-testing.rst | 19 +++ Documentation/admin-guide/abi.rst | 11 ++ Documentation/admin-guide/index.rst | 1 + Documentation/conf.py | 2 +- Documentation/sphinx/kernel_abi.py | 155 +++++++++++++++++++++ 8 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 Documentation/admin-guide/abi-obsolete.rst create mode 100644 Documentation/admin-guide/abi-removed.rst create mode 100644 Documentation/admin-guide/abi-stable.rst create mode 100644 Documentation/admin-guide/abi-testing.rst create mode 100644 Documentation/admin-guide/abi.rst create mode 100644 Documentation/sphinx/kernel_abi.py
Documentation/admin-guide/abi-obsolete.rst new file +10 -0
@@ -0,0 +1,10 @@ +ABI obsolete symbols +==================== + +Documents interfaces that are still remaining in the kernel, but are +marked to be removed at some later point in time. + +The description of the interface will document the reason why it is +obsolete and when it can be expected to be removed. + +.. kernel-abi:: $srctree/Documentation/ABI/obsolete
Documentation/admin-guide/abi-removed.rst new file +4 -0
@@ -0,0 +1,4 @@ +ABI removed symbols +=================== + +.. kernel-abi:: $srctree/Documentation/ABI/removed
Documentation/admin-guide/abi-stable.rst new file +13 -0
@@ -0,0 +1,13 @@ +ABI stable symbols +================== + +Documents the interfaces that the developer has defined to be stable. + +Userspace programs are free to use these interfaces with no +restrictions, and backward compatibility for them will be guaranteed +for at least 2 years. + +Most interfaces (like syscalls) are expected to never change and always +be available. + +.. kernel-abi:: $srctree/Documentation/ABI/stable
Documentation/admin-guide/abi-testing.rst new file +19 -0
@@ -0,0 +1,19 @@ +ABI testing symbols +=================== + +Documents interfaces that are felt to be stable, +as the main development of this interface has been completed. + +The interface can be changed to add new features, but the +current interface will not break by doing this, unless grave +errors or security problems are found in them. + +Userspace programs can start to rely on these interfaces, but they must +be aware of changes that can occur before these interfaces move to +be marked stable. + +Programs that use these interfaces are strongly encouraged to add their +name to the description of these interfaces, so that the kernel +developers can easily notify them if any changes occur. + +.. kernel-abi:: $srctree/Documentation/ABI/testing
Documentation/admin-guide/abi.rst new file +11 -0
@@ -0,0 +1,11 @@ +===================== +Linux ABI description +===================== + +.. toctree:: + :maxdepth: 1 + + abi-stable + abi-testing + abi-obsolete + abi-removed
Documentation/admin-guide/index.rst +1 -0
@@ -16,6 +16,7 @@ etc. README kernel-parameters devices + abi This section describes CPU vulnerabilities and their mitigations.
Documentation/conf.py +1 -1
@@ -34,7 +34,7 @@ needs_sphinx = '1.3' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain', 'kfigure', 'sphinx.ext.ifconfig'] +extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain', 'kfigure', 'sphinx.ext.ifconfig', 'kernel_abi'] # The name of the math extension changed on Sphinx 1.4 if (major == 1 and minor > 3) or (major > 1):
Documentation/sphinx/kernel_abi.py new file +155 -0
155 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 5/14 scripts: add an script to parse the ABI files
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
Add a script to parse the Documentation/ABI files and produce an output with all entries inside an ABI (sub)directory.
Right now, it outputs its contents on ReST format. It shouldn't be hard to make it produce other kind of outputs, since the ABI file parser is implemented in separate than the output generator.
--- scripts/get_abi.pl | 212 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100755 scripts/get_abi.pl
scripts/get_abi.pl new file +212 -0
@@ -0,0 +1,212 @@ +#!/usr/bin/perl + +use strict; +use Pod::Usage; +use Getopt::Long; +use File::Find; +use Fcntl ':mode'; + +my $help; +my $man; +my $debug; + +GetOptions( + "debug|d+" => \$debug, + 'help|?' => \$help, + man => \$man +) or pod2usage(2); + +pod2usage(1) if $help; +pod2usage(-exitstatus => 0, -verbose => 2) if $man; + +pod2usage(2) if (scalar @ARGV != 1); + +my ($prefix) = @ARGV; + +require Data::Dumper if ($debug); + +my %data; + +# +# Displays an error message, printing file name and line +# +sub parse_error($$$$) { + my ($file, $ln, $msg, $data) = @_; + + print STDERR "file $file#$ln: $msg at\n\t$data"; +} + +# +# Parse an ABI file, storing its contents at %data +# +sub parse_abi { + my $file = $File::Find::name; + + my $mode = (stat($file))[2]; + return if ($mode & S_IFDIR); + return if ($file =~ m,/README,); + + my $name = $file; + $name =~ s,.*/,,; + + my $type = $file; + $type =~ s,.*/(.*)/.*,$1,; + + my $what; + my $new_what; + my $tag; + my $ln; + + print STDERR "Opening $file\n" if ($debug > 1); + open IN, $file; + while(<IN>) { + $ln++; + if (m/^(\S+):\s*(.*)/i) { + my $new_tag = lc($1); + my $content = $2; + + if (!($new_tag =~ m/(what|date|kernelversion|contact|description|users)/)) { + if ($tag eq "description") { + $data{$what}->{$tag} .= "\n$content";; + $data{$what}->{$tag} =~ s/\n+$//; + next; + } else { + parse_error($file, $ln, "tag '$tag' is invalid", $_); + } + } + + if ($new_tag =~ m/what/) { + if ($tag =~ m/what/) { + $what .= ", " . $content; + } else { + $what = $content; + $new_what = 1; + } + $tag = $new_tag; + next; + } + + $tag = $new_tag; + + if ($new_what) { + $new_what = 0; + + $data{$what}->{type} = $type; + $data{$what}->{file} = $name; + print STDERR "\twhat: $what\n" if ($debug > 1); + } + + if (!$what) { + parse_error($file, $ln, "'What:' should come first:", $_); + next; + } + $data{$what}->{$tag} = $content; + next; + } + + # Silently ignore any headers before the database + next if (!$tag); + + if (m/^\s*(.*)/) { + $data{$what}->{$tag} .= "\n$1"; + $data{$what}->{$tag} =~ s/\n+$//; + next; + } + + # Everything else is error + parse_error($file, $ln, "Unexpected line:", $_); + } + close IN; +} + +# Outputs the output on ReST format +sub output_rest { + foreach my $what (sort keys %data) { + my $type = $data{$what}->{type}; + my $file = $data{$what}->{file}; + + my $w = $what; + $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g; + + print "$w\n\n"; + print "- defined on file $file (type: $type)\n\n::\n\n"; + + my $desc = $data{$what}->{description}; + $desc =~ s/^\s+//; + + # Remove title markups from the description, as they won't work + $desc =~ s/\n[\-\*\=\^\~]+\n/\n/g; + + # put everything inside a code block + $desc =~ s/\n/\n /g; + + + if (!($desc =~ /^\s*$/)) { + print " $desc\n\n"; + } else { + print " DESCRIPTION MISSING\n\n"; + } + } +} + +# +# Parses all ABI files located at $prefix dir +# +find({wanted =>\&parse_abi, no_chdir => 1}, $prefix); + +print STDERR Data::Dumper->Dump([\%data], [qw(*data)]) if ($debug); + +# +# Outputs an ReST file with the ABI contents +# +output_rest + + +__END__ + +=head1 NAME + +abi_book.pl - parse the Linux ABI files and produce a ReST book. + +=head1 SYNOPSIS + +B<abi_book.pl> [--debug] <ABI_DIR>] + +=head1 OPTIONS + +=over 8 + +=item B<--debug> + +Put the script in verbose mode, useful for debugging. Can be called multiple +times, to increase verbosity. + +=item B<--help> + +Prints a brief help message and exits. + +=item B<--man> + +Prints the manual page and exits. + +=back + +=head1 DESCRIPTION + +Parse the Linux ABI files from ABI DIR (usually located at Documentation/ABI) +and produce a ReST book containing the Linux ABI. + +=head1 BUGS + +Report bugs to Mauro Carvalho Chehab <[email protected]> + +=head1 COPYRIGHT + +Copyright (c) 2016 by Mauro Carvalho Chehab <[email protected]>. + +License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>. + +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. + +=cut
Signature · 1 line
2.21.0
PATCH 10/14 scripts/get_abi.pl: represent what in tables
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
Several entries at the ABI have multiple What: with the same description.
Instead of showing those symbols as sections, let's show them as tables. That makes easier to read on the final output, and avoid too much recursion at Sphinx parsing.
We need to put file references at the end, as we don't want non-file tables to be mangled with other entries.
--- scripts/get_abi.pl | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-)
scripts/get_abi.pl +36 -5
@@ -193,16 +193,19 @@ sub parse_abi { # # Outputs the book on ReST format # + sub output_rest { - foreach my $what (sort keys %data) { + foreach my $what (sort { + ($data{$a}->{type} eq "File") cmp ($data{$b}->{type} eq "File") || + $a cmp $b + } keys %data) { my $type = $data{$what}->{type}; my $file = $data{$what}->{file}; + my $filepath = $data{$what}->{filepath}; my $w = $what; $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g; - my $bar = $w; - $bar =~ s/./-/g; foreach my $p (@{$data{$what}->{label}}) { my ($content, $label) = @{$p};
@@ -222,9 +225,37 @@ sub output_rest { last; } - print "$w\n$bar\n\n"; - print "- defined on file $file (type: $type)\n\n" if ($type ne "File"); + $filepath =~ s,.*/(.*/.*),\1,;; + $filepath =~ s,[/\-],_,g;; + my $fileref = "abi_file_".$filepath; + + if ($type eq "File") { + my $bar = $w; + $bar =~ s/./-/g; + + print ".. _$fileref:\n\n"; + print "$w\n$bar\n\n"; + } else { + my @names = split /\s*,\s*/,$w; + + my $len = 0; + + foreach my $name (@names) { + $len = length($name) if (length($name) > $len); + } + + print "What:\n\n"; + + print "+-" . "-" x $len . "-+\n"; + foreach my $name (@names) { + printf "| %s", $name . " " x ($len - length($name)) . " |\n"; + print "+-" . "-" x $len . "-+\n"; + } + print "\n"; + } + + print "Defined on file :ref:`$file <$fileref>`\n\n" if ($type ne "File"); my $desc = $data{$what}->{description}; $desc =~ s/^\s+//;
Signature · 1 line
2.21.0
Re: [PATCH 01/14] ABI: fix some syntax issues at the ABI database
In reply to Mauro Carvalho ChehabDocumentation/ABI/testing/sysfs-class-cxl line 1
Quoted 9 lines · Mauro Carvalho Chehab
Documentation/ABI/testing/sysfs-class-cxl +1
-3@@ -1,6 +1,6 @@ -Note: Attributes that are shared between devices are stored in the directory -pointed to by the symlink device/. -Example: The real path of the attribute /sys/class/cxl/afu0.0s/irqs_max is +Please notice that attributes that are shared between devices are stored in
Would prefer "Please note" over "Please notice".
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Re: [PATCH 01/14] ABI: fix some syntax issues at the ABI database
In reply to Mauro Carvalho ChehabQuoted 12 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
On those three files, the ABI representation described at README are violated.
- at sysfs-bus-iio-proximity-as3935:
a ':' character is missing after "What"- at sysfs-class-devfreq:
there's a typo at Description
Quoted 8 lines
- at sysfs-class-cxl, it is using the ":" character at a file preamble, causing it to be misinterpreted as a tag.
- On the other files, instead of "What", they use "Where".
Signed-off-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>
Quoted 302 lines
--- Documentation/ABI/testing/pstore | 2 +- .../sysfs-bus-event_source-devices-format | 2 +- .../ABI/testing/sysfs-bus-i2c-devices-hm6352 | 6 ++--- .../ABI/testing/sysfs-bus-iio-distance-srf08 | 4 ++-- .../testing/sysfs-bus-iio-proximity-as3935 | 4 ++-- .../ABI/testing/sysfs-bus-pci-devices-cciss | 22 +++++++++---------- .../testing/sysfs-bus-usb-devices-usbsevseg | 12 +++++----- Documentation/ABI/testing/sysfs-class-cxl | 6 ++--- Documentation/ABI/testing/sysfs-class-devfreq | 2 +- .../ABI/testing/sysfs-class-powercap | 2 +- Documentation/ABI/testing/sysfs-kernel-fscaps | 2 +- .../ABI/testing/sysfs-kernel-vmcoreinfo | 2 +- 12 files changed, 33 insertions(+), 33 deletions(-)Documentation/ABI/testing/pstore +1
-1@@ -1,4 +1,4 @@ -Where: /sys/fs/pstore/... (or /dev/pstore/...) +What: /sys/fs/pstore/... (or /dev/pstore/...) Date: March 2011 Kernel Version: 2.6.39 Contact: [email protected]Documentation/ABI/testing/sysfs-bus-event_source-devices-format +1
-1@@ -1,4 +1,4 @@ -Where: /sys/bus/event_source/devices/<dev>/format +What: /sys/bus/event_source/devices/<dev>/format Date: January 2012 Kernel Version: 3.3 Contact: Jiri Olsa <[email protected]>Documentation/ABI/testing/sysfs-bus-i2c-devices-hm6352 +3
-3@@ -1,18 +1,18 @@ -Where: /sys/bus/i2c/devices/.../heading0_input +What: /sys/bus/i2c/devices/.../heading0_input Date: April 2010 Kernel Version: 2.6.36? Contact: [email protected] Description: Reports the current heading from the compass as a floating point value in degrees. -Where: /sys/bus/i2c/devices/.../power_state +What: /sys/bus/i2c/devices/.../power_state Date: April 2010 Kernel Version: 2.6.36? Contact: [email protected] Description: Sets the power state of the device. 0 sets the device into sleep mode, 1 wakes it up. -Where: /sys/bus/i2c/devices/.../calibration +What: /sys/bus/i2c/devices/.../calibration Date: April 2010 Kernel Version: 2.6.36? Contact: [email protected]Documentation/ABI/testing/sysfs-bus-iio-distance-srf08 +2
-2@@ -1,4 +1,4 @@ -What /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity +What: /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity Date: January 2017 KernelVersion: 4.11 Contact: [email protected]@@ -6,7 +6,7 @@ Description: Show or set the gain boost of the amp, from 0-31 range. default 31 -What /sys/bus/iio/devices/iio:deviceX/sensor_max_range +What: /sys/bus/iio/devices/iio:deviceX/sensor_max_range Date: January 2017 KernelVersion: 4.11 Contact: [email protected]Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 +2
-2@@ -1,4 +1,4 @@ -What /sys/bus/iio/devices/iio:deviceX/in_proximity_input +What: /sys/bus/iio/devices/iio:deviceX/in_proximity_input Date: March 2014 KernelVersion: 3.15 Contact: Matt Ranostay <[email protected]>@@ -6,7 +6,7 @@ Description: Get the current distance in meters of storm (1km steps) 1000-40000 = distance in meters -What /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity +What: /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity Date: March 2014 KernelVersion: 3.15 Contact: Matt Ranostay <[email protected]>Documentation/ABI/testing/sysfs-bus-pci-devices-cciss +11
-11@@ -1,66 +1,66 @@ -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/model +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/model Date: March 2009 Kernel Version: 2.6.30 Contact: [email protected] Description: Displays the SCSI INQUIRY page 0 model for logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/rev +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/rev Date: March 2009 Kernel Version: 2.6.30 Contact: [email protected] Description: Displays the SCSI INQUIRY page 0 revision for logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/unique_id +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/unique_id Date: March 2009 Kernel Version: 2.6.30 Contact: [email protected] Description: Displays the SCSI INQUIRY page 83 serial number for logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/vendor +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/vendor Date: March 2009 Kernel Version: 2.6.30 Contact: [email protected] Description: Displays the SCSI INQUIRY page 0 vendor for logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/block:cciss!cXdY +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/block:cciss!cXdY Date: March 2009 Kernel Version: 2.6.30 Contact: [email protected] Description: A symbolic link to /sys/block/cciss!cXdY -Where: /sys/bus/pci/devices/<dev>/ccissX/rescan +What: /sys/bus/pci/devices/<dev>/ccissX/rescan Date: August 2009 Kernel Version: 2.6.31 Contact: [email protected] Description: Kicks of a rescan of the controller to discover logical drive topology changes. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/lunid +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/lunid Date: August 2009 Kernel Version: 2.6.31 Contact: [email protected] Description: Displays the 8-byte LUN ID used to address logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/raid_level +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/raid_level Date: August 2009 Kernel Version: 2.6.31 Contact: [email protected] Description: Displays the RAID level of logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/usage_count +What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/usage_count Date: August 2009 Kernel Version: 2.6.31 Contact: [email protected] Description: Displays the usage count (number of opens) of logical drive Y of controller X. -Where: /sys/bus/pci/devices/<dev>/ccissX/resettable +What: /sys/bus/pci/devices/<dev>/ccissX/resettable Date: February 2011 Kernel Version: 2.6.38 Contact: [email protected]@@ -71,7 +71,7 @@ Description: Value of 1 indicates the controller can honor the reset_devices a dump device, as kdump requires resetting the device in order to work reliably. -Where: /sys/bus/pci/devices/<dev>/ccissX/transport_mode +What: /sys/bus/pci/devices/<dev>/ccissX/transport_mode Date: July 2011 Kernel Version: 3.0 Contact: [email protected]Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg +6
-6@@ -1,12 +1,12 @@ -Where: /sys/bus/usb/.../powered +What: /sys/bus/usb/.../powered Date: August 2008 Kernel Version: 2.6.26 Contact: Harrison Metzger <[email protected]> Description: Controls whether the device's display will powered. A value of 0 is off and a non-zero value is on. -Where: /sys/bus/usb/.../mode_msb -Where: /sys/bus/usb/.../mode_lsb +What: /sys/bus/usb/.../mode_msb +What: /sys/bus/usb/.../mode_lsb Date: August 2008 Kernel Version: 2.6.26 Contact: Harrison Metzger <[email protected]>@@ -16,7 +16,7 @@ Description: Controls the devices display mode. for an 8 character display the values are MSB 0x08; LSB 0xFF. -Where: /sys/bus/usb/.../textmode +What: /sys/bus/usb/.../textmode Date: August 2008 Kernel Version: 2.6.26 Contact: Harrison Metzger <[email protected]>@@ -25,13 +25,13 @@ Description: Controls the way the device interprets its text buffer. hex: each character is between 0-15 ascii: each character is between '0'-'9' and 'A'-'F'. -Where: /sys/bus/usb/.../text +What: /sys/bus/usb/.../text Date: August 2008 Kernel Version: 2.6.26 Contact: Harrison Metzger <[email protected]> Description: The text (or data) for the device to display -Where: /sys/bus/usb/.../decimals +What: /sys/bus/usb/.../decimals Date: August 2008 Kernel Version: 2.6.26 Contact: Harrison Metzger <[email protected]>Documentation/ABI/testing/sysfs-class-cxl +3
-3@@ -1,6 +1,6 @@ -Note: Attributes that are shared between devices are stored in the directory -pointed to by the symlink device/. -Example: The real path of the attribute /sys/class/cxl/afu0.0s/irqs_max is +Please notice that attributes that are shared between devices are stored in +the directory pointed to by the symlink device/. +For example, the real path of the attribute /sys/class/cxl/afu0.0s/irqs_max is /sys/class/cxl/afu0.0s/device/irqs_max, i.e. /sys/class/cxl/afu0.0/irqs_max.Documentation/ABI/testing/sysfs-class-devfreq +1
-1@@ -47,7 +47,7 @@ Description: What: /sys/class/devfreq/.../trans_stat Date: October 2012 Contact: MyungJoo Ham <[email protected]> -Descrtiption: +Description: This ABI shows the statistics of devfreq behavior on a specific device. It shows the time spent in each state and the number of transitions between states.Documentation/ABI/testing/sysfs-class-powercap +1
-1@@ -147,6 +147,6 @@ What: /sys/class/powercap/.../<power zone>/enabled Date: September 2013 KernelVersion: 3.13 Contact: [email protected] -Description +Description: This allows to enable/disable power capping at power zone level. This applies to current power zone and its children.Documentation/ABI/testing/sysfs-kernel-fscaps +1
-1@@ -2,7 +2,7 @@ What: /sys/kernel/fscaps Date: February 2011 KernelVersion: 2.6.38 Contact: Ludwig Nussel <[email protected]> -Description +Description: Shows whether file system capabilities are honored when executing a binaryDocumentation/ABI/testing/sysfs-kernel-vmcoreinfo +1
-2@@ -4,7 +4,7 @@ KernelVersion: 2.6.24 Contact: Ken'ichi Ohmichi <[email protected]> Kexec Mailing List <[email protected]> Vivek Goyal <[email protected]> -Description +Description: Shows physical address and size of vmcoreinfo ELF note. First value contains physical address of note in hex and second value contains the size of note in hex. This ELF --2.21.0
Re: [PATCH 05/14] scripts: add an script to parse the ABI files
In reply to Mauro Carvalho ChehabQuoted 8 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
Add a script to parse the
Documentation/ABIfiles and produce an output with all entries inside an ABI (sub)directory.Right now, it outputs its contents on ReST format. It shouldn't be hard to make it produce other kind of outputs, since the ABI file parser is implemented in separate than the output generator.
Hum, or just convert the ABI files to rst directly.
BR,
Jani.
Quoted 226 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>--- scripts/get_abi.pl | 212 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100755 scripts/get_abi.plscripts/get_abi.pl new file +212
-0@@ -0,0 +1,212 @@ +#!/usr/bin/perl + +use strict; +use Pod::Usage; +use Getopt::Long; +use File::Find; +use Fcntl ':mode'; + +my $help; +my $man; +my $debug; + +GetOptions( + "debug|d+" => \$debug, + 'help|?' => \$help, + man => \$man +) or pod2usage(2); + +pod2usage(1) if $help; +pod2usage(-exitstatus => 0, -verbose => 2) if $man; + +pod2usage(2) if (scalar @ARGV != 1); + +my ($prefix) = @ARGV; + +require Data::Dumper if ($debug); + +my %data; + +# +# Displays an error message, printing file name and line +# +sub parse_error($$$$) { + my ($file, $ln, $msg, $data) = @_; + + print STDERR "file $file#$ln: $msg at\n\t$data"; +} + +# +# Parse an ABI file, storing its contents at %data +# +sub parse_abi { + my $file = $File::Find::name; + + my $mode = (stat($file))[2]; + return if ($mode & S_IFDIR); + return if ($file =~ m,/README,); + + my $name = $file; + $name =~ s,.*/,,; + + my $type = $file; + $type =~ s,.*/(.*)/.*,$1,; + + my $what; + my $new_what; + my $tag; + my $ln; + + print STDERR "Opening $file\n" if ($debug > 1); + open IN, $file; + while(<IN>) { + $ln++; + if (m/^(\S+):\s*(.*)/i) { + my $new_tag = lc($1); + my $content = $2; + + if (!($new_tag =~ m/(what|date|kernelversion|contact|description|users)/)) { + if ($tag eq "description") { + $data{$what}->{$tag} .= "\n$content";; + $data{$what}->{$tag} =~ s/\n+$//; + next; + } else { + parse_error($file, $ln, "tag '$tag' is invalid", $_); + } + } + + if ($new_tag =~ m/what/) { + if ($tag =~ m/what/) { + $what .= ", " . $content; + } else { + $what = $content; + $new_what = 1; + } + $tag = $new_tag; + next; + } + + $tag = $new_tag; + + if ($new_what) { + $new_what = 0; + + $data{$what}->{type} = $type; + $data{$what}->{file} = $name; + print STDERR "\twhat: $what\n" if ($debug > 1); + } + + if (!$what) { + parse_error($file, $ln, "'What:' should come first:", $_); + next; + } + $data{$what}->{$tag} = $content; + next; + } + + # Silently ignore any headers before the database + next if (!$tag); + + if (m/^\s*(.*)/) { + $data{$what}->{$tag} .= "\n$1"; + $data{$what}->{$tag} =~ s/\n+$//; + next; + } + + # Everything else is error + parse_error($file, $ln, "Unexpected line:", $_); + } + close IN; +} + +# Outputs the output on ReST format +sub output_rest { + foreach my $what (sort keys %data) { + my $type = $data{$what}->{type}; + my $file = $data{$what}->{file}; + + my $w = $what; + $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g; + + print "$w\n\n"; + print "- defined on file $file (type: $type)\n\n::\n\n"; + + my $desc = $data{$what}->{description}; + $desc =~ s/^\s+//; + + # Remove title markups from the description, as they won't work + $desc =~ s/\n[\-\*\=\^\~]+\n/\n/g; + + # put everything inside a code block + $desc =~ s/\n/\n /g; + + + if (!($desc =~ /^\s*$/)) { + print " $desc\n\n"; + } else { + print " DESCRIPTION MISSING\n\n"; + } + } +} + +# +# Parses all ABI files located at $prefix dir +# +find({wanted =>\&parse_abi, no_chdir => 1}, $prefix); + +print STDERR Data::Dumper->Dump([\%data], [qw(*data)]) if ($debug); + +# +# Outputs an ReST file with the ABI contents +# +output_rest + + +__END__ + +=head1 NAME + +abi_book.pl - parse the Linux ABI files and produce a ReST book. + +=head1 SYNOPSIS + +B<abi_book.pl> [--debug] <ABI_DIR>] + +=head1 OPTIONS + +=over 8 + +=item B<--debug> + +Put the script in verbose mode, useful for debugging. Can be called multiple +times, to increase verbosity. + +=item B<--help> + +Prints a brief help message and exits. + +=item B<--man> + +Prints the manual page and exits. + +=back + +=head1 DESCRIPTION + +Parse the Linux ABI files from ABI DIR (usually located at Documentation/ABI) +and produce a ReST book containing the Linux ABI. + +=head1 BUGS + +Report bugs to Mauro Carvalho Chehab <[email protected]> + +=head1 COPYRIGHT + +Copyright (c) 2016 by Mauro Carvalho Chehab <[email protected]>. + +License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>. + +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. + +=cut
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Mauro Carvalho ChehabQuoted 8 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
As we don't want a generic Sphinx extension to execute commands, change the one proposed to Markus to call the abi_book.pl script.
Use a script to parse the
Documentation/ABIdirectory and output it at the admin-guide.
We had a legacy kernel-doc perl script so we used that instead of rewriting it in python. Just to keep it bug-for-bug compatible with the past. That was the only reason.
I see absolutely zero reason to add a new perl monstrosity with a python extension to call it. All of this could be better done in python, directly.
Please don't complicate the documentation build. I know you know we all worked hard to take apart the old DocBook Rube Goldberg machine to replace it with Sphinx. Please don't turn the Sphinx build to another complicated mess.
My strong preferences are, in this order:
1) Convert the ABI documentation to reStructuredText
2) Have the python extension read the ABI files directly, without an extra pipeline.
BR,
Jani.
Quoted 293 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>--- Documentation/admin-guide/abi-obsolete.rst | 10 ++ Documentation/admin-guide/abi-removed.rst | 4 + Documentation/admin-guide/abi-stable.rst | 13 ++ Documentation/admin-guide/abi-testing.rst | 19 +++ Documentation/admin-guide/abi.rst | 11 ++ Documentation/admin-guide/index.rst | 1 + Documentation/conf.py | 2 +- Documentation/sphinx/kernel_abi.py | 155 +++++++++++++++++++++ 8 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 Documentation/admin-guide/abi-obsolete.rst create mode 100644 Documentation/admin-guide/abi-removed.rst create mode 100644 Documentation/admin-guide/abi-stable.rst create mode 100644 Documentation/admin-guide/abi-testing.rst create mode 100644 Documentation/admin-guide/abi.rst create mode 100644 Documentation/sphinx/kernel_abi.pyDocumentation/admin-guide/abi-obsolete.rst new file +10
-0@@ -0,0 +1,10 @@ +ABI obsolete symbols +==================== + +Documents interfaces that are still remaining in the kernel, but are +marked to be removed at some later point in time. + +The description of the interface will document the reason why it is +obsolete and when it can be expected to be removed. + +.. kernel-abi:: $srctree/Documentation/ABI/obsoleteDocumentation/admin-guide/abi-removed.rst new file +4
-0@@ -0,0 +1,4 @@ +ABI removed symbols +=================== + +.. kernel-abi:: $srctree/Documentation/ABI/removedDocumentation/admin-guide/abi-stable.rst new file +13
-0@@ -0,0 +1,13 @@ +ABI stable symbols +================== + +Documents the interfaces that the developer has defined to be stable. + +Userspace programs are free to use these interfaces with no +restrictions, and backward compatibility for them will be guaranteed +for at least 2 years. + +Most interfaces (like syscalls) are expected to never change and always +be available. + +.. kernel-abi:: $srctree/Documentation/ABI/stableDocumentation/admin-guide/abi-testing.rst new file +19
-0@@ -0,0 +1,19 @@ +ABI testing symbols +=================== + +Documents interfaces that are felt to be stable, +as the main development of this interface has been completed. + +The interface can be changed to add new features, but the +current interface will not break by doing this, unless grave +errors or security problems are found in them. + +Userspace programs can start to rely on these interfaces, but they must +be aware of changes that can occur before these interfaces move to +be marked stable. + +Programs that use these interfaces are strongly encouraged to add their +name to the description of these interfaces, so that the kernel +developers can easily notify them if any changes occur. + +.. kernel-abi:: $srctree/Documentation/ABI/testingDocumentation/admin-guide/abi.rst new file +11
-0@@ -0,0 +1,11 @@ +===================== +Linux ABI description +===================== + +.. toctree:: + :maxdepth: 1 + + abi-stable + abi-testing + abi-obsolete + abi-removedDocumentation/admin-guide/index.rst +1
-0@@ -16,6 +16,7 @@ etc. README kernel-parameters devices + abi This section describes CPU vulnerabilities and their mitigations.Documentation/conf.py +1
-1@@ -34,7 +34,7 @@ needs_sphinx = '1.3' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain', 'kfigure', 'sphinx.ext.ifconfig'] +extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain', 'kfigure', 'sphinx.ext.ifconfig', 'kernel_abi'] # The name of the math extension changed on Sphinx 1.4 if (major == 1 and minor > 3) or (major > 1):Documentation/sphinx/kernel_abi.py new file +155
-0@@ -0,0 +1,155 @@ +# -*- coding: utf-8; mode: python -*- +u""" + kernel-abi + ~~~~~~~~~~ + + Implementation of the ``kernel-abi`` reST-directive. + + :copyright: Copyright (C) 2016 Markus Heiser + :copyright: Copyright (C) 2016 Mauro Carvalho Chehab + :license: GPL Version 2, June 1991 see Linux/COPYING for details. + + The ``kernel-abi`` (:py:class:`KernelCmd`) directive calls the + scripts/get_abi.pl script to parse the Kernel ABI files. + + Overview of directive's argument and options. + + .. code-block:: rst + + .. kernel-abi:: <ABI directory location> + :debug: + + The argument ``<ABI directory location>`` is required. It contains the + location of the ABI files to be parsed. + + ``debug`` + Inserts a code-block with the *raw* reST. Sometimes it is helpful to see + what reST is generated. + +""" + +import sys +import os +from os import path +import subprocess + +from sphinx.ext.autodoc import AutodocReporter + +from docutils import nodes +from docutils.parsers.rst import Directive, directives +from docutils.statemachine import ViewList +from docutils.utils.error_reporting import ErrorString + + +__version__ = '1.0' + +# We can't assume that six is installed +PY3 = sys.version_info[0] == 3 +PY2 = sys.version_info[0] == 2 +if PY3: + # pylint: disable=C0103, W0622 + unicode = str + basestring = str + +def setup(app): + + app.add_directive("kernel-abi", KernelCmd) + return dict( + version = __version__ + , parallel_read_safe = True + , parallel_write_safe = True + ) + +class KernelCmd(Directive): + + u"""KernelABI (``kernel-abi``) directive""" + + required_arguments = 1 + optional_arguments = 0 + has_content = False + final_argument_whitespace = True + + option_spec = { + "debug" : directives.flag + } + + def warn(self, message, **replace): + replace["fname"] = self.state.document.current_source + replace["line_no"] = replace.get("line_no", self.lineno) + message = ("%(fname)s:%(line_no)s: [kernel-abi WARN] : " + message) % replace + self.state.document.settings.env.app.warn(message, prefix="") + + def run(self): + + doc = self.state.document + if not doc.settings.file_insertion_enabled: + raise self.warning("docutils: file insertion disabled") + + env = doc.settings.env + cwd = path.dirname(doc.current_source) + cmd = "get_abi.pl rest --dir " + cmd += self.arguments[0] + + srctree = path.abspath(os.environ["srctree"]) + + fname = cmd + + # extend PATH with $(srctree)/scripts + path_env = os.pathsep.join([ + srctree + os.sep + "scripts", + os.environ["PATH"] + ]) + shell_env = os.environ.copy() + shell_env["PATH"] = path_env + shell_env["srctree"] = srctree + + lines = self.runCmd(cmd, shell=True, cwd=cwd, env=shell_env) + nodeList = self.nestedParse(lines, fname) + return nodeList + + def runCmd(self, cmd, **kwargs): + u"""Run command ``cmd`` and return it's stdout as unicode.""" + + try: + proc = subprocess.Popen( + cmd + , stdout = subprocess.PIPE + , stderr = subprocess.PIPE + , universal_newlines = True + , **kwargs + ) + out, err = proc.communicate() + if err: + self.warn(err) + if proc.returncode != 0: + raise self.severe( + u"command '%s' failed with return code %d" + % (cmd, proc.returncode) + ) + except OSError as exc: + raise self.severe(u"problems with '%s' directive: %s." + % (self.name, ErrorString(exc))) + return unicode(out) + + def nestedParse(self, lines, fname): + content = ViewList() + node = nodes.section() + + if "debug" in self.options: + code_block = "\n\n.. code-block:: rst\n :linenos:\n" + for l in lines.split("\n"): + code_block += "\n " + l + lines = code_block + "\n\n" + + for c, l in enumerate(lines.split("\n")): + content.append(l, fname, c) + + buf = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter + self.state.memo.title_styles = [] + self.state.memo.section_level = 0 + self.state.memo.reporter = AutodocReporter(content, self.state.memo.reporter) + try: + self.state.nested_parse(content, 0, node, match_titles=1) + finally: + self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = buf + return node.children
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [PATCH 05/14] scripts: add an script to parse the ABI files
In reply to Jani NikulaQuoted 11 lines · Jani Nikula
Quoted 8 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
Add a script to parse the
Documentation/ABIfiles and produce an output with all entries inside an ABI (sub)directory.Right now, it outputs its contents on ReST format. It shouldn't be hard to make it produce other kind of outputs, since the ABI file parser is implemented in separate than the output generator.
Hum, or just convert the ABI files to rst directly.
And what would that look like?
thanks,
greg k-h
Re: [PATCH 05/14] scripts: add an script to parse the ABI files
Quoted 7 lines · Greg Kroah-Hartman
Quoted 6 lines · Jani Nikula
Quoted 5 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
Add a script to parse the
Documentation/ABIfiles and produce an output with all entries inside an ABI (sub)directory.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Right now, it outputs its contents on ReST format. It shouldn't be hard to make it produce other kind of outputs, since the ABI file parser is implemented in separate than the output generator.
Hum, or just convert the ABI files to rst directly.
And what would that look like?
That pretty much depends on the requirements we want to set on both the ABI source files and the generated output. Obviously the requirements can be conflicting; might be hard to produce fancy output if the input is very limited.
At the bare minimum, you could convert the files to contain reStructuredText field lists [1]. Add a colon at the start of the field name, and make sure field bodies (values) are not empty.
Conversion of a file selected at random; I've only added ":" and "N/A".
Documentation/ABI/stable/sysfs-devices-system-cpu +13 -12
@@ -1,19 +1,20 @@ -What: /sys/devices/system/cpu/dscr_default -Date: 13-May-2014 -KernelVersion: v3.15.0 -Contact: -Description: Writes are equivalent to writing to +:What: /sys/devices/system/cpu/dscr_default +:Date: 13-May-2014 +:KernelVersion: v3.15.0 +:Contact: N/A +:Description: Writes are equivalent to writing to /sys/devices/system/cpu/cpuN/dscr on all CPUs. Reads return the last written value or 0. This value is not a global default: it is a way to set all per-CPU defaults at the same time. -Values: 64 bit unsigned integer (bit field) +:Values: 64 bit unsigned integer (bit field) -What: /sys/devices/system/cpu/cpu[0-9]+/dscr -Date: 13-May-2014 -KernelVersion: v3.15.0 -Contact: -Description: Default value for the Data Stream Control Register (DSCR) on + +:What: /sys/devices/system/cpu/cpu[0-9]+/dscr +:Date: 13-May-2014 +:KernelVersion: v3.15.0 +:Contact: N/A +:Description: Default value for the Data Stream Control Register (DSCR) on a CPU. This default value is used when the kernel is executing and for any process that has not set the DSCR itself.
@@ -22,4 +23,4 @@ Description: Default value for the Data Stream Control Register (DSCR) on on any CPU where it executes (overriding the value described here). If set by a process it will be inherited by child processes. -Values: 64 bit unsigned integer (bit field) +:Values: 64 bit unsigned integer (bit field)
---
Of course, you'd still need to add higher level files to include the ABI files.
At the other end, you could add structure and syntax to your heart's content, and make the output fancier too.
BR,
Jani.
[1] http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#field-lists
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [PATCH 05/14] scripts: add an script to parse the ABI files
In reply to Greg Kroah-HartmanEm Fri, 14 Jun 2019 15:39:33 +0200
Greg Kroah-Hartman <[email protected]> escreveu:
Quoted 12 lines · Jani Nikula
Quoted 11 lines · Mauro Carvalho Chehab
Quoted 8 lines
From: Mauro Carvalho Chehab <[email protected]>
Add a script to parse the
Documentation/ABIfiles and produce an output with all entries inside an ABI (sub)directory.Right now, it outputs its contents on ReST format. It shouldn't be hard to make it produce other kind of outputs, since the ABI file parser is implemented in separate than the output generator.
Hum, or just convert the ABI files to rst directly.
Converting ABI files to rst could be easily done using a modified version of my script (plus the produced files will likely need some manual review).
There is a drawback though: we'll lose the capability of being able to parse ABI files via an script, as people would be freed to use a different syntax.
We could minimize it by using things like:
:What:
:Kernel Version:
...
Quoted 1 line
And what would that look like?
That's the big question :-)
If you prefer something like that, I can write the patches.
Thanks,
Mauro
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Jani NikulaQuoted 18 lines · Jani Nikula
Quoted 8 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
As we don't want a generic Sphinx extension to execute commands, change the one proposed to Markus to call the abi_book.pl script.
Use a script to parse the
Documentation/ABIdirectory and output it at the admin-guide.We had a legacy kernel-doc perl script so we used that instead of rewriting it in python. Just to keep it bug-for-bug compatible with the past. That was the only reason.
I see absolutely zero reason to add a new perl monstrosity with a python extension to call it. All of this could be better done in python, directly.
Quoted 8 lines
Please don't complicate the documentation build. I know you know we all worked hard to take apart the old DocBook Rube Goldberg machine to replace it with Sphinx. Please don't turn the Sphinx build to another complicated mess.
My strong preferences are, in this order:
1) Convert the ABI documentation to reStructuredText
What would that exactly look like? What would it require for new developers for when they write new entries? Why not rely on a helper script, that allows us to validate things better?
Quoted 2 lines
2) Have the python extension read the ABI files directly, without an extra pipeline.
He who writes the script, get's to dictate the language of the script :)
Personally, this looks sane to me, I'm going to apply the ABI fixups to my tree at least, and then see how the script works out. The script can always be replaced with a different one in a different language at a later point in time of people think it really mattes.
thanks,
greg k-h
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Jani NikulaAm 14.06.19 um 15:42 schrieb Jani Nikula:
Quoted 22 lines · Mauro Carvalho Chehab
Quoted 8 lines
From: Mauro Carvalho Chehab<[email protected]>
As we don't want a generic Sphinx extension to execute commands, change the one proposed to Markus to call the abi_book.pl script.
Use a script to parse the
Documentation/ABIdirectory and output it at the admin-guide.We had a legacy kernel-doc perl script so we used that instead of rewriting it in python. Just to keep it bug-for-bug compatible with the past. That was the only reason.
I see absolutely zero reason to add a new perl monstrosity with a python extension to call it. All of this could be better done in python, directly.
Please don't complicate the documentation build. I know you know we all worked hard to take apart the old DocBook Rube Goldberg machine to replace it with Sphinx. Please don't turn the Sphinx build to another complicated mess.
Quoted 7 lines
My strong preferences are, in this order:
1) Convert the ABI documentation to reStructuredText
2) Have the python extension read the ABI files directly, without an extra pipeline.
I agree with Jani. No matter how the decision ends, since I can't help here, I'd rather not show up in the copyright.
-- Markus --
Jonathan Corbet
maintainerRe: [PATCH 05/14] scripts: add an script to parse the ABI files
In reply to Jani NikulaQuoted 12 lines · On Fri, 14 Jun 2019 17:00:55 +0300 Jani Nikula <[email protected]>…
Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Jani Nikula
Quoted 8 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
Add a script to parse the
Documentation/ABIfiles and produce an output with all entries inside an ABI (sub)directory.Right now, it outputs its contents on ReST format. It shouldn't be hard to make it produce other kind of outputs, since the ABI file parser is implemented in separate than the output generator.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Hum, or just convert the ABI files to rst directly.
And what would that look like?
That pretty much depends on the requirements we want to set on both the ABI source files and the generated output. Obviously the requirements can be conflicting; might be hard to produce fancy output if the input is very limited.
The real question, I guess, is: is there anything else that depends on the current format of those files? That could make reformatting them harder.
Otherwise it seems like Jani's fieldlist idea might have some potential. We could consider a *really* simple preprocessing step if we really wanted ("prepend a colon on relevant lines and join with the following line if need be") to keep the current format nearly unchanged.
jon
Jonathan Corbet
maintainerRe: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Markus HeiserQuoted 2 lines · On Fri, 14 Jun 2019 16:10:31 +0200 Markus Heiser <[email protected]>…
I agree with Jani. No matter how the decision ends, since I can't help here, I'd rather not show up in the copyright.
Is there something specific you are asking us to do here?
Thanks,
jon
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Greg Kroah-HartmanEm Fri, 14 Jun 2019 16:06:03 +0200
Greg Kroah-Hartman <[email protected]> escreveu:
Quoted 24 lines · Jani Nikula
Quoted 23 lines · Mauro Carvalho Chehab
Quoted 8 lines
From: Mauro Carvalho Chehab <[email protected]>
As we don't want a generic Sphinx extension to execute commands, change the one proposed to Markus to call the abi_book.pl script.
Use a script to parse the
Documentation/ABIdirectory and output it at the admin-guide.We had a legacy kernel-doc perl script so we used that instead of rewriting it in python. Just to keep it bug-for-bug compatible with the past. That was the only reason.
I see absolutely zero reason to add a new perl monstrosity with a python extension to call it. All of this could be better done in python, directly.
Please don't complicate the documentation build. I know you know we all worked hard to take apart the old DocBook Rube Goldberg machine to replace it with Sphinx. Please don't turn the Sphinx build to another complicated mess.
Quoted 7 lines
Quoted 3 lines
My strong preferences are, in this order:
1) Convert the ABI documentation to reStructuredText
What would that exactly look like? What would it require for new developers for when they write new entries? Why not rely on a helper script, that allows us to validate things better?
Funny enough, this e-mail arrived here after Greg's reply, and my reply over his one :-)
-
With regards to the script, my idea is to have it run on a new "validate" mode, when the Kernel is built with COMPILE_TEST:
https://git.linuxtv.org/mchehab/experimental.git/log/?h=abi_patches_v4
NB: the last patch is not yet... somehow, the building system is not passing CONFIG_WARN_ABI_ERRORS to Documentation/Makefile. I'm debugging it.
Personally, I would prefer to keep it the way it is, with two additions:
1) I would add a SPDX header at the fist line of each file there;
2) It would make sense to have a new field - or indicator - to let add ReST markups at the description.
The advantage of using a parseable ABI file is that it is possible to parse it, for example, to search for a symbol:
$ ./scripts/get_abi.pl voltage_max
/sys/class/power_supply/<supply_name>/voltage_max ------------------------------------------------- Date: January 2008 Contact: [email protected] Defined on file: Documentation/ABI/testing/sysfs-class-power Description: Reports the maximum VBUS voltage the supply can support. Access: Read Valid values: Represented in microvolts ...
Quoted 5 lines
Quoted 3 lines
2) Have the python extension read the ABI files directly, without an extra pipeline.
He who writes the script, get's to dictate the language of the script :)
No idea about how much time it would take if written in python, but this perl script is really fast:
$ time ./scripts/get_abi.pl search voltage_max >/dev/null real 0m0,139s user 0m0,132s sys 0m0,006s
That's the time it takes here (SSD disks) to read all files under Documentation/ABI, parse them and seek for a string.
That's about half of the time a python script takes to just import the the sphinx modules and print its version, running at the same machine:
$ time sphinx-build --version >/dev/null
real 0m0,224s user 0m0,199s sys 0m0,024s
Quoted 4 lines
Personally, this looks sane to me, I'm going to apply the ABI fixups to my tree at least, and then see how the script works out. The script can always be replaced with a different one in a different language at a later point in time of people think it really mattes.
Thanks,
Mauro
Re: [PATCH 01/14] ABI: fix some syntax issues at the ABI database
In reply to Andrew DonnellanQuoted 12 lines · Andrew Donnellan
Documentation/ABI/testing/sysfs-class-cxl line 1
Quoted 9 lines · Mauro Carvalho Chehab
Documentation/ABI/testing/sysfs-class-cxl +1
-3@@ -1,6 +1,6 @@ -Note: Attributes that are shared between devices are stored in the directory -pointed to by the symlink device/. -Example: The real path of the attribute /sys/class/cxl/afu0.0s/irqs_max is +Please notice that attributes that are shared between devices are stored inWould prefer "Please note" over "Please notice".
Now changed, but that's a minor grammer thing, both are correct. :)
Quoted 1 line
thanks,
greg k-h
Re: [PATCH 14/14] docs: sphinx/kernel_abi.py: fix UTF-8 support
In reply to Mauro Carvalho ChehabQuoted 12 lines · Mauro Carvalho Chehab
The parser breaks with UTF-8 characters with Sphinx 1.4.
Signed-off-by Mauro Carvalho Chehab <[email protected]>--- Documentation/sphinx/kernel_abi.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)Documentation/sphinx/kernel_abi.py +0
-0
Documentation/sphinx/kernel_abi.py line 2
Quoted 3 lines
Documentation/sphinx/kernel_abi.py +2
-1@@ -1,4 +1,5 @@ -# -*- coding: utf-8; mode: python -*- +# coding=utf-8 +#
Is this an emacs vs. vim fight?
Why change this?
thanks,
greg k-h
Quoted 11 lines · Mauro Carvalho Chehab
Greg,
As promised, I'm resending the patch series with adds the Kernel ABI to
Documentation/admin-guide.Those patches are basically the version 3 patchset I sent back in 2017, rebased on the top of linux-next (next-20190613), and with some fixes in order for it to work.
- The 4 initial patches to fix some ABI descriptions that are violating the syntax described at
Documentation/ABI/README;
These 4 are now applied to my driver-core tree, thanks.
greg k-h
Re: [PATCH 05/14] scripts: add an script to parse the ABI files
In reply to Jani NikulaQuoted 21 lines · Jani Nikula
Quoted 7 lines · Greg Kroah-Hartman
Quoted 6 lines · Jani Nikula
Quoted 5 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
Add a script to parse the
Documentation/ABIfiles and produce an output with all entries inside an ABI (sub)directory.Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Right now, it outputs its contents on ReST format. It shouldn't be hard to make it produce other kind of outputs, since the ABI file parser is implemented in separate than the output generator.
Hum, or just convert the ABI files to rst directly.
And what would that look like?
That pretty much depends on the requirements we want to set on both the ABI source files and the generated output. Obviously the requirements can be conflicting; might be hard to produce fancy output if the input is very limited.
Quoted 5 lines
At the bare minimum, you could convert the files to contain reStructuredText field lists [1]. Add a colon at the start of the field name, and make sure field bodies (values) are not empty.
Conversion of a file selected at random; I've only added ":" and "N/A".
N/A should be allowed to just drop the line entirely, right?
And what does this end up looking like?
I also hate "flag days" where all of a chunk of stuff needs to be converted into another style. Also it doesn't deal with merges from the 100+ different trees that all end up adding stuff to this directory over time (slowly though, unfortunately)
So ideally, I'd like to keep the original format if at all possible. Having the tool here allows people to do nice things like search for a specific file easily, or a device type, which is something that I know I have wanted, and others have asked for in the past as well.
It also might allow us to find out where we are missing documentation, a long-term goal of mine.
thanks,
greg k-h
Re: [PATCH 14/14] docs: sphinx/kernel_abi.py: fix UTF-8 support
In reply to Greg Kroah-HartmanEm Fri, 14 Jun 2019 18:18:37 +0200
Greg Kroah-Hartman <[email protected]> escreveu:
Quoted 8 lines · Mauro Carvalho Chehab
Quoted 7 lines
The parser breaks with UTF-8 characters with Sphinx 1.4.
Signed-off-by Mauro Carvalho Chehab <[email protected]>--- Documentation/sphinx/kernel_abi.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Quoted 10 lines
Documentation/sphinx/kernel_abi.py line 2
Quoted 8 lines
Documentation/sphinx/kernel_abi.py +2
-1@@ -1,4 +1,5 @@ -# -*- coding: utf-8; mode: python -*- +# coding=utf-8 +#Is this an emacs vs. vim fight?
No. This is a python-specific thing:
https://www.python.org/dev/peps/pep-0263/
Quoted 2 lines
Why change this?
Just to keep the "header" part of the script closer to kerneldoc.py.
You may keep the previous syntax if you want, as both ways are equally recognized, as python actually checks for anything that matches this regex at the first or second line:
^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)
Thanks,
Mauro
Re: [PATCH 14/14] docs: sphinx/kernel_abi.py: fix UTF-8 support
Quoted 22 lines · Mauro Carvalho Chehab
Em Fri, 14 Jun 2019 18:18:37 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 8 lines · Mauro Carvalho Chehab
Quoted 7 lines
The parser breaks with UTF-8 characters with Sphinx 1.4.
Signed-off-by Mauro Carvalho Chehab <[email protected]>--- Documentation/sphinx/kernel_abi.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)Quoted 10 lines
Documentation/sphinx/kernel_abi.py line 2
Quoted 8 lines
Documentation/sphinx/kernel_abi.py +2
-1@@ -1,4 +1,5 @@ -# -*- coding: utf-8; mode: python -*- +# coding=utf-8 +#Is this an emacs vs. vim fight?
Quoted 3 lines
No. This is a python-specific thing:
https://www.python.org/dev/peps/pep-0263/
Ah, thanks, didn't know that.
greg k-h
Re: [PATCH 14/14] docs: sphinx/kernel_abi.py: fix UTF-8 support
In reply to Mauro Carvalho ChehabAm 14.06.19 um 18:25 schrieb Mauro Carvalho Chehab:
Quoted 22 lines
Em Fri, 14 Jun 2019 18:18:37 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 8 lines · Mauro Carvalho Chehab
Quoted 7 lines
The parser breaks with UTF-8 characters with Sphinx 1.4.
Signed-off-by Mauro Carvalho Chehab <[email protected]>--- Documentation/sphinx/kernel_abi.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)Quoted 10 lines
Documentation/sphinx/kernel_abi.py line 2
Quoted 8 lines
Documentation/sphinx/kernel_abi.py +2
-1@@ -1,4 +1,5 @@ -# -*- coding: utf-8; mode: python -*- +# coding=utf-8 +#Is this an emacs vs. vim fight?
Quoted 3 lines
No. This is a python-specific thing:
https://www.python.org/dev/peps/pep-0263/
No need to change, the emacs notation is also OK, see your link
"""or (using formats recognized by popular editors):"""
https://www.python.org/dev/peps/pep-0263/#defining-the-encoding
I prefer emacs notation, this is also evaluated by many other editors / tools.
-- Markus --
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Jonathan CorbetAm 14.06.19 um 16:15 schrieb Jonathan Corbet:
Quoted 8 lines
Quoted 2 lines · On Fri, 14 Jun 2019 16:10:31 +0200 Markus Heiser <[email protected]>…
I agree with Jani. No matter how the decision ends, since I can't help here, I'd rather not show up in the copyright.
Is there something specific you are asking us to do here?
I have lost the overview, but there was a patch Mauro added a kernel_abi.py. There was my name (Markus Heiser) listed with a copyright notation.
I guess Mauro picked up some old RFC or an other old patch of mine from 2016 and made some C&P .. whatever .. ATM I do not have time to give any support on parsing ABI and I'am not interested in holding copyrights on a C&P of a old source ;)
-- Markus --
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
Em Sun, 16 Jun 2019 18:04:01 +0200
Markus Heiser <[email protected]> escreveu:
Quoted 11 lines
Am 14.06.19 um 16:15 schrieb Jonathan Corbet:
Quoted 8 lines
Quoted 2 lines · On Fri, 14 Jun 2019 16:10:31 +0200 Markus Heiser <[email protected]>…
I agree with Jani. No matter how the decision ends, since I can't help here, I'd rather not show up in the copyright.
Is there something specific you are asking us to do here?
Quoted 8 lines
I have lost the overview, but there was a patch Mauro added a
kernel_abi.py. There was my name (Markus Heiser) listed with a copyright notation.I guess Mauro picked up some old RFC or an other old patch of mine from 2016 and made some C&P .. whatever .. ATM I do not have time to give any support on parsing ABI and I'am not interested in holding copyrights on a C&P of a old source ;)
Well, the code was basically written by you :-)
It was written to be a script capable of running a generic script. On that time, my contribution to it was basically to hardcode it to run "get_abi.pl".
This came from an old branch where the last change was back in 2017. It was resurrected due to a discussion at KS ML.
There, the discussion was related to what's left to be converted to ReST.
While I can't simply remove your copyright, would you be happy with something like that?
Thanks,
Mauro
Documentation/sphinx/kernel_abi.py +2 -1
@@ -7,7 +7,8 @@ u""" Implementation of the ``kernel-abi`` reST-directive. :copyright: Copyright (C) 2016 Markus Heiser - :copyright: Copyright (C) 2016 Mauro Carvalho Chehab + :copyright: Copyright (C) 2016-2019 Mauro Carvalho Chehab + :maintained-by: Mauro Carvalho Chehab <[email protected]> :license: GPL Version 2, June 1991 see Linux/COPYING for details. The ``kernel-abi`` (:py:class:`KernelCmd`) directive calls the
Re: [PATCH 14/14] docs: sphinx/kernel_abi.py: fix UTF-8 support
In reply to Markus HeiserEm Sun, 16 Jun 2019 17:43:50 +0200
Markus Heiser <[email protected]> escreveu:
Quoted 27 lines
Am 14.06.19 um 18:25 schrieb Mauro Carvalho Chehab:
Quoted 22 lines
Em Fri, 14 Jun 2019 18:18:37 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 8 lines · Mauro Carvalho Chehab
Quoted 7 lines
The parser breaks with UTF-8 characters with Sphinx 1.4.
Signed-off-by Mauro Carvalho Chehab <[email protected]>--- Documentation/sphinx/kernel_abi.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)Quoted 10 lines
Documentation/sphinx/kernel_abi.py line 2
Quoted 8 lines
Documentation/sphinx/kernel_abi.py +2
-1@@ -1,4 +1,5 @@ -# -*- coding: utf-8; mode: python -*- +# coding=utf-8 +#Is this an emacs vs. vim fight?
Quoted 3 lines
No. This is a python-specific thing:
https://www.python.org/dev/peps/pep-0263/
Quoted 7 lines
No need to change, the emacs notation is also OK, see your link
"""or (using formats recognized by popular editors):"""
https://www.python.org/dev/peps/pep-0263/#defining-the-encodingI prefer emacs notation, this is also evaluated by many other editors / tools.
The usage of emacs notation is something that we don't like at the Linux Kernel. With ~4K developers per release, if we add tags to every single editor people use, it would be really messy, as one developer would be adding a tag and the next one replacing it by its some other favorite editor's tag.
There's even an item at Documentation/process/coding-style.rst due to that (item 9).
Thanks,
Mauro
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Mauro Carvalho ChehabQuoted 8 lines · Mauro Carvalho Chehab
Em Fri, 14 Jun 2019 16:06:03 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 5 lines · Jani Nikula
Quoted 2 lines
2) Have the python extension read the ABI files directly, without an extra pipeline.
He who writes the script, get's to dictate the language of the script :)
The point is, it's an extension to a python based tool, written in perl, using pipes for communication, and losing any advantages of integrating with the tool it's extending.
I doubt you'd want to see system() to be used to subsequently extend the perl tool.
I think it's just sad to see the documentation system slowly drift further away from the ideals we had, and towards the old ways we worked so hard to fix.
Quoted 11 lines
No idea about how much time it would take if written in python, but this perl script is really fast:
$ time ./scripts/get_abi.pl search voltage_max >/dev/null real 0m0,139s user 0m0,132s sys 0m0,006sThat's the time it takes here (SSD disks) to read all files under
Documentation/ABI, parse them and seek for a string.
Quoted 8 lines
That's about half of the time a python script takes to just import the the sphinx modules and print its version, running at the same machine:
$ time sphinx-build --version >/dev/nullreal 0m0,224s user 0m0,199s sys 0m0,024s
Please at least use fair and sensible comparisons. If you want to make the extension usable standalone on the command-line, bypassing Sphinx, you can do that. No need to factor in Sphinx to your comparisons.
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
Quoted 14 lines · Jani Nikula
Quoted 8 lines · Mauro Carvalho Chehab
Em Fri, 14 Jun 2019 16:06:03 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 5 lines · Jani Nikula
Quoted 2 lines
2) Have the python extension read the ABI files directly, without an extra pipeline.
He who writes the script, get's to dictate the language of the script :)
The point is, it's an extension to a python based tool, written in perl, using pipes for communication, and losing any advantages of integrating with the tool it's extending.
Quoted 6 lines
I doubt you'd want to see
system()to be used to subsequently extend the perl tool.I think it's just sad to see the documentation system slowly drift further away from the ideals we had, and towards the old ways we worked so hard to fix.
What are those ideals?
I thought the goal was to be able to write documentation in a as much as a normal text file as possible and have automation turn those files into "pretty" documentation that we can all use.
And I think that fits with the way this patch set goes, right? We are not on a quest for purity of scripts to generate the documentation at the expense of having to force hundreds, or thousands, of developers to change their ways, or to force a "flag day" conversion of existing documentation resulting in a huge merge mess.
So, we are stuck with the current structure that I totally made up for Documentation/ABI/. Turns out it is almost parsable, as Mauro's tool shows. His tool also validates the existing text, which is great, and has caused fixes for it.
If someone wants to write that tool in some other language, like python, wonderful, I have no objection, but as it is, this is a useful tool already, allowing us to validate, and search, existing documentation entries that we have never been able to do before. It also provides an output that can be turned into pretty html/pdf/whatever files by other tools in the pipeline, a totally bonus benefit.
So what is going backwards here?
Maybe the processing pipeline isn't as nice as you would like, but remember to view this from a normal developer's point of view, not a documentation pipeline developer's point of view please.
So, in short, my requirements are:
- keep Documentation/ABI/ file formats as close as possible to what we have today, preventing any flag-day issues or merge problems
- be able to query and validate Documentation/ABI/
- be able to turn Documentation/ABI into pretty documentation.
If you object to the mechanics of the last requirement here, I don't object either, provide something else that works better. But don't throw away the whole thing just because you don't like how things are hooked up here.
I'm going to go apply most of the rest of these patches to my driver-core tree, stopping at the "hook it up to the kernel documentation" point. Is that ok?
thanks,
greg k-h
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
Quoted 15 lines · Greg Kroah-Hartman
Quoted 14 lines · Jani Nikula
Quoted 8 lines · Mauro Carvalho Chehab
Em Fri, 14 Jun 2019 16:06:03 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 5 lines · Jani Nikula
Quoted 2 lines
2) Have the python extension read the ABI files directly, without an extra pipeline.
He who writes the script, get's to dictate the language of the script :)
The point is, it's an extension to a python based tool, written in perl, using pipes for communication, and losing any advantages of integrating with the tool it's extending.
Quoted 8 lines
Quoted 6 lines
I doubt you'd want to see
system()to be used to subsequently extend the perl tool.I think it's just sad to see the documentation system slowly drift further away from the ideals we had, and towards the old ways we worked so hard to fix.
What are those ideals?
For example, have a single coherent system, instead of a fragile pipe with each stage written in a different language, each having its own idiosynchracies, each step losing something in translation.
Have a system that a normal developer can actually look at and understand. It didn't use to be that way.
Quoted 9 lines
I thought the goal was to be able to write documentation in a as much as a normal text file as possible and have automation turn those files into "pretty" documentation that we can all use.
And I think that fits with the way this patch set goes, right? We are not on a quest for purity of scripts to generate the documentation at the expense of having to force hundreds, or thousands, of developers to change their ways, or to force a "flag day" conversion of existing documentation resulting in a huge merge mess.
Fair enough, let's dismiss the thought of changing the ABI files. But I never meant that would somehow be for the "purity of scripts", or that those two would somehow be at odds here.
Quoted 25 lines
So, we are stuck with the current structure that I totally made up for
Documentation/ABI/. Turns out it is almost parsable, as Mauro's tool shows. His tool also validates the existing text, which is great, and has caused fixes for it.If someone wants to write that tool in some other language, like python, wonderful, I have no objection, but as it is, this is a useful tool already, allowing us to validate, and search, existing documentation entries that we have never been able to do before. It also provides an output that can be turned into pretty html/pdf/whatever files by other tools in the pipeline, a totally bonus benefit.
So what is going backwards here?
Maybe the processing pipeline isn't as nice as you would like, but remember to view this from a normal developer's point of view, not a documentation pipeline developer's point of view please.
So, in short, my requirements are:
- keepDocumentation/ABI/file formats as close as possible to what we have today, preventing any flag-day issues or merge problems
- be able to query and validateDocumentation/ABI/
- be able to turnDocumentation/ABIinto pretty documentation.
Quoted 8 lines
If you object to the mechanics of the last requirement here, I don't object either, provide something else that works better. But don't throw away the whole thing just because you don't like how things are hooked up here.
I'm going to go apply most of the rest of these patches to my driver-core tree, stopping at the "hook it up to the kernel documentation" point. Is that ok?
I'll leave it all up to Jon's discretion; I trust he'll understand my concerns. I have no authority beyond the opinion I've voiced here anyway.
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Jonathan Corbet
maintainerRe: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Greg Kroah-HartmanQuoted 9 lines · On Mon, 17 Jun 2019 14:54:38 +0200 Greg Kroah-Hartman…
Quoted 3 lines
I think it's just sad to see the documentation system slowly drift further away from the ideals we had, and towards the old ways we worked so hard to fix.
What are those ideals?
I thought the goal was to be able to write documentation in a as much as a normal text file as possible and have automation turn those files into "pretty" documentation that we can all use.
That was indeed one of the goals. Another was to replace the incredible pile of fragile duct tape that the docs build system had become with something more robust, understandable, and maintainable. We did that, to an extent at least, and life is better.
Jani worries that we have been regressing toward duct-tape mode, and I suspect he may be right. I'm certainly as guilty as anybody of tossing stuff in because it's expedient right now. It is right to ask whether we should continue in that direction.
Can we slow down just a bit on the ABI files? It may be that Mauro's solution is the best one, but I would really like to think a bit about how all this stuff fits together, and life isn't really even giving me time to tie my shoes these days. I don't think that this is screamingly urgent right now.
Thanks,
jon
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Jani NikulaEm Mon, 17 Jun 2019 15:36:17 +0300
Jani Nikula <[email protected]> escreveu:
Quoted 14 lines · Mauro Carvalho Chehab
Quoted 8 lines
Em Fri, 14 Jun 2019 16:06:03 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 5 lines · Jani Nikula
Quoted 2 lines
2) Have the python extension read the ABI files directly, without an extra pipeline.
He who writes the script, get's to dictate the language of the script :)
The point is, it's an extension to a python based tool, written in perl, using pipes for communication, and losing any advantages of integrating with the tool it's extending.
Quoted 6 lines
I doubt you'd want to see
system()to be used to subsequently extend the perl tool.I think it's just sad to see the documentation system slowly drift further away from the ideals we had, and towards the old ways we worked so hard to fix.
Actually, it is a perl script that can be used standalone (just like get_maintainers.pl and kernel-doc) with have some features including producing a ReST output. We could easily get rid of the python extension, if we add this to the Makefile (adjusted to work with O= option):
./scripts/get_api.pl rest > Documentation/output/admin-guide/abi.rst
Quoted 17 lines
Quoted 17 lines
No idea about how much time it would take if written in python, but this perl script is really fast:
$ time ./scripts/get_abi.pl search voltage_max >/dev/null real 0m0,139s user 0m0,132s sys 0m0,006sThat's the time it takes here (SSD disks) to read all files under
Documentation/ABI, parse them and seek for a string.That's about half of the time a python script takes to just import the the sphinx modules and print its version, running at the same machine:
$ time sphinx-build --version >/dev/null
Quoted 7 lines
Quoted 3 lines
real 0m0,224s user 0m0,199s sys 0m0,024sPlease at least use fair and sensible comparisons. If you want to make the extension usable standalone on the command-line, bypassing Sphinx, you can do that. No need to factor in Sphinx to your comparisons.
Yeah, I guess it should be possible to do that. How a python script can identify if it was called by Sphinx, or if it was called directly?
Thanks,
Mauro
Jonathan Corbet
maintainerRe: [PATCH 14/14] docs: sphinx/kernel_abi.py: fix UTF-8 support
In reply to Mauro Carvalho ChehabQuoted 6 lines · On Mon, 17 Jun 2019 06:16:59 -0300 Mauro Carvalho Chehab…
Quoted 6 lines
No need to change, the emacs notation is also OK, see your link
"""or (using formats recognized by popular editors):"""
https://www.python.org/dev/peps/pep-0263/#defining-the-encoding
Quoted 7 lines
Quoted 1 line
I prefer emacs notation, this is also evaluated by many other editors / tools.
The usage of emacs notation is something that we don't like at the Linux Kernel. With ~4K developers per release, if we add tags to every single editor people use, it would be really messy, as one developer would be adding a tag and the next one replacing it by its some other favorite editor's tag.
So "we" like a language-specific notation instead? That seems a little strange to me. Lots of things understand the Emacs notation, it doesn't seem like something that needs to be actively avoided here.
Thanks,
jon
Re: [PATCH 14/14] docs: sphinx/kernel_abi.py: fix UTF-8 support
Em Mon, 17 Jun 2019 07:56:08 -0600
Jonathan Corbet <[email protected]> escreveu:
Quoted 17 lines
Quoted 6 lines · On Mon, 17 Jun 2019 06:16:59 -0300 Mauro Carvalho Chehab…
Quoted 6 lines
No need to change, the emacs notation is also OK, see your link
"""or (using formats recognized by popular editors):"""
https://www.python.org/dev/peps/pep-0263/#defining-the-encodingQuoted 7 lines
Quoted 1 line
I prefer emacs notation, this is also evaluated by many other editors / tools.
The usage of emacs notation is something that we don't like at the Linux Kernel. With ~4K developers per release, if we add tags to every single editor people use, it would be really messy, as one developer would be adding a tag and the next one replacing it by its some other favorite editor's tag.
Quoted 3 lines
So "we" like a language-specific notation instead? That seems a little strange to me. Lots of things understand the Emacs notation, it doesn't seem like something that needs to be actively avoided here.
From my side, I don't have any strong preference. Just saying that people usually complain when e-macs or vim specific tags appear at the Kernel. That's why I would prefer an editor-agnostic macro.
It won't make any difference for me, anyway, as the editors I use don't recognize it.
Whatever you want is OK to me, provided that we use the same notation on all Sphinx extensions... right now there's a mix of notations.
Thanks,
Mauro
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Mauro Carvalho ChehabAm 17.06.19 um 11:11 schrieb Mauro Carvalho Chehab:
Quoted 23 lines
Em Sun, 16 Jun 2019 18:04:01 +0200
Markus Heiser <[email protected]> escreveu:Quoted 11 lines
Am 14.06.19 um 16:15 schrieb Jonathan Corbet:
Quoted 8 lines
Quoted 2 lines · On Fri, 14 Jun 2019 16:10:31 +0200 Markus Heiser <[email protected]>…
I agree with Jani. No matter how the decision ends, since I can't help here, I'd rather not show up in the copyright.
Is there something specific you are asking us to do here?
Quoted 8 lines
I have lost the overview, but there was a patch Mauro added a
kernel_abi.py. There was my name (Markus Heiser) listed with a copyright notation.I guess Mauro picked up some old RFC or an other old patch of mine from 2016 and made some C&P .. whatever .. ATM I do not have time to give any support on parsing ABI and I'am not interested in holding copyrights on a C&P of a old source ;)
Quoted 5 lines
Well, the code was basically written by you :-)
It was written to be a script capable of running a generic script. On that time, my contribution to it was basically to hardcode it to run "get_abi.pl".
Thanks for clarifying.
Quoted 9 lines
This came from an old branch where the last change was back in 2017. It was resurrected due to a discussion at KS ML.
There, the discussion was related to what's left to be converted to ReST.
While I can't simply remove your copyright, would you be happy with something like that?
Yes, but basically I share Jani's and Jon's doubts about this solution.
-- Markus --
Quoted 21 lines
Thanks,
MauroDocumentation/sphinx/kernel_abi.py +2
-1@@ -7,7 +7,8 @@ u""" Implementation of the ``kernel-abi`` reST-directive. :copyright: Copyright (C) 2016 Markus Heiser - :copyright: Copyright (C) 2016 Mauro Carvalho Chehab + :copyright: Copyright (C) 2016-2019 Mauro Carvalho Chehab + :maintained-by: Mauro Carvalho Chehab <[email protected]> :license: GPL Version 2, June 1991 see Linux/COPYING for details. The ``kernel-abi`` (:py:class:`KernelCmd`) directive calls the
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Mauro Carvalho ChehabQuoted 2 lines · Mauro Carvalho Chehab
Yeah, I guess it should be possible to do that. How a python script can identify if it was called by Sphinx, or if it was called directly?
if __name__ == '__main__':
# run on the command-line, not imported
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [PATCH 04/14] ABI: better identificate tables
In reply to Mauro Carvalho ChehabQuoted 10 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
When parsing via script, it is important to know if the script should consider a description as a literal block that should be displayed as-is, or if the description can be considered as a normal text.
Change descriptions to ensure that the preceding line of a table ends with a colon. That makes easy to identify the need of a literal block.
In the cover letter you say that the first four patches of this series, including this one, "fix some ABI descriptions that are violating the syntax described at Documentation/ABI/README". This seems a bit harsh, given that it's you that is now *introducing* a new syntax requirement to assist your script.
Specifically, this new requirement isn't documented anywhere AFAICT, so how will anyone adding new ABI descriptions learn about it?
Quoted 15 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>--- Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra | 2 +- .../ABI/testing/sysfs-class-backlight-driver-lm3533 | 6 +++--- Documentation/ABI/testing/sysfs-class-led-driver-lm3533 | 8 ++++---- Documentation/ABI/testing/sysfs-class-leds-gt683r | 4 ++-- Documentation/ABI/testing/sysfs-driver-hid-roccat-kone | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-)Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra +0
-0
Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra Description: It is possible to switch the cpi setting of the mouse with the · line 11
Quoted 8 lines
Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra +1
-1@@ -5,7 +5,7 @@ Description: It is possible to switch the cpi setting of the mouse with the press of a button. When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further - processed to receive the real dpi value. + processed to receive the real dpi value: VALUE DPI 1 400
Johan
Re: [PATCH 04/14] ABI: better identificate tables
Hi Johan,
Em Wed, 19 Jun 2019 14:51:35 +0200
Johan Hovold <[email protected]> escreveu:
Quoted 12 lines · Mauro Carvalho Chehab
Quoted 10 lines
From: Mauro Carvalho Chehab <[email protected]>
When parsing via script, it is important to know if the script should consider a description as a literal block that should be displayed as-is, or if the description can be considered as a normal text.
Change descriptions to ensure that the preceding line of a table ends with a colon. That makes easy to identify the need of a literal block.
Quoted 5 lines
In the cover letter you say that the first four patches of this series, including this one, "fix some ABI descriptions that are violating the syntax described at
Documentation/ABI/README". This seems a bit harsh, given that it's you that is now *introducing* a new syntax requirement to assist your script.
Yeah, what's there at the cover letter doesn't apply to this specific patch. The thing is that I wrote this series a lot of time ago (2016/17).
I revived those per a request at KS ML, as we still need to expose the ABI content on some book that will be used by userspace people.
So, I just rebased it on the top of curent Kernel, add a cover letter with the things I remembered and re-sent.
In the specific case of this patch, the ":" there actually makes sense for someone that it is reading it as a text file, and it is an easy hack to make it parse better.
Quoted 2 lines
Specifically, this new requirement isn't documented anywhere AFAICT, so how will anyone adding new ABI descriptions learn about it?
Yeah, either that or provide an alternative to "Description" tag, to be used with more complex ABI descriptions.
One of the things that occurred to me, back on 2017, is that we should have a way to to specify that an specific ABI description would have a rich format. Something like:
What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/pyra/roccatpyra<minor>/actual_cpi
Date: August 2010
Contact: Stefan Achatz <[email protected]>
RST-Description:
It is possible to switch the cpi setting of the mouse with the press of a button. When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further processed to receive the real dpi value: ===== ===== VALUE DPI ===== ===== 1 400 2 800 4 1600 ===== =====
With that, the script will know that the description contents will be using the ReST markup, and parse it accordingly. Right now, what it does, instead, is to place the description on a code-block, e. g. it will produce this output for the description:
::
It is possible to switch the cpi setting of the mouse with the press of a button.
When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further processed to receive the real dpi value:
VALUE DPI
1 400
2 800
4 1600
Greg,
what do you think?
Thanks,
Mauro
Re: [PATCH 04/14] ABI: better identificate tables
Quoted 83 lines · Mauro Carvalho Chehab
Hi Johan,
Em Wed, 19 Jun 2019 14:51:35 +0200
Johan Hovold <[email protected]> escreveu:Quoted 12 lines · Mauro Carvalho Chehab
Quoted 10 lines
From: Mauro Carvalho Chehab <[email protected]>
When parsing via script, it is important to know if the script should consider a description as a literal block that should be displayed as-is, or if the description can be considered as a normal text.
Change descriptions to ensure that the preceding line of a table ends with a colon. That makes easy to identify the need of a literal block.
Quoted 5 lines
In the cover letter you say that the first four patches of this series, including this one, "fix some ABI descriptions that are violating the syntax described at
Documentation/ABI/README". This seems a bit harsh, given that it's you that is now *introducing* a new syntax requirement to assist your script.Yeah, what's there at the cover letter doesn't apply to this specific patch. The thing is that I wrote this series a lot of time ago (2016/17).
I revived those per a request at KS ML, as we still need to expose the ABI content on some book that will be used by userspace people.
So, I just rebased it on the top of curent Kernel, add a cover letter with the things I remembered and re-sent.
In the specific case of this patch, the ":" there actually makes sense for someone that it is reading it as a text file, and it is an easy hack to make it parse better.
Quoted 2 lines
Specifically, this new requirement isn't documented anywhere AFAICT, so how will anyone adding new ABI descriptions learn about it?
Yeah, either that or provide an alternative to "Description" tag, to be used with more complex ABI descriptions.
One of the things that occurred to me, back on 2017, is that we should have a way to to specify that an specific ABI description would have a rich format. Something like:
What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/pyra/roccatpyra<minor>/actual_cpi
Date: August 2010
Contact: Stefan Achatz <[email protected]>
RST-Description:It is possible to switch the cpi setting of the mouse with the press of a button. When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further processed to receive the real dpi value: ===== ===== VALUE DPI ===== ===== 1 400 2 800 4 1600 ===== =====With that, the script will know that the description contents will be using the ReST markup, and parse it accordingly. Right now, what it does, instead, is to place the description on a code-block, e. g. it will produce this output for the description:
::
It is possible to switch the cpi setting of the mouse with the press of a button.
When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further processed to receive the real dpi value:VALUE DPI
1 400
2 800
4 1600
Quoted 3 lines
Greg,
what do you think?
I don't know when "Description" and "RST-Description" would be used. Why not just parse "Description" like rst text and if things are "messy" we fix them up as found, like you did with the ":" here? It doesn't have to be complex, we can always fix them up after-the-fact if new stuff gets added that doesn't quite parse properly.
Just like we do for most kernel-doc formatting :)
thanks,
greg k-h
Re: [PATCH 04/14] ABI: better identificate tables
Em Wed, 19 Jun 2019 17:02:07 +0200
Greg Kroah-Hartman <[email protected]> escreveu:
Quoted 88 lines · Mauro Carvalho Chehab
Quoted 83 lines
Hi Johan,
Em Wed, 19 Jun 2019 14:51:35 +0200
Johan Hovold <[email protected]> escreveu:Quoted 12 lines · Mauro Carvalho Chehab
Quoted 10 lines
From: Mauro Carvalho Chehab <[email protected]>
When parsing via script, it is important to know if the script should consider a description as a literal block that should be displayed as-is, or if the description can be considered as a normal text.
Change descriptions to ensure that the preceding line of a table ends with a colon. That makes easy to identify the need of a literal block.
Quoted 5 lines
In the cover letter you say that the first four patches of this series, including this one, "fix some ABI descriptions that are violating the syntax described at
Documentation/ABI/README". This seems a bit harsh, given that it's you that is now *introducing* a new syntax requirement to assist your script.Yeah, what's there at the cover letter doesn't apply to this specific patch. The thing is that I wrote this series a lot of time ago (2016/17).
I revived those per a request at KS ML, as we still need to expose the ABI content on some book that will be used by userspace people.
So, I just rebased it on the top of curent Kernel, add a cover letter with the things I remembered and re-sent.
In the specific case of this patch, the ":" there actually makes sense for someone that it is reading it as a text file, and it is an easy hack to make it parse better.
Quoted 2 lines
Specifically, this new requirement isn't documented anywhere AFAICT, so how will anyone adding new ABI descriptions learn about it?
Yeah, either that or provide an alternative to "Description" tag, to be used with more complex ABI descriptions.
One of the things that occurred to me, back on 2017, is that we should have a way to to specify that an specific ABI description would have a rich format. Something like:
What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/pyra/roccatpyra<minor>/actual_cpi
Date: August 2010
Contact: Stefan Achatz <[email protected]>
RST-Description:It is possible to switch the cpi setting of the mouse with the press of a button. When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further processed to receive the real dpi value: ===== ===== VALUE DPI ===== ===== 1 400 2 800 4 1600 ===== =====With that, the script will know that the description contents will be using the ReST markup, and parse it accordingly. Right now, what it does, instead, is to place the description on a code-block, e. g. it will produce this output for the description:
::
It is possible to switch the cpi setting of the mouse with the press of a button.
When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further processed to receive the real dpi value:VALUE DPI
1 400
2 800
4 1600Quoted 3 lines
Greg,
what do you think?
Quoted 7 lines
I don't know when "Description" and "RST-Description" would be used. Why not just parse "Description" like rst text and if things are "messy" we fix them up as found, like you did with the ":" here? It doesn't have to be complex, we can always fix them up after-the-fact if new stuff gets added that doesn't quite parse properly.
Just like we do for most kernel-doc formatting :)
Works for me. Yet, I guess I tried that, back on 2017.
If I'm not mistaken, the initial patchset to solve the broken things won't be small, and will be require a lot of attention in order to identify what's broken and where.
Btw, one thing is to pass at ReST validation. Another thing is to produce something that people can read.
Right now, the pertinent logic at the script I wrote (scripts/get_abi.pl) is here:
if (!($desc =~ /^\s*$/)) {
if ($desc =~ m/\:\n/ || $desc =~ m/\n[\t ]+/ || $desc =~ m/[\x00-\x08\x0b-\x1f\x7b-\xff]/) {
# put everything inside a code block
$desc =~ s/\n/\n /g;
print "::\n\n";
print " $desc\n\n";
} else {
# Escape any special chars from description
$desc =~s/([\x00-\x08\x0b-\x1f\x21-\x2a\x2d\x2f\x3c-\x40\x5c\x5e-\x60\x7b-\xff])/\\$1/g;
print "$desc\n\n";
}
}If it discovers something weird enough, it just places everything into a comment block. Otherwise, it assumes that it is a plain text and that any special characters should be escaped.
If the above block is replaced by a simple:
print "$desc\n\n";
The description content will be handled as a ReST file.
I don't have any time right now to do this change and to handle the warnings that will start to popup.
Btw, a single replace there is enough to show the amount of problems that it will rise, as it will basically break Sphinx build with:
reading sources... [ 1%] admin-guide/abi-testing
reST markup error:
get_abi.pl rest --dir $srctree/Documentation/ABI/testing:45261: (SEVERE/4) Missing matching underline for section title overline.
==========================
PCIe Device AER statistics
These attributes show up under all the devices that are AER capable. These
Thanks,
Mauro
scripts/get_abi.pl +9 -9
@@ -288,18 +288,18 @@ sub output_rest { $desc =~ s/\n[\-\*\=\^\~]+\n/\n/g; if (!($desc =~ /^\s*$/)) { - if ($desc =~ m/\:\n/ || $desc =~ m/\n[\t ]+/ || $desc =~ m/[\x00-\x08\x0b-\x1f\x7b-\xff]/) { - # put everything inside a code block - $desc =~ s/\n/\n /g; +# if ($desc =~ m/\:\n/ || $desc =~ m/\n[\t ]+/ || $desc =~ m/[\x00-\x08\x0b-\x1f\x7b-\xff]/) { +# # put everything inside a code block +# $desc =~ s/\n/\n /g; - print "::\n\n"; - print " $desc\n\n"; - } else { - # Escape any special chars from description - $desc =~s/([\x00-\x08\x0b-\x1f\x21-\x2a\x2d\x2f\x3c-\x40\x5c\x5e-\x60\x7b-\xff])/\\$1/g; +# print "::\n\n"; +# print " $desc\n\n"; +# } else { +# # Escape any special chars from description +# $desc =~s/([\x00-\x08\x0b-\x1f\x21-\x2a\x2d\x2f\x3c-\x40\x5c\x5e-\x60\x7b-\xff])/\\$1/g; print "$desc\n\n"; - } +# } } else { print "DESCRIPTION MISSING for $what\n\n" if (!$data{$what}->{is_file}); }
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Jani NikulaEm Tue, 18 Jun 2019 11:47:32 +0300
Jani Nikula <[email protected]> escreveu:
Quoted 6 lines · Mauro Carvalho Chehab
Quoted 2 lines
Yeah, I guess it should be possible to do that. How a python script can identify if it was called by Sphinx, or if it was called directly?
if
__name__== '__main__':# run on the command-line, not imported
Ok, when I have some spare time, I may try to convert one script to python and see how it behaves.
Thanks,
Mauro
Re: [PATCH 04/14] ABI: better identificate tables
In reply to Greg Kroah-HartmanQuoted 18 lines · Greg Kroah-Hartman
Quoted 17 lines · Mauro Carvalho Chehab
Hi Johan,
Em Wed, 19 Jun 2019 14:51:35 +0200
Johan Hovold <[email protected]> escreveu:Quoted 12 lines · Mauro Carvalho Chehab
Quoted 10 lines
From: Mauro Carvalho Chehab <[email protected]>
When parsing via script, it is important to know if the script should consider a description as a literal block that should be displayed as-is, or if the description can be considered as a normal text.
Change descriptions to ensure that the preceding line of a table ends with a colon. That makes easy to identify the need of a literal block.
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
In the cover letter you say that the first four patches of this series, including this one, "fix some ABI descriptions that are violating the syntax described at
Documentation/ABI/README". This seems a bit harsh, given that it's you that is now *introducing* a new syntax requirement to assist your script.Yeah, what's there at the cover letter doesn't apply to this specific patch. The thing is that I wrote this series a lot of time ago (2016/17).
Got it, thanks.
[...]
Quoted 3 lines
Quoted 3 lines
In the specific case of this patch, the ":" there actually makes sense for someone that it is reading it as a text file, and it is an easy hack to make it parse better.
Human readers probably depend on more on tabulation and white space. When the preceding description wasn't using a colon to begin with (and you just replace s/\./:/) it can even look weird, but no big deal.
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
Specifically, this new requirement isn't documented anywhere AFAICT, so how will anyone adding new ABI descriptions learn about it?
Yeah, either that or provide an alternative to "Description" tag, to be used with more complex ABI descriptions.
One of the things that occurred to me, back on 2017, is that we should have a way to to specify that an specific ABI description would have a rich format. Something like:
[...]
Quoted 7 lines
I don't know when "Description" and "RST-Description" would be used. Why not just parse "Description" like rst text and if things are "messy" we fix them up as found, like you did with the ":" here? It doesn't have to be complex, we can always fix them up after-the-fact if new stuff gets added that doesn't quite parse properly.
Just like we do for most kernel-doc formatting :)
But kernel-doc has a documented format, which was sort of the point I was trying to make. If the new get_abi.pl scripts expects a colon I think it should be mentioned somewhere (e.g. Documentation/ABI/README).
Grepping for attribute entries in linux-next still reveals a number descriptions that still lack that colon and use varying formatting. More are bound to be added later, but perhaps that's ok depending on what you're aiming at here.
Johan
Re: [PATCH 04/14] ABI: better identificate tables
Quoted 8 lines · Johan Hovold
Quoted 7 lines
I don't know when "Description" and "RST-Description" would be used. Why not just parse "Description" like rst text and if things are "messy" we fix them up as found, like you did with the ":" here? It doesn't have to be complex, we can always fix them up after-the-fact if new stuff gets added that doesn't quite parse properly.
Just like we do for most kernel-doc formatting :)
Quoted 8 lines
But kernel-doc has a documented format, which was sort of the point I was trying to make. If the new get_abi.pl scripts expects a colon I think it should be mentioned somewhere (e.g.
Documentation/ABI/README).Grepping for attribute entries in linux-next still reveals a number descriptions that still lack that colon and use varying formatting. More are bound to be added later, but perhaps that's ok depending on what you're aiming at here.
I'm aiming for "good enough" to start with, and then we can work through the exceptions.
But given that Mauro hasn't resent the script that does the conversion of the files, I don't know if that will even matter... {hint}
thanks,
greg k-h
Re: [PATCH 04/14] ABI: better identificate tables
Em Thu, 20 Jun 2019 14:54:13 +0200
Greg Kroah-Hartman <[email protected]> escreveu:
Quoted 18 lines · Johan Hovold
Quoted 8 lines
Quoted 7 lines
I don't know when "Description" and "RST-Description" would be used. Why not just parse "Description" like rst text and if things are "messy" we fix them up as found, like you did with the ":" here? It doesn't have to be complex, we can always fix them up after-the-fact if new stuff gets added that doesn't quite parse properly.
Just like we do for most kernel-doc formatting :)
Quoted 8 lines
But kernel-doc has a documented format, which was sort of the point I was trying to make. If the new get_abi.pl scripts expects a colon I think it should be mentioned somewhere (e.g.
Documentation/ABI/README).Grepping for attribute entries in linux-next still reveals a number descriptions that still lack that colon and use varying formatting. More are bound to be added later, but perhaps that's ok depending on what you're aiming at here.
Quoted 5 lines
I'm aiming for "good enough" to start with, and then we can work through the exceptions.
But given that Mauro hasn't resent the script that does the conversion of the files, I don't know if that will even matter... {hint}
It sounds I missed something... are you expecting a new version?
If so, what changes are you expecting?
Thanks,
Mauro
Re: [PATCH 04/14] ABI: better identificate tables
In reply to Mauro Carvalho ChehabEm Wed, 19 Jun 2019 13:14:08 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:
Quoted 142 lines
Em Wed, 19 Jun 2019 17:02:07 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 88 lines · Mauro Carvalho Chehab
Quoted 83 lines
Hi Johan,
Em Wed, 19 Jun 2019 14:51:35 +0200
Johan Hovold <[email protected]> escreveu:Quoted 12 lines · Mauro Carvalho Chehab
Quoted 10 lines
From: Mauro Carvalho Chehab <[email protected]>
When parsing via script, it is important to know if the script should consider a description as a literal block that should be displayed as-is, or if the description can be considered as a normal text.
Change descriptions to ensure that the preceding line of a table ends with a colon. That makes easy to identify the need of a literal block.
Quoted 5 lines
In the cover letter you say that the first four patches of this series, including this one, "fix some ABI descriptions that are violating the syntax described at
Documentation/ABI/README". This seems a bit harsh, given that it's you that is now *introducing* a new syntax requirement to assist your script.Yeah, what's there at the cover letter doesn't apply to this specific patch. The thing is that I wrote this series a lot of time ago (2016/17).
I revived those per a request at KS ML, as we still need to expose the ABI content on some book that will be used by userspace people.
So, I just rebased it on the top of curent Kernel, add a cover letter with the things I remembered and re-sent.
In the specific case of this patch, the ":" there actually makes sense for someone that it is reading it as a text file, and it is an easy hack to make it parse better.
Quoted 2 lines
Specifically, this new requirement isn't documented anywhere AFAICT, so how will anyone adding new ABI descriptions learn about it?
Yeah, either that or provide an alternative to "Description" tag, to be used with more complex ABI descriptions.
One of the things that occurred to me, back on 2017, is that we should have a way to to specify that an specific ABI description would have a rich format. Something like:
What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/pyra/roccatpyra<minor>/actual_cpi
Date: August 2010
Contact: Stefan Achatz <[email protected]>
RST-Description:It is possible to switch the cpi setting of the mouse with the press of a button. When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further processed to receive the real dpi value: ===== ===== VALUE DPI ===== ===== 1 400 2 800 4 1600 ===== =====With that, the script will know that the description contents will be using the ReST markup, and parse it accordingly. Right now, what it does, instead, is to place the description on a code-block, e. g. it will produce this output for the description:
::
It is possible to switch the cpi setting of the mouse with the press of a button.
When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further processed to receive the real dpi value:VALUE DPI
1 400
2 800
4 1600Quoted 3 lines
Greg,
what do you think?
Quoted 7 lines
I don't know when "Description" and "RST-Description" would be used. Why not just parse "Description" like rst text and if things are "messy" we fix them up as found, like you did with the ":" here? It doesn't have to be complex, we can always fix them up after-the-fact if new stuff gets added that doesn't quite parse properly.
Just like we do for most kernel-doc formatting :)
Works for me. Yet, I guess I tried that, back on 2017.
If I'm not mistaken, the initial patchset to solve the broken things won't be small, and will be require a lot of attention in order to identify what's broken and where.
Btw, one thing is to pass at ReST validation. Another thing is to produce something that people can read.
Right now, the pertinent logic at the script I wrote (
scripts/get_abi.pl) is here:if (!($desc =~ /^\s*$/)) { if ($desc =~ m/\:\n/ || $desc =~ m/\n[\t ]+/ || $desc =~ m/[\x00-\x08\x0b-\x1f\x7b-\xff]/) { # put everything inside a code block $desc =~ s/\n/\n /g; print "::\n\n"; print " $desc\n\n"; } else { # Escape any special chars from description $desc =~s/([\x00-\x08\x0b-\x1f\x21-\x2a\x2d\x2f\x3c-\x40\x5c\x5e-\x60\x7b-\xff])/\\$1/g; print "$desc\n\n"; } }If it discovers something weird enough, it just places everything into a comment block. Otherwise, it assumes that it is a plain text and that any special characters should be escaped.
If the above block is replaced by a simple:
print "$desc\n\n";The description content will be handled as a ReST file.
I don't have any time right now to do this change and to handle the warnings that will start to popup.
Btw, a single replace there is enough to show the amount of problems that it will rise, as it will basically break Sphinx build with:
Quoted 7 lines
reading sources... [ 1%] admin-guide/abi-testing
reST markup error:
get_abi.pl rest --dir $srctree/Documentation/ABI/testing:45261: (SEVERE/4) Missing matching underline for section title overline.==========================
PCIe Device AER statistics
These attributes show up under all the devices that are AER capable. These
To be clear here: the problem with the above is that ReST has zero tolerance and actually behaves like a crash, if it receives something like:
==========================
PCIe Device AER statistics
==========================
For it to work, it has to have zero spaces before ===..=== line, e. g.:
==========================
PCIe Device AER statistics
==========================
Ok, maybe we could try to teach the parser a way to identify the initial spacing of the first description line and remove that amount of spaces/tabs for the following lines, but it may require some heuristics.
Thanks,
Mauro
Re: [PATCH 04/14] ABI: better identificate tables
In reply to Mauro Carvalho ChehabQuoted 21 lines · Mauro Carvalho Chehab
Em Thu, 20 Jun 2019 14:54:13 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 18 lines · Johan Hovold
Quoted 16 lines
Quoted 7 lines
I don't know when "Description" and "RST-Description" would be used. Why not just parse "Description" like rst text and if things are "messy" we fix them up as found, like you did with the ":" here? It doesn't have to be complex, we can always fix them up after-the-fact if new stuff gets added that doesn't quite parse properly.
Just like we do for most kernel-doc formatting :)
But kernel-doc has a documented format, which was sort of the point I was trying to make. If the new get_abi.pl scripts expects a colon I think it should be mentioned somewhere (e.g.
Documentation/ABI/README).Grepping for attribute entries in linux-next still reveals a number descriptions that still lack that colon and use varying formatting. More are bound to be added later, but perhaps that's ok depending on what you're aiming at here.
Quoted 7 lines
Quoted 5 lines
I'm aiming for "good enough" to start with, and then we can work through the exceptions.
But given that Mauro hasn't resent the script that does the conversion of the files, I don't know if that will even matter... {hint}
It sounds I missed something... are you expecting a new version?
Yes, the last round of patches didn't have a SPDX header on the script, so I couldn't add it to the tree :(
thanks,
greg k-h
Re: [PATCH 04/14] ABI: better identificate tables
Em Thu, 20 Jun 2019 18:29:45 +0200
Greg Kroah-Hartman <[email protected]> escreveu:
Quoted 25 lines · Mauro Carvalho Chehab
Quoted 24 lines
Em Thu, 20 Jun 2019 14:54:13 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 21 lines · Johan Hovold
Quoted 8 lines
Quoted 7 lines
I don't know when "Description" and "RST-Description" would be used. Why not just parse "Description" like rst text and if things are "messy" we fix them up as found, like you did with the ":" here? It doesn't have to be complex, we can always fix them up after-the-fact if new stuff gets added that doesn't quite parse properly.
Just like we do for most kernel-doc formatting :)
Quoted 8 lines
But kernel-doc has a documented format, which was sort of the point I was trying to make. If the new get_abi.pl scripts expects a colon I think it should be mentioned somewhere (e.g.
Documentation/ABI/README).Grepping for attribute entries in linux-next still reveals a number descriptions that still lack that colon and use varying formatting. More are bound to be added later, but perhaps that's ok depending on what you're aiming at here.
I'm aiming for "good enough" to start with, and then we can work through the exceptions.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
But given that Mauro hasn't resent the script that does the conversion of the files, I don't know if that will even matter... {hint}
It sounds I missed something... are you expecting a new version?
Yes, the last round of patches didn't have a SPDX header on the script, so I couldn't add it to the tree :(
I could swear I sent you a version with SPDX on it... anyway, I'm re-sending the hole thing. The SPDX header addition is on a separate patch.
Thanks,
Mauro
Re: [PATCH 04/14] ABI: better identificate tables
Quoted 31 lines · Mauro Carvalho Chehab
Em Thu, 20 Jun 2019 18:29:45 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 28 lines · Mauro Carvalho Chehab
Quoted 27 lines
Em Thu, 20 Jun 2019 14:54:13 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 23 lines · Johan Hovold
Quoted 8 lines
Quoted 7 lines
I don't know when "Description" and "RST-Description" would be used. Why not just parse "Description" like rst text and if things are "messy" we fix them up as found, like you did with the ":" here? It doesn't have to be complex, we can always fix them up after-the-fact if new stuff gets added that doesn't quite parse properly.
Just like we do for most kernel-doc formatting :)
Quoted 8 lines
But kernel-doc has a documented format, which was sort of the point I was trying to make. If the new get_abi.pl scripts expects a colon I think it should be mentioned somewhere (e.g.
Documentation/ABI/README).Grepping for attribute entries in linux-next still reveals a number descriptions that still lack that colon and use varying formatting. More are bound to be added later, but perhaps that's ok depending on what you're aiming at here.
I'm aiming for "good enough" to start with, and then we can work through the exceptions.
But given that Mauro hasn't resent the script that does the conversion of the files, I don't know if that will even matter... {hint}
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It sounds I missed something... are you expecting a new version?
Yes, the last round of patches didn't have a SPDX header on the script, so I couldn't add it to the tree :(
I could swear I sent you a version with SPDX on it... anyway, I'm re-sending the hole thing. The SPDX header addition is on a separate patch.
Ah, you didn't cc: me on the whole thread this time, that's why I missed it last time. I sucked it off lkml now, will look at it in the morning.
thanks,
greg k-h
Re: [PATCH 04/14] ABI: better identificate tables
In reply to Mauro Carvalho ChehabQuoted 162 lines · Mauro Carvalho Chehab
Em Wed, 19 Jun 2019 13:14:08 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:Quoted 142 lines
Em Wed, 19 Jun 2019 17:02:07 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 88 lines · Mauro Carvalho Chehab
Quoted 83 lines
Hi Johan,
Em Wed, 19 Jun 2019 14:51:35 +0200
Johan Hovold <[email protected]> escreveu:Quoted 12 lines · Mauro Carvalho Chehab
Quoted 10 lines
From: Mauro Carvalho Chehab <[email protected]>
When parsing via script, it is important to know if the script should consider a description as a literal block that should be displayed as-is, or if the description can be considered as a normal text.
Change descriptions to ensure that the preceding line of a table ends with a colon. That makes easy to identify the need of a literal block.
Quoted 5 lines
In the cover letter you say that the first four patches of this series, including this one, "fix some ABI descriptions that are violating the syntax described at
Documentation/ABI/README". This seems a bit harsh, given that it's you that is now *introducing* a new syntax requirement to assist your script.Yeah, what's there at the cover letter doesn't apply to this specific patch. The thing is that I wrote this series a lot of time ago (2016/17).
I revived those per a request at KS ML, as we still need to expose the ABI content on some book that will be used by userspace people.
So, I just rebased it on the top of curent Kernel, add a cover letter with the things I remembered and re-sent.
In the specific case of this patch, the ":" there actually makes sense for someone that it is reading it as a text file, and it is an easy hack to make it parse better.
Quoted 2 lines
Specifically, this new requirement isn't documented anywhere AFAICT, so how will anyone adding new ABI descriptions learn about it?
Yeah, either that or provide an alternative to "Description" tag, to be used with more complex ABI descriptions.
One of the things that occurred to me, back on 2017, is that we should have a way to to specify that an specific ABI description would have a rich format. Something like:
What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/pyra/roccatpyra<minor>/actual_cpi
Date: August 2010
Contact: Stefan Achatz <[email protected]>
RST-Description:It is possible to switch the cpi setting of the mouse with the press of a button. When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further processed to receive the real dpi value: ===== ===== VALUE DPI ===== ===== 1 400 2 800 4 1600 ===== =====With that, the script will know that the description contents will be using the ReST markup, and parse it accordingly. Right now, what it does, instead, is to place the description on a code-block, e. g. it will produce this output for the description:
::
It is possible to switch the cpi setting of the mouse with the press of a button.
When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further processed to receive the real dpi value:VALUE DPI
1 400
2 800
4 1600Quoted 3 lines
Greg,
what do you think?
Quoted 7 lines
I don't know when "Description" and "RST-Description" would be used. Why not just parse "Description" like rst text and if things are "messy" we fix them up as found, like you did with the ":" here? It doesn't have to be complex, we can always fix them up after-the-fact if new stuff gets added that doesn't quite parse properly.
Just like we do for most kernel-doc formatting :)
Works for me. Yet, I guess I tried that, back on 2017.
If I'm not mistaken, the initial patchset to solve the broken things won't be small, and will be require a lot of attention in order to identify what's broken and where.
Btw, one thing is to pass at ReST validation. Another thing is to produce something that people can read.
Right now, the pertinent logic at the script I wrote (
scripts/get_abi.pl) is here:if (!($desc =~ /^\s*$/)) { if ($desc =~ m/\:\n/ || $desc =~ m/\n[\t ]+/ || $desc =~ m/[\x00-\x08\x0b-\x1f\x7b-\xff]/) { # put everything inside a code block $desc =~ s/\n/\n /g; print "::\n\n"; print " $desc\n\n"; } else { # Escape any special chars from description $desc =~s/([\x00-\x08\x0b-\x1f\x21-\x2a\x2d\x2f\x3c-\x40\x5c\x5e-\x60\x7b-\xff])/\\$1/g; print "$desc\n\n"; } }If it discovers something weird enough, it just places everything into a comment block. Otherwise, it assumes that it is a plain text and that any special characters should be escaped.
If the above block is replaced by a simple:
print "$desc\n\n";The description content will be handled as a ReST file.
I don't have any time right now to do this change and to handle the warnings that will start to popup.
Btw, a single replace there is enough to show the amount of problems that it will rise, as it will basically break Sphinx build with:
Quoted 7 lines
reading sources... [ 1%] admin-guide/abi-testing
reST markup error:
get_abi.pl rest --dir $srctree/Documentation/ABI/testing:45261: (SEVERE/4) Missing matching underline for section title overline.==========================
PCIe Device AER statistics
These attributes show up under all the devices that are AER capable. TheseTo be clear here: the problem with the above is that ReST has zero tolerance and actually behaves like a crash, if it receives something like:
========================== PCIe Device AER statistics ==========================For it to work, it has to have zero spaces before ===..=== line, e. g.:
Quoted 7 lines
==========================
PCIe Device AER statistics
==========================Ok, maybe we could try to teach the parser a way to identify the initial spacing of the first description line and remove that amount of spaces/tabs for the following lines, but it may require some heuristics.
Or we can clean this type of thing up by hand :)
Let's see how bad this gets, the documentation in these files should not be very complex as they _should_ only be one-value-per-file, but as you have shown in this very example, that rule is violated :(
thanks,
greg k-h
Re: [PATCH 04/14] ABI: better identificate tables
Em Fri, 21 Jun 2019 09:21:52 +0200
Greg Kroah-Hartman <[email protected]> escreveu:
Quoted 171 lines · Mauro Carvalho Chehab
Quoted 162 lines
Em Wed, 19 Jun 2019 13:14:08 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:Quoted 142 lines
Em Wed, 19 Jun 2019 17:02:07 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 88 lines · Mauro Carvalho Chehab
Quoted 83 lines
Hi Johan,
Em Wed, 19 Jun 2019 14:51:35 +0200
Johan Hovold <[email protected]> escreveu:Quoted 12 lines · Mauro Carvalho Chehab
Quoted 10 lines
From: Mauro Carvalho Chehab <[email protected]>
When parsing via script, it is important to know if the script should consider a description as a literal block that should be displayed as-is, or if the description can be considered as a normal text.
Change descriptions to ensure that the preceding line of a table ends with a colon. That makes easy to identify the need of a literal block.
Quoted 5 lines
In the cover letter you say that the first four patches of this series, including this one, "fix some ABI descriptions that are violating the syntax described at
Documentation/ABI/README". This seems a bit harsh, given that it's you that is now *introducing* a new syntax requirement to assist your script.Yeah, what's there at the cover letter doesn't apply to this specific patch. The thing is that I wrote this series a lot of time ago (2016/17).
I revived those per a request at KS ML, as we still need to expose the ABI content on some book that will be used by userspace people.
So, I just rebased it on the top of curent Kernel, add a cover letter with the things I remembered and re-sent.
In the specific case of this patch, the ":" there actually makes sense for someone that it is reading it as a text file, and it is an easy hack to make it parse better.
Quoted 2 lines
Specifically, this new requirement isn't documented anywhere AFAICT, so how will anyone adding new ABI descriptions learn about it?
Yeah, either that or provide an alternative to "Description" tag, to be used with more complex ABI descriptions.
One of the things that occurred to me, back on 2017, is that we should have a way to to specify that an specific ABI description would have a rich format. Something like:
What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/pyra/roccatpyra<minor>/actual_cpi
Date: August 2010
Contact: Stefan Achatz <[email protected]>
RST-Description:It is possible to switch the cpi setting of the mouse with the press of a button. When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further processed to receive the real dpi value: ===== ===== VALUE DPI ===== ===== 1 400 2 800 4 1600 ===== =====With that, the script will know that the description contents will be using the ReST markup, and parse it accordingly. Right now, what it does, instead, is to place the description on a code-block, e. g. it will produce this output for the description:
::
It is possible to switch the cpi setting of the mouse with the press of a button.
When read, this file returns the raw number of the actual cpi setting reported by the mouse. This number has to be further processed to receive the real dpi value:VALUE DPI
1 400
2 800
4 1600Quoted 3 lines
Greg,
what do you think?
Quoted 7 lines
I don't know when "Description" and "RST-Description" would be used. Why not just parse "Description" like rst text and if things are "messy" we fix them up as found, like you did with the ":" here? It doesn't have to be complex, we can always fix them up after-the-fact if new stuff gets added that doesn't quite parse properly.
Just like we do for most kernel-doc formatting :)
Works for me. Yet, I guess I tried that, back on 2017.
If I'm not mistaken, the initial patchset to solve the broken things won't be small, and will be require a lot of attention in order to identify what's broken and where.
Btw, one thing is to pass at ReST validation. Another thing is to produce something that people can read.
Right now, the pertinent logic at the script I wrote (
scripts/get_abi.pl) is here:if (!($desc =~ /^\s*$/)) { if ($desc =~ m/\:\n/ || $desc =~ m/\n[\t ]+/ || $desc =~ m/[\x00-\x08\x0b-\x1f\x7b-\xff]/) { # put everything inside a code block $desc =~ s/\n/\n /g; print "::\n\n"; print " $desc\n\n"; } else { # Escape any special chars from description $desc =~s/([\x00-\x08\x0b-\x1f\x21-\x2a\x2d\x2f\x3c-\x40\x5c\x5e-\x60\x7b-\xff])/\\$1/g; print "$desc\n\n"; } }If it discovers something weird enough, it just places everything into a comment block. Otherwise, it assumes that it is a plain text and that any special characters should be escaped.
If the above block is replaced by a simple:
print "$desc\n\n";The description content will be handled as a ReST file.
I don't have any time right now to do this change and to handle the warnings that will start to popup.
Btw, a single replace there is enough to show the amount of problems that it will rise, as it will basically break Sphinx build with:
Quoted 7 lines
reading sources... [ 1%] admin-guide/abi-testing
reST markup error:
get_abi.pl rest --dir $srctree/Documentation/ABI/testing:45261: (SEVERE/4) Missing matching underline for section title overline.==========================
PCIe Device AER statistics
These attributes show up under all the devices that are AER capable. TheseTo be clear here: the problem with the above is that ReST has zero tolerance and actually behaves like a crash, if it receives something like:
========================== PCIe Device AER statistics ==========================For it to work, it has to have zero spaces before ===..=== line, e. g.:
Quoted 7 lines
==========================
PCIe Device AER statistics
==========================Ok, maybe we could try to teach the parser a way to identify the initial spacing of the first description line and remove that amount of spaces/tabs for the following lines, but it may require some heuristics.
Quoted 5 lines
Or we can clean this type of thing up by hand :)
Let's see how bad this gets, the documentation in these files should not be very complex as they _should_ only be one-value-per-file, but as you have shown in this very example, that rule is violated :(
Hi Greg,
Doing a manual review - still incomplete (just stable/ dir) - and I didn't try to run the script over ABI file yet - this is what I found so far[1]: 17 files over 37 needed adjustments (45%).
That trick of detecting a complex file when it finds a ':' and parse the hole description as a literal block solves most of them.
From the changes below, this file:
Documentation/ABI/stable/sysfs-driver-mlxreg-io
Found a "creative way" to place the "What:" field avoiding long lines...
At least this one should be fixed, as the parser won't handle its content right (it won't complain, but the result output will be wrong).
[1] I also added a note at README that files should be ReST-compatible
Documentation/ABI/README +9 -1
@@ -32,7 +32,7 @@ The different levels of stability are: layout of the files below for details on how to do this.) obsolete/ - This directory documents interfaces that are still remaining in + This directory documents interfaces that are still remaining in the kernel, but are marked to be removed at some later point in time. The description of the interface will document the reason why it is obsolete and when it can be expected to be removed.
@@ -58,6 +58,14 @@ Users: All users of this interface who wish to be notified when be changed further. +Note: + The fields should be use a simple notation, compatible with ReST markup. + Also, the file **should not** have a top-level index, like:: + + === + foo + === + How things move between levels: Interfaces in stable may move to obsolete, as long as the proper
Documentation/ABI/stable/firewire-cdev +2 -0
@@ -20,6 +20,7 @@ Description: - Query node ID - Query maximum speed of the path between this node and local node + - The 1394 bus (i.e. "card") to which the node is attached to: - Isochronous stream transmission and reception - Asynchronous stream transmission and reception
@@ -31,6 +32,7 @@ Description: manager - Query cycle time - Bus reset initiation, bus reset event reception + - All 1394 buses: - Allocation of IEEE 1212 address ranges on the local link layers, reception of inbound requests to such
Documentation/ABI/stable/sysfs-acpi-pmprofile +11 -8
@@ -11,12 +11,15 @@ Values: For possible values see ACPI specification: Field: Preferred_PM_Profile Currently these values are defined by spec: - 0 Unspecified - 1 Desktop - 2 Mobile - 3 Workstation - 4 Enterprise Server - 5 SOHO Server - 6 Appliance PC - 7 Performance Server + + == ================= + 0 Unspecified + 1 Desktop + 2 Mobile + 3 Workstation + 4 Enterprise Server + 5 SOHO Server + 6 Appliance PC + 7 Performance Server >7 Reserved + == =================
Documentation/ABI/stable/sysfs-bus-firewire +2 -0
@@ -125,7 +125,9 @@ Description: Read-only attribute, immutable during the target's lifetime. Format, as exposed by firewire-sbp2 since 2.6.22, May 2007: Colon-separated hexadecimal string representations of + u64 EUI-64 : u24 directory_ID : u16 LUN + without 0x prefixes, without whitespace. The former sbp2 driver (removed in 2.6.37 after being superseded by firewire-sbp2) used a somewhat shorter format which was not as close to SAM.
Documentation/ABI/stable/sysfs-bus-nvmem +10 -9
@@ -9,13 +9,14 @@ Description: Note: This file is only present if CONFIG_NVMEM_SYSFS is enabled - ex: - hexdump /sys/bus/nvmem/devices/qfprom0/nvmem + ex:: - 0000000 0000 0000 0000 0000 0000 0000 0000 0000 - * - 00000a0 db10 2240 0000 e000 0c00 0c00 0000 0c00 - 0000000 0000 0000 0000 0000 0000 0000 0000 0000 - ... - * - 0001000 + hexdump /sys/bus/nvmem/devices/qfprom0/nvmem + + 0000000 0000 0000 0000 0000 0000 0000 0000 0000 + * + 00000a0 db10 2240 0000 e000 0c00 0c00 0000 0c00 + 0000000 0000 0000 0000 0000 0000 0000 0000 0000 + ... + * + 0001000
Documentation/ABI/stable/sysfs-bus-usb +4 -2
@@ -50,8 +50,10 @@ Description: Tools can use this file and the connected_duration file to compute the percentage of time that a device has been active. - For example, - echo $((100 * `cat active_duration` / `cat connected_duration`)) + For example:: + + echo $((100 * `cat active_duration` / `cat connected_duration`)) + will give an integer percentage. Note that this does not account for counter wrap. Users:
Documentation/ABI/stable/sysfs-class-backlight +1 -0
@@ -4,6 +4,7 @@ KernelVersion: 2.6.12 Contact: Richard Purdie <[email protected]> Description: Control BACKLIGHT power, values are FB_BLANK_* from fb.h + - FB_BLANK_UNBLANK (0) : power on. - FB_BLANK_POWERDOWN (4) : power off Users: HAL
Documentation/ABI/stable/sysfs-class-infiniband +67 -21
361 lines not on this page · raw message
Documentation/ABI/stable/sysfs-class-rfkill +3 -0
@@ -54,6 +54,7 @@ Description: Current state of the transmitter. through this interface. There will likely be another attempt to remove it in the future. Values: A numeric value. + 0: RFKILL_STATE_SOFT_BLOCKED transmitter is turned off by software 1: RFKILL_STATE_UNBLOCKED
@@ -69,6 +70,7 @@ KernelVersion v2.6.34 Contact: [email protected] Description: Current hardblock state. This file is read only. Values: A numeric value. + 0: inactive The transmitter is (potentially) active. 1: active
@@ -82,6 +84,7 @@ KernelVersion v2.6.34 Contact: [email protected] Description: Current softblock state. This file is read and write. Values: A numeric value. + 0: inactive The transmitter is (potentially) active. 1: active
Documentation/ABI/stable/sysfs-class-tpm +48 -48
135 lines not on this page · raw message
Documentation/ABI/stable/sysfs-devices +3 -2
@@ -1,5 +1,6 @@ -# Note: This documents additional properties of any device beyond what -# is documented in Documentation/admin-guide/sysfs-rules.rst +Note: + This documents additional properties of any device beyond what + is documented in Documentation/admin-guide/sysfs-rules.rst What: /sys/devices/*/of_node Date: February 2015
Documentation/ABI/stable/sysfs-driver-ib_srp +1 -0
@@ -6,6 +6,7 @@ Description: Interface for making ib_srp connect to a new target. One can request ib_srp to connect to a new target by writing a comma-separated list of login parameters to this sysfs attribute. The supported parameters are: + * id_ext, a 16-digit hexadecimal number specifying the eight byte identifier extension in the 16-byte SRP target port identifier. The target port identifier is sent by ib_srp
Documentation/ABI/stable/sysfs-driver-mlxreg-io +19 -26
84 lines not on this page · raw message
Documentation/ABI/stable/sysfs-firmware-efi-vars +4 -0
@@ -17,6 +17,7 @@ Description: directory has a name of the form "<key>-<vendor guid>" and contains the following files: + =============== ======================================== attributes: A read-only text file enumerating the EFI variable flags. Potential values include:
@@ -59,12 +60,14 @@ Description: size: As ASCII representation of the size of the variable's value. + =============== ======================================== In addition, two other magic binary files are provided in the top-level directory and are used for adding and removing variables: + =============== ======================================== new_var: Takes a "struct efi_variable" and instructs the EFI firmware to create a new variable.
@@ -73,3 +76,4 @@ Description: instructs the EFI firmware to remove any variable that has a matching vendor GUID and variable key name. + =============== ========================================
Documentation/ABI/stable/sysfs-firmware-opal-dump +5 -0
@@ -7,6 +7,7 @@ Description: This is only for the powerpc/powernv platform. + =============== =============================================== initiate_dump: When '1' is written to it, we will initiate a dump. Read this file for supported commands.
@@ -19,8 +20,11 @@ Description: and ID of the dump, use the id and type files. Do not rely on any particular size of dump type or dump id. + =============== =============================================== Each dump has the following files: + + =============== =============================================== id: An ASCII representation of the dump ID in hex (e.g. '0x01') type: An ASCII representation of the type of
@@ -39,3 +43,4 @@ Description: inaccessible. Reading this file will get a list of supported actions. + =============== ===============================================
Documentation/ABI/stable/sysfs-firmware-opal-elog +2 -0
@@ -38,6 +38,7 @@ Description: For each log entry (directory), there are the following files: + ============== ================================================ id: An ASCII representation of the ID of the error log, in hex - e.g. "0x01".
@@ -58,3 +59,4 @@ Description: entry will be removed from sysfs. Reading this file will list the supported operations (currently just acknowledge). + ============== ================================================
Documentation/ABI/stable/sysfs-hypervisor-xen +2 -0
@@ -33,6 +33,7 @@ Description: If running under Xen: Space separated list of supported guest system types. Each type is in the format: <class>-<major>.<minor>-<arch> With: + ======== ============================================ <class>: "xen" -- x86: paravirtualized, arm: standard "hvm" -- x86 only: fully virtualized <major>: major guest interface version
@@ -43,6 +44,7 @@ Description: If running under Xen: "x86_64": 64 bit x86 guest "armv7l": 32 bit arm guest "aarch64": 64 bit arm guest + ======== ============================================ What: /sys/hypervisor/properties/changeset Date: March 2009
Documentation/ABI/stable/vdso +3 -2
@@ -23,6 +23,7 @@ Unless otherwise noted, the set of symbols with any given version and the ABI of those symbols is considered stable. It may vary across architectures, though. -(As of this writing, this ABI documentation as been confirmed for x86_64. +Note: + As of this writing, this ABI documentation as been confirmed for x86_64. The maintainers of the other vDSO-using architectures should confirm - that it is correct for their architecture.) + that it is correct for their architecture.
Thanks,
Mauro
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
In reply to Mauro Carvalho ChehabEm Wed, 19 Jun 2019 13:37:39 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:
Quoted 4 lines
Em Tue, 18 Jun 2019 11:47:32 +0300
Jani Nikula <[email protected]> escreveu:Quoted 1 line · Mauro Carvalho Chehab
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Yeah, I guess it should be possible to do that. How a python script can identify if it was called by Sphinx, or if it was called directly?
if
__name__== '__main__':# run on the command-line, not importedOk, when I have some spare time, I may try to convert one script to python and see how it behaves.
Did a quick test here...
Probably I'm doing something wrong (as I'm a rookie with Python), but, in order to be able to use the same script as command line and as an Sphinx extension, everything that it is currently there should be "escaped" by an:
if __name__ != '__main__':
As event the class definition:
class KernelCmd(Directive):
depends on:
from docutils.parsers.rst import directives, Directive
With is only required when one needs to parse ReST - e. g. only when the script runs as a Sphinx extension.
If this is right, as we want a script that can run by command line to parse and search inside ABI files, at the end of the day, it will be a lot easier to maintain if the parser script is different from the Sphinx extension.
If so, as the Sphinx extension script will need to call a parsing script anyway, it doesn't matter the language of the script with will be doing the ABI file parsing.
See the enclosing file. I didn't add anything from the ABI parsing script yet. It was just changed in order to not generate an error when trying to run it from command line.
Thanks,
Mauro
#!/usr/bin/env python3
# coding=utf-8
# SPDX-License-Identifier: GPL-2.0
#
u"""
kernel-abi
~~~~~~~~~~
Implementation of the ``kernel-abi`` reST-directive.
:copyright: Copyright (C) 2016 Markus Heiser :copyright: Copyright (C) 2016-2019 Mauro Carvalho Chehab :maintained-by: Mauro Carvalho Chehab <[email protected]>
:license: GPL Version 2, June 1991 see Linux/COPYING for details.
The ``kernel-abi`` (:py:class:KernelCmd) directive calls the scripts/get_abi.pl script to parse the Kernel ABI files.
Overview of directive's argument and options.
.. code-block:: rst
.. kernel-abi:: <ABI directory location>
:debug:
The argument ``<ABI directory location>`` is required. It contains the location of the ABI files to be parsed.
``debug``
Inserts a code-block with the *raw* reST. Sometimes it is helpful to see what reST is generated.
"""
import codecs
import os
import subprocess
import sys
from os import path
if __name__ != '__main__':
from docutils import nodes, statemachine
from docutils.statemachine import ViewList from docutils.parsers.rst import directives, Directive from docutils.utils.error_reporting import ErrorString
#
# AutodocReporter is only good up to Sphinx 1.7 #
import sphinx
Use_SSI = sphinx.__version__[:3] >= '1.7'
if Use_SSI:
from sphinx.util.docutils import switch_source_input
else:
from sphinx.ext.autodoc import AutodocReporter
__version__ = '1.0'
if __name__ != '__main__':
def setup(app):
app.add_directive("kernel-abi", KernelCmd) return dict(
version = __version__
, parallel_read_safe = True
, parallel_write_safe = True
)
class KernelCmd(Directive):
u"""KernelABI (``kernel-abi``) directive"""
required_arguments = 1
optional_arguments = 2
has_content = False
final_argument_whitespace = True
option_spec = {
"debug" : directives.flag,
"rst" : directives.unchanged
}
def warn(self, message, **replace):
replace["fname"] = self.state.document.current_source
replace["line_no"] = replace.get("line_no", self.lineno) message = ("%(fname)s:%(line_no)s: [kernel-abi WARN] : " + message) % replace self.state.document.settings.env.app.warn(message, prefix="")
def run(self):
doc = self.state.document
if not doc.settings.file_insertion_enabled:
raise self.warning("docutils: file insertion disabled")
env = doc.settings.env
cwd = path.dirname(doc.current_source) fname = self.arguments[0]
cmd = "get_abi.pl rest --dir "
cmd += fname
if 'rst' in self.options:
cmd += " --rst-source"
srctree = path.abspath(os.environ["srctree"])
# extend PATH with $(srctree)/scripts
path_env = os.pathsep.join([
srctree + os.sep + "scripts",
os.environ["PATH"]
])
shell_env = os.environ.copy()
shell_env["PATH"] = path_env
shell_env["srctree"] = srctree
lines = self.runCmd(cmd, shell=True, cwd=cwd, env=shell_env) nodeList = self.nestedParse(lines, self.arguments[0]) return nodeList
def runCmd(self, cmd, **kwargs):
u"""Run command ``cmd`` and return it's stdout as unicode."""
try:
proc = subprocess.Popen(
cmd
, stdout = subprocess.PIPE
, stderr = subprocess.PIPE
, **kwargs
)
out, err = proc.communicate()
out, err = codecs.decode(out, 'utf-8'), codecs.decode(err, 'utf-8')
if proc.returncode != 0:
raise self.severe(
u"command '%s' failed with return code %d" % (cmd, proc.returncode)
)
except OSError as exc:
raise self.severe(u"problems with '%s' directive: %s."
% (self.name, ErrorString(exc)))
return out
def nestedParse(self, lines, fname):
content = ViewList()
node = nodes.section()
if "debug" in self.options:
code_block = "\n\n.. code-block:: rst\n :linenos:\n"
for l in lines.split("\n"):
code_block += "\n " + l
lines = code_block + "\n\n"
for c, l in enumerate(lines.split("\n")):
content.append(l, fname, c)
buf = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter
if Use_SSI:
with switch_source_input(self.state, content):
self.state.nested_parse(content, 0, node, match_titles=1)
else:
self.state.memo.title_styles = []
self.state.memo.section_level = 0
self.state.memo.reporter = AutodocReporter(content, self.state.memo.reporter)
try:
self.state.nested_parse(content, 0, node, match_titles=1)
finally:
self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = buf
return node.children
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
Quoted 33 lines · Mauro Carvalho Chehab
Em Wed, 19 Jun 2019 13:37:39 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:Quoted 4 lines
Em Tue, 18 Jun 2019 11:47:32 +0300
Jani Nikula <[email protected]> escreveu:Quoted 1 line · Mauro Carvalho Chehab
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Yeah, I guess it should be possible to do that. How a python script can identify if it was called by Sphinx, or if it was called directly?
if
__name__== '__main__':# run on the command-line, not importedOk, when I have some spare time, I may try to convert one script to python and see how it behaves.
Did a quick test here...
Probably I'm doing something wrong (as I'm a rookie with Python), but, in order to be able to use the same script as command line and as an Sphinx extension, everything that it is currently there should be "escaped" by an:
if __name__ != '__main__':As event the class definition:
class KernelCmd(Directive):
depends on:
from
docutils.parsers.rstimport directives, Directive
Quoted 7 lines
With is only required when one needs to parse ReST - e. g. only when the script runs as a Sphinx extension.
If this is right, as we want a script that can run by command line to parse and search inside ABI files, at the end of the day, it will be a lot easier to maintain if the parser script is different from the Sphinx extension.
Split it into two files, one has the nuts and bolts of parsing and has the "if __name__ == '__main__':" bit to run on the command line, and the other interfaces with Sphinx and imports the parser.
Quoted 3 lines
If so, as the Sphinx extension script will need to call a parsing script anyway, it doesn't matter the language of the script with will be doing the ABI file parsing.
Calling the parser using an API will be easier to use, maintain and extend than using pipes, with all the interleaved sideband information to adjust line numbers and whatnot.
BR,
Jani.
Quoted 181 lines
See the enclosing file. I didn't add anything from the ABI parsing script yet. It was just changed in order to not generate an error when trying to run it from command line.
Thanks,
Mauro
#!/usr/bin/env python3
# coding=utf-8
# SPDX-License-Identifier: GPL-2.0
#
u"""
kernel-abi
~~~~~~~~~~Implementation of the ``kernel-abi`` reST-directive.
:copyright: Copyright (C) 2016 Markus Heiser :copyright: Copyright (C) 2016-2019 Mauro Carvalho Chehab :maintained-by: Mauro Carvalho Chehab <[email protected]>
:license: GPL Version 2, June 1991 see Linux/COPYING for details.The ``kernel-abi`` (:py:class:
KernelCmd) directive calls thescripts/get_abi.plscript to parse the Kernel ABI files.Overview of directive's argument and options.
.. code-block:: rst
.. kernel-abi:: <ABI directory location>
:debug:The argument ``<ABI directory location>`` is required. It contains the location of the ABI files to be parsed.
``debug``
Inserts a code-block with the *raw* reST. Sometimes it is helpful to see what reST is generated."""
import codecs
import os
import subprocess
import sysfrom os import path
if
__name__!= '__main__':
from docutils import nodes, statemachine
from docutils.statemachine import ViewList fromdocutils.parsers.rstimport directives, Directive from docutils.utils.error_reporting import ErrorString#
# AutodocReporter is only good up to Sphinx 1.7 #
import sphinx
Use_SSI= sphinx.__version__[:3] >= '1.7'
ifUse_SSI:
from sphinx.util.docutils importswitch_source_input
else:
from sphinx.ext.autodoc import AutodocReporter
__version__= '1.0'if
__name__!= '__main__':
def setup(app):
app.add_directive("kernel-abi", KernelCmd)return dict(
version =__version__
,parallel_read_safe= True
,parallel_write_safe= True
)class KernelCmd(Directive):
u"""KernelABI (``kernel-abi``) directive"""
required_arguments= 1
optional_arguments= 2
has_content= False
final_argument_whitespace= True
option_spec= {
"debug" : directives.flag,
"rst" : directives.unchanged
}def
warn(self, message, **replace):
replace["fname"] = self.state.document.current_source
replace["line_no"] =replace.get("line_no", self.lineno)message = ("%(fname)s:%(line_no)s: [kernel-abi WARN] : " + message) % replaceself.state.document.settings.env.app.warn(message, prefix="")def run(self):
doc = self.state.document
if not doc.settings.file_insertion_enabled:
raiseself.warning("docutils: file insertion disabled")env = doc.settings.env
cwd =path.dirname(doc.current_source)fname = self.arguments[0]cmd = "get_abi.pl rest --dir "
cmd += fnameif 'rst' in self.options:
cmd += " --rst-source"srctree =
path.abspath(os.environ["srctree"])# extend PATH with $(srctree)/scripts
path_env= os.pathsep.join([
srctree + os.sep + "scripts",
os.environ["PATH"]
])
shell_env=os.environ.copy()
shell_env["PATH"] =path_env
shell_env["srctree"] = srctreelines =
self.runCmd(cmd, shell=True, cwd=cwd, env=shell_env)nodeList =self.nestedParse(lines, self.arguments[0])return nodeListdef
runCmd(self, cmd, **kwargs):
u"""Run command ``cmd`` and return it's stdout as unicode."""try:
proc = subprocess.Popen(
cmd
, stdout = subprocess.PIPE
, stderr = subprocess.PIPE
, **kwargs
)
out, err =proc.communicate()out, err =
codecs.decode(out, 'utf-8'),codecs.decode(err, 'utf-8')if proc.returncode != 0:
raise self.severe(
u"command '%s' failed with return code %d" % (cmd, proc.returncode)
)
except OSError as exc:
raise self.severe(u"problems with '%s' directive: %s."
% (self.name, ErrorString(exc)))
return outdef
nestedParse(self, lines, fname):
content =ViewList()
node =nodes.section()if "debug" in self.options:
code_block= "\n\n.. code-block:: rst\n :linenos:\n"
for l inlines.split("\n"):
code_block+= "\n " + l
lines =code_block+ "\n\n"for c, l in enumerate(lines.split("\n")):
content.append(l, fname, c)buf = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter
if
Use_SSI:
withswitch_source_input(self.state, content):
self.state.nested_parse(content, 0, node, match_titles=1)
else:
self.state.memo.title_styles = []
self.state.memo.section_level = 0
self.state.memo.reporter =AutodocReporter(content, self.state.memo.reporter)
try:
self.state.nested_parse(content, 0, node, match_titles=1)
finally:
self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = bufreturn node.children
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [PATCH 12/14] doc-rst: add ABI documentation to the admin-guide book
Em Thu, 27 Jun 2019 12:48:12 +0300
Jani Nikula <[email protected]> escreveu:
Quoted 37 lines · Mauro Carvalho Chehab
Quoted 36 lines
Em Wed, 19 Jun 2019 13:37:39 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:Quoted 4 lines
Em Tue, 18 Jun 2019 11:47:32 +0300
Jani Nikula <[email protected]> escreveu:Quoted 1 line · Mauro Carvalho Chehab
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Yeah, I guess it should be possible to do that. How a python script can identify if it was called by Sphinx, or if it was called directly?
if
__name__== '__main__':# run on the command-line, not importedOk, when I have some spare time, I may try to convert one script to python and see how it behaves.
Did a quick test here...
Probably I'm doing something wrong (as I'm a rookie with Python), but, in order to be able to use the same script as command line and as an Sphinx extension, everything that it is currently there should be "escaped" by an:
if __name__ != '__main__':As event the class definition:
class KernelCmd(Directive):
depends on:
from
docutils.parsers.rstimport directives, DirectiveWith is only required when one needs to parse ReST - e. g. only when the script runs as a Sphinx extension.
Quoted 8 lines
Quoted 4 lines
If this is right, as we want a script that can run by command line to parse and search inside ABI files, at the end of the day, it will be a lot easier to maintain if the parser script is different from the Sphinx extension.
Split it into two files, one has the nuts and bolts of parsing and has the "if
__name__== '__main__':" bit to run on the command line, and the other interfaces with Sphinx and imports the parser.
It seems we have an agreement here: the best is indeed to have two files, one with the Documentation/ABI parser, and another one with the Sphinx extension...
Quoted 8 lines
Quoted 4 lines
If so, as the Sphinx extension script will need to call a parsing script anyway, it doesn't matter the language of the script with will be doing the ABI file parsing.
Calling the parser using an API will be easier to use, maintain and extend than using pipes, with all the interleaved sideband information to adjust line numbers and whatnot.
... and here is where we have two different views.
From debug PoV, the Documentation/ABI parser script should be able to print the results by a command line call. This is also a feature that it is useful for the users: to be able to seek for a symbol and output its ABI description. So, the "stdout" output will be there anyway.
The only extra data for the extension side is the file name where the information came and the line number.
From maintainership PoV, adding the sideband API for file+line is one line at the parser script (a print) and two lines at the Sphinx extension (a regex expression and a match line). That's simple to maintain.
It is also simple to verify both sides independently, as what you see when running the parser script is what you get at the extension.
If we add a new ABI between the parser script and the extension script, this would require to also maintain the ABI, and would make harder to identify problems on ABI problems.
-
Another advantage of having those independent is that the language of the parsing script can be different. Not being python is a big advantage for me, as perl is a lot more intuitive and easier to write parser scripts for my eyes.
I can write a perl parsing script in a matter of minutes. It takes me a lot more time to do the same with python, and then ensure that it will work with two similar but different languages (python2 and python3) [1].
[1] btw, with that regards, I still don't know how to teach a python script that it should "prefer" to run with python3 but would fall back to python2. Adding this shebang:
# /usr/bin/env python
just do the opposite - at least on Fedora
Thanks,
Mauro