summaryrefslogtreecommitdiff
path: root/libparted/fs/fat/bootsector.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-05-13 21:26:17 +0200
committerJim Meyering <meyering@redhat.com>2011-05-27 17:07:45 +0200
commit58413d67ecb80740a07c3582d31883884cbb1966 (patch)
tree7683226939c6d1b4bb28b810cb61494a6ba03ea0 /libparted/fs/fat/bootsector.c
parentf82ca7907f2e1a614ce0f649ad08fc3739e5d1eb (diff)
downloadparted-58413d67ecb80740a07c3582d31883884cbb1966.tar.gz
fat: remove all-but-probe FS-related code
Diffstat (limited to 'libparted/fs/fat/bootsector.c')
-rw-r--r--libparted/fs/fat/bootsector.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/libparted/fs/fat/bootsector.c b/libparted/fs/fat/bootsector.c
index a5d69c3..6b78387 100644
--- a/libparted/fs/fat/bootsector.c
+++ b/libparted/fs/fat/bootsector.c
@@ -117,6 +117,23 @@ fat_boot_sector_probe_type (const FatBootSector* bs, const PedGeometry* geom)
return FAT_TYPE_FAT12;
}
+static int
+_fat_table_entry_size (FatType fat_type)
+{
+ 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;
+}
+
/* Analyses the boot sector, and sticks appropriate numbers in
fs->type_specific.
@@ -275,7 +292,7 @@ fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs)
= (fs_info->sector_count - fs_info->cluster_offset)
/ fs_info->cluster_sectors;
- fat_entry_size = fat_table_entry_size (fs_info->fat_type);
+ fat_entry_size = _fat_table_entry_size (fs_info->fat_type);
if (fs_info->cluster_count + 2
> fs_info->fat_sectors * 512 / fat_entry_size)
fs_info->cluster_count
@@ -419,26 +436,6 @@ fat_info_sector_read (FatInfoSector* is, const PedFileSystem* fs)
}
int
-fat_info_sector_generate (FatInfoSector* is, const PedFileSystem* fs)
-{
- FatSpecific* fs_info = FAT_SPECIFIC (fs);
-
- PED_ASSERT (is != NULL);
-
- fat_table_count_stats (fs_info->fat);
-
- memset (is, 0, 512);
-
- is->signature_1 = PED_CPU_TO_LE32 (FAT32_INFO_MAGIC1);
- is->signature_2 = PED_CPU_TO_LE32 (FAT32_INFO_MAGIC2);
- is->free_clusters = PED_CPU_TO_LE32 (fs_info->fat->free_cluster_count);
- is->next_cluster = PED_CPU_TO_LE32 (fs_info->fat->last_alloc);
- is->signature_3 = PED_CPU_TO_LE16 (FAT32_INFO_MAGIC3);
-
- return 1;
-}
-
-int
fat_info_sector_write (const FatInfoSector* is, PedFileSystem *fs)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);