From patchwork Tue Dec 16 21:18:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 916 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=1765919915; bh=f4qovgfyx2gXa18HaZWE2PijZS49QGbEjNLHnLbO2kE=; 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=mhiUMnphEt4/KxyltVjRL+Ujwoqhfx116YxKEhLlQkdOiEnxdsuI8awCA7ZKiptvf KarNQt6OpY0ZjfLzv1CZzNgvoEx76bVdRPq5jiOzqrK3TnpMt3lrz9yvhTGtMYfE2o vCK1JSXsSuIm3fz1JnVKyP5rvoAvUOsl1gZLoFRH3gx475MnmbrLeUzl7We3sb3EW+ UwTPivzZLvUbakcGJr05NJXWqb9anDImjWOIVk1rPr8MBEUXEpEW6t48XNZOcKDrhA phwY6dfAzPXE8k0xAvmsM+DmcAak8zwwJ0iJs0IrShCEucvQuMv/HF9j1UIj7K/gF+ 1LqdTlIulFVVg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4E7D868B94 for ; Tue, 16 Dec 2025 14:18:35 -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 UWPPMoHzyXQR for ; Tue, 16 Dec 2025 14:18:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919915; bh=f4qovgfyx2gXa18HaZWE2PijZS49QGbEjNLHnLbO2kE=; 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=mhiUMnphEt4/KxyltVjRL+Ujwoqhfx116YxKEhLlQkdOiEnxdsuI8awCA7ZKiptvf KarNQt6OpY0ZjfLzv1CZzNgvoEx76bVdRPq5jiOzqrK3TnpMt3lrz9yvhTGtMYfE2o vCK1JSXsSuIm3fz1JnVKyP5rvoAvUOsl1gZLoFRH3gx475MnmbrLeUzl7We3sb3EW+ UwTPivzZLvUbakcGJr05NJXWqb9anDImjWOIVk1rPr8MBEUXEpEW6t48XNZOcKDrhA phwY6dfAzPXE8k0xAvmsM+DmcAak8zwwJ0iJs0IrShCEucvQuMv/HF9j1UIj7K/gF+ 1LqdTlIulFVVg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3CD2768B84 for ; Tue, 16 Dec 2025 14:18:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919913; bh=fdzmfxzGzOZx6ITOaiPJbEFHa3EbB6VvJjf7Yqkc01E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hoj8gWSo/4AWVe5G9C9eDdYhTtyPUzgB4sA+zncYsL9kFiPClrA1eyqwm1DVbxxSG PbRhLIg4dJyKDEhFGppZmLv5FUfGW4cPFpwG+YujgtGtiFrNNHZUbVJtGc9E++e3go nSCtD+GMpo6aAfjOR1wN4RaiF/CUQG86Z3FstGxvXHIOH9ed4rPPXQFsKp1YuXyp0Y 26Bd2qonF0+TCzAGesBlysZeOgmBZAQkO924bZpexybELHvYYBkf2PpOmZZkjFB8u1 Z4iE3Riy001escSvBYQWkjL1lUhjtjRnllKrLALG2nFHmiAUbvjvhTz3eWupF5ww8t jwt1uNqkuL7GA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6A61068AD5; Tue, 16 Dec 2025 14:18:33 -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 B__0ZjT6686R; Tue, 16 Dec 2025 14:18:33 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919909; bh=pIUY3gkF+26DKLI6RlCmuKDyhCZpMpuPoao5sAky6bg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iN8ur0QJitJXa/qhBkH+czwyGDvlVh+aLhTKcB6Nm1wCFPkc8ZtpJW9Mg1Vh7j1ks /5vkh9ZcSZWKBHOrkFYDG1m68sAZPHigcceAH0ApOAj/xPsMQcbA8nZm66dNy9gDSP g+H2MYFpbcM6OHDTkuT1iv5mn5CAHeBv2iW3esYn3xe2CWk4hVdC8c1sVq6NM+Lqho 7oXMy4dRXIjqcdL+o6jpxwUtq/s2FyAqXgnR8I5rws+f6hgVcOxkq0HlNJuZKq+Dlv MVW3l4as/pHzQDx9BzEvfoksShrOdDMhHMrYG5leY/rsCERI6Alt9BomxmIeT92KP3 JutBHIOK3zwyw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1F947689CD; Tue, 16 Dec 2025 14:18:29 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 14:18:02 -0700 Message-ID: <20251216211817.4131167-2-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: VU5B3LAVJ2ONLEUSF3S6E2SXBZTFSQHZ X-Message-ID-Hash: VU5B3LAVJ2ONLEUSF3S6E2SXBZTFSQHZ 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 01/11] ext4l: Extract export.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/export.h with stub definitions for EXPORT_SYMBOL and EXPORT_SYMBOL_GPL macros. This matches the Linux kernel's header organization where export.h is a separate file. Update compat.h to include export.h and remove the duplicate definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/compat.h | 3 +-- include/linux/export.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 include/linux/export.h diff --git a/include/linux/compat.h b/include/linux/compat.h index 62381451617..12b4cfccdc5 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -11,6 +11,7 @@ #include #include +#include #include #ifdef CONFIG_XEN @@ -182,8 +183,6 @@ typedef unsigned long blkcnt_t; #define module_put(...) do { } while (0) #define module_init(...) #define module_exit(...) -#define EXPORT_SYMBOL(...) -#define EXPORT_SYMBOL_GPL(...) #define module_param(...) #define module_param_call(...) #define MODULE_PARM_DESC(...) diff --git a/include/linux/export.h b/include/linux/export.h new file mode 100644 index 00000000000..2585bd40d25 --- /dev/null +++ b/include/linux/export.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _LINUX_EXPORT_H +#define _LINUX_EXPORT_H + +/* + * Stub definitions for Linux kernel module exports. + * U-Boot doesn't use modules, so these are no-ops. + */ +#define EXPORT_SYMBOL(sym) +#define EXPORT_SYMBOL_GPL(sym) +#define EXPORT_SYMBOL_NS(sym, ns) +#define EXPORT_SYMBOL_NS_GPL(sym, ns) + +#endif /* _LINUX_EXPORT_H */ From patchwork Tue Dec 16 21:18:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 917 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=1765919917; bh=kiMipwHr+h1niJ4lqbrF07MQoVO6m0py8pAyO4NuigM=; 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=muGcygUXKRVoBRzesotD7LKxLRi1URh9zSdSIYd7adyaINd59EFYf7IcYTrbUw2se 2dhXyYBzXeOGKRQ5XzavIL10I9jPBa3AyGOsImsP+SmdwvdjoNvdxlAudyOKNB/hAb ekSUSdgPYR9oW/n56UFy3K0P5y2xSIrvlMZ+iabrsbJS6bMDis0XpioNiwCB99bNLe tZCIK923lehm6Soyb/aQSx3QqBrWLxIQoPQNVrFEnuRKQIdzpyqOMiin+gHVwBZ+Pu lIvGG+xwnplAG3G0xfmLlX2FztEiKq+x/VhUsqHmihYpXBgf0eGUnyPSDLd7YzRzTN 1L9Nsth4/OfTg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A55E268AD5 for ; Tue, 16 Dec 2025 14:18:37 -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 Xf12PxuuqbqI for ; Tue, 16 Dec 2025 14:18:37 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919916; bh=kiMipwHr+h1niJ4lqbrF07MQoVO6m0py8pAyO4NuigM=; 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=StI8IwXMA0L29KWknIPUaDhNb4NPwvals0PT8N/vCU1IsEtLtzwVzGqh/b9K7DYdL +vB2UkBtMSwrImttkrHES7ubNlhSg6CgO9uMJJ4nnRgVBU9V+od9J4GJGvta1I9l6X ydVyOjzA3ifAHxT/nAxmLVGasWoE0y/IGIItv75SGAXd3s3akACRADRp9Z98Au4OSE oZQn/zjUDo6J7AuH++eXUaoSz44gZBFVtW9hbSQ+XfmkRFqJO/3h/snCLjXSPlhl1+ Qpmcy+kQb37WawcfE0qFGD57ncgZh849TLsjaKYV4vKxanL2suqpjOQjCLAgG/w/3i Sy4PSfFbXGl/Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9BC7F68B84 for ; Tue, 16 Dec 2025 14:18:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919914; bh=IsdwkbfgzGIPFFxW239K8La2X9Vv5lbvUFZHrNd5EpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iVXruHuvfru9QTf/scG3197umiGFDwVBgKokW1efc2ULl4D270rv2Qnn/PkPFx902 bLNOVqnXFW/CG5zPYBs4cq7lODSLWwae9EaIXC+uAG1WIcxB3MJaBYfzly1SZAuEQz iBsdoGgAZ+nZFO8awfNj5dhDQtefNos7CqkxHl1T8VtlPcvfZJsJenvLwus4GTrQRG Klb/krDEjobJexXDbYT2+fXp2b1uY3SK818P5Qxx7foCWaxEiNACnNI3qUQDNc5JG5 2mrscDr3V22uhkYt/NKNevNkcBz4DBRtIM/gWWSPTuyujcL1li0i0whSiossOTjcUb y48yZU0CHX0Ig== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 36B2768AD5; Tue, 16 Dec 2025 14:18:34 -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 xd1d7iG_1QEB; Tue, 16 Dec 2025 14:18:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919914; bh=myzbuqMiYIrXhQKHASeBA6uY4Kp0GjcqVUxNa8xXaRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=reUo74zKpZfFMBe24YPc+rVYcgWKF69HcjDo3u2HU1fd/ZxhJ9tt/OR0w5sEQGhTS EFx0loBUiUHC+g9fmgGbYSg/VrSj2enWWP3A/j8kJ6KDhoUoD9mmN0kfGFwrV/ZUPg ab5COMAaXfTylYtVaNPieOtM76aY61OBGyTxCqGMzpa4p8NbOLpEdHLHhpyRMGiy0E kB/1bt1xygO4jnbEEZF63Favuv5IZEnbpA+e8tVddMrgGAGUANlBw7M7O5lC0vJfg+ HQAh87A1CFrdwp2zJqo4bkVKlMUHDwQFosS1NQ7uO/Aem7XbDlGLKIDBOHNMcGcy5e X2oh62gvQtWDQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id AD0CF689CD; Tue, 16 Dec 2025 14:18:33 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 14:18:03 -0700 Message-ID: <20251216211817.4131167-3-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: FJHM5RBGB7ZETZYHZQZNNSNY6BRE7T55 X-Message-ID-Hash: FJHM5RBGB7ZETZYHZQZNNSNY6BRE7T55 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 02/11] ext4l: Provide sizeof_field() in linux/stddef.h 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 Add the sizeof_field() macro which returns the size of a struct field. This is used by Linux kernel code including ext4. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/stddef.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/stddef.h b/include/linux/stddef.h index c732eef65ac..deeffc96360 100644 --- a/include/linux/stddef.h +++ b/include/linux/stddef.h @@ -17,4 +17,12 @@ #undef offsetof #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) +/** + * sizeof_field() - Report the size of a struct field in bytes + * + * @TYPE: The structure containing the field of interest + * @MEMBER: The field to return the size of + */ +#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER)) + #endif 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 */ From patchwork Tue Dec 16 21:18:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 918 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=1765919923; bh=Wm+eNycprvVZ8NwYek+KTL+iqqNhh7m6HBOLepgRvkU=; 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=AGh55uzb4VidB7O3cgJuWYCltK328TdPU5DH/+isk5y6Bx0p7Oq4EFfFIW0Rwz8hN ClxznKon8SikhdkNvkzRr59MpwCuDfvW3/ULQu2uh8yLM3hPGge0Vfq1c2tdQ/wMlf yqr55MUyc421EDyUiFmsPpPWpMoV0pMgbCEYs81eYsEM+B3aeusBuXAglmToEM9K2Q 5gPPuAmuNWy9bCDPCMMZUFAoSbLxK+dnbzBslQTU8Qmy9MuKC1tQB8RgnkBeSeauoS VKN1k8QNGNV19nwzFI2uU5XsbEOa9BI8ULooaHvEt1rVjSVP0IDV4Opuw5UJA1oLfD Kb9OtufCYwOaA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 28D3A68B94 for ; Tue, 16 Dec 2025 14:18:43 -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 Ir7L2OyHYFl9 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=1765919923; bh=Wm+eNycprvVZ8NwYek+KTL+iqqNhh7m6HBOLepgRvkU=; 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=AGh55uzb4VidB7O3cgJuWYCltK328TdPU5DH/+isk5y6Bx0p7Oq4EFfFIW0Rwz8hN ClxznKon8SikhdkNvkzRr59MpwCuDfvW3/ULQu2uh8yLM3hPGge0Vfq1c2tdQ/wMlf yqr55MUyc421EDyUiFmsPpPWpMoV0pMgbCEYs81eYsEM+B3aeusBuXAglmToEM9K2Q 5gPPuAmuNWy9bCDPCMMZUFAoSbLxK+dnbzBslQTU8Qmy9MuKC1tQB8RgnkBeSeauoS VKN1k8QNGNV19nwzFI2uU5XsbEOa9BI8ULooaHvEt1rVjSVP0IDV4Opuw5UJA1oLfD Kb9OtufCYwOaA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1872D68AEE 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=z+Ul+mD9q9xXmdW3q93ihdN3WSUoHaaa/Nj2WOeozkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UpD62IeSoYV6IKC8KNFFpJrqAWYceG9x7EB/9mgH4JV6PEqFCE8D8wrEvUyO60YnZ D5itoar6asfUNmeg+xV3hYHIa2cF/hGUFuMP1ahxYl+u69jJo8ZQOl3c7kKIktfjgz pkyvo7/+r35zkPpycetz0Dh62dFAc0DIX1DAFKFxrPvBm+F8jDaTsWmgFsdIUeHUT+ iTnaUX8sLys3tKeULwk/+L45EIJ7OZVi5ch2uRDeRN7an1VWTZjUFxGH/j537bQoYQ xOTB7NZEPDqIZDfC+q0/8y2ap82jxVKObgYsHN0w7ykaZz3c+HesF6/9lD42xDfzLK weqsm06HsHo5w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EF95768AF5; 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 uEaiuBt_LJEm; 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=1765919919; bh=hyjooeiJ/0petKZ0eWObMvoj8gpO3Q7g1hRen6qCKk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJJdYEtS2YsbH44QYRGpdPzecjCzLwXHuYqez5mpIgfD0pK8F2yCfHkE2XOT9+o/d lcUerDWvZCTdGoRKBa43ne7vxBNMRBZzzXhG7oO73NjfbUEDuLd42UVIJ/AXPfaSUP kUADUCbegQW3p/ZiO/gWa9LsWjepQ59kwwKIx7+0LBZbf/4rxuIgKZhZdA2UYq2oqx pC566tgbv9t37K0Yc7oi38jJC2teDSth5NXaU3Bwmu9lwvuiG0nsUxlLfKcx11UQoX 9TlFpoOqFVKR5y2OwMPFU+e5QIvoUxlsiLR33uZBBYmDgzRDd7D0Rf7TKTROqSXzg1 /XtReVFEfwnoA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 14E4F68AD5; Tue, 16 Dec 2025 14:18:39 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 14:18:05 -0700 Message-ID: <20251216211817.4131167-5-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: CXYWVWKVUBRL3U5X2BFGU66O2OUQYQFV X-Message-ID-Hash: CXYWVWKVUBRL3U5X2BFGU66O2OUQYQFV 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 04/11] ext4l: Add some stub headers for Linux code 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 Add stub headers for Linux kernel interfaces that ext4 code expects: - capability.h: stub capability checks (always return true) - cred.h: stub credential types and macros - file.h: stub file descriptor helpers - path.h: basic path structure definition - security.h: stub LSM hooks (no-ops) - seq_file.h: stub seq_file interface These provide minimal definitions to allow ext4 code to compile. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/capability.h | 27 +++++++++++++++++++ include/linux/cred.h | 53 ++++++++++++++++++++++++++++++++++++++ include/linux/file.h | 29 +++++++++++++++++++++ include/linux/path.h | 13 ++++++++++ include/linux/security.h | 39 ++++++++++++++++++++++++++++ include/linux/seq_file.h | 18 +++++++++++++ 6 files changed, 179 insertions(+) create mode 100644 include/linux/capability.h create mode 100644 include/linux/cred.h create mode 100644 include/linux/file.h create mode 100644 include/linux/path.h create mode 100644 include/linux/security.h create mode 100644 include/linux/seq_file.h diff --git a/include/linux/capability.h b/include/linux/capability.h new file mode 100644 index 00000000000..1192c8a4033 --- /dev/null +++ b/include/linux/capability.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * This is + * + * Andrew G. Morgan + * Alexander Kjeldaas + * with help from Aleph1, Roland Buresund and Andrew Main. + * + * Stub definitions for Linux kernel capabilities. + * U-Boot doesn't implement capability checks. + */ +#ifndef _LINUX_CAPABILITY_H +#define _LINUX_CAPABILITY_H + +#define CAP_SYS_RESOURCE 24 + +static inline bool capable(int cap) +{ + return true; +} + +static inline bool ns_capable(void *ns, int cap) +{ + return true; +} + +#endif /* _LINUX_CAPABILITY_H */ diff --git a/include/linux/cred.h b/include/linux/cred.h new file mode 100644 index 00000000000..a5afc267ba0 --- /dev/null +++ b/include/linux/cred.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* Credentials management - see Documentation/security/credentials.rst + * + * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + */ +#ifndef _LINUX_CRED_H +#define _LINUX_CRED_H + +#include + +/* + * Stub definitions for Linux kernel credentials. + * U-Boot doesn't implement user credentials. + */ + +typedef struct { + uid_t val; +} kuid_t; + +typedef struct { + gid_t val; +} kgid_t; + +struct cred { + kuid_t uid; + kgid_t gid; + kuid_t fsuid; + kgid_t fsgid; +}; + +#define current_cred() NULL +#define current_uid() ((kuid_t){0}) +#define current_gid() ((kgid_t){0}) +#define current_fsuid() ((kuid_t){0}) +#define current_fsgid() ((kgid_t){0}) + +#define from_kuid(ns, uid) ((uid).val) +#define from_kgid(ns, gid) ((gid).val) +#define make_kuid(ns, uid) ((kuid_t){uid}) +#define make_kgid(ns, gid) ((kgid_t){gid}) + +#define uid_eq(a, b) ((a).val == (b).val) +#define gid_eq(a, b) ((a).val == (b).val) +#define uid_valid(uid) ((uid).val != (uid_t)-1) +#define gid_valid(gid) ((gid).val != (gid_t)-1) + +#define GLOBAL_ROOT_UID ((kuid_t){0}) +#define GLOBAL_ROOT_GID ((kgid_t){0}) +#define INVALID_UID ((kuid_t){-1}) +#define INVALID_GID ((kgid_t){-1}) + +#endif /* _LINUX_CRED_H */ diff --git a/include/linux/file.h b/include/linux/file.h new file mode 100644 index 00000000000..74859204979 --- /dev/null +++ b/include/linux/file.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Wrapper functions for accessing the file_struct fd array. + */ +#ifndef _LINUX_FILE_H +#define _LINUX_FILE_H + +/* + * Stub definitions for Linux kernel file handling. + */ + +struct file; +struct fd { + struct file *file; + unsigned int flags; +}; + +#define EMPTY_FD ((struct fd){ NULL, 0 }) + +static inline struct fd fdget(unsigned int fd) +{ + return EMPTY_FD; +} + +static inline void fdput(struct fd fd) +{ +} + +#endif /* _LINUX_FILE_H */ diff --git a/include/linux/path.h b/include/linux/path.h new file mode 100644 index 00000000000..27cc071026a --- /dev/null +++ b/include/linux/path.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _LINUX_PATH_H +#define _LINUX_PATH_H + +struct dentry; +struct vfsmount; + +struct path { + struct vfsmount *mnt; + struct dentry *dentry; +}; + +#endif /* _LINUX_PATH_H */ diff --git a/include/linux/security.h b/include/linux/security.h new file mode 100644 index 00000000000..876b70bc1c8 --- /dev/null +++ b/include/linux/security.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Linux Security plug + * + * Copyright (C) 2001 WireX Communications, Inc + * Copyright (C) 2001 Greg Kroah-Hartman + * Copyright (C) 2001 Networks Associates Technology, Inc + * Copyright (C) 2001 James Morris + * Copyright (C) 2001 Silicon Graphics, Inc. (Trust Technology Group) + * Copyright (C) 2016 Mellanox Techonologies + * + * Stub definitions for Linux Security Module (LSM) hooks. + * U-Boot doesn't implement security modules. + */ +#ifndef _LINUX_SECURITY_H +#define _LINUX_SECURITY_H + +struct inode; +struct dentry; + +static inline int security_inode_init_security(struct inode *inode, + struct inode *dir, + void *name, void *value, + void *len) +{ + return -EOPNOTSUPP; +} + +#define security_inode_create(dir, dentry, mode) 0 +#define security_inode_link(old, dir, new) 0 +#define security_inode_unlink(dir, dentry) 0 +#define security_inode_symlink(dir, dentry, name) 0 +#define security_inode_mkdir(dir, dentry, mode) 0 +#define security_inode_rmdir(dir, dentry) 0 +#define security_inode_mknod(dir, dentry, mode, dev) 0 +#define security_inode_rename(od, odent, nd, ndent, f) 0 +#define security_inode_setattr(dentry, attr) 0 + +#endif /* _LINUX_SECURITY_H */ diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h new file mode 100644 index 00000000000..fb5dbf97708 --- /dev/null +++ b/include/linux/seq_file.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _LINUX_SEQ_FILE_H +#define _LINUX_SEQ_FILE_H + +/* + * Stub definitions for seq_file interface. + * U-Boot doesn't use /proc filesystem. + */ + +struct seq_file { + void *private; +}; + +#define seq_printf(m, fmt, ...) do { } while (0) +#define seq_puts(m, s) do { } while (0) +#define seq_putc(m, c) do { } while (0) + +#endif /* _LINUX_SEQ_FILE_H */ From patchwork Tue Dec 16 21:18:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 920 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=m+BJogq6Wj9a3ClHewNuMI+NMZH7GTurJAUYIdcv4iw=; 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=jq/4UcrA073nTB12Z6GQkLmDpzfTauh5EzmJPTPtO1My2e2RFgHrBNNzDQ2vXozaN XQKljrvErQ8Vx+084MIXijSOMwadqAyFq1XCYU5+ln5I1sP9rkJ6NbpEgYklhPdCTT qESh7WJnCtr+C2bBsko2iIaIKk+lCVqWHfxcrZEK2pXWMQFGGzXz6BpjNuXKDBUnYp 3gGxGu+v6MRvX8x2Y+WBLXF4HBj74XCGDJERfSUHGdLVa2yHaHFlESeNxkwIN2SfW7 Zd6iVzyELRHwy/qIrivd4PMOGQXjc4QL9CVexwnSR60o40w8ezUBVd+oMtwgjpDKOi kf/14YrcjuFfg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CECF168B95 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 9mTjBqqCtxI9 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=1765919924; bh=m+BJogq6Wj9a3ClHewNuMI+NMZH7GTurJAUYIdcv4iw=; 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=uW/A1pL+NqoWgD+AwWAoCovM0C0wIckB7c+iN9nrrqWOLTUy9C1I2qTO+whqAR0RF R5GpgrhiyREo768GX/LORxl+yhKOLMKGPEpnyujm/0cvoZLOCBhE2OKhx3GuBDtRF+ h8/smpq+MC1/aB/Ino1L5pyQQeGpGYRgyAx7Fh7Xqx1XI5uU436/i3u154oCGKy5wP Pys7jmBy21lzU+D4NGoPWcNGJIIV7ARFSmXs3WZlNA2acL4oG/wRir910WxyP6y+bl FO8sV4tnIW/TDDItCm1Qj559FFcFiTAvtfAA+FywOA5Vx77k7KdH+gLGfp7hg+W+/D DRjobmJe44Orw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6420568B9F for ; Tue, 16 Dec 2025 14:18:44 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919920; bh=Dbq9P3k0076xMhYJOYs0WvgLrhcM8rmJtPp0YuV2Kac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PhZmU+qWfLekp9WJ7llaiA2zWXKoIfn5Y8hOaMLQmJFV31n9p1umP5RzsQq9pJOuO QGKxk1TSrbD125CvUpUD9xSgWBJvO/9qvOYau7/VxfoVaG+QMDSzyf9UmOCE4cHHZq RUaXN6cgm5gxgXVIHyE520+d4W534VNjFCMokQmflcBxvV3EV4y76EIkAdRf8o4g/3 BvvFKq7CyPHhjJkjwnyETK3WYTBG+Wcd1Y9V9MKpKm9+hwdKdnk5eEzyqJmSkKzhr2 jfc53qwSxonfE16dqDLGOd8QjGQPlaormc1WkCnGCFAQNYcPjvjZNj8AoOFL9vqWvi 2p/0IOp9NWJpg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 97D0B68AD5; Tue, 16 Dec 2025 14:18:40 -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 CP2L2k0um-ic; Tue, 16 Dec 2025 14:18:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919920; bh=DFn9ruJA90713/nH1HfrfEcY2nKnQQ2WSgPlLpjD+JM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dPt6CQD+GxWQsnun1pbIoDO/m7+PmH1lknmQFWdzT1kH93tozS4c2XSjfdw/8G39l ip0jcawbKl9rLfhgeE+lReFag1UgzFLfw5j517QqQrEKLKRbWTX3xosI1vZHylPHhF MbFney9vF1Lf+/bAkOFp3toIEa1WQXKT4YZiL8nb8kI8i7eKiNqVgbB3tz0kZWR3rE 6ETr7j4YSZnSXFyOATEVV/e7YU2RvGPvmNkz8s8ld70mV6NzUYo6ciYKdNBy7oxNNM Z+2pXR+Ns2Aey1NUltCJT9CLKD9uWTB0SffNsX1qLGV669cgRZ/FJi9ozdFrJi2eK0 DfPaMMq6o7RSA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 16496689CD; Tue, 16 Dec 2025 14:18:40 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 14:18:06 -0700 Message-ID: <20251216211817.4131167-6-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: 3GQN3NTEANCOOFSEQP3MEOTM6EDURIQR X-Message-ID-Hash: 3GQN3NTEANCOOFSEQP3MEOTM6EDURIQR 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 05/11] ext4l: Extract freezer.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/freezer.h with stub definitions for process freezer functions used during suspend/hibernate. U-Boot doesn't support process freezing, so these are no-ops. Update compat.h to include freezer.h and remove duplicate definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/compat.h | 3 +-- include/linux/freezer.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 include/linux/freezer.h diff --git a/include/linux/compat.h b/include/linux/compat.h index d66ca200602..190c3820a14 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -228,8 +229,6 @@ typedef unsigned long blkcnt_t; #define dump_stack(...) do { } while (0) #define task_pid_nr(x) 0 -#define set_freezable(...) do { } while (0) -#define try_to_freeze(...) 0 #define set_current_state(...) do { } while (0) #define kthread_should_stop(...) 0 diff --git a/include/linux/freezer.h b/include/linux/freezer.h new file mode 100644 index 00000000000..be38266beeb --- /dev/null +++ b/include/linux/freezer.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Freezer declarations + * + * Stub definitions for Linux kernel freezer (suspend/hibernate). + * U-Boot doesn't support process freezing. + */ +#ifndef _LINUX_FREEZER_H +#define _LINUX_FREEZER_H + +#define set_freezable() do { } while (0) +#define try_to_freeze() 0 +#define freezing(task) 0 +#define frozen(task) 0 +#define freezable_schedule() do { } while (0) +#define freezable_schedule_timeout(t) 0 + +#endif /* _LINUX_FREEZER_H */ From patchwork Tue Dec 16 21:18:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 921 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=1765919929; bh=/+XIOulVIgz1CYgyrhZam0CyDExo/oFui8/peA+7VQc=; 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=DbQeWv5uBMYZsSt9xGEEY3CHYVOF69wB/SwrK7liy+xoFyIWSQDq6oJuppTSPnfLc bCvpXElCOnntoDnIDYQ9qfJg3xMHXBhCwyB28kf/FbykZ9CcTwWDdRgcxr9YQTfcPN 0fbG4nBvy3cSjXPaW6nTjrhBBfTOsuKo2d25yNcgkq0enpL2I+/Y37TmceQetPLVIZ 6R7Pognu8vVzUTZl57lBK3libKSh+Mo9zYPtkL/mJk5GGRL8LRbYkJ2L/GLbV4cq4c GUkjcu4xQHw7kclLPwXAqAnrFU6OVd4ywElv8/sS7ywroN9SXPeLHyjrxoRxTqoavX 9urAtFs1CrAQg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DD36868B8F for ; Tue, 16 Dec 2025 14:18:49 -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 PNjkho4U4uJ9 for ; Tue, 16 Dec 2025 14:18:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919929; bh=/+XIOulVIgz1CYgyrhZam0CyDExo/oFui8/peA+7VQc=; 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=DbQeWv5uBMYZsSt9xGEEY3CHYVOF69wB/SwrK7liy+xoFyIWSQDq6oJuppTSPnfLc bCvpXElCOnntoDnIDYQ9qfJg3xMHXBhCwyB28kf/FbykZ9CcTwWDdRgcxr9YQTfcPN 0fbG4nBvy3cSjXPaW6nTjrhBBfTOsuKo2d25yNcgkq0enpL2I+/Y37TmceQetPLVIZ 6R7Pognu8vVzUTZl57lBK3libKSh+Mo9zYPtkL/mJk5GGRL8LRbYkJ2L/GLbV4cq4c GUkjcu4xQHw7kclLPwXAqAnrFU6OVd4ywElv8/sS7ywroN9SXPeLHyjrxoRxTqoavX 9urAtFs1CrAQg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CB39168AF5 for ; Tue, 16 Dec 2025 14:18:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919928; bh=9letgCL1DAGrU6XtioDUSw5cXUXWgDEMyZ3d4FKpG1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w5X/XNMhCLf14RUJBr+1EJOCgQ/SL/nqjRV73LFMGDJJ9bkgAJEsdyhYUn6XvyfFL 4LfCb5zcQS8L/nQint2WK7E54R7IH5c//uK63DxsiYLgcxsBJaw2GZFPNdQOl6Zmqy fuGP/TGBUn8vtuRxkxJgz4BVOT4cd4GUkcEqwdmBXW5Ak0l/vMbFJ/5OLKmiJrO8O/ COaqQmPkbFzVrEGzQNiC0MdvcyzlkTzx/edKziIA2gfT1/WSP8DPtqbQQeOtcqdEeg Zk844Eson30RINalKac4YIm951ksgoHjTq3WF7qAE16er0of5BUMRXKLRdMY+hGG08 M4uoVWT4gcBJg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 20CBD68AD5; Tue, 16 Dec 2025 14:18:48 -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 psU7Gkmyii3g; Tue, 16 Dec 2025 14:18:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919921; bh=E6818WhfCQycRpAMhvdxxiVki2FEUJFPw3IjVrA+imI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IxJJtMOfg56oOhK6kUuIxNcaB7F48MS4j8dAtnJ1pIK0onFLY2zeNyX0azunFy5xa zbajz55HYUb4kzOlMg+AUtbNEnCz9y35NX1agzjmNalJAz+QBaF9XEPWHc6izYOEsZ TqYmfOeritJLR9jHdvxX28Lchqe0YizQ59JLRyOSSn1MYD2O90zt8qeFRUanUyCjcW CMzO0ukLlJOxQ+zr1a+SyQ7hYbLW+yhAVEz5F8BNnBHu8HYjkKAv9a7CiOp1M68mQO Q6wdIEMBd076fAoJSLHqJgN7DOpeJ9pAIaxRM4Mpn3BzAn4iMz8T5fP4DEMz7PMyso eQVSN99Hu/tBw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D99F5689CD; Tue, 16 Dec 2025 14:18:40 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 14:18:07 -0700 Message-ID: <20251216211817.4131167-7-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: 6YSIVG6W6VTFXVUUBPJG34W7QWMR4UO3 X-Message-ID-Hash: 6YSIVG6W6VTFXVUUBPJG34W7QWMR4UO3 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 06/11] ext4l: Extract alloc 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/slab.h and include/linux/vmalloc.h with memory allocation functions: slab.h: - GFP flags (GFP_KERNEL, GFP_ATOMIC, etc.) - kmalloc(), kzalloc(), kcalloc(), kmalloc_array() - kfree(), krealloc(), kmemdup() - kmem_cache_* functions vmalloc.h: - vmalloc(), vzalloc(), vfree() - __vmalloc() Update compat.h to include these headers and remove duplicate definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/compat.h | 58 ++---------------------------- include/linux/slab.h | 79 +++++++++++++++++++++++++++++++++++++++++ include/linux/vmalloc.h | 24 +++++++++++++ 3 files changed, 105 insertions(+), 56 deletions(-) create mode 100644 include/linux/slab.h create mode 100644 include/linux/vmalloc.h diff --git a/include/linux/compat.h b/include/linux/compat.h index 190c3820a14..28207fb96b8 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -14,7 +14,9 @@ #include #include #include +#include #include +#include #ifdef CONFIG_XEN #include @@ -29,61 +31,6 @@ struct p_current{ extern struct p_current *current; -#define GFP_ATOMIC ((gfp_t) 0) -#define GFP_KERNEL ((gfp_t) 0) -#define GFP_NOFS ((gfp_t) 0) -#define GFP_USER ((gfp_t) 0) -#define __GFP_NOWARN ((gfp_t) 0) -#define __GFP_ZERO ((__force gfp_t)0x8000u) /* Return zeroed page on success */ - -void *kmalloc(size_t size, int flags); - -static inline void *kzalloc(size_t size, gfp_t flags) -{ - return kmalloc(size, flags | __GFP_ZERO); -} - -static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) -{ - if (size != 0 && n > SIZE_MAX / size) - return NULL; - return kmalloc(n * size, flags | __GFP_ZERO); -} - -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) -{ - return kmalloc_array(n, size, flags | __GFP_ZERO); -} - -#define vmalloc(size) kmalloc(size, 0) -#define __vmalloc(size, flags, pgsz) kmalloc(size, flags) -static inline void *vzalloc(unsigned long size) -{ - return kzalloc(size, 0); -} -static inline void kfree(const void *block) -{ - free((void *)block); -} -static inline void vfree(const void *addr) -{ - free((void *)addr); -} - -struct kmem_cache { int sz; }; - -struct kmem_cache *get_mem(int element_sz); -#define kmem_cache_create(a, sz, c, d, e) get_mem(sz) -void *kmem_cache_alloc(struct kmem_cache *obj, int flag); -static inline void kmem_cache_free(struct kmem_cache *cachep, void *obj) -{ - free(obj); -} -static inline void kmem_cache_destroy(struct kmem_cache *cachep) -{ - free(cachep); -} - #define DECLARE_WAITQUEUE(...) do { } while (0) #define add_wait_queue(...) do { } while (0) #define remove_wait_queue(...) do { } while (0) @@ -357,7 +304,6 @@ struct writeback_control { unsigned for_sync:1; /* sync(2) WB_SYNC_ALL writeback */ }; -void *kmemdup(const void *src, size_t len, gfp_t gfp); typedef int irqreturn_t; diff --git a/include/linux/slab.h b/include/linux/slab.h new file mode 100644 index 00000000000..2ea124a420d --- /dev/null +++ b/include/linux/slab.h @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Written by Mark Hemment, 1996 (markhe@nextd.demon.co.uk). + * + * (C) SGI 2006, Christoph Lameter + * Cleaned up and restructured to ease the addition of alternative + * implementations of SLAB allocators. + * (C) Linux Foundation 2008-2013 + * Unified interface for all slab allocators + * + * Memory allocation functions for Linux kernel compatibility. + * These map to U-Boot's malloc/free infrastructure. + */ +#ifndef _LINUX_SLAB_H +#define _LINUX_SLAB_H + +#include +#include + +#define GFP_ATOMIC ((gfp_t)0) +#define GFP_KERNEL ((gfp_t)0) +#define GFP_NOFS ((gfp_t)0) +#define GFP_USER ((gfp_t)0) +#define GFP_NOWAIT ((gfp_t)0) +#define __GFP_NOWARN ((gfp_t)0) +#define __GFP_ZERO ((__force gfp_t)0x8000u) +#define __GFP_NOFAIL ((gfp_t)0) + +void *kmalloc(size_t size, gfp_t flags); + +static inline void *kzalloc(size_t size, gfp_t flags) +{ + return kmalloc(size, flags | __GFP_ZERO); +} + +static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) +{ + if (size != 0 && n > SIZE_MAX / size) + return NULL; + return kmalloc(n * size, flags | __GFP_ZERO); +} + +static inline void *kcalloc(size_t n, size_t size, gfp_t flags) +{ + return kmalloc_array(n, size, flags | __GFP_ZERO); +} + +static inline void kfree(const void *block) +{ + free((void *)block); +} + +static inline void *krealloc(const void *p, size_t new_size, gfp_t flags) +{ + return realloc((void *)p, new_size); +} + +void *kmemdup(const void *src, size_t len, gfp_t gfp); + +/* kmem_cache stubs */ +struct kmem_cache { + int sz; +}; + +struct kmem_cache *get_mem(int element_sz); +#define kmem_cache_create(a, sz, c, d, e) get_mem(sz) +void *kmem_cache_alloc(struct kmem_cache *obj, gfp_t flag); + +static inline void kmem_cache_free(struct kmem_cache *cachep, void *obj) +{ + free(obj); +} + +static inline void kmem_cache_destroy(struct kmem_cache *cachep) +{ + free(cachep); +} + +#endif /* _LINUX_SLAB_H */ diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h new file mode 100644 index 00000000000..b8b5e5e63a2 --- /dev/null +++ b/include/linux/vmalloc.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * vmalloc functions for Linux kernel compatibility. + * In U-Boot, these just map to regular malloc. + */ +#ifndef _LINUX_VMALLOC_H +#define _LINUX_VMALLOC_H + +#include + +#define vmalloc(size) kmalloc(size, 0) +#define __vmalloc(size, flags, pgsz) kmalloc(size, flags) + +static inline void *vzalloc(unsigned long size) +{ + return kzalloc(size, 0); +} + +static inline void vfree(const void *addr) +{ + free((void *)addr); +} + +#endif /* _LINUX_VMALLOC_H */ From patchwork Tue Dec 16 21:18:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 922 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=1765919932; bh=YkKKbl11QTw24bmJzTS/QpTr7f0pPhN+k51OjcZdUyI=; 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=FmNqkVTp8vxSSY0GAP4wLyv7ANZBCI4mIrFORA9f6xf7PV7Z1y+WCR+l+g90Whxu9 YPMZ8lmx4lO+VpMTOgwnfk5ub8Eww+u6JwFsJr6GyReDUblg715/hDcManHHQbwArO /hmyMiaiJmg3Frn1iUipGm98jHkhaIYoQDJ8u7Pxv6l9fRLPSmZwUOytAMWQ7Wx7SB KacIsfg0kKkUJ1Gr1dMcgrdpkHJcyJtptZx4OS/yTO6CAJw3SDXu1Tz+XASaaMADdO AIvV5VRte52P1b5evzx1tM++Hoj0zCNLFIaqMPxQchu+/fdI8VlUjSYo8B0147g76/ 6RVP7iHRDXK2g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 41211689CD for ; Tue, 16 Dec 2025 14:18:52 -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 xXObU9crGHdM for ; Tue, 16 Dec 2025 14:18:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919931; bh=YkKKbl11QTw24bmJzTS/QpTr7f0pPhN+k51OjcZdUyI=; 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=r+YkMamVUuOuhKiPhH3Ro5Dlc2oZg2mAFekpBbGHJhYmtaogiuI/pEsA5GPYSn55f aBQbkrkClfWC7ny/pY9Wm6qU9eZsmaDFTO0j0eBvhFunEy+fvqpbfgH8/ncQRHyIdC zUrCwHwLD1KRhWsG1R0me+DyzR/pAu2EPq+jmPdcNkVTBkIEL1jZonoMLTzGJ6NDv5 lJhkHBliD6Dmm6Y8tTDz+UWI4QVHheaML7FZzBWfbxILIDZ1lIWArwbatQcJg77RPB X1FUlOTjJFy5IGzJ4DbYbEGKARokfn4dpCrmG2aSrGcEjtDdSNuVfo2VFoB8hYIL5a xIL8oIRZi5CxQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8FED968B8F for ; Tue, 16 Dec 2025 14:18:51 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919929; bh=aR32CYBuBb015ngkGmqDwICO4K6SN1JK32/AvuIcdf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XMuhgdBrfmSGvCtpAgNsoeDPRp1yX3DZczJNWG79HLU7aD7+iyUxfuMRBaDbEIfcf CE1n8NLMCkd20cLI3ffO16nF5klYSJjv1WO2Y+Ez9Up6+VSH+NAxXtJdNKFoYj4r1Y Q6m5Q79yzU4oTPlSOcFYyRpPOmTEMJXmQq2udyeyeT0PsE9DNJGK1nERIdU331HWrT KGAZXFaiJSphLa3HK5XsVHc/motZ1yUnQbbiQrS8rbVjEolDHLt9GxCh6tUfrZK/fH SlVOx/RQsX5fqAavlj/To1/raoNbJLQ7c+tZgLFmT5AHZdGIYNqaE938+Bga7rO+ar hHMWVxESms/vA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BD455689CD; Tue, 16 Dec 2025 14:18:49 -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 Yans3mV9-nir; Tue, 16 Dec 2025 14:18:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919925; bh=zt0v1NOztMH3pAZrMMkBHKWxGHWbzgUOIZlbPsvoQ1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UuuS+97kmYCUOqpFRVimqdJbgKeeTPEnPwj0seuD6t4tIRbKZTaXhves5jN+E20MJ CF8345XyjKVCneM9D+j0c0OMxAadahTmd3CfignAzDxNjAgcHc/I1ZcbXB1NdJB8Bx wB3GBY0PmEEUPsRUffZWf9blAAsp2ZlJ5rDsQxt/FGO10xKaZ14yImo7acNpULn1gy Lg8F9mDTtzHIJAuTOMac6W7uoswEBFhQ3ZCJ3Ttx5Wwf4H2cvw390qfpe8DtyTYrqG f5fwWmbXmWaglvcBZQW9S/+JvsupQRY4zj19XMYcSer9t0F5Qqk/6ASgqAbess1Z50 00+ybniwbhiTA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 76C2568B84; Tue, 16 Dec 2025 14:18:45 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 14:18:08 -0700 Message-ID: <20251216211817.4131167-8-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: N3QL7BDEB4QBA6DHQIS3Q4VXXEWEHMWC X-Message-ID-Hash: N3QL7BDEB4QBA6DHQIS3Q4VXXEWEHMWC 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 07/11] ext4l: Extract module 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/module.h with stub definitions for kernel module support. U-Boot doesn't use loadable modules, so these are no-ops. Includes: - THIS_MODULE, try_module_get(), module_put() - module_init(), module_exit() - module_param() and variants - MODULE_* macros (LICENSE, AUTHOR, DESCRIPTION, etc.) Update compat.h to include module.h and remove duplicate definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/compat.h | 16 +--------------- include/linux/module.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 include/linux/module.h diff --git a/include/linux/compat.h b/include/linux/compat.h index 28207fb96b8..3bba18d637d 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -126,21 +127,6 @@ typedef unsigned long sector_t; typedef unsigned long blkcnt_t; #endif -/* module */ -#define THIS_MODULE 0 -#define try_module_get(...) 1 -#define module_put(...) do { } while (0) -#define module_init(...) -#define module_exit(...) -#define module_param(...) -#define module_param_call(...) -#define MODULE_PARM_DESC(...) -#define MODULE_VERSION(...) -#define MODULE_DESCRIPTION(...) -#define MODULE_AUTHOR(...) -#define MODULE_LICENSE(...) -#define MODULE_ALIAS(...) -#define __module_get(...) /* character device */ #define MKDEV(...) 0 diff --git a/include/linux/module.h b/include/linux/module.h new file mode 100644 index 00000000000..ba226652144 --- /dev/null +++ b/include/linux/module.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Dynamic loading of modules into the kernel. + * + * Rewritten by Richard Henderson Dec 1996 + * Rewritten again by Rusty Russell, 2002 + * + * Stub definitions for Linux kernel module support. + * U-Boot doesn't use loadable modules. + */ +#ifndef _LINUX_MODULE_H +#define _LINUX_MODULE_H + +struct module; + +#define THIS_MODULE ((struct module *)0) +#define try_module_get(...) 1 +#define module_put(...) do { } while (0) +#define __module_get(...) do { } while (0) + +#define module_init(fn) +#define module_exit(fn) + +#define module_param(name, type, perm) +#define module_param_call(name, set, get, arg, perm) +#define module_param_named(name, var, type, perm) + +#define MODULE_PARM_DESC(name, desc) +#define MODULE_VERSION(ver) +#define MODULE_DESCRIPTION(desc) +#define MODULE_AUTHOR(author) +#define MODULE_LICENSE(license) +#define MODULE_ALIAS(alias) +#define MODULE_SOFTDEP(dep) +#define MODULE_INFO(tag, info) + +#endif /* _LINUX_MODULE_H */ From patchwork Tue Dec 16 21:18:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 923 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=1765919936; bh=VvSPmJR8Qc8WXVMyJc1P0WsMgzf7Aq8tVLFcIQgTAH8=; 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=U6W0qhm1uBT5tOJJhFg+3ybZMOMEaiwQj1QXU4Twn698uOalXen30zIF+QRFYYQMK iCCzDDAbGxeIeUUMM175rM5zqYkBuHK5JTkm63T2hY1Iv0WYXv+ZCF+1x2jm86hkou rOSOEHy5W/kOEZgBtS/2hOSmHX8ztnmRboFgEDaD72usr0PZeB6BkD+9GG9uuQqrHH BxSx8P/lokCtvh5Rk4PmSn9fi3s8oaiLjZ7KCe24uIxWwWfmyHJ7uZQFxABgOvg0Zu 7p7REl8ulTynZ/M68/bbvdr9Q0sWodUmluAiYeWJpBXtB3KImUMEN5sp9xhdrrzu4X nyLHrjw+OJz/Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1C1F068AF5 for ; Tue, 16 Dec 2025 14:18:56 -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 lJ8BdkuonAfm for ; Tue, 16 Dec 2025 14:18:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919936; bh=VvSPmJR8Qc8WXVMyJc1P0WsMgzf7Aq8tVLFcIQgTAH8=; 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=U6W0qhm1uBT5tOJJhFg+3ybZMOMEaiwQj1QXU4Twn698uOalXen30zIF+QRFYYQMK iCCzDDAbGxeIeUUMM175rM5zqYkBuHK5JTkm63T2hY1Iv0WYXv+ZCF+1x2jm86hkou rOSOEHy5W/kOEZgBtS/2hOSmHX8ztnmRboFgEDaD72usr0PZeB6BkD+9GG9uuQqrHH BxSx8P/lokCtvh5Rk4PmSn9fi3s8oaiLjZ7KCe24uIxWwWfmyHJ7uZQFxABgOvg0Zu 7p7REl8ulTynZ/M68/bbvdr9Q0sWodUmluAiYeWJpBXtB3KImUMEN5sp9xhdrrzu4X nyLHrjw+OJz/Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0364C68B8F for ; Tue, 16 Dec 2025 14:18:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919934; bh=hCpzRWCPVN+maatuXYz8dkzsFLWuI+7XYcli9Nt82Fc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qL0h4ymv4AZC6PuJD6G/AeBP1yt18hohBX9tCp34N3jwxFkbbwh5ma9iaNKjYSdF7 Hk6YgAAxYbRr3MDU6MXwZ0FEi42pRev3bEFT5wJOOsNj2le1arqzijsREdB4Qni2mV GnamvRmZ55sl/YhYkpawvkxAavzot6MKxVQ4dtgsheWan3RLvjfCTQxYWhZQW+o/sh odJkMmyvK2fduQLMfRJFK+pc0mImgH4sxVgxWFiDzqTB/Va5T5evHlM4QmtSyTBoXq ud91XaIl9WqwbCu+7Nq/2alDK44gf2zHH8YkJ9YZkZlFMncJlWd76NXas2RkIo1Mfv n65bnLwQRnRQQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 873C868AEE; Tue, 16 Dec 2025 14:18:54 -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 tcFIKiT3gQn0; Tue, 16 Dec 2025 14:18:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919930; bh=ZNQq5EHHduddv7bpya2AtwwkR/X6tSM+3VozsRN6Sl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pqJSoc756ERjaIneYGpql7IyilahykJacoH5Y3VWBdaBe3rsYcMnOAgUpSGeA5a2R lSQTuAiPuG9qF0s6mof3obEQhLxXmG9/eTRie+hNvwsWUcZ6QBV1HyB95XgRE+SVe0 /l93kt+duXXKOE5jrJY4g2+w0v5UwWGjQTQTfdTGg67uL8GgCT0nx1mWZyzjTBNNkA gIr8NAJ9QUKM/SxJDm6R6QfElb636qf943Tu5/oBPFq5HkBTzRp7yCLh6508kVH7oG ibIeSZwefEVfZFnpzutZwGb4WGUzxtOYKfEM2zP+EgoTWGCeAgzHXUMUSpgWTS/rtT SS/Q8J8BjboFQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0C70568AF5; Tue, 16 Dec 2025 14:18:49 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 14:18:09 -0700 Message-ID: <20251216211817.4131167-9-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: 6KEJ7XAAWRZOP6GI7KUABTYZPUIX3BBR X-Message-ID-Hash: 6KEJ7XAAWRZOP6GI7KUABTYZPUIX3BBR 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 08/11] ext4l: Extract initcall 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/init.h with stub definitions for kernel initialization macros. U-Boot has its own initialization mechanism. Includes: - Section markers: __init, __exit, __initdata, __devinit, etc. - Initcall levels: core_initcall(), late_initcall(), etc. Update compat.h to include init.h and remove duplicate definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/compat.h | 10 +-------- include/linux/init.h | 49 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 include/linux/init.h diff --git a/include/linux/compat.h b/include/linux/compat.h index 3bba18d637d..fc0bfc31e5f 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -147,8 +148,6 @@ typedef unsigned long blkcnt_t; #define blocking_notifier_call_chain(...) 0 -#define __initdata -#define late_initcall(...) #define dev_set_name(...) do { } while (0) #define device_register(...) 0 @@ -197,13 +196,6 @@ typedef int wait_queue_head_t; #define cond_resched() do { } while (0) #define yield() do { } while (0) -#define __init -#define __exit -#define __devinit -#define __devinitdata -#define __devinitconst -#define __initconst -#define __initdata #define kthread_create(...) __builtin_return_address(0) #define kthread_stop(...) do { } while (0) diff --git a/include/linux/init.h b/include/linux/init.h new file mode 100644 index 00000000000..ea74422c337 --- /dev/null +++ b/include/linux/init.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * These macros are used to mark some functions or initialized data + * as 'initialization' functions. The kernel can take this as hint + * that the function is used only during the initialization phase + * and free up used memory resources after. + * + * Stub definitions for Linux kernel initialization macros. + * U-Boot has its own initialization mechanism. + */ +#ifndef _LINUX_INIT_H +#define _LINUX_INIT_H + +/* Section markers - these are no-ops in U-Boot */ +#define __init +#define __exit +#define __initdata +#define __exitdata +#define __initconst +#define __exitconst +#define __devinit +#define __devexit +#define __devinitdata +#define __devexitdata +#define __devinitconst +#define __devexitconst + +/* Initcall levels - no-ops in U-Boot */ +#define pure_initcall(fn) +#define core_initcall(fn) +#define core_initcall_sync(fn) +#define postcore_initcall(fn) +#define postcore_initcall_sync(fn) +#define arch_initcall(fn) +#define arch_initcall_sync(fn) +#define subsys_initcall(fn) +#define subsys_initcall_sync(fn) +#define fs_initcall(fn) +#define fs_initcall_sync(fn) +#define rootfs_initcall(fn) +#define device_initcall(fn) +#define device_initcall_sync(fn) +#define late_initcall(fn) +#define late_initcall_sync(fn) + +#define __initcall(fn) +#define __exitcall(fn) + +#endif /* _LINUX_INIT_H */ From patchwork Tue Dec 16 21:18:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 924 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=1765919938; bh=fh0LRh2VjQF7ozuD9XdMDytbetwOLUQzwlWJyYLySik=; 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=txLsHLyc3ofBvWR8ca+nbro0k+C+siyHmLiQrDNK44jIhtN1AjklBUHbFWXfdHKBA Lfhgbnjjf+Tk2cqBOIBsar/E34SzTXTp8/T2tBlsyf0pm8iGa+0n2GRwuARUCLjzaN TjIv4qkOp+Wl4bGsKqKaGVZLbB/12SMnF/O2gAn/lo/hJxVg36VcN4lcuHBaaZvJZE hibQf751Wk3OM6Gk3negG3s645kVQe7bENeOd0XAZVkpffPTEOiB4W7UN2Flfygod7 biw7pIlubkzHI51gHnwLvtCWVjS05YRicztTW7/G5O4ZXX/SOBCPdqaJLg962BjI0M 5+MItFyFSaaFQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7081468BA3 for ; Tue, 16 Dec 2025 14:18:58 -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 cJPHBP3KtMB2 for ; Tue, 16 Dec 2025 14:18:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919936; bh=fh0LRh2VjQF7ozuD9XdMDytbetwOLUQzwlWJyYLySik=; 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=VlFH1WUO5DAw+ApenQXuGKxu0lYtlweBSCEJ340X3spxjnr8u/icivoxc8Wpk0sYo clah7PqJHrpYaTF3JnKcgF1Oql1dY7MdD5LvjOH6QrPvx/eBxRGJOTBJYtPjWJgrXq /pYtlRN0RPDJ/19SlXWWy3SpZbm7sgJT3GIRh8gmeIPdGzUaWEdQrE0ZPAlYpXKMGw HvWoVvVp2DtS8Tuhfoiu5LaOQGL92pw7hg1wOPqV12zKfRPd73crGVHfS3GVGn1vza e3U8P18viyd6pa2LPPO4hULUiTGkunbLiesju/nVQVjFLxkKJHZGOknrQ5A8s25LPT BY+mj05mrvi6w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6515668AEE for ; Tue, 16 Dec 2025 14:18:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919935; bh=Ucp9TKk75xyc0BTnXKvacsDFpCO3URxdR4FrMb3E4Hw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IXPGkR+E0VqtRyr26XXgngLNn2wq401RVNs9YaXq/QbdFhp7pitXaY+b32mkpqDJz hz3suKQKbLlRMVY3IDWWGRi5MBpEdHfBtgjkazB6XecfcuefSNyt1zFvVXydda50PF tK7cQijR9dZtvX+lejRAQ7TcH1JkselLz5KXI1jv3Jkf8PXA6qzrI+G1ijJWFPj6Pt xu2hjLAup4dMVSgkq/Nl9oDWzNbIvsrA+tle/bSKX+W/cFIgtWwq/kLclFKNADX7fn Rq+npzukMlLYG6ewxFy9NBE0HNVBMDCGeWpSofiDpgY1CqldMmN0Dj+o3c0pJ2MhA1 dmWkGPeZe3CJg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2BCB868B8F; Tue, 16 Dec 2025 14:18:55 -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 gOM-zFf1aTmR; Tue, 16 Dec 2025 14:18:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919934; bh=iAJPxrWTC2M0FFozgE/R6e6aTlZQHF895jZKHeVAzXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JPIv5UmIGTd5fN26PnMM8/5lzDiNDqkw5TcWYnWO+ck80l/VOVoLDtMbxrZByAwJH FDDQnZVASC4MKbz4/C4HVR8wC8kEorNA7X+4JJo8zJQlC5zc+Q8ZL7Zv4hNXGhefL9 oUM8BXYKi3q6iQ6/E58TudIalbL2gwV4XLqJy+AC+hEzXwh+eqmA56Rk8LH405aVZz 3yl0lsnMRrnQeRpmZBgsgzafgvMhohMNoXjkL7djQkscNfV96nBIzHnDwWZoNsRsJG gU6inhNGecyFRCzuARcH06nlrTZFnqUNc1ISXbtKOBHFfwaUgoqfx3iGroraMga23Z 0rgGC58Aej1bA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 990BE68AF5; Tue, 16 Dec 2025 14:18:54 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 14:18:10 -0700 Message-ID: <20251216211817.4131167-10-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: QNHJMKBI2O3KKCVWQ4DSRUHCFSG4B6H5 X-Message-ID-Hash: QNHJMKBI2O3KKCVWQ4DSRUHCFSG4B6H5 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 09/11] ext4l: Extract kthread 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/kthread.h with stub definitions for kernel thread support. U-Boot doesn't have multi-threading. Includes: - kthread_create(), kthread_run(), kthread_stop() - kthread_should_stop(), kthread_should_park() - wake_up_process(), set_current_state() - task_pid_nr() Update compat.h to include kthread.h and remove duplicate definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/compat.h | 7 +------ include/linux/kthread.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 include/linux/kthread.h diff --git a/include/linux/compat.h b/include/linux/compat.h index fc0bfc31e5f..e9db2120de6 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -160,9 +161,6 @@ typedef unsigned long blkcnt_t; #define wake_up_interruptible(...) do { } while (0) #define dump_stack(...) do { } while (0) -#define task_pid_nr(x) 0 -#define set_current_state(...) do { } while (0) -#define kthread_should_stop(...) 0 #define setup_timer(timer, func, data) do {} while (0) #define del_timer_sync(timer) do {} while (0) @@ -197,9 +195,6 @@ typedef int wait_queue_head_t; #define yield() do { } while (0) -#define kthread_create(...) __builtin_return_address(0) -#define kthread_stop(...) do { } while (0) -#define wake_up_process(...) do { } while (0) struct rw_semaphore { int i; }; #define down_write(...) do { } while (0) diff --git a/include/linux/kthread.h b/include/linux/kthread.h new file mode 100644 index 00000000000..ba35274e9a4 --- /dev/null +++ b/include/linux/kthread.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Simple interface for creating and stopping kernel threads without mess. + * + * Stub definitions for Linux kernel thread support. + * U-Boot doesn't have multi-threading. + */ +#ifndef _LINUX_KTHREAD_H +#define _LINUX_KTHREAD_H + +struct task_struct; + +#define kthread_create(fn, data, fmt, ...) \ + ((struct task_struct *)__builtin_return_address(0)) +#define kthread_run(fn, data, fmt, ...) \ + ((struct task_struct *)__builtin_return_address(0)) +#define kthread_stop(task) do { } while (0) +#define kthread_should_stop() 0 +#define kthread_should_park() 0 +#define kthread_park(task) 0 +#define kthread_unpark(task) do { } while (0) +#define kthread_parkme() do { } while (0) + +#define wake_up_process(task) do { } while (0) +#define set_current_state(state) do { } while (0) + +#define task_pid_nr(task) 0 + +#endif /* _LINUX_KTHREAD_H */ From patchwork Tue Dec 16 21:18:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 925 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=1765919938; bh=MVIGHF4cIbbMbGrIKjxQ1by21Z1/lKClE28UvRWhtLo=; 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=WEu6MKnKv2VIDahji+oc9xB7eC9BeGeuUdYUV0eR+le6EN1p/weOWLTUE+TxuaDTc p8j2pf8ocL8M9+fsGPK2ERPAsCghtf8VklYfQ/1kD/Ct1Ct3LJd2ZSLJ+ZSVAfKA4O PMKWBitwq15ClQQVh4xpVn5nIndekfbpxoAlSN6MR0GpSOMx8vX7sPqWFNM8A2vwgP 8kt5IUfuKPVrzKU6Glkvhouo9JwymknT6YD+YzCOMtL3xqBZg2fhRZwWFslc96cPMb nEj3MIu/jH6a+i7Rm11a1jIMa5Sz4lD7yh0+uMz3+UNajqG5T7cPs3wZZxGxqkwao+ 4Wlvwg9ZhSHBw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B9C0A68AF5 for ; Tue, 16 Dec 2025 14:18:58 -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 1wXWbb2oj6vw for ; Tue, 16 Dec 2025 14:18:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919937; bh=MVIGHF4cIbbMbGrIKjxQ1by21Z1/lKClE28UvRWhtLo=; 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=KS+N2a6cIM6hrEkD9fePD4OTGQEEehl1Ts1n5Kr2WVwPAQy+IogjioqgAyPO5s/5i oYPDTER1zv9S48grsDitdaNKSYvMeYcj+O0tyjIbhLjf7emz8zQc8z1ekQYAnAVuxY pAzisMfx6JKn1cxPgKMMgqD39rtAqPC5ql0wVRwhkh6FrFS99fw7qxPt0OAJhRUAlO ahP42frUC86lD/weKrGe/2G88rr8rmBhseGre6SFmKWFzLPfknxLdAHw7hzUY4yBv1 CM0C7l+fFO5mOb9BiXQToC/aT/VKEqspkRX8mIy/Ydtif2FxhzX9UI8IvqBf5ABv0s Zln3v5IsSaEUw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 62A5968B9D for ; Tue, 16 Dec 2025 14:18:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919936; bh=xk6FeSyeT4UNP3hHYNpPZRncWi4oYCq2dNhrS2H0vj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LBWJV/gTR7ENb3DtYw+yfjmWuQ/s6QXY5YYqMxJlxlJiScYs4QckrvlkBhfJbPlx1 van/1ivftk23jMJUGc/QvTipBlNAH9MjAgT7O16MmoKnCdtw8I3vemGpaLVnyJEZt0 +O0yjv8lWUWb4WkRlYNhZJDiw9TCG2KoBM4mai3tprA5rPlslQ8mZhuIjhVGqBvgC7 mzd4/X1/SnTqwYfa4Qu93b263wRkXa1cQc/txbnRCZBc68W4q8jOyoiLKRv9mjzlMh DoMNmayNgYI4d+gdnY3T35rEHNIIt2BGYyL6bIV8dc7e/2ADPWC3IbWZ1g11Ts9hk2 P/BHMRZbqHhGQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0BAA668B95; Tue, 16 Dec 2025 14:18:56 -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 ll7nHQkDs3oi; Tue, 16 Dec 2025 14:18:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919935; bh=rIgM19h/yFfBaR8A2tZ1Yv8qNON0hvAgLWTOz5mk4Lg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I9FHYCdLKQcqkWbK58AXzhLJrVuT+eG8uOlukmmSJPDvrcpZ+HqUDYs04vHyvrd8V SNBFsOKCmoKNXHfC98oQgjMy0iuZvte5bGNi+M8+nHWAeaqFH+VG6PTBfPeSI76llR w23dYyU3wnpKcaoO4oJ5xDNKUqjBSsJNdr6A2suRP8EzqFZvqce2xmbu1KLAt5atkS 1qzcjLLM7aUPRhN4c6134KchpzL7WA3prNAhClzxsuJ+q+slBLBMAOKYA+bbL/z8Rb udrnh9aWFV5eMZy2d08s5PxQzx5K3r9Y9J6iF7r21M9gLtse2xtoGsV1yAJAbOuQpD 9yhcpl11ExeGg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6ADF868AEE; Tue, 16 Dec 2025 14:18:55 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 14:18:11 -0700 Message-ID: <20251216211817.4131167-11-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: YOIWO2S57EOKJ6MPEDOB7RCX3KKADZWC X-Message-ID-Hash: YOIWO2S57EOKJ6MPEDOB7RCX3KKADZWC 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 10/11] ext4l: Extract timer 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/timer.h and include/linux/workqueue.h with stub definitions for kernel timer and workqueue support. U-Boot doesn't use these subsystems. timer.h: - struct timer_list - setup_timer(), del_timer(), del_timer_sync() - timer_setup(), mod_timer(), timer_pending() workqueue.h: - struct work_struct, struct delayed_work - INIT_WORK(), schedule_work() - queue_work(), cancel_work_sync() - alloc_workqueue(), destroy_workqueue() Update compat.h to include these headers and remove duplicate definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/compat.h | 9 ++------- include/linux/timer.h | 30 ++++++++++++++++++++++++++++++ include/linux/workqueue.h | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 include/linux/timer.h create mode 100644 include/linux/workqueue.h diff --git a/include/linux/compat.h b/include/linux/compat.h index e9db2120de6..6892decf3ec 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -18,8 +18,10 @@ #include #include #include +#include #include #include +#include #ifdef CONFIG_XEN #include @@ -162,12 +164,6 @@ typedef unsigned long blkcnt_t; #define dump_stack(...) do { } while (0) -#define setup_timer(timer, func, data) do {} while (0) -#define del_timer_sync(timer) do {} while (0) -#define schedule_work(work) do {} while (0) -#define INIT_WORK(work, fun) do {} while (0) - -struct work_struct {}; typedef unused_t spinlock_t; @@ -280,7 +276,6 @@ struct writeback_control { typedef int irqreturn_t; -struct timer_list {}; struct notifier_block {}; typedef unsigned long dmaaddr_t; diff --git a/include/linux/timer.h b/include/linux/timer.h new file mode 100644 index 00000000000..71274df1125 --- /dev/null +++ b/include/linux/timer.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Stub definitions for Linux kernel timer support. + * U-Boot doesn't use kernel timers. + */ +#ifndef _LINUX_TIMER_H +#define _LINUX_TIMER_H + +struct timer_list { + unsigned long expires; + void (*function)(struct timer_list *); + unsigned long data; +}; + +#define DEFINE_TIMER(name, func) \ + struct timer_list name = { .function = func } + +#define setup_timer(timer, func, data) do { } while (0) +#define timer_setup(timer, func, flags) do { } while (0) +#define init_timer(timer) do { } while (0) +#define add_timer(timer) do { } while (0) +#define del_timer(timer) 0 +#define del_timer_sync(timer) 0 +#define mod_timer(timer, expires) 0 +#define timer_pending(timer) 0 + +#define from_timer(var, callback_timer, timer_fieldname) \ + container_of(callback_timer, typeof(*var), timer_fieldname) + +#endif /* _LINUX_TIMER_H */ diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h new file mode 100644 index 00000000000..8f0cc25a2ea --- /dev/null +++ b/include/linux/workqueue.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * workqueue.h --- work queue handling for Linux. + * + * Stub definitions for Linux kernel workqueue support. + * U-Boot doesn't use workqueues. + */ +#ifndef _LINUX_WORKQUEUE_H +#define _LINUX_WORKQUEUE_H + +struct work_struct { + void (*func)(struct work_struct *); +}; + +struct delayed_work { + struct work_struct work; +}; + +#define INIT_WORK(work, func) do { } while (0) +#define INIT_DELAYED_WORK(work, func) do { } while (0) +#define schedule_work(work) 0 +#define schedule_delayed_work(work, delay) 0 +#define cancel_work_sync(work) 0 +#define cancel_delayed_work(work) 0 +#define cancel_delayed_work_sync(work) 0 +#define flush_work(work) 0 +#define flush_delayed_work(work) 0 +#define queue_work(wq, work) 0 +#define queue_delayed_work(wq, work, delay) 0 + +#define alloc_workqueue(fmt, flags, max, ...) ((struct workqueue_struct *)1) +#define create_singlethread_workqueue(name) ((struct workqueue_struct *)1) +#define destroy_workqueue(wq) do { } while (0) + +struct workqueue_struct; + +#endif /* _LINUX_WORKQUEUE_H */ From patchwork Tue Dec 16 21:18:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 926 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=1765919942; bh=xMcbv5OISV1MuHCn+G2BrQaSyn4siijDo3aIO+mpmvs=; 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=LaEEGjjtnpxOcj1GIPpixNboirVY8lmfAD9gbZThqBv4iOrDfkPV/AuHrOQfCe/5T 2mkCrFemxd4sKulUSgFePUd9nk+N4SNh/qpDbvvJWNN+tcGYOIMxWy7CTKC+U7ZzBj tQRRIXUH0hzaQsYkAV0VGsCZWd0HUiA+veeKcPGd2yTjOEqJqAus2PWs9yUhX/EACk a/WG4sSqw4nepm7bieD8HkqtGuwXV8wud03LvdI4KZ7J+4pskxO3GySsOL6CRURgJr 5VOougDcROAK+bHy9PIkSnq2cFleiNn52NZWZ1yQfwnWCHM3wUwCfKgjSF/PjeetEa SCyEMx6co/aKA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EDB3D68B8F for ; Tue, 16 Dec 2025 14:19:02 -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 fyLYAvgKHRbY for ; Tue, 16 Dec 2025 14:19:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919942; bh=xMcbv5OISV1MuHCn+G2BrQaSyn4siijDo3aIO+mpmvs=; 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=LaEEGjjtnpxOcj1GIPpixNboirVY8lmfAD9gbZThqBv4iOrDfkPV/AuHrOQfCe/5T 2mkCrFemxd4sKulUSgFePUd9nk+N4SNh/qpDbvvJWNN+tcGYOIMxWy7CTKC+U7ZzBj tQRRIXUH0hzaQsYkAV0VGsCZWd0HUiA+veeKcPGd2yTjOEqJqAus2PWs9yUhX/EACk a/WG4sSqw4nepm7bieD8HkqtGuwXV8wud03LvdI4KZ7J+4pskxO3GySsOL6CRURgJr 5VOougDcROAK+bHy9PIkSnq2cFleiNn52NZWZ1yQfwnWCHM3wUwCfKgjSF/PjeetEa SCyEMx6co/aKA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D8ABD68AF5 for ; Tue, 16 Dec 2025 14:19:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919941; bh=pzAyMoHlbV4DuqDaGs4zY7X4WliY0zLcVm9dsd7gIL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tUI3WAGMUMVIHEQffGjjjnYdgyC6/ycIkWe5XSCo8yIt4abMIp9gcAFgjQvd3dEif 2EW+6xxjPhTs5pE31xqCABQGptsPWsAC4gm9ryPiXVCM3jELFxCozvoOv5kDArEoYf v50cAkEbZVhtTYFZ5w9PuPV8aOot8DfgeR8004DJ+YMyPNGuuMqyfr67S/RoSC1lXF 6VWdquFtPYF99+GlTuPrilj0oRwuzkNqbEE4TMHUQX4sSlkrltlxmZibKEw2phk09W BhvW8CNZTyh8GGlJUprARwpIg/FQY7M1CIdHRDX9MjU1RmhUoQSx5Fn3nyXY6Vtwnr muEtSPDuxHcWw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 09F2D689CD; Tue, 16 Dec 2025 14:19:01 -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 s4uHjPi-Iax4; Tue, 16 Dec 2025 14:19:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919936; bh=TZtPjCQVtEAgNgACTOD4kthNtn+GaId0S9/bYh0BTbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SvfjtM2xsDJHkagdJQzDtbaaNmBmmxWLxDt5zxf3k/uPQX/XkLWWqz+JKRVHiFvnk 9mWhGLEX+BvP/4JpScY8a0fu7e2El0ZGiox19FYl7ArLoQ2QsI5WsBZETRs3hkN+gU lpJiROVL1VBx/7io25xPePc9QdeDewxEANhanyzv/fDILbpZcCuXWrbnEwDzHLhriM Kf+JPsan13HMg1lAr2dJ+GokX9XJFQG4fKyAtqtDa9wX5zeR8HwNFLqfbZTnKTpThh ve2DIorBi4hJtUqUCFGD5wtIbWJYapSFjJlm5kyAKDqU1b8OnGQ6nJKZauLUgVOffp q64BiW47IXvoA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 49D1C68B9F; Tue, 16 Dec 2025 14:18:56 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 14:18:12 -0700 Message-ID: <20251216211817.4131167-12-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: 22W3LSCFFFJOYQLDC53HRCTDEBKPJ3ZH X-Message-ID-Hash: 22W3LSCFFFJOYQLDC53HRCTDEBKPJ3ZH 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 11/11] ext4l: Add stub versions various other linux headers 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 Add stub headers for various Linux kernel interfaces that ext4 code expects: - sched.h: scheduler stubs (task_struct, cond_resched, yield) - wait.h: wait queue stubs - rwsem.h: read-write semaphore stubs - percpu_counter.h: percpu counter implementation (single-threaded) - random.h: random number stubs - quotaops.h: disk quota operation stubs - part_stat.h: partition statistics stubs - prefetch.h: prefetch operation stubs - sort.h: sort wrapper using stdlib qsort - swap.h: swap/memory management stubs Update compat.h to include new headers and remove duplicate definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/compat.h | 28 ++---------- include/linux/part_stat.h | 16 +++++++ include/linux/percpu_counter.h | 80 ++++++++++++++++++++++++++++++++++ include/linux/prefetch.h | 17 ++++++++ include/linux/quotaops.h | 38 ++++++++++++++++ include/linux/random.h | 15 +++++++ include/linux/rwsem.h | 28 ++++++++++++ include/linux/sched.h | 36 +++++++++++++++ include/linux/sort.h | 19 ++++++++ include/linux/swap.h | 18 ++++++++ include/linux/wait.h | 31 +++++++++++++ 11 files changed, 302 insertions(+), 24 deletions(-) create mode 100644 include/linux/part_stat.h create mode 100644 include/linux/percpu_counter.h create mode 100644 include/linux/prefetch.h create mode 100644 include/linux/quotaops.h create mode 100644 include/linux/random.h create mode 100644 include/linux/rwsem.h create mode 100644 include/linux/sched.h create mode 100644 include/linux/sort.h create mode 100644 include/linux/swap.h create mode 100644 include/linux/wait.h diff --git a/include/linux/compat.h b/include/linux/compat.h index 6892decf3ec..d5e4c3b4530 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -11,12 +11,16 @@ #include #include +#include #include #include #include #include #include #include +#include +#include +#include #include #include #include @@ -93,8 +97,6 @@ extern struct p_current *current; #define PAGE_SIZE 4096 #endif -/* drivers/char/random.c */ -#define get_random_bytes(...) /* include/linux/leds.h */ struct led_trigger {}; @@ -180,23 +182,9 @@ typedef int wait_queue_head_t; #define mutex_lock(...) #define mutex_unlock(...) -#define init_rwsem(...) do { } while (0) -#define down_read(...) do { } while (0) -#define down_write(...) do { } while (0) -#define down_write_trylock(...) 1 -#define up_read(...) do { } while (0) -#define up_write(...) do { } while (0) -#define cond_resched() do { } while (0) -#define yield() do { } while (0) - -struct rw_semaphore { int i; }; -#define down_write(...) do { } while (0) -#define up_write(...) do { } while (0) -#define down_read(...) do { } while (0) -#define up_read(...) do { } while (0) struct device { struct device *parent; struct class *class; @@ -217,15 +205,7 @@ struct cdev { #define cdev_add(...) 0 #define cdev_del(...) do { } while (0) -#define prandom_u32(...) 0 - -typedef struct { - uid_t val; -} kuid_t; -typedef struct { - gid_t val; -} kgid_t; /* from include/linux/types.h */ diff --git a/include/linux/part_stat.h b/include/linux/part_stat.h new file mode 100644 index 00000000000..8c998b99786 --- /dev/null +++ b/include/linux/part_stat.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Stub definitions for partition statistics. + * U-Boot doesn't track I/O statistics. + */ +#ifndef _LINUX_PART_STAT_H +#define _LINUX_PART_STAT_H + +#define STAT_READ 0 +#define STAT_WRITE 1 + +#define part_stat_read(bdev, field) 0 +#define part_stat_inc(bdev, field) do { } while (0) +#define part_stat_add(bdev, field, val) do { } while (0) + +#endif /* _LINUX_PART_STAT_H */ diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h new file mode 100644 index 00000000000..425648e6377 --- /dev/null +++ b/include/linux/percpu_counter.h @@ -0,0 +1,80 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * A simple "approximate counter" for use in ext2 and ext3 superblocks. + * + * WARNING: these things are HUGE. 4 kbytes per counter on 32-way P4. + * + * Stub definitions for percpu counters. + * U-Boot is single-threaded, use simple counters. + */ +#ifndef _LINUX_PERCPU_COUNTER_H +#define _LINUX_PERCPU_COUNTER_H + +#include + +struct percpu_counter { + s64 count; +}; + +static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount, + gfp_t gfp) +{ + fbc->count = amount; + return 0; +} + +static inline void percpu_counter_destroy(struct percpu_counter *fbc) +{ +} + +static inline void percpu_counter_set(struct percpu_counter *fbc, s64 amount) +{ + fbc->count = amount; +} + +static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) +{ + fbc->count += amount; +} + +static inline void percpu_counter_sub(struct percpu_counter *fbc, s64 amount) +{ + fbc->count -= amount; +} + +static inline void percpu_counter_inc(struct percpu_counter *fbc) +{ + fbc->count++; +} + +static inline void percpu_counter_dec(struct percpu_counter *fbc) +{ + fbc->count--; +} + +static inline s64 percpu_counter_read(struct percpu_counter *fbc) +{ + return fbc->count; +} + +static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc) +{ + return fbc->count > 0 ? fbc->count : 0; +} + +static inline s64 percpu_counter_sum(struct percpu_counter *fbc) +{ + return fbc->count; +} + +static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) +{ + return fbc->count > 0 ? fbc->count : 0; +} + +static inline bool percpu_counter_initialized(struct percpu_counter *fbc) +{ + return true; +} + +#endif /* _LINUX_PERCPU_COUNTER_H */ diff --git a/include/linux/prefetch.h b/include/linux/prefetch.h new file mode 100644 index 00000000000..4b9bbfbe7e9 --- /dev/null +++ b/include/linux/prefetch.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Generic cache management functions. Everything is arch-specific, + * but this header exists to make sure the defines/functions can be + * used in a generic way. + * + * 2000-11-13 Arjan van de Ven + * + * Stub definitions for prefetch operations. + */ +#ifndef _LINUX_PREFETCH_H +#define _LINUX_PREFETCH_H + +#define prefetch(x) do { } while (0) +#define prefetchw(x) do { } while (0) + +#endif /* _LINUX_PREFETCH_H */ diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h new file mode 100644 index 00000000000..04988ace843 --- /dev/null +++ b/include/linux/quotaops.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Definitions for diskquota-operations. When diskquota is configured these + * macros expand to the right source-code. + * + * Author: Marco van Wieringen + * + * Stub definitions for quota operations. + * U-Boot doesn't support disk quotas. + */ +#ifndef _LINUX_QUOTAOPS_H +#define _LINUX_QUOTAOPS_H + +struct inode; +struct dentry; +struct kqid; + +#define dquot_initialize(inode) 0 +#define dquot_drop(inode) do { } while (0) +#define dquot_alloc_inode(inode) 0 +#define dquot_free_inode(inode) do { } while (0) +#define dquot_transfer(inode, attr) 0 +#define dquot_claim_space_nodirty(inode, nr) 0 +#define dquot_reclaim_space_nodirty(inode, nr) do { } while (0) +#define dquot_disable(sb, type, flags) 0 +#define dquot_suspend(sb, type) 0 +#define dquot_resume(sb, type) 0 +#define dquot_file_open(inode, file) 0 + +#define sb_has_quota_usage_enabled(sb, type) 0 +#define sb_has_quota_limits_enabled(sb, type) 0 +#define sb_has_quota_suspended(sb, type) 0 +#define sb_has_quota_loaded(sb, type) 0 +#define sb_has_quota_active(sb, type) 0 +#define sb_any_quota_loaded(sb) 0 +#define sb_any_quota_active(sb) 0 + +#endif /* _LINUX_QUOTAOPS_H */ diff --git a/include/linux/random.h b/include/linux/random.h new file mode 100644 index 00000000000..cb09c6c6b05 --- /dev/null +++ b/include/linux/random.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Stub definitions for random number generation. + */ +#ifndef _LINUX_RANDOM_H +#define _LINUX_RANDOM_H + +#include + +#define get_random_bytes(buf, len) do { } while (0) +#define prandom_u32() 0 +#define get_random_u32() 0 +#define get_random_u64() 0ULL + +#endif /* _LINUX_RANDOM_H */ diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h new file mode 100644 index 00000000000..ea70829d135 --- /dev/null +++ b/include/linux/rwsem.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* rwsem.h: R/W semaphores, public interface + * + * Written by David Howells (dhowells@redhat.com). + * Derived from asm-i386/semaphore.h + * + * Stub definitions for Linux kernel read-write semaphores. + * U-Boot is single-threaded, no locking needed. + */ +#ifndef _LINUX_RWSEM_H +#define _LINUX_RWSEM_H + +struct rw_semaphore { + int count; +}; + +#define DECLARE_RWSEM(name) struct rw_semaphore name = { 0 } + +#define init_rwsem(sem) do { } while (0) +#define down_read(sem) do { } while (0) +#define down_read_trylock(sem) 1 +#define up_read(sem) do { } while (0) +#define down_write(sem) do { } while (0) +#define down_write_trylock(sem) 1 +#define up_write(sem) do { } while (0) +#define downgrade_write(sem) do { } while (0) + +#endif /* _LINUX_RWSEM_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h new file mode 100644 index 00000000000..e62a2a40c77 --- /dev/null +++ b/include/linux/sched.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Define 'struct task_struct' and provide the main scheduler + * APIs (schedule(), wakeup variants, etc.) + * + * Stub definitions for Linux kernel scheduler. + * U-Boot is single-threaded. + */ +#ifndef _LINUX_SCHED_H +#define _LINUX_SCHED_H + +#include + +struct task_struct { + int pid; + char comm[16]; +}; + +extern struct task_struct *current; + +#define TASK_RUNNING 0 +#define TASK_INTERRUPTIBLE 1 +#define TASK_UNINTERRUPTIBLE 2 + +#define cond_resched() do { } while (0) +#define yield() do { } while (0) +#define schedule() do { } while (0) + +#define in_interrupt() 0 +#define in_atomic() 0 +#define in_task() 1 + +#define signal_pending(task) 0 +#define fatal_signal_pending(task) 0 + +#endif /* _LINUX_SCHED_H */ diff --git a/include/linux/sort.h b/include/linux/sort.h new file mode 100644 index 00000000000..dc222d8dc89 --- /dev/null +++ b/include/linux/sort.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Sorting functions - use stdlib qsort. + */ +#ifndef _LINUX_SORT_H +#define _LINUX_SORT_H + +#include +#include + +typedef int (*cmp_func_t)(const void *, const void *); + +static inline void sort(void *base, size_t num, size_t size, + cmp_func_t cmp, void *swap) +{ + qsort(base, num, size, cmp); +} + +#endif /* _LINUX_SORT_H */ diff --git a/include/linux/swap.h b/include/linux/swap.h new file mode 100644 index 00000000000..1c714db6ae2 --- /dev/null +++ b/include/linux/swap.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Stub definitions for swap/memory management. + * U-Boot doesn't use swap. + */ +#ifndef _LINUX_SWAP_H +#define _LINUX_SWAP_H + +#define mark_page_accessed(page) do { } while (0) + +struct address_space; +struct folio; + +static inline void folio_mark_accessed(struct folio *folio) +{ +} + +#endif /* _LINUX_SWAP_H */ diff --git a/include/linux/wait.h b/include/linux/wait.h new file mode 100644 index 00000000000..1eb1263639e --- /dev/null +++ b/include/linux/wait.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Linux wait queue related types and methods + * + * Stub definitions for Linux kernel wait queues. + * U-Boot doesn't use wait queues. + */ +#ifndef _LINUX_WAIT_H +#define _LINUX_WAIT_H + +typedef int wait_queue_head_t; + +struct wait_queue_entry { + int dummy; +}; + +#define DECLARE_WAITQUEUE(name, task) struct wait_queue_entry name = { 0 } +#define DECLARE_WAIT_QUEUE_HEAD(name) wait_queue_head_t name = 0 + +#define init_waitqueue_head(wq) do { } while (0) +#define add_wait_queue(wq, entry) do { } while (0) +#define remove_wait_queue(wq, entry) do { } while (0) +#define wake_up(wq) do { } while (0) +#define wake_up_all(wq) do { } while (0) +#define wake_up_interruptible(wq) do { } while (0) +#define wake_up_interruptible_all(wq) do { } while (0) + +#define wait_event(wq, condition) do { } while (0) +#define wait_event_interruptible(wq, condition) 0 + +#endif /* _LINUX_WAIT_H */