* 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.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user