HP-UX Reference (11i v2 04/09) - 7 Device (Special) Files, 9 General Information, Index (vol 10)
m
mt(7) mt(7)
mtop.mt_op = MTWEOF;
mtop.mt_count = 2;
ioctl(fd, MTIOCTOP, &mtop);
If fd is a valid file descriptor for an open DDS drive, the following example spaces forward to just past the
next setmark:
#include <sys/types.h>
#include <sys/mtio.h>
struct mtop mtop;
mtop.mt_op = MTFSS;
mtop.mt_count = 1;
ioctl(fd, MTIOCTOP, &mtop);
Given that fd is a valid file descriptor for an opened tape device, and that it has just returned 0 from a
read(2) request. The following system call verifies that the tape has just read a filemark:
#include <sys/types.h>
#include <sys/mtio.h>
struct mtget mtget;
ioctl(fd, MTIOCGET, &mtget);
if (GMT_EOF (mtget.mt_gstat)) {
/* code for filemark detection */
}
WARNINGS
Density specifications BEST (standard naming convention) or f0 (alternate naming convention) activate
data compression on tape devices which support compression. This is also true for the files using the
pre-HP-UX 10.0 naming convention which are linked to these files (see "Naming Conventions" above).
This means that a tape written using one of the eight device files (which are automatically created when
the system is initialized) on a tape device which supports data compression, will contain compressed data.
This tape cannot be successfully read on a tape device which does not support compressed data. For
example, a tape written (using one of the eight automatically created device files) on a newer DDS device
which supports data compression cannot be read on an older DDS device which does not support data
compression.
To accomplish data interchange between devices in a case such as this, a new device file must be manu-
ally created using the mksf(1M) command. In the above example, the options specified to mksf(1M)
should include a density option with an argument of
DDS1, and must not include a compression option.
Use the mksf(1M) command instead of the mknod(1M) command to create tape device files. As of the
10.0 release, there are more configuration options than will fit in the device file’s minor number. Prior to
the 10.0 release, it was possible to select configuration options by directly setting the bits in the device
special file’s minor number using mknod(1M).
As of the 10.0 release, a base set of configuration options are contained in the minor number. Extended
configuration options are stored in a table of configuration properties. The minor number may contain an
index into the property table, which is maintained by the tape driver and is not directly visible to the
user. The mksf(1M) command sets the minor number and modifies the property table as needed based on
mnemonic parameters passed into the command.
If your device configuration requirements are limited to the base set of options, you need not be concerned
with the property table. The base configuration options are as follows:
• hardware address (card instance, target, and unit number)
• density (from the set of pre-defined options listed in mksf(1M))
• compression (using the default compression algorithm)
• rewind or no rewind
• Berkeley or AT&T mode
All other configuration options are extended options that result in use of the property table.
It is recommended that all tape device files be put in the
/dev/rmt directory. All tape device files using
extended configuration options must be put in the /dev/rmt directory. This is required for proper
Section 7−−84 Hewlett-Packard Company − 7 − HP-UX 11i Version 2: September 2004