summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.h
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2004-03-13 18:15:06 +0000
committerCorinna Vinschen <corinna@vinschen.de>2004-03-13 18:15:06 +0000
commit09f36ed08f383df03cfe23c286fb24b549486d1f (patch)
tree31f16e95eb7a014bf6216741b7dea6f19282b9e0 /winsup/cygwin/fhandler.h
parent5817840adfff858867a0b9dfec089a2b67751cb9 (diff)
downloadcygnal-09f36ed08f383df03cfe23c286fb24b549486d1f.tar.gz
cygnal-09f36ed08f383df03cfe23c286fb24b549486d1f.tar.bz2
cygnal-09f36ed08f383df03cfe23c286fb24b549486d1f.zip
* errno.cc (errmap): Handle ERROR_BUS_RESET.
* fhandler.h (fhandler_dev_raw::write_file): New method, created from former static function. (fhandler_dev_raw::read_file): Ditto. (reset_devbuf): New inline method. (class fhandler_dev_tape): Add TAPE_GET_DRIVE_PARAMETERS member `dp'. (fhandler_dev_tape::write_file): New method. (fhandler_dev_tape::read_file): Ditto. (fhandler_dev_tape::tape_get_feature): Convert to inline method. (fhandler_dev_tape::tape_error): New method, created from former static function. (fhandler_dev_tape::tape_get_blocksize): Remove declaration. * fhandler_raw.cc (fhandler_dev_raw::write_file): New method, created from former static function. (fhandler_dev_raw::read_file): Ditto. (fhandler_dev_raw::writebuf): Accomodate the fact that no devbuf exists under variable block size condition. (fhandler_dev_raw::raw_read): Ditto. Add local p pointer to simplify pointer arithmetic. (fhandler_dev_raw::raw_write): Always set devbufend to 0 when starting with writing. Accomodate the fact that no devbuf exists under variable block size condition. * fhandler_tape.cc: Various formatting changes. (TAPE_FUNC): New macro. Use throughout as tape function loop. (get_ll): Convert into macro. (IS_EOM): New macro. (IS_EOF): New macro. (fhandler_dev_tape::is_eom): Use IS_EOM macro. (fhandler_dev_tape::is_eof): Use IS_EOF macro. (fhandler_dev_tape::write_file): New method. (fhandler_dev_tape::read_file): New method. (fhandler_dev_tape::open): Get drive information block here once. (fhandler_dev_tape::lseek): Remove unneeded duplicate code. (fhandler_dev_tape::dup): Duplicate drive information block. (fhandler_dev_tape::ioctl): Remove drvbuf in variable block size mode. Return ERROR_INVALID_BLOCK_LENGTH instead of ERROR_MORE_DATA if buffer contains data which would get lost on buffer size changing. Use absolute tape positioning also if drive only supports logical block positioning. (fhandler_dev_tape::tape_error): New method, created from former static function. (fhandler_dev_tape::tape_get_pos): Allow logical block reporting. Workaround tape driver bug. (fhandler_dev_tape::_tape_set_pos): Reset device buffer and flags after successful repositioning. (fhandler_dev_tape::tape_set_pos): Allow logical block positioning. Workaround tape driver bug. (fhandler_dev_tape::tape_erase): Use dp instead of calling GetTapeParameters. (fhandler_dev_tape::tape_prepare): Ditto. (fhandler_dev_tape::tape_get_blocksize): Remove. (fhandler_dev_tape::tape_set_blocksize): Don't call tape_get_blocksize. Error handling already done in fhandler_dev_tape::ioctl. (fhandler_dev_tape::tape_status): Remove local `dp' variable. Accomodate logical tape reporting. Call tape_get_feature instead of accessing feature words directly. (fhandler_dev_tape::tape_compression): Use dp instead of calling GetTapeParameters. Fix resetting datcompression.
Diffstat (limited to 'winsup/cygwin/fhandler.h')
-rw-r--r--winsup/cygwin/fhandler.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 2fde1f77e..dbbac2c12 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -514,6 +514,9 @@ class fhandler_dev_raw: public fhandler_base
int varblkop : 1;
virtual void clear (void);
+ 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);
virtual int writebuf (void);
/* returns not null, if `win_error' determines an end of media condition */
@@ -523,6 +526,13 @@ class fhandler_dev_raw: public fhandler_base
fhandler_dev_raw ();
+ inline void reset_devbuf (void)
+ {
+ devbufstart = devbufend = 0;
+ eom_detected = eof_detected = 0;
+ lastblk_to_read = is_writing = has_written = 0;
+ }
+
public:
~fhandler_dev_raw (void);
@@ -562,14 +572,17 @@ class fhandler_dev_floppy: public fhandler_dev_raw
class fhandler_dev_tape: public fhandler_dev_raw
{
int lasterr;
+ TAPE_GET_DRIVE_PARAMETERS dp;
bool is_rewind_device () { return get_unit () < 128; }
protected:
virtual void clear (void);
-
virtual int is_eom (int win_error);
virtual int is_eof (int win_error);
+ 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);
public:
fhandler_dev_tape ();
@@ -586,13 +599,19 @@ class fhandler_dev_tape: public fhandler_dev_raw
virtual int ioctl (unsigned int cmd, void *buf);
private:
+ inline bool tape_get_feature (DWORD parm)
+ {
+ return ((parm & TAPE_DRIVE_HIGH_FEATURES)
+ ? ((dp.FeaturesHigh & parm) != 0)
+ : ((dp.FeaturesLow & parm) != 0));
+ }
+ int tape_error (const char *txt);
int tape_write_marks (int marktype, DWORD len);
int tape_get_pos (unsigned long *ret);
int tape_set_pos (int mode, long count, bool sfm_func = false);
+ int _tape_set_pos (int mode, long count);
int tape_erase (int mode);
int tape_prepare (int action);
- bool tape_get_feature (DWORD parm);
- int tape_get_blocksize (long *min, long *def, long *max, long *cur);
int tape_set_blocksize (long count);
int tape_status (struct mtget *get);
int tape_compression (long count);