[uaccess] Remove redundant user_to_virt()

The user_to_virt() function is now a straightforward wrapper around
addition, with the addend almost invariably being zero.

Remove this redundant wrapper.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-04-21 00:15:52 +01:00
parent 89fe788689
commit 4535548cba
14 changed files with 15 additions and 60 deletions

View File

@@ -64,11 +64,6 @@ UACCESS_INLINE ( linux, virt_to_user ) ( volatile const void *addr ) {
return trivial_virt_to_user ( addr );
}
static inline __always_inline void *
UACCESS_INLINE ( linux, user_to_virt ) ( userptr_t userptr, off_t offset ) {
return trivial_user_to_virt ( userptr, offset );
}
static inline __always_inline off_t
UACCESS_INLINE ( linux, memchr_user ) ( userptr_t buffer, off_t offset,
int c, size_t len ) {

View File

@@ -51,20 +51,6 @@ trivial_virt_to_user ( volatile const void *addr ) {
return ( ( userptr_t ) addr );
}
/**
* Convert user pointer to virtual address
*
* @v userptr User pointer
* @v offset Offset from user pointer
* @ret addr Virtual address
*
* This operation is not available under all memory models.
*/
static inline __always_inline void *
trivial_user_to_virt ( userptr_t userptr, off_t offset ) {
return ( ( void * ) userptr + offset );
}
/**
* Find character in user buffer
*
@@ -128,11 +114,6 @@ UACCESS_INLINE ( flat, virt_to_user ) ( volatile const void *addr ) {
return trivial_virt_to_user ( addr );
}
static inline __always_inline void *
UACCESS_INLINE ( flat, user_to_virt ) ( userptr_t userptr, off_t offset ) {
return trivial_user_to_virt ( userptr, offset );
}
static inline __always_inline off_t
UACCESS_INLINE ( flat, memchr_user ) ( userptr_t buffer, off_t offset,
int c, size_t len ) {
@@ -170,17 +151,6 @@ unsigned long user_to_phys ( userptr_t userptr, off_t offset );
*/
userptr_t virt_to_user ( volatile const void *addr );
/**
* Convert user pointer to virtual address
*
* @v userptr User pointer
* @v offset Offset from user pointer
* @ret addr Virtual address
*
* This operation is not available under all memory models.
*/
void * user_to_virt ( userptr_t userptr, off_t offset );
/**
* Convert virtual address to a physical address
*
@@ -201,7 +171,7 @@ virt_to_phys ( volatile const void *addr ) {
* This operation is not available under all memory models.
*/
static inline __always_inline void * phys_to_virt ( unsigned long phys_addr ) {
return user_to_virt ( phys_to_user ( phys_addr ), 0 );
return ( phys_to_user ( phys_addr ) );
}
/**