* 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:
@ -35,7 +35,7 @@ struct mtop {
|
||||
};
|
||||
|
||||
/* Magnetic Tape operations [Not all operations supported by all drivers]: */
|
||||
#define MTRESET 0 /* +reset drive in case of problems */
|
||||
#define MTRESET 0 /* reset drive in case of problems */
|
||||
#define MTFSF 1 /* forward space over FileMark,
|
||||
* position at first record of next file
|
||||
*/
|
||||
@ -80,15 +80,14 @@ struct mtop {
|
||||
/* structure for MTIOCGET - mag tape get status command */
|
||||
|
||||
struct mtget {
|
||||
long mt_type; /* type of magtape device
|
||||
* Cygwin: MT_ISUNKNOWN */
|
||||
long mt_type; /* type of magtape device */
|
||||
long mt_resid; /* residual count: (not sure)
|
||||
* number of bytes ignored, or
|
||||
* number of files not skipped, or
|
||||
* number of records not skipped.
|
||||
* Cygwin: remaining KB until 1.5.7.
|
||||
* active partition since 1.5.8,
|
||||
* same as on linux.
|
||||
* active partition since 1.5.8
|
||||
* (same as on GNU-Linux).
|
||||
*/
|
||||
/* the following registers are device dependent */
|
||||
long mt_dsreg; /* status register, Contains blocksize and
|
||||
@ -133,17 +132,27 @@ struct mtpos {
|
||||
#define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */
|
||||
#define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */
|
||||
#define GMT_WR_PROT(x) ((x) & 0x04000000)
|
||||
/* #define GMT_ ? ((x) & 0x02000000) */
|
||||
#define GMT_REP_SM(x) ((x) & 0x02000000) /* Cygwin: rep. setmarks */
|
||||
#define GMT_ONLINE(x) ((x) & 0x01000000)
|
||||
#define GMT_D_6250(x) ((x) & 0x00800000)
|
||||
#define GMT_D_1600(x) ((x) & 0x00400000)
|
||||
#define GMT_D_800(x) ((x) & 0x00200000)
|
||||
#define GMT_PADDING(x) ((x) & 0x00100000) /* data padding */
|
||||
#define GMT_HW_ECC(x) ((x) & 0x00080000) /* HW error correction */
|
||||
#define GMT_PADDING(x) ((x) & 0x00100000) /* Cygwin: data padding */
|
||||
#define GMT_HW_ECC(x) ((x) & 0x00080000) /* Cygwin: HW error corr. */
|
||||
#define GMT_DR_OPEN(x) ((x) & 0x00040000) /* door open (no tape) */
|
||||
#define GMT_HW_COMP(x) ((x) & 0x00020000) /* HW compression */
|
||||
#define GMT_HW_COMP(x) ((x) & 0x00020000) /* Cygwin: HW compression */
|
||||
#define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* immediate report mode */
|
||||
/* 16 generic status bits unused */
|
||||
#define GMT_CLN(x) ((x) & 0x00008000) /* cleaning requested */
|
||||
/* 15 generic status bits unused */
|
||||
/* Cygwin only: The below settings are also used by the GNU-Linux SCSI tape
|
||||
driver but they aren't usually reported here. Unfortunately, there's no
|
||||
other official method to retrieve the values of these settings and
|
||||
reporting them here apparently doesn't hurt. */
|
||||
#define GMT_TWO_FM(x) ((x) & 0x00000080) /* two fm after write */
|
||||
#define GMT_FAST_MTEOM(x) ((x) & 0x00000040) /* fast seek to eom */
|
||||
#define GMT_AUTO_LOCK(x) ((x) & 0x00000020) /* auto door lock on r/w */
|
||||
#define GMT_SYSV(x) ((x) & 0x00000010) /* SYSV read semantics */
|
||||
#define GMT_NOWAIT(x) ((x) & 0x00000008) /* don't wait for positioning commands */
|
||||
|
||||
|
||||
/* SCSI-tape specific definitions */
|
||||
@ -156,6 +165,33 @@ struct mtpos {
|
||||
#define MT_ST_SOFTERR_SHIFT 0
|
||||
#define MT_ST_SOFTERR_MASK 0xffff
|
||||
|
||||
/* Bitfields for the MTSETDRVBUFFER ioctl. */
|
||||
#define MT_ST_OPTIONS 0xf0000000
|
||||
#define MT_ST_BOOLEANS 0x10000000
|
||||
#define MT_ST_SETBOOLEANS 0x30000000
|
||||
#define MT_ST_CLEARBOOLEANS 0x40000000
|
||||
#define MT_ST_WRITE_THRESHOLD 0x20000000 /* Not supported */
|
||||
#define MT_ST_DEF_OPTIONS 0x60000000 /* Not supported */
|
||||
#define MT_ST_EOT_WZ_SIZE 0xf0000000 /* Cygwin only */
|
||||
|
||||
#define MT_ST_BUFFER_WRITES 0x00000001
|
||||
#define MT_ST_ASYNC_WRITES 0x00000002 /* Not supported */
|
||||
#define MT_ST_READ_AHEAD 0x00000004 /* Not supported */
|
||||
#define MT_ST_DEBUGGING 0x00000008 /* Not supported */
|
||||
#define MT_ST_TWO_FM 0x00000010
|
||||
#define MT_ST_FAST_MTEOM 0x00000020
|
||||
#define MT_ST_AUTO_LOCK 0x00000040
|
||||
#define MT_ST_DEF_WRITES 0x00000080 /* Not supported */
|
||||
#define MT_ST_CAN_BSR 0x00000100 /* Not supported */
|
||||
#define MT_ST_NO_BLKLIMS 0x00000200 /* Not supported */
|
||||
#define MT_ST_CAN_PARTITIONS 0x00000400 /* Not supported */
|
||||
#define MT_ST_SCSI2LOGICAL 0x00000800 /* Not supported */
|
||||
#define MT_ST_SYSV 0x00001000
|
||||
#define MT_ST_NOWAIT 0x00002000
|
||||
#define MT_ST_ECC 0x00010000 /* Cygwin only */
|
||||
#define MT_ST_PADDING 0x00020000 /* Cygwin only */
|
||||
#define MT_ST_REPORT_SM 0x00040000 /* Cygwin only */
|
||||
|
||||
/*
|
||||
* Constants for mt_type. Not all of these are supported,
|
||||
* and these are not all of the ones that are supported.
|
||||
|
Reference in New Issue
Block a user