diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2001-09-05 10:14:15 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2001-09-05 10:14:15 +0000 |
commit | 37c23731c72a9c840b596819e4c75a0ef9280faf (patch) | |
tree | ad11f257e8d4f53ef5b5e06bfc43e724ef0a0771 /winsup/cygwin/fhandler_floppy.cc | |
parent | 669153e1444eaefba4e05995a768151ea11740b1 (diff) | |
download | newlib-37c23731c72a9c840b596819e4c75a0ef9280faf.zip newlib-37c23731c72a9c840b596819e4c75a0ef9280faf.tar.gz newlib-37c23731c72a9c840b596819e4c75a0ef9280faf.tar.bz2 |
* fhandler_floppy.cc (fhandler_floppy::lseek): Remove iswinnt check.
Diffstat (limited to 'winsup/cygwin/fhandler_floppy.cc')
-rw-r--r-- | winsup/cygwin/fhandler_floppy.cc | 69 |
1 files changed, 33 insertions, 36 deletions
diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc index 2160d26..471b16b 100644 --- a/winsup/cygwin/fhandler_floppy.cc +++ b/winsup/cygwin/fhandler_floppy.cc @@ -91,44 +91,41 @@ fhandler_dev_floppy::lseek (off_t offset, int whence) DWORD low; LONG high = 0; - if (iswinnt) + DISK_GEOMETRY di; + PARTITION_INFORMATION pi; + DWORD bytes_read; + + if (!DeviceIoControl (get_handle(), + IOCTL_DISK_GET_DRIVE_GEOMETRY, + NULL, 0, + &di, sizeof (di), + &bytes_read, NULL)) { - DISK_GEOMETRY di; - PARTITION_INFORMATION pi; - DWORD bytes_read; - - if (!DeviceIoControl (get_handle(), - IOCTL_DISK_GET_DRIVE_GEOMETRY, - NULL, 0, - &di, sizeof (di), - &bytes_read, NULL)) - { - __seterrno (); - return -1; - } - debug_printf ("disk geometry: (%ld cyl)*(%ld trk)*(%ld sec)*(%ld bps)", - di.Cylinders.LowPart, - di.TracksPerCylinder, - di.SectorsPerTrack, - di.BytesPerSector); - if (DeviceIoControl (get_handle (), - IOCTL_DISK_GET_PARTITION_INFO, - NULL, 0, - &pi, sizeof (pi), - &bytes_read, NULL)) - { - debug_printf ("partition info: %ld (%ld)", - pi.StartingOffset.LowPart, - pi.PartitionLength.LowPart); - drive_size = (long long) pi.PartitionLength.QuadPart; - } - else - { - drive_size = (long long) di.Cylinders.QuadPart * di.TracksPerCylinder * - di.SectorsPerTrack * di.BytesPerSector; - } - debug_printf ("drive size: %ld", drive_size); + __seterrno (); + return -1; + } + debug_printf ("disk geometry: (%ld cyl)*(%ld trk)*(%ld sec)*(%ld bps)", + di.Cylinders.LowPart, + di.TracksPerCylinder, + di.SectorsPerTrack, + di.BytesPerSector); + if (DeviceIoControl (get_handle (), + IOCTL_DISK_GET_PARTITION_INFO, + NULL, 0, + &pi, sizeof (pi), + &bytes_read, NULL)) + { + debug_printf ("partition info: %ld (%ld)", + pi.StartingOffset.LowPart, + pi.PartitionLength.LowPart); + drive_size = (long long) pi.PartitionLength.QuadPart; + } + else + { + drive_size = (long long) di.Cylinders.QuadPart * di.TracksPerCylinder * + di.SectorsPerTrack * di.BytesPerSector; } + debug_printf ("drive size: %ld", drive_size); if (whence == SEEK_END && drive_size > 0) { |