1 1.1 christos /* $NetBSD: ext2fs_htree.h,v 1.1 2016/06/24 17:21:30 christos Exp $ */ 2 1.1 christos 3 1.1 christos /*- 4 1.1 christos * Copyright (c) 2010, 2012 Zheng Liu <lz (at) freebsd.org> 5 1.1 christos * Copyright (c) 2012, Vyacheslav Matyushin 6 1.1 christos * All rights reserved. 7 1.1 christos * 8 1.1 christos * Redistribution and use in source and binary forms, with or without 9 1.1 christos * modification, are permitted provided that the following conditions 10 1.1 christos * are met: 11 1.1 christos * 1. Redistributions of source code must retain the above copyright 12 1.1 christos * notice, this list of conditions and the following disclaimer. 13 1.1 christos * 2. Redistributions in binary form must reproduce the above copyright 14 1.1 christos * notice, this list of conditions and the following disclaimer in the 15 1.1 christos * documentation and/or other materials provided with the distribution. 16 1.1 christos * 17 1.1 christos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 1.1 christos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 1.1 christos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 1.1 christos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 1.1 christos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 1.1 christos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 1.1 christos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 1.1 christos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 1.1 christos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 1.1 christos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 1.1 christos * SUCH DAMAGE. 28 1.1 christos * 29 1.1 christos * $FreeBSD: head/sys/fs/ext2fs/htree.h 262623 2014-02-28 21:25:32Z pfg $ 30 1.1 christos */ 31 1.1 christos #ifndef _FS_EXT2FS_HTREE_H_ 32 1.1 christos #define _FS_EXT2FS_HTREE_H_ 33 1.1 christos 34 1.1 christos /* EXT3 HTree directory indexing */ 35 1.1 christos 36 1.1 christos #define EXT2_HTREE_LEGACY 0 37 1.1 christos #define EXT2_HTREE_HALF_MD4 1 38 1.1 christos #define EXT2_HTREE_TEA 2 39 1.1 christos #define EXT2_HTREE_LEGACY_UNSIGNED 3 40 1.1 christos #define EXT2_HTREE_HALF_MD4_UNSIGNED 4 41 1.1 christos #define EXT2_HTREE_TEA_UNSIGNED 5 42 1.1 christos 43 1.1 christos #define EXT2_HTREE_EOF 0x7FFFFFFF 44 1.1 christos 45 1.1 christos struct ext2fs_fake_direct { 46 1.1 christos uint32_t e2d_ino; /* inode number of entry */ 47 1.1 christos uint16_t e2d_reclen; /* length of this record */ 48 1.1 christos uint8_t e2d_namlen; /* length of string in d_name */ 49 1.1 christos uint8_t e2d_type; /* file type */ 50 1.1 christos }; 51 1.1 christos 52 1.1 christos struct ext2fs_htree_count { 53 1.1 christos uint16_t h_entries_max; 54 1.1 christos uint16_t h_entries_num; 55 1.1 christos }; 56 1.1 christos 57 1.1 christos struct ext2fs_htree_entry { 58 1.1 christos uint32_t h_hash; 59 1.1 christos uint32_t h_blk; 60 1.1 christos }; 61 1.1 christos 62 1.1 christos struct ext2fs_htree_root_info { 63 1.1 christos uint32_t h_reserved1; 64 1.1 christos uint8_t h_hash_version; 65 1.1 christos uint8_t h_info_len; 66 1.1 christos uint8_t h_ind_levels; 67 1.1 christos uint8_t h_reserved2; 68 1.1 christos }; 69 1.1 christos 70 1.1 christos struct ext2fs_htree_root { 71 1.1 christos struct ext2fs_fake_direct h_dot; 72 1.1 christos char h_dot_name[4]; 73 1.1 christos struct ext2fs_fake_direct h_dotdot; 74 1.1 christos char h_dotdot_name[4]; 75 1.1 christos struct ext2fs_htree_root_info h_info; 76 1.1 christos struct ext2fs_htree_entry h_entries[0]; 77 1.1 christos }; 78 1.1 christos 79 1.1 christos struct ext2fs_htree_node { 80 1.1 christos struct ext2fs_fake_direct h_fake_dirent; 81 1.1 christos struct ext2fs_htree_entry h_entries[0]; 82 1.1 christos }; 83 1.1 christos 84 1.1 christos struct ext2fs_htree_lookup_level { 85 1.1 christos struct buf *h_bp; 86 1.1 christos struct ext2fs_htree_entry *h_entries; 87 1.1 christos struct ext2fs_htree_entry *h_entry; 88 1.1 christos }; 89 1.1 christos 90 1.1 christos struct ext2fs_htree_lookup_info { 91 1.1 christos struct ext2fs_htree_lookup_level h_levels[2]; 92 1.1 christos uint32_t h_levels_num; 93 1.1 christos }; 94 1.1 christos 95 1.1 christos struct ext2fs_htree_sort_entry { 96 1.1 christos uint16_t h_offset; 97 1.1 christos uint16_t h_size; 98 1.1 christos uint32_t h_hash; 99 1.1 christos }; 100 1.1 christos 101 1.1 christos #endif /* !_FS_EXT2FS_HTREE_H_ */ 102