* devices.h (lives_in_dev): New field.

(dev_on_fs): Set bit size.
(is_dev_resident): Define new method.
* devices.in: Use different method for labelling requested name for dev
storage: prefix it with a ='.  Use an actual ':' to denote an internal device.
(exists_console): Avoid repeated test.
(exists_ntdev_silent): Rename from the less-descriptive exists_ntdevs.
(dev_dev_storage): Delete unneeded define.
* gendevices: Add a flag to each line denoting whether the device lives in /dev
space.
(generate): Handle special ":" case here for internal devices.  Parse
=something_dev as requiring a storage location.  Tack the rest of the line back
onto the reformulated "$rest".
* devices.cc: Regenerate.
This commit is contained in:
Christopher Faylor
2012-04-02 20:41:46 +00:00
parent eb7729eb36
commit 17a61045ff
5 changed files with 3574 additions and 3496 deletions

View File

@@ -41,6 +41,7 @@ while (<INPUT>) {
my $x = $f->[0];
my $rest = $f->[1];
my ($dev, $devrest) = ($x =~ /([^%]+)(%.*)?$/o);
$rest .= ', ' . (($dev =~ m%/dev/%o) ? 'true' : 'false');
push(@lines, generate($dev, $devrest, $rest, []));
}
@patterns = ();
@@ -84,7 +85,6 @@ for (my $i = 0; $i < @lines; $i++) {
splice(@lines, $i, 1);
redo;
};
$lines[$i] =~ s%"//%":%go;
}
open(OUTPUT, '>', $output) or do {{
if (chmod(0664, $output)) {
@@ -117,6 +117,7 @@ sub generate {
} else {
my $fh = $dev;
$fh =~ s%/%_%og;
$fh =~ s%^:%__%o;
my $shilka_id = $fh;
my $storage_str = $fh . '_storage';
$fh =~ s/^_dev_/FH_/o;
@@ -127,9 +128,9 @@ sub generate {
@lines = ('"' . $dev . '"' . " = $shilka_id {return $storage_loc;}\n");
$rest = "$fh, $rest" if $rest =~ /^"/o;
$rest = fixup($rest, $vars);
if ($rest =~ /^(.*), ([a-z_]*_dev)/) {
if ($rest =~ /^(.*), =(\S*_dev)\b\s*(.*)$/) {
$pointers{$2} ||= "const device *$2 = $storage_loc;\n";
$rest = $1;
$rest = $1 . $3;
}
push(@storage, " {\"$dev\", " . $rest . "},\n");
}