[lkml]   [2005]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 2.6.12-rc4-mm2] drivers: (dynamic sysfs callbacks) update device attribute callbacks
    Here is the previously mentioned perl script. Its quite simplistic,
    and accepts the filename of a source file to update as a parameter, or
    uses stdin/stdout if no parameters are given. To update a whole tree
    using the below just use something like:

    find linux-2.6.12-rc4 -type f -exec ./ {} \;

    This script should catch every device_attribute callback, including
    multiline function signatures and embedded in macros. If it fails to
    catch something please let me know.



    use strict;

    my $infile=shift;

    if(!defined $infile){
    open(IN,"<&STDIN") or die "Could not open an input stream";
    open(IN,"<$infile") or die "Could not open an input stream";

    my $subs = 0;
    my $code = "";


    $code =~ s/(ssize_t[\s\\]+?[^(;]+?\(\s*?struct[\s\\]+?(?:device)[\s\\]*?\*[^,);]*?,)([\s\\]*?char[\s\\]*?\*[^,);]*?[\s\\]*?\))/$1
    struct device_attribute *attr,$2/gs && $subs++;
    $code =~ s/(ssize_t[\s\\]+?[^(;]+?\(\s*?struct[\s\\]+?(?:device)[\s\\]*?\*[^,);]*?,)([\s\\]*?const[\s\\]+?char[\s\\]*?\*[^,);]*?[\s\\]*?,[\s\\]*size_t[^,);]*?[\s\\]*\))/$1
    struct device_attribute *attr,$2/gs && $subs++;

    if(!defined $infile){
    open(OUT,">&STDOUT") or die "Could not open an output stream";
    open(OUT,">$infile") or die "Could not open an output stream";
    print OUT $code;
    $infile && print STDOUT "$infile updated.\n";
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-05-19 13:56    [W:0.021 / U:57.932 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site