Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Tape and EOF mark

OSR_Community_UserOSR_Community_User Member Posts: 110,217
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

Comments

  • Paul_BunnPaul_Bunn Member Posts: 251
    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:[email protected]]
    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
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
  • Paul_BunnPaul_Bunn Member Posts: 251
    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:[email protected]]
    Sent: Sunday, June 04, 2000 1:52 AM
    To: NT Developers Interest List; [email protected]
    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,
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 13-17 May 2024 Live, Online
Developing Minifilters 1-5 Apr 2024 Live, Online
Internals & Software Drivers 11-15 Mar 2024 Live, Online
Writing WDF Drivers 20-24 May 2024 Live, Online