Changeset 6cf9aeb in mainline
- Timestamp:
- 2012-02-19T16:28:51Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3f6d4ea
- Parents:
- f8973122
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mkexfat/mkexfat.c
rf8973122 r6cf9aeb 42 42 #include <errno.h> 43 43 #include <byteorder.h> 44 #include <align.h> 44 45 #include <sys/types.h> 45 46 #include <sys/typefmt.h> … … 62 63 aoff64_t volume_start; 63 64 aoff64_t volume_count; 64 u int32_tfat_sector_count;65 u int32_tdata_start_sector;66 u int32_t data_cluster;67 u int32_t rootdir_cluster;65 unsigned long fat_sector_count; 66 unsigned long data_start_sector; 67 unsigned long rootdir_cluster; 68 unsigned long total_clusters; 68 69 size_t sector_size; 69 70 size_t cluster_size; 70 uint32_t total_clusters;71 71 } exfat_cfg_t; 72 72 … … 96 96 * the entire storage device. 97 97 */ 98 while (n_req_clusters > UINT32_MAX&&98 while (n_req_clusters > 4000000 && 99 99 (cfg->cluster_size < 32 * 1024 * 1024)) { 100 100 … … 103 103 } 104 104 105 cfg->total_clusters = n_req_clusters ;105 cfg->total_clusters = n_req_clusters + 2; 106 106 107 107 /* Compute the FAT size in sectors */ … … 109 109 cfg->fat_sector_count = div_round_up(fat_bytes, cfg->sector_size); 110 110 111 /* Compute the number of the first data sector */ 112 cfg->data_start_sector = ROUND_UP(FAT_SECTOR_START + 113 cfg->fat_sector_count, cfg->cluster_size / cfg->sector_size); 114 115 cfg->rootdir_cluster = 0; 116 111 117 /* The first sector of the partition is zero */ 112 118 cfg->volume_start = 0; 119 } 120 121 /** Prints the exFAT structure values 122 * 123 * @param cfg Pointer to the exfat_cfg_t structure. 124 */ 125 static void 126 cfg_print_info(exfat_cfg_t *cfg) 127 { 128 printf(NAME ": Sector size: %lu\n", cfg->sector_size); 129 printf(NAME ": Cluster size: %lu\n", cfg->cluster_size); 130 printf(NAME ": FAT size in sectors: %lu\n", cfg->fat_sector_count); 131 printf(NAME ": Data start sector: %lu\n", cfg->data_start_sector); 132 printf(NAME ": Total num of clusters: %lu\n", cfg->total_clusters); 113 133 } 114 134 … … 136 156 vbr->fat_sector_start = host2uint32_t_le(FAT_SECTOR_START); 137 157 vbr->fat_sector_count = host2uint32_t_le(cfg->fat_sector_count); 158 vbr->data_start_sector = host2uint32_t_le(cfg->data_start_sector); 159 160 vbr->data_clusters = host2uint32_t_le(cfg->total_clusters - 161 div_round_up(cfg->data_start_sector, cfg->cluster_size)); 162 163 vbr->rootdir_cluster = 0; 164 vbr->volume_serial = 0; 138 165 vbr->version.major = 1; 139 166 vbr->version.minor = 0; … … 155 182 * It works only if n is a power of two. 156 183 */ 157 static unsigned log2(unsigned n) 184 static unsigned 185 log2(unsigned n) 158 186 { 159 187 unsigned r; … … 221 249 222 250 cfg_params_initialize(&cfg); 251 cfg_print_info(&cfg); 223 252 vbr_initialize(&vbr, &cfg); 224 253
Note:
See TracChangeset
for help on using the changeset viewer.