Deleted Added
full compact
scsi_cmds.c (109345) scsi_cmds.c (120428)
1/*
2 * SCSI Disk Emulator
3 *
4 * Copyright (c) 2002 Nate Lawson.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1/*
2 * SCSI Disk Emulator
3 *
4 * Copyright (c) 2002 Nate Lawson.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/share/examples/scsi_target/scsi_cmds.c 109345 2003-01-16 00:24:29Z njl $
28 * $FreeBSD: head/share/examples/scsi_target/scsi_cmds.c 120428 2003-09-25 05:43:26Z simokawa $
29 */
30
31#include <stdio.h>
32#include <stddef.h>
33#include <stdarg.h>
34#include <stdlib.h>
35#include <string.h>
36#include <err.h>

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

241 sense->add_sense_code = asc;
242 sense->add_sense_code_qual = ascq;
243 sense->extra_len =
244 offsetof(struct scsi_sense_data, sense_key_spec[2]) -
245 offsetof(struct scsi_sense_data, extra_len);
246
247 /* Fill out the supplied CTIO */
248 if (ctio != NULL) {
29 */
30
31#include <stdio.h>
32#include <stddef.h>
33#include <stdarg.h>
34#include <stdlib.h>
35#include <string.h>
36#include <err.h>

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

241 sense->add_sense_code = asc;
242 sense->add_sense_code_qual = ascq;
243 sense->extra_len =
244 offsetof(struct scsi_sense_data, sense_key_spec[2]) -
245 offsetof(struct scsi_sense_data, extra_len);
246
247 /* Fill out the supplied CTIO */
248 if (ctio != NULL) {
249 /* No autosense yet
250 bcopy(sense, &ctio->sense_data, sizeof(*sense));
249 bcopy(sense, &ctio->sense_data, sizeof(*sense));
251 ctio->sense_len = sizeof(*sense); XXX
252 */
250 ctio->sense_len = sizeof(*sense); /* XXX */
253 ctio->ccb_h.flags &= ~CAM_DIR_MASK;
254 ctio->ccb_h.flags |= CAM_DIR_NONE | /* CAM_SEND_SENSE | */
255 CAM_SEND_STATUS;
256 ctio->dxfer_len = 0;
257 ctio->scsi_status = SCSI_STATUS_CHECK_COND;
258 }
259}
260

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

326static int
327init_inquiry(u_int16_t req_flags, u_int16_t sim_flags)
328{
329 struct scsi_inquiry_data *inq;
330
331 inq = &inq_data;
332 bzero(inq, sizeof(*inq));
333 inq->device = T_DIRECT | (SID_QUAL_LU_CONNECTED << 5);
251 ctio->ccb_h.flags &= ~CAM_DIR_MASK;
252 ctio->ccb_h.flags |= CAM_DIR_NONE | /* CAM_SEND_SENSE | */
253 CAM_SEND_STATUS;
254 ctio->dxfer_len = 0;
255 ctio->scsi_status = SCSI_STATUS_CHECK_COND;
256 }
257}
258

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

324static int
325init_inquiry(u_int16_t req_flags, u_int16_t sim_flags)
326{
327 struct scsi_inquiry_data *inq;
328
329 inq = &inq_data;
330 bzero(inq, sizeof(*inq));
331 inq->device = T_DIRECT | (SID_QUAL_LU_CONNECTED << 5);
332#ifdef SCSI_REV_SPC
334 inq->version = SCSI_REV_SPC; /* was 2 */
333 inq->version = SCSI_REV_SPC; /* was 2 */
334#else
335 inq->version = SCSI_REV_3; /* was 2 */
336#endif
335
336 /*
337 * XXX cpi.hba_inquiry doesn't support Addr16 so we give the
338 * user what they want if they ask for it.
339 */
340 if ((req_flags & SID_Addr16) != 0) {
341 sim_flags |= SID_Addr16;
342 warnx("Not sure SIM supports Addr16 but enabling it anyway");

--- 324 unchanged lines hidden ---
337
338 /*
339 * XXX cpi.hba_inquiry doesn't support Addr16 so we give the
340 * user what they want if they ask for it.
341 */
342 if ((req_flags & SID_Addr16) != 0) {
343 sim_flags |= SID_Addr16;
344 warnx("Not sure SIM supports Addr16 but enabling it anyway");

--- 324 unchanged lines hidden ---