public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: 1.5.12: mt sees incorrect maximum block size
Date: Wed, 15 Dec 2004 09:05:00 -0000	[thread overview]
Message-ID: <20041215090728.GB13158@cygbert.vinschen.de> (raw)
In-Reply-To: <5995792B428BD840906480B184A386CBB508A7@marvin.killerobot.com>

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 <windows.h>
#include <stdio.h>

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@cygwin.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/

  reply	other threads:[~2004-12-15  9:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-14 22:36 Richard Simon
2004-12-15  9:05 ` Corinna Vinschen [this message]
2004-12-15 18:33   ` Brian Dessent
2004-12-16 13:14     ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041215090728.GB13158@cygbert.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).