From b470a0e81fb3e56dfd7886e0099e7b6b7c148101 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 26 Sep 2005 14:55:40 +0000 Subject: * fhandler.h (class fhandler_dev_raw): Add drive information members drive_size, current_position and bytes_per_sector. (fhandler_dev_floppy::get_drive_info): Declare. * fhandler_floppy.cc (fhandler_dev_floppy::is_eom): Define ERROR_SEEK and ERROR_SECTOR_NOT_FOUND as end-of-medium conditions. (fhandler_dev_floppy::get_drive_info): New method to have one function retrieving drive info. (fhandler_dev_floppy::open): Call get_drive_info to get drive information right from the start. (fhandler_dev_floppy::lseek): Use and set drive information members. Especially keep track of current_position. (fhandler_dev_floppy::ioctl): Ditto. * fhandler_raw.cc (fhandler_dev_raw::write_file): Keep track of current_position. (fhandler_dev_raw::read_file): Ditto. (fhandler_dev_raw::raw_read): Never try to read beyond end-of-medium. (fhandler_dev_raw::dup): Handle new drive information members. --- winsup/cygwin/fhandler.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'winsup/cygwin/fhandler.h') diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index bdc73bfbf..ac1e4e9a9 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -551,6 +551,9 @@ public: class fhandler_dev_raw: public fhandler_base { protected: + _off64_t drive_size; + _off64_t current_position; + unsigned long bytes_per_sector; char *devbuf; size_t devbufsiz; size_t devbufstart; @@ -600,6 +603,9 @@ class fhandler_dev_raw: public fhandler_base class fhandler_dev_floppy: public fhandler_dev_raw { + private: + int fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo); + protected: virtual int is_eom (int win_error); virtual int is_eof (int win_error); -- cgit v1.2.3