1 /* 2 libparted 3 Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef PED_FAT_TABLE_H_INCLUDED 20 #define PED_FAT_TABLE_H_INCLUDED 21 22 typedef struct _FatTable FatTable; 23 24 #include "fat.h" 25 26 struct _FatTable { 27 void* table; 28 FatCluster size; 29 int raw_size; 30 31 FatType fat_type; 32 FatCluster cluster_count; 33 FatCluster free_cluster_count; 34 FatCluster bad_cluster_count; 35 36 FatCluster last_alloc; 37 }; 38 39 extern FatTable* fat_table_new (FatType fat_type, FatCluster size); 40 extern FatTable* fat_table_duplicate (const FatTable* ft); 41 extern void fat_table_destroy (FatTable* ft); 42 extern void fat_table_clear (FatTable* ft); 43 extern int fat_table_set_cluster_count (FatTable* ft, 44 FatCluster new_cluster_count); 45 46 extern int fat_table_read (FatTable* ft, const PedFileSystem* fs, 47 int table_num); 48 extern int fat_table_write (const FatTable* ft, PedFileSystem* fs, 49 int table_num); 50 extern int fat_table_write_all (const FatTable* ft, PedFileSystem* fs); 51 extern int fat_table_compare (const FatTable* a, const FatTable* b); 52 extern int fat_table_count_stats (FatTable* ft); 53 54 extern FatCluster fat_table_get (const FatTable* ft, FatCluster cluster); 55 extern int fat_table_set (FatTable* ft, FatCluster cluster, FatCluster value); 56 57 extern FatCluster fat_table_alloc_cluster (FatTable* ft); 58 extern FatCluster fat_table_alloc_check_cluster (FatTable* ft, 59 PedFileSystem* fs); 60 61 extern int fat_table_is_bad (const FatTable* ft, FatCluster cluster); 62 extern int fat_table_is_eof (const FatTable* ft, FatCluster cluster); 63 extern int fat_table_is_empty (const FatTable* ft, FatCluster cluster); 64 extern int fat_table_is_available (const FatTable* ft, FatCluster cluster); 65 extern int fat_table_is_active (const FatTable* ft, FatCluster cluster); 66 67 extern int fat_table_set_eof (FatTable* ft, FatCluster cluster); 68 extern int fat_table_set_avail (FatTable* ft, FatCluster cluster); 69 extern int fat_table_set_bad (FatTable* ft, FatCluster cluster); 70 71 extern int fat_table_entry_size (FatType fat_type); 72 73 #endif /* PED_FAT_TABLE_H_INCLUDED */ 74