From 3ee82da30da28ad797c045571d29f20f4633c681 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 21 Aug 2013 20:28:12 +0000 Subject: [PATCH] * fhandler_tape.cc (mtinfo_drive::create_partitions): Allow partitioning of drives supporting select partitions. (mtinfo_drive::get_status): Fill in current partition and number of partitions on tape into mt_resid. * include/cygwin/mtio.h (struct mtget): Align mt_resid comment to aforementioned change. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. --- winsup/cygwin/ChangeLog | 10 ++++++++++ winsup/cygwin/fhandler_tape.cc | 8 +++++++- winsup/cygwin/include/cygwin/mtio.h | 11 +++++++---- winsup/cygwin/include/cygwin/version.h | 4 +++- winsup/cygwin/release/1.7.25 | 3 +++ 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 83fc78955..b42a8c641 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,13 @@ +2013-08-21 Corinna Vinschen + + * fhandler_tape.cc (mtinfo_drive::create_partitions): Allow partitioning + of drives supporting select partitions. + (mtinfo_drive::get_status): Fill in current partition and number of + partitions on tape into mt_resid. + * include/cygwin/mtio.h (struct mtget): Align mt_resid comment to + aforementioned change. + * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. + 2013-08-20 Corinna Vinschen * fhandler_tape.cc (mtinfo_drive::create_partitions): Fix long-standing diff --git a/winsup/cygwin/fhandler_tape.cc b/winsup/cygwin/fhandler_tape.cc index 8002b955d..969ee7653 100644 --- a/winsup/cygwin/fhandler_tape.cc +++ b/winsup/cygwin/fhandler_tape.cc @@ -560,6 +560,11 @@ mtinfo_drive::create_partitions (HANDLE mt, int32_t count) TAPE_FUNC (CreateTapePartition (mt, TAPE_INITIATOR_PARTITIONS, count <= 0 ? 0 : 2, (DWORD) count)); } + else if (get_feature (TAPE_DRIVE_SELECT)) + { + TAPE_FUNC (CreateTapePartition (mt, TAPE_SELECT_PARTITIONS, + count <= 0 ? 0 : 2, 0)); + } else if (get_feature (TAPE_DRIVE_FIXED)) { /* This is supposed to work for Tandberg SLR drivers up to version @@ -798,7 +803,8 @@ mtinfo_drive::get_status (HANDLE mt, struct mtget *get) if (!notape) { - get->mt_resid = partition; + get->mt_resid = (partition & 0xffff) + | ((mp ()->PartitionCount & 0xffff) << 16); get->mt_fileno = part (partition)->file; get->mt_blkno = part (partition)->fblock; diff --git a/winsup/cygwin/include/cygwin/mtio.h b/winsup/cygwin/include/cygwin/mtio.h index f18f27bd6..ae3aa8d33 100644 --- a/winsup/cygwin/include/cygwin/mtio.h +++ b/winsup/cygwin/include/cygwin/mtio.h @@ -1,6 +1,6 @@ /* cygwin/mtio.h - Copyright 1999, 2000, 2001, 2004 Red Hat, Inc. + Copyright 1999, 2000, 2001, 2004, 2013 Red Hat, Inc. Written by Corinna Vinschen @@ -85,9 +85,12 @@ struct mtget { * 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 GNU-Linux). + * Cygwin: + * remaining KB until 1.5.7. + * active partition until 1.7.24. + * active partition in low 16 bits, + * number of partitions on this tape + * in next 16 bits, since 1.7.25. */ /* the following registers are device dependent */ long mt_dsreg; /* status register, Contains blocksize and diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 6681a9955..e0c666bf9 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -439,12 +439,14 @@ details. */ 267: Export rawmemchr. 268: Export GetCommandLineA, GetCommandLineW 269: Allow application override of posix_memalign. + 270: Redefine mtget.mt_resid field to contain current partition as well + as number of partitions on tape. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 269 +#define CYGWIN_VERSION_API_MINOR 270 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/release/1.7.25 b/winsup/cygwin/release/1.7.25 index b3fb78043..6a1f55dbf 100644 --- a/winsup/cygwin/release/1.7.25 +++ b/winsup/cygwin/release/1.7.25 @@ -5,6 +5,9 @@ What's new: What changed: ------------- +- Redefine content of mtget tape info struct to allow fetching the number of + partitions on a tape. + Bug fixes: ----------