scsi_ch.c (104094) | scsi_ch.c (109623) |
---|---|
1/* 2 * Copyright (c) 1997 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 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 * $FreeBSD: head/sys/cam/scsi/scsi_ch.c 104094 2002-09-28 17:15:38Z phk $ | 27 * $FreeBSD: head/sys/cam/scsi/scsi_ch.c 109623 2003-01-21 08:56:16Z alfred $ |
28 */ 29/* 30 * Derived from the NetBSD SCSI changer driver. 31 * 32 * $NetBSD: ch.c,v 1.32 1998/01/12 09:49:12 thorpej Exp $ 33 * 34 */ 35/* --- 1059 unchanged lines hidden (view full) --- 1095 return (EINVAL); 1096 1097 /* 1098 * Request one descriptor for the given element type. This 1099 * is used to determine the size of the descriptor so that 1100 * we can allocate enough storage for all of them. We assume 1101 * that the first one can fit into 1k. 1102 */ | 28 */ 29/* 30 * Derived from the NetBSD SCSI changer driver. 31 * 32 * $NetBSD: ch.c,v 1.32 1998/01/12 09:49:12 thorpej Exp $ 33 * 34 */ 35/* --- 1059 unchanged lines hidden (view full) --- 1095 return (EINVAL); 1096 1097 /* 1098 * Request one descriptor for the given element type. This 1099 * is used to determine the size of the descriptor so that 1100 * we can allocate enough storage for all of them. We assume 1101 * that the first one can fit into 1k. 1102 */ |
1103 data = (caddr_t)malloc(1024, M_DEVBUF, M_WAITOK); | 1103 data = (caddr_t)malloc(1024, M_DEVBUF, 0); |
1104 1105 ccb = cam_periph_getccb(periph, /*priority*/ 1); 1106 1107 scsi_read_element_status(&ccb->csio, 1108 /* retries */ 1, 1109 /* cbfcnp */ chdone, 1110 /* tag_action */ MSG_SIMPLE_Q_TAG, 1111 /* voltag */ want_voltags, --- 20 unchanged lines hidden (view full) --- 1132 sizeof(struct read_element_status_page_header) + 1133 (desclen * cesr->cesr_element_count); 1134 1135 /* 1136 * Reallocate storage for descriptors and get them from the 1137 * device. 1138 */ 1139 free(data, M_DEVBUF); | 1104 1105 ccb = cam_periph_getccb(periph, /*priority*/ 1); 1106 1107 scsi_read_element_status(&ccb->csio, 1108 /* retries */ 1, 1109 /* cbfcnp */ chdone, 1110 /* tag_action */ MSG_SIMPLE_Q_TAG, 1111 /* voltag */ want_voltags, --- 20 unchanged lines hidden (view full) --- 1132 sizeof(struct read_element_status_page_header) + 1133 (desclen * cesr->cesr_element_count); 1134 1135 /* 1136 * Reallocate storage for descriptors and get them from the 1137 * device. 1138 */ 1139 free(data, M_DEVBUF); |
1140 data = (caddr_t)malloc(size, M_DEVBUF, M_WAITOK); | 1140 data = (caddr_t)malloc(size, M_DEVBUF, 0); |
1141 1142 scsi_read_element_status(&ccb->csio, 1143 /* retries */ 1, 1144 /* cbfcnp */ chdone, 1145 /* tag_action */ MSG_SIMPLE_Q_TAG, 1146 /* voltag */ want_voltags, 1147 /* sea */ softc->sc_firsts[chet] 1148 + cesr->cesr_element_base, --- 18 unchanged lines hidden (view full) --- 1167 1168 if (avail != cesr->cesr_element_count) { 1169 xpt_print_path(periph->path); 1170 printf("warning, READ ELEMENT STATUS avail != count\n"); 1171 } 1172 1173 user_data = (struct changer_element_status *) 1174 malloc(avail * sizeof(struct changer_element_status), | 1141 1142 scsi_read_element_status(&ccb->csio, 1143 /* retries */ 1, 1144 /* cbfcnp */ chdone, 1145 /* tag_action */ MSG_SIMPLE_Q_TAG, 1146 /* voltag */ want_voltags, 1147 /* sea */ softc->sc_firsts[chet] 1148 + cesr->cesr_element_base, --- 18 unchanged lines hidden (view full) --- 1167 1168 if (avail != cesr->cesr_element_count) { 1169 xpt_print_path(periph->path); 1170 printf("warning, READ ELEMENT STATUS avail != count\n"); 1171 } 1172 1173 user_data = (struct changer_element_status *) 1174 malloc(avail * sizeof(struct changer_element_status), |
1175 M_DEVBUF, M_WAITOK | M_ZERO); | 1175 M_DEVBUF, M_ZERO); |
1176 1177 desc = (struct read_element_status_descriptor *)((uintptr_t)data + 1178 sizeof(struct read_element_status_header) + 1179 sizeof(struct read_element_status_page_header)); 1180 /* 1181 * Set up the individual element status structures 1182 */ 1183 for (i = 0; i < avail; ++i) { --- 508 unchanged lines hidden --- | 1176 1177 desc = (struct read_element_status_descriptor *)((uintptr_t)data + 1178 sizeof(struct read_element_status_header) + 1179 sizeof(struct read_element_status_page_header)); 1180 /* 1181 * Set up the individual element status structures 1182 */ 1183 for (i = 0; i < avail; ++i) { --- 508 unchanged lines hidden --- |