Changeset 55dbaeb in mainline for uspace/app/mkexfat/mkexfat.c
- Timestamp:
- 2012-02-21T20:02:38Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dabe1664
- Parents:
- e15f4d5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mkexfat/mkexfat.c
re15f4d5 r55dbaeb 53 53 #define FAT_SECTOR_START 128 54 54 55 /** First sector of the Main Extended Boot Region */ 56 #define EBS_SECTOR_START 1 57 58 /** Size of the Main Extended Boot Region */ 59 #define EBS_SIZE 8 60 55 61 /** Divide and round up. */ 56 62 #define div_round_up(a, b) (((a) + (b) - 1) / (b)) … … 178 184 } 179 185 186 /** Write the Main Extended Boot Sector to disk 187 * 188 * @param service_id The service id. 189 * @param cfg Pointer to the exFAT configuration structure. 190 * @return EOK on success or a negative error code. 191 */ 192 static int 193 ebs_write(service_id_t service_id, exfat_cfg_t *cfg) 194 { 195 uint32_t *ebs = calloc(cfg->sector_size, sizeof(uint8_t)); 196 int i, rc; 197 198 if (!ebs) 199 return ENOMEM; 200 201 ebs[cfg->sector_size / 4 - 1] = host2uint32_t_le(0xAA550000); 202 203 for (i = 0; i < EBS_SIZE; ++i) { 204 rc = block_write_direct(service_id, i + EBS_SECTOR_START, 205 1, ebs); 206 207 if (rc != EOK) 208 goto exit; 209 } 210 211 exit: 212 free(ebs); 213 return rc; 214 } 215 180 216 /** Writes the FAT on disk. 181 217 * … … 304 340 } 305 341 342 rc = ebs_write(service_id, &cfg); 343 if (rc != EOK) { 344 printf(NAME ": Error, failed to write the Main Extended Boot" \ 345 " Sector to disk\n"); 346 return 2; 347 } 348 306 349 rc = fat_write(service_id, &cfg); 307 350 if (rc != EOK) { 308 printf(NAME ": Error, failed to write the FAT ondisk\n");351 printf(NAME ": Error, failed to write the FAT to disk\n"); 309 352 return 2; 310 353 }
Note:
See TracChangeset
for help on using the changeset viewer.