Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp654636lqp; Fri, 5 Apr 2024 05:15:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfX+HKxw8LFBeT9+BD4CO+QxFj9v5zA3aYIvjltYdaHFdbBmSIbBxJMsWH2Lsw0kRx5zuEpx0K+Z9e90VDn6YXjgVdlLvtlAtwoClePg== X-Google-Smtp-Source: AGHT+IFbvpdar4Q2hPXFuz+GSm9w16zMv1YkP/NxvTS1Tnl/rYG7mTD4WhmjPMXHw6Ujygo/Zool X-Received: by 2002:a05:6102:cc8:b0:479:dedd:3a05 with SMTP id g8-20020a0561020cc800b00479dedd3a05mr951651vst.14.1712319334995; Fri, 05 Apr 2024 05:15:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712319334; cv=pass; d=google.com; s=arc-20160816; b=ZMf/zHZf5KyGIFgAyAgmkqQNWoN8J8EowsBT36Xv/VQfIz0p+ByjjGA0P3BOwdQpXw SmVggguTWxNPqSnWd7CXAaz9QfWtkNMOtSKZcdCSK5VkLD2wj5ePWhyl5Id2th7ujOp9 8/hC8/3RdtPpU6QKnvfELb7jZSqitYNzvzUDMeZl10uh1ajhmyIncoBqY+9uB6usCcEv ENMqTUDcS2IGyUitrKEXMZDt1kkTeRxds6Ivm1v06DHZBwwjA9n2Lgx44GfXt5+nXV7m vH+GvFIZp6yOcMcUwdN49C158F2LXwaErgmmlqfOaBfR+OUdDkG4HXndeOaSTdUXToQl iBkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=K93gzc0N8n6LEX9UE9DlTpvA2JW97rK3RKSkaKXsbrQ=; fh=i4fiMUBCQXbDZMdyre5oEqz49aLUEO6D1+7NN548JDQ=; b=MDm3Bb9Z7AdiArDiHlRY0IIztEEBvgIKnTz1P1sSsDIVXgnojaGCQ4Stsd130aI4wu GBG9IPqU2emrl8HR38ppEOy6YoPydNO/Vrpw14YQEcYZTULnD6trhuOeF/+nImKKu7TF JWEQKA3XkwDDyNspQxtcfBJ4fYM7NGsxdXlN/UVqFFf6DfnPWczV8kS+MzLeLcZJnU6E D75TSQ2zNo8bTSuQYpOXiL0FMZmfcXElFWRNgS7GMyRxbBZhqQYfbZhlaopEZTjhI1FM 9p1f2FDbLtmUsan4rR9ICBiymygGOFBqza3998VRYGse8AvhdLqUX9s/wlea3gLXRVxR oeoQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=2ySpj2rL; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-ext4+bounces-1890-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1890-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a12-20020a05610234cc00b00478456efecasi162669vst.506.2024.04.05.05.15.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 05:15:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1890-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=2ySpj2rL; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-ext4+bounces-1890-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1890-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E32C51C2222B for ; Fri, 5 Apr 2024 12:15:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ECFD216DEC5; Fri, 5 Apr 2024 12:14:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="2ySpj2rL" X-Original-To: linux-ext4@vger.kernel.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B7CF16D4D3; Fri, 5 Apr 2024 12:14:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712319251; cv=none; b=sFE5Vqj2zw7fqLImcVrbZUtVbOpMzvdCqOqYv6eO7b3UY+4NLj2dIXnHbMSqfWlwqxHkMmiIwMcuYhsi49yYOeh/QhX7gKBUcSxWmzRkATzgP9yhTFGDPmoSDJiRVGES3nDdly5vkXy87WboPkWCQc4dumO3Q7AcK7lo/tqBPJc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712319251; c=relaxed/simple; bh=7yUG7UGRK7OExSJRvYKpT6PLYdclk+J33hviNbmb5mI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UMQtn6cQfEmxFgd+bXj9xLpzsytyeM/lM+1CA0hi5qkggIQViSSGlS59ttvd55Q7445dcRAcrVXvbYCJTj7YdyFOq272d/2QTNVGsSvYbgrx/qIqEIzgRbwoSVsFxjIYdlmqsIG3+/oGg2o31izGG+mHM49y3fkTKtRyqB+P5fs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=2ySpj2rL; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1712319246; bh=7yUG7UGRK7OExSJRvYKpT6PLYdclk+J33hviNbmb5mI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2ySpj2rLA7DYnONIZw4YUlfaBDtZwz0AxOKGhg5GwFbmISCNJ1TzLcGpfhQ+DYg1N L5PocgPil4uWENPLJ2aO/nZPateaq5QGe+/bf2fT3oV4ETthWMpsSyA6NuWSv5Rn/R QRWu9dXPE2/aDOr81v/fVjaot3BUrhG5EIjlP5TLggU6vrabTn55/Va98bBUdMbDmX tBt1V9FCSbEwcge+NPu/5DrlsnMB+h+3CrVFtP5WZLso0yOnYGP300+1Cw4OVtlsLi STgHUHF2MaSI8Asfl4RcJAG58gjFVZC3axxpFTmGgaK25p5bmjnLG4EZw612BFQI8l lRuQwahvB5JaA== Received: from eugen-station.. (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ehristev) by madrid.collaboradmins.com (Postfix) with ESMTPSA id E91BD3782130; Fri, 5 Apr 2024 12:14:05 +0000 (UTC) From: Eugen Hristev To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, jaegeuk@kernel.org, chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel@collabora.com, eugen.hristev@collabora.com, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, krisman@suse.de, ebiggers@kernel.org, Gabriel Krisman Bertazi Subject: [PATCH v16 5/9] f2fs: Reuse generic_ci_match for ci comparisons Date: Fri, 5 Apr 2024 15:13:28 +0300 Message-Id: <20240405121332.689228-6-eugen.hristev@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405121332.689228-1-eugen.hristev@collabora.com> References: <20240405121332.689228-1-eugen.hristev@collabora.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Gabriel Krisman Bertazi Now that ci_match is part of libfs, make f2fs reuse it instead of having a different implementation. Signed-off-by: Gabriel Krisman Bertazi Signed-off-by: Eugen Hristev --- fs/f2fs/dir.c | 58 ++++----------------------------------------------- 1 file changed, 4 insertions(+), 54 deletions(-) diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index bdf980e25adb..cbd7a5e96a37 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -185,58 +185,6 @@ static struct f2fs_dir_entry *find_in_block(struct inode *dir, return f2fs_find_target_dentry(&d, fname, max_slots); } -#if IS_ENABLED(CONFIG_UNICODE) -/* - * Test whether a case-insensitive directory entry matches the filename - * being searched for. - * - * Returns 1 for a match, 0 for no match, and -errno on an error. - */ -static int f2fs_match_ci_name(const struct inode *dir, const struct qstr *name, - const u8 *de_name, u32 de_name_len) -{ - const struct super_block *sb = dir->i_sb; - const struct unicode_map *um = sb->s_encoding; - struct fscrypt_str decrypted_name = FSTR_INIT(NULL, de_name_len); - struct qstr entry = QSTR_INIT(de_name, de_name_len); - int res; - - if (IS_ENCRYPTED(dir)) { - const struct fscrypt_str encrypted_name = - FSTR_INIT((u8 *)de_name, de_name_len); - - if (WARN_ON_ONCE(!fscrypt_has_encryption_key(dir))) - return -EINVAL; - - decrypted_name.name = kmalloc(de_name_len, GFP_KERNEL); - if (!decrypted_name.name) - return -ENOMEM; - res = fscrypt_fname_disk_to_usr(dir, 0, 0, &encrypted_name, - &decrypted_name); - if (res < 0) - goto out; - entry.name = decrypted_name.name; - entry.len = decrypted_name.len; - } - - res = utf8_strncasecmp_folded(um, name, &entry); - /* - * In strict mode, ignore invalid names. In non-strict mode, - * fall back to treating them as opaque byte sequences. - */ - if (res < 0 && !sb_has_strict_encoding(sb)) { - res = name->len == entry.len && - memcmp(name->name, entry.name, name->len) == 0; - } else { - /* utf8_strncasecmp_folded returns 0 on match */ - res = (res == 0); - } -out: - kfree(decrypted_name.name); - return res; -} -#endif /* CONFIG_UNICODE */ - static inline int f2fs_match_name(const struct inode *dir, const struct f2fs_filename *fname, const u8 *de_name, u32 de_name_len) @@ -245,8 +193,10 @@ static inline int f2fs_match_name(const struct inode *dir, #if IS_ENABLED(CONFIG_UNICODE) if (fname->cf_name.name) - return f2fs_match_ci_name(dir, &fname->cf_name, - de_name, de_name_len); + return generic_ci_match(dir, fname->usr_fname, + &fname->cf_name, + de_name, de_name_len); + #endif f.usr_fname = fname->usr_fname; f.disk_name = fname->disk_name; -- 2.34.1