From patchwork Thu Sep 5 19:02:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 13792876 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A5EDCE7A81 for ; Thu, 5 Sep 2024 19:03:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 25DF16B008C; Thu, 5 Sep 2024 15:03:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 170926B0092; Thu, 5 Sep 2024 15:03:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDC1B6B0093; Thu, 5 Sep 2024 15:03:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CAC256B008C for ; Thu, 5 Sep 2024 15:03:35 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 88898160947 for ; Thu, 5 Sep 2024 19:03:35 +0000 (UTC) X-FDA: 82531608390.06.FAC5DC7 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf22.hostedemail.com (Postfix) with ESMTP id B1EC2C0012 for ; Thu, 5 Sep 2024 19:03:33 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=hbeKl1QT; dmarc=pass (policy=none) header.from=igalia.com; spf=pass (imf22.hostedemail.com: domain of andrealmeid@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=andrealmeid@igalia.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725562905; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7BUAvvMuRU2tfo2IDkqAEnh0rC165iKKlWi/Zf6qiA4=; b=cNUnVotUEpJyxbaOOg9deDo77KnNouKAQZmHBfRXNPjOUc0WIvP7j6f3vhgTYWpUT1FFWm IDzzu5lh6KPFvq50QamJNVP+6q2Wn6HQxIWpuKOWrUv0Nk1LDgAHsusR4wGqvksPX6U+Ku 8wkL4Lm9haU2xGJc6gNCAGjDGAbNwLA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725562905; a=rsa-sha256; cv=none; b=C7SoIIohxtjTosELwglth3KoaWXrjFWh55HYuMRB6SPZja73JJv0tYu/xK16NYO56KYkK6 r0Ao9TRvGVIleQrmj3KUwfI6nKzTNsI7tFOksHCMKA6axgvAt7kwV2Qv2YiWN44/ryhnMY 0EQPKJxBzUUdkHZ/J7EhMJOpK+nqdUg= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=hbeKl1QT; dmarc=pass (policy=none) header.from=igalia.com; spf=pass (imf22.hostedemail.com: domain of andrealmeid@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=andrealmeid@igalia.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7BUAvvMuRU2tfo2IDkqAEnh0rC165iKKlWi/Zf6qiA4=; b=hbeKl1QTRIQB74KvSycQ2F2ZFI 6EfPYPIhY/kDzNhC98wdLPBaxCUHGO7YQWeSRu206BRnRY4OziReMSFa9WRpaSTikBw7d2jXLjfwr nTprejKDeitM+tSIEZhx2fICW04IwmW+fU43Zj738ANKXAnWQOgAZGu/wevvHpNtkqgvIVwpWgBLZ ZdqWoBif0OlbIyaMHRLkuCGA/93cKu/Is6K/FZyIKHbUW5sbcDVaAzQttKFFePbOWeMf/SGsQubuk g3gaYQ56XbCJ6j0nXmDVsOxjwOAJDtg+1amttVaH0F5VvFc65s2ObC6W5W2m8zfdlLd7ncHFNieAE HSjJ+DLQ==; Received: from [177.172.122.98] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1smHlN-00A6Ho-RC; Thu, 05 Sep 2024 21:03:25 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: Hugh Dickins , Andrew Morton , Alexander Viro , Christian Brauner , Jan Kara , krisman@kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, kernel-dev@igalia.com, Daniel Rosenberg , smcv@collabora.com, Christoph Hellwig , Theodore Ts'o , =?utf-8?q?An?= =?utf-8?q?dr=C3=A9_Almeida?= Subject: [PATCH v3 4/9] unicode: Export latest available UTF-8 version number Date: Thu, 5 Sep 2024 16:02:47 -0300 Message-ID: <20240905190252.461639-5-andrealmeid@igalia.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240905190252.461639-1-andrealmeid@igalia.com> References: <20240905190252.461639-1-andrealmeid@igalia.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: B1EC2C0012 X-Stat-Signature: girnxfg5ypgsq7opw5bm9wts7hf4uxfc X-Rspam-User: X-HE-Tag: 1725563013-770208 X-HE-Meta: U2FsdGVkX191a/cd6oExfkIlQW28EgHmgjOOb9H/fve4S99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TooUNtOzhldwy/WtNmDWAUelAI1iKqEXTbFiF1pwblknsH8ysYdR+hGlVAcHxZsiDfsSK5YE8txXHN2MicEIr8mcfl0dxsuoEZbDWwgp6tIuQ7WBdRxNWLk+5M56l7afdrHVATpACjcD9rjfQ2qz37od/Jn3kcCjJ9npdH6qAsw4luzf6da5CsYJCBCwGQXbA/A= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Export latest available UTF-8 version number so filesystems can easily load the newest one. Signed-off-by: André Almeida Acked-by: Gabriel Krisman Bertazi --- If this is the accepted way of doing that, I will also add something to checkpatch to warn that modifications at fs/unicode/utf8data.c likely need to change this define. Other ways to implement this: 1) Having a new arg for utf8_load() struct unicode_map *utf8_load(unsigned int version, bool latest) { um->tables = symbol_request(utf8_data_table); if (latest) { int i = um->tables->utf8agetab_size - 1; version = um->tables->utf8agetab[i] } } 2) Expose utf8agetab[] Having utf8agetab[] at include/linux/unicode.h will make easier to programmatically find out the latest version without the need to do a symbol_request/symbol_put of the whole utf8 table. --- fs/unicode/utf8-selftest.c | 3 --- include/linux/unicode.h | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/unicode/utf8-selftest.c b/fs/unicode/utf8-selftest.c index 600e15efe9ed..5ddaf27b21a6 100644 --- a/fs/unicode/utf8-selftest.c +++ b/fs/unicode/utf8-selftest.c @@ -17,9 +17,6 @@ static unsigned int failed_tests; static unsigned int total_tests; -/* Tests will be based on this version. */ -#define UTF8_LATEST UNICODE_AGE(12, 1, 0) - #define _test(cond, func, line, fmt, ...) do { \ total_tests++; \ if (!cond) { \ diff --git a/include/linux/unicode.h b/include/linux/unicode.h index f73a78655588..db043ea914fd 100644 --- a/include/linux/unicode.h +++ b/include/linux/unicode.h @@ -16,6 +16,8 @@ struct utf8data_table; ((unsigned int)(MIN) << UNICODE_MIN_SHIFT) | \ ((unsigned int)(REV))) +#define UTF8_LATEST UNICODE_AGE(12, 1, 0) + static inline u8 unicode_major(unsigned int age) { return (age >> UNICODE_MAJ_SHIFT) & 0xff;