From patchwork Thu Oct 17 21:14:15 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: 13840843 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 A0476D3C533 for ; Thu, 17 Oct 2024 21:15:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 369C36B0093; Thu, 17 Oct 2024 17:15:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 31AA56B0095; Thu, 17 Oct 2024 17:15:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BAA26B0096; Thu, 17 Oct 2024 17:15:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F36716B0093 for ; Thu, 17 Oct 2024 17:15:25 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EBA0E140363 for ; Thu, 17 Oct 2024 21:15:13 +0000 (UTC) X-FDA: 82684349790.19.213E03F Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf20.hostedemail.com (Postfix) with ESMTP id 948461C0012 for ; Thu, 17 Oct 2024 21:15:11 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=ZSU3viWE; spf=pass (imf20.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=1729199530; 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=aKJMGqqg8ysmtiudHOn7uT8eJFcRURlMkiN4L56Qckc=; b=B1JqhLcQ+DeE9pvPEcHyMhOPhVkAuGLimBVOoqWA6kkWT6WZCA5pqE9Z6nGBytyuxOgdls 43WTw08VHXLq8pgIYUKRHe6upEkpekSfhPUrSSwXBPA5opNYaGi2q5XoCDTp3bZvHahxDs K+ERoU2QCZ/ei2mXGnJ7+KZ316DL5/E= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=ZSU3viWE; spf=pass (imf20.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729199530; a=rsa-sha256; cv=none; b=yJb70zLlvvrM6O58CUR9EuY2wtH9t9PAZg3az06JjtjxQ0vk3YhF/McjZ2sMbT93Kr1Kzi vuxeFSdby1D/GD25z8e/yLJdbVlMmZPkm90EMMlc2s8PpIYvpg0gbhKy0b3k9pqt/LrKE0 1Qc/hVHKOCIlLiAkIU/mOK5LfGizv+8= 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=aKJMGqqg8ysmtiudHOn7uT8eJFcRURlMkiN4L56Qckc=; b=ZSU3viWEHOv4TQ3rGzE4Erk1QD W+mN+D1C2qbhbTnu60ta8qy5ip+a2dkEYa390eqEWeMNJx/vnfPeXypnY9OArnPxS7Au9NXfY5KR9 ldOBLy5YqGIUSsbKit3tgNPpXFdn+W0EccgUA4muWMNsv3hLGu53IZEq9Sp0avMykt0xq5X/S3hlk FG7E6uLKrE3hx6p5yvjOD+YSZRJm0egFSERtqS8FyqTV3fevHZC34WwdMG8VKVD51ZAbkd0FCDrvQ N9fLsK9RyfmEaaPb1EhGr9JjsBwn60cstu7Z1cjMA1T/EBDARmIwLlk8+rmeHcocA3whxP/tusFfp kTr4I4Ow==; Received: from [179.118.186.49] (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 1t1Xpn-00Bnlc-RU; Thu, 17 Oct 2024 23:15:04 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= Date: Thu, 17 Oct 2024 18:14:15 -0300 Subject: [PATCH v7 5/9] libfs: Export generic_ci_ dentry functions MIME-Version: 1.0 Message-Id: <20241017-tonyk-tmpfs-v7-5-a9c056f8391f@igalia.com> References: <20241017-tonyk-tmpfs-v7-0-a9c056f8391f@igalia.com> In-Reply-To: <20241017-tonyk-tmpfs-v7-0-a9c056f8391f@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-Server: rspam06 X-Rspamd-Queue-Id: 948461C0012 X-Stat-Signature: 3c5j8q3zts1mkbp7sttrfw677etwtmk7 X-Rspam-User: X-HE-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2Rz0kCJWA3RbWvfiqCXs+ggYjVE4w1vy7G4BpEfdgZK2AIWZ8KJHfhRwVinwo/PYQR65ihUBKkvfRnPh4VDzdWPH3sPIDb5OAaa0TP/aMfY3nM7E+QI3VeWT0zLbCqQ4dPUtJ9lv3jzGUL49qtjvUfq3o6+fsWMllS4Ww1KlfxWFyZpAptAAcC9dcJCkW3N1huMAEC1JlqN66t83PBxmg6ozUgnIoF61lfU7h9Njx/Mp8VrdOIPFAAgKa2D+lrOjMAVzIv7a+8TmIHEAcnbnd57aMowKYpZQCIMNub3Am1CXKK7z/mGjxf5uCtofkm+HmA5PCkh+Mhbk5NeJbmaYsmQRmlFcmQ9W9LjVK2+smpeora7tnuY9O9ioGlpisjk= 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 Reviewed-by: Gabriel Krisman Bertazi --- 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 403ee5d54c60a0a97e2eba9ef80d8fb4bbd2288f..b277369672a140eba13dce7fa7b0883359c643f8 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