Deleted Added
full compact
iscsi_subr.c (211095) iscsi_subr.c (225950)
1/*-
2 * Copyright (c) 2005-2010 Daniel Braniss <danny@cs.huji.ac.il>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

24 * SUCH DAMAGE.
25 *
26 */
27/*
28 | $Id: iscsi_subr.c 743 2009-08-08 10:54:53Z danny $
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2005-2010 Daniel Braniss <danny@cs.huji.ac.il>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

24 * SUCH DAMAGE.
25 *
26 */
27/*
28 | $Id: iscsi_subr.c 743 2009-08-08 10:54:53Z danny $
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/iscsi/initiator/iscsi_subr.c 211095 2010-08-09 12:36:36Z des $");
32__FBSDID("$FreeBSD: head/sys/dev/iscsi/initiator/iscsi_subr.c 225950 2011-10-03 20:32:55Z ken $");
33
34#include "opt_iscsi_initiator.h"
35
36#include <sys/param.h>
37#include <sys/kernel.h>
38#include <sys/callout.h>
39#include <sys/malloc.h>
40#include <sys/mbuf.h>

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

148{
149 pdu_t *pp = &pq->pdu;
150 struct ccb_scsiio *scsi = (struct ccb_scsiio *)ccb;
151 struct scsi_sense_data *sense = &scsi->sense_data;
152 struct mbuf *m = pq->mp;
153 scsi_rsp_t *cmd = &pp->ipdu.scsi_rsp;
154 caddr_t bp;
155 int sense_len, mustfree = 0;
33
34#include "opt_iscsi_initiator.h"
35
36#include <sys/param.h>
37#include <sys/kernel.h>
38#include <sys/callout.h>
39#include <sys/malloc.h>
40#include <sys/mbuf.h>

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

148{
149 pdu_t *pp = &pq->pdu;
150 struct ccb_scsiio *scsi = (struct ccb_scsiio *)ccb;
151 struct scsi_sense_data *sense = &scsi->sense_data;
152 struct mbuf *m = pq->mp;
153 scsi_rsp_t *cmd = &pp->ipdu.scsi_rsp;
154 caddr_t bp;
155 int sense_len, mustfree = 0;
156 int error_code, sense_key, asc, ascq;
156
157 bp = mtod(pq->mp, caddr_t);
158 if((sense_len = scsi_2btoul(bp)) == 0)
159 return 0;
160 debug(4, "sense_len=%d", sense_len);
161 /*
162 | according to the specs, the sense data cannot
163 | be larger than 252 ...

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

169 mustfree++;
170 }
171 scsi->scsi_status = status;
172
173 bcopy(bp+2, sense, min(sense_len, scsi->sense_len));
174 scsi->sense_resid = 0;
175 if(cmd->flag & (BIT(1)|BIT(2)))
176 scsi->sense_resid = ntohl(pp->ipdu.scsi_rsp.rcnt);
157
158 bp = mtod(pq->mp, caddr_t);
159 if((sense_len = scsi_2btoul(bp)) == 0)
160 return 0;
161 debug(4, "sense_len=%d", sense_len);
162 /*
163 | according to the specs, the sense data cannot
164 | be larger than 252 ...

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

170 mustfree++;
171 }
172 scsi->scsi_status = status;
173
174 bcopy(bp+2, sense, min(sense_len, scsi->sense_len));
175 scsi->sense_resid = 0;
176 if(cmd->flag & (BIT(1)|BIT(2)))
177 scsi->sense_resid = ntohl(pp->ipdu.scsi_rsp.rcnt);
178
179 scsi_extract_sense_len(sense, scsi->sense_len - scsi->sense_resid,
180 &error_code, &sense_key, &asc, &ascq, /*show_errors*/ 1);
181
177 debug(3, "sense_len=%d rcnt=%d sense_resid=%d dsl=%d error_code=%x flags=%x",
178 sense_len,
179 ntohl(pp->ipdu.scsi_rsp.rcnt), scsi->sense_resid,
182 debug(3, "sense_len=%d rcnt=%d sense_resid=%d dsl=%d error_code=%x flags=%x",
183 sense_len,
184 ntohl(pp->ipdu.scsi_rsp.rcnt), scsi->sense_resid,
180 pp->ds_len, sense->error_code, sense->flags);
185 pp->ds_len, error_code, sense_key);
181
182 if(mustfree)
183 free(bp, M_ISCSI);
184
185 return 1;
186}
187
188/*

--- 410 unchanged lines hidden ---
186
187 if(mustfree)
188 free(bp, M_ISCSI);
189
190 return 1;
191}
192
193/*

--- 410 unchanged lines hidden ---