1: /* 2: * Copyright (c) 1982, 1986 Regents of the University of California. 3: * All rights reserved. The Berkeley software License Agreement 4: * specifies the terms and conditions for redistribution. 5: * 6: * @(#)ufs_tables.c 7.1 (Berkeley) 6/5/86 7: */ 8: 9: #include "param.h" 10: 11: /* 12: * Bit patterns for identifying fragments in the block map 13: * used as ((map & around) == inside) 14: */ 15: int around[9] = { 16: 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff, 0x1ff, 0x3ff 17: }; 18: int inside[9] = { 19: 0x0, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe 20: }; 21: 22: /* 23: * Given a block map bit pattern, the frag tables tell whether a 24: * particular size fragment is available. 25: * 26: * used as: 27: * if ((1 << (size - 1)) & fragtbl[fs->fs_frag][map] { 28: * at least one fragment of the indicated size is available 29: * } 30: * 31: * These tables are used by the scanc instruction on the VAX to 32: * quickly find an appropriate fragment. 33: */ 34: u_char fragtbl124[256] = { 35: 0x00, 0x16, 0x16, 0x2a, 0x16, 0x16, 0x26, 0x4e, 36: 0x16, 0x16, 0x16, 0x3e, 0x2a, 0x3e, 0x4e, 0x8a, 37: 0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e, 38: 0x16, 0x16, 0x16, 0x3e, 0x3e, 0x3e, 0x5e, 0x9e, 39: 0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e, 40: 0x16, 0x16, 0x16, 0x3e, 0x3e, 0x3e, 0x5e, 0x9e, 41: 0x2a, 0x3e, 0x3e, 0x2a, 0x3e, 0x3e, 0x2e, 0x6e, 42: 0x3e, 0x3e, 0x3e, 0x3e, 0x2a, 0x3e, 0x6e, 0xaa, 43: 0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e, 44: 0x16, 0x16, 0x16, 0x3e, 0x3e, 0x3e, 0x5e, 0x9e, 45: 0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e, 46: 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: }; 68: 69: u_char fragtbl8[256] = { 70: 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x04, 71: 0x01, 0x01, 0x01, 0x03, 0x02, 0x03, 0x04, 0x08, 72: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05, 73: 0x02, 0x03, 0x03, 0x02, 0x04, 0x05, 0x08, 0x10, 74: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05, 75: 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09, 76: 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06, 77: 0x04, 0x05, 0x05, 0x06, 0x08, 0x09, 0x10, 0x20, 78: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05, 79: 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09, 80: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05, 81: 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x09, 0x11, 82: 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06, 83: 0x03, 0x03, 0x03, 0x03, 0x02, 0x03, 0x06, 0x0a, 84: 0x04, 0x05, 0x05, 0x06, 0x05, 0x05, 0x06, 0x04, 85: 0x08, 0x09, 0x09, 0x0a, 0x10, 0x11, 0x20, 0x40, 86: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05, 87: 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09, 88: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05, 89: 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x09, 0x11, 90: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05, 91: 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09, 92: 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 93: 0x05, 0x05, 0x05, 0x07, 0x09, 0x09, 0x11, 0x21, 94: 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06, 95: 0x03, 0x03, 0x03, 0x03, 0x02, 0x03, 0x06, 0x0a, 96: 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 97: 0x02, 0x03, 0x03, 0x02, 0x06, 0x07, 0x0a, 0x12, 98: 0x04, 0x05, 0x05, 0x06, 0x05, 0x05, 0x06, 0x04, 99: 0x05, 0x05, 0x05, 0x07, 0x06, 0x07, 0x04, 0x0c, 100: 0x08, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x0a, 0x0c, 101: 0x10, 0x11, 0x11, 0x12, 0x20, 0x21, 0x40, 0x80, 102: }; 103: 104: /* 105: * The actual fragtbl array. 106: */ 107: u_char *fragtbl[MAXFRAG + 1] = { 108: 0, fragtbl124, fragtbl124, 0, fragtbl124, 0, 0, 0, fragtbl8, 109: };