aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/osd_initiator.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/osd_initiator.h')
-rw-r--r--include/scsi/osd_initiator.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index e84dc7aa5e34..8482777416d8 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -21,6 +21,23 @@
21 21
22/* Note: "NI" in comments below means "Not Implemented yet" */ 22/* Note: "NI" in comments below means "Not Implemented yet" */
23 23
24/* Configure of code:
25 * #undef if you *don't* want OSD v1 support in runtime.
26 * If #defined the initiator will dynamically configure to encode OSD v1
27 * CDB's if the target is detected to be OSD v1 only.
28 * OSD v2 only commands, options, and attributes will be ignored if target
29 * is v1 only.
30 * If #defined will result in bigger/slower code (OK Slower maybe not)
31 * Q: Should this be CONFIG_SCSI_OSD_VER1_SUPPORT and set from Kconfig?
32 */
33#define OSD_VER1_SUPPORT y
34
35enum osd_std_version {
36 OSD_VER_NONE = 0,
37 OSD_VER1 = 1,
38 OSD_VER2 = 2,
39};
40
24/* 41/*
25 * Object-based Storage Device. 42 * Object-based Storage Device.
26 * This object represents an OSD device. 43 * This object represents an OSD device.
@@ -31,6 +48,10 @@
31struct osd_dev { 48struct osd_dev {
32 struct scsi_device *scsi_device; 49 struct scsi_device *scsi_device;
33 unsigned def_timeout; 50 unsigned def_timeout;
51
52#ifdef OSD_VER1_SUPPORT
53 enum osd_std_version version;
54#endif
34}; 55};
35 56
36/* Retrieve/return osd_dev(s) for use by Kernel clients */ 57/* Retrieve/return osd_dev(s) for use by Kernel clients */
@@ -46,6 +67,14 @@ void osduld_unregister_test(unsigned ioctl);
46void osd_dev_init(struct osd_dev *od, struct scsi_device *scsi_device); 67void osd_dev_init(struct osd_dev *od, struct scsi_device *scsi_device);
47void osd_dev_fini(struct osd_dev *od); 68void osd_dev_fini(struct osd_dev *od);
48 69
70/* we might want to use function vector in the future */
71static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v)
72{
73#ifdef OSD_VER1_SUPPORT
74 od->version = v;
75#endif
76}
77
49struct osd_request; 78struct osd_request;
50typedef void (osd_req_done_fn)(struct osd_request *or, void *private); 79typedef void (osd_req_done_fn)(struct osd_request *or, void *private);
51 80
@@ -82,6 +111,16 @@ struct osd_request {
82 int async_error; 111 int async_error;
83}; 112};
84 113
114/* OSD Version control */
115static inline bool osd_req_is_ver1(struct osd_request *or)
116{
117#ifdef OSD_VER1_SUPPORT
118 return or->osd_dev->version == OSD_VER1;
119#else
120 return false;
121#endif
122}
123
85/* 124/*
86 * How to use the osd library: 125 * How to use the osd library:
87 * 126 *