]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[block] Remove userptr_t from block device abstraction
authorMichael Brown <mcb30@ipxe.org>
Thu, 24 Apr 2025 16:11:30 +0000 (17:11 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 24 Apr 2025 16:11:30 +0000 (17:11 +0100)
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>
19 files changed:
src/arch/x86/interface/pcbios/int13.c
src/core/blockdev.c
src/core/blocktrans.c
src/core/dummy_sanboot.c
src/core/sanboot.c
src/drivers/block/ata.c
src/drivers/block/scsi.c
src/drivers/usb/usbblk.c
src/include/ipxe/ata.h
src/include/ipxe/blockdev.h
src/include/ipxe/blocktrans.h
src/include/ipxe/sanboot.h
src/include/ipxe/scsi.h
src/interface/efi/efi_block.c
src/net/aoe.c
src/net/fcp.c
src/net/tcp/httpblock.c
src/net/tcp/httpcore.c
src/net/tcp/iscsi.c

index 498676b70b470a0ef037dab7c8adfc684967c9c9..73fdfebd388cd4bd4bc744b2349d8a3c6664846e 100644 (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 ) {
index c219d967376ec0b48811ec8d90fe15d7dff816f0..3513caafaa8ebf76d25fb3528cdb5e0513b0b73a 100644 (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 );
index f3be2ba2be8668067f2826ffc064dc50beb30e3e..ba70462f2b93cccb0f89a316d9df7d0f7414e260 100644 (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;
 
index e22998da584f5084048386416514f0f0a04c9706..5ca120aac48ae713eb23f4e4d0ef55c3424b4c95 100644 (file)
@@ -29,6 +29,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  *
  */
 
+#include <string.h>
 #include <errno.h>
 #include <ipxe/sanboot.h>
 
index 4facf86b892e1793115e64fe460cc2fe5fe77aa0..bdac813ffec4edb3543351ded5dda32b3947860b 100644 (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 ) );
index b1c6855a0c113b5bdfd477631dd38a3d96c1428c..cf98d7c9f7c59e4fb548347939fadd1c73014b29 100644 (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 );
 }
 
 /**
index ff415f5c6f7ea2ca3185c8df1bd799c3f0ecfe92..251210d4fa19ce0103d02f86c79dcbae6045c39f 100644 (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 );
 }
 
 /**
index 5a086d3f850f1f95cf133c876908b9bde957b90e..39adc012f3ef9c05ac58280aa7a69751880dde09 100644 (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;
index a10cfafcc61f8e863905da374376109d9ac806e6..cd78cd7951134e574d3aeada6009d9689f8c1653 100644 (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
index 418c4300429e4bde436d3c269356cf0a74f8bf9c..ef6fc8d5a92cfa893c84d4c1315691d51911fe88 100644 (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 );
index fee71b96c0a815c96757499bac0ea31b848f711c..1167a256e3660c1ae1d4cf6e6dcf7533f5e4c196 100644 (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 */
index e44367cdbbee2d8bc8712dc773ae9b65939b69e3..9d5fceee0ae375c6e27eb4c299bb4e7fcb5625e4 100644 (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,
index 28b55b2d51459f70f8b020f2f25155b3d0cab078..9bb38a059c76aa8c4d655433471de0e96bef56e0 100644 (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
index 94e2aae06f0856278ed3cc3d756e83bca6486c39..aa5ec4e0fa0398b83f50bd113c97982a76ef6d40 100644 (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;
index dba4f51b5890043f332a346fe822618b6af97299..b484bdd338e3bb09bebb7fbad7c974019ef67a33 100644 (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;
 }
index f78f7bd9bf966b1ba5ff648b46cb669e40f98f30..9701b5d54e55f175e41fdca83280287d639ed415 100644 (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;
index 1abd6b34d068bba9e34805ef0082df0b691c22f6..156f11e4727a6498dd00d7f1e5f66343be2e8789 100644 (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;
index 7052bbbad725563dde3e66f3655e6b9d72679c1d..57c31ac26abe6e53d76babed8606831acecf26b0 100644 (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;
 }
index dd20849cecd6935143783f089391fb6a6774cb58..b7b33a51a68fc1726043a3ce19e4e322d2253184 100644 (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 );