xref: /linux/fs/ntfs/collate.h (revision cdd4dc3aebeab43a72ce0bc2b5bab6f0a80b97a5)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Defines for NTFS kernel collation handling.
4  *
5  * Copyright (c) 2004 Anton Altaparmakov
6  *
7  * Part of this file is based on code from the NTFS-3G.
8  * and is copyrighted by the respective authors below:
9  * Copyright (c) 2004 Anton Altaparmakov
10  * Copyright (c) 2005 Yura Pakhuchiy
11  */
12 
13 #ifndef _LINUX_NTFS_COLLATE_H
14 #define _LINUX_NTFS_COLLATE_H
15 
16 #include "volume.h"
17 
18 static inline bool ntfs_is_collation_rule_supported(__le32 cr)
19 {
20 	int i;
21 
22 	if (unlikely(cr != COLLATION_BINARY && cr != COLLATION_NTOFS_ULONG &&
23 		     cr != COLLATION_FILE_NAME) && cr != COLLATION_NTOFS_ULONGS)
24 		return false;
25 	i = le32_to_cpu(cr);
26 	if (likely(((i >= 0) && (i <= 0x02)) ||
27 			((i >= 0x10) && (i <= 0x13))))
28 		return true;
29 	return false;
30 }
31 
32 int ntfs_collate(struct ntfs_volume *vol, __le32 cr,
33 		const void *data1, const u32 data1_len,
34 		const void *data2, const u32 data2_len);
35 
36 #endif /* _LINUX_NTFS_COLLATE_H */
37