summaryrefslogtreecommitdiffstats
path: root/perl-install/devices.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/devices.pm')
-rw-r--r--perl-install/devices.pm28
1 files changed, 18 insertions, 10 deletions
diff --git a/perl-install/devices.pm b/perl-install/devices.pm
index c48bd3636..1a84d84ae 100644
--- a/perl-install/devices.pm
+++ b/perl-install/devices.pm
@@ -48,17 +48,9 @@ sub set_loop {
}
}
-sub make($) {
- local $_ = my $file = $_[0];
+sub entry {
my ($type, $major, $minor);
-
- if (m,^(.*/(?:dev|tmp))/(.*),) {
- $_ = $2;
- } else {
- -e $file or $file = "/tmp/$_";
- -e $file or $file = "/dev/$_";
- }
- -e $file and return $file; #- assume nobody takes fun at creating files named as device
+ local ($_) = @_;
if (/^sd(.)(\d{0,2})/) {
$type = c::S_IFBLK();
@@ -122,6 +114,22 @@ sub make($) {
"zero" => [ c::S_IFCHR(), 1, 5 ],
}}{$_} or die "unknown device $_" };
}
+ ($type, $major, $minor);
+}
+
+
+sub make($) {
+ local $_ = my $file = $_[0];
+
+ if (m,^(.*/(?:dev|tmp))/(.*),) {
+ $_ = $2;
+ } else {
+ -e $file or $file = "/tmp/$_";
+ -e $file or $file = "/dev/$_";
+ }
+ -e $file and return $file; #- assume nobody takes fun at creating files named as device
+
+ my ($type, $major, $minor) = entry($_);
#- make a directory for this inode if needed.
mkdir dirname($file), 0755;