From patchwork Sun Jan 18 20:37:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1587 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=1768768760; bh=dhC/aMVXeANPe2X7yFGoAyj7e0KTMOwl6fmc69DcCzs=; 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=h8gQD8XbNf62r62ZYi2LC557QJYpPxtPWtNdg5NfittBWEi99LS1T/o0e9SicjDu5 kxR1EipXDac14dzl0HI2xp640apI48mBGm1lRvK0lezAn/q5BydQYjUc6U7e1t5bO8 uq/YnVbTZ49it134DIeF77pdd7rUqRIeEhzmStSbMd/w7Y3GgBDJqRXj7DaRihGGN1 a26g3CSn8yGmXKPd8Ibh4Qdq4syNdfFb6NVc83AvTwildwyZ6A+/mJzOrmEpZrxnJy CJ7s+zTLonaXFb+tLwk1LK9LHNDkzxBATTL91hy+zL9Zx9G9EUvVNygx4XgF2p/pVm hwbQrySoR7Zog== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4268D69494 for ; Sun, 18 Jan 2026 13:39:20 -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 EzN-hX7-Puhz for ; Sun, 18 Jan 2026 13:39:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768760; bh=dhC/aMVXeANPe2X7yFGoAyj7e0KTMOwl6fmc69DcCzs=; 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=h8gQD8XbNf62r62ZYi2LC557QJYpPxtPWtNdg5NfittBWEi99LS1T/o0e9SicjDu5 kxR1EipXDac14dzl0HI2xp640apI48mBGm1lRvK0lezAn/q5BydQYjUc6U7e1t5bO8 uq/YnVbTZ49it134DIeF77pdd7rUqRIeEhzmStSbMd/w7Y3GgBDJqRXj7DaRihGGN1 a26g3CSn8yGmXKPd8Ibh4Qdq4syNdfFb6NVc83AvTwildwyZ6A+/mJzOrmEpZrxnJy CJ7s+zTLonaXFb+tLwk1LK9LHNDkzxBATTL91hy+zL9Zx9G9EUvVNygx4XgF2p/pVm hwbQrySoR7Zog== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2E7BE693A2 for ; Sun, 18 Jan 2026 13:39:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768757; bh=YFnGfKuFtTWCn4jeW/kcb80Uw4oMg4C8uLqouzCP+mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fi01HWndb/hA1CHdfB/jmU73FNq+peXLqGpIIvAkjdoNnXKsVpegbcMiYerLIv2zf bUVQrFx4+yYlQ4nxrDl8FQqjrVnEPU47eAJ/ZUAiUnSuCQ6S9A9XSLqi9EnBrOqD4o nvHXHFWkw9YPLAGUOfKgLl5ecYuQpEx5XpSoCsYedzFbEhFT5QVgCzetiy7p7zNUrw Zy/xVKwZf4yDbQVpc8f7E2f3LVon+wgo5HZ3DDjbX956pqUK3POrWcvPhjrAJs1Djz jKSSYnTemPPkMw1bJ/jEbt/nNs1g8AH2jWIELNMMs/wQc1CQaWUYj7hYcWwUfs8opW eSpXH5pmpKE7w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F1A8A69496; Sun, 18 Jan 2026 13:39:17 -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 s-s6I54o2Zmn; Sun, 18 Jan 2026 13:39:17 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768751; bh=7E7gaZEAB7otNYf0KWf2QCStMBo0xNqyTyJS5Nu/1/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ACoBJOOaOXgTMuxI/Cy1eJX0e0vloNU/QZaf557cLYs3PU8gKmLpLktfF4mq1UwUh BSqiu4iNxulfWCYkiZBb/ErJ6EzHnutzeCKKx9EeftIVUK1vXgvfzHq5M0SyBDVkZ9 ahLm1ynKmMNEic0yaMEFzkd7ipmVSL9udZHoaVB2q3ccnqYNI4P0EVomt3PGp0U0ih 6usXkii1xfhFAi2XdBkZvNQjPRoSC+6lrcQEUHASaLd1YG6Dg6xMeiELOHQmodutjJ GEn07USH/hlEl4yq4CAWrwl/l19zsnm2L31kPX1Xx614iDuL1nqzbpm3k0YwMTmry4 xN4eq8TUm8sBg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A88BD69491; Sun, 18 Jan 2026 13:39:11 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:30 -0700 Message-ID: <20260118133734.8.44e6459f58d96077c114c70af004835ed34c6be8@changeid> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260118203739.1974323-1-sjg@u-boot.org> References: <20260118203739.1974323-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QMK253W6KAMHYD6YA2DQVS3TBKHVAYVR X-Message-ID-Hash: QMK253W6KAMHYD6YA2DQVS3TBKHVAYVR 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/12] linux: Add ratelimit.h header with rate limiting stubs 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 linux/ratelimit.h with ratelimit_state structure and rate limiting operation stubs. Rate limiting is not needed in U-Boot. Update ext4_uboot.h to use the new header instead of duplicating these definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 19 +++++-------------- include/linux/ratelimit.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 include/linux/ratelimit.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 102f03fe002..f6883d888f4 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -384,10 +384,8 @@ typedef int (get_block_t)(struct inode *inode, sector_t iblock, /* crc32c - from linux/crc32c.h */ #include -/* ratelimit_state - stub */ -struct ratelimit_state { - int dummy; -}; +/* ratelimit_state - use linux/ratelimit.h */ +#include /* fscrypt_dummy_policy and qstr are now in ext4_fscrypt.h */ @@ -869,12 +867,7 @@ static inline int in_range(unsigned long val, unsigned long start, /* percpu_counter_init/destroy are in linux/percpu_counter.h */ -/* ratelimit macros */ -#define DEFAULT_RATELIMIT_INTERVAL (5 * 1000) -#define DEFAULT_RATELIMIT_BURST 10 -#define DEFINE_RATELIMIT_STATE(name, interval, burst) \ - int name __attribute__((unused)) = 0 -#define __ratelimit(state) ({ (void)(state); 1; }) +/* ratelimit macros are now in linux/ratelimit.h */ /* SEQ_START_TOKEN is in linux/seq_file.h */ @@ -1364,8 +1357,7 @@ int trylock_buffer(struct buffer_head *bh); /* Trace stubs for super.c - declaration for stub.c implementation */ void trace_ext4_error(struct super_block *sb, const char *func, unsigned int line); -/* Ratelimiting - declaration for stub.c */ -int ___ratelimit(struct ratelimit_state *rs, const char *func); +/* ___ratelimit is now in linux/ratelimit.h */ /* Filesystem notification - declaration for stub.c */ void fsnotify_sb_error(struct super_block *sb, struct inode *inode, int error); @@ -1502,8 +1494,7 @@ static inline void super_set_uuid(struct super_block *sb, const u8 *uuid, /* strreplace is in linux/string.h */ -/* Ratelimit - declaration for stub.c */ -void ratelimit_state_init(void *rs, int interval, int burst); +/* ratelimit_state_init is now in linux/ratelimit.h */ /* Block device operations - declarations for stub.c */ void bdev_fput(void *file); diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h new file mode 100644 index 00000000000..319f794f059 --- /dev/null +++ b/include/linux/ratelimit.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Rate limit definitions for U-Boot + * + * Based on Linux ratelimit.h - rate limiting for messages. + * U-Boot stubs - rate limiting not needed. + */ +#ifndef _LINUX_RATELIMIT_H +#define _LINUX_RATELIMIT_H + +/** + * struct ratelimit_state - rate limiter state + * + * U-Boot stub - rate limiting not supported. + */ +struct ratelimit_state { + int dummy; +}; + +/* Default rate limit parameters */ +#define DEFAULT_RATELIMIT_INTERVAL (5 * 1000) +#define DEFAULT_RATELIMIT_BURST 10 + +/* Define a rate limit state variable */ +#define DEFINE_RATELIMIT_STATE(name, interval, burst) \ + int name __attribute__((unused)) = 0 + +/* Rate limiting operations - all return true (allow) */ +#define __ratelimit(state) ({ (void)(state); 1; }) + +/* Rate limit functions - implemented in stub.c */ +int ___ratelimit(struct ratelimit_state *rs, const char *func); +void ratelimit_state_init(void *rs, int interval, int burst); + +#endif /* _LINUX_RATELIMIT_H */