67 |
fat_mount (void) |
fat_mount (void) |
68 |
{ |
{ |
69 |
struct fat_bpb bpb; |
struct fat_bpb bpb; |
70 |
|
__u32 magic, first_fat; |
71 |
|
|
72 |
/* Check partition type for harddisk */ |
/* Check partition type for harddisk */ |
73 |
if (((current_drive & 0x80) || (current_slice != 0)) |
if (((current_drive & 0x80) || (current_slice != 0)) |
162 |
> FAT_SUPER->fat_length)) |
> FAT_SUPER->fat_length)) |
163 |
return 0; |
return 0; |
164 |
|
|
165 |
|
/* kbs: Media check on first FAT entry [ported from PUPA] */ |
166 |
|
|
167 |
|
if (!devread(FAT_SUPER->fat_offset, 0, |
168 |
|
sizeof(first_fat), (char *)&first_fat)) |
169 |
|
return 0; |
170 |
|
|
171 |
|
if (FAT_SUPER->fat_size == 8) |
172 |
|
{ |
173 |
|
first_fat &= 0x0fffffff; |
174 |
|
magic = 0x0fffff00; |
175 |
|
} |
176 |
|
else if (FAT_SUPER->fat_size == 4) |
177 |
|
{ |
178 |
|
first_fat &= 0x0000ffff; |
179 |
|
magic = 0xff00; |
180 |
|
} |
181 |
|
else |
182 |
|
{ |
183 |
|
first_fat &= 0x00000fff; |
184 |
|
magic = 0x0f00; |
185 |
|
} |
186 |
|
|
187 |
|
if (first_fat != (magic | bpb.media)) |
188 |
|
return 0; |
189 |
|
|
190 |
FAT_SUPER->cached_fat = - 2 * FAT_CACHE_SIZE; |
FAT_SUPER->cached_fat = - 2 * FAT_CACHE_SIZE; |
191 |
return 1; |
return 1; |
192 |
} |
} |