compress frag tables
[unix-history] / usr / src / sys / ufs / ffs / ffs_tables.c
CommitLineData
5576d804
KM
1/* Copyright (c) 1981 Regents of the University of California */
2
156b8f82 3/* @(#)ffs_tables.c 1.4 %G% */
5576d804
KM
4
5#include "../h/param.h"
6
7/* partab.c 4.2 81/03/08 */
8
9/*
10 * Table giving parity for characters and indicating
11 * character classes to tty driver. In particular,
12 * if the low 6 bits are 0, then the character needs
13 * no special processing on output.
14 */
15
1b940b13 16unsigned char partab[] = {
5576d804
KM
17 0001,0201,0201,0001,0201,0001,0001,0201,
18 0202,0004,0003,0201,0005,0206,0201,0001,
19 0201,0001,0001,0201,0001,0201,0201,0001,
20 0001,0201,0201,0001,0201,0001,0001,0201,
21 0200,0000,0000,0200,0000,0200,0200,0000,
22 0000,0200,0200,0000,0200,0000,0000,0200,
23 0000,0200,0200,0000,0200,0000,0000,0200,
24 0200,0000,0000,0200,0000,0200,0200,0000,
25 0200,0000,0000,0200,0000,0200,0200,0000,
26 0000,0200,0200,0000,0200,0000,0000,0200,
27 0000,0200,0200,0000,0200,0000,0000,0200,
28 0200,0000,0000,0200,0000,0200,0200,0000,
29 0000,0200,0200,0000,0200,0000,0000,0200,
30 0200,0000,0000,0200,0000,0200,0200,0000,
31 0200,0000,0000,0200,0000,0200,0200,0000,
32 0000,0200,0200,0000,0200,0000,0000,0201,
33
34 /*
35 * 7 bit ascii ends with the last character above,
36 * but we contine through all 256 codes for the sake
37 * of the tty output routines which use special vax
38 * instructions which need a 256 character trt table.
39 */
40
41 0007,0007,0007,0007,0007,0007,0007,0007,
42 0007,0007,0007,0007,0007,0007,0007,0007,
43 0007,0007,0007,0007,0007,0007,0007,0007,
44 0007,0007,0007,0007,0007,0007,0007,0007,
45 0007,0007,0007,0007,0007,0007,0007,0007,
46 0007,0007,0007,0007,0007,0007,0007,0007,
47 0007,0007,0007,0007,0007,0007,0007,0007,
48 0007,0007,0007,0007,0007,0007,0007,0007,
49 0007,0007,0007,0007,0007,0007,0007,0007,
50 0007,0007,0007,0007,0007,0007,0007,0007,
51 0007,0007,0007,0007,0007,0007,0007,0007,
52 0007,0007,0007,0007,0007,0007,0007,0007,
53 0007,0007,0007,0007,0007,0007,0007,0007,
54 0007,0007,0007,0007,0007,0007,0007,0007,
55 0007,0007,0007,0007,0007,0007,0007,0007,
56 0007,0007,0007,0007,0007,0007,0007,0007
57};
58
59/*
60 * bit patterns for identifying fragments in the block map
61 * used as ((map & around) == inside)
62 */
63int around[9] = {
64 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff, 0x1ff, 0x3ff
65};
66int inside[9] = {
67 0x0, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe
68};
69
70/*
b6407c9d 71 * given a block map bit pattern, the frag tables tell whether a
5576d804 72 * particular size fragment is available.
b6407c9d 73 *
5576d804 74 * used as:
b6407c9d 75 * if ((1 << (size - 1)) & fragtbl[fs->fs_frag][map] {
5576d804
KM
76 * at least one fragment of the indicated size is available
77 * }
b6407c9d
KM
78 *
79 * These tables are used by the scanc instruction on the VAX to
5576d804
KM
80 * quickly find an appropriate fragment.
81 */
b6407c9d 82
156b8f82
KM
83unsigned char fragtbl124[256] = {
84 0x00, 0x16, 0x16, 0x2a, 0x16, 0x16, 0x26, 0x4e,
85 0x16, 0x16, 0x16, 0x3e, 0x2a, 0x3e, 0x4e, 0x8a,
86 0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e,
87 0x16, 0x16, 0x16, 0x3e, 0x3e, 0x3e, 0x5e, 0x9e,
88 0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e,
89 0x16, 0x16, 0x16, 0x3e, 0x3e, 0x3e, 0x5e, 0x9e,
90 0x2a, 0x3e, 0x3e, 0x2a, 0x3e, 0x3e, 0x2e, 0x6e,
91 0x3e, 0x3e, 0x3e, 0x3e, 0x2a, 0x3e, 0x6e, 0xaa,
92 0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 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0x9e, 0xaa, 0x9e, 0x9e, 0xae, 0xce,
115 0x9e, 0x9e, 0x9e, 0xbe, 0xaa, 0xbe, 0xce, 0x8a,
5576d804 116};
5576d804 117
b6407c9d 118unsigned char fragtbl8[256] = {
5576d804
KM
119 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x04,
120 0x01, 0x01, 0x01, 0x03, 0x02, 0x03, 0x04, 0x08,
121 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
122 0x02, 0x03, 0x03, 0x02, 0x04, 0x05, 0x08, 0x10,
123 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
124 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
125 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06,
126 0x04, 0x05, 0x05, 0x06, 0x08, 0x09, 0x10, 0x20,
127 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
128 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
129 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
130 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x09, 0x11,
131 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06,
132 0x03, 0x03, 0x03, 0x03, 0x02, 0x03, 0x06, 0x0a,
133 0x04, 0x05, 0x05, 0x06, 0x05, 0x05, 0x06, 0x04,
134 0x08, 0x09, 0x09, 0x0a, 0x10, 0x11, 0x20, 0x40,
135 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
136 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
137 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
138 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x09, 0x11,
139 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
140 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
141 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07,
142 0x05, 0x05, 0x05, 0x07, 0x09, 0x09, 0x11, 0x21,
143 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06,
144 0x03, 0x03, 0x03, 0x03, 0x02, 0x03, 0x06, 0x0a,
145 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07,
146 0x02, 0x03, 0x03, 0x02, 0x06, 0x07, 0x0a, 0x12,
147 0x04, 0x05, 0x05, 0x06, 0x05, 0x05, 0x06, 0x04,
148 0x05, 0x05, 0x05, 0x07, 0x06, 0x07, 0x04, 0x0c,
149 0x08, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x0a, 0x0c,
150 0x10, 0x11, 0x11, 0x12, 0x20, 0x21, 0x40, 0x80,
151};
b6407c9d
KM
152
153/*
154 * the actual fragtbl array
155 */
156unsigned char *fragtbl[MAXFRAG + 1] = {
156b8f82 157 0, fragtbl124, fragtbl124, 0, fragtbl124, 0, 0, 0, fragtbl8,
b6407c9d 158};