From patchwork Wed Oct 2 23:44:39 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: 13820558 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 A2E7ECF8547 for ; Wed, 2 Oct 2024 23:45:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 382AE6B04EC; Wed, 2 Oct 2024 19:45:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3330C6B04ED; Wed, 2 Oct 2024 19:45:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FB4A6B04EE; Wed, 2 Oct 2024 19:45:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id EC0CD6B04EC for ; Wed, 2 Oct 2024 19:45:30 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 626911C6DEF for ; Wed, 2 Oct 2024 23:45:30 +0000 (UTC) X-FDA: 82630296420.10.31B5C57 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf11.hostedemail.com (Postfix) with ESMTP id AC1DF40018 for ; Wed, 2 Oct 2024 23:45:28 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=GRS0ZU4D; spf=pass (imf11.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=1727912663; 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=AQXk6ztfHTUQteq8elPhWhUuCISghcvWoGYTPvw/Cw8=; b=y2QmNKWM6o5ibIkcPzmKhI4N6YqXBQSRqfaDWQQyUPW9QgrTYYSh39wV54U57uy1nTNpbm DlfsX2yi00Isog0qpZd7t2qDXeV2WTiWagLbioE0+WcHSnLnHlO+JZjAnliSCfUSg4Z1DZ E8hClfGFC5AyGa/YoxGq7wo53Yviqjk= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=GRS0ZU4D; spf=pass (imf11.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=1727912663; a=rsa-sha256; cv=none; b=IMma49UVprFd1liL++sqIzfeXEBByMmFyJkmuFo4n/x+veWCbIY2jN3LnmSpw5PH1OC6mm nq79fr+3tR8zXRVXzhSK2HddlRI3971cfEk1LrYhEemjJbdvLwka7PTVYSF8APrP3p617y yeETA1Wiu6RZbK8iR9qkAMRH5NTh9WA= 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=AQXk6ztfHTUQteq8elPhWhUuCISghcvWoGYTPvw/Cw8=; b=GRS0ZU4D/LbdgGtJz8RqDet2I/ kBSmua98CNEkx9YC1kQqu5FoWtonv8v6mjKUDDc+4jt2vUVc3H6KfulRVGlmnmc77P+HgeXkffCxc ylDiVRu9Ko+fcofddOY/MotK4SzHmfX/qso/QhYfbjx+NngmuqyXbkJsJKWcizQVxvqWLiSXbitLm 7N5QOFhclCGI2g2TRhiPKOVDDFSHwO19js7JLFOv+9TrSrB6I5oA81S9Gzs6k2x9duS/K3VXWggQY rjF7yM0fWEyE+RAq7rdWWkODzySa7GRoaOxdV0lHMyk6n0mrrCOHOXnjiIU+96+GbfoKG8yqtGoj/ 1ycf+wPA==; Received: from [187.57.199.212] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1sw920-0045tc-HW; Thu, 03 Oct 2024 01:45:20 +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 v5 05/10] libfs: Export generic_ci_ dentry functions Date: Wed, 2 Oct 2024 20:44:39 -0300 Message-ID: <20241002234444.398367-6-andrealmeid@igalia.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241002234444.398367-1-andrealmeid@igalia.com> References: <20241002234444.398367-1-andrealmeid@igalia.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: AC1DF40018 X-Stat-Signature: hmw836xxd59b6k4xps15qhxi18toabuu X-HE-Tag: 1727912728-717067 X-HE-Meta: U2FsdGVkX1+IunSG068Mdh5HmytQy7R2VfA7iF/qu9cclNaGBwBxzvYZ/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g5VMH/1zK0tK4rOnTzOGPQ9oFsCPMvB+MJH9Ft5286kzEB2KZVljv/oceV9VvuBgWDlDcDzsHgJYCn2w+yTfCnrKJT7XiG7Kkl8TQqbsz5uUu38aTHXWypArBo6UNaYGuVe6gY8e6Qw24tsJSfyJ0LVddylKx6gk/+6arw1fJRgjJu04uJJyzRP4g6wrXiyF5Wsd012Y5qzInlKZp/c7jm62O1AtMF9oMWjlsQpAyY46hTuoB3rpzmY9 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 46966fd8bcf9..7b290404c5f9 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 9a5d38fc3b67..400d070d9a9b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3453,6 +3453,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