* fhandler.h (class fhandler_dev_raw): Delete current_position and
eof_detected status flag. Delete is_eom and is_eof methods. Move drive_size, bytes_per_sector, eom_detected status flag, as well as the methods read_file, write_file, raw_read and raw_write to ... (class fhandler_dev_floppy): ... here. Remove is_eom and is_eof methods. Add dup method. * fhandler_floppy.cc (IS_EOM): New macro. (fhandler_dev_floppy::is_eom): Remove. (fhandler_dev_floppy::is_eof): Remove. (fhandler_dev_floppy::fhandler_dev_floppy): Initialize status flags. (fhandler_dev_floppy::get_drive_info): Only call EX functions on systems supporting them and stop suffering strange delays. (fhandler_dev_floppy::read_file): Move here, drop setting current_position. (fhandler_dev_floppy::write_file): Move here, drop setting current_position. (fhandler_dev_floppy::open): Rearrange comment. (fhandler_dev_floppy::dup): New method. (fhandler_dev_floppy::get_current_position): New inline method. Use instead of former current_position were appropriate. (fhandler_dev_floppy::raw_read): Move here. Drop EOF handling. (fhandler_dev_floppy::raw_write): Move here. Drop EOF handling. (fhandler_dev_floppy::lseek): Remove useless conditions. Convert sector_aligned_offset to LARGE_INTEGER to improve SetFilePointer call. (fhandler_dev_floppy::ioctl): Move blocksize check in RDSETBLK case to here. * fhandler_raw.cc (fhandler_dev_raw::is_eom): Remove. (fhandler_dev_raw::is_eof): Remove. (fhandler_dev_raw::write_file): Remove. (fhandler_dev_raw::read_file): Remove. (fhandler_dev_raw::raw_read): Remove. (fhandler_dev_raw::raw_write): Remove. (fhandler_dev_raw::dup): Drop copying removed members. (fhandler_dev_raw::ioctl): Drop blocksize testing. * wincap.h: Implement has_disk_ex_ioctls throughout. * wincap.cc: Ditto. (wincap_vista): Preliminary wincaps for Windows Vista/Longhorn. (wincapc::init): Add Vista/Longhorn handling.
This commit is contained in:
@ -551,50 +551,29 @@ 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;
|
||||
size_t devbufend;
|
||||
struct status_flags
|
||||
{
|
||||
unsigned eom_detected : 1;
|
||||
unsigned eof_detected : 1;
|
||||
unsigned lastblk_to_read : 1;
|
||||
public:
|
||||
status_flags () :
|
||||
eom_detected (0), eof_detected (0), lastblk_to_read (0)
|
||||
{}
|
||||
status_flags () : lastblk_to_read (0) {}
|
||||
} status;
|
||||
|
||||
IMPLEMENT_STATUS_FLAG (bool, eom_detected)
|
||||
IMPLEMENT_STATUS_FLAG (bool, eof_detected)
|
||||
IMPLEMENT_STATUS_FLAG (bool, lastblk_to_read)
|
||||
|
||||
virtual BOOL write_file (const void *buf, DWORD to_write,
|
||||
DWORD *written, int *err);
|
||||
virtual BOOL read_file (void *buf, DWORD to_read, DWORD *read, int *err);
|
||||
|
||||
/* returns not null, if `win_error' determines an end of media condition */
|
||||
virtual int is_eom(int win_error);
|
||||
/* returns not null, if `win_error' determines an end of file condition */
|
||||
virtual int is_eof(int win_error);
|
||||
|
||||
fhandler_dev_raw ();
|
||||
|
||||
public:
|
||||
~fhandler_dev_raw ();
|
||||
|
||||
int open (int flags, mode_t mode = 0);
|
||||
void raw_read (void *ptr, size_t& ulen);
|
||||
int raw_write (const void *ptr, size_t ulen);
|
||||
|
||||
int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
|
||||
|
||||
int dup (fhandler_base *child);
|
||||
|
||||
int ioctl (unsigned int cmd, void *buf);
|
||||
|
||||
void fixup_after_fork (HANDLE);
|
||||
@ -604,20 +583,32 @@ class fhandler_dev_raw: public fhandler_base
|
||||
class fhandler_dev_floppy: public fhandler_dev_raw
|
||||
{
|
||||
private:
|
||||
_off64_t drive_size;
|
||||
unsigned long bytes_per_sector;
|
||||
struct status_flags
|
||||
{
|
||||
unsigned eom_detected : 1;
|
||||
public:
|
||||
status_flags () : eom_detected (0) {}
|
||||
} status;
|
||||
|
||||
IMPLEMENT_STATUS_FLAG (bool, eom_detected)
|
||||
|
||||
inline _off64_t get_current_position ();
|
||||
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);
|
||||
BOOL write_file (const void *buf, DWORD to_write, DWORD *written, int *err);
|
||||
BOOL read_file (void *buf, DWORD to_read, DWORD *read, int *err);
|
||||
|
||||
public:
|
||||
fhandler_dev_floppy ();
|
||||
|
||||
virtual int open (int flags, mode_t mode = 0);
|
||||
|
||||
virtual _off64_t lseek (_off64_t offset, int whence);
|
||||
|
||||
virtual int ioctl (unsigned int cmd, void *buf);
|
||||
int open (int flags, mode_t mode = 0);
|
||||
int dup (fhandler_base *child);
|
||||
void raw_read (void *ptr, size_t& ulen);
|
||||
int raw_write (const void *ptr, size_t ulen);
|
||||
_off64_t lseek (_off64_t offset, int whence);
|
||||
int ioctl (unsigned int cmd, void *buf);
|
||||
};
|
||||
|
||||
class fhandler_dev_tape: public fhandler_dev_raw
|
||||
|
Reference in New Issue
Block a user