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