/*
libparted
Copyright (C) 1998-2000, 2007-2010 Free Software Foundation, Inc.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include "fat.h"
#ifndef DISCOVER_ONLY
{
/* ensure there's some free room on the end, to finish off the sector */
return NULL;
}
return ft;
}
void
{
}
{
return dup_ft;
}
void
{
ft->bad_cluster_count = 0;
}
int
{
return fat_table_count_stats (ft);
}
int
{
FatCluster i;
ft->free_cluster_count = 0;
ft->bad_cluster_count = 0;
if (fat_table_is_available (ft, i))
ft->free_cluster_count++;
if (fat_table_is_bad (ft, i))
ft->bad_cluster_count++;
}
return 1;
}
int
{
return 0;
if (ped_exception_throw (
_("FAT %d media %x doesn't match the boot sector's "
"media %x. You should probably run scandisk."),
(int) table_num + 1,
return 0;
}
return 1;
}
int
{
return 0;
return 0;
return 1;
}
int
{
int i;
for (i = 0; i < fs_info->fat_table_count; i++) {
return 0;
}
return 1;
}
int
{
FatCluster i;
if (a->cluster_count != b->cluster_count)
return 0;
for (i = 0; i < a->cluster_count + 2; i++) {
if (fat_table_get (a, i) != fat_table_get (b, i))
return 0;
}
return 1;
}
static int
{
return code == 0;
}
static int
{
case FAT_TYPE_FAT12:
break;
case FAT_TYPE_FAT16:
break;
case FAT_TYPE_FAT32:
break;
}
return 0;
}
static int
{
case FAT_TYPE_FAT12:
break;
case FAT_TYPE_FAT16:
break;
case FAT_TYPE_FAT32:
break;
}
return 0;
}
void
{
ft->free_cluster_count++;
ft->bad_cluster_count--;
}
ft->free_cluster_count--;
ft->bad_cluster_count--;
}
}
int
{
_("fat_table_set: cluster %ld outside "
"file system"),
(long) cluster);
return 0;
}
case FAT_TYPE_FAT12:
PED_ASSERT (0, (void) 0);
break;
case FAT_TYPE_FAT16:
= PED_CPU_TO_LE16 (value);
break;
case FAT_TYPE_FAT32:
= PED_CPU_TO_LE32 (value);
break;
}
return 1;
}
{
_("fat_table_get: cluster %ld outside "
"file system"),
(long) cluster);
}
case FAT_TYPE_FAT12:
PED_ASSERT (0, (void) 0);
break;
case FAT_TYPE_FAT16:
return PED_LE16_TO_CPU
case FAT_TYPE_FAT32:
return PED_LE32_TO_CPU
}
return 0;
}
{
FatCluster i;
/* hack: assumes the first two FAT entries are marked as used (which they
* always should be)
*/
return cluster;
}
}
_("fat_table_alloc_cluster: no free clusters"));
return 0;
}
{
while (1) {
if (!result)
return 0;
return result;
}
}
/*
returns true if <cluster> is marked as bad
*/
int
{
}
/*
returns true if <cluster> represents an EOF marker
*/
int
{
}
/*
returns true if <cluster> is available.
*/
int
{
}
/*
returns true if <cluster> is empty. Note that this includes bad clusters.
*/
int
{
}
/*
returns true if <cluster> is being used for something constructive.
*/
int
{
}
/*
marks <cluster> as the last cluster in the chain
*/
int
{
case FAT_TYPE_FAT12:
PED_ASSERT (0, (void) 0);
break;
case FAT_TYPE_FAT16:
case FAT_TYPE_FAT32:
}
return 0;
}
/*
Marks a clusters as unusable, due to physical disk damage.
*/
int
{
ft->bad_cluster_count++;
case FAT_TYPE_FAT12:
case FAT_TYPE_FAT16:
case FAT_TYPE_FAT32:
}
return 0;
}
/*
*/
int
{
}
#endif /* !DISCOVER_ONLY */
int
{
switch (fat_type) {
case FAT_TYPE_FAT12:
return 2; /* FIXME: how? */
case FAT_TYPE_FAT16:
return 2;
case FAT_TYPE_FAT32:
return 4;
}
return 0;
}