Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
17cb960f CH |
2 | #ifndef _LINUX_BSG_H |
3 | #define _LINUX_BSG_H | |
3d6392cf | 4 | |
607ca46e | 5 | #include <uapi/linux/bsg.h> |
4ab3b73f | 6 | |
17cb960f CH |
7 | struct request; |
8 | ||
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 | }; | |
45977d0e | 17 | |
3d6392cf | 18 | struct bsg_class_device { |
ee959b00 | 19 | struct device *class_dev; |
97f46ae4 | 20 | struct device *parent; |
3d6392cf | 21 | int minor; |
d351af01 | 22 | struct request_queue *queue; |
97f46ae4 | 23 | struct kref ref; |
17cb960f | 24 | const struct bsg_ops *ops; |
97f46ae4 | 25 | void (*release)(struct device *); |
3d6392cf JA |
26 | }; |
27 | ||
17cb960f CH |
28 | int bsg_register_queue(struct request_queue *q, struct device *parent, |
29 | const char *name, const struct bsg_ops *ops, | |
30 | void (*release)(struct device *)); | |
31 | int bsg_scsi_register_queue(struct request_queue *q, struct device *parent); | |
32 | void bsg_unregister_queue(struct request_queue *q); | |
3d6392cf | 33 | #else |
17cb960f CH |
34 | static inline int bsg_scsi_register_queue(struct request_queue *q, |
35 | struct device *parent) | |
a4ee0df8 JB |
36 | { |
37 | return 0; | |
38 | } | |
97f46ae4 | 39 | static inline void bsg_unregister_queue(struct request_queue *q) |
a4ee0df8 JB |
40 | { |
41 | } | |
17cb960f CH |
42 | #endif /* CONFIG_BLK_DEV_BSG */ |
43 | #endif /* _LINUX_BSG_H */ |