1/* 2 * ntfs_collate.h - Defines for collation handling in the NTFS kernel driver. 3 * 4 * Copyright (c) 2006-2008 Anton Altaparmakov. All Rights Reserved. 5 * Portions Copyright (c) 2006-2008 Apple Inc. All Rights Reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright notice, 11 * this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright notice, 13 * this list of conditions and the following disclaimer in the documentation 14 * and/or other materials provided with the distribution. 15 * 3. Neither the name of Apple Inc. ("Apple") nor the names of its 16 * contributors may be used to endorse or promote products derived from this 17 * software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 20 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * 30 * ALTERNATIVELY, provided that this notice and licensing terms are retained in 31 * full, this file may be redistributed and/or modified under the terms of the 32 * GNU General Public License (GPL) Version 2, in which case the provisions of 33 * that version of the GPL will apply to you instead of the license terms 34 * above. You can obtain a copy of the GPL Version 2 at 35 * http://developer.apple.com/opensource/licenses/gpl-2.txt. 36 */ 37 38#ifndef _OSX_NTFS_COLLATE_H 39#define _OSX_NTFS_COLLATE_H 40 41#include "ntfs_layout.h" 42#include "ntfs_types.h" 43#include "ntfs_volume.h" 44 45static inline BOOL ntfs_is_collation_rule_supported(COLLATION_RULE cr) { 46 int i; 47 48 /* 49 * TODO: We support everything other than COLLATION_UNICODE_STRING at 50 * present but we do a range check in case new collation rules turn up 51 * in later ntfs releases. 52 */ 53 if (cr == COLLATION_UNICODE_STRING) 54 return FALSE; 55 i = le32_to_cpu(cr); 56 if (((i >= 0) && (i <= 0x02)) || ((i >= 0x10) && (i <= 0x13))) 57 return TRUE; 58 return FALSE; 59} 60 61__private_extern__ int ntfs_collate(ntfs_volume *vol, COLLATION_RULE cr, 62 const void *data1, const int data1_len, 63 const void *data2, const int data2_len); 64 65#endif /* _OSX_NTFS_COLLATE_H */ 66