Thomas Gleixner | a1d312d | 2019-05-22 09:51:42 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
| 3 | * collate.h - Defines for NTFS kernel collation handling. Part of the |
| 4 | * Linux-NTFS project. |
| 5 | * |
| 6 | * Copyright (c) 2004 Anton Altaparmakov |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef _LINUX_NTFS_COLLATE_H |
| 10 | #define _LINUX_NTFS_COLLATE_H |
| 11 | |
| 12 | #include "types.h" |
| 13 | #include "volume.h" |
| 14 | |
Richard Knutsson | c49c311 | 2006-09-30 23:27:12 -0700 | [diff] [blame] | 15 | static inline bool ntfs_is_collation_rule_supported(COLLATION_RULE cr) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | int i; |
| 17 | |
| 18 | /* |
| 19 | * FIXME: At the moment we only support COLLATION_BINARY and |
| 20 | * COLLATION_NTOFS_ULONG, so we return false for everything else for |
| 21 | * now. |
| 22 | */ |
| 23 | if (unlikely(cr != COLLATION_BINARY && cr != COLLATION_NTOFS_ULONG)) |
Richard Knutsson | c49c311 | 2006-09-30 23:27:12 -0700 | [diff] [blame] | 24 | return false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | i = le32_to_cpu(cr); |
| 26 | if (likely(((i >= 0) && (i <= 0x02)) || |
| 27 | ((i >= 0x10) && (i <= 0x13)))) |
Richard Knutsson | c49c311 | 2006-09-30 23:27:12 -0700 | [diff] [blame] | 28 | return true; |
| 29 | return false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | extern int ntfs_collate(ntfs_volume *vol, COLLATION_RULE cr, |
| 33 | const void *data1, const int data1_len, |
| 34 | const void *data2, const int data2_len); |
| 35 | |
| 36 | #endif /* _LINUX_NTFS_COLLATE_H */ |