ext4l: Extract uaccess.h declarations into their own file
Create include/linux/uaccess.h with stub implementations for user-space access functions. In U-Boot there's no user/kernel separation, so these are simple memory copies. Includes: - copy_from_user() - copy_to_user() - get_user() / put_user() - access_ok() Update compat.h to include uaccess.h and remove the duplicate declaration. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
#ifdef CONFIG_XEN
|
||||
#include <xen/events.h>
|
||||
@@ -239,8 +240,6 @@ typedef unsigned long blkcnt_t;
|
||||
|
||||
struct work_struct {};
|
||||
|
||||
unsigned long copy_from_user(void *dest, const void *src,
|
||||
unsigned long count);
|
||||
|
||||
typedef unused_t spinlock_t;
|
||||
typedef int wait_queue_head_t;
|
||||
|
||||
32
include/linux/uaccess.h
Normal file
32
include/linux/uaccess.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef _LINUX_UACCESS_H
|
||||
#define _LINUX_UACCESS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Stub definitions for Linux kernel user-space access functions.
|
||||
* In U-Boot there's no user/kernel separation, so these are simple copies.
|
||||
*/
|
||||
|
||||
static inline unsigned long copy_from_user(void *to, const void *from,
|
||||
unsigned long n)
|
||||
{
|
||||
memcpy(to, from, n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long copy_to_user(void *to, const void *from,
|
||||
unsigned long n)
|
||||
{
|
||||
memcpy(to, from, n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define get_user(x, ptr) ({ x = *(ptr); 0; })
|
||||
#define put_user(x, ptr) ({ *(ptr) = x; 0; })
|
||||
|
||||
#define access_ok(addr, size) 1
|
||||
|
||||
#endif /* _LINUX_UACCESS_H */
|
||||
@@ -10,13 +10,6 @@ struct p_current cur = {
|
||||
};
|
||||
__maybe_unused struct p_current *current = &cur;
|
||||
|
||||
unsigned long copy_from_user(void *dest, const void *src,
|
||||
unsigned long count)
|
||||
{
|
||||
memcpy((void *)dest, (void *)src, count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *kmalloc(size_t size, int flags)
|
||||
{
|
||||
void *p;
|
||||
|
||||
Reference in New Issue
Block a user