From patchwork Tue Dec 16 21:18:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 919 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919925; bh=qKHlOtLbDuXkeVZ2A5sisIYNmfpSxaaJP1nuaYKk2R0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=pVTHjmfH8YIlx0yLeFXwOD9ZOSF31dJTObV/yfXwOqaiKLft3GA1JUJNijTc8C8d+ 5pFND7dzRIIMSlPOY0lfxwR+VVb22DfCcpGZ/ka+TCFQregLDUMIo3c6IWrBszkWW4 44fbeF21g35Ob26IJtHEILMNeJvP0urS6K6aijNi95WfeaS8wwdbRkr+N5T3+grGAx NUqHLjcP0eHubNl13eU3ZuUeUxpLdr9CmrlGZORaVrJ0g7TyUQk0dbUFJ+nYBEierS +YfUd2cRUaYMKTPvPSzSWWPq2Yp7fbGdTLUjcxSXtkOe1kuWvDUCbyI1OnrjJ6FhlP 0sHbYAo1QUBqg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9046368B96 for ; Tue, 16 Dec 2025 14:18:45 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id qwv-iiwAcN7Q for ; Tue, 16 Dec 2025 14:18:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919923; bh=qKHlOtLbDuXkeVZ2A5sisIYNmfpSxaaJP1nuaYKk2R0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=sx0Fxx/G7A5FdVaf5rkDaOvpmQG2HInGODIB38ZqbH8YfbMM8Xib+p3hhc43usjBM lyVh7U32VrhL3oNrHGiuEDUPN6YiCGjfptDbryShmEyPEjivo7UrilmVQ0QLkRX9M2 JRX4x3nL3vUlvQ3hC+JGsmfPStfrxyibxh3zYz6O4N3Hxzx7TkfU7tYsIbqGIdogVS t2lvj1XkG+p8m7Fi1vn+v/xXLqQdemLvQgr9LI1SopZkhOp4hRk9zAu/wboxhSBqBc Un1ISQiYbD8Wi0s/wyVg1QRmG/2rBW90SEYeGYfsPex1nL8romK6r+FkoiSM0XWBXK 2MX78aap27Q+g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ABD7B68AF5 for ; Tue, 16 Dec 2025 14:18:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919919; bh=PlnGN7BTWH5EVjz1pGH1aGrNQYiDJMHieBblx0HSasI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TJv2g3mTTYgkQzx8CeyU9uqNDJDHM5PhODXSiL7DcqEBraNcBBRkBIe4VsKUhgP9+ wh9lVKx3vJTDcIKXLDFn/yUtp006qrq3SsdD6eG0JLpcI4SPyN6QfgM9sqixToIUeS psytTNNg0k5ks5c3aYQh6S/aPIpvKfrd1GFGJtuUeHZC4iOT7BcaKUEh+ozW8TRyKy y/XZi3g86vgEeOiE9Wgv0cJJ0IWCWCwp58U7k94sMNSospRKrX12Wllb+lCFtVcE8E 5cgzgBEUsAe4kpLvCCBoEKpDEYb8sTeBOnbbfLvK6i03l6YqdS3XH7VB8NrQSUGJj+ ysExP+6NHU5VA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EF92E68AEE; Tue, 16 Dec 2025 14:18:39 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id F4Pc0I1MugQV; Tue, 16 Dec 2025 14:18:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919914; bh=8OleCuU1/fMCi3GezkejbG1sOHGhm6KK3ZLVyxiYyhU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EZQmtPfsdeA0dUDg/ci/81jHsafAD0ilx35XJxYhnmlzIBpOABvxoLFY873+tFIIA XbBISSSNcyhJHloigKZMWgUYv4vvhRukooJkExYHDZB+FQauuFdFWZeudR8/FmYDTv r3/ajrfYOuTafkyLjosDQgpygt9mP+J8SiSRCaExltXE5VXakqcrrkRhnDe5mtu+i9 X+EXVNB/AuOnDyKyasd6IDKs2cBVf4BqD2dTdshEVij+SwjsXlestisIunJoqyeKkN OerW52KDtFq8V9u5E0Zpz2Z3e2zV8XNWPKNVc6RQGQVSvuhyjZoaFZpGQFq/DaHC+D Jm8eg0TxYKxTQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7A0C7689CD; Tue, 16 Dec 2025 14:18:34 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 14:18:04 -0700 Message-ID: <20251216211817.4131167-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251216211817.4131167-1-sjg@u-boot.org> References: <20251216211817.4131167-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: HOZ77UZ3CND634NHYUTS2MRQZRTEBRHY X-Message-ID-Hash: HOZ77UZ3CND634NHYUTS2MRQZRTEBRHY X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/11] ext4l: Extract uaccess.h declarations into their own file List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass 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 Signed-off-by: Simon Glass --- include/linux/compat.h | 3 +-- include/linux/uaccess.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 include/linux/uaccess.h diff --git a/include/linux/compat.h b/include/linux/compat.h index 12b4cfccdc5..d66ca200602 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -13,6 +13,7 @@ #include #include #include +#include #ifdef CONFIG_XEN #include @@ -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; diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h new file mode 100644 index 00000000000..96311e2c6f1 --- /dev/null +++ b/include/linux/uaccess.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _LINUX_UACCESS_H +#define _LINUX_UACCESS_H + +#include +#include + +/* + * 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 */