xref: /linux/drivers/scsi/st_options.h (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds    The compile-time configurable defaults for the Linux SCSI tape driver.
41da177e4SLinus Torvalds 
51da177e4SLinus Torvalds    Copyright 1995-2003 Kai Makisara.
61da177e4SLinus Torvalds 
740f6b36cSKai Makisara    Last modified: Thu Feb 21 21:47:07 2008 by kai.makisara
81da177e4SLinus Torvalds */
91da177e4SLinus Torvalds 
101da177e4SLinus Torvalds #ifndef _ST_OPTIONS_H
111da177e4SLinus Torvalds #define _ST_OPTIONS_H
121da177e4SLinus Torvalds 
131da177e4SLinus Torvalds /* If TRY_DIRECT_IO is non-zero, the driver tries to transfer data directly
141da177e4SLinus Torvalds    between the user buffer and tape drive. If this is not possible, driver
151da177e4SLinus Torvalds    buffer is used. If TRY_DIRECT_IO is zero, driver buffer is always used. */
161da177e4SLinus Torvalds #define TRY_DIRECT_IO 1
171da177e4SLinus Torvalds 
181da177e4SLinus Torvalds /* The driver does not wait for some operations to finish before returning
191da177e4SLinus Torvalds    to the user program if ST_NOWAIT is non-zero. This helps if the SCSI
201da177e4SLinus Torvalds    adapter does not support multiple outstanding commands. However, the user
211da177e4SLinus Torvalds    should not give a new tape command before the previous one has finished. */
221da177e4SLinus Torvalds #define ST_NOWAIT 0
231da177e4SLinus Torvalds 
241da177e4SLinus Torvalds /* If ST_IN_FILE_POS is nonzero, the driver positions the tape after the
251da177e4SLinus Torvalds    record been read by the user program even if the tape has moved further
261da177e4SLinus Torvalds    because of buffered reads. Should be set to zero to support also drives
271da177e4SLinus Torvalds    that can't space backwards over records. NOTE: The tape will be
281da177e4SLinus Torvalds    spaced backwards over an "accidentally" crossed filemark in any case. */
291da177e4SLinus Torvalds #define ST_IN_FILE_POS 0
301da177e4SLinus Torvalds 
311da177e4SLinus Torvalds /* If ST_RECOVERED_WRITE_FATAL is non-zero, recovered errors while writing
321da177e4SLinus Torvalds    are considered "hard errors". */
331da177e4SLinus Torvalds #define ST_RECOVERED_WRITE_FATAL 0
341da177e4SLinus Torvalds 
351da177e4SLinus Torvalds /* The "guess" for the block size for devices that don't support MODE
361da177e4SLinus Torvalds    SENSE. */
371da177e4SLinus Torvalds #define ST_DEFAULT_BLOCK 0
381da177e4SLinus Torvalds 
391da177e4SLinus Torvalds /* The minimum tape driver buffer size in kilobytes in fixed block mode.
401da177e4SLinus Torvalds    Must be non-zero. */
411da177e4SLinus Torvalds #define ST_FIXED_BUFFER_BLOCKS 32
421da177e4SLinus Torvalds 
431da177e4SLinus Torvalds /* Maximum number of scatter/gather segments */
441da177e4SLinus Torvalds #define ST_MAX_SG      256
451da177e4SLinus Torvalds 
461da177e4SLinus Torvalds /* The number of scatter/gather segments to allocate at first try (must be
471da177e4SLinus Torvalds    smaller or equal to the maximum). */
481da177e4SLinus Torvalds #define ST_FIRST_SG    8
491da177e4SLinus Torvalds 
501da177e4SLinus Torvalds /* The size of the first scatter/gather segments (determines the maximum block
511da177e4SLinus Torvalds    size for SCSI adapters not supporting scatter/gather). The default is set
521da177e4SLinus Torvalds    to try to allocate the buffer as one chunk. */
531da177e4SLinus Torvalds #define ST_FIRST_ORDER  5
541da177e4SLinus Torvalds 
551da177e4SLinus Torvalds 
561da177e4SLinus Torvalds /* The following lines define defaults for properties that can be set
571da177e4SLinus Torvalds    separately for each drive using the MTSTOPTIONS ioctl. */
581da177e4SLinus Torvalds 
591da177e4SLinus Torvalds /* If ST_TWO_FM is non-zero, the driver writes two filemarks after a
601da177e4SLinus Torvalds    file being written. Some drives can't handle two filemarks at the
611da177e4SLinus Torvalds    end of data. */
621da177e4SLinus Torvalds #define ST_TWO_FM 0
631da177e4SLinus Torvalds 
641da177e4SLinus Torvalds /* If ST_BUFFER_WRITES is non-zero, writes in fixed block mode are
651da177e4SLinus Torvalds    buffered until the driver buffer is full or asynchronous write is
661da177e4SLinus Torvalds    triggered. May make detection of End-Of-Medium early enough fail. */
671da177e4SLinus Torvalds #define ST_BUFFER_WRITES 1
681da177e4SLinus Torvalds 
691da177e4SLinus Torvalds /* If ST_ASYNC_WRITES is non-zero, the SCSI write command may be started
701da177e4SLinus Torvalds    without waiting for it to finish. May cause problems in multiple
711da177e4SLinus Torvalds    tape backups. */
721da177e4SLinus Torvalds #define ST_ASYNC_WRITES 1
731da177e4SLinus Torvalds 
741da177e4SLinus Torvalds /* If ST_READ_AHEAD is non-zero, blocks are read ahead in fixed block
751da177e4SLinus Torvalds    mode. */
761da177e4SLinus Torvalds #define ST_READ_AHEAD 1
771da177e4SLinus Torvalds 
781da177e4SLinus Torvalds /* If ST_AUTO_LOCK is non-zero, the drive door is locked at the first
791da177e4SLinus Torvalds    read or write command after the device is opened. The door is opened
801da177e4SLinus Torvalds    when the device is closed. */
811da177e4SLinus Torvalds #define ST_AUTO_LOCK 0
821da177e4SLinus Torvalds 
831da177e4SLinus Torvalds /* If ST_FAST_MTEOM is non-zero, the MTEOM ioctl is done using the
841da177e4SLinus Torvalds    direct SCSI command. The file number status is lost but this method
851da177e4SLinus Torvalds    is fast with some drives. Otherwise MTEOM is done by spacing over
861da177e4SLinus Torvalds    files and the file number status is retained. */
871da177e4SLinus Torvalds #define ST_FAST_MTEOM 0
881da177e4SLinus Torvalds 
891da177e4SLinus Torvalds /* If ST_SCSI2LOGICAL is nonzero, the logical block addresses are used for
901da177e4SLinus Torvalds    MTIOCPOS and MTSEEK by default. Vendor addresses are used if ST_SCSI2LOGICAL
911da177e4SLinus Torvalds    is zero. */
921da177e4SLinus Torvalds #define ST_SCSI2LOGICAL 0
931da177e4SLinus Torvalds 
941da177e4SLinus Torvalds /* If ST_SYSV is non-zero, the tape behaves according to the SYS V semantics.
951da177e4SLinus Torvalds    The default is BSD semantics. */
961da177e4SLinus Torvalds #define ST_SYSV 0
971da177e4SLinus Torvalds 
9840f6b36cSKai Makisara /* If ST_SILI is non-zero, the SILI bit is set when reading in variable block
9940f6b36cSKai Makisara    mode and the block size is determined using the residual returned by the HBA. */
10040f6b36cSKai Makisara #define ST_SILI 0
10140f6b36cSKai Makisara 
1021da177e4SLinus Torvalds /* Time to wait for the drive to become ready if blocking open */
1031da177e4SLinus Torvalds #define ST_BLOCK_SECONDS     120
1041da177e4SLinus Torvalds 
1051da177e4SLinus Torvalds #endif
106