Deleted Added
full compact
ctl_backend.h (313368) ctl_backend.h (361256)
1/*-
2 * Copyright (c) 2003 Silicon Graphics International Corp.
3 * Copyright (c) 2014-2017 Alexander Motin <mav@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 15 unchanged lines hidden (view full) ---

24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGES.
30 *
31 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend.h#2 $
1/*-
2 * Copyright (c) 2003 Silicon Graphics International Corp.
3 * Copyright (c) 2014-2017 Alexander Motin <mav@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 15 unchanged lines hidden (view full) ---

24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGES.
30 *
31 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend.h#2 $
32 * $FreeBSD: stable/11/sys/cam/ctl/ctl_backend.h 313368 2017-02-07 01:55:48Z mav $
32 * $FreeBSD: stable/11/sys/cam/ctl/ctl_backend.h 361256 2020-05-19 14:42:09Z mav $
33 */
34/*
35 * CTL backend driver definitions
36 *
37 * Author: Ken Merry <ken@FreeBSD.org>
38 */
39
40#ifndef _CTL_BACKEND_H_

--- 31 unchanged lines hidden (view full) ---

72 name ## _modevent, \
73 (void *)&driver \
74 }; \
75 DECLARE_MODULE(name, name ## _mod, SI_SUB_CONFIGURE, SI_ORDER_FOURTH); \
76 MODULE_DEPEND(name, ctl, 1, 1, 1); \
77 MODULE_DEPEND(name, cam, 1, 1, 1)
78
79
33 */
34/*
35 * CTL backend driver definitions
36 *
37 * Author: Ken Merry <ken@FreeBSD.org>
38 */
39
40#ifndef _CTL_BACKEND_H_

--- 31 unchanged lines hidden (view full) ---

72 name ## _modevent, \
73 (void *)&driver \
74 }; \
75 DECLARE_MODULE(name, name ## _mod, SI_SUB_CONFIGURE, SI_ORDER_FOURTH); \
76 MODULE_DEPEND(name, ctl, 1, 1, 1); \
77 MODULE_DEPEND(name, cam, 1, 1, 1)
78
79
80typedef enum {
81 CTL_LUN_CONFIG_OK,
82 CTL_LUN_CONFIG_FAILURE
83} ctl_lun_config_status;
84
85typedef void (*be_callback_t)(void *be_lun);
80typedef void (*be_callback_t)(void *be_lun);
86typedef void (*be_lun_config_t)(void *be_lun,
87 ctl_lun_config_status status);
88
89/*
90 * The lun_type field is the SCSI device type of this particular LUN. In
91 * general, this should be T_DIRECT, although backends will want to create
92 * a processor LUN, typically at LUN 0. See scsi_all.h for the defines for
93 * the various SCSI device types.
94 *
95 * The flags are described above.

--- 32 unchanged lines hidden (view full) ---

128 * terminated.
129 *
130 * device_id is the T10 device identifier returned in the SCSI INQUIRY VPD
131 * page 0x83. This should be a unique, per-LUN value. The data inside
132 * this field should be ASCII only, left aligned, and any unused space
133 * should be padded with ASCII spaces. This field should NOT be NULL
134 * terminated.
135 *
81
82/*
83 * The lun_type field is the SCSI device type of this particular LUN. In
84 * general, this should be T_DIRECT, although backends will want to create
85 * a processor LUN, typically at LUN 0. See scsi_all.h for the defines for
86 * the various SCSI device types.
87 *
88 * The flags are described above.

--- 32 unchanged lines hidden (view full) ---

121 * terminated.
122 *
123 * device_id is the T10 device identifier returned in the SCSI INQUIRY VPD
124 * page 0x83. This should be a unique, per-LUN value. The data inside
125 * this field should be ASCII only, left aligned, and any unused space
126 * should be padded with ASCII spaces. This field should NOT be NULL
127 * terminated.
128 *
136 * The lun_shutdown() method is the callback for the ctl_invalidate_lun()
129 * The lun_shutdown() method is the callback for the ctl_remove_lun()
137 * call. It is called when all outstanding I/O for that LUN has been
138 * completed and CTL has deleted the resources for that LUN. When the CTL
139 * backend gets this call, it can safely free its per-LUN resources.
140 *
130 * call. It is called when all outstanding I/O for that LUN has been
131 * completed and CTL has deleted the resources for that LUN. When the CTL
132 * backend gets this call, it can safely free its per-LUN resources.
133 *
141 * The lun_config_status() method is the callback for the ctl_add_lun()
142 * call. It is called when the LUN is successfully added, or when LUN
143 * addition fails. If the LUN is successfully added, the backend may call
144 * the ctl_enable_lun() method to enable the LUN.
145 *
146 * The be field is a pointer to the ctl_backend_driver structure, which
147 * contains the backend methods to be called by CTL.
148 *
149 * The ctl_lun field is for CTL internal use only, and should not be used
150 * by the backend.
151 *
152 * The links field is for CTL internal use only, and should not be used by
153 * the backend.

--- 11 unchanged lines hidden (view full) ---

165 uint16_t ublockoff; /* passed to CTL */
166 uint32_t atomicblock; /* passed to CTL */
167 uint32_t opttxferlen; /* passed to CTL */
168 uint32_t req_lun_id; /* passed to CTL */
169 uint32_t lun_id; /* returned from CTL */
170 uint8_t serial_num[CTL_SN_LEN]; /* passed to CTL */
171 uint8_t device_id[CTL_DEVID_LEN];/* passed to CTL */
172 be_callback_t lun_shutdown; /* passed to CTL */
134 * The be field is a pointer to the ctl_backend_driver structure, which
135 * contains the backend methods to be called by CTL.
136 *
137 * The ctl_lun field is for CTL internal use only, and should not be used
138 * by the backend.
139 *
140 * The links field is for CTL internal use only, and should not be used by
141 * the backend.

--- 11 unchanged lines hidden (view full) ---

153 uint16_t ublockoff; /* passed to CTL */
154 uint32_t atomicblock; /* passed to CTL */
155 uint32_t opttxferlen; /* passed to CTL */
156 uint32_t req_lun_id; /* passed to CTL */
157 uint32_t lun_id; /* returned from CTL */
158 uint8_t serial_num[CTL_SN_LEN]; /* passed to CTL */
159 uint8_t device_id[CTL_DEVID_LEN];/* passed to CTL */
160 be_callback_t lun_shutdown; /* passed to CTL */
173 be_lun_config_t lun_config_status; /* passed to CTL */
174 struct ctl_backend_driver *be; /* passed to CTL */
175 void *ctl_lun; /* used by CTL */
176 ctl_options_t options; /* passed to CTL */
177 STAILQ_ENTRY(ctl_be_lun) links; /* used by CTL */
178};
179
180typedef enum {
181 CTL_BE_FLAG_NONE = 0x00, /* no flags */

--- 22 unchanged lines hidden (view full) ---

204 be_luninfo_t lun_info; /* passed to CTL */
205 be_lunattr_t lun_attr; /* passed to CTL */
206#ifdef CS_BE_CONFIG_MOVE_DONE_IS_NOT_USED
207 be_func_t config_move_done; /* passed to backend */
208#endif
209#if 0
210 be_vfunc_t config_write_done; /* passed to backend */
211#endif
161 struct ctl_backend_driver *be; /* passed to CTL */
162 void *ctl_lun; /* used by CTL */
163 ctl_options_t options; /* passed to CTL */
164 STAILQ_ENTRY(ctl_be_lun) links; /* used by CTL */
165};
166
167typedef enum {
168 CTL_BE_FLAG_NONE = 0x00, /* no flags */

--- 22 unchanged lines hidden (view full) ---

191 be_luninfo_t lun_info; /* passed to CTL */
192 be_lunattr_t lun_attr; /* passed to CTL */
193#ifdef CS_BE_CONFIG_MOVE_DONE_IS_NOT_USED
194 be_func_t config_move_done; /* passed to backend */
195#endif
196#if 0
197 be_vfunc_t config_write_done; /* passed to backend */
198#endif
212 u_int num_luns; /* used by CTL */
213 STAILQ_ENTRY(ctl_backend_driver) links; /* used by CTL */
214};
215
216int ctl_backend_register(struct ctl_backend_driver *be);
217int ctl_backend_deregister(struct ctl_backend_driver *be);
218struct ctl_backend_driver *ctl_backend_find(char *backend_name);
219
220/*
199 STAILQ_ENTRY(ctl_backend_driver) links; /* used by CTL */
200};
201
202int ctl_backend_register(struct ctl_backend_driver *be);
203int ctl_backend_deregister(struct ctl_backend_driver *be);
204struct ctl_backend_driver *ctl_backend_find(char *backend_name);
205
206/*
221 * To add a LUN, first call ctl_add_lun(). You will get the lun_config_status()
222 * callback when the LUN addition has either succeeded or failed.
223 *
224 * Once you get that callback, you can then call ctl_enable_lun() to enable
225 * the LUN.
207 * To add a LUN, call ctl_add_lun().
226 */
227int ctl_add_lun(struct ctl_be_lun *be_lun);
208 */
209int ctl_add_lun(struct ctl_be_lun *be_lun);
228int ctl_enable_lun(struct ctl_be_lun *be_lun);
229
230/*
210
211/*
231 * To delete a LUN, first call ctl_disable_lun(), then
232 * ctl_invalidate_lun(). You will get the lun_shutdown() callback when all
212 * To remove a LUN, first call ctl_remove_lun().
213 * You will get the lun_shutdown() callback when all
233 * I/O to the LUN has completed and the LUN has been deleted.
234 */
214 * I/O to the LUN has completed and the LUN has been deleted.
215 */
235int ctl_disable_lun(struct ctl_be_lun *be_lun);
236int ctl_invalidate_lun(struct ctl_be_lun *be_lun);
216int ctl_remove_lun(struct ctl_be_lun *be_lun);
237
238/*
239 * To start a LUN (transition from powered off to powered on state) call
240 * ctl_start_lun(). To stop a LUN (transition from powered on to powered
241 * off state) call ctl_stop_lun().
242 */
243int ctl_start_lun(struct ctl_be_lun *be_lun);
244int ctl_stop_lun(struct ctl_be_lun *be_lun);

--- 25 unchanged lines hidden ---
217
218/*
219 * To start a LUN (transition from powered off to powered on state) call
220 * ctl_start_lun(). To stop a LUN (transition from powered on to powered
221 * off state) call ctl_stop_lun().
222 */
223int ctl_start_lun(struct ctl_be_lun *be_lun);
224int ctl_stop_lun(struct ctl_be_lun *be_lun);

--- 25 unchanged lines hidden ---