From 3d6392cfbd7dc11f23058e3493683afab4ac13a3 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 9 Jul 2007 12:38:05 +0200 Subject: bsg: support for full generic block layer SG v3 Signed-off-by: Jens Axboe --- include/linux/blkdev.h | 12 ++++++++++++ include/linux/bsg.h | 21 +++++++++++++++++++++ include/linux/genhd.h | 2 ++ 3 files changed, 35 insertions(+) create mode 100644 include/linux/bsg.h (limited to 'include') diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index fae138bd220..53002d40efa 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -41,6 +41,8 @@ struct elevator_queue; typedef struct elevator_queue elevator_t; struct request_pm_state; struct blk_trace; +struct request; +struct sg_io_hdr; #define BLKDEV_MIN_RQ 4 #define BLKDEV_MAX_RQ 128 /* Default maximum */ @@ -607,6 +609,11 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn; #define BLK_BOUNCE_ANY ((u64)blk_max_pfn << PAGE_SHIFT) #define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) +/* + * default timeout for SG_IO if none specified + */ +#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ) + #ifdef CONFIG_MMU extern int init_emergency_isa_pool(void); extern void blk_queue_bounce(request_queue_t *q, struct bio **bio); @@ -680,6 +687,11 @@ extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *, int); extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *, struct request *, int, rq_end_io_fn *); +extern int blk_fill_sghdr_rq(request_queue_t *, struct request *, + struct sg_io_hdr *, int); +extern int blk_unmap_sghdr_rq(struct request *, struct sg_io_hdr *); +extern int blk_complete_sghdr_rq(struct request *, struct sg_io_hdr *, + struct bio *); static inline request_queue_t *bdev_get_queue(struct block_device *bdev) { diff --git a/include/linux/bsg.h b/include/linux/bsg.h new file mode 100644 index 00000000000..dc0d7282c4c --- /dev/null +++ b/include/linux/bsg.h @@ -0,0 +1,21 @@ +#ifndef BSG_H +#define BSG_H + +#if defined(CONFIG_BLK_DEV_BSG) +struct bsg_class_device { + struct class_device *class_dev; + struct device *dev; + int minor; + struct gendisk *disk; + struct list_head list; +}; + +extern int bsg_register_disk(struct gendisk *); +extern void bsg_unregister_disk(struct gendisk *); +#else +struct bsg_class_device { }; +#define bsg_register_disk(disk) (0) +#define bsg_unregister_disk(disk) do { } while (0) +#endif + +#endif diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 9756fc102a8..8c43d703261 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -67,6 +67,7 @@ struct partition { #include #include #include +#include struct partition { unsigned char boot_ind; /* 0x80 - active */ @@ -91,6 +92,7 @@ struct hd_struct { #ifdef CONFIG_FAIL_MAKE_REQUEST int make_it_fail; #endif + struct bsg_class_device bsg_dev; }; #define GENHD_FL_REMOVABLE 1 -- cgit v1.2.3-70-g09d2