From patchwork Wed Sep 11 14:44:58 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: 13800722 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 D112DEE49BE for ; Wed, 11 Sep 2024 14:45:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7DBE1940056; Wed, 11 Sep 2024 10:45:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78AE2940053; Wed, 11 Sep 2024 10:45:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 604D3940056; Wed, 11 Sep 2024 10:45:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 38D09940053 for ; Wed, 11 Sep 2024 10:45:46 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E156DC1393 for ; Wed, 11 Sep 2024 14:45:45 +0000 (UTC) X-FDA: 82552731450.20.481E4A9 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf12.hostedemail.com (Postfix) with ESMTP id 418B94000C for ; Wed, 11 Sep 2024 14:45:44 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=hxJKefRG; spf=pass (imf12.hostedemail.com: domain of andrealmeid@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=andrealmeid@igalia.com; dmarc=pass (policy=none) header.from=igalia.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726065839; 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=B86Pw1ckCkywr9gzf5gk+joWfc2NDawEVXulB0pNBG0=; b=1WvTESpaw9P/jBoDn+gfIfWi/kHFQlR37rtX6kwrKupYZUpHz+VbttZHd38CE89Dh0Zhqe 4YVB7xRbcEXW86nEi7NFDgOZLjD94evT5oXoMcq2+8SphKrcBQIIWSd3dPWIkXNitwf/fU M7ENRRlViHz0Bh6aJXappPd97nUa8DI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726065839; a=rsa-sha256; cv=none; b=yY03NFTQro/Y1DYwimNDx85n79N6DnjZKSHWzQCZWu7II1fOXIEia4L1UemeyUC9fXd1cL VXdjUVCh4xLujxoFYwcdckcW2ZemInL5r+2uWl3kSH5Bcs22xnIKLJFsQtfu+P4AiM7X4B WZK7zu3GtZQkNq7eaQZl25YnAYvMvAk= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=hxJKefRG; spf=pass (imf12.hostedemail.com: domain of andrealmeid@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=andrealmeid@igalia.com; dmarc=pass (policy=none) header.from=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=B86Pw1ckCkywr9gzf5gk+joWfc2NDawEVXulB0pNBG0=; b=hxJKefRG1tjyLL745br9iC9O4A jcfqv+LNEBW2FgL9bLdQh841tBi7M1XJNljoL/h+w6JBZ4Qt7AHX2JQ3fILqb1kKkXydBhzZ0f/Zf 5lQTd/bh6iYANTNNqdkhLdBaM1zx9cBpMHpmQyGAudyPYwWKf8+nLNLqCBhQrnDelY7LcUOoRIzx6 3CVm4GH7tvWsHOn94OzODUu0C3KhOEYk153KyDh4Nh/wRDk6L28h0fmMeYJaL4Fbpp3iM0xX4PfBy gNWVKo1x38q654U/6UwewxkbF/8tDNc93lckRXHV2U0om76pxlBisCcYgv+MdbVwlRUe67gK3SZVA HSnuoh7Q==; 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 1soObA-00CTwi-UH; Wed, 11 Sep 2024 16:45:37 +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 v4 06/10] libfs: Export generic_ci_ dentry functions Date: Wed, 11 Sep 2024 11:44:58 -0300 Message-ID: <20240911144502.115260-7-andrealmeid@igalia.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240911144502.115260-1-andrealmeid@igalia.com> References: <20240911144502.115260-1-andrealmeid@igalia.com> MIME-Version: 1.0 X-Stat-Signature: kafjbeznj69jwdi1kjb1er9t47syeh88 X-Rspamd-Queue-Id: 418B94000C X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1726065944-133884 X-HE-Meta: U2FsdGVkX1/XiSRufMwic4hh7aaTwjTIpsbZbpwDA0t/3crg1fukSLkes262JUwSsv95NctPUVL3UMgaxEI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Rb8Krms2sNiyP2hKz+b2bMZmSA2M35NVQ4qdW9GdWBK82UunDu4vggwDao85JBt0aohDPN8oWQOgIHeCz5ObZLZ0KOzAtvK062+qji+XQIQlQlsIfyZTwW99ZallRICgb4y9ZrujI7oBroDP4wqGaynDlf5NB4zI6iYg/wwgEVB6NGKJR119zoSqleE= 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 generic_ci_ dentry functions so they can be used by case-insensitive filesystems that need something more custom than the default one set by `struct generic_ci_dentry_ops`. Signed-off-by: André Almeida --- Changes from v3: - New patch --- fs/libfs.c | 8 +++++--- include/linux/fs.h | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index 838524314b1b..c09254ecdcdd 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -1783,8 +1783,8 @@ bool is_empty_dir_inode(struct inode *inode) * * Return: 0 if names match, 1 if mismatch, or -ERRNO */ -static int generic_ci_d_compare(const struct dentry *dentry, unsigned int len, - const char *str, const struct qstr *name) +int generic_ci_d_compare(const struct dentry *dentry, unsigned int len, + const char *str, const struct qstr *name) { const struct dentry *parent; const struct inode *dir; @@ -1827,6 +1827,7 @@ static int generic_ci_d_compare(const struct dentry *dentry, unsigned int len, return utf8_strncasecmp(dentry->d_sb->s_encoding, name, &qstr); } +EXPORT_SYMBOL(generic_ci_d_compare); /** * generic_ci_d_hash - generic d_hash implementation for casefolding filesystems @@ -1835,7 +1836,7 @@ static int generic_ci_d_compare(const struct dentry *dentry, unsigned int len, * * Return: 0 if hash was successful or unchanged, and -EINVAL on error */ -static int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str) +int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str) { const struct inode *dir = READ_ONCE(dentry->d_inode); struct super_block *sb = dentry->d_sb; @@ -1850,6 +1851,7 @@ static int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str) return -EINVAL; return 0; } +EXPORT_SYMBOL(generic_ci_d_hash); static const struct dentry_operations generic_ci_dentry_ops = { .d_hash = generic_ci_d_hash, diff --git a/include/linux/fs.h b/include/linux/fs.h index 937142950dfe..4cd86d36c03d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3386,6 +3386,9 @@ extern int generic_ci_match(const struct inode *parent, const struct qstr *folded_name, const u8 *de_name, u32 de_name_len); bool generic_ci_validate_strict_name(struct inode *dir, struct qstr *name); +int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str); +int generic_ci_d_compare(const struct dentry *dentry, unsigned int len, + const char *str, const struct qstr *name); static inline bool sb_has_encoding(const struct super_block *sb) {