Tape and EOF mark

Hello,

I’m working with MS Tape interface defined in Win32 API (I’m also
willing to use any IOCTLs if needed).
Does anybody know how to:

  1. mark EOF on my tape???
  2. forward the tape till the end of the tape???

In UNIX it’s dome through ioctl calls with the appropriate codes. None
of this was found in NT…

Thank you in advance.
Giga

There’s no such thing as EOF on tape. There’s EOM(edia), EOD(ata), and then
there’s filemarks and setmarks. EOM is handled already by the tape – it’s
hardmarked on the media and you can’t change it. EOD is also handled
automatically – when the tape is given a command that ends the current
session (eg a REWIND op) the data is marked, and reading past this will
result in an appropriate error.
Positioning within a tape is done by the SetTapePosition() API. There are a
few (old) tape drives out there that do not support positioning to EOD, in
which case you have to “roll your own”.

Regards,

Paul Bunn, UltraBac.com, 425-644-6000
Microsoft MVP - WindowsNT/2000
http://www.ultrabac.com

-----Original Message-----
From: Giga Giguashvili [mailto:xxxxx@ParadigmGeo.com]
Sent: Thursday, June 01, 2000 5:54 AM
To: NT Developers Interest List
Subject: [ntdev] Tape and EOF mark

Hello,

I’m working with MS Tape interface defined in Win32 API (I’m also
willing to use any IOCTLs if needed).
Does anybody know how to:

  1. mark EOF on my tape???
  2. forward the tape till the end of the tape???

In UNIX it’s dome through ioctl calls with the appropriate codes. None
of this was found in NT…

Thank you in advance.
Giga

You shouldn’t be using DeviceIoControl, or have any requirement to send
IOCTLs to a tape device. All tape operations are abstracted into a set of
tape APIs such as PrepareTape, SetTapePosition etc. These APIs are much
easier to use, and have sophisticated device/errorhandling depending on the
device in use. The problem with IOCTLs sent to a device directly is that on
one device it might work, and on another it won’t do anything. By using the
Tape APIs, you’re assured that the correct IOCTL/command is sent to the
device.
I think you’ll find that values 0,3,4 are archaic and aren’t used on any
modern tape drive that NT would support.

Regards,

Paul Bunn, UltraBac.com, 425-644-6000
Microsoft MVP - WindowsNT/2000
http://www.ultrabac.com

-----Original Message-----
From: Giga Giguashvili [mailto:xxxxx@ParadigmGeo.com]
Sent: Sunday, June 04, 2000 1:52 AM
To: NT Developers Interest List; xxxxx@ultrabac.com
Subject: Re: [ntdev] RE: Tape and EOF mark

Paul,
Thank you very much for your reply.
The problem is that I port an existing software from UNIX to NT. There are
several tape operations that I’m not sure how to translate them. Here is a
part of sys/mtio.h file from Sun 5.6.
(There is almost similar file on SGI 6.5, IBM 4.x and Linux 2.2)
/*
* values for mt_op
*/
#define MTWEOF 0 /* write an end-of-file record */
#define MTFSF 1 /* forward space over file mark */
#define MTBSF 2 /* backward space over file mark (1/2" only ) */
#define MTFSR 3 /* forward space to inter-record gap */
#define MTBSR 4 /* backward space to inter-record gap */
#define MTREW 5 /* rewind */
#define MTOFFL 6 /* rewind and put the drive offline */
#define MTNOP 7 /* no operation, sets status only */
#define MTRETEN 8 /* retension the tape (cartridge tape only) */
#define MTERASE 9 /* erase the entire tape */
#define MTEOM 10 /* position to end of media */
#define MTNBSF 11 /* backward space file to BOF */
#define MTSRSZ 12 /* set record size */
#define MTGRSZ 13 /* get record size */
#define MTLOAD 14 /* for loading a tape (use o_delay to open the tape
device) */
Some of them can be mapped to NT IOCTLs and some can’t.
You see the first IOCTL code is used to write EOF record, MTEOM is used to
position the tape on EOM and so on.
Could you please, explain me what are the counterparts of those IOCTLs on
Windows NT.
Thank you in advance,
Giga.
Paul Bunn wrote:
There’s no such thing as EOF on tape. There’s EOM(edia), EOD(ata), and then

there’s filemarks and setmarks. EOM is handled already by the tape – it’s
hardmarked on the media and you can’t change it. EOD is also handled
automatically – when the tape is given a command that ends the current
session (eg a REWIND op) the data is marked, and reading past this will
result in an appropriate error.
Positioning within a tape is done by the SetTapePosition() API. There are a

few (old) tape drives out there that do not support positioning to EOD, in
which case you have to “roll your own”.
Regards,