From: Jim Meyering <meyer...@redhat.com> * libparted/fs/fat/bootsector.c (fat_boot_sector_generate) (fat_boot_sector_write, fat_info_sector_write): Remove functions. (fat_boot_sector_set_boot_code): Likewise. * libparted/fs/fat/bootsector.h: Remove declarations. * libparted/fs/fat/fat.c (fat_set_frag_sectors, fat_free_buffers): Remove function. * libparted/fs/fat/fat.h: Remove declarations. --- libparted/fs/fat/bootsector.c | 137 +---------------------------------------- libparted/fs/fat/bootsector.h | 4 - libparted/fs/fat/fat.c | 26 -------- libparted/fs/fat/fat.h | 3 - 4 files changed, 2 insertions(+), 168 deletions(-)
diff --git a/libparted/fs/fat/bootsector.c b/libparted/fs/fat/bootsector.c index f9d1069..c43940f 100644 --- a/libparted/fs/fat/bootsector.c +++ b/libparted/fs/fat/bootsector.c @@ -176,29 +176,14 @@ fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs) switch (ped_exception_throw ( PED_EXCEPTION_ERROR, - PED_EXCEPTION_FIX + PED_EXCEPTION_IGNORE - + PED_EXCEPTION_CANCEL, + PED_EXCEPTION_IGNORE_CANCEL, _("The file system's CHS geometry is (%d, %d, %d), " "which is invalid. The partition table's CHS " - "geometry is (%d, %d, %d). If you select Ignore, " - "the file system's CHS geometry will be left " - "unchanged. If you select Fix, the file system's " - "CHS geometry will be set to match the partition " - "table's CHS geometry."), + "geometry is (%d, %d, %d)."), cyl_count, fs_info->heads, fs_info->sectors_per_track, bios_geom->cylinders, bios_geom->heads, bios_geom->sectors)) { - case PED_EXCEPTION_FIX: - fs_info->sectors_per_track = bios_geom->sectors; - fs_info->heads = bios_geom->heads; - bs->secs_track - = PED_CPU_TO_LE16 (fs_info->sectors_per_track); - bs->heads = PED_CPU_TO_LE16 (fs_info->heads); - if (!fat_boot_sector_write (bs, fs)) - return 0; - break; - case PED_EXCEPTION_CANCEL: return 0; @@ -304,112 +289,6 @@ fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs) } #ifndef DISCOVER_ONLY -int -fat_boot_sector_set_boot_code (FatBootSector* bs) -{ - PED_ASSERT (bs != NULL); - - memset (bs, 0, 512); - memcpy (bs->boot_jump, FAT_BOOT_JUMP, 3); - memcpy (bs->u.fat32.boot_code, FAT_BOOT_CODE, FAT_BOOT_CODE_LENGTH); - return 1; -} - -int -fat_boot_sector_generate (FatBootSector* bs, const PedFileSystem* fs) -{ - FatSpecific* fs_info = FAT_SPECIFIC (fs); - - PED_ASSERT (bs != NULL); - - memcpy (bs->system_id, "MSWIN4.1", 8); - bs->sector_size = PED_CPU_TO_LE16 (fs_info->logical_sector_size * 512); - bs->cluster_size = fs_info->cluster_sectors - / fs_info->logical_sector_size; - bs->reserved = PED_CPU_TO_LE16 (fs_info->fat_offset - / fs_info->logical_sector_size); - bs->fats = fs_info->fat_table_count; - - bs->dir_entries = (fs_info->fat_type == FAT_TYPE_FAT16) - ? PED_CPU_TO_LE16 (fs_info->root_dir_entry_count) - : 0; - - if (fs_info->sector_count / fs_info->logical_sector_size > 0xffff - || fs_info->fat_type == FAT_TYPE_FAT32) { - bs->sectors = 0; - bs->sector_count = PED_CPU_TO_LE32 (fs_info->sector_count - / fs_info->logical_sector_size); - } else { - bs->sectors = PED_CPU_TO_LE16 (fs_info->sector_count - / fs_info->logical_sector_size); - bs->sector_count = 0; - } - - bs->media = 0xf8; - - bs->secs_track = PED_CPU_TO_LE16 (fs_info->sectors_per_track); - bs->heads = PED_CPU_TO_LE16 (fs_info->heads); - bs->hidden = PED_CPU_TO_LE32 (fs->geom->start); - - if (fs_info->fat_type == FAT_TYPE_FAT32) { - bs->fat_length = 0; - bs->u.fat32.fat_length = PED_CPU_TO_LE32 (fs_info->fat_sectors - / fs_info->logical_sector_size); - bs->u.fat32.flags = 0; /* FIXME: what the hell are these? */ - bs->u.fat32.version = 0; /* must be 0, for Win98 bootstrap */ - bs->u.fat32.root_dir_cluster - = PED_CPU_TO_LE32 (fs_info->root_cluster); - bs->u.fat32.info_sector - = PED_CPU_TO_LE16 (fs_info->info_sector_offset - / fs_info->logical_sector_size); - bs->u.fat32.backup_sector - = PED_CPU_TO_LE16 (fs_info->boot_sector_backup_offset - / fs_info->logical_sector_size); - - bs->u.fat32.drive_num = 0x80; /* _ALWAYS_ 0x80. silly DOS */ - - memset (bs->u.fat32.empty_1, 0, 12); - - bs->u.fat32.ext_signature = 0x29; - bs->u.fat32.serial_number - = PED_CPU_TO_LE32 (fs_info->serial_number); - memcpy (bs->u.fat32.volume_name, "NO NAME ", 11); - memcpy (bs->u.fat32.fat_name, "FAT32 ", 8); - } else { - bs->fat_length - = PED_CPU_TO_LE16 (fs_info->fat_sectors - / fs_info->logical_sector_size); - - bs->u.fat16.drive_num = 0x80; /* _ALWAYS_ 0x80. silly DOS */ - - bs->u.fat16.ext_signature = 0x29; - bs->u.fat16.serial_number - = PED_CPU_TO_LE32 (fs_info->serial_number); - memcpy (bs->u.fat16.volume_name, "NO NAME ", 11); - memcpy (bs->u.fat16.fat_name, "FAT16 ", 8); - } - - bs->boot_sign = PED_CPU_TO_LE16 (0xaa55); - - return 1; -} - -int -fat_boot_sector_write (const FatBootSector* bs, PedFileSystem* fs) -{ - FatSpecific* fs_info = FAT_SPECIFIC (fs); - - PED_ASSERT (bs != NULL); - - if (!ped_geometry_write (fs->geom, bs, 0, 1)) - return 0; - if (fs_info->fat_type == FAT_TYPE_FAT32) { - if (!ped_geometry_write (fs->geom, bs, - fs_info->boot_sector_backup_offset, 1)) - return 0; - } - return ped_geometry_sync (fs->geom); -} int fat_info_sector_read (FatInfoSector* is, const PedFileSystem* fs) @@ -434,16 +313,4 @@ fat_info_sector_read (FatInfoSector* is, const PedFileSystem* fs) } return 1; } - -int -fat_info_sector_write (const FatInfoSector* is, PedFileSystem *fs) -{ - FatSpecific* fs_info = FAT_SPECIFIC (fs); - - PED_ASSERT (is != NULL); - - if (!ped_geometry_write (fs->geom, is, fs_info->info_sector_offset, 1)) - return 0; - return ped_geometry_sync (fs->geom); -} #endif /* !DISCOVER_ONLY */ diff --git a/libparted/fs/fat/bootsector.h b/libparted/fs/fat/bootsector.h index 0fa5edf..2b51cd1 100644 --- a/libparted/fs/fat/bootsector.h +++ b/libparted/fs/fat/bootsector.h @@ -120,11 +120,7 @@ int fat_boot_sector_read (FatBootSector* bs, const PedGeometry* geom); FatType fat_boot_sector_probe_type (const FatBootSector* bs, const PedGeometry* geom); int fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs); -int fat_boot_sector_set_boot_code (FatBootSector* bs); -int fat_boot_sector_generate (FatBootSector* bs, const PedFileSystem* fs); -int fat_boot_sector_write (const FatBootSector* bs, PedFileSystem* fs); int fat_info_sector_read (FatInfoSector* is, const PedFileSystem* fs); -int fat_info_sector_write (const FatInfoSector* is, PedFileSystem* fs); #endif /* PED_FAT_BOOTSECTOR_H */ diff --git a/libparted/fs/fat/fat.c b/libparted/fs/fat/fat.c index cdfb83a..62e8790 100644 --- a/libparted/fs/fat/fat.c +++ b/libparted/fs/fat/fat.c @@ -51,15 +51,6 @@ error: } void -fat_free_buffers (PedFileSystem* fs) -{ - FatSpecific* fs_info = FAT_SPECIFIC (fs); - - free (fs_info->cluster_info); - free (fs_info->buffer); -} - -void fat_free (PedFileSystem* fs) { ped_geometry_destroy (fs->geom); @@ -67,23 +58,6 @@ fat_free (PedFileSystem* fs) free (fs); } -int -fat_set_frag_sectors (PedFileSystem* fs, PedSector frag_sectors) -{ - FatSpecific* fs_info = FAT_SPECIFIC (fs); - - PED_ASSERT (fs_info->cluster_sectors % frag_sectors == 0 - && frag_sectors <= fs_info->cluster_sectors); - - fs_info->frag_size = frag_sectors * 512; - fs_info->frag_sectors = frag_sectors; - fs_info->buffer_frags = fs_info->buffer_sectors / frag_sectors; - fs_info->cluster_frags = fs_info->cluster_sectors / frag_sectors; - fs_info->frag_count = fs_info->cluster_count * fs_info->cluster_frags; - - return 1; -} - PedGeometry* fat_probe (PedGeometry* geom, FatType* fat_type) { diff --git a/libparted/fs/fat/fat.h b/libparted/fs/fat/fat.h index dddc461..b1b96ba 100644 --- a/libparted/fs/fat/fat.h +++ b/libparted/fs/fat/fat.h @@ -156,10 +156,7 @@ extern void fat_print (const PedFileSystem* fs); extern PedFileSystem* fat_alloc (const PedGeometry* geom); extern void fat_free (PedFileSystem* fs); extern int fat_alloc_buffers (PedFileSystem* fs); -extern void fat_free_buffers (PedFileSystem* fs); extern int fat_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer); -extern int fat_set_frag_sectors (PedFileSystem* fs, PedSector frag_sectors); - #endif /* FAT_H_INCLUDED */ -- 1.7.9.112.gb85f2