2 # SPDX-License-Identifier: GPL-2.0
4 BEGIN { $Pod::Usage::Formatter = 'Pod::Text::Termcap'; }
9 use Pod::Usage qw(pod2usage);
21 my $enable_lineno = 0;
22 my $show_warnings = 1;
23 my $prefix="Documentation/ABI";
24 my $sysfs_prefix="/sys";
28 my $dbg_what_parsing = 1;
29 my $dbg_what_open = 2;
30 my $dbg_dump_abi_structs = 4;
31 my $dbg_undefined = 8;
33 $Data::Dumper::Indent = 1;
34 $Data::Dumper::Terse = 1;
37 # If true, assumes that the description is formatted with ReST
39 my $description_is_rst = 1;
43 "enable-lineno" => \$enable_lineno,
44 "rst-source!" => \$description_is_rst,
47 "show-hints" => \$hint,
48 "search-string=s" => \$search_string,
52 pod2usage(1) if $help;
53 pod2usage(-exitstatus => 0, -noperldoc, -verbose => 2) if $man;
55 pod2usage(2) if (scalar @ARGV < 1 || @ARGV > 2);
57 my ($cmd, $arg) = @ARGV;
59 pod2usage(2) if ($cmd ne "search" && $cmd ne "rest" && $cmd ne "validate" && $cmd ne "undefined");
60 pod2usage(2) if ($cmd eq "search" && !$arg);
62 require Data::Dumper if ($debug & $dbg_dump_abi_structs);
68 # Displays an error message, printing file name and line
70 sub parse_error($$$$) {
71 my ($file, $ln, $msg, $data) = @_;
73 return if (!$show_warnings);
77 print STDERR "Warning: file $file#$ln:\n\t$msg";
80 print STDERR ". Line\n\t\t$data";
87 # Parse an ABI file, storing its contents at %data
90 my $file = $File::Find::name;
92 my $mode = (stat($file))[2];
93 return if ($mode & S_IFDIR);
94 return if ($file =~ m,/README,);
95 return if ($file =~ m,/\.,);
101 $fn =~ s,Documentation/ABI/,,;
103 my $nametag = "File $fn";
104 $data{$nametag}->{what} = "File $name";
105 $data{$nametag}->{type} = "File";
106 $data{$nametag}->{file} = $name;
107 $data{$nametag}->{filepath} = $file;
108 $data{$nametag}->{is_file} = 1;
109 $data{$nametag}->{line_no} = 1;
112 $type =~ s,.*/(.*)/.*,$1,;
123 print STDERR "Opening $file\n" if ($debug & $dbg_what_open);
127 if (m/^(\S+)(:\s*)(.*)/i) {
128 my $new_tag = lc($1);
132 if (!($new_tag =~ m/(what|where|date|kernelversion|contact|description|users)/)) {
133 if ($tag eq "description") {
134 # New "tag" is actually part of
135 # description. Don't consider it a tag
137 } elsif ($tag ne "") {
138 parse_error($file, $ln, "tag '$tag' is invalid", $_);
142 # Invalid, but it is a common mistake
143 if ($new_tag eq "where") {
144 parse_error($file, $ln, "tag 'Where' is invalid. Should be 'What:' instead", "");
148 if ($new_tag =~ m/what/) {
150 $content =~ s/[,.;]$//;
152 push @{$symbols{$content}->{file}}, " $file:" . ($ln - 1);
154 if ($tag =~ m/what/) {
155 $what .= "\xac" . $content;
158 parse_error($file, $ln, "What '$what' doesn't have a description", "") if (!$data{$what}->{description});
160 foreach my $w(split /\xac/, $what) {
161 $symbols{$w}->{xref} = $what;
169 push @labels, [($content, $label)];
172 push @{$data{$nametag}->{symbols}}, $content if ($data{$nametag}->{what});
176 if ($tag ne "" && $new_tag) {
180 @{$data{$what}->{label_list}} = @labels if ($data{$nametag}->{what});
185 $data{$what}->{type} = $type;
186 if (!defined($data{$what}->{file})) {
187 $data{$what}->{file} = $name;
188 $data{$what}->{filepath} = $file;
190 $data{$what}->{description} .= "\n\n" if (defined($data{$what}->{description}));
191 if ($name ne $data{$what}->{file}) {
192 $data{$what}->{file} .= " " . $name;
193 $data{$what}->{filepath} .= " " . $file;
196 print STDERR "\twhat: $what\n" if ($debug & $dbg_what_parsing);
197 $data{$what}->{line_no} = $ln;
199 $data{$what}->{line_no} = $ln if (!defined($data{$what}->{line_no}));
203 parse_error($file, $ln, "'What:' should come first:", $_);
206 if ($new_tag eq "description") {
208 $content = ' ' x length($new_tag) . $sep . $content;
209 while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
210 if ($content =~ m/^(\s*)(\S.*)$/) {
211 # Preserve initial spaces for the first line
214 $data{$what}->{$tag} .= $content;
220 $data{$what}->{$tag} = $content;
226 # Store any contents before tags at the database
227 if (!$tag && $data{$nametag}->{what}) {
228 $data{$nametag}->{description} .= $_;
232 if ($tag eq "description") {
234 while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
236 $data{$what}->{$tag} .= "\n";
240 if (!defined($space)) {
241 # Preserve initial spaces for the first line
242 if ($content =~ m/^(\s*)(\S.*)$/) {
247 $space = "" if (!($content =~ s/^($space)//));
249 $data{$what}->{$tag} .= $content;
254 $data{$what}->{$tag} .= "\n$1";
255 $data{$what}->{$tag} =~ s/\n+$//;
259 # Everything else is error
260 parse_error($file, $ln, "Unexpected content", $_);
262 $data{$nametag}->{description} =~ s/^\n+// if ($data{$nametag}->{description});
264 parse_error($file, $ln, "What '$what' doesn't have a description", "") if (!$data{$what}->{description});
266 foreach my $w(split /\xac/,$what) {
267 $symbols{$w}->{xref} = $what;
276 foreach my $what (keys %data) {
277 next if ($data{$what}->{file} eq "File");
279 foreach my $p (@{$data{$what}->{label_list}}) {
280 my ($content, $label) = @{$p};
281 $label = "abi_" . $label . " ";
282 $label =~ tr/A-Z/a-z/;
284 # Convert special chars to "_"
285 $label =~s/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xff])/_/g;
289 # Avoid duplicated labels
290 while (defined($labels{$label})) {
291 my @chars = ("A".."Z", "a".."z");
292 $label .= $chars[rand @chars];
296 $data{$what}->{label} = $label;
298 # only one label is enough
305 # Outputs the book on ReST format
308 # \b doesn't work well with paths. So, we need to define something else:
309 # Boundaries are punct characters, spaces and end-of-line
310 my $start = qr {(^|\s|\() }x;
311 my $bondary = qr { ([,.:;\)\s]|\z) }x;
312 my $xref_match = qr { $start(\/(sys|config|proc|dev|kvd)\/[^,.:;\)\s]+)$bondary }x;
313 my $symbols = qr { ([\x01-\x08\x0e-\x1f\x21-\x2f\x3a-\x40\x7b-\xff]) }x;
320 foreach my $what (sort {
321 ($data{$a}->{type} eq "File") cmp ($data{$b}->{type} eq "File") ||
324 my $type = $data{$what}->{type};
326 my @file = split / /, $data{$what}->{file};
327 my @filepath = split / /, $data{$what}->{filepath};
329 if ($enable_lineno) {
330 printf ".. LINENO %s%s#%s\n\n",
332 $data{$what}->{line_no};
337 if ($type ne "File") {
338 my $cur_part = $what;
340 if ($what =~ m#^(\/?(?:[\w\-]+\/?){1,2})#) {
341 $cur_part = "Symbols under $1";
346 if ($cur_part ne "" && $part ne $cur_part) {
350 print "$part\n$bar\n\n";
353 printf ".. _%s:\n\n", $data{$what}->{label};
355 my @names = split /\xac/,$w;
358 foreach my $name (@names) {
359 $name =~ s/$symbols/\\$1/g;
361 $len = length($name) if (length($name) > $len);
364 print "+-" . "-" x $len . "-+\n";
365 foreach my $name (@names) {
366 printf "| %s", $name . " " x ($len - length($name)) . " |\n";
367 print "+-" . "-" x $len . "-+\n";
373 for (my $i = 0; $i < scalar(@filepath); $i++) {
374 my $path = $filepath[$i];
377 $path =~ s,.*/(.*/.*),$1,;;
378 $path =~ s,[/\-],_,g;;
379 my $fileref = "abi_file_".$path;
381 if ($type eq "File") {
382 print ".. _$fileref:\n\n";
384 print "Defined on file :ref:`$f <$fileref>`\n\n";
388 if ($type eq "File") {
391 print "$w\n$bar\n\n";
395 $desc = $data{$what}->{description} if (defined($data{$what}->{description}));
398 if (!($desc =~ /^\s*$/)) {
399 if ($description_is_rst) {
400 # Remove title markups from the description
401 # Having titles inside ABI files will only work if extra
402 # care would be taken in order to strictly follow the same
403 # level order for each markup.
404 $desc =~ s/\n[\-\*\=\^\~]+\n/\n\n/g;
406 # Enrich text by creating cross-references
409 my $init_indent = -1;
410 my $literal_indent = -1;
412 open(my $fh, "+<", \$desc);
413 while (my $d = <$fh>) {
414 my $indent = $d =~ m/^(\s+)/;
415 my $spaces = length($indent);
416 $init_indent = $indent if ($init_indent < 0);
417 if ($literal_indent >= 0) {
418 if ($spaces > $literal_indent) {
422 $literal_indent = -1;
425 if ($d =~ /()::$/ && !($d =~ /^\s*\.\./)) {
426 $literal_indent = $spaces;
430 $d =~ s,Documentation/(?!devicetree)(\S+)\.rst,:doc:`/$1`,g;
432 my @matches = $d =~ m,Documentation/ABI/([\w\/\-]+),g;
433 foreach my $f (@matches) {
436 $path =~ s,.*/(.*/.*),$1,;;
437 $path =~ s,[/\-],_,g;;
438 $xref .= " <abi_file_" . $path . ">";
439 $d =~ s,\bDocumentation/ABI/$f\b,:ref:`$xref`,g;
442 # Seek for cross reference symbols like /sys/...
443 @matches = $d =~ m/$xref_match/g;
445 foreach my $s (@matches) {
446 next if (!($s =~ m,/,));
447 if (defined($data{$s}) && defined($data{$s}->{label})) {
450 $xref =~ s/$symbols/\\$1/g;
451 $xref = ":ref:`$xref <" . $data{$s}->{label} . ">`";
453 $d =~ s,$start$s$bondary,$1$xref$2,g;
461 print "$new_desc\n\n";
465 # Remove title markups from the description, as they won't work
466 $desc =~ s/\n[\-\*\=\^\~]+\n/\n\n/g;
468 if ($desc =~ m/\:\n/ || $desc =~ m/\n[\t ]+/ || $desc =~ m/[\x00-\x08\x0b-\x1f\x7b-\xff]/) {
469 # put everything inside a code block
475 # Escape any special chars from description
476 $desc =~s/([\x00-\x08\x0b-\x1f\x21-\x2a\x2d\x2f\x3c-\x40\x5c\x5e-\x60\x7b-\xff])/\\$1/g;
481 print "DESCRIPTION MISSING for $what\n\n" if (!$data{$what}->{is_file});
484 if ($data{$what}->{symbols}) {
485 printf "Has the following ABI:\n\n";
487 foreach my $content(@{$data{$what}->{symbols}}) {
488 my $label = $data{$symbols{$content}->{xref}}->{label};
490 # Escape special chars from content
491 $content =~s/([\x00-\x1f\x21-\x2f\x3a-\x40\x7b-\xff])/\\$1/g;
493 print "- :ref:`$content <$label>`\n\n";
497 if (defined($data{$what}->{users})) {
498 my $users = $data{$what}->{users};
500 $users =~ s/\n/\n\t/g;
501 printf "Users:\n\t%s\n\n", $users if ($users ne "");
508 # Searches for ABI symbols
511 foreach my $what (sort keys %data) {
512 next if (!($what =~ m/($arg)/));
514 my $type = $data{$what}->{type};
515 next if ($type eq "File");
517 my $file = $data{$what}->{filepath};
519 $what =~ s/\xac/, /g;
523 print "\n$what\n$bar\n\n";
525 my $kernelversion = $data{$what}->{kernelversion} if (defined($data{$what}->{kernelversion}));
526 my $contact = $data{$what}->{contact} if (defined($data{$what}->{contact}));
527 my $users = $data{$what}->{users} if (defined($data{$what}->{users}));
528 my $date = $data{$what}->{date} if (defined($data{$what}->{date}));
529 my $desc = $data{$what}->{description} if (defined($data{$what}->{description}));
531 $kernelversion =~ s/^\s+// if ($kernelversion);
532 $contact =~ s/^\s+// if ($contact);
537 $date =~ s/^\s+// if ($date);
538 $desc =~ s/^\s+// if ($desc);
540 printf "Kernel version:\t\t%s\n", $kernelversion if ($kernelversion);
541 printf "Date:\t\t\t%s\n", $date if ($date);
542 printf "Contact:\t\t%s\n", $contact if ($contact);
543 printf "Users:\t\t\t%s\n", $users if ($users);
544 print "Defined on file(s):\t$file\n\n";
545 print "Description:\n\n$desc";
549 # Exclude /sys/kernel/debug and /sys/kernel/tracing from the search path
550 sub dont_parse_special_attributes {
551 if (($File::Find::dir =~ m,^/sys/kernel,)) {
552 return grep {!/(debug|tracing)/ } @_;
555 if (($File::Find::dir =~ m,^/sys/fs,)) {
556 return grep {!/(pstore|bpf|fuse)/ } @_;
572 $dir =~ s,^(.*/).*,$1,;
576 my $file_ref = \%root;
577 foreach my $edge(split "/", $dir) {
579 if (!defined ${$file_ref}{$edge}) {
580 ${$file_ref}{$edge} = { };
582 $file_ref = \%{$$file_ref{$edge}};
583 ${$file_ref}{"__name"} = [ $name ];
586 ${$file_ref}{$file} = {
587 "__name" => [ $name ]
590 return \%{$$file_ref{$file}};
597 # Traverse graph to find the reference
598 my $file_ref = \%root;
599 foreach my $edge(split "/", $file) {
600 $file_ref = \%{$$file_ref{$edge}} || die "Missing node!";
609 push @queue, $file_ref;
613 my $v = shift @queue;
614 my @child = keys(%{$v});
616 foreach my $c(@child) {
617 next if $seen{$$v{$c}};
618 next if ($c eq "__name");
620 if (!defined($$v{$c}{"__name"})) {
621 printf STDERR "Error: Couldn't find a non-empty name on a children of $file/.*: ";
622 print STDERR Dumper(%{$v});
627 my $name = @{$$v{$c}{"__name"}}[0];
628 if ($name =~ s#^$file/#$link/#) {
629 push @{$$v{$c}{"__name"}}, $name;
631 # Add child to the queue and mark as seen
632 push @queue, $$v{$c};
638 my $escape_symbols = qr { ([\x01-\x08\x0e-\x1f\x21-\x29\x2b-\x2d\x3a-\x40\x7b-\xfe]) }x;
639 sub parse_existing_sysfs {
640 my $file = $File::Find::name;
642 my $mode = (lstat($file))[2];
643 my $abs_file = abs_path($file);
647 push @tmp, $abs_file if ($abs_file ne $file);
649 foreach my $f(@tmp) {
650 # Ignore cgroup, as this is big and has zero docs under ABI
651 return if ($f =~ m#^/sys/fs/cgroup/#);
653 # Ignore firmware as it is documented elsewhere
654 # Either ACPI or under Documentation/devicetree/bindings/
655 return if ($f =~ m#^/sys/firmware/#);
657 # Ignore some sysfs nodes that aren't actually part of ABI
658 return if ($f =~ m#/sections|notes/#);
660 # Would need to check at
661 # Documentation/admin-guide/kernel-parameters.txt, but this
662 # is not easily parseable.
663 return if ($f =~ m#/parameters/#);
666 if (S_ISLNK($mode)) {
667 $aliases{$file} = $abs_file;
671 return if (S_ISDIR($mode));
673 # Trivial: file is defined exactly the same way at ABI What:
674 return if (defined($data{$file}));
675 return if (defined($data{$abs_file}));
677 push @files, graph_add_file($abs_file, "file");
691 $leave =~ s/[\(\)]//g;
693 # $leave is used to improve search performance at
694 # check_undefined_symbols, as the algorithm there can seek
695 # for a small number of "what". It also allows giving a
696 # hint about a leave with the same name somewhere else.
697 # However, there are a few occurences where the leave is
698 # either a wildcard or a number. Just group such cases
700 if ($leave =~ m/\.\*/ || $leave eq "" || $leave =~ /\\d/) {
711 my $file_ref = shift;
712 my $names_ref = shift;
713 my @names = @{$names_ref};
714 my $file = $names[0];
718 my $leave = get_leave($file);
719 if (!defined($leaf{$leave})) {
722 my @expr = @{$leaf{$leave}->{expr}};
723 die ("\rmissing rules for $leave") if (!defined($leaf{$leave}));
726 $path =~ s,(.*/).*,$1,;
728 if ($search_string) {
729 return if (!($file =~ m#$search_string#));
733 for (my $i = 0; $i < @names; $i++) {
734 if ($found_string && $hint) {
736 print STDERR "--> $names[$i]\n";
738 print STDERR " $names[$i]\n";
741 foreach my $re (@expr) {
742 print STDERR "$names[$i] =~ /^$re\$/\n" if ($debug && $dbg_undefined);
743 if ($names[$i] =~ $re) {
749 if ($leave ne "others") {
750 my @expr = @{$leaf{"others"}->{expr}};
751 for (my $i = 0; $i < @names; $i++) {
752 foreach my $re (@expr) {
753 print STDERR "$names[$i] =~ /^$re\$/\n" if ($debug && $dbg_undefined);
754 if ($names[$i] =~ $re) {
761 push @not_found, $file if (!$search_string || $found_string);
763 if ($hint && (!$search_string || $found_string)) {
764 my $what = $leaf{$leave}->{what};
765 $what =~ s/\xac/\n\t/g;
766 if ($leave ne "others") {
767 print STDERR "\r more likely regexes:\n\t$what\n";
769 print STDERR "\r tested regexes:\n\t$what\n";
774 sub check_undefined_symbols {
775 my $num_files = scalar @files;
777 my $start_time = times;
779 @files = sort @files;
781 my $last_time = $start_time;
783 # When either debug or hint is enabled, there's no sense showing
784 # progress, as the progress will be overriden.
785 if ($hint || ($debug && $dbg_undefined)) {
786 $next_i = $num_files;
790 $is_console = 1 if (-t STDERR);
792 for (my $i = 0; $i < $num_files; $i++) {
793 my $file_ref = $files[$i];
794 my @names = @{$$file_ref{"__name"}};
796 check_file($file_ref, \@names);
798 my $cur_time = times;
800 if ($i == $next_i || $cur_time > $last_time + 1) {
801 my $percent = $i * 100 / $num_files;
803 my $tm = $cur_time - $start_time;
804 my $time = sprintf "%d:%02d", int($tm), 60 * ($tm - int($tm));
806 printf STDERR "\33[2K\r", if ($is_console);
807 printf STDERR "%s: processing sysfs files... %i%%: $names[0]", $time, $percent;
808 printf STDERR "\n", if (!$is_console);
811 $next_i = int (($percent + 1) * $num_files / 100);
812 $last_time = $cur_time;
816 my $cur_time = times;
817 my $tm = $cur_time - $start_time;
818 my $time = sprintf "%d:%02d", int($tm), 60 * ($tm - int($tm));
820 printf STDERR "\33[2K\r", if ($is_console);
821 printf STDERR "%s: processing sysfs files... done\n", $time;
823 foreach my $file (@not_found) {
824 print "$file not found.\n";
828 sub undefined_symbols {
829 print STDERR "Reading $sysfs_prefix directory contents...";
831 wanted =>\&parse_existing_sysfs,
832 preprocess =>\&dont_parse_special_attributes,
835 print STDERR "done.\n";
837 $leaf{"others"}->{what} = "";
839 print STDERR "Converting ABI What fields into regexes...";
840 foreach my $w (sort keys %data) {
841 foreach my $what (split /\xac/,$w) {
842 next if (!($what =~ m/^$sysfs_prefix/));
844 # Convert what into regular expressions
846 # Escape dot characters
847 $what =~ s/\./\xf6/g;
849 # Temporarily change [0-9]+ type of patterns
850 $what =~ s/\[0\-9\]\+/\xff/g;
852 # Temporarily change [\d+-\d+] type of patterns
853 $what =~ s/\[0\-\d+\]/\xff/g;
854 $what =~ s/\[(\d+)\]/\xf4$1\xf5/g;
856 # Temporarily change [0-9] type of patterns
857 $what =~ s/\[(\d)\-(\d)\]/\xf4$1-$2\xf5/g;
859 # Handle multiple option patterns
860 $what =~ s/[\{\<\[]([\w_]+)(?:[,|]+([\w_]+)){1,}[\}\>\]]/($1|$2)/g;
864 $what =~ s,/\xf6..,/.*,g;
865 $what =~ s/\<[^\>]+\>/.*/g;
866 $what =~ s/\{[^\}]+\}/.*/g;
867 $what =~ s/\[[^\]]+\]/.*/g;
869 $what =~ s/[XYZ]/.*/g;
871 # Recover [0-9] type of patterns
875 # Remove duplicated spaces
878 # Special case: this ABI has a parenthesis on it
879 $what =~ s/sqrt\(x^2\+y^2\+z^2\)/sqrt\(x^2\+y^2\+z^2\)/;
881 # Special case: drop comparition as in:
882 # What: foo = <something>
883 # (this happens on a few IIO definitions)
884 $what =~ s,\s*\=.*$,,;
886 # Escape all other symbols
887 $what =~ s/$escape_symbols/\\$1/g;
888 $what =~ s/\\\\/\\/g;
889 $what =~ s/\\([\[\]\(\)\|])/$1/g;
890 $what =~ s/(\d+)\\(-\d+)/$1$2/g;
892 $what =~ s/\xff/\\d+/g;
894 # Special case: IIO ABI which a parenthesis.
895 $what =~ s/sqrt(.*)/sqrt\(.*\)/;
897 # Simplify regexes with multiple .*
898 $what =~ s#(?:\.\*){2,}##g;
899 # $what =~ s#\.\*/\.\*#.*#g;
901 # Recover dot characters
902 $what =~ s/\xf6/\./g;
904 my $leave = get_leave($what);
907 foreach my $l (split /\|/, $leave) {
908 if (defined($leaf{$l})) {
909 next if ($leaf{$l}->{what} =~ m/\b$what\b/);
910 $leaf{$l}->{what} .= "\xac" . $what;
913 $leaf{$l}->{what} = $what;
917 if ($search_string && $added) {
918 print STDERR "What: $what\n" if ($what =~ m#$search_string#);
924 foreach my $l (sort keys %leaf) {
926 foreach my $w(sort split /\xac/, $leaf{$l}->{what}) {
927 push @expr, qr /^$w$/;
929 $leaf{$l}->{expr} = \@expr;
932 # Take links into account
933 foreach my $link (sort keys %aliases) {
934 my $abs_file = $aliases{$link};
935 graph_add_link($abs_file, $link);
937 print STDERR "done.\n";
939 check_undefined_symbols;
942 # Ensure that the prefix will always end with a slash
943 # While this is not needed for find, it makes the patch nicer
944 # with --enable-lineno
947 if ($cmd eq "undefined" || $cmd eq "search") {
951 # Parses all ABI files located at $prefix dir
953 find({wanted =>\&parse_abi, no_chdir => 1}, $prefix);
955 print STDERR Data::Dumper->Dump([\%data], [qw(*data)]) if ($debug & $dbg_dump_abi_structs);
958 # Handles the command
960 if ($cmd eq "undefined") {
962 } elsif ($cmd eq "search") {
965 if ($cmd eq "rest") {
969 # Warn about duplicated ABI entries
970 foreach my $what(sort keys %symbols) {
971 my @files = @{$symbols{$what}->{file}};
973 next if (scalar(@files) == 1);
975 printf STDERR "Warning: $what is defined %d times: @files\n",
984 get_abi.pl - parse the Linux ABI files and produce a ReST book.
988 B<get_abi.pl> [--debug <level>] [--enable-lineno] [--man] [--help]
989 [--(no-)rst-source] [--dir=<dir>] [--show-hints]
990 [--search-string <regex>]
991 <COMMAND> [<ARGUMENT>]
993 Where B<COMMAND> can be:
997 B<search> I<SEARCH_REGEX> - search for I<SEARCH_REGEX> inside ABI
999 B<rest> - output the ABI in ReST markup language
1001 B<validate> - validate the ABI contents
1003 B<undefined> - existing symbols at the system that aren't
1004 defined at Documentation/ABI
1014 Changes the location of the ABI search. By default, it uses
1015 the Documentation/ABI directory.
1017 =item B<--rst-source> and B<--no-rst-source>
1019 The input file may be using ReST syntax or not. Those two options allow
1020 selecting between a rst-compliant source ABI (B<--rst-source>), or a
1021 plain text that may be violating ReST spec, so it requres some escaping
1022 logic (B<--no-rst-source>).
1024 =item B<--enable-lineno>
1026 Enable output of .. LINENO lines.
1028 =item B<--debug> I<debug level>
1030 Print debug information according with the level, which is given by the
1033 - 1: Debug parsing What entries from ABI files;
1034 - 2: Shows what files are opened from ABI files;
1035 - 4: Dump the structs used to store the contents of the ABI files.
1037 =item B<--show-hints>
1039 Show hints about possible definitions for the missing ABI symbols.
1040 Used only when B<undefined>.
1042 =item B<--search-string> I<regex string>
1044 Show only occurences that match a search string.
1045 Used only when B<undefined>.
1049 Prints a brief help message and exits.
1053 Prints the manual page and exits.
1059 Parse the Linux ABI files from ABI DIR (usually located at Documentation/ABI),
1060 allowing to search for ABI symbols or to produce a ReST book containing
1061 the Linux ABI documentation.
1065 Search for all stable symbols with the word "usb":
1069 $ scripts/get_abi.pl search usb --dir Documentation/ABI/stable
1073 Search for all symbols that match the regex expression "usb.*cap":
1077 $ scripts/get_abi.pl search usb.*cap
1081 Output all obsoleted symbols in ReST format
1085 $ scripts/get_abi.pl rest --dir Documentation/ABI/obsolete
1091 Report bugs to Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1095 Copyright (c) 2016-2021 by Mauro Carvalho Chehab <mchehab+huawei@kernel.org>.
1097 License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>.
1099 This is free software: you are free to change and redistribute it.
1100 There is NO WARRANTY, to the extent permitted by law.