07.06.2013 Views

Scsi - Index of

Scsi - Index of

Scsi - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

491 * scatter-gather or not, and acts appropriately.<br />

492 */<br />

493 int usb_stor_bulk_transfer_sg(struct us_data* us, unsigned int pipe,<br />

494 void *buf, unsigned int length_left, int use_sg, int *residual)<br />

495 {<br />

496 int result;<br />

497 unsigned int partial;<br />

498<br />

499 /* are we scatter-gathering? */<br />

500 if (use_sg) {<br />

501 /* use the usb core scatter-gather primitives */<br />

502 result = usb_stor_bulk_transfer_sglist(us, pipe,<br />

503 (struct scatterlist *) buf, use_sg,<br />

504 length_left, &partial);<br />

505 length_left -= partial;<br />

506 } else {<br />

507 /* no scatter-gather, just make the request */<br />

508 result = usb_stor_bulk_transfer_buf(us, pipe, buf,<br />

509 length_left, &partial);<br />

510 length_left -= partial;<br />

511 }<br />

512<br />

513 /* store the residual and return the error code */<br />

514 if (residual)<br />

515 *residual = length_left;<br />

516 return result;<br />

517 }<br />

162<br />

注释说得很清楚,这个函数是一个壳,真正干活的是她所调用或者说利用的那两个函<br />

数.usb_stor_bulk_transfer_sglist()和usb_stor_bulk_transfer_buf().后者咱们刚才已经遇到过了,<br />

而前者是专门为scatter-gather 传输准备的函数,她也来自drivers/usb/storage/transport.c 中:<br />

433 /*<br />

434 * Transfer a scatter-gather list via bulk transfer<br />

435 *<br />

436 * This function does basically the same thing as usb_stor_bulk_transfer_buf()<br />

437 * above, but it uses the usbcore scatter-gather library.<br />

438 */<br />

439 int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe,<br />

440 struct scatterlist *sg, int num_sg, unsigned int length,<br />

441 unsigned int *act_len)<br />

442 {<br />

443 int result;<br />

444<br />

445 /* don't submit s-g requests during abort/disconnect processing */

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!