1
2
3
4
5
6
7
8
9
10 #include <linux/kernel.h>
11 #include <linux/string.h>
12
13 #include "tables.h"
14
15 unsigned char fat_uni2code[64] = {
16 '0', '1', '2', '3', '4', '5', '6', '7',
17 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
18 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
19 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
20 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
21 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
22 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
23 'u', 'v', 'w', 'x', 'y', 'z', '+', '-'
24 };
25
26 unsigned char fat_code2uni[256] = {
27 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
28 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
29 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
30 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
31 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
32 0xff, 0xff, 0xff, 0x3e, 0xff, 0x3f, 0xff, 0xff,
33 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
34 0x08, 0x09, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
35 0xff, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
36 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
37 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
38 0x21, 0x22, 0x23, 0xff, 0xff, 0xff, 0xff, 0xff,
39 0xff, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
40 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32,
41 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a,
42 0x3b, 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff,
43 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
44 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
45 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
46 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
47 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
48 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
49 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
50 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
51 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
52 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
53 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
54 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
55 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
56 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
57 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
58 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
59 };
60
61 static unsigned char page00[256] = {
62 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
63 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
64 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
65 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
66 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
67 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
68 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
69 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
70 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
71 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
72 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
73 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
74 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
75 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
76 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
77 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
78
79 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92,
83 0xFF, 0xAD, 0xBD, 0x9C, 0xCF, 0xBE, 0xDD, 0xF5,
84 0xF9, 0xB8, 0x00, 0xAE, 0xAA, 0xF0, 0x00, 0xEE,
85 0xF8, 0xF1, 0xFD, 0xFC, 0xEF, 0xE6, 0xF4, 0xFA,
86 0xF7, 0xFB, 0x00, 0xAF, 0xAC, 0xAB, 0xF3, 0x00,
87 0xB7, 0xB5, 0xB6, 0xC7, 0x8E, 0x8F, 0x92, 0x80,
88 0xD4, 0x90, 0xD2, 0xD3, 0xDE, 0xD6, 0xD7, 0xD8,
89 0x00, 0xA5, 0xE3, 0xE0, 0xE2, 0xE5, 0x99, 0x9E,
90 0x9D, 0xEB, 0xE9, 0xEA, 0x9A, 0xED, 0xE8, 0xE1,
91 0xA1, 0xA0, 0x83, 0xC6, 0x84, 0x86, 0x91, 0x87,
92 0x8A, 0x82, 0x88, 0x89, 0x8D, 0x00, 0x8C, 0x8B,
93 0xD0, 0xA4, 0x95, 0xA2, 0x93, 0xE4, 0x94, 0xF6,
94 0x9B, 0x97, 0xA3, 0x96, 0x81, 0xEC, 0xE7, 0x98
95 };
96
97
98 static unsigned char page25[256] = {
99 0xC4, 0x00, 0xB3, 0x00, 0x00, 0x00, 0x00, 0x00,
100 0x00, 0x00, 0x00, 0x00, 0xDA, 0x00, 0x00, 0x00,
101 0xBF, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00,
102 0xD9, 0x00, 0x00, 0x00, 0xC3, 0x00, 0x00, 0x00,
103 0x00, 0x00, 0x00, 0x00, 0xB4, 0x00, 0x00, 0x00,
104 0x00, 0x00, 0x00, 0x00, 0xC2, 0x00, 0x00, 0x00,
105 0x00, 0x00, 0x00, 0x00, 0xC1, 0x00, 0x00, 0x00,
106 0x00, 0x00, 0x00, 0x00, 0xC5, 0x00, 0x00, 0x00,
107 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
108 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
109 0xCD, 0xBA, 0x00, 0x00, 0xC9, 0x00, 0x00, 0xBB,
110 0x00, 0x00, 0xC8, 0x00, 0x00, 0xBC, 0x00, 0x00,
111 0xCC, 0x00, 0x00, 0xB9, 0x00, 0x00, 0xCB, 0x00,
112 0x00, 0xCA, 0x00, 0x00, 0xCE, 0x00, 0x00, 0x00,
113 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
114 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
115
116 0xDF, 0x00, 0x00, 0x00, 0xDC, 0x00, 0x00, 0x00,
117 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
118 0x00, 0xB0, 0xB1, 0xB2, 0x00, 0x00, 0x00, 0x00,
119 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
120 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
121 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
122 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
124 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
125 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
126 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
127 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
132 };
133
134
135 unsigned char *fat_uni2asc_pg[256] = {
136 page00, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
137 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
138 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
139 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
140 NULL, NULL, NULL, NULL, page25
141 };
142
143
144
145
146 unsigned char fat_a2alias[256] =
147 {
148 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
149 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
150 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
151 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
152 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
153 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
154 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
155 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
156 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
157 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
158 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
159 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
160 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
161 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
162 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
163 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
164
165 0x80, 0x9A, 0x90, 0xB6, 0x8E, 0xB7, 0x8F, 0x80,
166 0xD2, 0xD3, 0xD4, 0xD8, 0xD7, 0xDE, 0x8E, 0x8F,
167 0x90, 0x92, 0x92, 0xE2, 0x99, 0xE3, 0xEA, 0xEB,
168 0x98, 0x99, 0x9A, 0x9D, 0x9C, 0x9D, 0x9E, 0x9F,
169 0xB5, 0xD6, 0xE0, 0xE9, 0xA5, 0xA5, 0xA6, 0xA7,
170 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
171 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7,
172 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
173 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
174 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
175 0xD1, 0xD1, 0xD2, 0xD3, 0xD4, 0x49, 0xD6, 0xD7,
176 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
177 0xE0, 0xE1, 0xE2, 0xE3, 0x05, 0x05, 0xE6, 0xE8,
178 0xE8, 0xE9, 0xEA, 0xEB, 0xED, 0xED, 0xEE, 0xEF,
179 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
180 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
181 };
182
183 struct unicode_value fat_a2uni[256] = {
184
185 {0x00, 0x00}, {0x01, 0x00}, {0x02, 0x00}, {0x03, 0x00},
186 {0x04, 0x00}, {0x05, 0x00}, {0x06, 0x00}, {0x07, 0x00},
187 {0x08, 0x00}, {0x09, 0x00}, {0x0A, 0x00}, {0x0B, 0x00},
188 {0x0C, 0x00}, {0x0D, 0x00}, {0x0E, 0x00}, {0x0F, 0x00},
189
190 {0x10, 0x00}, {0x11, 0x00}, {0x12, 0x00}, {0x13, 0x00},
191 {0x14, 0x00}, {0x15, 0x00}, {0x16, 0x00}, {0x17, 0x00},
192 {0x18, 0x00}, {0x19, 0x00}, {0x1A, 0x00}, {0x1B, 0x00},
193 {0x1C, 0x00}, {0x1D, 0x00}, {0x1E, 0x00}, {0x1F, 0x00},
194
195 {0x20, 0x00}, {0x21, 0x00}, {0x22, 0x00}, {0x23, 0x00},
196 {0x24, 0x00}, {0x25, 0x00}, {0x26, 0x00}, {0x27, 0x00},
197 {0x28, 0x00}, {0x29, 0x00}, {0x2A, 0x00}, {0x2B, 0x00},
198 {0x2C, 0x00}, {0x2D, 0x00}, {0x2E, 0x00}, {0x2F, 0x00},
199
200 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
201 {0x34, 0x00}, {0x35, 0x00}, {0x36, 0x00}, {0x37, 0x00},
202 {0x38, 0x00}, {0x39, 0x00}, {0x3A, 0x00}, {0x3B, 0x00},
203 {0x3C, 0x00}, {0x3D, 0x00}, {0x3E, 0x00}, {0x3F, 0x00},
204
205 {0x40, 0x00}, {0x41, 0x00}, {0x42, 0x00}, {0x43, 0x00},
206 {0x44, 0x00}, {0x45, 0x00}, {0x46, 0x00}, {0x47, 0x00},
207 {0x48, 0x00}, {0x49, 0x00}, {0x4A, 0x00}, {0x4B, 0x00},
208 {0x4C, 0x00}, {0x4D, 0x00}, {0x4E, 0x00}, {0x4F, 0x00},
209
210 {0x50, 0x00}, {0x51, 0x00}, {0x52, 0x00}, {0x53, 0x00},
211 {0x54, 0x00}, {0x55, 0x00}, {0x56, 0x00}, {0x57, 0x00},
212 {0x58, 0x00}, {0x59, 0x00}, {0x5A, 0x00}, {0x5B, 0x00},
213 {0x5C, 0x00}, {0x5D, 0x00}, {0x5E, 0x00}, {0x5F, 0x00},
214
215 {0x60, 0x00}, {0x61, 0x00}, {0x62, 0x00}, {0x63, 0x00},
216 {0x64, 0x00}, {0x65, 0x00}, {0x66, 0x00}, {0x67, 0x00},
217 {0x68, 0x00}, {0x69, 0x00}, {0x6A, 0x00}, {0x6B, 0x00},
218 {0x6C, 0x00}, {0x6D, 0x00}, {0x6E, 0x00}, {0x6F, 0x00},
219
220 {0x70, 0x00}, {0x71, 0x00}, {0x72, 0x00}, {0x73, 0x00},
221 {0x74, 0x00}, {0x75, 0x00}, {0x76, 0x00}, {0x77, 0x00},
222 {0x78, 0x00}, {0x79, 0x00}, {0x7A, 0x00}, {0x7B, 0x00},
223 {0x7C, 0x00}, {0x7D, 0x00}, {0x7E, 0x00}, {0x7F, 0x00},
224
225 {0xC7, 0x00}, {0xFC, 0x00}, {0xE9, 0x00}, {0xE2, 0x00},
226 {0xE4, 0x00}, {0xE0, 0x00}, {0xE5, 0x00}, {0xE7, 0x00},
227 {0xEA, 0x00}, {0xEB, 0x00}, {0xE8, 0x00}, {0xEF, 0x00},
228 {0xEE, 0x00}, {0xEC, 0x00}, {0xC4, 0x00}, {0xC5, 0x00},
229
230 {0xC9, 0x00}, {0xE6, 0x00}, {0xC6, 0x00}, {0xF4, 0x00},
231 {0xF6, 0x00}, {0xF2, 0x00}, {0xFB, 0x00}, {0xF9, 0x00},
232 {0xFF, 0x00}, {0xD6, 0x00}, {0xDC, 0x00}, {0xF8, 0x00},
233 {0xA3, 0x00}, {0xD8, 0x00}, {0xD7, 0x00}, {0x92, 0x00},
234
235 {0xE1, 0x00}, {0xE0, 0x00}, {0xF3, 0x00}, {0xFA, 0x00},
236 {0xF1, 0x00}, {0xD1, 0x00}, {0xAA, 0x00}, {0xBA, 0x00},
237 {0xBF, 0x00}, {0xAE, 0x00}, {0xAC, 0x00}, {0xBD, 0x00},
238 {0xBC, 0x00}, {0xA1, 0x00}, {0xAB, 0x00}, {0xBB, 0x00},
239
240 {0x91, 0x25}, {0x92, 0x25}, {0x93, 0x25}, {0x02, 0x25},
241 {0x24, 0x25}, {0xC1, 0x00}, {0xC2, 0x00}, {0xC0, 0x00},
242 {0xA9, 0x00}, {0x63, 0x25}, {0x51, 0x25}, {0x57, 0x25},
243 {0x5D, 0x25}, {0xA2, 0x00}, {0xA5, 0x00}, {0x10, 0x25},
244
245 {0x14, 0x25}, {0x34, 0x25}, {0x2C, 0x25}, {0x1C, 0x25},
246 {0x00, 0x25}, {0x3C, 0x25}, {0xE3, 0x00}, {0xC3, 0x00},
247 {0x5A, 0x25}, {0x54, 0x25}, {0x69, 0x25}, {0x66, 0x25},
248 {0x60, 0x25}, {0x50, 0x25}, {0x6C, 0x25}, {0xA4, 0x00},
249
250 {0xF0, 0x00}, {0xD0, 0x00}, {0xCA, 0x00}, {0xCB, 0x00},
251 {0xC8, 0x00}, {0x31, 0x01}, {0xCD, 0x00}, {0xCE, 0x00},
252 {0xCF, 0x00}, {0x18, 0x25}, {0x0C, 0x25}, {0x88, 0x25},
253 {0x84, 0x25}, {0xA6, 0x00}, {0xCC, 0x00}, {0x80, 0x25},
254
255 {0xD3, 0x00}, {0xDF, 0x00}, {0xD4, 0x00}, {0xD2, 0x00},
256 {0xF5, 0x00}, {0xD5, 0x00}, {0xB5, 0x00}, {0xFE, 0x00},
257 {0xDE, 0x00}, {0xDA, 0x00}, {0xDB, 0x00}, {0xD9, 0x00},
258 {0xFD, 0x00}, {0xDD, 0x00}, {0xAF, 0x00}, {0xB4, 0x00},
259
260 {0xAD, 0x00}, {0xB1, 0x00}, {0x17, 0x20}, {0xBE, 0x00},
261 {0xB6, 0x00}, {0xA7, 0x00}, {0xF7, 0x00}, {0xB8, 0x00},
262 {0xB0, 0x00}, {0xA8, 0x00}, {0xB7, 0x00}, {0xB9, 0x00},
263 {0xB3, 0x00}, {0xB2, 0x00}, {0xA0, 0x25}, {0xA0, 0x00}};
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280