mirror of
https://github.com/ipxe/ipxe
synced 2025-12-15 17:12:54 +03:00
[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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user