// SPDX-License-Identifier: GPL-2.0 /* * * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved. * */ #include <linux/kernel.h> #include <linux/types.h> #include "ntfs_fs.h" static inline u16 upcase_unicode_char(const u16 *upcase, u16 chr) { … } /* * ntfs_cmp_names * * Thanks Kari Argillander <[email protected]> for idea and implementation 'bothcase' * * Straight way to compare names: * - Case insensitive * - If name equals and 'bothcases' then * - Case sensitive * 'Straight way' code scans input names twice in worst case. * Optimized code scans input names only once. */ int ntfs_cmp_names(const __le16 *s1, size_t l1, const __le16 *s2, size_t l2, const u16 *upcase, bool bothcase) { … } int ntfs_cmp_names_cpu(const struct cpu_str *uni1, const struct le_str *uni2, const u16 *upcase, bool bothcase) { … } /* Helper function for ntfs_d_hash. */ unsigned long ntfs_names_hash(const u16 *name, size_t len, const u16 *upcase, unsigned long hash) { … }