Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > S


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


scsi_tape — SCSI sequential access device driver


SCSI sequential-access (tape) devices store a sequence of data blocks. Data can be read and written using either fixed or variable sized block mode. If supported by the device, variable sized block mode is normally used (even when all blocks are the same size). Fixed sized block mode is generally only used for tape devices which do not support variable sized blocks. Fixed sized block mode can be used on some tape devices which support variable sized blocks to increase I/O performance.

Generally SCSI tape devices are controlled through the mt (see mt(7)) generic tape device interface. This section describes features that are specific to SCSI tape devices.

The SIOC_CAPACITY ioctl (see scsi(7)) can be used to determine remaining tape capacity for some tape devices. The blksz field indicates the "natural" block size of the device. This value may or may not be the current block size of the device. The number of blocks, indicated by the lba field, is an estimate of how much data can be written on the remaining media. A zero size is returned for devices that do not provide remaining-capacity information. The quantity of data that can actually be written may be higher or lower than indicated, depending on such factors as block size, media defects, data compression, and ability to maintain streaming.

To improve performance, most SCSI tape devices have caches. Read-cache use, called "read ahead", causes the tape drive to read data in anticipation of read requests. Read ahead is only apparent to users in the increased performance that it produces. Write-cache use is called "immediate reporting". Immediate reporting increases I/O performance by reporting a completed write status before the data being written is actually committed to media. This allows the application program to supply additional data so that continuous media motion, called "streaming", can be achieved. The SIOC_GET_IR ioctl can be used to determine if immediate-reporting functionality is currently being used by the device. The value "1" indicates immediate reporting is enabled. By default, the device driver attempts to enable immediate reporting. The SIOC_SET_IR ioctl can be used to explicitly enable or disable immediate reporting. A zero value disables immediate reporting. The value "1" enables immediate reporting. The MTIOCTOP ioctl MTNOP command can be used to cause any cached data to be written (committed) to media. Note that the device immediate reporting mode set by the SIOC_SET_IR ioctl survives between close() and open() calls, but not through system reboot.

The SIOC_GET_BLOCK_SIZE ioctl indicates the device's current block size. A block size of zero indicates the device is in variable-sized-block mode. A non-zero block size indicates the device is in fixed-sized-block mode.

The SIOC_SET_BLOCK_SIZE ioctl changes the current block size to the specified number of bytes. Setting the block size to zero specifies that variable-sized-block mode should be used. Any non-zero block size specifies that fixed-sized-block mode should be used. By default, the device driver attempts to set the block size to zero during open. If variable-sized-block mode is not supported by the device, the driver selects an appropriate block size for fixed-sized-block mode use. Note that the device block size set by the SIOC_SET_BLOCK_SIZE ioctl survives between close() and open() calls, but not through system reboot.

The SIOC_GET_BLOCK_LIMITS ioctl indicates the device's maximum and minimum fixed block-size limits. The device's minimum fixed block size is indicated by the min_blk_size field. The max_blk_size field contains the smaller of the maximum block size supported by the device and the maximum block size supported by the system (MAXPHYS). This is the largest valid block size for the specific combination of device, driver, and host system being used.

The SIOC_GET_POSITION ioctl can be used to determine the current media position for some devices. For devices that support this capability, the resultant value can be used to reposition the media to the same position in the future.

The SIOC_SET_POSITION ioctl can be used to cause media repositioning on some devices. For devices that support this capability, media repositioning via this mechanism can generally be completed more quickly than might be similarly accomplished using record, filemark, or setmark spacing. The argument value specified should be the result of a previous SIOC_GET_POSITION for that media volume.

The following is included from <sys/scsi.h>:

/* ioctl support for SCSI tape commands */ #define SIOC_GET_IR _IOR('S', 14, int) #define SIOC_SET_IR _IOW('S', 15, int) #define SIOC_GET_BLOCK_SIZE _IOR('S', 30, int) #define SIOC_SET_BLOCK_SIZE _IOW('S', 31, int) #define SIOC_GET_BLOCK_LIMITS _IOW('S', 32, struct scsi_block_limits) #define SIOC_GET_POSITION _IOR('S', 33, int) #define SIOC_SET_POSITION _IOW('S', 34, int) /* structure for SIOC_GET_BLOCK_LIMITS ioctl */ struct scsi_block_limits { unsigned min_blk_size; unsigned max_blk_size; };


SCSI bus and device resets cause some devices to reposition media to beginning-of-tape (BOT). This unintentional media repositioning can cause loss of data. The scsi_tape driver causes the first subsequent open() attempt to fail as an indication of potential data loss.

The scsi_tape driver does not write filemarks at close if the media has been programmatically repositioned. Applications that reposition the media prior to closing the device should write any required tapemarks.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.