[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:
@@ -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
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user