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

Changeset 5dbd696 in mainline


Ignore:
Timestamp:
2012-02-18T18:32:39Z (8 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
master
Children:
f8973122
Parents:
6b3cda3
Message:

mkexfat: compute the total FAT size

File:
1 edited

Legend:

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

    r6b3cda3 r5dbd696  
    6868        size_t   sector_size;
    6969        size_t   cluster_size;
    70         unsigned long total_clusters;
     70        uint32_t total_clusters;
    7171} exfat_cfg_t;
    7272
     
    8383cfg_params_initialize(exfat_cfg_t *cfg)
    8484{
    85         aoff64_t const volume_bytes = cfg->volume_count * cfg->sector_size;
     85        unsigned long fat_bytes;
     86        aoff64_t const volume_bytes = (cfg->volume_count - FAT_SECTOR_START) *
     87            cfg->sector_size;
    8688
    8789        /** Number of clusters required to index the entire device, it must
     
    100102                n_req_clusters = volume_bytes / cfg->cluster_size;
    101103        }
     104
     105        cfg->total_clusters = n_req_clusters;
     106
     107        /* Compute the FAT size in sectors */
     108        fat_bytes = (cfg->total_clusters + 1) * 4;
     109        cfg->fat_sector_count = div_round_up(fat_bytes, cfg->sector_size);
    102110}
    103111
     
    203211        rc = block_get_nblocks(service_id, &cfg.volume_count);
    204212        if (rc != EOK) {
    205                 printf(NAME ": Warning, failed to obtain device block size.\n");
    206                 /* FIXME: the user should specify the filesystem size */
     213                printf(NAME ": Warning, failed to obtain" \
     214                    " device block size.\n");
     215                /* FIXME: the user should be able to specify the filesystem size */
    207216                return 1;
    208217        } else {
Note: See TracChangeset for help on using the changeset viewer.