Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
sg.c File Reference
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/errno.h>
#include <linux/mtio.h>
#include <linux/ioctl.h>
#include <linux/slab.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/moduleparam.h>
#include <linux/cdev.h>
#include <linux/idr.h>
#include <linux/seq_file.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/blktrace_api.h>
#include <linux/mutex.h>
#include <linux/ratelimit.h>
#include "scsi.h"
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_driver.h>
#include <scsi/scsi_ioctl.h>
#include <scsi/sg.h>
#include "scsi_logging.h"

Go to the source code of this file.

Data Structures

struct  sg_scatter_hold
 
struct  sg_request
 
struct  sg_fd
 
struct  sg_device
 

Macros

#define SG_VERSION_STR   "3.5.34"
 
#define SG_ALLOW_DIO_DEF   0
 
#define SG_MAX_DEVS   32768
 
#define MULDIV(X, MUL, DIV)   ((((X % DIV) * MUL) / DIV) + ((X / DIV) * MUL))
 
#define SG_DEFAULT_TIMEOUT   MULDIV(SG_DEFAULT_TIMEOUT_USER, HZ, USER_HZ)
 
#define SG_SECTOR_SZ   512
 
#define SZ_SG_HEADER   sizeof(struct sg_header)
 
#define SZ_SG_IO_HDR   sizeof(sg_io_hdr_t)
 
#define SZ_SG_IOVEC   sizeof(sg_iovec_t)
 
#define SZ_SG_REQ_INFO   sizeof(sg_req_info_t)
 

Typedefs

typedef struct sg_scatter_hold Sg_scatter_hold
 
typedef struct sg_request Sg_request
 
typedef struct sg_fd Sg_fd
 
typedef struct sg_device Sg_device
 

Functions

 module_param_named (scatter_elem_sz, scatter_elem_sz, int, S_IRUGO|S_IWUSR)
 
 module_param_named (def_reserved_size, def_reserved_size, int, S_IRUGO|S_IWUSR)
 
 module_param_named (allow_dio, sg_allow_dio, int, S_IRUGO|S_IWUSR)
 
 MODULE_AUTHOR ("Douglas Gilbert")
 
 MODULE_DESCRIPTION ("SCSI generic (sg) driver")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_VERSION (SG_VERSION_STR)
 
 MODULE_ALIAS_CHARDEV_MAJOR (SCSI_GENERIC_MAJOR)
 
 MODULE_PARM_DESC (scatter_elem_sz,"scatter gather element ""size (default: max(SG_SCATTER_SZ, PAGE_SIZE))")
 
 MODULE_PARM_DESC (def_reserved_size,"size of buffer reserved for each fd")
 
 MODULE_PARM_DESC (allow_dio,"allow direct I/O (default: 0 (disallow))")
 
 module_init (init_sg)
 
 module_exit (exit_sg)
 

Variables

int sg_big_buff = SG_DEF_RESERVED_SIZE
 

Macro Definition Documentation

#define MULDIV (   X,
  MUL,
  DIV 
)    ((((X % DIV) * MUL) / DIV) + ((X / DIV) * MUL))

Definition at line 85 of file sg.c.

#define SG_ALLOW_DIO_DEF   0

Definition at line 72 of file sg.c.

#define SG_DEFAULT_TIMEOUT   MULDIV(SG_DEFAULT_TIMEOUT_USER, HZ, USER_HZ)

Definition at line 87 of file sg.c.

#define SG_MAX_DEVS   32768

Definition at line 74 of file sg.c.

#define SG_SECTOR_SZ   512

Definition at line 102 of file sg.c.

#define SG_VERSION_STR   "3.5.34"

Definition at line 22 of file sg.c.

#define SZ_SG_HEADER   sizeof(struct sg_header)

Definition at line 212 of file sg.c.

#define SZ_SG_IO_HDR   sizeof(sg_io_hdr_t)

Definition at line 213 of file sg.c.

#define SZ_SG_IOVEC   sizeof(sg_iovec_t)

Definition at line 214 of file sg.c.

#define SZ_SG_REQ_INFO   sizeof(sg_req_info_t)

Definition at line 215 of file sg.c.

Typedef Documentation

typedef struct sg_fd Sg_fd

Function Documentation

MODULE_ALIAS_CHARDEV_MAJOR ( SCSI_GENERIC_MAJOR  )
MODULE_AUTHOR ( "Douglas Gilbert"  )
MODULE_DESCRIPTION ( "SCSI generic (sg) driver )
module_exit ( exit_sg  )
module_init ( init_sg  )
MODULE_LICENSE ( "GPL"  )
module_param_named ( scatter_elem_sz  ,
scatter_elem_sz  ,
int  ,
S_IRUGO S_IWUSR 
)
module_param_named ( def_reserved_size  ,
def_reserved_size  ,
int  ,
S_IRUGO S_IWUSR 
)
module_param_named ( allow_dio  ,
sg_allow_dio  ,
int  ,
S_IRUGO S_IWUSR 
)
MODULE_PARM_DESC ( scatter_elem_sz  ,
"scatter gather element ""size (default: max(SG_SCATTER_SZ, PAGE_SIZE))"   
)
MODULE_PARM_DESC ( def_reserved_size  ,
"size of buffer reserved for each fd  
)
MODULE_PARM_DESC ( allow_dio  ,
"allow direct I/O (default: 0 (disallow))"   
)
MODULE_VERSION ( SG_VERSION_STR  )

Variable Documentation

int sg_big_buff = SG_DEF_RESERVED_SIZE

Definition at line 89 of file sg.c.