From 975c4c27c0245389fedb1669bab816502f1c36f3 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 9 Mar 2000 15:23:56 +0000 Subject: no_comment --- perl-install/ChangeLog | 3 +++ perl-install/c/stuff.xs.pm | 29 ++++++++++++++++++++++++++++- perl-install/devices.pm | 13 +++++++++++++ perl-install/fs.pm | 3 ++- perl-install/fsedit.pm | 2 +- perl-install/loopback.pm | 2 -- perl-install/modules.pm | 5 ++++- 7 files changed, 51 insertions(+), 6 deletions(-) (limited to 'perl-install') diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index b0f8ea58d..2372bfb23 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,5 +1,8 @@ 2000-03-09 Pixel + * modules.pm (write_conf): don't add alias block-major-11 in every case + * modules.pm (add_alias): special case oss (post-installs modprobe snd-pcm-oss) + * fs.pm (format_*): move the @options before the device * loopback.pm: created, added a lot of stuff for loopback in diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm index 5aaef8605..bc405af1d 100644 --- a/perl-install/c/stuff.xs.pm +++ b/perl-install/c/stuff.xs.pm @@ -19,6 +19,7 @@ print ' #include #include #include +#include #include #include @@ -242,6 +243,32 @@ kernel_version() RETVAL +int +set_loop(dev_fd, file) + int dev_fd + char *file + CODE: + RETVAL = 0; +{ + struct loop_info loopinfo; + int file_fd = open(file, O_RDWR); + + if (file_fd < 0) return; + + memset(&loopinfo, 0, sizeof (loopinfo)); + strncpy(loopinfo.lo_name, file, LO_NAME_SIZE); + loopinfo.lo_name[LO_NAME_SIZE - 1] = 0; + + if (ioctl(dev_fd, LOOP_SET_FD, file_fd) < 0) return; + if (ioctl(dev_fd, LOOP_SET_STATUS, &loopinfo) < 0) { + ioctl(dev_fd, LOOP_CLR_FD, 0); + return; + } + close(file_fd); + RETVAL = 1; +} + OUTPUT: + RETVAL '; $ENV{C_RPM} and print ' @@ -747,7 +774,7 @@ headerGetEntry_filenames(h) @macros = ( [ qw(int S_IFCHR S_IFBLK KDSKBENT KT_SPEC NR_KEYS MAX_NR_KEYMAPS BLKRRPART TIOCSCTTY - HDIO_GETGEO BLKGETSIZE + HDIO_GETGEO BLKGETSIZE LOOP_GET_STATUS MS_MGC_VAL MS_RDONLY O_NONBLOCK SECTORSIZE WNOHANG VT_ACTIVATE VT_WAITACTIVE VT_GETSTATE CDROM_LOCKDOOR CDROMEJECT ) ], diff --git a/perl-install/devices.pm b/perl-install/devices.pm index 5ebee431e..61d6bd4c7 100644 --- a/perl-install/devices.pm +++ b/perl-install/devices.pm @@ -35,6 +35,18 @@ sub size($) { $low + 1; } +sub set_loop { + my ($file) = @_; + + foreach (0..9) { + local *F; + my $dev = devices::make("loop$_"); + sysopen F, $dev, 0 or next; + !ioctl(F, c::LOOP_GET_STATUS(), my $tmp) && $! == 6 or next; #- 6 == ENXIO + return c::set_loop(fileno F, $file) && $dev; + } +} + sub make($) { local $_ = my $file = $_[0]; my ($type, $major, $minor); @@ -79,6 +91,7 @@ sub make($) { @{ ${{"fd" => [ c::S_IFBLK(), 2, 0 ], "hidbp-mse-" => [ c::S_IFCHR(), 10, 32 ], "lp" => [ c::S_IFCHR(), 6, 0 ], + "loop" => [ c::S_IFBLK(), 7, 0 ], "md" => [ c::S_IFBLK(), 9, 0 ], "nst" => [ c::S_IFCHR(), 9, 128], "scd" => [ c::S_IFBLK(), 11, 0 ], diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 661564ecd..b5d80010e 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -173,8 +173,9 @@ sub mount_part($;$$) { $part->{isMounted} and return; unless ($::testing) { + local $part->{device} = devices::set_loop(loopback::file($part)) || die if isLoopback($part); if (isSwap($part)) { - swap::swapon($part->{device}); + swap::swapon($part->{device}); } else { $part->{mntpoint} or die "missing mount point"; mount(devices::make($part->{device}), ($prefix || '') . $part->{mntpoint}, type2fs($part->{type}), $rdonly); diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index c1fd12697..96d572cb5 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -40,7 +40,7 @@ my @suggestions_mntpoints = qw(/mnt/dos); my @partitions_signatures = ( [ 0x83, 0x438, "\x53\xEF" ], [ 0x82, 4086, "SWAP-SPACE" ], - [ 0x7, 0x3, "NTFS" ], + [ 0x7, 0x1FE, "\x55\xAA", 0x3, "NTFS" ], [ 0xc, 0x1FE, "\x55\xAA", 0x52, "FAT32" ], arch() !~ /^sparc/ ? ( [ 0x6, 0x1FE, "\x55\xAA", 0x36, "FAT" ], diff --git a/perl-install/loopback.pm b/perl-install/loopback.pm index d992f4dec..0fdebebaf 100644 --- a/perl-install/loopback.pm +++ b/perl-install/loopback.pm @@ -19,8 +19,6 @@ sub file { $part->{loopback_file}; } -sub ffile { "$_[0]{device}{mntpoint}$_[0]{loopback_file}" } - sub loopbacks { map { map { @{$_->{loopback} || []} } partition_table::get_normal_parts($_) } @_; } diff --git a/perl-install/modules.pm b/perl-install/modules.pm index 8092956df..8ed1be0c9 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -344,6 +344,9 @@ sub add_alias($$) { $alias .= $scsi++ || '' if $alias eq 'scsi_hostadapter'; log::l("adding alias $alias to $name"); $conf{$alias}{alias} ||= $name; + if ($alias eq "sound" && $name =~ /^snd-card-/) { + $conf{$name}{"post-install"} = "modprobe snd-pcm-oss"; + } $alias; } @@ -472,7 +475,7 @@ sub write_conf { while (my ($k, $v) = each %net) { add_alias($k, $v) } my @l = sort grep { $conf{$_}{alias} && /scsi_hostadapter/ } keys %conf; - add_alias('block-major-11', 'scsi_hostadapter'); + add_alias('block-major-11', 'scsi_hostadapter') if @l; push @l, "ide-floppy" if detect_devices::zips(); $conf{supermount}{"post-install"} = join " ; ", map { "modprobe $_" } @l if @l; -- cgit v1.2.1