Changeset 89a0a827 in mainline


Ignore:
Timestamp:
2012-02-24T22:21:29Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
552efe3
Parents:
557e5b13
Message:

mkexfat: write the upcase table to disk

File:
1 edited

Legend:

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

    r557e5b13 r89a0a827  
    163163            cfg->cluster_size);
    164164
    165         /* FIXME: set the real rootdir cluster */
     165        /* Will be set later */
    166166        cfg->rootdir_cluster = 0;
    167167
     
    470470}
    471471
     472/** Write the upcase table to disk. */
     473static int
     474upcase_table_write(service_id_t service_id, exfat_cfg_t *cfg)
     475{
     476        int rc;
     477        aoff64_t start_sec, nsecs, i;
     478        uint8_t *table_ptr;
     479
     480        start_sec = cfg->data_start_sector;
     481        start_sec += (cfg->upcase_table_cluster * cfg->cluster_size) /
     482            cfg->sector_size;
     483
     484        nsecs = div_round_up(sizeof(upcase_table), cfg->sector_size);
     485        table_ptr = (uint8_t *) upcase_table;
     486
     487        for (i = 0; i < nsecs; ++i, table_ptr += cfg->sector_size) {
     488                rc = block_write_direct(service_id,
     489                    start_sec + i, 1, table_ptr);
     490                if (rc != EOK)
     491                        return rc;
     492        }
     493
     494        return EOK;
     495}
     496
    472497/** Given a number (n), returns the result of log2(n).
    473498 *
     
    617642        }
    618643
     644        rc = upcase_table_write(service_id, &cfg);
     645        if (rc != EOK) {
     646                printf(NAME ": Error, failed to write the upcase table to disk.\n");
     647                return 2;
     648        }
     649
    619650        rc = bootsec_write(service_id, &cfg);
    620651        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.