From patchwork Thu Oct 10 19:39:40 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: 13830984 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 2DBF2D24442 for ; Thu, 10 Oct 2024 19:41:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A61F6B008A; Thu, 10 Oct 2024 15:41:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 657476B008C; Thu, 10 Oct 2024 15:41:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 520C36B0092; Thu, 10 Oct 2024 15:41:37 -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 316796B008A for ; Thu, 10 Oct 2024 15:41:37 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D87551C4C0A for ; Thu, 10 Oct 2024 19:41:32 +0000 (UTC) X-FDA: 82658712192.15.A80B7E3 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf25.hostedemail.com (Postfix) with ESMTP id 4729BA000F for ; Thu, 10 Oct 2024 19:41:34 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b="e/wI86TS"; dmarc=pass (policy=none) header.from=igalia.com; spf=pass (imf25.hostedemail.com: domain of andrealmeid@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=andrealmeid@igalia.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728589193; a=rsa-sha256; cv=none; b=rxqXXiSj0hP5V8kFsLdEGz94JiBlNuvVnheua3b1yRoba14r21PHyF3f9GuvO+2Eonj9fH eYf8kNHcLP3uqxoQJwgMfl9Yg0jqJw69/tPRCsVXIUx9qSFrGDszSuMxTA678qith5R9O9 Pg0ZMsYKPRzoBWKD5ExSbPO/vfOfkbc= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b="e/wI86TS"; dmarc=pass (policy=none) header.from=igalia.com; spf=pass (imf25.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=1728589193; 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=Yy1QkMBVz1rUhANkqZgd4aZpMCC+lFeHbVpyTkY8ZcE=; b=W3MjzcbY0aqxIm6Zpe/vLMcPeBAe2IFDqVjv4u4A18y5pjRaAMN1RhtU+NBUTJWH9vqreD ewB0UKsURdbpYpXkdUO8yJoNyV/fGIRF1JpKxOOA8MgPnmRQrqGdKxT7fZlLzxuNtiouGk fhnC36xcsM3R/iIWYY0I+aL5cJu9d+I= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: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=Yy1QkMBVz1rUhANkqZgd4aZpMCC+lFeHbVpyTkY8ZcE=; b=e/wI86TS/CqLCywlrfiwkp1WUs HM/n+0gxZKeHi6CUJE4brwibgsgjJv5gT74ZYWGrFkXmIbYetmTe+Pc4o0xdsLaAhndFe+gcNyVKK QiVos7aFwQEM+FSpqTj8Zw/DYljmlNx5FvTjoIHE2/I7FmHETd2nrohp+eDgPu3LlFycnJEd+xb9Y P8MLfHz15A6Enve05fWqu+ysOgEIA7H3fypmIMubJzoyA3rnyc6TVbrx/FT911lZmvvVViVyOW2cY y8+7EkHtdx05Gskguah8myRuScZEEYfuFa5XTIKIrBUZ+wzJvwHLIoV+SDzmC2ia5jTs5Brqcyot+ qlMLVCxw==; Received: from [187.57.199.212] (helo=[192.168.15.100]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1syz2G-007SHz-Nk; Thu, 10 Oct 2024 21:41:20 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= Date: Thu, 10 Oct 2024 16:39:40 -0300 Subject: [PATCH v6 05/10] libfs: Export generic_ci_ dentry functions MIME-Version: 1.0 Message-Id: <20241010-tonyk-tmpfs-v6-5-79f0ae02e4c8@igalia.com> References: <20241010-tonyk-tmpfs-v6-0-79f0ae02e4c8@igalia.com> In-Reply-To: <20241010-tonyk-tmpfs-v6-0-79f0ae02e4c8@igalia.com> To: Gabriel Krisman Bertazi , Alexander Viro , Christian Brauner , Jan Kara , Theodore Ts'o , Andreas Dilger , Hugh Dickins , Andrew Morton , Jonathan Corbet , smcv@collabora.com Cc: kernel-dev@igalia.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Almeid?= =?utf-8?q?a?= X-Mailer: b4 0.14.2 X-Rspamd-Queue-Id: 4729BA000F X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: r6wyqhisb78qqee18qs39rt4xy17roic X-HE-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SH3Qikdgf9hO57ngtj7vCaZC06Ge9jwbsfYrpRKirrXTYmhLlR2RL2AOsGvpfJfemCHz7nnGntX+0pYEepRIQRdxxqkuEgIk2hho6FB2QWteezVSXmZ6n0bHBVbBdlQGWQBvdYbWaGHc2rQrda7hE2ZwZn/QIdIL0TCvWMS5ZfbZOV8cM8B2daH+eajjmnMR1IDgb3WfTTkvJ/Pp3JWVSFDdXsKVDUDYK5VYkD1JxeSGlttkwbpBCpjZHLqsPGG4Mncqdhi3B9RkONI1fkGZxKK8VurfCwzKBmAdg2YW95ODd7Hr/tp0cbUQRQLoP5anM2WlZThwE06sCp 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 v4: - Guard func signatures inside IS_ENABLED(CONFIG_UNICODE) Changes from v3: - New patch --- fs/libfs.c | 8 +++++--- include/linux/fs.h | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index 46966fd8bcf9f042e85d0b66134e59fbef83abfd..7b290404c5f9901010ada2f921a214dbc94eb5fa 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -1791,8 +1791,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; @@ -1835,6 +1835,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 @@ -1843,7 +1844,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; @@ -1858,6 +1859,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 9b232aee4cd6ad8dce64370db0111bd25d3fedfa..21e183e5041ed029bf47fda018f44b20bcdd4389 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3458,6 +3458,10 @@ extern int generic_ci_match(const struct inode *parent, const u8 *de_name, u32 de_name_len); #if IS_ENABLED(CONFIG_UNICODE) +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); + /** * generic_ci_validate_strict_name - Check if a given name is suitable * for a directory