Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset b6eb5da in mainline


Ignore:
Timestamp:
2012-02-28T20:44:30Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master
Children:
9bbe54f
Parents:
2601383
Message:

mkexfat: Fix calculation of the total number of clusters on device.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/mkexfat/mkexfat.c

    r2601383 rb6eb5da  
    164164
    165165                cfg->cluster_size <<= 1;
    166                 cfg->total_clusters = div_round_up(volume_bytes,
    167                     cfg->cluster_size);
     166                cfg->total_clusters = volume_bytes / cfg->cluster_size;
    168167        }
    169168
     
    178177            cfg->fat_sector_count, cfg->cluster_size / cfg->sector_size);
    179178
     179        /* Subtract the FAT and bootsector space from the total
     180         * number of available clusters.
     181         */
     182        cfg->total_clusters -= div_round_up((cfg->data_start_sector -
     183            FAT_SECTOR_START) * cfg->sector_size,
     184            cfg->cluster_size);
     185
    180186        /* Compute the bitmap size */
    181187        cfg->bitmap_size = div_round_up(cfg->total_clusters, 8);
     
    191197        cfg->allocated_clusters += div_round_up(sizeof(upcase_table),
    192198            cfg->cluster_size);
    193 
    194         /* Subtract the FAT and bootsector space from the total
    195          * number of available clusters.
    196          */
    197         cfg->total_clusters -= div_round_up(cfg->data_start_sector *
    198             cfg->sector_size, cfg->cluster_size);
    199199
    200200        /* Will be set later */
Note: See TracChangeset for help on using the changeset viewer.