From patchwork Fri Sep 5 13: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: 233 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=1757078312; bh=6hqH55/5YGDgpkbUAtY458gpOG4Vwj2TeoVmOkFMROM=; 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=AZarFp9MwjjBPIfXM1yypX5TjUqf0BJzKcwIt06ddo05VlNHZJwKxsPVfrhJ2Va7G aPm5k/L1h0AWaXgTKQEewOx7gmpk76UhH9zbTyF07HHpMj/xNYhW6V3CsVLryQWvB1 +S9gGLZbIhSk8trWohlDGYZqUmO1iBzHiQjMQkB4NpGKiIIk7XLNG8ZQ4cVrIYNogI tnslxkp6IsRc89zlPHNkxCgBmJ4YueGJSfrG+lCYsTtfZUTUt3k0lcqUm2ljBycRnh 18s8MmEPRMghHWkkUtk6d80cEZmaXdUdYpQOrGIMtakP+TqdEUkZWbmY5X1REfrFkd 5YfriPCU1p8ng== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7BA246799B for ; Fri, 5 Sep 2025 07:18:32 -0600 (MDT) 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 U5H4XT_FbeBy for ; Fri, 5 Sep 2025 07:18:32 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757078311; bh=6hqH55/5YGDgpkbUAtY458gpOG4Vwj2TeoVmOkFMROM=; 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=VSUdRp6zOF5o8x22b3n0G8QlUs2RGjLvw1h2rWs/i/N4vuwY1NF8uw8bdde0MazVb K25B7jW+dg/U/z5CGp9gmyX2drMFfmi2kg7vVSMF3hwyft5QCvLkGzrNPke7Sv3xbS CX73E/PvatQR47mfz3R/bW77hGkYK4SB+ZD1U6ybvQ4TFWIYtyceNgg0KL+bQcqh/p x1zVlJ6eWikI7qpl8EdO72x0up0rswYeDbT1siUGd6eDg98ee+EIu0nrI9XeUyDYAE iRb2N5i/YmIqUmZQ40AnNVhxjvixbf2KAsygze/76DIUzSnMKSqCIU40w6zqPVb0iI /IBKk0ijd+Kww== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 299226799F for ; Fri, 5 Sep 2025 07:18:31 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757078310; bh=u9cM4A6odEO1xmuHN4BGDqZLE/ZNtRU4URg0eMJRjbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PJBqOlRayLSQbza5W37uY5KiwuMWCU6I8PpAvFVXMOpM0fxnSXXSOxzgdQKSqH7NF BgErNPSUmKwvF1uCYlc80lm3imvy3952jTsCYsHZyTFxB0U8eHXoU9OLHqHXfMC6y7 4M8PcKMMWjm4r5pT0alNJ5dItNF0BhyENBYvIwPycZiOyVvvpk50klSFBOncZf2DCg V/L0hdShFkx/w4qGn1JyXmrwpZNJkyxmCLOzHdrII9c+YxZ6/JMC5sH9hW1VwvAbgm J+Os9JiaphGsfdpRSY9Lj1uhDJpRIwmuCpZajQDMJ+ZsAz5ZOZ7IVVWh5BoYlhGZBa lIH1LWh8aAwkQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 063CD5FE1B; Fri, 5 Sep 2025 07:18:30 -0600 (MDT) 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 RKLC1syAOnGt; Fri, 5 Sep 2025 07:18:29 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757078309; bh=nDNhmXyuanMLWCkiceelnJC2E8hwMJszn4UIYGUJS9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ShHKVWYXMEfZBql4F7EAyJYvS+w9O+VUmoJgZSZgAjl4ZOfYD5Wvx6k8XJyR5C09+ xqoX47npkrrHSjB9HQ7psspgKvspCPRRFM7RCdKkmLFDIbC9RHfKFhEhIlbGCC4rlJ X+a0WRUkTAUdNYAiFuPOCasWYBU3IdqeAWwRSMXes6E3vrPp2CYkAiq4srH1uBbvYt k3IuuVLssyhv+9sCPsT10jlEPRxWu48IyZYKSMm0exWzOLsDUZSHZwfQyzXgtZYq24 Kvbi3jTmUNVM+kSoOFgacMlOuuBZ7Kocd0TkGWU3avLIbSsA7P2mHGSSuIsxba4VFv ekwQH7fXXyFLw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1BE8A678AA; Fri, 5 Sep 2025 07:18:29 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 5 Sep 2025 07:18:08 -0600 Message-ID: <20250905131816.3344908-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250905131816.3344908-1-sjg@u-boot.org> References: <20250905131816.3344908-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: D5SICQAGFGVR4A3GK35R5GZZR27ZVAV5 X-Message-ID-Hash: D5SICQAGFGVR4A3GK35R5GZZR27ZVAV5 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: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 1/5] api: Rename legacy API files and examples 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 The API is not very useful these days, since it doesn't support driver model. It is laborious to add new functions to the API as there are so many needed. A better approach would be to create a library containing all of U-Boot, then have the API be generated by a script containing a list of functions, perhaps with wildcards. Then a stub could be created, with a list of entry points, which links with and calls through into the library. In preparation for heading in this direction, rename some of the existing files and directories: - examples/api -> examples/legacy_api - include/api*.h -> include/legacy_api*.h - API_BUILD to LEGACY_API_BUILD Co-developed-by: Claude Signed-off-by: Simon Glass --- api/api.c | 2 +- api/api_display.c | 2 +- api/api_net.c | 2 +- api/api_platform-arm.c | 2 +- api/api_platform-mips.c | 2 +- api/api_platform-powerpc.c | 2 +- api/api_storage.c | 2 +- common/board_r.c | 2 +- examples/{api => legacy_api}/.gitignore | 0 examples/{api => legacy_api}/Makefile | 8 ++++---- examples/{api => legacy_api}/crt0.S | 0 examples/{api => legacy_api}/demo.c | 2 +- examples/{api => legacy_api}/glue.c | 2 +- examples/{api => legacy_api}/glue.h | 0 examples/{api => legacy_api}/libgenwrap.c | 2 +- include/{api.h => legacy_api.h} | 4 ++-- include/{api_public.h => legacy_api_public.h} | 6 +++--- lib/Makefile | 2 +- lib/vsprintf.c | 6 +++--- test/common/print.c | 2 +- test/lib/unicode.c | 2 +- 21 files changed, 26 insertions(+), 26 deletions(-) rename examples/{api => legacy_api}/.gitignore (100%) rename examples/{api => legacy_api}/Makefile (87%) rename examples/{api => legacy_api}/crt0.S (100%) rename examples/{api => legacy_api}/demo.c (99%) rename examples/{api => legacy_api}/glue.c (99%) rename examples/{api => legacy_api}/glue.h (100%) rename examples/{api => legacy_api}/libgenwrap.c (96%) rename include/{api.h => legacy_api.h} (89%) rename include/{api_public.h => legacy_api_public.h} (96%) diff --git a/api/api.c b/api/api.c index b892c5c278a..458eaf0c5a4 100644 --- a/api/api.c +++ b/api/api.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include "api_private.h" diff --git a/api/api_display.c b/api/api_display.c index 8fd078c8c4a..83ff89d3680 100644 --- a/api/api_display.c +++ b/api/api_display.c @@ -3,7 +3,7 @@ * Copyright (c) 2011 The Chromium OS Authors. */ -#include +#include #include #include diff --git a/api/api_net.c b/api/api_net.c index 264ff530563..0bedcce4df5 100644 --- a/api/api_net.c +++ b/api/api_net.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #define DEBUG #undef DEBUG diff --git a/api/api_platform-arm.c b/api/api_platform-arm.c index 9afba66c244..3d2a3e0bd45 100644 --- a/api/api_platform-arm.c +++ b/api/api_platform-arm.c @@ -10,7 +10,7 @@ #include #include -#include +#include #include diff --git a/api/api_platform-mips.c b/api/api_platform-mips.c index 262b35a2777..b5632320290 100644 --- a/api/api_platform-mips.c +++ b/api/api_platform-mips.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include diff --git a/api/api_platform-powerpc.c b/api/api_platform-powerpc.c index 2c1ab043af6..6b76afd955f 100644 --- a/api/api_platform-powerpc.c +++ b/api/api_platform-powerpc.c @@ -10,7 +10,7 @@ #include #include -#include +#include #include diff --git a/api/api_storage.c b/api/api_storage.c index c663e7df942..23f043fbb5d 100644 --- a/api/api_storage.c +++ b/api/api_storage.c @@ -6,7 +6,7 @@ */ #include -#include +#include #include #include #include diff --git a/common/board_r.c b/common/board_r.c index ca1498de11e..a141312f918 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -10,7 +10,7 @@ */ #include -#include +#include #include #include #include diff --git a/examples/api/.gitignore b/examples/legacy_api/.gitignore similarity index 100% rename from examples/api/.gitignore rename to examples/legacy_api/.gitignore diff --git a/examples/api/Makefile b/examples/legacy_api/Makefile similarity index 87% rename from examples/api/Makefile rename to examples/legacy_api/Makefile index ec1643e4875..07a31e219b6 100644 --- a/examples/api/Makefile +++ b/examples/legacy_api/Makefile @@ -2,8 +2,8 @@ # # (C) Copyright 2007 Semihalf -# Provide symbol API_BUILD to signal that the API example is being built. -KBUILD_CPPFLAGS += -DAPI_BUILD +# Provide symbol LEGACY_API_BUILD to signal that the legacy API example is being built. +KBUILD_CPPFLAGS += -DLEGACY_API_BUILD ifeq ($(ARCH),powerpc) LOAD_ADDR = 0x40000 @@ -26,13 +26,13 @@ endif # Resulting ELF and binary exectuables will be named demo and demo.bin extra-y = demo -# Source files located in the examples/api directory +# Source files located in the examples/legacy_api directory OBJ-y += crt0.o OBJ-y += demo.o OBJ-y += glue.o OBJ-y += libgenwrap.o -# Source files which exist outside the examples/api directory +# Source files which exist outside the examples/legacy_api directory EXT_COBJ-y += lib/crc32.o EXT_COBJ-y += lib/ctype.o EXT_COBJ-y += lib/div64.o diff --git a/examples/api/crt0.S b/examples/legacy_api/crt0.S similarity index 100% rename from examples/api/crt0.S rename to examples/legacy_api/crt0.S diff --git a/examples/api/demo.c b/examples/legacy_api/demo.c similarity index 99% rename from examples/api/demo.c rename to examples/legacy_api/demo.c index 9a55f76c504..ea1a8746812 100644 --- a/examples/api/demo.c +++ b/examples/legacy_api/demo.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include "glue.h" diff --git a/examples/api/glue.c b/examples/legacy_api/glue.c similarity index 99% rename from examples/api/glue.c rename to examples/legacy_api/glue.c index 478f7b6cfb4..4f7012ea730 100644 --- a/examples/api/glue.c +++ b/examples/legacy_api/glue.c @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include "glue.h" diff --git a/examples/api/glue.h b/examples/legacy_api/glue.h similarity index 100% rename from examples/api/glue.h rename to examples/legacy_api/glue.h diff --git a/examples/api/libgenwrap.c b/examples/legacy_api/libgenwrap.c similarity index 96% rename from examples/api/libgenwrap.c rename to examples/legacy_api/libgenwrap.c index bfd88e100d6..9ada33fb15b 100644 --- a/examples/api/libgenwrap.c +++ b/examples/legacy_api/libgenwrap.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include "glue.h" diff --git a/include/api.h b/include/legacy_api.h similarity index 89% rename from include/api.h rename to include/legacy_api.h index 83412a7c87f..85bd80b2e33 100644 --- a/include/api.h +++ b/include/legacy_api.h @@ -4,8 +4,8 @@ * Written by Simon Glass */ -#ifndef __API_H -#define __API_H +#ifndef __LEGACY_API_H +#define __LEGACY_API_H /** * api_init() - Initialize API for external applications diff --git a/include/api_public.h b/include/legacy_api_public.h similarity index 96% rename from include/api_public.h rename to include/legacy_api_public.h index e89572c00a4..d8bb5807460 100644 --- a/include/api_public.h +++ b/include/legacy_api_public.h @@ -5,8 +5,8 @@ * Written by: Rafal Jaworowski */ -#ifndef _API_PUBLIC_H_ -#define _API_PUBLIC_H_ +#ifndef _LEGACY_API_PUBLIC_H_ +#define _LEGACY_API_PUBLIC_H_ #include @@ -139,4 +139,4 @@ struct display_info { int screen_cols; }; -#endif /* _API_PUBLIC_H_ */ +#endif /* _LEGACY_API_PUBLIC_H_ */ diff --git a/lib/Makefile b/lib/Makefile index af191913873..1db1e3c9000 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -23,7 +23,7 @@ obj-$(CONFIG_AES) += aes.o obj-$(CONFIG_AES) += aes/ obj-$(CONFIG_$(PHASE_)BINMAN_FDT) += binman.o -ifndef API_BUILD +ifndef LEGACY_API_BUILD ifneq ($(CONFIG_CHARSET),) obj-y += charset.o endif diff --git a/lib/vsprintf.c b/lib/vsprintf.c index c7340a047b2..c072b44140b 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -308,7 +308,7 @@ static __maybe_unused char *string16(char *buf, char *end, u16 *s, return buf; } -#if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT) && !defined(API_BUILD) +#if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT) && !defined(LEGACY_API_BUILD) static char *device_path_string(char *buf, char *end, void *dp, int field_width, int precision, int flags) { @@ -469,7 +469,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, switch (*fmt) { /* Device paths only exist in the EFI context. */ -#if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT) && !defined(API_BUILD) +#if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT) && !defined(LEGACY_API_BUILD) case 'D': return device_path_string(buf, end, ptr, field_width, precision, flags); @@ -630,7 +630,7 @@ repeat: case 's': /* U-Boot uses UTF-16 strings in the EFI context only. */ #if (CONFIG_IS_ENABLED(EFI_LOADER) || IS_ENABLED(CONFIG_EFI_APP)) && \ - !defined(API_BUILD) + !defined(LEGACY_API_BUILD) if (qualifier == 'l') { str = string16(str, end, va_arg(args, u16 *), field_width, precision, flags); diff --git a/test/common/print.c b/test/common/print.c index c48efc2783f..3fe24dc3e9d 100644 --- a/test/common/print.c +++ b/test/common/print.c @@ -59,7 +59,7 @@ static int print_guid(struct unit_test_state *uts) COMMON_TEST(print_guid, 0); #endif -#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD) +#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(LEGACY_API_BUILD) /* Test efi_loader specific printing */ static int print_efi_ut(struct unit_test_state *uts) { diff --git a/test/lib/unicode.c b/test/lib/unicode.c index 673470c8d2c..5bd3629b153 100644 --- a/test/lib/unicode.c +++ b/test/lib/unicode.c @@ -100,7 +100,7 @@ static int unicode_test_u16_strcpy(struct unit_test_state *uts) LIB_TEST(unicode_test_u16_strcpy, 0); /* U-Boot uses UTF-16 strings in the EFI context only. */ -#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD) +#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(LEGACY_API_BUILD) static int unicode_test_string16(struct unit_test_state *uts) { char buf[20];