xref: /OK3568_Linux_fs/kernel/drivers/scsi/st_options.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun    The compile-time configurable defaults for the Linux SCSI tape driver.
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun    Copyright 1995-2003 Kai Makisara.
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun    Last modified: Thu Feb 21 21:47:07 2008 by kai.makisara
8*4882a593Smuzhiyun */
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #ifndef _ST_OPTIONS_H
11*4882a593Smuzhiyun #define _ST_OPTIONS_H
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun /* If TRY_DIRECT_IO is non-zero, the driver tries to transfer data directly
14*4882a593Smuzhiyun    between the user buffer and tape drive. If this is not possible, driver
15*4882a593Smuzhiyun    buffer is used. If TRY_DIRECT_IO is zero, driver buffer is always used. */
16*4882a593Smuzhiyun #define TRY_DIRECT_IO 1
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun /* The driver does not wait for some operations to finish before returning
19*4882a593Smuzhiyun    to the user program if ST_NOWAIT is non-zero. This helps if the SCSI
20*4882a593Smuzhiyun    adapter does not support multiple outstanding commands. However, the user
21*4882a593Smuzhiyun    should not give a new tape command before the previous one has finished. */
22*4882a593Smuzhiyun #define ST_NOWAIT 0
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun /* If ST_IN_FILE_POS is nonzero, the driver positions the tape after the
25*4882a593Smuzhiyun    record been read by the user program even if the tape has moved further
26*4882a593Smuzhiyun    because of buffered reads. Should be set to zero to support also drives
27*4882a593Smuzhiyun    that can't space backwards over records. NOTE: The tape will be
28*4882a593Smuzhiyun    spaced backwards over an "accidentally" crossed filemark in any case. */
29*4882a593Smuzhiyun #define ST_IN_FILE_POS 0
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun /* If ST_RECOVERED_WRITE_FATAL is non-zero, recovered errors while writing
32*4882a593Smuzhiyun    are considered "hard errors". */
33*4882a593Smuzhiyun #define ST_RECOVERED_WRITE_FATAL 0
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun /* The "guess" for the block size for devices that don't support MODE
36*4882a593Smuzhiyun    SENSE. */
37*4882a593Smuzhiyun #define ST_DEFAULT_BLOCK 0
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun /* The minimum tape driver buffer size in kilobytes in fixed block mode.
40*4882a593Smuzhiyun    Must be non-zero. */
41*4882a593Smuzhiyun #define ST_FIXED_BUFFER_BLOCKS 32
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun /* Maximum number of scatter/gather segments */
44*4882a593Smuzhiyun #define ST_MAX_SG      256
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun /* The number of scatter/gather segments to allocate at first try (must be
47*4882a593Smuzhiyun    smaller or equal to the maximum). */
48*4882a593Smuzhiyun #define ST_FIRST_SG    8
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun /* The size of the first scatter/gather segments (determines the maximum block
51*4882a593Smuzhiyun    size for SCSI adapters not supporting scatter/gather). The default is set
52*4882a593Smuzhiyun    to try to allocate the buffer as one chunk. */
53*4882a593Smuzhiyun #define ST_FIRST_ORDER  5
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun /* The following lines define defaults for properties that can be set
57*4882a593Smuzhiyun    separately for each drive using the MTSTOPTIONS ioctl. */
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun /* If ST_TWO_FM is non-zero, the driver writes two filemarks after a
60*4882a593Smuzhiyun    file being written. Some drives can't handle two filemarks at the
61*4882a593Smuzhiyun    end of data. */
62*4882a593Smuzhiyun #define ST_TWO_FM 0
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun /* If ST_BUFFER_WRITES is non-zero, writes in fixed block mode are
65*4882a593Smuzhiyun    buffered until the driver buffer is full or asynchronous write is
66*4882a593Smuzhiyun    triggered. May make detection of End-Of-Medium early enough fail. */
67*4882a593Smuzhiyun #define ST_BUFFER_WRITES 1
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun /* If ST_ASYNC_WRITES is non-zero, the SCSI write command may be started
70*4882a593Smuzhiyun    without waiting for it to finish. May cause problems in multiple
71*4882a593Smuzhiyun    tape backups. */
72*4882a593Smuzhiyun #define ST_ASYNC_WRITES 1
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun /* If ST_READ_AHEAD is non-zero, blocks are read ahead in fixed block
75*4882a593Smuzhiyun    mode. */
76*4882a593Smuzhiyun #define ST_READ_AHEAD 1
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun /* If ST_AUTO_LOCK is non-zero, the drive door is locked at the first
79*4882a593Smuzhiyun    read or write command after the device is opened. The door is opened
80*4882a593Smuzhiyun    when the device is closed. */
81*4882a593Smuzhiyun #define ST_AUTO_LOCK 0
82*4882a593Smuzhiyun 
83*4882a593Smuzhiyun /* If ST_FAST_MTEOM is non-zero, the MTEOM ioctl is done using the
84*4882a593Smuzhiyun    direct SCSI command. The file number status is lost but this method
85*4882a593Smuzhiyun    is fast with some drives. Otherwise MTEOM is done by spacing over
86*4882a593Smuzhiyun    files and the file number status is retained. */
87*4882a593Smuzhiyun #define ST_FAST_MTEOM 0
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun /* If ST_SCSI2LOGICAL is nonzero, the logical block addresses are used for
90*4882a593Smuzhiyun    MTIOCPOS and MTSEEK by default. Vendor addresses are used if ST_SCSI2LOGICAL
91*4882a593Smuzhiyun    is zero. */
92*4882a593Smuzhiyun #define ST_SCSI2LOGICAL 0
93*4882a593Smuzhiyun 
94*4882a593Smuzhiyun /* If ST_SYSV is non-zero, the tape behaves according to the SYS V semantics.
95*4882a593Smuzhiyun    The default is BSD semantics. */
96*4882a593Smuzhiyun #define ST_SYSV 0
97*4882a593Smuzhiyun 
98*4882a593Smuzhiyun /* If ST_SILI is non-zero, the SILI bit is set when reading in variable block
99*4882a593Smuzhiyun    mode and the block size is determined using the residual returned by the HBA. */
100*4882a593Smuzhiyun #define ST_SILI 0
101*4882a593Smuzhiyun 
102*4882a593Smuzhiyun /* Time to wait for the drive to become ready if blocking open */
103*4882a593Smuzhiyun #define ST_BLOCK_SECONDS     120
104*4882a593Smuzhiyun 
105*4882a593Smuzhiyun #endif
106