1/* 2 * ntfs_hash.h - Defines for inode hash structures and operations for the NTFS 3 * kernel driver. 4 * 5 * Copyright (c) 2006-2011 Anton Altaparmakov. All Rights Reserved. 6 * Portions Copyright (c) 2006-2011 Apple Inc. All Rights Reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are met: 10 * 11 * 1. Redistributions of source code must retain the above copyright notice, 12 * this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright notice, 14 * this list of conditions and the following disclaimer in the documentation 15 * and/or other materials provided with the distribution. 16 * 3. Neither the name of Apple Inc. ("Apple") nor the names of its 17 * contributors may be used to endorse or promote products derived from this 18 * software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 21 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 * ALTERNATIVELY, provided that this notice and licensing terms are retained in 32 * full, this file may be redistributed and/or modified under the terms of the 33 * GNU General Public License (GPL) Version 2, in which case the provisions of 34 * that version of the GPL will apply to you instead of the license terms 35 * above. You can obtain a copy of the GPL Version 2 at 36 * http://developer.apple.com/opensource/licenses/gpl-2.txt. 37 */ 38 39#ifndef _OSX_NTFS_HASH_H 40#define _OSX_NTFS_HASH_H 41 42#include <sys/cdefs.h> 43#include <sys/errno.h> 44#include <sys/mount.h> 45#include <sys/queue.h> 46 47#include <kern/locks.h> 48 49#include "ntfs_inode.h" 50#include "ntfs_volume.h" 51 52__private_extern__ lck_mtx_t ntfs_inode_hash_lock; 53 54__private_extern__ errno_t ntfs_inode_hash_init(void); 55__private_extern__ void ntfs_inode_hash_deinit(void); 56 57__private_extern__ ntfs_inode *ntfs_inode_hash_lookup(ntfs_volume *vol, 58 const ntfs_attr *na); 59__private_extern__ ntfs_inode *ntfs_inode_hash_get(ntfs_volume *vol, 60 const ntfs_attr *na); 61 62/** 63 * ntfs_inode_hash_rm_nolock - remove an ntfs inode from the ntfs inode hash 64 * @ni: ntfs inode to remove from the hash 65 * 66 * Remove the ntfs inode @ni from the ntfs inode hash. 67 */ 68static inline void ntfs_inode_hash_rm_nolock(ntfs_inode *ni) 69{ 70 LIST_REMOVE(ni, hash); 71} 72 73__private_extern__ void ntfs_inode_hash_rm(ntfs_inode *ni); 74 75#endif /* !_OSX_NTFS_HASH_H */ 76