/* * The scatter-gather list handling. This contains all * the yucky stuff that needs to be fixed properly.
*/
/* * copy_SCp_to_sg() Assumes contiguous allocation at @sg of at-most @max * entries of uninitialized memory. SCp is from scsi-ml and has a valid * (possibly chained) sg-list
*/ staticinlineint copy_SCp_to_sg(struct scatterlist *sg, struct scsi_pointer *SCp, int max)
{ int bufs = SCp->buffers_residual;
/* FIXME: It should be easy for drivers to loop on copy_SCp_to_sg(). * and to remove this BUG_ON. Use min() in-its-place
*/
BUG_ON(bufs + 1 > max);
sg_set_buf(sg, SCp->ptr, SCp->this_residual);
if (bufs) { struct scatterlist *src_sg; unsigned i;
#ifdef BELT_AND_BRACES
{ /* * Calculate correct buffer length. Some commands * come in with the wrong scsi_bufflen.
*/ struct scatterlist *sg; unsigned i, sg_count = scsi_sg_count(SCpnt);
scsi_for_each_sg(SCpnt, sg, sg_count, i)
len += sg->length;
if (scsi_bufflen(SCpnt) != len) {
printk(KERN_WARNING "scsi%d.%c: bad request buffer " "length %d, should be %ld\n",
SCpnt->device->host->host_no, '0' + SCpnt->device->id,
scsi_bufflen(SCpnt), len); /* * FIXME: Totaly naive fixup. We should abort * with error
*/
scsi_pointer->phase =
min_t(unsignedlong, len,
scsi_bufflen(SCpnt));
}
} #endif
} else {
scsi_pointer->ptr = NULL;
scsi_pointer->this_residual = 0;
scsi_pointer->phase = 0;
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.