blob: 6a4d387ebf3bbbe29e987c0d66aa4fd92f779bee [file] [log] [blame]
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -03001#!/usr/bin/perl
Mauro Carvalho Chehabecb351f2019-06-20 14:23:10 -03002# SPDX-License-Identifier: GPL-2.0
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -03003
4use strict;
5use Pod::Usage;
6use Getopt::Long;
7use File::Find;
8use Fcntl ':mode';
9
10my $help;
11my $man;
12my $debug;
Mauro Carvalho Chehab61439c42020-10-30 08:40:22 +010013my $enable_lineno;
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -030014my $prefix="Documentation/ABI";
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -030015
Mauro Carvalho Chehab11ce90a2020-10-30 08:40:20 +010016#
17# If true, assumes that the description is formatted with ReST
18#
19my $description_is_rst = 0;
20
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -030021GetOptions(
22 "debug|d+" => \$debug,
Mauro Carvalho Chehab61439c42020-10-30 08:40:22 +010023 "enable-lineno" => \$enable_lineno,
Mauro Carvalho Chehab11ce90a2020-10-30 08:40:20 +010024 "rst-source!" => \$description_is_rst,
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -030025 "dir=s" => \$prefix,
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -030026 'help|?' => \$help,
27 man => \$man
28) or pod2usage(2);
29
30pod2usage(1) if $help;
31pod2usage(-exitstatus => 0, -verbose => 2) if $man;
32
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -030033pod2usage(2) if (scalar @ARGV < 1 || @ARGV > 2);
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -030034
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -030035my ($cmd, $arg) = @ARGV;
36
Mauro Carvalho Chehab7ce7b892019-06-20 14:23:04 -030037pod2usage(2) if ($cmd ne "search" && $cmd ne "rest" && $cmd ne "validate");
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -030038pod2usage(2) if ($cmd eq "search" && !$arg);
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -030039
40require Data::Dumper if ($debug);
41
42my %data;
43
44#
45# Displays an error message, printing file name and line
46#
47sub parse_error($$$$) {
48 my ($file, $ln, $msg, $data) = @_;
49
50 print STDERR "file $file#$ln: $msg at\n\t$data";
51}
52
53#
54# Parse an ABI file, storing its contents at %data
55#
56sub parse_abi {
57 my $file = $File::Find::name;
58
59 my $mode = (stat($file))[2];
60 return if ($mode & S_IFDIR);
61 return if ($file =~ m,/README,);
62
63 my $name = $file;
64 $name =~ s,.*/,,;
65
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -030066 my $nametag = "File $name";
67 $data{$nametag}->{what} = "File $name";
68 $data{$nametag}->{type} = "File";
69 $data{$nametag}->{file} = $name;
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -030070 $data{$nametag}->{filepath} = $file;
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -030071 $data{$nametag}->{is_file} = 1;
Mauro Carvalho Chehab61439c42020-10-30 08:40:22 +010072 $data{$nametag}->{line_no} = 1;
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -030073
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -030074 my $type = $file;
75 $type =~ s,.*/(.*)/.*,$1,;
76
77 my $what;
78 my $new_what;
79 my $tag;
80 my $ln;
Mauro Carvalho Chehab6619c662019-06-20 14:22:56 -030081 my $xrefs;
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -030082 my $space;
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -030083 my @labels;
84 my $label;
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -030085
86 print STDERR "Opening $file\n" if ($debug > 1);
87 open IN, $file;
88 while(<IN>) {
89 $ln++;
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -030090 if (m/^(\S+)(:\s*)(.*)/i) {
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -030091 my $new_tag = lc($1);
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -030092 my $sep = $2;
93 my $content = $3;
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -030094
Mauro Carvalho Chehab7ce7b892019-06-20 14:23:04 -030095 if (!($new_tag =~ m/(what|where|date|kernelversion|contact|description|users)/)) {
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -030096 if ($tag eq "description") {
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -030097 # New "tag" is actually part of
98 # description. Don't consider it a tag
99 $new_tag = "";
Mauro Carvalho Chehab7d7ea8d2019-06-20 14:23:01 -0300100 } elsif ($tag ne "") {
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300101 parse_error($file, $ln, "tag '$tag' is invalid", $_);
102 }
103 }
104
Mauro Carvalho Chehab2c0700e2019-06-20 14:23:03 -0300105 # Invalid, but it is a common mistake
106 if ($new_tag eq "where") {
107 parse_error($file, $ln, "tag 'Where' is invalid. Should be 'What:' instead", $_);
108 $new_tag = "what";
109 }
110
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300111 if ($new_tag =~ m/what/) {
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300112 $space = "";
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300113 if ($tag =~ m/what/) {
114 $what .= ", " . $content;
115 } else {
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300116 parse_error($file, $ln, "What '$what' doesn't have a description", "") if ($what && !$data{$what}->{description});
117
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300118 $what = $content;
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -0300119 $label = $content;
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300120 $new_what = 1;
121 }
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -0300122 push @labels, [($content, $label)];
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300123 $tag = $new_tag;
Mauro Carvalho Chehab6619c662019-06-20 14:22:56 -0300124
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -0300125 push @{$data{$nametag}->{xrefs}}, [($content, $label)] if ($data{$nametag}->{what});
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300126 next;
127 }
128
Mauro Carvalho Chehab7d7ea8d2019-06-20 14:23:01 -0300129 if ($tag ne "" && $new_tag) {
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300130 $tag = $new_tag;
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300131
Mauro Carvalho Chehab61439c42020-10-30 08:40:22 +0100132 $data{$what}->{line_no} = $ln;
133
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300134 if ($new_what) {
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -0300135 @{$data{$what}->{label}} = @labels if ($data{$nametag}->{what});
136 @labels = ();
137 $label = "";
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300138 $new_what = 0;
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300139
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300140 $data{$what}->{type} = $type;
141 $data{$what}->{file} = $name;
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -0300142 $data{$what}->{filepath} = $file;
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300143 print STDERR "\twhat: $what\n" if ($debug > 1);
144 }
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300145
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300146 if (!$what) {
147 parse_error($file, $ln, "'What:' should come first:", $_);
148 next;
149 }
150 if ($tag eq "description") {
Mauro Carvalho Chehab11ce90a2020-10-30 08:40:20 +0100151 # Preserve initial spaces for the first line
152 $content = ' ' x length($new_tag) . $sep . $content;
153 $content =~ s,^(\s*):,$1 ,;
154 if ($content =~ m/^(\s*)(.*)$/) {
155 $space = $1;
156 $content = $2;
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300157 }
Mauro Carvalho Chehab11ce90a2020-10-30 08:40:20 +0100158 while ($space =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
Mauro Carvalho Chehabe9bca892020-10-30 08:40:21 +0100159
160 $data{$what}->{$tag} .= "$content\n" if ($content);
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300161 } else {
162 $data{$what}->{$tag} = $content;
163 }
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300164 next;
165 }
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300166 }
167
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300168 # Store any contents before tags at the database
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -0300169 if (!$tag && $data{$nametag}->{what}) {
170 $data{$nametag}->{description} .= $_;
Mauro Carvalho Chehab6619c662019-06-20 14:22:56 -0300171 next;
172 }
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300173
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300174 if ($tag eq "description") {
Mauro Carvalho Chehabe9bca892020-10-30 08:40:21 +0100175 my $content = $_;
176 while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300177 if (!$data{$what}->{description}) {
Mauro Carvalho Chehabe9bca892020-10-30 08:40:21 +0100178 # Preserve initial spaces for the first line
179 if ($content =~ m/^(\s*)(.*)$/) {
180 $space = $1;
181 $content = $2;
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300182 }
Mauro Carvalho Chehabe9bca892020-10-30 08:40:21 +0100183
184 $data{$what}->{$tag} .= "$content\n" if ($content);
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300185 } else {
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300186 if (m/^\s*\n/) {
187 $data{$what}->{$tag} .= $content;
188 next;
189 }
190
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300191 $space = "" if (!($content =~ s/^($space)//));
192
Mauro Carvalho Chehabe9bca892020-10-30 08:40:21 +0100193# # Compress spaces with tabs
194# $content =~ s<^ {8}> <\t>;
195# $content =~ s<^ {1,7}\t> <\t>;
196# $content =~ s< {1,7}\t> <\t>;
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300197 $data{$what}->{$tag} .= $content;
198 }
199 next;
200 }
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300201 if (m/^\s*(.*)/) {
202 $data{$what}->{$tag} .= "\n$1";
203 $data{$what}->{$tag} =~ s/\n+$//;
204 next;
205 }
206
207 # Everything else is error
208 parse_error($file, $ln, "Unexpected line:", $_);
209 }
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -0300210 $data{$nametag}->{description} =~ s/^\n+//;
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300211 close IN;
212}
213
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -0300214#
215# Outputs the book on ReST format
216#
Mauro Carvalho Chehab45f96512019-06-20 14:23:00 -0300217
Mauro Carvalho Chehab2e7ce052019-06-20 14:23:02 -0300218my %labels;
219
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300220sub output_rest {
Mauro Carvalho Chehab45f96512019-06-20 14:23:00 -0300221 foreach my $what (sort {
222 ($data{$a}->{type} eq "File") cmp ($data{$b}->{type} eq "File") ||
223 $a cmp $b
224 } keys %data) {
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300225 my $type = $data{$what}->{type};
226 my $file = $data{$what}->{file};
Mauro Carvalho Chehab45f96512019-06-20 14:23:00 -0300227 my $filepath = $data{$what}->{filepath};
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300228
Mauro Carvalho Chehab61439c42020-10-30 08:40:22 +0100229 if ($enable_lineno) {
230 printf "#define LINENO %s%s#%s\n\n",
231 $prefix, $data{$what}->{file},
232 $data{$what}->{line_no};
233 }
234
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300235 my $w = $what;
236 $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g;
237
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300238
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -0300239 foreach my $p (@{$data{$what}->{label}}) {
240 my ($content, $label) = @{$p};
241 $label = "abi_" . $label . " ";
242 $label =~ tr/A-Z/a-z/;
243
244 # Convert special chars to "_"
245 $label =~s/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xff])/_/g;
246 $label =~ s,_+,_,g;
247 $label =~ s,_$,,;
248
Mauro Carvalho Chehab2e7ce052019-06-20 14:23:02 -0300249 # Avoid duplicated labels
250 while (defined($labels{$label})) {
251 my @chars = ("A".."Z", "a".."z");
252 $label .= $chars[rand @chars];
253 }
254 $labels{$label} = 1;
255
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -0300256 $data{$what}->{label} .= $label;
257
258 printf ".. _%s:\n\n", $label;
259
260 # only one label is enough
261 last;
Mauro Carvalho Chehab6619c662019-06-20 14:22:56 -0300262 }
263
Mauro Carvalho Chehab6619c662019-06-20 14:22:56 -0300264
Mauro Carvalho Chehab45f96512019-06-20 14:23:00 -0300265 $filepath =~ s,.*/(.*/.*),\1,;;
266 $filepath =~ s,[/\-],_,g;;
267 my $fileref = "abi_file_".$filepath;
268
269 if ($type eq "File") {
270 my $bar = $w;
271 $bar =~ s/./-/g;
272
273 print ".. _$fileref:\n\n";
274 print "$w\n$bar\n\n";
275 } else {
276 my @names = split /\s*,\s*/,$w;
277
278 my $len = 0;
279
280 foreach my $name (@names) {
281 $len = length($name) if (length($name) > $len);
282 }
283
284 print "What:\n\n";
285
286 print "+-" . "-" x $len . "-+\n";
287 foreach my $name (@names) {
288 printf "| %s", $name . " " x ($len - length($name)) . " |\n";
289 print "+-" . "-" x $len . "-+\n";
290 }
291 print "\n";
292 }
293
294 print "Defined on file :ref:`$file <$fileref>`\n\n" if ($type ne "File");
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300295
296 my $desc = $data{$what}->{description};
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300297
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300298 if (!($desc =~ /^\s*$/)) {
Mauro Carvalho Chehab11ce90a2020-10-30 08:40:20 +0100299 if ($description_is_rst) {
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300300 print "$desc\n\n";
Mauro Carvalho Chehab11ce90a2020-10-30 08:40:20 +0100301 } else {
302 $desc =~ s/^\s+//;
303
304 # Remove title markups from the description, as they won't work
305 $desc =~ s/\n[\-\*\=\^\~]+\n/\n\n/g;
306
307 if ($desc =~ m/\:\n/ || $desc =~ m/\n[\t ]+/ || $desc =~ m/[\x00-\x08\x0b-\x1f\x7b-\xff]/) {
308 # put everything inside a code block
309 $desc =~ s/\n/\n /g;
310
311 print "::\n\n";
312 print " $desc\n\n";
313 } else {
314 # Escape any special chars from description
315 $desc =~s/([\x00-\x08\x0b-\x1f\x21-\x2a\x2d\x2f\x3c-\x40\x5c\x5e-\x60\x7b-\xff])/\\$1/g;
316 print "$desc\n\n";
317 }
Mauro Carvalho Chehab4e6a6232019-06-20 14:22:57 -0300318 }
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300319 } else {
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -0300320 print "DESCRIPTION MISSING for $what\n\n" if (!$data{$what}->{is_file});
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300321 }
Mauro Carvalho Chehab6619c662019-06-20 14:22:56 -0300322
Mauro Carvalho Chehabd0ebaf52019-06-20 14:22:58 -0300323 if ($data{$what}->{xrefs}) {
324 printf "Has the following ABI:\n\n";
325
326 foreach my $p(@{$data{$what}->{xrefs}}) {
327 my ($content, $label) = @{$p};
328 $label = "abi_" . $label . " ";
329 $label =~ tr/A-Z/a-z/;
330
331 # Convert special chars to "_"
332 $label =~s/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xff])/_/g;
333 $label =~ s,_+,_,g;
334 $label =~ s,_$,,;
335
336 # Escape special chars from content
337 $content =~s/([\x00-\x1f\x21-\x2f\x3a-\x40\x7b-\xff])/\\$1/g;
338
339 print "- :ref:`$content <$label>`\n\n";
340 }
341 }
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300342 }
343}
344
345#
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -0300346# Searches for ABI symbols
347#
348sub search_symbols {
349 foreach my $what (sort keys %data) {
350 next if (!($what =~ m/($arg)/));
351
352 my $type = $data{$what}->{type};
353 next if ($type eq "File");
354
355 my $file = $data{$what}->{filepath};
356
357 my $bar = $what;
358 $bar =~ s/./-/g;
359
360 print "\n$what\n$bar\n\n";
361
362 my $kernelversion = $data{$what}->{kernelversion};
363 my $contact = $data{$what}->{contact};
364 my $users = $data{$what}->{users};
365 my $date = $data{$what}->{date};
366 my $desc = $data{$what}->{description};
367 $kernelversion =~ s/^\s+//;
368 $contact =~ s/^\s+//;
369 $users =~ s/^\s+//;
370 $users =~ s/\n//g;
371 $date =~ s/^\s+//;
372 $desc =~ s/^\s+//;
373
374 printf "Kernel version:\t\t%s\n", $kernelversion if ($kernelversion);
375 printf "Date:\t\t\t%s\n", $date if ($date);
376 printf "Contact:\t\t%s\n", $contact if ($contact);
377 printf "Users:\t\t\t%s\n", $users if ($users);
378 print "Defined on file:\t$file\n\n";
379 print "Description:\n\n$desc";
380 }
381}
382
Mauro Carvalho Chehab61439c42020-10-30 08:40:22 +0100383# Ensure that the prefix will always end with a slash
384# While this is not needed for find, it makes the patch nicer
385# with --enable-lineno
386$prefix =~ s,/?$,/,;
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -0300387
388#
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300389# Parses all ABI files located at $prefix dir
390#
391find({wanted =>\&parse_abi, no_chdir => 1}, $prefix);
392
393print STDERR Data::Dumper->Dump([\%data], [qw(*data)]) if ($debug);
394
395#
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -0300396# Handles the command
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300397#
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -0300398if ($cmd eq "rest") {
399 output_rest;
Mauro Carvalho Chehab7ce7b892019-06-20 14:23:04 -0300400} elsif ($cmd eq "search") {
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -0300401 search_symbols;
402}
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300403
404
405__END__
406
407=head1 NAME
408
409abi_book.pl - parse the Linux ABI files and produce a ReST book.
410
411=head1 SYNOPSIS
412
Mauro Carvalho Chehab61439c42020-10-30 08:40:22 +0100413B<abi_book.pl> [--debug] [--enable-lineno] [--man] [--help]
414 [--(no-)rst-source] [--dir=<dir>] <COMAND> [<ARGUMENT>]
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -0300415
416Where <COMMAND> can be:
417
418=over 8
419
420B<search> [SEARCH_REGEX] - search for [SEARCH_REGEX] inside ABI
421
Mauro Carvalho Chehab7ce7b892019-06-20 14:23:04 -0300422B<rest> - output the ABI in ReST markup language
423
424B<validate> - validate the ABI contents
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -0300425
426=back
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300427
428=head1 OPTIONS
429
430=over 8
431
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -0300432=item B<--dir>
433
434Changes the location of the ABI search. By default, it uses
435the Documentation/ABI directory.
436
Mauro Carvalho Chehab11ce90a2020-10-30 08:40:20 +0100437=item B<--rst-source> and B<--no-rst-source>
438
439The input file may be using ReST syntax or not. Those two options allow
440selecting between a rst-compliant source ABI (--rst-source), or a
441plain text that may be violating ReST spec, so it requres some escaping
442logic (--no-rst-source).
443
Mauro Carvalho Chehab61439c42020-10-30 08:40:22 +0100444=item B<--enable-lineno>
445
446Enable output of #define LINENO lines.
447
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300448=item B<--debug>
449
450Put the script in verbose mode, useful for debugging. Can be called multiple
451times, to increase verbosity.
452
453=item B<--help>
454
455Prints a brief help message and exits.
456
457=item B<--man>
458
459Prints the manual page and exits.
460
461=back
462
463=head1 DESCRIPTION
464
Mauro Carvalho Chehab33e3e992019-06-20 14:22:59 -0300465Parse the Linux ABI files from ABI DIR (usually located at Documentation/ABI),
466allowing to search for ABI symbols or to produce a ReST book containing
467the Linux ABI documentation.
468
469=head1 EXAMPLES
470
471Search for all stable symbols with the word "usb":
472
473=over 8
474
475$ scripts/get_abi.pl search usb --dir Documentation/ABI/stable
476
477=back
478
479Search for all symbols that match the regex expression "usb.*cap":
480
481=over 8
482
483$ scripts/get_abi.pl search usb.*cap
484
485=back
486
487Output all obsoleted symbols in ReST format
488
489=over 8
490
491$ scripts/get_abi.pl rest --dir Documentation/ABI/obsolete
492
493=back
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300494
495=head1 BUGS
496
Mauro Carvalho Chehab7ce7b892019-06-20 14:23:04 -0300497Report bugs to Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300498
499=head1 COPYRIGHT
500
Mauro Carvalho Chehab7ce7b892019-06-20 14:23:04 -0300501Copyright (c) 2016-2019 by Mauro Carvalho Chehab <mchehab+samsung@kernel.org>.
Mauro Carvalho Chehabbbc249f2019-06-20 14:22:55 -0300502
503License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>.
504
505This is free software: you are free to change and redistribute it.
506There is NO WARRANTY, to the extent permitted by law.
507
508=cut