Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 2 | #ifndef _LINUX_BSG_H |
| 3 | #define _LINUX_BSG_H |
Jens Axboe | 3d6392c | 2007-07-09 12:38:05 +0200 | [diff] [blame] | 4 | |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 5 | #include <uapi/linux/bsg.h> |
Douglas Gilbert | 4ab3b73 | 2009-03-09 10:51:38 -0400 | [diff] [blame] | 6 | |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 7 | struct request; |
FUJITA Tomonori | 45977d0e | 2006-12-20 11:19:32 +0100 | [diff] [blame] | 8 | |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 9 | #ifdef CONFIG_BLK_DEV_BSG |
| 10 | struct bsg_ops { |
| 11 | int (*check_proto)(struct sg_io_v4 *hdr); |
| 12 | int (*fill_hdr)(struct request *rq, struct sg_io_v4 *hdr, |
| 13 | fmode_t mode); |
| 14 | int (*complete_rq)(struct request *rq, struct sg_io_v4 *hdr); |
| 15 | void (*free_rq)(struct request *rq); |
| 16 | }; |
| 17 | |
Jens Axboe | 3d6392c | 2007-07-09 12:38:05 +0200 | [diff] [blame] | 18 | struct bsg_class_device { |
Tony Jones | ee959b0 | 2008-02-22 00:13:36 +0100 | [diff] [blame] | 19 | struct device *class_dev; |
Jens Axboe | 3d6392c | 2007-07-09 12:38:05 +0200 | [diff] [blame] | 20 | int minor; |
FUJITA Tomonori | d351af0 | 2007-07-09 12:40:35 +0200 | [diff] [blame] | 21 | struct request_queue *queue; |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 22 | const struct bsg_ops *ops; |
Jens Axboe | 3d6392c | 2007-07-09 12:38:05 +0200 | [diff] [blame] | 23 | }; |
| 24 | |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 25 | int bsg_register_queue(struct request_queue *q, struct device *parent, |
Christoph Hellwig | 5de815a | 2018-05-29 08:40:23 +0200 | [diff] [blame] | 26 | const char *name, const struct bsg_ops *ops); |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 27 | int bsg_scsi_register_queue(struct request_queue *q, struct device *parent); |
| 28 | void bsg_unregister_queue(struct request_queue *q); |
Jens Axboe | 3d6392c | 2007-07-09 12:38:05 +0200 | [diff] [blame] | 29 | #else |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 30 | static inline int bsg_scsi_register_queue(struct request_queue *q, |
| 31 | struct device *parent) |
James Bottomley | a4ee0df | 2007-07-23 09:53:51 -0500 | [diff] [blame] | 32 | { |
| 33 | return 0; |
| 34 | } |
FUJITA Tomonori | 97f46ae | 2008-04-19 00:43:14 +0900 | [diff] [blame] | 35 | static inline void bsg_unregister_queue(struct request_queue *q) |
James Bottomley | a4ee0df | 2007-07-23 09:53:51 -0500 | [diff] [blame] | 36 | { |
| 37 | } |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 38 | #endif /* CONFIG_BLK_DEV_BSG */ |
| 39 | #endif /* _LINUX_BSG_H */ |