blob: 894ebf1ce529ee7db9b560256063ae0809fa714d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
log::l("PATCH: 2006-fix-parsing-dmraid");
use log;
undef *c::total_sectors;
*c::total_sectors = sub {
my ($fd) = @_;
use log;
log::l("PATCH: total_sectors");
my ($BLKGETSIZE, $BLKGETSIZE64) = (0x1260, 0x80041272);
open(my $F, "<& $fd") or return;
my $ll = '';
if (ioctl($F, $BLKGETSIZE64, $ll)) {
my ($v, $v1) = unpack("L2", $ll);
$v1 * 1024 * 1024 * 8 + $v / 512;
} elsif (ioctl($F, $BLKGETSIZE, $ll)) {
log::l("defaulting to BLKGETSIZE");
unpack("L", $ll);
} else {
0;
}
};
|