aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2006-01-09 09:35:28 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 12:45:36 -0500
commit49cd619c69d643b30a24029e40eb5364c7a26b2e (patch)
tree77d181378b85210b3b32a9b22e3363408ebe786a /drivers
parent19dbaf6f6f0f3b766df08594446d64747a5cced3 (diff)
[PATCH] moxa serial: add proper capability check
This requires the proper capabilities for the moxa bios update ioctl's. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/moxa.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 5e3ef5522194..f43c2e04eadd 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -1649,6 +1649,8 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port)
1649 case MOXA_FIND_BOARD: 1649 case MOXA_FIND_BOARD:
1650 case MOXA_LOAD_C320B: 1650 case MOXA_LOAD_C320B:
1651 case MOXA_LOAD_CODE: 1651 case MOXA_LOAD_CODE:
1652 if (!capable(CAP_SYS_RAWIO))
1653 return -EPERM;
1652 break; 1654 break;
1653 } 1655 }
1654 1656
s="hl opt">; $stripped =~ s/^$i\///; return $stripped if $stripped ne $filename; } return $filename; } # Search for the file name in the list of include paths sub search { my $filename = shift; return $filename if -f $filename; for my $i (@opt_include) { my $path = "$i/$filename"; return $path if -f $path; } return undef; } sub parse_all { # Parse all the headers. my @queue = @_; while(@queue) { my $header = pop @queue; next if exists $deps{$header}; $deps{$header} = [] unless exists $deps{$header}; my $path = search($header); next unless $path; open(my $file, '<', $path) or die($!); chomp(my @lines = <$file>); close($file); for my $i (0 .. $#lines) { my $line = $lines[$i]; if(my($dep) = ($line =~ m/^#\s*include\s*<(.*?)>/)) { push @queue, $dep; push @{$deps{$header}}, [$i + 1, $dep]; } } } } sub print_cycle { # $cycle[n] includes $cycle[n + 1]; # $cycle[-1] will be the culprit my $cycle = shift; # Adjust the line numbers for my $i (0 .. $#$cycle - 1) { $cycle->[$i]->[0] = $cycle->[$i + 1]->[0]; } $cycle->[-1]->[0] = 0; my $first = shift @$cycle; my $last = pop @$cycle; my $msg = "In file included"; printf "%s from %s,\n", $msg, $last->[1] if defined $last; for my $header (reverse @$cycle) { printf "%s from %s:%d%s\n", " " x length $msg, $header->[1], $header->[0], $header->[1] eq $last->[1] ? ' <-- here' : ''; } printf "%s:%d: warning: recursive header inclusion\n", $first->[1], $first->[0]; } # Find and print the smallest cycle starting in the specified node. sub detect_cycles { my @queue = map { [[0, $_]] } @_; while(@queue) { my $top = pop @queue; my $name = $top->[-1]->[1]; for my $dep (@{$deps{$name}}) { my $chain = [@$top, [$dep->[0], $dep->[1]]]; # If the dep already exists in the chain, we have a # cycle... if(grep { $_->[1] eq $dep->[1] } @$top) { print_cycle($chain); next if $opt_all; return; } push @queue, $chain; } } } sub mangle { $_ = shift; s/\//__/g; s/\./_/g; s/-/_/g; $_; } # Output dependency graph in GraphViz language. sub graph { print "digraph {\n"; print "\t/* vertices */\n"; for my $header (keys %deps) { printf "\t%s [label=\"%s\"];\n", mangle($header), $header; } print "\n"; print "\t/* edges */\n"; for my $header (keys %deps) { for my $dep (@{$deps{$header}}) { printf "\t%s -> %s;\n", mangle($header), mangle($dep->[1]); } } print "}\n"; }