diff options
author | Christopher Faylor <me@cgf.cx> | 2003-01-26 06:42:40 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-01-26 06:42:40 +0000 |
commit | 9a751621661bab473334333b4422599bc26164a2 (patch) | |
tree | 742a43bdccdc8dec7c86ddf6813f6f82aa465c5a /winsup/cygwin/fhandler_floppy.cc | |
parent | 989c97fe141b5869c3dfd438683b14a8bc8453ca (diff) | |
download | cygnal-9a751621661bab473334333b4422599bc26164a2.tar.gz cygnal-9a751621661bab473334333b4422599bc26164a2.tar.bz2 cygnal-9a751621661bab473334333b4422599bc26164a2.zip |
* uinfo.cc (pwdgrp::load): Regularize strace output. Add warning for
CreateFile failure.
Diffstat (limited to 'winsup/cygwin/fhandler_floppy.cc')
-rw-r--r-- | winsup/cygwin/fhandler_floppy.cc | 192 |
1 files changed, 96 insertions, 96 deletions
diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc index fe338317b..e5da2418d 100644 --- a/winsup/cygwin/fhandler_floppy.cc +++ b/winsup/cygwin/fhandler_floppy.cc @@ -201,112 +201,112 @@ fhandler_dev_floppy::ioctl (unsigned int cmd, void *buf) { case HDIO_GETGEO: { - debug_printf ("HDIO_GETGEO"); - 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); - start = pi.StartingOffset.QuadPart >> 9ULL; - } - struct hd_geometry *geo = (struct hd_geometry *) buf; - geo->heads = di.TracksPerCylinder; - geo->sectors = di.SectorsPerTrack; - geo->cylinders = di.Cylinders.LowPart; - geo->start = start; - return 0; + debug_printf ("HDIO_GETGEO"); + 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); + start = pi.StartingOffset.QuadPart >> 9ULL; + } + struct hd_geometry *geo = (struct hd_geometry *) buf; + geo->heads = di.TracksPerCylinder; + geo->sectors = di.SectorsPerTrack; + geo->cylinders = di.Cylinders.LowPart; + geo->start = start; + return 0; } case BLKGETSIZE: case BLKGETSIZE64: { - debug_printf ("BLKGETSIZE"); - 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 = pi.PartitionLength.QuadPart; - } - else - { - drive_size = di.Cylinders.QuadPart * di.TracksPerCylinder * - di.SectorsPerTrack * di.BytesPerSector; - } - if (cmd == BLKGETSIZE) - *(long *)buf = drive_size >> 9UL; - else - *(__off64_t *)buf = drive_size; - return 0; + debug_printf ("BLKGETSIZE"); + 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 = pi.PartitionLength.QuadPart; + } + else + { + drive_size = di.Cylinders.QuadPart * di.TracksPerCylinder * + di.SectorsPerTrack * di.BytesPerSector; + } + if (cmd == BLKGETSIZE) + *(long *)buf = drive_size >> 9UL; + else + *(__off64_t *)buf = drive_size; + return 0; } case BLKRRPART: { - debug_printf ("BLKRRPART"); - if (!DeviceIoControl (get_handle (), - IOCTL_DISK_UPDATE_DRIVE_SIZE, - NULL, 0, - &di, sizeof (di), - &bytes_read, NULL)) - { - __seterrno (); - return -1; - } - return 0; + debug_printf ("BLKRRPART"); + if (!DeviceIoControl (get_handle (), + IOCTL_DISK_UPDATE_DRIVE_SIZE, + NULL, 0, + &di, sizeof (di), + &bytes_read, NULL)) + { + __seterrno (); + return -1; + } + return 0; } case BLKSSZGET: { - debug_printf ("BLKSSZGET"); - 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); - *(int *)buf = di.BytesPerSector; - return 0; + debug_printf ("BLKSSZGET"); + 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); + *(int *)buf = di.BytesPerSector; + return 0; } default: return fhandler_dev_raw::ioctl (cmd, buf); |