#!/usr/bin/perl -w use smatch; sub print_url { if (get_filename() =~ /home\/carp0110\/progs\/kernel\/devel\/linux-2.5.7\/(.*)/){ print 'http://lxr.linux.no/source/', $1, '?v=2.5.7#', get_lineno(), "\n"; } } while ($data = get_data()){ # if we see a lock_kernel then we set the state to "locked" if ($data =~ /call_expr\(\(addr_expr function_decl\(lock_kernel/){ set_state("locked"); next; } # if we see an unlock_kernel we set the state to "unlocked" if ($data =~ /call_expr\(\(addr_expr function_decl\(unlock_kernel/){ set_state("unlocked"); next; } # if we see a return statement and the kernel is # locked then we print a mesg. if ($data =~ /^return_stmt/){ if (get_state() =~ /^locked$/){ #print "Not unlocked: ", get_filename(), " ", get_start_line(), " ", get_lineno(), "\n"; print_url(); next; } } }