Deleted Added
full compact
scsi_cmds.c (157129) scsi_cmds.c (157670)
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 157129 2006-03-25 18:18:26Z mjacob $
28 * $FreeBSD: head/share/examples/scsi_target/scsi_cmds.c 157670 2006-04-11 21:36:43Z 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>

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

684 if (a_descr->init_req == a_descr->total_len)
685 work_atio(atio);
686 if (debug)
687 warnx("AIO done freeing CTIO");
688 free_ccb((union ccb *)ctio);
689 }
690 break;
691 case CTIO_DONE:
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>

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

684 if (a_descr->init_req == a_descr->total_len)
685 work_atio(atio);
686 if (debug)
687 warnx("AIO done freeing CTIO");
688 free_ccb((union ccb *)ctio);
689 }
690 break;
691 case CTIO_DONE:
692 if (ctio->ccb_h.status != CAM_REQ_CMP) {
693 /* XXX */
692 switch (ctio->ccb_h.status & CAM_STATUS_MASK) {
693 case CAM_REQ_CMP:
694 break;
695 case CAM_REQUEUE_REQ:
696 warnx("requeueing request");
697 if ((a_descr->flags & CAM_DIR_MASK) == CAM_DIR_OUT) {
698 if (aio_write(&c_descr->aiocb) < 0) {
699 err(1, "aio_write"); /* XXX */
700 }
701 } else {
702 if (aio_read(&c_descr->aiocb) < 0) {
703 err(1, "aio_read"); /* XXX */
704 }
705 }
706 return;
707 default:
694 errx(1, "CTIO failed, status %#x", ctio->ccb_h.status);
695 }
696 a_descr->init_ack += ctio->dxfer_len;
697 if ((a_descr->flags & CAM_DIR_MASK) == CAM_DIR_OUT &&
698 ctio->dxfer_len > 0) {
699 if (debug)
700 warnx("sending AIO for CTIO write");
701 a_descr->targ_req += ctio->dxfer_len;

--- 63 unchanged lines hidden ---
708 errx(1, "CTIO failed, status %#x", ctio->ccb_h.status);
709 }
710 a_descr->init_ack += ctio->dxfer_len;
711 if ((a_descr->flags & CAM_DIR_MASK) == CAM_DIR_OUT &&
712 ctio->dxfer_len > 0) {
713 if (debug)
714 warnx("sending AIO for CTIO write");
715 a_descr->targ_req += ctio->dxfer_len;

--- 63 unchanged lines hidden ---