* errno.cc (errmap): Map ERROR_SHARING_VIOLATION to EBUSY,

ERROR_EOM_OVERFLOW and ERROR_NO_DATA_DETECTED to EIO.  Add mappings
	for ERROR_NO_MEDIA_IN_DRIVE, ERROR_DEVICE_REQUIRES_CLEANING and
	ERROR_DEVICE_DOOR_OPEN.
	* fhandler.h (class fhandler_dev_raw): Drop varblkop member.
	(fhandler_dev_raw::is_eom): De-virtualize.
	(fhandler_dev_raw::is_eof): Ditto.
	(class fhandler_dev_tape): Drop lasterr and dp member.  Add mt_mtx
	member.  Drop all private methods formerly used by ioctl.
	(fhandler_dev_tape::is_rewind_device): Use get_minor for clarity.
	(fhandler_dev_tape::driveno): New method.
	(fhandler_dev_tape::drive_init): New method.
	(fhandler_dev_tape::clear): Remove method.
	(fhandler_dev_tape::is_eom): Ditto.
	(fhandler_dev_tape::is_eof): Ditto.
	(fhandler_dev_tape::write_file): Ditto.
	(fhandler_dev_tape::read_file): Ditto.
	(fhandler_dev_tape::_lock): New method.
	(fhandler_dev_tape::unlock): New method.
	(fhandler_dev_tape::raw_read): New method.
	(fhandler_dev_tape::raw_write): New method.
	* fhandler_raw.cc (fhandler_dev_raw::is_eom): New method.
	(fhandler_dev_raw::is_eof): New method.
	(fhandler_dev_raw::open): Allow setting write through option by
	using the O_TEXT flag as ... flag.
	(fhandler_dev_raw::writebuf): Remove usage of varblkop and other
	tape specific code.
	(fhandler_dev_raw::raw_read): Ditto.
	(fhandler_dev_raw::dup): Ditto.
	* fhandler_tape.cc: Rewrite tape operations entirely.  Implement
	new tape driver classes mtinfo, mtinfo_drive and mtinfo_part.
	Reduce fhandler_dev_tape methods to mostly just calling appropriate
	mtinfo_drive methods.
	(mtinfo_init): New function adding the mtinfo shared memory area.
	* mtinfo.h: New file, containing the definition of the new tape
	driver classes.
	* shared.cc: Include mtinfo.h.
	(offsets): Add entry for mtinfo shared memory area.
	(memory_init): Call mtinfo_init.
	* shared_info.h (shared_locations): Add SH_MTINFO shared location.
	* include/cygwin/mtio.h: Change and add various comments.  Add GMT_xxx
	macros for new generic flags.  Add MT_ST_xxx bitfield definitions
	for MTSETDRVBUFFER ioctl.
	* include/cygwin/version.h: Bump API minor version number.
This commit is contained in:
Corinna Vinschen
2004-03-26 21:43:49 +00:00
parent 359b6e4c49
commit dee563095d
10 changed files with 1460 additions and 630 deletions

View File

@ -509,7 +509,6 @@ class fhandler_dev_raw: public fhandler_base
int lastblk_to_read : 1;
int is_writing : 1;
int has_written : 1;
int varblkop : 1;
virtual void clear (void);
virtual BOOL write_file (const void *buf, DWORD to_write,
@ -518,9 +517,9 @@ class fhandler_dev_raw: public fhandler_base
virtual int writebuf (void);
/* returns not null, if `win_error' determines an end of media condition */
virtual int is_eom(int win_error) = 0;
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) = 0;
virtual int is_eof(int win_error);
fhandler_dev_raw ();
@ -569,18 +568,14 @@ class fhandler_dev_floppy: public fhandler_dev_raw
class fhandler_dev_tape: public fhandler_dev_raw
{
int lasterr;
TAPE_GET_DRIVE_PARAMETERS dp;
HANDLE mt_mtx;
bool is_rewind_device () { return get_unit () < 128; }
bool is_rewind_device () { return get_minor () < 128; }
unsigned int driveno () { return (unsigned int) get_minor () & 0x7f; }
void drive_init (void);
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);
inline bool _lock ();
inline int unlock (int ret = 0);
public:
fhandler_dev_tape ();
@ -588,33 +583,15 @@ class fhandler_dev_tape: public fhandler_dev_raw
virtual int open (int flags, mode_t mode = 0);
virtual int close (void);
void raw_read (void *ptr, size_t& ulen);
int raw_write (const void *ptr, size_t ulen);
virtual _off64_t lseek (_off64_t offset, int whence);
virtual int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
virtual int dup (fhandler_base *child);
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 *block, unsigned long *partition = NULL);
int tape_set_pos (int mode, long count, bool sfm_func = false);
int _tape_set_pos (int mode, long count, int partition = 0);
int tape_erase (int mode);
int tape_prepare (int action);
int tape_set_blocksize (long count);
int tape_status (struct mtget *get);
int tape_compression (long count);
int tape_partition (long count);
int tape_set_partition (long count);
};
/* Standard disk file */