dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / kernel / fs / ufs / ufs_tables.c
blob7917f7f726e8097f7deeaa4008f2a5b6b2f9fdf9
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 1998 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
33 * All Rights Reserved
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
37 * contributors.
41 #pragma ident "%Z%%M% %I% %E% SMI"
43 #include <sys/types.h>
44 #include <sys/param.h>
47 * Bit patterns for identifying fragments in the block map
48 * used as ((map & around) == inside)
50 int around[9] = {
51 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff, 0x1ff, 0x3ff
53 int inside[9] = {
54 0x0, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe
58 * Given a block map bit pattern, the frag tables tell whether a
59 * particular size fragment is available.
61 * used as:
62 * if ((1 << (size - 1)) & fragtbl[fs->fs_frag][map] {
63 * at least one fragment of the indicated size is available
64 * }
66 * These tables are used by the scanc instruction on the VAX to
67 * quickly find an appropriate fragment.
69 uchar_t fragtbl124[256] = {
70 0x00, 0x16, 0x16, 0x2a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3e, 0x3e, 0x3e, 0x7e,
93 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x7e, 0xbe,
94 0x2a, 0x3e, 0x3e, 0x2a, 0x3e, 0x3e, 0x2e, 0x6e,
95 0x3e, 0x3e, 0x3e, 0x3e, 0x2a, 0x3e, 0x6e, 0xaa,
96 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x7e,
97 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x7e, 0xbe,
98 0x4e, 0x5e, 0x5e, 0x6e, 0x5e, 0x5e, 0x6e, 0x4e,
99 0x5e, 0x5e, 0x5e, 0x7e, 0x6e, 0x7e, 0x4e, 0xce,
100 0x8a, 0x9e, 0x9e, 0xaa, 0x9e, 0x9e, 0xae, 0xce,
101 0x9e, 0x9e, 0x9e, 0xbe, 0xaa, 0xbe, 0xce, 0x8a,
104 uchar_t fragtbl8[256] = {
105 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x04,
106 0x01, 0x01, 0x01, 0x03, 0x02, 0x03, 0x04, 0x08,
107 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
108 0x02, 0x03, 0x03, 0x02, 0x04, 0x05, 0x08, 0x10,
109 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
110 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
111 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06,
112 0x04, 0x05, 0x05, 0x06, 0x08, 0x09, 0x10, 0x20,
113 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
114 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
115 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
116 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x09, 0x11,
117 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06,
118 0x03, 0x03, 0x03, 0x03, 0x02, 0x03, 0x06, 0x0a,
119 0x04, 0x05, 0x05, 0x06, 0x05, 0x05, 0x06, 0x04,
120 0x08, 0x09, 0x09, 0x0a, 0x10, 0x11, 0x20, 0x40,
121 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
122 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
123 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
124 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x09, 0x11,
125 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
126 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
127 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07,
128 0x05, 0x05, 0x05, 0x07, 0x09, 0x09, 0x11, 0x21,
129 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06,
130 0x03, 0x03, 0x03, 0x03, 0x02, 0x03, 0x06, 0x0a,
131 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07,
132 0x02, 0x03, 0x03, 0x02, 0x06, 0x07, 0x0a, 0x12,
133 0x04, 0x05, 0x05, 0x06, 0x05, 0x05, 0x06, 0x04,
134 0x05, 0x05, 0x05, 0x07, 0x06, 0x07, 0x04, 0x0c,
135 0x08, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x0a, 0x0c,
136 0x10, 0x11, 0x11, 0x12, 0x20, 0x21, 0x40, 0x80,
140 * The actual fragtbl array.
142 uchar_t *fragtbl[MAXFRAG + 1] = {
143 0, fragtbl124, fragtbl124, 0, fragtbl124, 0, 0, 0, fragtbl8,