Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 15 Dec 2004 10:07:28 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: 1.5.12: mt sees incorrect maximum block size Message-ID: <20041215090728.GB13158@cygbert.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <5995792B428BD840906480B184A386CBB508A7 AT marvin DOT killerobot DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5995792B428BD840906480B184A386CBB508A7@marvin.killerobot.com> User-Agent: Mutt/1.4.2i On Dec 14 14:36, Richard Simon wrote: > when I attempt to set the correct block size with mt (or try to do so with tar) I am unable to do so. > mt status 2 reports a maximum block size of 65535, whereas the windows driver and the winTarSCSI utility both report a much larger maximum block size of 16777214 > > I can use the winTarSCSI utility to write tapes with a block size of 262144, but tar under cygwin will not write with a block size larger than 65535. Now that you mention it... While rewriting the Cygwin tape driver code a couple of months ago, I found the same problem. I've just drawn the wrong conclusion. According to the documentation, my Tandberg SLR7 drive is capable of writing 262144 byte blocks and the XP drivers properties dialog also reports a max block size of 262144. But the Windows function reports 65536 as maximum block size. Yes, it's actually Windows which returns that value. I just wrote a small testcase(tm), which verifies that without involving Cygwin. ======== SNIP ======== #include #include int main (int argc, char **argv) { TAPE_SET_MEDIA_PARAMETERS smp; TAPE_GET_DRIVE_PARAMETERS dp; TAPE_GET_MEDIA_PARAMETERS mp; DWORD len, err; HANDLE fh = CreateFile ("\\\\.\\tape0", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (fh != INVALID_HANDLE_VALUE) { if (argc > 1) { smp.BlockSize = strtoul (argv[1], NULL, 0); if (smp.BlockSize > 0) { printf ("Try setting BlockSize to %lu\n", smp.BlockSize); while ((err = SetTapeParameters (fh, SET_TAPE_MEDIA_INFORMATION, (void *) &smp)) == ERROR_MEDIA_CHANGED) ; if (err) printf ("SetTapeParameters returned Win32 error %lu\n", err); } } len = sizeof dp; while ((err = GetTapeParameters (fh, GET_TAPE_DRIVE_INFORMATION, &len, &dp)) == ERROR_MEDIA_CHANGED) ; if (!err) { printf ("DefaultBlockSize: %lu\n", dp.DefaultBlockSize); printf ("MinimumBlockSize: %lu\n", dp.MinimumBlockSize); printf ("MaximumBlockSize: %lu\n", dp.MaximumBlockSize); } len = sizeof mp; while ((err = GetTapeParameters (fh, GET_TAPE_MEDIA_INFORMATION, &len, &mp)) == ERROR_MEDIA_CHANGED) ; if (!err) { printf ("CurrentBlockSize: %lu\n", mp.BlockSize); } CloseHandle (fh); } return 0; } ======== SNAP ======== $ gcc mt-test.c -o mt-test $ ./mt-test DefaultBlockSize: 512 MinimumBlockSize: 1 MaximumBlockSize: 65536 CurrentBlockSize: 512 $ ./mt-test 65536 Try setting BlockSize to 65536 DefaultBlockSize: 512 MinimumBlockSize: 1 MaximumBlockSize: 65536 CurrentBlockSize: 65536 $ ./mt-test 131072 Try setting BlockSize to 131072 SetTapeParameters returned Win32 error 87 DefaultBlockSize: 512 MinimumBlockSize: 1 MaximumBlockSize: 65536 CurrentBlockSize: 65536 So, as you can see, the Windows NT tape functions doesn't allow me to set the block size to more than 64K, too. That's the same functionality used inside of Cygwin. I have no idea how to workaround that. I also didn't find anything useful on the Web so far. I'd *love* to get that solved, but I don't know how. I'm going to ask someone who's writing tape drivers for Windows, perhaps he has a clue. Other than that, I'm open to any useful hint from the community. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/