From 749646d30eb3cefd0df6cbd29f1af6b6b29f745b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 12 Jan 2006 10:10:36 +0000 Subject: use BLKGETSIZE64 to allow detecting partitions bigger than 2TB, and use "double" instead of "unsigned int" (nb: it means we will use doubles instead of ints for computing things, this works quite nicely up to 100_000TB --- perl-install/c/stuff.xs.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index 31e37c748..4a1f845c2 100644 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -226,13 +226,15 @@ floppy_info(name) OUTPUT: RETVAL -unsigned int +double total_sectors(fd) int fd CODE: { - long s; - RETVAL = ioctl(fd, BLKGETSIZE, &s) == 0 ? s : 0; + unsigned long long ll; + unsigned long l; + RETVAL = ioctl(fd, BLKGETSIZE64, &ll) == 0 ? ll / 512 : + ioctl(fd, BLKGETSIZE, &l) == 0 ? l : 0; } OUTPUT: RETVAL @@ -680,7 +682,7 @@ get_iso_volume_ids(int fd) @macros = ( [ qw(int S_IFCHR S_IFBLK S_IFIFO KDSKBENT KT_SPEC K_NOSUCHMAP NR_KEYS MAX_NR_KEYMAPS BLKRRPART TIOCSCTTY - HDIO_GETGEO BLKGETSIZE LOOP_GET_STATUS + HDIO_GETGEO LOOP_GET_STATUS MS_MGC_VAL O_WRONLY O_RDWR O_CREAT O_NONBLOCK F_SETFL F_GETFL WNOHANG VT_ACTIVATE VT_WAITACTIVE VT_GETSTATE CDROM_LOCKDOOR CDROMEJECT CDROM_DRIVE_STATUS LOG_WARNING LOG_INFO LOG_LOCAL1 -- cgit v1.2.1