Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
st.c File Reference
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/mtio.h>
#include <linux/cdrom.h>
#include <linux/ioctl.h>
#include <linux/fcntl.h>
#include <linux/spinlock.h>
#include <linux/blkdev.h>
#include <linux/moduleparam.h>
#include <linux/cdev.h>
#include <linux/idr.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
#include <asm/dma.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/sg.h>
#include "st_options.h"
#include "st.h"
#include "osst_detect.h"

Go to the source code of this file.

Data Structures

struct  st_dev_parm
 
struct  st_reject_data
 

Macros

#define DEBUG   0
 
#define DEB(a)
 
#define DEBC(a)
 
#define ST_KILOBYTE   1024
 
#define ST_FIXED_BUFFER_SIZE   (ST_FIXED_BUFFER_BLOCKS * ST_KILOBYTE)
 
#define MAX_RETRIES   0
 
#define MAX_WRITE_RETRIES   0
 
#define MAX_READY_RETRIES   0
 
#define NO_TAPE   NOT_READY
 
#define ST_TIMEOUT   (900 * HZ)
 
#define ST_LONG_TIMEOUT   (14000 * HZ)
 
#define TAPE_NR(x)
 
#define TAPE_MODE(x)   ((iminor(x) & ST_MODE_MASK) >> ST_MODE_SHIFT)
 
#define TAPE_MINOR(d, m, n)
 
#define SET_DENS_AND_BLK   0x10001
 
#define to_scsi_tape(obj)   container_of(obj, struct scsi_tape, kref)
 
#define CHKRES_READY   0
 
#define CHKRES_NEW_SESSION   1
 
#define CHKRES_NOT_READY   2
 
#define CHKRES_NO_TAPE   3
 
#define MAX_ATTENTIONS   10
 
#define MODE_HEADER_LENGTH   4
 
#define MH_OFF_DATA_LENGTH   0
 
#define MH_OFF_MEDIUM_TYPE   1
 
#define MH_OFF_DEV_SPECIFIC   2
 
#define MH_OFF_BDESCS_LENGTH   3
 
#define MP_OFF_PAGE_NBR   0
 
#define MP_OFF_PAGE_LENGTH   1
 
#define MH_BIT_WP   0x80
 
#define MP_MSK_PAGE_NBR   0x3f
 
#define MODE_SENSE_OMIT_BDESCS   0x08
 
#define MODE_SELECT_PAGE_FORMAT   0x10
 
#define COMPRESSION_PAGE   0x0f
 
#define COMPRESSION_PAGE_LENGTH   16
 
#define CP_OFF_DCE_DCC   2
 
#define CP_OFF_C_ALGO   7
 
#define DCE_MASK   0x80
 
#define DCC_MASK   0x40
 
#define RED_MASK   0x60
 
#define PART_PAGE   0x11
 
#define PART_PAGE_FIXED_LENGTH   8
 
#define PP_OFF_MAX_ADD_PARTS   2
 
#define PP_OFF_NBR_ADD_PARTS   3
 
#define PP_OFF_FLAGS   4
 
#define PP_OFF_PART_UNITS   6
 
#define PP_OFF_RESERVED   7
 
#define PP_BIT_IDP   0x20
 
#define PP_MSK_PSUM_MB   0x10
 
#define ST_MAX_ORDER   6
 

Functions

 MODULE_AUTHOR ("Kai Makisara")
 
 MODULE_DESCRIPTION ("SCSI tape (st) driver")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_ALIAS_CHARDEV_MAJOR (SCSI_TAPE_MAJOR)
 
 MODULE_ALIAS_SCSI_DEVICE (TYPE_TAPE)
 
 module_param_named (buffer_kbs, buffer_kbs, int, 0)
 
 MODULE_PARM_DESC (buffer_kbs,"Default driver buffer size for fixed block mode (KB; 32)")
 
 module_param_named (max_sg_segs, max_sg_segs, int, 0)
 
 MODULE_PARM_DESC (max_sg_segs,"Maximum number of scatter/gather segments to use (256)")
 
 module_param_named (try_direct_io, try_direct_io, int, 0)
 
 MODULE_PARM_DESC (try_direct_io,"Try direct I/O between user buffer and tape drive (1)")
 
 module_param_named (try_rdio, try_rdio, int, 0)
 
 MODULE_PARM_DESC (try_rdio,"Try direct read i/o when possible")
 
 module_param_named (try_wdio, try_wdio, int, 0)
 
 MODULE_PARM_DESC (try_wdio,"Try direct write i/o when possible")
 
 DEB (static void st_log_options(struct scsi_tape *STp, struct st_modedef *STm, char *name){if(debugging){printk(KERN_INFO"%s: Mode %d options: buffer writes: %d, async writes: %d, read ahead: %d\n", name, STp->current_mode, STm->do_buffer_writes, STm->do_async_writes, STm->do_read_ahead);printk(KERN_INFO"%s: can bsr: %d, two FMs: %d, fast mteom: %d, auto lock: %d,\n", name, STp->can_bsr, STp->two_fm, STp->fast_mteom, STp->do_auto_lock);printk(KERN_INFO"%s: defs for wr: %d, no block limits: %d, partitions: %d, s2 log: %d\n", name, STm->defaults_for_writes, STp->omit_blklims, STp->can_partitions, STp->scsi2_logical);printk(KERN_INFO"%s: sysv: %d nowait: %d sili: %d nowait_filemark: %d\n", name, STm->sysv, STp->immediate, STp->sili, STp->immediate_filemark);printk(KERN_INFO"%s: debugging: %d\n", name, debugging);}})
 
 __setup ("st=", st_setup)
 
 module_init (init_st)
 
 module_exit (exit_st)
 

Macro Definition Documentation

#define CHKRES_NEW_SESSION   1

Definition at line 891 of file st.c.

#define CHKRES_NO_TAPE   3

Definition at line 893 of file st.c.

#define CHKRES_NOT_READY   2

Definition at line 892 of file st.c.

#define CHKRES_READY   0

Definition at line 890 of file st.c.

#define COMPRESSION_PAGE   0x0f

Definition at line 2447 of file st.c.

#define COMPRESSION_PAGE_LENGTH   16

Definition at line 2448 of file st.c.

#define CP_OFF_C_ALGO   7

Definition at line 2451 of file st.c.

#define CP_OFF_DCE_DCC   2

Definition at line 2450 of file st.c.

#define DCC_MASK   0x40

Definition at line 2454 of file st.c.

#define DCE_MASK   0x80

Definition at line 2453 of file st.c.

#define DEB (   a)

Definition at line 69 of file st.c.

#define DEBC (   a)

Definition at line 70 of file st.c.

#define DEBUG   0

Definition at line 59 of file st.c.

#define MAX_ATTENTIONS   10

Definition at line 895 of file st.c.

#define MAX_READY_RETRIES   0

Definition at line 155 of file st.c.

#define MAX_RETRIES   0

Definition at line 153 of file st.c.

#define MAX_WRITE_RETRIES   0

Definition at line 154 of file st.c.

#define MH_BIT_WP   0x80

Definition at line 2379 of file st.c.

#define MH_OFF_BDESCS_LENGTH   3

Definition at line 2374 of file st.c.

#define MH_OFF_DATA_LENGTH   0

Definition at line 2371 of file st.c.

#define MH_OFF_DEV_SPECIFIC   2

Definition at line 2373 of file st.c.

#define MH_OFF_MEDIUM_TYPE   1

Definition at line 2372 of file st.c.

#define MODE_HEADER_LENGTH   4

Definition at line 2368 of file st.c.

#define MODE_SELECT_PAGE_FORMAT   0x10

Definition at line 2385 of file st.c.

#define MODE_SENSE_OMIT_BDESCS   0x08

Definition at line 2383 of file st.c.

#define MP_MSK_PAGE_NBR   0x3f

Definition at line 2380 of file st.c.

#define MP_OFF_PAGE_LENGTH   1

Definition at line 2376 of file st.c.

#define MP_OFF_PAGE_NBR   0

Definition at line 2375 of file st.c.

#define NO_TAPE   NOT_READY

Definition at line 156 of file st.c.

#define PART_PAGE   0x11

Definition at line 3201 of file st.c.

#define PART_PAGE_FIXED_LENGTH   8

Definition at line 3202 of file st.c.

#define PP_BIT_IDP   0x20

Definition at line 3210 of file st.c.

#define PP_MSK_PSUM_MB   0x10

Definition at line 3211 of file st.c.

#define PP_OFF_FLAGS   4

Definition at line 3206 of file st.c.

#define PP_OFF_MAX_ADD_PARTS   2

Definition at line 3204 of file st.c.

#define PP_OFF_NBR_ADD_PARTS   3

Definition at line 3205 of file st.c.

#define PP_OFF_PART_UNITS   6

Definition at line 3207 of file st.c.

#define PP_OFF_RESERVED   7

Definition at line 3208 of file st.c.

#define RED_MASK   0x60

Definition at line 2455 of file st.c.

#define SET_DENS_AND_BLK   0x10001

Definition at line 172 of file st.c.

#define ST_FIXED_BUFFER_SIZE   (ST_FIXED_BUFFER_BLOCKS * ST_KILOBYTE)

Definition at line 143 of file st.c.

#define ST_KILOBYTE   1024

Definition at line 73 of file st.c.

#define ST_LONG_TIMEOUT   (14000 * HZ)

Definition at line 159 of file st.c.

#define ST_MAX_ORDER   6

Definition at line 3718 of file st.c.

#define ST_TIMEOUT   (900 * HZ)

Definition at line 158 of file st.c.

#define TAPE_MINOR (   d,
  m,
  n 
)
Value:
(((d & ~(255 >> (ST_NBR_MODE_BITS + 1))) << (ST_NBR_MODE_BITS + 1)) | \
(d & (255 >> (ST_NBR_MODE_BITS + 1))) | (m << ST_MODE_SHIFT) | ((n != 0) << 7) )

Definition at line 167 of file st.c.

#define TAPE_MODE (   x)    ((iminor(x) & ST_MODE_MASK) >> ST_MODE_SHIFT)

Definition at line 164 of file st.c.

#define TAPE_NR (   x)
Value:
( ((iminor(x) & ~255) >> (ST_NBR_MODE_BITS + 1)) | \
(iminor(x) & ~(-1 << ST_MODE_SHIFT)) )

Definition at line 162 of file st.c.

#define to_scsi_tape (   obj)    container_of(obj, struct scsi_tape, kref)

Definition at line 214 of file st.c.

Function Documentation

__setup ( )
DEB ( static void st_log_options(struct scsi_tape *STp, struct st_modedef *STm, char *name){if(debugging){printk(KERN_INFO"%s: Mode %d options: buffer writes: %d, async writes: %d, read ahead: %d\n", name, STp->current_mode, STm->do_buffer_writes, STm->do_async_writes, STm->do_read_ahead);printk(KERN_INFO"%s: can bsr: %d, two FMs: %d, fast mteom: %d, auto lock: %d,\n", name, STp->can_bsr, STp->two_fm, STp->fast_mteom, STp->do_auto_lock);printk(KERN_INFO"%s: defs for wr: %d, no block limits: %d, partitions: %d, s2 log: %d\n", name, STm->defaults_for_writes, STp->omit_blklims, STp->can_partitions, STp->scsi2_logical);printk(KERN_INFO"%s: sysv: %d nowait: %d sili: %d nowait_filemark: %d\n", name, STm->sysv, STp->immediate, STp->sili, STp->immediate_filemark);printk(KERN_INFO"%s: debugging: %d\n", name, debugging);}}  )

Definition at line 2167 of file st.c.

MODULE_ALIAS_CHARDEV_MAJOR ( SCSI_TAPE_MAJOR  )
MODULE_ALIAS_SCSI_DEVICE ( TYPE_TAPE  )
MODULE_AUTHOR ( "Kai Makisara"  )
MODULE_DESCRIPTION ( "SCSI tape (st) driver )
module_exit ( exit_st  )
module_init ( init_st  )
MODULE_LICENSE ( "GPL"  )
module_param_named ( buffer_kbs  ,
buffer_kbs  ,
int  ,
 
)
module_param_named ( max_sg_segs  ,
max_sg_segs  ,
int  ,
 
)
module_param_named ( try_direct_io  ,
try_direct_io  ,
int  ,
 
)
module_param_named ( try_rdio  ,
try_rdio  ,
int  ,
 
)
module_param_named ( try_wdio  ,
try_wdio  ,
int  ,
 
)
MODULE_PARM_DESC ( buffer_kbs  ,
"Default driver buffer size for fixed block mode (KB; 32)"   
)
MODULE_PARM_DESC ( max_sg_segs  ,
"Maximum number of scatter/gather segments to use (256)"   
)
MODULE_PARM_DESC ( try_direct_io  ,
"Try direct I/O between user buffer and tape drive (1)"   
)
MODULE_PARM_DESC ( try_rdio  ,
"Try direct read i/o when possible"   
)
MODULE_PARM_DESC ( try_wdio  ,
"Try direct write i/o when possible"   
)