1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate *
4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate * with the License.
8*7c478bd9Sstevel@tonic-gate *
9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate *
14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate *
20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate * Copyright (c) 1999 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate * All rights reserved.
25*7c478bd9Sstevel@tonic-gate */
26*7c478bd9Sstevel@tonic-gate
27*7c478bd9Sstevel@tonic-gate /*
28*7c478bd9Sstevel@tonic-gate * fsck_pcfs -- routines for manipulating the FAT.
29*7c478bd9Sstevel@tonic-gate */
30*7c478bd9Sstevel@tonic-gate #include <stdio.h>
31*7c478bd9Sstevel@tonic-gate #include <unistd.h>
32*7c478bd9Sstevel@tonic-gate #include <stdlib.h>
33*7c478bd9Sstevel@tonic-gate #include <libintl.h>
34*7c478bd9Sstevel@tonic-gate #include <sys/dktp/fdisk.h>
35*7c478bd9Sstevel@tonic-gate #include <sys/fs/pc_fs.h>
36*7c478bd9Sstevel@tonic-gate #include <sys/fs/pc_dir.h>
37*7c478bd9Sstevel@tonic-gate #include <sys/fs/pc_label.h>
38*7c478bd9Sstevel@tonic-gate #include "pcfs_common.h"
39*7c478bd9Sstevel@tonic-gate #include "fsck_pcfs.h"
40*7c478bd9Sstevel@tonic-gate
41*7c478bd9Sstevel@tonic-gate extern int32_t BytesPerCluster;
42*7c478bd9Sstevel@tonic-gate extern int32_t TotalClusters;
43*7c478bd9Sstevel@tonic-gate extern int32_t LastCluster;
44*7c478bd9Sstevel@tonic-gate extern off64_t FirstClusterOffset;
45*7c478bd9Sstevel@tonic-gate extern off64_t PartitionOffset;
46*7c478bd9Sstevel@tonic-gate extern bpb_t TheBIOSParameterBlock;
47*7c478bd9Sstevel@tonic-gate extern int ReadOnly;
48*7c478bd9Sstevel@tonic-gate extern int IsFAT32;
49*7c478bd9Sstevel@tonic-gate extern int Verbose;
50*7c478bd9Sstevel@tonic-gate
51*7c478bd9Sstevel@tonic-gate static uchar_t *TheFAT;
52*7c478bd9Sstevel@tonic-gate static int FATRewriteNeeded = 0;
53*7c478bd9Sstevel@tonic-gate
54*7c478bd9Sstevel@tonic-gate int32_t FATSize;
55*7c478bd9Sstevel@tonic-gate short FATEntrySize;
56*7c478bd9Sstevel@tonic-gate
57*7c478bd9Sstevel@tonic-gate static off64_t
seekFAT(int fd)58*7c478bd9Sstevel@tonic-gate seekFAT(int fd)
59*7c478bd9Sstevel@tonic-gate {
60*7c478bd9Sstevel@tonic-gate off64_t seekto;
61*7c478bd9Sstevel@tonic-gate /*
62*7c478bd9Sstevel@tonic-gate * The FAT(s) immediately follows the reserved sectors.
63*7c478bd9Sstevel@tonic-gate */
64*7c478bd9Sstevel@tonic-gate seekto = TheBIOSParameterBlock.bpb.resv_sectors *
65*7c478bd9Sstevel@tonic-gate TheBIOSParameterBlock.bpb.bytes_per_sector + PartitionOffset;
66*7c478bd9Sstevel@tonic-gate return (lseek64(fd, seekto, SEEK_SET));
67*7c478bd9Sstevel@tonic-gate }
68*7c478bd9Sstevel@tonic-gate
69*7c478bd9Sstevel@tonic-gate void
getFAT(int fd)70*7c478bd9Sstevel@tonic-gate getFAT(int fd)
71*7c478bd9Sstevel@tonic-gate {
72*7c478bd9Sstevel@tonic-gate ssize_t bytesRead;
73*7c478bd9Sstevel@tonic-gate
74*7c478bd9Sstevel@tonic-gate if (TheFAT != NULL) {
75*7c478bd9Sstevel@tonic-gate return;
76*7c478bd9Sstevel@tonic-gate } else if ((TheFAT = (uchar_t *)malloc(FATSize)) == NULL) {
77*7c478bd9Sstevel@tonic-gate mountSanityCheckFails();
78*7c478bd9Sstevel@tonic-gate perror(gettext("No memory for a copy of the FAT"));
79*7c478bd9Sstevel@tonic-gate (void) close(fd);
80*7c478bd9Sstevel@tonic-gate exit(7);
81*7c478bd9Sstevel@tonic-gate }
82*7c478bd9Sstevel@tonic-gate if (seekFAT(fd) < 0) {
83*7c478bd9Sstevel@tonic-gate mountSanityCheckFails();
84*7c478bd9Sstevel@tonic-gate perror(gettext("Cannot seek to FAT"));
85*7c478bd9Sstevel@tonic-gate (void) close(fd);
86*7c478bd9Sstevel@tonic-gate exit(7);
87*7c478bd9Sstevel@tonic-gate }
88*7c478bd9Sstevel@tonic-gate if (Verbose)
89*7c478bd9Sstevel@tonic-gate (void) fprintf(stderr,
90*7c478bd9Sstevel@tonic-gate gettext("Reading FAT\n"));
91*7c478bd9Sstevel@tonic-gate if ((bytesRead = read(fd, TheFAT, FATSize)) != FATSize) {
92*7c478bd9Sstevel@tonic-gate mountSanityCheckFails();
93*7c478bd9Sstevel@tonic-gate if (bytesRead < 0) {
94*7c478bd9Sstevel@tonic-gate perror(gettext("Cannot read a FAT"));
95*7c478bd9Sstevel@tonic-gate } else {
96*7c478bd9Sstevel@tonic-gate (void) fprintf(stderr,
97*7c478bd9Sstevel@tonic-gate gettext("Short read of FAT."));
98*7c478bd9Sstevel@tonic-gate }
99*7c478bd9Sstevel@tonic-gate (void) close(fd);
100*7c478bd9Sstevel@tonic-gate exit(7);
101*7c478bd9Sstevel@tonic-gate }
102*7c478bd9Sstevel@tonic-gate /*
103*7c478bd9Sstevel@tonic-gate * XXX - might want to read the other copies of the FAT
104*7c478bd9Sstevel@tonic-gate * for comparison and/or to use if the first one seems hosed.
105*7c478bd9Sstevel@tonic-gate */
106*7c478bd9Sstevel@tonic-gate if (Verbose) {
107*7c478bd9Sstevel@tonic-gate (void) fprintf(stderr,
108*7c478bd9Sstevel@tonic-gate gettext("Dump of FAT's first 32 bytes.\n"));
109*7c478bd9Sstevel@tonic-gate header_for_dump();
110*7c478bd9Sstevel@tonic-gate dump_bytes(TheFAT, 32);
111*7c478bd9Sstevel@tonic-gate }
112*7c478bd9Sstevel@tonic-gate }
113*7c478bd9Sstevel@tonic-gate
114*7c478bd9Sstevel@tonic-gate void
writeFATMods(int fd)115*7c478bd9Sstevel@tonic-gate writeFATMods(int fd)
116*7c478bd9Sstevel@tonic-gate {
117*7c478bd9Sstevel@tonic-gate ssize_t bytesWritten;
118*7c478bd9Sstevel@tonic-gate
119*7c478bd9Sstevel@tonic-gate if (TheFAT == NULL) {
120*7c478bd9Sstevel@tonic-gate (void) fprintf(stderr,
121*7c478bd9Sstevel@tonic-gate gettext("Internal error: No FAT to write\n"));
122*7c478bd9Sstevel@tonic-gate (void) close(fd);
123*7c478bd9Sstevel@tonic-gate exit(11);
124*7c478bd9Sstevel@tonic-gate }
125*7c478bd9Sstevel@tonic-gate if (!FATRewriteNeeded) {
126*7c478bd9Sstevel@tonic-gate if (Verbose) {
127*7c478bd9Sstevel@tonic-gate (void) fprintf(stderr,
128*7c478bd9Sstevel@tonic-gate gettext("No FAT changes need to be written.\n"));
129*7c478bd9Sstevel@tonic-gate }
130*7c478bd9Sstevel@tonic-gate return;
131*7c478bd9Sstevel@tonic-gate }
132*7c478bd9Sstevel@tonic-gate if (ReadOnly)
133*7c478bd9Sstevel@tonic-gate return;
134*7c478bd9Sstevel@tonic-gate if (Verbose)
135*7c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext("Writing FAT\n"));
136*7c478bd9Sstevel@tonic-gate if (seekFAT(fd) < 0) {
137*7c478bd9Sstevel@tonic-gate perror(gettext("Cannot seek to FAT"));
138*7c478bd9Sstevel@tonic-gate (void) close(fd);
139*7c478bd9Sstevel@tonic-gate exit(11);
140*7c478bd9Sstevel@tonic-gate }
141*7c478bd9Sstevel@tonic-gate if ((bytesWritten = write(fd, TheFAT, FATSize)) != FATSize) {
142*7c478bd9Sstevel@tonic-gate if (bytesWritten < 0) {
143*7c478bd9Sstevel@tonic-gate perror(gettext("Cannot write FAT"));
144*7c478bd9Sstevel@tonic-gate } else {
145*7c478bd9Sstevel@tonic-gate (void) fprintf(stderr,
146*7c478bd9Sstevel@tonic-gate gettext("Short write of FAT."));
147*7c478bd9Sstevel@tonic-gate }
148*7c478bd9Sstevel@tonic-gate (void) close(fd);
149*7c478bd9Sstevel@tonic-gate exit(11);
150*7c478bd9Sstevel@tonic-gate }
151*7c478bd9Sstevel@tonic-gate FATRewriteNeeded = 0;
152*7c478bd9Sstevel@tonic-gate }
153*7c478bd9Sstevel@tonic-gate
154*7c478bd9Sstevel@tonic-gate /*
155*7c478bd9Sstevel@tonic-gate * checkFAT32CleanBit()
156*7c478bd9Sstevel@tonic-gate * Return non-zero if the bit indicating proper Windows shutdown has
157*7c478bd9Sstevel@tonic-gate * been set.
158*7c478bd9Sstevel@tonic-gate */
159*7c478bd9Sstevel@tonic-gate int
checkFAT32CleanBit(int fd)160*7c478bd9Sstevel@tonic-gate checkFAT32CleanBit(int fd)
161*7c478bd9Sstevel@tonic-gate {
162*7c478bd9Sstevel@tonic-gate getFAT(fd);
163*7c478bd9Sstevel@tonic-gate return (TheFAT[WIN_SHUTDOWN_STATUS_BYTE] & WIN_SHUTDOWN_BIT_MASK);
164*7c478bd9Sstevel@tonic-gate }
165*7c478bd9Sstevel@tonic-gate
166*7c478bd9Sstevel@tonic-gate static uchar_t *
findClusterEntryInFAT(int32_t currentCluster)167*7c478bd9Sstevel@tonic-gate findClusterEntryInFAT(int32_t currentCluster)
168*7c478bd9Sstevel@tonic-gate {
169*7c478bd9Sstevel@tonic-gate int32_t idx;
170*7c478bd9Sstevel@tonic-gate if (FATEntrySize == 32) {
171*7c478bd9Sstevel@tonic-gate idx = currentCluster * 4;
172*7c478bd9Sstevel@tonic-gate } else if (FATEntrySize == 16) {
173*7c478bd9Sstevel@tonic-gate idx = currentCluster * 2;
174*7c478bd9Sstevel@tonic-gate } else {
175*7c478bd9Sstevel@tonic-gate idx = currentCluster + currentCluster/2;
176*7c478bd9Sstevel@tonic-gate }
177*7c478bd9Sstevel@tonic-gate return (TheFAT + idx);
178*7c478bd9Sstevel@tonic-gate }
179*7c478bd9Sstevel@tonic-gate
180*7c478bd9Sstevel@tonic-gate /*
181*7c478bd9Sstevel@tonic-gate * {read,write}FATentry
182*7c478bd9Sstevel@tonic-gate * For the 16 and 32 bit FATs these routines are relatively easy
183*7c478bd9Sstevel@tonic-gate * to follow.
184*7c478bd9Sstevel@tonic-gate *
185*7c478bd9Sstevel@tonic-gate * 12 bit FATs are kind of strange, though. The magic index for
186*7c478bd9Sstevel@tonic-gate * 12 bit FATS computed below, 1.5 * clusterNum, is a
187*7c478bd9Sstevel@tonic-gate * simplification that there are 8 bits in a byte, so you need
188*7c478bd9Sstevel@tonic-gate * 1.5 bytes per entry.
189*7c478bd9Sstevel@tonic-gate *
190*7c478bd9Sstevel@tonic-gate * It's easiest to think about FAT12 entries in pairs:
191*7c478bd9Sstevel@tonic-gate *
192*7c478bd9Sstevel@tonic-gate * ---------------------------------------------
193*7c478bd9Sstevel@tonic-gate * | mid1 | low1 | low2 | high1 | high2 | mid2 |
194*7c478bd9Sstevel@tonic-gate * ---------------------------------------------
195*7c478bd9Sstevel@tonic-gate *
196*7c478bd9Sstevel@tonic-gate * Each box in the diagram represents a nibble (4 bits) of a FAT
197*7c478bd9Sstevel@tonic-gate * entry. A FAT entry is made up of three nibbles. So if you
198*7c478bd9Sstevel@tonic-gate * look closely, you'll see that first byte of the pair of
199*7c478bd9Sstevel@tonic-gate * entries contains the low and middle nibbles of the first
200*7c478bd9Sstevel@tonic-gate * entry. The second byte has the low nibble of the second entry
201*7c478bd9Sstevel@tonic-gate * and the high nibble of the first entry. Those two bytes alone
202*7c478bd9Sstevel@tonic-gate * are enough to read the first entry. The second FAT entry is
203*7c478bd9Sstevel@tonic-gate * finished out by the last nibble pair.
204*7c478bd9Sstevel@tonic-gate */
205*7c478bd9Sstevel@tonic-gate int32_t
readFATEntry(int32_t currentCluster)206*7c478bd9Sstevel@tonic-gate readFATEntry(int32_t currentCluster)
207*7c478bd9Sstevel@tonic-gate {
208*7c478bd9Sstevel@tonic-gate int32_t value;
209*7c478bd9Sstevel@tonic-gate uchar_t *ep;
210*7c478bd9Sstevel@tonic-gate
211*7c478bd9Sstevel@tonic-gate ep = findClusterEntryInFAT(currentCluster);
212*7c478bd9Sstevel@tonic-gate if (FATEntrySize == 32) {
213*7c478bd9Sstevel@tonic-gate read_32_bits(ep, (uint32_t *)&value);
214*7c478bd9Sstevel@tonic-gate } else if (FATEntrySize == 16) {
215*7c478bd9Sstevel@tonic-gate read_16_bits(ep, (uint32_t *)&value);
216*7c478bd9Sstevel@tonic-gate /*
217*7c478bd9Sstevel@tonic-gate * Convert 16 bit entry to 32 bit if we are
218*7c478bd9Sstevel@tonic-gate * into the reserved or higher values.
219*7c478bd9Sstevel@tonic-gate */
220*7c478bd9Sstevel@tonic-gate if (value >= PCF_RESCLUSTER)
221*7c478bd9Sstevel@tonic-gate value |= 0xFFF0000;
222*7c478bd9Sstevel@tonic-gate } else {
223*7c478bd9Sstevel@tonic-gate value = 0;
224*7c478bd9Sstevel@tonic-gate if (currentCluster & 1) {
225*7c478bd9Sstevel@tonic-gate /*
226*7c478bd9Sstevel@tonic-gate * Odd numbered cluster
227*7c478bd9Sstevel@tonic-gate */
228*7c478bd9Sstevel@tonic-gate value = (((unsigned int)*ep++ & 0xf0) >> 4);
229*7c478bd9Sstevel@tonic-gate value += (*ep << 4);
230*7c478bd9Sstevel@tonic-gate } else {
231*7c478bd9Sstevel@tonic-gate value = *ep++;
232*7c478bd9Sstevel@tonic-gate value += ((*ep & 0x0f) << 8);
233*7c478bd9Sstevel@tonic-gate }
234*7c478bd9Sstevel@tonic-gate /*
235*7c478bd9Sstevel@tonic-gate * Convert 12 bit entry to 32 bit if we are
236*7c478bd9Sstevel@tonic-gate * into the reserved or higher values.
237*7c478bd9Sstevel@tonic-gate */
238*7c478bd9Sstevel@tonic-gate if (value >= PCF_12BCLUSTER)
239*7c478bd9Sstevel@tonic-gate value |= 0xFFFF000;
240*7c478bd9Sstevel@tonic-gate }
241*7c478bd9Sstevel@tonic-gate return (value);
242*7c478bd9Sstevel@tonic-gate }
243*7c478bd9Sstevel@tonic-gate
244*7c478bd9Sstevel@tonic-gate void
writeFATEntry(int32_t currentCluster,int32_t value)245*7c478bd9Sstevel@tonic-gate writeFATEntry(int32_t currentCluster, int32_t value)
246*7c478bd9Sstevel@tonic-gate {
247*7c478bd9Sstevel@tonic-gate uchar_t *ep;
248*7c478bd9Sstevel@tonic-gate
249*7c478bd9Sstevel@tonic-gate FATRewriteNeeded = 1;
250*7c478bd9Sstevel@tonic-gate ep = findClusterEntryInFAT(currentCluster);
251*7c478bd9Sstevel@tonic-gate if (FATEntrySize == 32) {
252*7c478bd9Sstevel@tonic-gate store_32_bits(&ep, value);
253*7c478bd9Sstevel@tonic-gate } else if (FATEntrySize == 16) {
254*7c478bd9Sstevel@tonic-gate store_16_bits(&ep, value);
255*7c478bd9Sstevel@tonic-gate } else {
256*7c478bd9Sstevel@tonic-gate if (currentCluster & 1) {
257*7c478bd9Sstevel@tonic-gate /*
258*7c478bd9Sstevel@tonic-gate * Odd numbered cluster
259*7c478bd9Sstevel@tonic-gate */
260*7c478bd9Sstevel@tonic-gate *ep = (*ep & 0x0f) | ((value << 4) & 0xf0);
261*7c478bd9Sstevel@tonic-gate ep++;
262*7c478bd9Sstevel@tonic-gate *ep = (value >> 4) & 0xff;
263*7c478bd9Sstevel@tonic-gate } else {
264*7c478bd9Sstevel@tonic-gate *ep++ = value & 0xff;
265*7c478bd9Sstevel@tonic-gate *ep = (*ep & 0xf0) | ((value >> 8) & 0x0f);
266*7c478bd9Sstevel@tonic-gate }
267*7c478bd9Sstevel@tonic-gate }
268*7c478bd9Sstevel@tonic-gate }
269*7c478bd9Sstevel@tonic-gate
270*7c478bd9Sstevel@tonic-gate /*
271*7c478bd9Sstevel@tonic-gate * reservedInFAT - Is this cluster marked in the reserved range?
272*7c478bd9Sstevel@tonic-gate * The range from PCF_RESCLUSTER32 to PCF_BADCLUSTER32 - 1,
273*7c478bd9Sstevel@tonic-gate * have been reserved by Microsoft. No cluster should be
274*7c478bd9Sstevel@tonic-gate * marked with these; they are effectively invalid cluster values.
275*7c478bd9Sstevel@tonic-gate */
276*7c478bd9Sstevel@tonic-gate int
reservedInFAT(int32_t clusterNum)277*7c478bd9Sstevel@tonic-gate reservedInFAT(int32_t clusterNum)
278*7c478bd9Sstevel@tonic-gate {
279*7c478bd9Sstevel@tonic-gate int32_t e;
280*7c478bd9Sstevel@tonic-gate
281*7c478bd9Sstevel@tonic-gate e = readFATEntry(clusterNum);
282*7c478bd9Sstevel@tonic-gate return (e >= PCF_RESCLUSTER32 && e < PCF_BADCLUSTER32);
283*7c478bd9Sstevel@tonic-gate }
284*7c478bd9Sstevel@tonic-gate
285*7c478bd9Sstevel@tonic-gate /*
286*7c478bd9Sstevel@tonic-gate * badInFAT - Is this cluster marked as bad? I.e., is it inaccessible?
287*7c478bd9Sstevel@tonic-gate */
288*7c478bd9Sstevel@tonic-gate int
badInFAT(int32_t clusterNum)289*7c478bd9Sstevel@tonic-gate badInFAT(int32_t clusterNum)
290*7c478bd9Sstevel@tonic-gate {
291*7c478bd9Sstevel@tonic-gate return (readFATEntry(clusterNum) == PCF_BADCLUSTER32);
292*7c478bd9Sstevel@tonic-gate }
293*7c478bd9Sstevel@tonic-gate
294*7c478bd9Sstevel@tonic-gate /*
295*7c478bd9Sstevel@tonic-gate * lastInFAT - Is this cluster marked as free? I.e., is it available
296*7c478bd9Sstevel@tonic-gate * for use?
297*7c478bd9Sstevel@tonic-gate */
298*7c478bd9Sstevel@tonic-gate int
freeInFAT(int32_t clusterNum)299*7c478bd9Sstevel@tonic-gate freeInFAT(int32_t clusterNum)
300*7c478bd9Sstevel@tonic-gate {
301*7c478bd9Sstevel@tonic-gate return (readFATEntry(clusterNum) == PCF_FREECLUSTER);
302*7c478bd9Sstevel@tonic-gate }
303*7c478bd9Sstevel@tonic-gate
304*7c478bd9Sstevel@tonic-gate /*
305*7c478bd9Sstevel@tonic-gate * lastInFAT - Is this cluster the last in its cluster chain?
306*7c478bd9Sstevel@tonic-gate */
307*7c478bd9Sstevel@tonic-gate int
lastInFAT(int32_t clusterNum)308*7c478bd9Sstevel@tonic-gate lastInFAT(int32_t clusterNum)
309*7c478bd9Sstevel@tonic-gate {
310*7c478bd9Sstevel@tonic-gate return (readFATEntry(clusterNum) == PCF_LASTCLUSTER32);
311*7c478bd9Sstevel@tonic-gate }
312*7c478bd9Sstevel@tonic-gate
313*7c478bd9Sstevel@tonic-gate /*
314*7c478bd9Sstevel@tonic-gate * markLastInFAT - Mark this cluster as the last in its cluster chain.
315*7c478bd9Sstevel@tonic-gate */
316*7c478bd9Sstevel@tonic-gate void
markLastInFAT(int32_t clusterNum)317*7c478bd9Sstevel@tonic-gate markLastInFAT(int32_t clusterNum)
318*7c478bd9Sstevel@tonic-gate {
319*7c478bd9Sstevel@tonic-gate writeFATEntry(clusterNum, PCF_LASTCLUSTER32);
320*7c478bd9Sstevel@tonic-gate }
321*7c478bd9Sstevel@tonic-gate
322*7c478bd9Sstevel@tonic-gate void
markFreeInFAT(int32_t clusterNum)323*7c478bd9Sstevel@tonic-gate markFreeInFAT(int32_t clusterNum)
324*7c478bd9Sstevel@tonic-gate {
325*7c478bd9Sstevel@tonic-gate writeFATEntry(clusterNum, PCF_FREECLUSTER);
326*7c478bd9Sstevel@tonic-gate }
327*7c478bd9Sstevel@tonic-gate
328*7c478bd9Sstevel@tonic-gate void
markBadInFAT(int32_t clusterNum)329*7c478bd9Sstevel@tonic-gate markBadInFAT(int32_t clusterNum)
330*7c478bd9Sstevel@tonic-gate {
331*7c478bd9Sstevel@tonic-gate writeFATEntry(clusterNum, PCF_BADCLUSTER32);
332*7c478bd9Sstevel@tonic-gate }
333