scsi_targ_bh.c (201758) | scsi_targ_bh.c (225950) |
---|---|
1/*- 2 * Implementation of the Target Mode 'Black Hole device' for CAM. 3 * 4 * Copyright (c) 1999 Justin T. Gibbs. 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 --- 13 unchanged lines hidden (view full) --- 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 29#include <sys/cdefs.h> | 1/*- 2 * Implementation of the Target Mode 'Black Hole device' for CAM. 3 * 4 * Copyright (c) 1999 Justin T. Gibbs. 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 --- 13 unchanged lines hidden (view full) --- 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 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_targ_bh.c 201758 2010-01-07 21:01:37Z mbr $"); | 30__FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_targ_bh.c 225950 2011-10-03 20:32:55Z ken $"); |
31 32#include <sys/param.h> 33#include <sys/queue.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/types.h> 37#include <sys/bio.h> 38#include <sys/conf.h> --- 68 unchanged lines hidden (view full) --- 107}; 108 109static struct scsi_inquiry_data no_lun_inq_data = 110{ 111 T_NODEVICE | (SID_QUAL_BAD_LU << 5), 0, 112 /* version */2, /* format version */2 113}; 114 | 31 32#include <sys/param.h> 33#include <sys/queue.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/types.h> 37#include <sys/bio.h> 38#include <sys/conf.h> --- 68 unchanged lines hidden (view full) --- 107}; 108 109static struct scsi_inquiry_data no_lun_inq_data = 110{ 111 T_NODEVICE | (SID_QUAL_BAD_LU << 5), 0, 112 /* version */2, /* format version */2 113}; 114 |
115static struct scsi_sense_data no_lun_sense_data = | 115static struct scsi_sense_data_fixed no_lun_sense_data = |
116{ 117 SSD_CURRENT_ERROR|SSD_ERRCODE_VALID, 118 0, 119 SSD_KEY_NOT_READY, 120 { 0, 0, 0, 0 }, | 116{ 117 SSD_CURRENT_ERROR|SSD_ERRCODE_VALID, 118 0, 119 SSD_KEY_NOT_READY, 120 { 0, 0, 0, 0 }, |
121 /*extra_len*/offsetof(struct scsi_sense_data, fru) 122 - offsetof(struct scsi_sense_data, extra_len), | 121 /*extra_len*/offsetof(struct scsi_sense_data_fixed, fru) 122 - offsetof(struct scsi_sense_data_fixed, extra_len), |
123 { 0, 0, 0, 0 }, 124 /* Logical Unit Not Supported */ 125 /*ASC*/0x25, /*ASCQ*/0 126}; 127 | 123 { 0, 0, 0, 0 }, 124 /* Logical Unit Not Supported */ 125 /*ASC*/0x25, /*ASCQ*/0 126}; 127 |
128static const int request_sense_size = offsetof(struct scsi_sense_data, fru); | 128static const int request_sense_size = offsetof(struct scsi_sense_data_fixed, fru); |
129 130static periph_init_t targbhinit; 131static void targbhasync(void *callback_arg, u_int32_t code, 132 struct cam_path *path, void *arg); 133static cam_status targbhenlun(struct cam_periph *periph); 134static cam_status targbhdislun(struct cam_periph *periph); 135static periph_ctor_t targbhctor; 136static periph_dtor_t targbhdtor; --- 445 unchanged lines hidden (view full) --- 582 if ((inq->byte2 & SI_EVPD) != 0 583 || inq->page_code != 0) { 584 atio->ccb_h.flags &= ~CAM_DIR_MASK; 585 atio->ccb_h.flags |= CAM_DIR_NONE; 586 /* 587 * This needs to have other than a 588 * no_lun_sense_data response. 589 */ | 129 130static periph_init_t targbhinit; 131static void targbhasync(void *callback_arg, u_int32_t code, 132 struct cam_path *path, void *arg); 133static cam_status targbhenlun(struct cam_periph *periph); 134static cam_status targbhdislun(struct cam_periph *periph); 135static periph_ctor_t targbhctor; 136static periph_dtor_t targbhdtor; --- 445 unchanged lines hidden (view full) --- 582 if ((inq->byte2 & SI_EVPD) != 0 583 || inq->page_code != 0) { 584 atio->ccb_h.flags &= ~CAM_DIR_MASK; 585 atio->ccb_h.flags |= CAM_DIR_NONE; 586 /* 587 * This needs to have other than a 588 * no_lun_sense_data response. 589 */ |
590 atio->sense_data = no_lun_sense_data; | 590 bcopy(&no_lun_sense_data, &atio->sense_data, 591 min(sizeof(no_lun_sense_data), 592 sizeof(atio->sense_data))); |
591 atio->sense_len = sizeof(no_lun_sense_data); 592 descr->data_resid = 0; 593 descr->data_increment = 0; 594 descr->status = SCSI_STATUS_CHECK_COND; 595 break; 596 } 597 /* 598 * Direction is always relative --- 26 unchanged lines hidden (view full) --- 625 descr->status = SCSI_STATUS_OK; 626 break; 627 } 628 default: 629 /* Constant CA, tell initiator */ 630 /* Direction is always relative to the initator */ 631 atio->ccb_h.flags &= ~CAM_DIR_MASK; 632 atio->ccb_h.flags |= CAM_DIR_NONE; | 593 atio->sense_len = sizeof(no_lun_sense_data); 594 descr->data_resid = 0; 595 descr->data_increment = 0; 596 descr->status = SCSI_STATUS_CHECK_COND; 597 break; 598 } 599 /* 600 * Direction is always relative --- 26 unchanged lines hidden (view full) --- 627 descr->status = SCSI_STATUS_OK; 628 break; 629 } 630 default: 631 /* Constant CA, tell initiator */ 632 /* Direction is always relative to the initator */ 633 atio->ccb_h.flags &= ~CAM_DIR_MASK; 634 atio->ccb_h.flags |= CAM_DIR_NONE; |
633 atio->sense_data = no_lun_sense_data; | 635 bcopy(&no_lun_sense_data, &atio->sense_data, 636 min(sizeof(no_lun_sense_data), 637 sizeof(atio->sense_data))); |
634 atio->sense_len = sizeof (no_lun_sense_data); 635 descr->data_resid = 0; 636 descr->data_increment = 0; 637 descr->timeout = 5 * 1000; 638 descr->status = SCSI_STATUS_CHECK_COND; 639 break; 640 } 641 --- 136 unchanged lines hidden --- | 638 atio->sense_len = sizeof (no_lun_sense_data); 639 descr->data_resid = 0; 640 descr->data_increment = 0; 641 descr->timeout = 5 * 1000; 642 descr->status = SCSI_STATUS_CHECK_COND; 643 break; 644 } 645 --- 136 unchanged lines hidden --- |