linux/scripts/headers_install.pl
<<
tionv2./spa> v2./form v2.a tionv2 href="../linux+v3.8.1/scripts/headers_install.pl">tionv2.img src="../.static/gfx/right.png" alt=">>">ti./spa> ti.spa> class="lxr_search">tion="+search" method="post" onsubmit="return do_search(this);">tionv2.input typionhidden" namionnavtarget" /option">tionv2.input typiontext" namionsearch" idonsearch">tionv2.butt.1Search ti.spa> class="lxr_prefs" v2.a href="+prefs?return=scripts/headers_install.pl"tionv2 onclick="return ajax_prefs();">tionv2Prefs v2./a>ti./spa> onv2 2./div onv2 2.form ac >="ajax+*" method="post" onsubmit="return false;">ti.input typionhidden" namionajax_lookup" idonajax_lookup" /option">tonv2 2./form tonv2 2.div class="headingbott.m">
.div idonfile_contents"
2 21./a>#!/usr/bin/perl -w
2 22./a>#
2 23./a># headers_install prepare the listed header files for use in
2 24./a># user space and copy the files to their destina	  >.
2 25./a>#
2 26./a># Usage: headers_install.pl readdir installdir arch [files...]
2 27./a># installdir: dir to install the files to
2 28./a># arch:onv2 2 current architecture
2 29./a>#             arch is used to force a reinstalla	  > when the arch
2 6.16a>#             changes because kbuild then detect a command line change.
2 11./a># files:onv2 2list of files to check
2 12./a>#
2 13./a># Step in prepara	  > for users space:
2 14./a># 1) Drop all use of compiler.h defini	  >s
2 15./a># 2) Drop include of compiler.h
2 16./a># 3) Drop all sec	  >s defined out by __KERNEL__ (using unifdef)
2 17./a>
2 18./a>use strict;
2 19./a>
2 2.16a>my ($installdir, $arch, @files) = @ARGV;
2 21./a>
2 2216a>my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__";
2 23./a>
2 24./a>foreach my $filenami (@files) {
2 25./a>        my $file = $filenami;
2 26./a>        $file =~ s!^.*/!!;
2 27./a>
2 28./a>        my $tmpfile = "$installdir/$file.tmp";
2 29./a>
2 30./a>        open(my $in, '<', $filenami)
2 31./a>            or die "$filenami: $!\n";
2 32./a>        open(my $out, '>', $tmpfile)
2 33./a>            or die "$tmpfile: $!\n";
2 34./a>        while (my $line = <$in>) {
2 35./a>                $line =~ s/([\s(])__user\s/$1/g;
2 36./a>                $line =~ s/([\s(])__force\s/$1/g;
2 37./a>                $line =~ s/([\s(])__iomem\s/$1/g;
2 38./a>                $line =~ s/\s__attribute_const__\s/ /g;
2 39./a>                $line =~ s/\s__attribute_const__$//g;
2 40./a>                $line =~ s/\b__packed\b/__attribute__((packed))/g;
2 41./a>                $line =~ s/^#include <linux\/compiler.h>//;
2 42./a>                $line =~ s/(^|\s)(inline)\b/$1__$2__/g;
2 43./a>                $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
2 44./a>                $line =~ s/(^|\s|[(])(vola	 le)\b(\s|[(]|$)/$1__$2__$3/g;
2 45./a>                $line =~ s/#ifndef\s+_UAPI/#ifndef /;
2 46./a>                $line =~ s/#define\s+_UAPI/#define /;
2 47./a>                $line =~ s!#endif\s+/[*]\s*_UAPI!#endif /* !;
2 48./a>                printf {$out} "%s", $line;
2 49./a>        }
2 50./a>        close $out;
2 51./a>        close $in;
2 52./a>
2 53./a>        system $unifdef . " $tmpfile > $installdir/$file";
2 54./a>        # unifdef will exit 0 on success, and will exit 1 when the
2 55./a>        # file was processed successfully but no changes were made,
2 56./a>        # so abort only when it's higher than that.
2 57./a>        my $e = $? >> 8;
2 58./a>        if ($e > 1) {
2 59./a>                die "$tmpfile: $!\n";
2 60./a>        }
2 61./a>        unlink $tmpfile;
2 62./a>}
2 63./a>exit 0;
2 64./a>
The original LXR software by the LXR community./a>, this experimental vers > by lxr@linux.no./a>. ./div .div class="subfooter"> lxr.linux.no kindly hosted by Redpill Linpro AS./a>, provider of Linux consulting and opera >s services since 1995. ./div ./body ./html