summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-06-20 05:52:56 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-06-20 05:52:56 +0000
commit8c84f730c5e0f572d9f9c783b5bade2617576ea5 (patch)
tree477e58ade987d4ccaf2bc6a3e33c480b501c706a /perl-install
parentcfabc9b199e4b112a93c1d8bc94fbca05e59a7c3 (diff)
downloaddrakx-8c84f730c5e0f572d9f9c783b5bade2617576ea5.tar
drakx-8c84f730c5e0f572d9f9c783b5bade2617576ea5.tar.gz
drakx-8c84f730c5e0f572d9f9c783b5bade2617576ea5.tar.bz2
drakx-8c84f730c5e0f572d9f9c783b5bade2617576ea5.tar.xz
drakx-8c84f730c5e0f572d9f9c783b5bade2617576ea5.zip
enable creation of /dev/dm-x devices (not used at the moment)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/devices.pm38
1 files changed, 22 insertions, 16 deletions
diff --git a/perl-install/devices.pm b/perl-install/devices.pm
index 9404481a8..a55ef63ad 100644
--- a/perl-install/devices.pm
+++ b/perl-install/devices.pm
@@ -50,12 +50,17 @@ sub find_clp_loop {
undef;
}
+sub get_dynamic_major {
+ my ($name) = @_;
+ cat_('/proc/devices') =~ /^(\d+) \Q$name\E$/m && $1;
+}
+
sub init_device_mapper() {
eval { modules::load('dm-mod') };
make('urandom');
my $control = '/dev/mapper/control';
if (! -e $control) {
- my ($major) = cat_('/proc/devices') =~ /(\d+) misc$/m or return;
+ my ($major) = get_dynamic_major('misc') or return;
my ($minor) = cat_('/proc/misc') =~ /(\d+) device-mapper$/m or return;
mkdir_p(dirname($control));
syscall_('mknod', $control, c::S_IFCHR() | 0600, makedev($major, $minor)) or die "mknod $control failed: $!";
@@ -107,21 +112,22 @@ sub entry {
$type = c::S_IFBLK();
$major = 114;
$minor = 16 * $1 + ($2 || 0);
- } elsif (/(.*?)(\d+)$/) {
- ($type, $major, $minor) =
- @{ ${{"fd" => [ c::S_IFBLK(), 2, 0 ],
- "hidbp-mse-" => [ c::S_IFCHR(), 10, 32 ],
- "lp" => [ c::S_IFCHR(), 6, 0 ],
- "usb/lp" => [ c::S_IFCHR(), 180, 0 ],
- "input/event" => [ c::S_IFCHR(), 13, 64 ],
- "loop" => [ c::S_IFBLK(), 7, 0 ],
- "md" => [ c::S_IFBLK(), 9, 0 ],
- "nst" => [ c::S_IFCHR(), 9, 128 ],
- "sr" => [ c::S_IFBLK(), 11, 0 ],
- "ttyS" => [ c::S_IFCHR(), 4, 64 ],
- "ubd/" => [ c::S_IFBLK(), 98, 0 ],
- }}{$1} };
- $minor += $2;
+ } elsif (my ($prefix, $nb) = /(.*?)(\d+)$/) {
+ my $f = ${{"fd" => sub { c::S_IFBLK(), 2, 0 },
+ "hidbp-mse-" => sub { c::S_IFCHR(), 10, 32 },
+ "lp" => sub { c::S_IFCHR(), 6, 0 },
+ "usb/lp" => sub { c::S_IFCHR(), 180, 0 },
+ "input/event" => sub { c::S_IFCHR(), 13, 64 },
+ "loop" => sub { c::S_IFBLK(), 7, 0 },
+ "md" => sub { c::S_IFBLK(), 9, 0 },
+ "nst" => sub { c::S_IFCHR(), 9, 128 },
+ "sr" => sub { c::S_IFBLK(), 11, 0 },
+ "ttyS" => sub { c::S_IFCHR(), 4, 64 },
+ "ubd/" => sub { c::S_IFBLK(), 98, 0 },
+ "dm-" => sub { c::S_IFBLK(), get_dynamic_major('device-mapper'), 0 },
+ }}{$prefix} or internal_error("unknown device $prefix $nb");
+ ($type, $major, $minor) = $f->();
+ $minor += $nb;
}
unless ($type) {
($type, $major, $minor) =