collate.h 934 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * collate.h - Defines for NTFS kernel collation handling. Part of the
  4. * Linux-NTFS project.
  5. *
  6. * Copyright (c) 2004 Anton Altaparmakov
  7. */
  8. #ifndef _LINUX_NTFS_COLLATE_H
  9. #define _LINUX_NTFS_COLLATE_H
  10. #include "types.h"
  11. #include "volume.h"
  12. static inline bool ntfs_is_collation_rule_supported(COLLATION_RULE cr) {
  13. int i;
  14. /*
  15. * FIXME: At the moment we only support COLLATION_BINARY and
  16. * COLLATION_NTOFS_ULONG, so we return false for everything else for
  17. * now.
  18. */
  19. if (unlikely(cr != COLLATION_BINARY && cr != COLLATION_NTOFS_ULONG))
  20. return false;
  21. i = le32_to_cpu(cr);
  22. if (likely(((i >= 0) && (i <= 0x02)) ||
  23. ((i >= 0x10) && (i <= 0x13))))
  24. return true;
  25. return false;
  26. }
  27. extern int ntfs_collate(ntfs_volume *vol, COLLATION_RULE cr,
  28. const void *data1, const int data1_len,
  29. const void *data2, const int data2_len);
  30. #endif /* _LINUX_NTFS_COLLATE_H */