[block] Remove userptr_t from block device abstraction

Simplify the block device code by assuming that all read/write buffers
are directly accessible via pointer dereferences.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-04-24 17:11:30 +01:00
parent 2742ed5d77
commit 2f11f466e6
19 changed files with 86 additions and 93 deletions

View File

@@ -181,8 +181,7 @@ static int int13_parse_eltorito ( struct san_device *sandev, void *scratch ) {
int rc;
/* Read boot record volume descriptor */
if ( ( rc = sandev_read ( sandev, ELTORITO_LBA, 1,
virt_to_user ( boot ) ) ) != 0 ) {
if ( ( rc = sandev_read ( sandev, ELTORITO_LBA, 1, boot ) ) != 0 ) {
DBGC ( sandev->drive, "INT13 drive %02x could not read El "
"Torito boot record volume descriptor: %s\n",
sandev->drive, strerror ( rc ) );
@@ -228,7 +227,7 @@ static int int13_guess_geometry_hdd ( struct san_device *sandev, void *scratch,
int rc;
/* Read partition table */
if ( ( rc = sandev_read ( sandev, 0, 1, virt_to_user ( mbr ) ) ) != 0 ) {
if ( ( rc = sandev_read ( sandev, 0, 1, mbr ) ) != 0 ) {
DBGC ( sandev->drive, "INT13 drive %02x could not read "
"partition table to guess geometry: %s\n",
sandev->drive, strerror ( rc ) );
@@ -517,12 +516,12 @@ static int int13_rw_sectors ( struct san_device *sandev,
int ( * sandev_rw ) ( struct san_device *sandev,
uint64_t lba,
unsigned int count,
userptr_t buffer ) ) {
void *buffer ) ) {
struct int13_data *int13 = sandev->priv;
unsigned int cylinder, head, sector;
unsigned long lba;
unsigned int count;
userptr_t buffer;
void *buffer;
int rc;
/* Validate blocksize */
@@ -710,12 +709,12 @@ static int int13_extended_rw ( struct san_device *sandev,
int ( * sandev_rw ) ( struct san_device *sandev,
uint64_t lba,
unsigned int count,
userptr_t buffer ) ) {
void *buffer ) ) {
struct int13_disk_address addr;
uint8_t bufsize;
uint64_t lba;
unsigned long count;
userptr_t buffer;
void *buffer;
int rc;
/* Extended reads are not allowed on floppy drives.
@@ -1455,8 +1454,8 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
"catalog (status %04x)\n", drive, status );
return -EIO;
}
copy_from_user ( &catalog, phys_to_virt ( eltorito_cmd.buffer ), 0,
sizeof ( catalog ) );
memcpy ( &catalog, phys_to_virt ( eltorito_cmd.buffer ),
sizeof ( catalog ) );
/* Sanity checks */
if ( catalog.valid.platform_id != ELTORITO_PLATFORM_X86 ) {

View File

@@ -45,8 +45,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* @ret rc Return status code
*/
int block_read ( struct interface *control, struct interface *data,
uint64_t lba, unsigned int count,
userptr_t buffer, size_t len ) {
uint64_t lba, unsigned int count, void *buffer,
size_t len ) {
struct interface *dest;
block_read_TYPE ( void * ) *op =
intf_get_dest_op ( control, block_read, &dest );
@@ -76,8 +76,8 @@ int block_read ( struct interface *control, struct interface *data,
* @ret rc Return status code
*/
int block_write ( struct interface *control, struct interface *data,
uint64_t lba, unsigned int count,
userptr_t buffer, size_t len ) {
uint64_t lba, unsigned int count, void *buffer,
size_t len ) {
struct interface *dest;
block_write_TYPE ( void * ) *op =
intf_get_dest_op ( control, block_write, &dest );

View File

@@ -81,7 +81,7 @@ static void blktrans_xferbuf_write ( struct xfer_buffer *xferbuf, size_t offset,
if ( blktrans->buffer ) {
/* Write data to buffer */
copy_to_user ( blktrans->buffer, offset, data, len );
memcpy ( ( blktrans->buffer + offset ), data, len );
} else {
@@ -107,7 +107,7 @@ static void blktrans_xferbuf_read ( struct xfer_buffer *xferbuf, size_t offset,
if ( blktrans->buffer ) {
/* Read data from buffer */
copy_from_user ( data, blktrans->buffer, offset, len );
memcpy ( data, ( blktrans->buffer + offset ), len );
} else {
@@ -216,11 +216,11 @@ static struct interface_descriptor blktrans_xfer_desc =
* Insert block device translator
*
* @v block Block device interface
* @v buffer Data buffer (or UNULL)
* @v buffer Data buffer (or NULL)
* @v size Length of data buffer, or block size
* @ret rc Return status code
*/
int block_translate ( struct interface *block, userptr_t buffer, size_t size ) {
int block_translate ( struct interface *block, void *buffer, size_t size ) {
struct block_translator *blktrans;
int rc;

View File

@@ -29,6 +29,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
*/
#include <string.h>
#include <errno.h>
#include <ipxe/sanboot.h>

View File

@@ -424,10 +424,10 @@ int sandev_reopen ( struct san_device *sandev ) {
struct san_command_rw_params {
/** SAN device read/write operation */
int ( * block_rw ) ( struct interface *control, struct interface *data,
uint64_t lba, unsigned int count,
userptr_t buffer, size_t len );
uint64_t lba, unsigned int count, void *buffer,
size_t len );
/** Data buffer */
userptr_t buffer;
void *buffer;
/** Starting LBA */
uint64_t lba;
/** Block count */
@@ -594,11 +594,11 @@ int sandev_reset ( struct san_device *sandev ) {
* @ret rc Return status code
*/
static int sandev_rw ( struct san_device *sandev, uint64_t lba,
unsigned int count, userptr_t buffer,
unsigned int count, void *buffer,
int ( * block_rw ) ( struct interface *control,
struct interface *data,
uint64_t lba, unsigned int count,
userptr_t buffer, size_t len ) ) {
void *buffer, size_t len ) ) {
union san_command_params params;
unsigned int remaining;
size_t frag_len;
@@ -643,11 +643,12 @@ static int sandev_rw ( struct san_device *sandev, uint64_t lba,
* @ret rc Return status code
*/
int sandev_read ( struct san_device *sandev, uint64_t lba,
unsigned int count, userptr_t buffer ) {
unsigned int count, void *buffer ) {
int rc;
/* Read from device */
if ( ( rc = sandev_rw ( sandev, lba, count, buffer, block_read ) ) != 0 )
if ( ( rc = sandev_rw ( sandev, lba, count, buffer,
block_read ) ) != 0 )
return rc;
return 0;
@@ -663,11 +664,12 @@ int sandev_read ( struct san_device *sandev, uint64_t lba,
* @ret rc Return status code
*/
int sandev_write ( struct san_device *sandev, uint64_t lba,
unsigned int count, userptr_t buffer ) {
unsigned int count, void *buffer ) {
int rc;
/* Write to device */
if ( ( rc = sandev_rw ( sandev, lba, count, buffer, block_write ) ) != 0 )
if ( ( rc = sandev_rw ( sandev, lba, count, buffer,
block_write ) ) != 0 )
return rc;
/* Quiesce system. This is a heuristic designed to ensure
@@ -799,8 +801,7 @@ static int sandev_parse_iso9660 ( struct san_device *sandev ) {
}
/* Read primary volume descriptor */
if ( ( rc = sandev_read ( sandev, lba, count,
virt_to_user ( scratch ) ) ) != 0 ) {
if ( ( rc = sandev_read ( sandev, lba, count, scratch ) ) != 0 ) {
DBGC ( sandev->drive, "SAN %#02x could not read ISO9660 "
"primary volume descriptor: %s\n",
sandev->drive, strerror ( rc ) );

View File

@@ -147,8 +147,8 @@ struct ata_command_type {
* @ret data_in Data-in buffer
* @ret data_in_len Data-in buffer length
*/
void ( * data_in ) ( struct ata_command *atacmd, userptr_t buffer,
size_t len, userptr_t *data_in,
void ( * data_in ) ( struct ata_command *atacmd, void *buffer,
size_t len, void **data_in,
size_t *data_in_len );
/**
* Calculate data-out buffer
@@ -160,8 +160,8 @@ struct ata_command_type {
* @ret data_out Data-out buffer
* @ret data_out_len Data-out buffer length
*/
void ( * data_out ) ( struct ata_command *atacmd, userptr_t buffer,
size_t len, userptr_t *data_out,
void ( * data_out ) ( struct ata_command *atacmd, void *buffer,
size_t len, void **data_out,
size_t *data_out_len );
/**
* Handle ATA command completion
@@ -285,8 +285,8 @@ static void atacmd_done ( struct ata_command *atacmd, int rc ) {
* @ret data_len Data buffer length
*/
static void atacmd_data_buffer ( struct ata_command *atacmd __unused,
userptr_t buffer, size_t len,
userptr_t *data, size_t *data_len ) {
void *buffer, size_t len,
void **data, size_t *data_len ) {
*data = buffer;
*data_len = len;
}
@@ -301,8 +301,8 @@ static void atacmd_data_buffer ( struct ata_command *atacmd __unused,
* @ret data_len Data buffer length
*/
static void atacmd_data_none ( struct ata_command *atacmd __unused,
userptr_t buffer __unused, size_t len __unused,
userptr_t *data __unused,
void *buffer __unused, size_t len __unused,
void **data __unused,
size_t *data_len __unused ) {
/* Nothing to do */
}
@@ -317,9 +317,9 @@ static void atacmd_data_none ( struct ata_command *atacmd __unused,
* @ret data_len Data buffer length
*/
static void atacmd_data_priv ( struct ata_command *atacmd,
userptr_t buffer __unused, size_t len __unused,
userptr_t *data, size_t *data_len ) {
*data = virt_to_user ( atacmd_priv ( atacmd ) );
void *buffer __unused, size_t len __unused,
void **data, size_t *data_len ) {
*data = atacmd_priv ( atacmd );
*data_len = atacmd->type->priv_len;
}
@@ -455,7 +455,7 @@ static int atadev_command ( struct ata_device *atadev,
struct interface *block,
struct ata_command_type *type,
uint64_t lba, unsigned int count,
userptr_t buffer, size_t len ) {
void *buffer, size_t len ) {
struct ata_command *atacmd;
struct ata_cmd command;
int tag;
@@ -543,7 +543,7 @@ static int atadev_command ( struct ata_device *atadev,
static int atadev_read ( struct ata_device *atadev,
struct interface *block,
uint64_t lba, unsigned int count,
userptr_t buffer, size_t len ) {
void *buffer, size_t len ) {
return atadev_command ( atadev, block, &atacmd_read,
lba, count, buffer, len );
}
@@ -562,7 +562,7 @@ static int atadev_read ( struct ata_device *atadev,
static int atadev_write ( struct ata_device *atadev,
struct interface *block,
uint64_t lba, unsigned int count,
userptr_t buffer, size_t len ) {
void *buffer, size_t len ) {
return atadev_command ( atadev, block, &atacmd_write,
lba, count, buffer, len );
}
@@ -581,7 +581,7 @@ static int atadev_read_capacity ( struct ata_device *atadev,
assert ( atacmd_identify.priv_len == sizeof ( *identity ) );
assert ( atacmd_identify.priv_len == ATA_SECTOR_SIZE );
return atadev_command ( atadev, block, &atacmd_identify,
0, 1, UNULL, ATA_SECTOR_SIZE );
0, 1, NULL, ATA_SECTOR_SIZE );
}
/**

View File

@@ -279,7 +279,7 @@ struct scsi_command {
/** Number of blocks */
unsigned int count;
/** Data buffer */
userptr_t buffer;
void *buffer;
/** Length of data buffer */
size_t len;
/** Command tag */
@@ -591,12 +591,12 @@ static void scsicmd_read_capacity_cmd ( struct scsi_command *scsicmd,
readcap16->service_action =
SCSI_SERVICE_ACTION_READ_CAPACITY_16;
readcap16->len = cpu_to_be32 ( sizeof ( *capacity16 ) );
command->data_in = virt_to_user ( capacity16 );
command->data_in = capacity16;
command->data_in_len = sizeof ( *capacity16 );
} else {
/* Use READ CAPACITY (10) */
readcap10->opcode = SCSI_OPCODE_READ_CAPACITY_10;
command->data_in = virt_to_user ( capacity10 );
command->data_in = capacity10;
command->data_in_len = sizeof ( *capacity10 );
}
}
@@ -721,7 +721,7 @@ static int scsidev_command ( struct scsi_device *scsidev,
struct interface *block,
struct scsi_command_type *type,
uint64_t lba, unsigned int count,
userptr_t buffer, size_t len ) {
void *buffer, size_t len ) {
struct scsi_command *scsicmd;
int rc;
@@ -773,7 +773,7 @@ static int scsidev_command ( struct scsi_device *scsidev,
static int scsidev_read ( struct scsi_device *scsidev,
struct interface *block,
uint64_t lba, unsigned int count,
userptr_t buffer, size_t len ) {
void *buffer, size_t len ) {
return scsidev_command ( scsidev, block, &scsicmd_read,
lba, count, buffer, len );
}
@@ -792,7 +792,7 @@ static int scsidev_read ( struct scsi_device *scsidev,
static int scsidev_write ( struct scsi_device *scsidev,
struct interface *block,
uint64_t lba, unsigned int count,
userptr_t buffer, size_t len ) {
void *buffer, size_t len ) {
return scsidev_command ( scsidev, block, &scsicmd_write,
lba, count, buffer, len );
}
@@ -807,7 +807,7 @@ static int scsidev_write ( struct scsi_device *scsidev,
static int scsidev_read_capacity ( struct scsi_device *scsidev,
struct interface *block ) {
return scsidev_command ( scsidev, block, &scsicmd_read_capacity,
0, 0, UNULL, 0 );
0, 0, NULL, 0 );
}
/**
@@ -820,7 +820,7 @@ static int scsidev_read_capacity ( struct scsi_device *scsidev,
static int scsidev_test_unit_ready ( struct scsi_device *scsidev,
struct interface *block ) {
return scsidev_command ( scsidev, block, &scsicmd_test_unit_ready,
0, 0, UNULL, 0 );
0, 0, NULL, 0 );
}
/**

View File

@@ -205,7 +205,7 @@ static int usbblk_out_data ( struct usbblk_device *usbblk ) {
/* Calculate length */
assert ( cmd->tag );
assert ( cmd->scsi.data_out != UNULL );
assert ( cmd->scsi.data_out != NULL );
assert ( cmd->offset < cmd->scsi.data_out_len );
len = ( cmd->scsi.data_out_len - cmd->offset );
if ( len > USBBLK_MAX_LEN )
@@ -220,8 +220,8 @@ static int usbblk_out_data ( struct usbblk_device *usbblk ) {
}
/* Populate I/O buffer */
copy_from_user ( iob_put ( iobuf, len ), cmd->scsi.data_out,
cmd->offset, len );
memcpy ( iob_put ( iobuf, len ),
( cmd->scsi.data_out + cmd->offset ), len );
/* Send data */
if ( ( rc = usb_stream ( &usbblk->out, iobuf, 0 ) ) != 0 ) {
@@ -332,12 +332,12 @@ static int usbblk_in_data ( struct usbblk_device *usbblk, const void *data,
/* Sanity checks */
assert ( cmd->tag );
assert ( cmd->scsi.data_in != UNULL );
assert ( cmd->scsi.data_in != NULL );
assert ( cmd->offset <= cmd->scsi.data_in_len );
assert ( len <= ( cmd->scsi.data_in_len - cmd->offset ) );
/* Store data */
copy_to_user ( cmd->scsi.data_in, cmd->offset, data, len );
memcpy ( ( cmd->scsi.data_in + cmd->offset ), data, len );
cmd->offset += len;
return 0;

View File

@@ -2,7 +2,6 @@
#define _IPXE_ATA_H
#include <stdint.h>
#include <ipxe/uaccess.h>
#include <ipxe/interface.h>
/** @file
@@ -173,7 +172,7 @@ struct ata_cmd {
* If non-NULL, this buffer must be ata_command::cb::count
* sectors in size.
*/
userptr_t data_out;
void *data_out;
/** Data-out buffer length
*
* Must be zero if @c data_out is NULL
@@ -184,7 +183,7 @@ struct ata_cmd {
* If non-NULL, this buffer must be ata_command::cb::count
* sectors in size.
*/
userptr_t data_in;
void *data_in;
/** Data-in buffer length
*
* Must be zero if @c data_in is NULL

View File

@@ -11,7 +11,6 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <ipxe/uaccess.h>
#include <ipxe/interface.h>
/** Block device capacity */
@@ -25,20 +24,20 @@ struct block_device_capacity {
};
extern int block_read ( struct interface *control, struct interface *data,
uint64_t lba, unsigned int count,
userptr_t buffer, size_t len );
uint64_t lba, unsigned int count, void *buffer,
size_t len );
#define block_read_TYPE( object_type ) \
typeof ( int ( object_type, struct interface *data, \
uint64_t lba, unsigned int count, \
userptr_t buffer, size_t len ) )
void *buffer, size_t len ) )
extern int block_write ( struct interface *control, struct interface *data,
uint64_t lba, unsigned int count,
userptr_t buffer, size_t len );
uint64_t lba, unsigned int count, void *buffer,
size_t len );
#define block_write_TYPE( object_type ) \
typeof ( int ( object_type, struct interface *data, \
uint64_t lba, unsigned int count, \
userptr_t buffer, size_t len ) )
void *buffer, size_t len ) )
extern int block_read_capacity ( struct interface *control,
struct interface *data );

View File

@@ -13,7 +13,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/refcnt.h>
#include <ipxe/interface.h>
#include <ipxe/xferbuf.h>
#include <ipxe/uaccess.h>
/** A block device translator */
struct block_translator {
@@ -27,12 +26,12 @@ struct block_translator {
/** Data transfer buffer */
struct xfer_buffer xferbuf;
/** Data buffer */
userptr_t buffer;
void *buffer;
/** Block size */
size_t blksize;
};
extern int block_translate ( struct interface *block,
userptr_t buffer, size_t size );
extern int block_translate ( struct interface *block, void *buffer,
size_t size );
#endif /* _IPXE_BLOCKTRANS_H */

View File

@@ -261,9 +261,9 @@ extern struct san_device * sandev_next ( unsigned int drive );
extern int sandev_reopen ( struct san_device *sandev );
extern int sandev_reset ( struct san_device *sandev );
extern int sandev_read ( struct san_device *sandev, uint64_t lba,
unsigned int count, userptr_t buffer );
unsigned int count, void *buffer );
extern int sandev_write ( struct san_device *sandev, uint64_t lba,
unsigned int count, userptr_t buffer );
unsigned int count, void *buffer );
extern struct san_device * alloc_sandev ( struct uri **uris, unsigned int count,
size_t priv_size );
extern int register_sandev ( struct san_device *sandev, unsigned int drive,

View File

@@ -2,7 +2,6 @@
#define _IPXE_SCSI_H
#include <stdint.h>
#include <ipxe/uaccess.h>
#include <ipxe/interface.h>
/** @file
@@ -252,14 +251,14 @@ struct scsi_cmd {
/** CDB for this command */
union scsi_cdb cdb;
/** Data-out buffer (may be NULL) */
userptr_t data_out;
void *data_out;
/** Data-out buffer length
*
* Must be zero if @c data_out is NULL
*/
size_t data_out_len;
/** Data-in buffer (may be NULL) */
userptr_t data_in;
void *data_in;
/** Data-in buffer length
*
* Must be zero if @c data_in is NULL

View File

@@ -95,8 +95,9 @@ struct efi_block_data {
static int efi_block_rw ( struct san_device *sandev, uint64_t lba,
void *data, size_t len,
int ( * sandev_rw ) ( struct san_device *sandev,
uint64_t lba, unsigned int count,
userptr_t buffer ) ) {
uint64_t lba,
unsigned int count,
void *buffer ) ) {
struct efi_block_data *block = sandev->priv;
unsigned int count;
int rc;

View File

@@ -33,7 +33,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/list.h>
#include <ipxe/if_ether.h>
#include <ipxe/iobuf.h>
#include <ipxe/uaccess.h>
#include <ipxe/netdevice.h>
#include <ipxe/features.h>
#include <ipxe/interface.h>
@@ -391,8 +390,7 @@ static void aoecmd_ata_cmd ( struct aoe_command *aoecmd,
if ( ! command->cb.lba48 )
aoeata->lba.bytes[3] |=
( command->cb.device & ATA_DEV_MASK );
copy_from_user ( aoeata->data, command->data_out, 0,
command->data_out_len );
memcpy ( aoeata->data, command->data_out, command->data_out_len );
DBGC2 ( aoedev, "AoE %s/%08x ATA cmd %02x:%02x:%02x:%02x:%08llx",
aoedev_name ( aoedev ), aoecmd->tag, aoeata->aflags,
@@ -452,8 +450,7 @@ static int aoecmd_ata_rsp ( struct aoe_command *aoecmd, const void *data,
}
/* Copy out data payload */
copy_to_user ( command->data_in, 0, aoeata->data,
command->data_in_len );
memcpy ( command->data_in, aoeata->data, command->data_in_len );
return 0;
}

View File

@@ -413,7 +413,7 @@ static int fcpcmd_recv_rddata ( struct fcp_command *fcpcmd,
fcpdev, fcpcmd->xchg_id, offset, ( offset + len ) );
/* Copy to user buffer */
copy_to_user ( command->data_in, offset, iobuf->data, len );
memcpy ( ( command->data_in + offset ), iobuf->data, len );
fcpcmd->offset += len;
assert ( fcpcmd->offset <= command->data_in_len );
@@ -464,8 +464,8 @@ static int fcpcmd_send_wrdata ( struct fcp_command *fcpcmd ) {
}
/* Construct data IU frame */
copy_from_user ( iob_put ( iobuf, len ), command->data_out,
fcpcmd->offset, len );
memcpy ( iob_put ( iobuf, len ),
( command->data_out + fcpcmd->offset ), len );
memset ( &meta, 0, sizeof ( meta ) );
meta.flags = ( XFER_FL_RESPONSE | XFER_FL_ABS_OFFSET );
meta.offset = fcpcmd->offset;

View File

@@ -31,7 +31,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#include <stdint.h>
#include <ipxe/uaccess.h>
#include <ipxe/blocktrans.h>
#include <ipxe/blockdev.h>
#include <ipxe/acpi.h>
@@ -52,7 +51,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* @ret rc Return status code
*/
int http_block_read ( struct http_transaction *http, struct interface *data,
uint64_t lba, unsigned int count, userptr_t buffer,
uint64_t lba, unsigned int count, void *buffer,
size_t len ) {
struct http_request_range range;
int rc;
@@ -101,7 +100,7 @@ int http_block_read_capacity ( struct http_transaction *http,
goto err_open;
/* Insert block device translator */
if ( ( rc = block_translate ( data, UNULL, HTTP_BLKSIZE ) ) != 0 ) {
if ( ( rc = block_translate ( data, NULL, HTTP_BLKSIZE ) ) != 0 ) {
DBGC ( http, "HTTP %p could not insert block translator: %s\n",
http, strerror ( rc ) );
goto err_translate;

View File

@@ -503,7 +503,7 @@ http_content_buffer ( struct http_transaction *http ) {
__weak int http_block_read ( struct http_transaction *http __unused,
struct interface *data __unused,
uint64_t lba __unused, unsigned int count __unused,
userptr_t buffer __unused, size_t len __unused ) {
void *buffer __unused, size_t len __unused ) {
return -ENOTSUP;
}

View File

@@ -39,7 +39,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/open.h>
#include <ipxe/scsi.h>
#include <ipxe/process.h>
#include <ipxe/uaccess.h>
#include <ipxe/tcpip.h>
#include <ipxe/settings.h>
#include <ipxe/features.h>
@@ -478,7 +477,7 @@ static int iscsi_rx_data_in ( struct iscsi_session *iscsi,
assert ( iscsi->command != NULL );
assert ( iscsi->command->data_in );
assert ( ( offset + len ) <= iscsi->command->data_in_len );
copy_to_user ( iscsi->command->data_in, offset, data, len );
memcpy ( ( iscsi->command->data_in + offset ), data, len );
/* Wait for whole SCSI response to arrive */
if ( remaining )
@@ -598,8 +597,8 @@ static int iscsi_tx_data_out ( struct iscsi_session *iscsi ) {
if ( ! iobuf )
return -ENOMEM;
copy_from_user ( iob_put ( iobuf, len ),
iscsi->command->data_out, offset, len );
memcpy ( iob_put ( iobuf, len ),
( iscsi->command->data_out + offset ), len );
memset ( iob_put ( iobuf, pad_len ), 0, pad_len );
return xfer_deliver_iob ( &iscsi->socket, iobuf );