#include <asm/dma.h>
#include <asm/system.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_dbg.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_driver.h>
+#include <scsi/scsi_eh.h>
+#include <scsi/scsi_host.h>
+#include <scsi/scsi_ioctl.h>
+#include <scsi/scsi_request.h>
+
+
/* The driver prints some debugging information on the console if DEBUG
is defined and non-zero. */
#define DEBUG 0
#define DEBC(a)
#endif
-
-#include "scsi.h"
-#include <scsi/scsi_host.h>
-
-#include <scsi/scsi_driver.h>
-#include <scsi/scsi_ioctl.h>
-
#define ST_KILOBYTE 1024
#include "st_options.h"
static int buffer_kbs;
static int max_sg_segs;
static int try_direct_io = TRY_DIRECT_IO;
-static int try_rdio = TRUE;
-static int try_wdio = TRUE;
+static int try_rdio = 1;
+static int try_wdio = 1;
static int st_dev_max;
static int st_nr_dev;
/* If the device signature is on the list of incompatible drives, the
function returns a pointer to the name of the correct driver (if known) */
-static char * st_incompatible(Scsi_Device* SDp)
+static char * st_incompatible(struct scsi_device* SDp)
{
struct st_reject_data *rp;
}
/* Convert the result to success code */
-static int st_chk_result(Scsi_Tape *STp, Scsi_Request * SRpnt)
+static int st_chk_result(Scsi_Tape *STp, struct scsi_request * SRpnt)
{
int result = SRpnt->sr_result;
unsigned char *sense = SRpnt->sr_sense_buffer, scode;
SRpnt->sr_cmnd[3], SRpnt->sr_cmnd[4], SRpnt->sr_cmnd[5],
SRpnt->sr_bufflen);
if (driver_byte(result) & DRIVER_SENSE)
- print_req_sense("st", SRpnt);
+ scsi_print_req_sense("st", SRpnt);
} else ) /* end DEB */
if (!(driver_byte(result) & DRIVER_SENSE) ||
((sense[0] & 0x70) == 0x70 &&
SRpnt->sr_cmnd[0] != TEST_UNIT_READY)) { /* Abnormal conditions for tape */
if (driver_byte(result) & DRIVER_SENSE) {
printk(KERN_WARNING "%s: Error with sense data: ", name);
- print_req_sense("st", SRpnt);
+ scsi_print_req_sense("st", SRpnt);
} else
printk(KERN_WARNING
"%s: Error %x (sugg. bt 0x%x, driver bt 0x%x, host bt 0x%x).\n",
/* Wakeup from interrupt */
-static void st_sleep_done(Scsi_Cmnd * SCpnt)
+static void st_sleep_done(struct scsi_cmnd * SCpnt)
{
int remainder;
Scsi_Tape *STp = container_of(SCpnt->request->rq_disk->private_data,
/* Do the scsi command. Waits until command performed if do_wait is true.
Otherwise write_behind_check() is used to check that the command
has finished. */
-static Scsi_Request *
- st_do_scsi(Scsi_Request * SRpnt, Scsi_Tape * STp, unsigned char *cmd, int bytes,
- int direction, int timeout, int retries, int do_wait)
+static struct scsi_request *
+st_do_scsi(struct scsi_request * SRpnt, Scsi_Tape * STp, unsigned char *cmd,
+ int bytes, int direction, int timeout, int retries, int do_wait)
{
unsigned char *bp;
it messes up the block number). */
static int cross_eof(Scsi_Tape * STp, int forward)
{
- Scsi_Request *SRpnt;
+ struct scsi_request *SRpnt;
unsigned char cmd[MAX_COMMAND_SIZE];
cmd[0] = SPACE;
DEBC(printk(ST_DEB_MSG "%s: Stepping over filemark %s.\n",
tape_name(STp), forward ? "forward" : "backward"));
- SRpnt = st_do_scsi(NULL, STp, cmd, 0, SCSI_DATA_NONE,
- STp->device->timeout, MAX_RETRIES, TRUE);
+ SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE,
+ STp->device->timeout, MAX_RETRIES, 1);
if (!SRpnt)
return (STp->buffer)->syscall_result;
int offset, transfer, blks;
int result;
unsigned char cmd[MAX_COMMAND_SIZE];
- Scsi_Request *SRpnt;
+ struct scsi_request *SRpnt;
ST_partstat *STps;
if ((STp->buffer)->writing) {
cmd[3] = blks >> 8;
cmd[4] = blks;
- SRpnt = st_do_scsi(NULL, STp, cmd, transfer, SCSI_DATA_WRITE,
- STp->device->timeout, MAX_WRITE_RETRIES, TRUE);
+ SRpnt = st_do_scsi(NULL, STp, cmd, transfer, DMA_TO_DEVICE,
+ STp->device->timeout, MAX_WRITE_RETRIES, 1);
if (!SRpnt)
return (STp->buffer)->syscall_result;
result = 0;
if (!seek_next) {
if (STps->eof == ST_FM_HIT) {
- result = cross_eof(STp, FALSE); /* Back over the EOF hit */
+ result = cross_eof(STp, 0); /* Back over the EOF hit */
if (!result)
STps->eof = ST_NOEOF;
else {
/* Set the mode parameters */
static int set_mode_densblk(Scsi_Tape * STp, ST_mode * STm)
{
- int set_it = FALSE;
+ int set_it = 0;
unsigned long arg;
char *name = tape_name(STp);
STm->default_density >= 0 &&
STm->default_density != STp->density) {
arg = STm->default_density;
- set_it = TRUE;
+ set_it = 1;
} else
arg = STp->density;
arg <<= MT_ST_DENSITY_SHIFT;
STm->default_blksize >= 0 &&
STm->default_blksize != STp->block_size) {
arg |= STm->default_blksize;
- set_it = TRUE;
+ set_it = 1;
} else
arg |= STp->block_size;
if (set_it &&
}
-/* Lock or unlock the drive door. Don't use when Scsi_Request allocated. */
+/* Lock or unlock the drive door. Don't use when scsi_request allocated. */
static int do_door_lock(Scsi_Tape * STp, int do_lock)
{
int retval, cmd;
STps->rw = ST_IDLE;
STps->eof = ST_NOEOF;
STps->at_sm = 0;
- STps->last_block_valid = FALSE;
+ STps->last_block_valid = 0;
STps->drv_block = -1;
STps->drv_file = -1;
}
static int test_ready(Scsi_Tape *STp, int do_wait)
{
int attentions, waits, max_wait, scode;
- int retval = CHKRES_READY, new_session = FALSE;
+ int retval = CHKRES_READY, new_session = 0;
unsigned char cmd[MAX_COMMAND_SIZE];
- Scsi_Request *SRpnt = NULL;
+ struct scsi_request *SRpnt = NULL;
max_wait = do_wait ? ST_BLOCK_SECONDS : 0;
for (attentions=waits=0; ; ) {
memset((void *) &cmd[0], 0, MAX_COMMAND_SIZE);
cmd[0] = TEST_UNIT_READY;
- SRpnt = st_do_scsi(SRpnt, STp, cmd, 0, SCSI_DATA_NONE,
- STp->long_timeout, MAX_READY_RETRIES, TRUE);
+ SRpnt = st_do_scsi(SRpnt, STp, cmd, 0, DMA_NONE,
+ STp->long_timeout, MAX_READY_RETRIES, 1);
if (!SRpnt) {
retval = (STp->buffer)->syscall_result;
scode = (SRpnt->sr_sense_buffer[2] & 0x0f);
if (scode == UNIT_ATTENTION) { /* New media? */
- new_session = TRUE;
+ new_session = 1;
if (attentions < MAX_ATTENTIONS) {
attentions++;
continue;
*/
static int check_tape(Scsi_Tape *STp, struct file *filp)
{
- int i, retval, new_session = FALSE, do_wait;
+ int i, retval, new_session = 0, do_wait;
unsigned char cmd[MAX_COMMAND_SIZE], saved_cleaning;
unsigned short st_flags = filp->f_flags;
- Scsi_Request *SRpnt = NULL;
+ struct scsi_request *SRpnt = NULL;
ST_mode *STm;
ST_partstat *STps;
char *name = tape_name(STp);
if (mode != STp->current_mode) {
DEBC(printk(ST_DEB_MSG "%s: Mode change from %d to %d.\n",
name, STp->current_mode, mode));
- new_session = TRUE;
+ new_session = 1;
STp->current_mode = mode;
}
STm = &(STp->modes[STp->current_mode]);
STps->rw = ST_IDLE;
STps->eof = ST_NOEOF;
STps->at_sm = 0;
- STps->last_block_valid = FALSE;
+ STps->last_block_valid = 0;
STps->drv_block = 0;
STps->drv_file = 0;
}
- new_session = TRUE;
+ new_session = 1;
}
else {
STp->cleaning_req |= saved_cleaning;
memset((void *) &cmd[0], 0, MAX_COMMAND_SIZE);
cmd[0] = READ_BLOCK_LIMITS;
- SRpnt = st_do_scsi(SRpnt, STp, cmd, 6, SCSI_DATA_READ, STp->device->timeout,
- MAX_READY_RETRIES, TRUE);
+ SRpnt = st_do_scsi(SRpnt, STp, cmd, 6, DMA_FROM_DEVICE,
+ STp->device->timeout, MAX_READY_RETRIES, 1);
if (!SRpnt) {
retval = (STp->buffer)->syscall_result;
goto err_out;
cmd[0] = MODE_SENSE;
cmd[4] = 12;
- SRpnt = st_do_scsi(SRpnt, STp, cmd, 12, SCSI_DATA_READ, STp->device->timeout,
- MAX_READY_RETRIES, TRUE);
+ SRpnt = st_do_scsi(SRpnt, STp, cmd, 12, DMA_FROM_DEVICE,
+ STp->device->timeout, MAX_READY_RETRIES, 1);
if (!SRpnt) {
retval = (STp->buffer)->syscall_result;
goto err_out;
}
scsi_release_request(SRpnt);
SRpnt = NULL;
- STp->inited = TRUE;
+ STp->inited = 1;
if (STp->block_size > 0)
(STp->buffer)->buffer_blocks =
}
if (new_session) { /* Change the drive parameters for the new mode */
- STp->density_changed = STp->blksize_changed = FALSE;
- STp->compression_changed = FALSE;
+ STp->density_changed = STp->blksize_changed = 0;
+ STp->compression_changed = 0;
if (!(STm->defaults_for_writes) &&
(retval = set_mode_densblk(STp, STm)) < 0)
goto err_out;
{
int result = 0, result2;
unsigned char cmd[MAX_COMMAND_SIZE];
- Scsi_Request *SRpnt;
+ struct scsi_request *SRpnt;
Scsi_Tape *STp = filp->private_data;
ST_mode *STm = &(STp->modes[STp->current_mode]);
ST_partstat *STps = &(STp->ps[STp->partition]);
cmd[0] = WRITE_FILEMARKS;
cmd[4] = 1 + STp->two_fm;
- SRpnt = st_do_scsi(NULL, STp, cmd, 0, SCSI_DATA_NONE,
- STp->device->timeout, MAX_WRITE_RETRIES, TRUE);
+ SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE,
+ STp->device->timeout, MAX_WRITE_RETRIES, 1);
if (!SRpnt) {
result = (STp->buffer)->syscall_result;
goto out;
STps->drv_file++;
STps->drv_block = 0;
if (STp->two_fm)
- cross_eof(STp, FALSE);
+ cross_eof(STp, 0);
STps->eof = ST_FM;
}
if (STp->can_bsr)
result = flush_buffer(STp, 0);
else if (STps->eof == ST_FM_HIT) {
- result = cross_eof(STp, FALSE);
+ result = cross_eof(STp, 0);
if (result) {
if (STps->drv_file >= 0)
STps->drv_file++;
STps->eof = ST_NOEOF;
}
} else if ((STps->eof == ST_NOEOF &&
- !(result = cross_eof(STp, TRUE))) ||
+ !(result = cross_eof(STp, 1))) ||
STps->eof == ST_FM_HIT) {
if (STps->drv_file >= 0)
STps->drv_file++;
STbp->buffer_bytes = 0; /* can be used as transfer counter */
}
else
- STbp->do_dio = FALSE; /* fall back to buffering with any error */
+ STbp->do_dio = 0; /* fall back to buffering with any error */
STbp->sg_segs = STbp->do_dio;
STbp->frp_sg_current = 0;
DEB(
}
)
} else
- STbp->do_dio = FALSE;
+ STbp->do_dio = 0;
DEB( STp->nbr_requests++; )
if (!STbp->do_dio) {
STbp = STp->buffer;
if (STbp->do_dio) {
- sgl_unmap_user_pages(&(STbp->sg[0]), STbp->do_dio, FALSE);
+ sgl_unmap_user_pages(&(STbp->sg[0]), STbp->do_dio, 0);
STbp->do_dio = 0;
}
}
int async_write;
unsigned char cmd[MAX_COMMAND_SIZE];
const char __user *b_point;
- Scsi_Request *SRpnt = NULL;
+ struct scsi_request *SRpnt = NULL;
Scsi_Tape *STp = filp->private_data;
ST_mode *STm;
ST_partstat *STps;
goto out;
}
- retval = setup_buffering(STp, buf, count, FALSE);
+ retval = setup_buffering(STp, buf, count, 0);
if (retval)
goto out;
if (STp->block_size != 0 && STm->do_buffer_writes &&
!(STp->try_dio && try_wdio) && STps->eof < ST_EOM_OK &&
STbp->buffer_bytes < STbp->buffer_size) {
- STp->dirty = TRUE;
+ STp->dirty = 1;
/* Don't write a buffer that is not full enough. */
if (!async_write && count == 0)
break;
cmd[3] = blks >> 8;
cmd[4] = blks;
- SRpnt = st_do_scsi(SRpnt, STp, cmd, transfer, SCSI_DATA_WRITE,
+ SRpnt = st_do_scsi(SRpnt, STp, cmd, transfer, DMA_TO_DEVICE,
STp->device->timeout, MAX_WRITE_RETRIES, !async_write);
if (!SRpnt) {
retval = STbp->syscall_result;
if (!retry_eot && (SRpnt->sr_sense_buffer[0] & 1) == 0 &&
(scode == NO_SENSE || scode == RECOVERED_ERROR)) {
move_buffer_data(STp->buffer, transfer - undone);
- retry_eot = TRUE;
+ retry_eot = 1;
if (STps->drv_block >= 0) {
STps->drv_block += (transfer - undone) /
STp->block_size;
Does release user buffer mapping if it is set.
*/
-static long read_tape(Scsi_Tape *STp, long count, Scsi_Request ** aSRpnt)
+static long read_tape(Scsi_Tape *STp, long count, struct scsi_request ** aSRpnt)
{
int transfer, blks, bytes;
unsigned char cmd[MAX_COMMAND_SIZE];
- Scsi_Request *SRpnt;
+ struct scsi_request *SRpnt;
ST_mode *STm;
ST_partstat *STps;
ST_buffer *STbp;
cmd[4] = blks;
SRpnt = *aSRpnt;
- SRpnt = st_do_scsi(SRpnt, STp, cmd, bytes, SCSI_DATA_READ,
- STp->device->timeout, MAX_RETRIES, TRUE);
+ SRpnt = st_do_scsi(SRpnt, STp, cmd, bytes, DMA_FROM_DEVICE,
+ STp->device->timeout, MAX_RETRIES, 1);
release_buffering(STp);
*aSRpnt = SRpnt;
if (!SRpnt)
ssize_t retval = 0;
ssize_t i, transfer;
int special, do_dio = 0;
- Scsi_Request *SRpnt = NULL;
+ struct scsi_request *SRpnt = NULL;
Scsi_Tape *STp = filp->private_data;
ST_mode *STm;
ST_partstat *STps;
STps->eof, STbp->buffer_bytes);
) /* end DEB */
- retval = setup_buffering(STp, buf, count, TRUE);
+ retval = setup_buffering(STp, buf, count, 1);
if (retval)
goto out;
do_dio = STbp->do_dio;
cd0 = STm->cdevs[0]; cd1 = STm->cdevs[1];
memcpy(STm, &(STp->modes[0]), sizeof(ST_mode));
STm->cdevs[0] = cd0; STm->cdevs[1] = cd1;
- modes_defined = TRUE;
+ modes_defined = 1;
DEBC(printk(ST_DEB_MSG
"%s: Initialized mode %d definition from mode 0\n",
name, STp->current_mode));
DEBC( printk(KERN_INFO "%s: Default block size set to %d bytes.\n",
name, STm->default_blksize));
if (STp->ready == ST_READY) {
- STp->blksize_changed = FALSE;
+ STp->blksize_changed = 0;
set_mode_densblk(STp, STm);
}
}
DEBC( printk(KERN_INFO "%s: Density default set to %x\n",
name, STm->default_density));
if (STp->ready == ST_READY) {
- STp->density_changed = FALSE;
+ STp->density_changed = 0;
set_mode_densblk(STp, STm);
}
}
DEBC( printk(KERN_INFO "%s: Compression default set to %x\n",
name, (value & 1)));
if (STp->ready == ST_READY) {
- STp->compression_changed = FALSE;
+ STp->compression_changed = 0;
st_compression(STp, (STm->default_compression == ST_YES));
}
}
static int read_mode_page(Scsi_Tape *STp, int page, int omit_block_descs)
{
unsigned char cmd[MAX_COMMAND_SIZE];
- Scsi_Request *SRpnt = NULL;
+ struct scsi_request *SRpnt = NULL;
memset(cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = MODE_SENSE;
cmd[2] = page;
cmd[4] = 255;
- SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], SCSI_DATA_READ,
- STp->device->timeout, 0, TRUE);
+ SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], DMA_FROM_DEVICE,
+ STp->device->timeout, 0, 1);
if (SRpnt == NULL)
return (STp->buffer)->syscall_result;
{
int pgo;
unsigned char cmd[MAX_COMMAND_SIZE];
- Scsi_Request *SRpnt = NULL;
+ struct scsi_request *SRpnt = NULL;
memset(cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = MODE_SELECT;
(STp->buffer)->b_data[MH_OFF_DEV_SPECIFIC] &= ~MH_BIT_WP;
(STp->buffer)->b_data[pgo + MP_OFF_PAGE_NBR] &= MP_MSK_PAGE_NBR;
- SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], SCSI_DATA_WRITE,
- (slow ? STp->long_timeout : STp->device->timeout), 0, TRUE);
+ SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], DMA_TO_DEVICE,
+ (slow ? STp->long_timeout : STp->device->timeout), 0, 1);
if (SRpnt == NULL)
return (STp->buffer)->syscall_result;
return (-EIO);
/* Read the current page contents */
- retval = read_mode_page(STp, COMPRESSION_PAGE, FALSE);
+ retval = read_mode_page(STp, COMPRESSION_PAGE, 0);
if (retval) {
DEBC(printk(ST_DEB_MSG "%s: Compression mode page not supported.\n",
name));
b_data[mpoffs + CP_OFF_C_ALGO] = 0; /* no compression */
}
- retval = write_mode_page(STp, COMPRESSION_PAGE, FALSE);
+ retval = write_mode_page(STp, COMPRESSION_PAGE, 0);
if (retval) {
DEBC(printk(ST_DEB_MSG "%s: Compression change failed.\n", name));
return (-EIO);
DEBC(printk(ST_DEB_MSG "%s: Compression state changed to %d.\n",
name, state));
- STp->compression_changed = TRUE;
+ STp->compression_changed = 1;
return 0;
}
DEB( char *name = tape_name(STp); )
unsigned char cmd[MAX_COMMAND_SIZE];
ST_partstat *STps;
- Scsi_Request *SRpnt;
+ struct scsi_request *SRpnt;
if (STp->ready != ST_READY && !load_code) {
if (STp->ready == ST_NO_TAPE)
printk(ST_DEB_MSG "%s: Loading tape.\n", name);
);
- SRpnt = st_do_scsi(NULL, STp, cmd, 0, SCSI_DATA_NONE,
- timeout, MAX_RETRIES, TRUE);
+ SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE,
+ timeout, MAX_RETRIES, 1);
if (!SRpnt)
return (STp->buffer)->syscall_result;
int timeout;
long ltmp;
int ioctl_result;
- int chg_eof = TRUE;
+ int chg_eof = 1;
unsigned char cmd[MAX_COMMAND_SIZE];
- Scsi_Request *SRpnt;
+ struct scsi_request *SRpnt;
ST_partstat *STps;
int fileno, blkno, at_sm, undone;
- int datalen = 0, direction = SCSI_DATA_NONE;
+ int datalen = 0, direction = DMA_NONE;
char *name = tape_name(STp);
WARN_ON(STp->buffer->do_dio != 0);
memset(cmd, 0, MAX_COMMAND_SIZE);
switch (cmd_in) {
case MTFSFM:
- chg_eof = FALSE; /* Changed from the FSF after this */
+ chg_eof = 0; /* Changed from the FSF after this */
case MTFSF:
cmd[0] = SPACE;
cmd[1] = 0x01; /* Space FileMarks */
at_sm &= (arg == 0);
break;
case MTBSFM:
- chg_eof = FALSE; /* Changed from the FSF after this */
+ chg_eof = 0; /* Changed from the FSF after this */
case MTBSF:
cmd[0] = SPACE;
cmd[1] = 0x01; /* Space FileMarks */
case MTSETDENSITY: /* Set tape density */
case MTSETDRVBUFFER: /* Set drive buffering */
case SET_DENS_AND_BLK: /* Set density and block size */
- chg_eof = FALSE;
+ chg_eof = 0;
if (STp->dirty || (STp->buffer)->buffer_bytes != 0)
return (-EIO); /* Not allowed if data in buffer */
if ((cmd_in == MTSETBLK || cmd_in == SET_DENS_AND_BLK) &&
if ((STp->use_pf & USE_PF))
cmd[1] = MODE_SELECT_PAGE_FORMAT;
cmd[4] = datalen = 12;
- direction = SCSI_DATA_WRITE;
+ direction = DMA_TO_DEVICE;
memset((STp->buffer)->b_data, 0, 12);
if (cmd_in == MTSETDRVBUFFER)
(STp->buffer)->b_data[3] = 8; /* block descriptor length */
if (cmd_in == MTSETDENSITY) {
(STp->buffer)->b_data[4] = arg;
- STp->density_changed = TRUE; /* At least we tried ;-) */
+ STp->density_changed = 1; /* At least we tried ;-) */
} else if (cmd_in == SET_DENS_AND_BLK)
(STp->buffer)->b_data[4] = arg >> 24;
else
if (cmd_in == MTSETBLK || cmd_in == SET_DENS_AND_BLK) {
ltmp = arg & MT_ST_BLKSIZE_MASK;
if (cmd_in == MTSETBLK)
- STp->blksize_changed = TRUE; /* At least we tried ;-) */
+ STp->blksize_changed = 1; /* At least we tried ;-) */
} else
ltmp = STp->block_size;
(STp->buffer)->b_data[9] = (ltmp >> 16);
}
SRpnt = st_do_scsi(NULL, STp, cmd, datalen, direction,
- timeout, MAX_RETRIES, TRUE);
+ timeout, MAX_RETRIES, 1);
if (!SRpnt)
return (STp->buffer)->syscall_result;
{
int result;
unsigned char scmd[MAX_COMMAND_SIZE];
- Scsi_Request *SRpnt;
+ struct scsi_request *SRpnt;
DEB( char *name = tape_name(STp); )
if (STp->ready != ST_READY)
if (!logical && !STp->scsi2_logical)
scmd[1] = 1;
}
- SRpnt = st_do_scsi(NULL, STp, scmd, 20, SCSI_DATA_READ, STp->device->timeout,
- MAX_READY_RETRIES, TRUE);
+ SRpnt = st_do_scsi(NULL, STp, scmd, 20, DMA_FROM_DEVICE,
+ STp->device->timeout, MAX_READY_RETRIES, 1);
if (!SRpnt)
return (STp->buffer)->syscall_result;
unsigned int blk;
int timeout;
unsigned char scmd[MAX_COMMAND_SIZE];
- Scsi_Request *SRpnt;
+ struct scsi_request *SRpnt;
DEB( char *name = tape_name(STp); )
if (STp->ready != ST_READY)
return (-EINVAL);
if (partition != STp->partition) {
if (get_location(STp, &blk, &p, 1))
- STps->last_block_valid = FALSE;
+ STps->last_block_valid = 0;
else {
- STps->last_block_valid = TRUE;
+ STps->last_block_valid = 1;
STps->last_block_visited = blk;
DEBC(printk(ST_DEB_MSG
"%s: Visited block %d for partition %d saved.\n",
timeout = STp->device->timeout;
}
- SRpnt = st_do_scsi(NULL, STp, scmd, 0, SCSI_DATA_NONE,
- timeout, MAX_READY_RETRIES, TRUE);
+ SRpnt = st_do_scsi(NULL, STp, scmd, 0, DMA_NONE,
+ timeout, MAX_READY_RETRIES, 1);
if (!SRpnt)
return (STp->buffer)->syscall_result;
if (STp->ready != ST_READY)
return (-EIO);
- result = read_mode_page(STp, PART_PAGE, TRUE);
+ result = read_mode_page(STp, PART_PAGE, 1);
if (result) {
DEBC(printk(ST_DEB_MSG "%s: Can't read medium partition page.\n",
int pgo, psd_cnt, psdo;
unsigned char *bp;
- result = read_mode_page(STp, PART_PAGE, FALSE);
+ result = read_mode_page(STp, PART_PAGE, 0);
if (result) {
DEBC(printk(ST_DEB_MSG "%s: Can't read partition mode page.\n", name));
return result;
bp[pgo + PP_OFF_RESERVED] = 0;
bp[pgo + PP_OFF_FLAGS] = PP_BIT_IDP | PP_MSK_PSUM_MB;
- result = write_mode_page(STp, PART_PAGE, TRUE);
+ result = write_mode_page(STp, PART_PAGE, 1);
if (result) {
printk(KERN_INFO "%s: Partitioning of tape failed.\n", name);
result = (-EIO);
for (i = 0; i < ST_NBR_PARTITIONS; i++) {
STp->ps[i].rw = ST_IDLE;
STp->ps[i].at_sm = 0;
- STp->ps[i].last_block_valid = FALSE;
+ STp->ps[i].last_block_valid = 0;
}
STp->partition = STp->new_partition = 0;
STp->nbr_partitions = 1; /* Bad guess ?-) */
goto out;
}
- if ((i = flush_buffer(STp, FALSE)) < 0) {
+ if ((i = flush_buffer(STp, 0)) < 0) {
retval = i;
goto out;
}
tb->b_data = page_address(tb->sg[0].page);
tb->frp = (struct st_buf_fragment *)(&(tb->sg[0]) + max_sg);
- tb->in_use = TRUE;
+ tb->in_use = 1;
tb->dma = need_dma;
tb->buffer_size = got;
int segs, nbr, max_segs, b_size, priority, order, got;
if (new_size <= STbuffer->buffer_size)
- return TRUE;
+ return 1;
if (STbuffer->buffer_size <= PAGE_SIZE)
normalize_buffer(STbuffer); /* Avoid extra segment */
max_segs = STbuffer->use_sg;
nbr = max_segs - STbuffer->frp_segs;
if (nbr <= 0)
- return FALSE;
+ return 0;
priority = GFP_KERNEL | __GFP_NOWARN;
if (need_dma)
}
DEB(STbuffer->buffer_size = got);
normalize_buffer(STbuffer);
- return FALSE;
+ return 0;
}
STbuffer->frp[segs].length = b_size;
STbuffer->frp_segs += 1;
}
STbuffer->b_data = page_address(STbuffer->frp[0].page);
- return TRUE;
+ return 1;
}
i = SDp->host->sg_tablesize;
if (st_max_sg_segs < i)
i = st_max_sg_segs;
- buffer = new_tape_buffer(TRUE, (SDp->host)->unchecked_isa_dma, i);
+ buffer = new_tape_buffer(1, (SDp->host)->unchecked_isa_dma, i);
if (buffer == NULL) {
printk(KERN_ERR "st: Can't allocate new tape buffer. Device not attached.\n");
goto out;
for (i = 0; i < ST_NBR_MODES; i++) {
STm = &(tpnt->modes[i]);
- STm->defined = FALSE;
+ STm->defined = 0;
STm->sysv = ST_SYSV;
STm->defaults_for_writes = 0;
STm->do_async_writes = ST_ASYNC_WRITES;
STps->rw = ST_IDLE;
STps->eof = ST_NOEOF;
STps->at_sm = 0;
- STps->last_block_valid = FALSE;
+ STps->last_block_valid = 0;
STps->drv_block = (-1);
STps->drv_file = (-1);
}
tpnt->current_mode = 0;
- tpnt->modes[0].defined = TRUE;
+ tpnt->modes[0].defined = 1;
tpnt->density_changed = tpnt->compression_changed =
- tpnt->blksize_changed = FALSE;
+ tpnt->blksize_changed = 0;
init_MUTEX(&tpnt->lock);
st_nr_dev++;
static int st_remove(struct device *dev)
{
- Scsi_Device *SDp = to_scsi_device(dev);
+ struct scsi_device *SDp = to_scsi_device(dev);
Scsi_Tape *tpnt;
int i, j, mode;
return nr_pages;
out_unmap:
- sgl_unmap_user_pages(sgl, nr_pages, FALSE);
+ sgl_unmap_user_pages(sgl, nr_pages, 0);
return 0;
}