Changeset 26ad20b in mainline


Ignore:
Timestamp:
2011-08-24T22:38:31Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
24738df
Parents:
81e9cb3
Message:

Cleanup mkfat.

Location:
uspace/app/mkfat
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/mkfat/fat.h

    r81e9cb3 r26ad20b  
    4747#define FAT32   32
    4848
    49 #define FAT_SIZE(a) ((a==FAT12)? 1.5 : ( (a==FAT16)? 2 : 4  ) )
     49#define FAT_SIZE(a) (((a) == FAT12) ? 1.5 : (((a) == FAT16) ? 2 : 4))
    5050
    5151typedef struct fat_bs {
  • uspace/app/mkfat/mkfat.c

    r81e9cb3 r26ad20b  
    215215static void syntax_print(void)
    216216{
    217         printf("syntax: mkfat32 [--size <sectors>] [--type 12|16|32] <device_name>\n");
     217        printf("syntax: mkfat [--size <sectors>] [--type 12|16|32] <device_name>\n");
    218218}
    219219
     
    229229
    230230        /*
    231     * Make a conservative guess on the FAT size needed for the file
    232     * system. The optimum could be potentially smaller since we
    233     * do not subtract size of the FAT itself when computing the
    234     * size of the data region.
    235     */
     231        * Make a conservative guess on the FAT size needed for the file
     232        * system. The optimum could be potentially smaller since we
     233        * do not subtract size of the FAT itself when computing the
     234        * size of the data region.
     235        */
    236236
    237237        if (cfg->fat_type == FAT12)
     
    242242                cfg->rootdir_sectors = div_round_up(cfg->root_ent_max * DIRENT_SIZE,
    243243                        cfg->sector_size);
    244         }
    245         else
     244        } else
    246245                cfg->rootdir_sectors = 0;
    247246        non_data_sectors_lb = cfg->reserved_sectors + cfg->rootdir_sectors;
     
    251250
    252251        if ((cfg->fat_type == FAT12 && cfg->total_clusters > FAT12_CLST_MAX) ||
    253                 (cfg->fat_type == FAT16 && (cfg->total_clusters <= FAT12_CLST_MAX ||
    254                 cfg->total_clusters > FAT16_CLST_MAX)) ||
     252            (cfg->fat_type == FAT16 && (cfg->total_clusters <= FAT12_CLST_MAX ||
     253            cfg->total_clusters > FAT16_CLST_MAX)) ||
    255254            (cfg->fat_type == FAT32 && cfg->total_clusters <= FAT16_CLST_MAX))
    256255                return ENOSPC;
     
    340339                }
    341340        } else {
    342                 for (i=0; i<cfg->sectors_per_cluster; i++) {
     341                for (i = 0; i < cfg->sectors_per_cluster; i++) {
    343342                        rc = block_write_direct(service_id, addr, 1, buffer);
    344343                        if (rc != EOK)
Note: See TracChangeset for help on using the changeset viewer.