protocol.c (cb5629b10d64a8006622ce3a52bc887d91057d69) protocol.c (e6e244b6cb1f70e7109381626293cd40a8334ed3)
1/* Driver for USB Mass Storage compliant devices
2 *
3 * Current development and maintenance by:
4 * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
5 *
6 * Developed with the assistance of:
7 * (c) 2000 David L. Brown, Jr. (usb-storage@davidb.org)
8 * (c) 2002 Alan Stern (stern@rowland.org)

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

116}
117
118void usb_stor_transparent_scsi_command(struct scsi_cmnd *srb,
119 struct us_data *us)
120{
121 /* send the command to the transport layer */
122 usb_stor_invoke_transport(srb, us);
123}
1/* Driver for USB Mass Storage compliant devices
2 *
3 * Current development and maintenance by:
4 * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
5 *
6 * Developed with the assistance of:
7 * (c) 2000 David L. Brown, Jr. (usb-storage@davidb.org)
8 * (c) 2002 Alan Stern (stern@rowland.org)

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

116}
117
118void usb_stor_transparent_scsi_command(struct scsi_cmnd *srb,
119 struct us_data *us)
120{
121 /* send the command to the transport layer */
122 usb_stor_invoke_transport(srb, us);
123}
124EXPORT_SYMBOL_GPL(usb_stor_transparent_scsi_command);
124
125/***********************************************************************
126 * Scatter-gather transfer buffer access routines
127 ***********************************************************************/
128
129/* Copy a buffer of length buflen to/from the srb's transfer buffer.
130 * Update the **sgptr and *offset variables so that the next copy will
131 * pick up from where this one left off.

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

194 sglen -= plen;
195 }
196 }
197 *sgptr = sg;
198
199 /* Return the amount actually transferred */
200 return cnt;
201}
125
126/***********************************************************************
127 * Scatter-gather transfer buffer access routines
128 ***********************************************************************/
129
130/* Copy a buffer of length buflen to/from the srb's transfer buffer.
131 * Update the **sgptr and *offset variables so that the next copy will
132 * pick up from where this one left off.

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

195 sglen -= plen;
196 }
197 }
198 *sgptr = sg;
199
200 /* Return the amount actually transferred */
201 return cnt;
202}
203EXPORT_SYMBOL_GPL(usb_stor_access_xfer_buf);
202
203/* Store the contents of buffer into srb's transfer buffer and set the
204 * SCSI residue.
205 */
206void usb_stor_set_xfer_buf(unsigned char *buffer,
207 unsigned int buflen, struct scsi_cmnd *srb)
208{
209 unsigned int offset = 0;
210 struct scatterlist *sg = NULL;
211
212 buflen = min(buflen, scsi_bufflen(srb));
213 buflen = usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset,
214 TO_XFER_BUF);
215 if (buflen < scsi_bufflen(srb))
216 scsi_set_resid(srb, scsi_bufflen(srb) - buflen);
217}
204
205/* Store the contents of buffer into srb's transfer buffer and set the
206 * SCSI residue.
207 */
208void usb_stor_set_xfer_buf(unsigned char *buffer,
209 unsigned int buflen, struct scsi_cmnd *srb)
210{
211 unsigned int offset = 0;
212 struct scatterlist *sg = NULL;
213
214 buflen = min(buflen, scsi_bufflen(srb));
215 buflen = usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset,
216 TO_XFER_BUF);
217 if (buflen < scsi_bufflen(srb))
218 scsi_set_resid(srb, scsi_bufflen(srb) - buflen);
219}
220EXPORT_SYMBOL_GPL(usb_stor_set_xfer_buf);