From 2f11f466e6b6cb47ac3b703b145e01f87bf8092e Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 24 Apr 2025 17:11:30 +0100 Subject: [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 --- src/include/ipxe/ata.h | 5 ++--- src/include/ipxe/blockdev.h | 13 ++++++------- src/include/ipxe/blocktrans.h | 7 +++---- src/include/ipxe/sanboot.h | 4 ++-- src/include/ipxe/scsi.h | 5 ++--- 5 files changed, 15 insertions(+), 19 deletions(-) (limited to 'src/include') diff --git a/src/include/ipxe/ata.h b/src/include/ipxe/ata.h index a10cfafcc..cd78cd795 100644 --- a/src/include/ipxe/ata.h +++ b/src/include/ipxe/ata.h @@ -2,7 +2,6 @@ #define _IPXE_ATA_H #include -#include #include /** @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 diff --git a/src/include/ipxe/blockdev.h b/src/include/ipxe/blockdev.h index 418c43004..ef6fc8d5a 100644 --- a/src/include/ipxe/blockdev.h +++ b/src/include/ipxe/blockdev.h @@ -11,7 +11,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include -#include #include /** 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 ); diff --git a/src/include/ipxe/blocktrans.h b/src/include/ipxe/blocktrans.h index fee71b96c..1167a256e 100644 --- a/src/include/ipxe/blocktrans.h +++ b/src/include/ipxe/blocktrans.h @@ -13,7 +13,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include #include #include -#include /** 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 */ diff --git a/src/include/ipxe/sanboot.h b/src/include/ipxe/sanboot.h index e44367cdb..9d5fceee0 100644 --- a/src/include/ipxe/sanboot.h +++ b/src/include/ipxe/sanboot.h @@ -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, diff --git a/src/include/ipxe/scsi.h b/src/include/ipxe/scsi.h index 28b55b2d5..9bb38a059 100644 --- a/src/include/ipxe/scsi.h +++ b/src/include/ipxe/scsi.h @@ -2,7 +2,6 @@ #define _IPXE_SCSI_H #include -#include #include /** @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 -- cgit v1.2.3-55-g7522