Deleted Added
full compact
scsi_cmds.c (156981) scsi_cmds.c (157129)
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 156981 2006-03-22 01:30:07Z mjacob $
28 * $FreeBSD: head/share/examples/scsi_target/scsi_cmds.c 157129 2006-03-25 18:18:26Z mjacob $
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>

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

150 struct targ_cdb_handlers *h;
151
152 for (h = cdb_handlers; h->cmd != ILLEGAL_CDB; h++) {
153 if (a_descr->cdb[0] == h->cmd)
154 break;
155 }
156 last_cmd = h;
157 }
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>

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

150 struct targ_cdb_handlers *h;
151
152 for (h = cdb_handlers; h->cmd != ILLEGAL_CDB; h++) {
153 if (a_descr->cdb[0] == h->cmd)
154 break;
155 }
156 last_cmd = h;
157 }
158
159 /* call completion and exit */
160 if (event != ATIO_WORK) {
161 if (last_cmd->done != NULL)
162 last_cmd->done(atio, ctio, event);
163 else
164 free_ccb((union ccb *)ctio);
165 return (1);
166 }
167
158 if (last_cmd->cmd == ILLEGAL_CDB) {
159 if (event != ATIO_WORK) {
160 warnx("no done func for %#x???", a_descr->cdb[0]);
161 abort();
162 }
163 /* Not found, return illegal request */
164 warnx("cdb %#x not handled", a_descr->cdb[0]);
165 tcmd_illegal_req(atio, ctio);
166 send_ccb((union ccb *)ctio, /*priority*/1);
167 return (0);
168 }
169
168 if (last_cmd->cmd == ILLEGAL_CDB) {
169 if (event != ATIO_WORK) {
170 warnx("no done func for %#x???", a_descr->cdb[0]);
171 abort();
172 }
173 /* Not found, return illegal request */
174 warnx("cdb %#x not handled", a_descr->cdb[0]);
175 tcmd_illegal_req(atio, ctio);
176 send_ccb((union ccb *)ctio, /*priority*/1);
177 return (0);
178 }
179
170 /* call completion and exit */
171 if (event != ATIO_WORK) {
172 if (last_cmd->done != NULL)
173 last_cmd->done(atio, ctio, event);
174 else
175 free_ccb((union ccb *)ctio);
176 return (1);
177 }
178
179 istate = tcmd_get_istate(ctio->init_id);
180 if (istate == NULL) {
181 tcmd_illegal_req(atio, ctio);
182 send_ccb((union ccb *)ctio, /*priority*/1);
183 return (0);
184 }
185
186 if (istate->pending_ca == 0 && istate->pending_ua != 0 &&

--- 577 unchanged lines hidden ---
180 istate = tcmd_get_istate(ctio->init_id);
181 if (istate == NULL) {
182 tcmd_illegal_req(atio, ctio);
183 send_ccb((union ccb *)ctio, /*priority*/1);
184 return (0);
185 }
186
187 if (istate->pending_ca == 0 && istate->pending_ua != 0 &&

--- 577 unchanged lines hidden ---