[uaccess] Remove redundant copy_from_user() and copy_to_user()

Remove the now-redundant copy_from_user() and copy_to_user() wrapper
functions.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-04-30 15:18:34 +01:00
parent a69c42dd9f
commit b6f9e4bab0
89 changed files with 90 additions and 28 deletions

View File

@@ -32,6 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <assert.h>

View File

@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/malloc.h>
#include <ipxe/pci.h>

View File

@@ -23,6 +23,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <errno.h>
#include <elf.h>
#include <ipxe/image.h>

View File

@@ -23,6 +23,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <errno.h>
#include <initrd.h>
#include <ipxe/image.h>

View File

@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <realmode.h>

View File

@@ -1,3 +1,4 @@
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <realmode.h>

View File

@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
*/
#include <string.h>
#include <pxe.h>
#include <pxe_call.h>
#include <pic8259.h>

View File

@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <ipxe/uaccess.h>

View File

@@ -2,6 +2,7 @@
#define REALMODE_H
#include <stdint.h>
#include <string.h>
#include <registers.h>
#include <ipxe/uaccess.h>

View File

@@ -23,6 +23,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <byteswap.h>

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <string.h>
#include <ipxe/init.h>
#include <ipxe/cachedhcp.h>
#include <realmode.h>

View File

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

View File

@@ -1,3 +1,4 @@
#include <string.h>
#include <errno.h>
#include <realmode.h>
#include <biosint.h>

View File

@@ -22,6 +22,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <assert.h>
#include <realmode.h>
#include <biosint.h>

View File

@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <byteswap.h>
#include <errno.h>

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <realmode.h>
#include <bios.h>

View File

@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#include <limits.h>
#include <string.h>
#include <errno.h>
#include <ipxe/uaccess.h>
#include <ipxe/hidemem.h>

View File

@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#include <stdint.h>
#include <string.h>
#include <realmode.h>
#include <bios.h>
#include <ipxe/acpi.h>

View File

@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/iobuf.h>

View File

@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ipxe/dhcppkt.h>
#include <ipxe/init.h>

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <syslog.h>
#include <ipxe/iobuf.h>

View File

@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ipxe/umalloc.h>
#include <ipxe/image.h>

View File

@@ -32,6 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/xfer.h>

View File

@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/device.h>
#include <ipxe/fdt.h>

View File

@@ -23,6 +23,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <errno.h>
#include <ipxe/uaccess.h>
#include <ipxe/ecam.h>

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/pci.h>
#include <ipxe/settings.h>

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/usb.h>
#include <ipxe/settings.h>

View File

@@ -20,6 +20,7 @@
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <ipxe/pci.h>

View File

@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <assert.h>

View File

@@ -7,6 +7,7 @@
#include <ipxe/malloc.h>
#include <stddef.h>
#include <string.h>
#include <byteswap.h>
#include <ipxe/io.h>
#include "../../mlx_utils/include/private/mlx_memory_priv.h"

View File

@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <assert.h>

View File

@@ -18,6 +18,7 @@
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/netdevice.h>
#include <ipxe/ethernet.h>

View File

@@ -23,6 +23,7 @@
FILE_LICENCE ( BSD2 );
#include <unistd.h>
#include <string.h>
#include <ipxe/net80211.h>
/* This block of functions are from kernel.h v3.0.1 */

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( MIT );
#include <stddef.h>
#include <string.h>
#include <byteswap.h>
#include <ipxe/io.h>
#include <ipxe/netdevice.h>

View File

@@ -31,6 +31,7 @@
FILE_LICENCE ( GPL2_OR_LATER );
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <stdio.h>

View File

@@ -3,6 +3,7 @@ FILE_LICENCE ( GPL2_ONLY );
#include <mii.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <byteswap.h>

View File

@@ -101,6 +101,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
*/
#include <stdint.h>
#include <string.h>
#include <byteswap.h>
#include <errno.h>
#include <stdio.h>

View File

@@ -21,6 +21,7 @@ FILE_LICENCE ( GPL_ANY );
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <assert.h>

View File

@@ -31,6 +31,7 @@
FILE_LICENCE ( BSD2 );
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>

View File

@@ -31,6 +31,7 @@
FILE_LICENCE ( BSD2 );
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>

View File

@@ -74,7 +74,7 @@ FILE_LICENCE ( GPL2_ONLY );
*/
#include <stdint.h>
#include <string.h>
#include <byteswap.h>
#include <errno.h>
#include <ipxe/ethernet.h>

View File

@@ -32,6 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* bus (VMBus). It provides a transport layer for RNDIS packets.
*/
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <byteswap.h>

View File

@@ -20,6 +20,7 @@
FILE_LICENCE(GPL2_ONLY);
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>

View File

@@ -21,6 +21,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <assert.h>

View File

@@ -19,6 +19,7 @@
***************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <byteswap.h>

View File

@@ -31,6 +31,7 @@
FILE_LICENCE ( GPL2_ONLY );
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>

View File

@@ -28,6 +28,7 @@
FILE_LICENCE ( GPL2_ONLY );
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>

View File

@@ -3,6 +3,7 @@ FILE_LICENCE ( GPL2_ONLY );
#include <mii.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <byteswap.h>

View File

@@ -18,6 +18,7 @@
FILE_LICENCE ( GPL2_ONLY );
#include <mii.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>

View File

@@ -1,6 +1,7 @@
#include <mii.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <byteswap.h>

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <byteswap.h>

View File

@@ -16,6 +16,7 @@ FILE_LICENCE(GPL2_ONLY);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ipxe/malloc.h>
#include <ipxe/pci.h>
#include <ipxe/iobuf.h>

View File

@@ -15,6 +15,7 @@
FILE_LICENCE(GPL2_ONLY);
#include <ipxe/netdevice.h>
#include <string.h>
#include <errno.h>
#include "vxge_traffic.h"

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/nvs.h>
#include <ipxe/pci.h>

View File

@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ipxe/usb.h>
#include <ipxe/scsi.h>

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <getopt.h>
#include <ipxe/x509.h>

View File

@@ -26,6 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <getopt.h>
#include <ipxe/image.h>

View File

@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include <ipxe/image.h>
#include <ipxe/command.h>

View File

@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include <ipxe/image.h>
#include <ipxe/command.h>

View File

@@ -22,6 +22,7 @@
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <getopt.h>
#include <ipxe/pci.h>

View File

@@ -22,6 +22,7 @@
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <getopt.h>
#include <ipxe/usb.h>

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/asn1.h>

View File

@@ -21,6 +21,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_snp.h>

View File

@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ipxe/asn1.h>
#include <ipxe/der.h>

View File

@@ -33,6 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* common ELF-related functionality.
*/
#include <string.h>
#include <errno.h>
#include <elf.h>
#include <ipxe/segment.h>

View File

@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <ipxe/image.h>

View File

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

View File

@@ -13,6 +13,8 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#define DUMMY_INX( _prefix, _suffix, _type ) \
static inline __always_inline _type \
IOAPI_INLINE ( _prefix, in ## _suffix ) ( volatile _type *io_addr __unused) { \

View File

@@ -9,6 +9,8 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stddef.h>
#ifdef IOMAP_VIRT
#define IOMAP_PREFIX_virt
#else

View File

@@ -11,7 +11,6 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <string.h>
#include <ipxe/api.h>
#include <config/ioapi.h>
@@ -127,30 +126,4 @@ virt_to_phys ( volatile const void *virt );
*/
void * __attribute__ (( const )) phys_to_virt ( physaddr_t phys );
/**
* Copy data to user buffer
*
* @v dest Destination
* @v dest_off Destination offset
* @v src Source
* @v len Length
*/
static inline __always_inline void
copy_to_user ( userptr_t dest, off_t dest_off, const void *src, size_t len ) {
memcpy ( ( dest + dest_off ), src, len );
}
/**
* Copy data from user buffer
*
* @v dest Destination
* @v src Source
* @v src_off Source offset
* @v len Length
*/
static inline __always_inline void
copy_from_user ( void *dest, userptr_t src, off_t src_off, size_t len ) {
memcpy ( dest, ( src + src_off ), len );
}
#endif /* _IPXE_UACCESS_H */

View File

@@ -23,6 +23,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <errno.h>
#include <ipxe/bofm.h>
#include <ipxe/efi/efi.h>

View File

@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <ipxe/init.h>

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ipxe/pci.h>
#include <ipxe/acpi.h>

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/malloc.h>
#include <ipxe/device.h>

View File

@@ -23,6 +23,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <byteswap.h>

View File

@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/if_ether.h>

View File

@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/iobuf.h>

View File

@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/http.h>
#include <ipxe/iobuf.h>

View File

@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/uri.h>
#include <ipxe/xferbuf.h>

View File

@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#include <stdint.h>
#include <string.h>
#include <ipxe/blocktrans.h>
#include <ipxe/blockdev.h>
#include <ipxe/acpi.h>

View File

@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <byteswap.h>
#include <ipxe/xfer.h>
#include <ipxe/open.h>

View File

@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <byteswap.h>
#include <ipxe/xfer.h>

View File

@@ -33,6 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#undef NDEBUG
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <ipxe/image.h>
#include <ipxe/asn1.h>

View File

@@ -33,6 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#undef NDEBUG
#include <stdlib.h>
#include <string.h>
#include <ipxe/cpio.h>
#include <ipxe/test.h>

View File

@@ -32,6 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/* Forcibly enable assertions */
#undef NDEBUG
#include <string.h>
#include <assert.h>
#include <ipxe/image.h>
#include <ipxe/pixbuf.h>

View File

@@ -34,6 +34,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/test.h>

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <string.h>
#include <ipxe/image.h>
#include <usr/imgarchive.h>

View File

@@ -26,6 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/image.h>
#include <ipxe/downloader.h>

View File

@@ -24,6 +24,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <syslog.h>