Deleted Added
full compact
scsi_pass.c (43819) scsi_pass.c (46581)
1/*
2 * Copyright (c) 1997, 1998 Justin T. Gibbs.
3 * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
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:

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

19 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*
2 * Copyright (c) 1997, 1998 Justin T. Gibbs.
3 * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
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:

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

19 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $Id: scsi_pass.c,v 1.5 1998/11/22 23:44:47 ken Exp $
27 * $Id: scsi_pass.c,v 1.6 1999/02/10 00:03:15 ken Exp $
28 */
29
30#include <sys/param.h>
31#include <sys/queue.h>
32#include <sys/systm.h>
33#include <sys/kernel.h>
34#include <sys/types.h>
35#include <sys/buf.h>

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

698 error = 0;
699
700 switch (cmd) {
701
702 case CAMIOCOMMAND:
703 {
704 union ccb *inccb;
705 union ccb *ccb;
28 */
29
30#include <sys/param.h>
31#include <sys/queue.h>
32#include <sys/systm.h>
33#include <sys/kernel.h>
34#include <sys/types.h>
35#include <sys/buf.h>

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

698 error = 0;
699
700 switch (cmd) {
701
702 case CAMIOCOMMAND:
703 {
704 union ccb *inccb;
705 union ccb *ccb;
706 int ccb_malloced;
706
707 inccb = (union ccb *)addr;
707
708 inccb = (union ccb *)addr;
708 ccb = cam_periph_getccb(periph, inccb->ccb_h.pinfo.priority);
709
709
710 /*
711 * Some CCB types, like scan bus and scan lun can only go
712 * through the transport layer device.
713 */
714 if (inccb->ccb_h.func_code & XPT_FC_XPT_ONLY) {
715 xpt_print_path(periph->path);
716 printf("CCB function code %#x is restricted to the "
717 "XPT device\n", inccb->ccb_h.func_code);
718 error = ENODEV;
719 break;
720 }
721
722 /*
723 * Non-immediate CCBs need a CCB from the per-device pool
724 * of CCBs, which is scheduled by the transport layer.
725 * Immediate CCBs and user-supplied CCBs should just be
726 * malloced.
727 */
728 if ((inccb->ccb_h.func_code & XPT_FC_QUEUED)
729 && ((inccb->ccb_h.func_code & XPT_FC_USER_CCB) == 0)) {
730 ccb = cam_periph_getccb(periph,
731 inccb->ccb_h.pinfo.priority);
732 ccb_malloced = 0;
733 } else {
734 ccb = xpt_alloc_ccb();
735
736 if (ccb != NULL)
737 xpt_setup_ccb(&ccb->ccb_h, periph->path,
738 inccb->ccb_h.pinfo.priority);
739 ccb_malloced = 1;
740 }
741
742 if (ccb == NULL) {
743 xpt_print_path(periph->path);
744 printf("unable to allocate CCB\n");
745 error = ENOMEM;
746 break;
747 }
748
710 error = passsendccb(periph, ccb, inccb);
711
749 error = passsendccb(periph, ccb, inccb);
750
712 xpt_release_ccb(ccb);
751 if (ccb_malloced)
752 xpt_free_ccb(ccb);
753 else
754 xpt_release_ccb(ccb);
713
714 break;
715 }
716 default:
717 error = cam_periph_ioctl(periph, cmd, addr, passerror);
718 break;
719 }
720

--- 98 unchanged lines hidden ---
755
756 break;
757 }
758 default:
759 error = cam_periph_ioctl(periph, cmd, addr, passerror);
760 break;
761 }
762

--- 98 unchanged lines hidden ---