aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 18:59:24 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 18:59:24 -0500
commit5ebe0ee802c52cdf0c0eed8f3eccc9a056e412a3 (patch)
tree0eb28b0315a44593404f58b9758d31e0afc41425 /scripts/kernel-doc
parent1873499e13648a2dd01a394ed3217c9290921b3d (diff)
parent3ce96239d482a7d2dfdc1f332152c580b219fef1 (diff)
Merge tag 'docs-for-linus' of git://git.lwn.net/linux
Pull documentation update from Jon Corbet: "There is a nice new document from Neil on how pathname lookups work and some new CAN driver documentation. Beyond that, we have kernel-doc fixes, a bit more work to support reproducible builds, and the usual collection of small fixes" * tag 'docs-for-linus' of git://git.lwn.net/linux: (34 commits) Documentation: add new description of path-name lookup. Documentation/vm/slub.txt: document slabinfo-gnuplot.sh Doc: ABI/stable: Fix typo in ABI/stable doc: Clarify that nmi_watchdog param is for hardlockups Typo correction for description in gpio document. DocBook: Fix kernel-doc to be case-insensitive for private: kernel-docs.txt: update kernelnewbies reference Doc:kvm: Fix typo in Doc/virtual/kvm Documentation/Changes: Add bc in "Current Minimal Requirements" section Documentation/email-clients.txt: remove trailing whitespace DocBook: Use a fixed encoding for output MAINTAINERS: The docs tree has moved Docs/kernel-parameters: Add earlycon devicetree usage SubmittingPatches: make Subject examples match the de facto standard Documentation: gpio: mention that <function>-gpio has been deprecated Documentation: cgroups: just fix a few typos Documentation: Update kselftest.txt Documentation: DMA API: Be more explicit that nents is always the same Documentation: Update the default value of crashkernel low zram: update documentation ...
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc119
1 files changed, 68 insertions, 51 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 0276d2b5eefe..125b906cd1d4 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -206,59 +206,73 @@ my $type_env = '(\$\w+)';
206# One for each output format 206# One for each output format
207 207
208# these work fairly well 208# these work fairly well
209my %highlights_html = ( $type_constant, "<i>\$1</i>", 209my @highlights_html = (
210 $type_func, "<b>\$1</b>", 210 [$type_constant, "<i>\$1</i>"],
211 $type_struct_xml, "<i>\$1</i>", 211 [$type_func, "<b>\$1</b>"],
212 $type_env, "<b><i>\$1</i></b>", 212 [$type_struct_xml, "<i>\$1</i>"],
213 $type_param, "<tt><b>\$1</b></tt>" ); 213 [$type_env, "<b><i>\$1</i></b>"],
214 [$type_param, "<tt><b>\$1</b></tt>"]
215 );
214my $local_lt = "\\\\\\\\lt:"; 216my $local_lt = "\\\\\\\\lt:";
215my $local_gt = "\\\\\\\\gt:"; 217my $local_gt = "\\\\\\\\gt:";
216my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>" 218my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>"
217 219
218# html version 5 220# html version 5
219my %highlights_html5 = ( $type_constant, "<span class=\"const\">\$1</span>", 221my @highlights_html5 = (
220 $type_func, "<span class=\"func\">\$1</span>", 222 [$type_constant, "<span class=\"const\">\$1</span>"],
221 $type_struct_xml, "<span class=\"struct\">\$1</span>", 223 [$type_func, "<span class=\"func\">\$1</span>"],
222 $type_env, "<span class=\"env\">\$1</span>", 224 [$type_struct_xml, "<span class=\"struct\">\$1</span>"],
223 $type_param, "<span class=\"param\">\$1</span>" ); 225 [$type_env, "<span class=\"env\">\$1</span>"],
226 [$type_param, "<span class=\"param\">\$1</span>]"]
227 );
224my $blankline_html5 = $local_lt . "br /" . $local_gt; 228my $blankline_html5 = $local_lt . "br /" . $local_gt;
225 229
226# XML, docbook format 230# XML, docbook format
227my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>", 231my @highlights_xml = (
228 $type_constant, "<constant>\$1</constant>", 232 ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"],
229 $type_func, "<function>\$1</function>", 233 [$type_constant, "<constant>\$1</constant>"],
230 $type_struct_xml, "<structname>\$1</structname>", 234 [$type_struct_xml, "<structname>\$1</structname>"],
231 $type_env, "<envar>\$1</envar>", 235 [$type_param, "<parameter>\$1</parameter>"],
232 $type_param, "<parameter>\$1</parameter>" ); 236 [$type_func, "<function>\$1</function>"],
237 [$type_env, "<envar>\$1</envar>"]
238 );
233my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n"; 239my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n";
234 240
235# gnome, docbook format 241# gnome, docbook format
236my %highlights_gnome = ( $type_constant, "<replaceable class=\"option\">\$1</replaceable>", 242my @highlights_gnome = (
237 $type_func, "<function>\$1</function>", 243 [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"],
238 $type_struct, "<structname>\$1</structname>", 244 [$type_func, "<function>\$1</function>"],
239 $type_env, "<envar>\$1</envar>", 245 [$type_struct, "<structname>\$1</structname>"],
240 $type_param, "<parameter>\$1</parameter>" ); 246 [$type_env, "<envar>\$1</envar>"],
247 [$type_param, "<parameter>\$1</parameter>" ]
248 );
241my $blankline_gnome = "</para><para>\n"; 249my $blankline_gnome = "</para><para>\n";
242 250
243# these are pretty rough 251# these are pretty rough
244my %highlights_man = ( $type_constant, "\$1", 252my @highlights_man = (
245 $type_func, "\\\\fB\$1\\\\fP", 253 [$type_constant, "\$1"],
246 $type_struct, "\\\\fI\$1\\\\fP", 254 [$type_func, "\\\\fB\$1\\\\fP"],
247 $type_param, "\\\\fI\$1\\\\fP" ); 255 [$type_struct, "\\\\fI\$1\\\\fP"],
256 [$type_param, "\\\\fI\$1\\\\fP"]
257 );
248my $blankline_man = ""; 258my $blankline_man = "";
249 259
250# text-mode 260# text-mode
251my %highlights_text = ( $type_constant, "\$1", 261my @highlights_text = (
252 $type_func, "\$1", 262 [$type_constant, "\$1"],
253 $type_struct, "\$1", 263 [$type_func, "\$1"],
254 $type_param, "\$1" ); 264 [$type_struct, "\$1"],
265 [$type_param, "\$1"]
266 );
255my $blankline_text = ""; 267my $blankline_text = "";
256 268
257# list mode 269# list mode
258my %highlights_list = ( $type_constant, "\$1", 270my @highlights_list = (
259 $type_func, "\$1", 271 [$type_constant, "\$1"],
260 $type_struct, "\$1", 272 [$type_func, "\$1"],
261 $type_param, "\$1" ); 273 [$type_struct, "\$1"],
274 [$type_param, "\$1"]
275 );
262my $blankline_list = ""; 276my $blankline_list = "";
263 277
264# read arguments 278# read arguments
@@ -273,7 +287,7 @@ my $verbose = 0;
273my $output_mode = "man"; 287my $output_mode = "man";
274my $output_preformatted = 0; 288my $output_preformatted = 0;
275my $no_doc_sections = 0; 289my $no_doc_sections = 0;
276my %highlights = %highlights_man; 290my @highlights = @highlights_man;
277my $blankline = $blankline_man; 291my $blankline = $blankline_man;
278my $modulename = "Kernel API"; 292my $modulename = "Kernel API";
279my $function_only = 0; 293my $function_only = 0;
@@ -374,31 +388,31 @@ while ($ARGV[0] =~ m/^-(.*)/) {
374 my $cmd = shift @ARGV; 388 my $cmd = shift @ARGV;
375 if ($cmd eq "-html") { 389 if ($cmd eq "-html") {
376 $output_mode = "html"; 390 $output_mode = "html";
377 %highlights = %highlights_html; 391 @highlights = @highlights_html;
378 $blankline = $blankline_html; 392 $blankline = $blankline_html;
379 } elsif ($cmd eq "-html5") { 393 } elsif ($cmd eq "-html5") {
380 $output_mode = "html5"; 394 $output_mode = "html5";
381 %highlights = %highlights_html5; 395 @highlights = @highlights_html5;
382 $blankline = $blankline_html5; 396 $blankline = $blankline_html5;
383 } elsif ($cmd eq "-man") { 397 } elsif ($cmd eq "-man") {
384 $output_mode = "man"; 398 $output_mode = "man";
385 %highlights = %highlights_man; 399 @highlights = @highlights_man;
386 $blankline = $blankline_man; 400 $blankline = $blankline_man;
387 } elsif ($cmd eq "-text") { 401 } elsif ($cmd eq "-text") {
388 $output_mode = "text"; 402 $output_mode = "text";
389 %highlights = %highlights_text; 403 @highlights = @highlights_text;
390 $blankline = $blankline_text; 404 $blankline = $blankline_text;
391 } elsif ($cmd eq "-docbook") { 405 } elsif ($cmd eq "-docbook") {
392 $output_mode = "xml"; 406 $output_mode = "xml";
393 %highlights = %highlights_xml; 407 @highlights = @highlights_xml;
394 $blankline = $blankline_xml; 408 $blankline = $blankline_xml;
395 } elsif ($cmd eq "-list") { 409 } elsif ($cmd eq "-list") {
396 $output_mode = "list"; 410 $output_mode = "list";
397 %highlights = %highlights_list; 411 @highlights = @highlights_list;
398 $blankline = $blankline_list; 412 $blankline = $blankline_list;
399 } elsif ($cmd eq "-gnome") { 413 } elsif ($cmd eq "-gnome") {
400 $output_mode = "gnome"; 414 $output_mode = "gnome";
401 %highlights = %highlights_gnome; 415 @highlights = @highlights_gnome;
402 $blankline = $blankline_gnome; 416 $blankline = $blankline_gnome;
403 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document 417 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document
404 $modulename = shift @ARGV; 418 $modulename = shift @ARGV;
@@ -1746,7 +1760,7 @@ sub output_declaration {
1746 my $func = "output_${functype}_$output_mode"; 1760 my $func = "output_${functype}_$output_mode";
1747 if (($function_only==0) || 1761 if (($function_only==0) ||
1748 ( $function_only == 1 && defined($function_table{$name})) || 1762 ( $function_only == 1 && defined($function_table{$name})) ||
1749 ( $function_only == 2 && !defined($function_table{$name}))) 1763 ( $function_only == 2 && !($functype eq "function" && defined($function_table{$name}))))
1750 { 1764 {
1751 &$func(@_); 1765 &$func(@_);
1752 $section_counter++; 1766 $section_counter++;
@@ -1791,8 +1805,8 @@ sub dump_struct($$) {
1791 $nested = $1; 1805 $nested = $1;
1792 1806
1793 # ignore members marked private: 1807 # ignore members marked private:
1794 $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gos; 1808 $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi;
1795 $members =~ s/\/\*\s*private:.*//gos; 1809 $members =~ s/\/\*\s*private:.*//gosi;
1796 # strip comments: 1810 # strip comments:
1797 $members =~ s/\/\*.*?\*\///gos; 1811 $members =~ s/\/\*.*?\*\///gos;
1798 $nested =~ s/\/\*.*?\*\///gos; 1812 $nested =~ s/\/\*.*?\*\///gos;
@@ -2416,12 +2430,13 @@ sub process_file($) {
2416 my $descr; 2430 my $descr;
2417 my $in_purpose = 0; 2431 my $in_purpose = 0;
2418 my $initial_section_counter = $section_counter; 2432 my $initial_section_counter = $section_counter;
2433 my ($orig_file) = @_;
2419 2434
2420 if (defined($ENV{'SRCTREE'})) { 2435 if (defined($ENV{'SRCTREE'})) {
2421 $file = "$ENV{'SRCTREE'}" . "/" . "@_"; 2436 $file = "$ENV{'SRCTREE'}" . "/" . $orig_file;
2422 } 2437 }
2423 else { 2438 else {
2424 $file = "@_"; 2439 $file = $orig_file;
2425 } 2440 }
2426 if (defined($source_map{$file})) { 2441 if (defined($source_map{$file})) {
2427 $file = $source_map{$file}; 2442 $file = $source_map{$file};
@@ -2665,7 +2680,7 @@ sub process_file($) {
2665 print "<refentry>\n"; 2680 print "<refentry>\n";
2666 print " <refnamediv>\n"; 2681 print " <refnamediv>\n";
2667 print " <refname>\n"; 2682 print " <refname>\n";
2668 print " ${file}\n"; 2683 print " ${orig_file}\n";
2669 print " </refname>\n"; 2684 print " </refname>\n";
2670 print " <refpurpose>\n"; 2685 print " <refpurpose>\n";
2671 print " Document generation inconsistency\n"; 2686 print " Document generation inconsistency\n";
@@ -2679,7 +2694,7 @@ sub process_file($) {
2679 print " <para>\n"; 2694 print " <para>\n";
2680 print " The template for this document tried to insert\n"; 2695 print " The template for this document tried to insert\n";
2681 print " the structured comment from the file\n"; 2696 print " the structured comment from the file\n";
2682 print " <filename>${file}</filename> at this point,\n"; 2697 print " <filename>${orig_file}</filename> at this point,\n";
2683 print " but none was found.\n"; 2698 print " but none was found.\n";
2684 print " This dummy section is inserted to allow\n"; 2699 print " This dummy section is inserted to allow\n";
2685 print " generation to continue.\n"; 2700 print " generation to continue.\n";
@@ -2696,9 +2711,11 @@ $kernelversion = get_kernel_version();
2696 2711
2697# generate a sequence of code that will splice in highlighting information 2712# generate a sequence of code that will splice in highlighting information
2698# using the s// operator. 2713# using the s// operator.
2699foreach my $pattern (sort keys %highlights) { 2714foreach my $k (keys @highlights) {
2700# print STDERR "scanning pattern:$pattern, highlight:($highlights{$pattern})\n"; 2715 my $pattern = $highlights[$k][0];
2701 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n"; 2716 my $result = $highlights[$k][1];
2717# print STDERR "scanning pattern:$pattern, highlight:($result)\n";
2718 $dohighlight .= "\$contents =~ s:$pattern:$result:gs;\n";
2702} 2719}
2703 2720
2704# Read the file that maps relative names to absolute names for 2721# Read the file that maps relative names to absolute names for