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