|
|
1.1 root 1: /*
2: * Copyright (c) 1982, 1986 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution is only permitted until one year after the first shipment
6: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
7: * binary forms are permitted provided that: (1) source distributions retain
8: * this entire copyright notice and comment, and (2) distributions including
9: * binaries display the following acknowledgement: This product includes
10: * software developed by the University of California, Berkeley and its
11: * contributors'' in the documentation or other materials provided with the
12: * distribution and in all advertising materials mentioning features or use
13: * of this software. Neither the name of the University nor the names of
14: * its contributors may be used to endorse or promote products derived from
15: * this software without specific prior written permission.
16: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19: *
20: * @(#)ufs_tables.c 7.4 (Berkeley) 6/28/90
21: */
22:
23: #ifdef KERNEL
24: #include "param.h"
25: #else
26: #include <sys/param.h>
27: #endif
28:
29: /*
30: * Bit patterns for identifying fragments in the block map
31: * used as ((map & around) == inside)
32: */
33: int around[9] = {
34: 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff, 0x1ff, 0x3ff
35: };
36: int inside[9] = {
37: 0x0, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe
38: };
39:
40: /*
41: * Given a block map bit pattern, the frag tables tell whether a
42: * particular size fragment is available.
43: *
44: * used as:
45: * if ((1 << (size - 1)) & fragtbl[fs->fs_frag][map] {
46: * at least one fragment of the indicated size is available
47: * }
48: *
49: * These tables are used by the scanc instruction on the VAX to
50: * quickly find an appropriate fragment.
51: */
52: u_char fragtbl124[256] = {
53: 0x00, 0x16, 0x16, 0x2a, 0x16, 0x16, 0x26, 0x4e,
54: 0x16, 0x16, 0x16, 0x3e, 0x2a, 0x3e, 0x4e, 0x8a,
55: 0x16, 0x16, 0x16, 0x3e, 0x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 0x2a, 0x3e, 0x3e, 0x2a, 0x3e, 0x3e, 0x2e, 0x6e,
78: 0x3e, 0x3e, 0x3e, 0x3e, 0x2a, 0x3e, 0x6e, 0xaa,
79: 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x7e,
80: 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x7e, 0xbe,
81: 0x4e, 0x5e, 0x5e, 0x6e, 0x5e, 0x5e, 0x6e, 0x4e,
82: 0x5e, 0x5e, 0x5e, 0x7e, 0x6e, 0x7e, 0x4e, 0xce,
83: 0x8a, 0x9e, 0x9e, 0xaa, 0x9e, 0x9e, 0xae, 0xce,
84: 0x9e, 0x9e, 0x9e, 0xbe, 0xaa, 0xbe, 0xce, 0x8a,
85: };
86:
87: u_char fragtbl8[256] = {
88: 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x04,
89: 0x01, 0x01, 0x01, 0x03, 0x02, 0x03, 0x04, 0x08,
90: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
91: 0x02, 0x03, 0x03, 0x02, 0x04, 0x05, 0x08, 0x10,
92: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
93: 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
94: 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06,
95: 0x04, 0x05, 0x05, 0x06, 0x08, 0x09, 0x10, 0x20,
96: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
97: 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
98: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
99: 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x09, 0x11,
100: 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06,
101: 0x03, 0x03, 0x03, 0x03, 0x02, 0x03, 0x06, 0x0a,
102: 0x04, 0x05, 0x05, 0x06, 0x05, 0x05, 0x06, 0x04,
103: 0x08, 0x09, 0x09, 0x0a, 0x10, 0x11, 0x20, 0x40,
104: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
105: 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
106: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
107: 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x09, 0x11,
108: 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
109: 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
110: 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07,
111: 0x05, 0x05, 0x05, 0x07, 0x09, 0x09, 0x11, 0x21,
112: 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06,
113: 0x03, 0x03, 0x03, 0x03, 0x02, 0x03, 0x06, 0x0a,
114: 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07,
115: 0x02, 0x03, 0x03, 0x02, 0x06, 0x07, 0x0a, 0x12,
116: 0x04, 0x05, 0x05, 0x06, 0x05, 0x05, 0x06, 0x04,
117: 0x05, 0x05, 0x05, 0x07, 0x06, 0x07, 0x04, 0x0c,
118: 0x08, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x0a, 0x0c,
119: 0x10, 0x11, 0x11, 0x12, 0x20, 0x21, 0x40, 0x80,
120: };
121:
122: /*
123: * The actual fragtbl array.
124: */
125: u_char *fragtbl[MAXFRAG + 1] = {
126: 0, fragtbl124, fragtbl124, 0, fragtbl124, 0, 0, 0, fragtbl8,
127: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.