diff options
author | Karel Zak | 2006-12-07 00:26:18 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:26:18 +0100 |
commit | 2cccd0ff2b26c782dbd05d589b7695cab5e17458 (patch) | |
tree | 45ebc5937d2e083c12b58bdeffc1b1a2046c9598 /fdisk/cfdisk.c | |
parent | Imported from util-linux-2.12b tarball. (diff) | |
download | kernel-qcow2-util-linux-2cccd0ff2b26c782dbd05d589b7695cab5e17458.tar.gz kernel-qcow2-util-linux-2cccd0ff2b26c782dbd05d589b7695cab5e17458.tar.xz kernel-qcow2-util-linux-2cccd0ff2b26c782dbd05d589b7695cab5e17458.zip |
Imported from util-linux-2.12d tarball.
Diffstat (limited to 'fdisk/cfdisk.c')
-rw-r--r-- | fdisk/cfdisk.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c index 9be1c7073..e09b4f5f3 100644 --- a/fdisk/cfdisk.c +++ b/fdisk/cfdisk.c @@ -170,7 +170,7 @@ int sectors = 0; long long cylinders = 0; int cylinder_size = 0; /* heads * sectors */ long long total_size = 0; /* actual_size rounded down */ -long long actual_size = 0; /* set using ioctl */ +long long actual_size = 0; /* (in 512-byte sectors) - set using ioctl */ /* explicitly given user values */ int user_heads = 0, user_sectors = 0; long long user_cylinders = 0; @@ -1579,7 +1579,7 @@ static void fill_p_info(void) { int pn, i; long long bs, bsz; - unsigned long long bytes; + unsigned long long llsectors; struct partition *p; partition_table buffer; partition_info tmp_ext = { 0, 0, 0, 0, FREE_SPACE, PRIMARY }; @@ -1608,15 +1608,9 @@ fill_p_info(void) { ioctl(fd, BLKFLSBUF); /* ignore errors */ /* e.g. Permission Denied */ - if (ioctl(fd, BLKGETSIZE64, &bytes) == 0) - actual_size = (bytes >> 9); - else { - unsigned long sz = 0; - - if (ioctl(fd, BLKGETSIZE, &sz)) - fatal(_("Cannot get disk size"), 3); - actual_size = sz; - } + if (disksize(fd, &llsectors)) + fatal(_("Cannot get disk size"), 3); + actual_size = llsectors; read_sector(buffer.c.b, 0); |