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_CALC_H
  20 #define PED_FAT_CALC_H
  21 
  22 extern PedSector fat_min_cluster_size (FatType fat_type);
  23 extern PedSector fat_max_cluster_size (FatType fat_type);
  24 extern FatCluster fat_min_cluster_count (FatType fat_type);
  25 extern FatCluster fat_max_cluster_count (FatType fat_type);
  26 
  27 extern PedSector fat_min_reserved_sector_count (FatType fat_type);
  28 
  29 extern int fat_check_resize_geometry (const PedFileSystem* fs,
  30                                       const PedGeometry* geom,
  31                                       PedSector new_cluster_sectors,
  32                                       FatCluster new_cluster_count);
  33 
  34 extern int fat_calc_sizes (PedSector size,
  35                            PedSector align,
  36                            FatType fat_type,
  37                            PedSector root_dir_sectors,
  38                            PedSector* out_cluster_sectors,
  39                            FatCluster* out_cluster_count,
  40                            PedSector* out_fat_size);
  41 
  42 extern int fat_calc_resize_sizes (const PedGeometry* geom,
  43                                   PedSector align,
  44                                   FatType fat_type,
  45                                   PedSector root_dir_sectors,
  46                                   PedSector cluster_sectors,
  47                                   PedSector* out_cluster_sectors,
  48                                   FatCluster* out_cluster_count,
  49                                   PedSector* out_fat_size);
  50 
  51 extern PedSector
  52 fat_calc_align_sectors (const PedFileSystem* new_fs,
  53                         const PedFileSystem* old_fs);
  54 
  55 extern int
  56 fat_is_sector_in_clusters (const PedFileSystem* fs, PedSector sector);
  57 
  58 extern FatFragment
  59 fat_cluster_to_frag (const PedFileSystem* fs, FatCluster cluster);
  60 
  61 extern FatCluster
  62 fat_frag_to_cluster (const PedFileSystem* fs, FatFragment frag);
  63 
  64 extern PedSector
  65 fat_frag_to_sector (const PedFileSystem* fs, FatFragment frag);
  66 
  67 extern FatFragment
  68 fat_sector_to_frag (const PedFileSystem* fs, PedSector sector);
  69 
  70 extern PedSector
  71 fat_cluster_to_sector (const PedFileSystem* fs, FatCluster cluster);
  72 
  73 extern FatCluster
  74 fat_sector_to_cluster (const PedFileSystem* fs, PedSector sector);
  75 
  76 #endif /* PED_FAT_CALC_H */
  77