Changeset 63bcbbc in mainline
- Timestamp:
- 2011-12-12T20:23:53Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1df224c
- Parents:
- bf84871 (diff), 80ec9b8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/srv/fs/exfat
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat_bitmap.c
rbf84871 r63bcbbc 45 45 #include <assert.h> 46 46 #include <fibril_synch.h> 47 #include <malloc.h>48 47 #include <mem.h> 49 48 -
uspace/srv/fs/exfat/exfat_dentry.c
rbf84871 r63bcbbc 101 101 bool exfat_valid_char(wchar_t ch) 102 102 { 103 /* TODO */ 104 return true; 103 switch (ch) { 104 case 0x01 ... 0x1F: 105 case '/': 106 case '\\': 107 case '?': 108 case '|': 109 case '>': 110 case '<': 111 case '"': 112 case '*': 113 case ':': 114 return false; 115 default: 116 return true; 117 } 105 118 } 106 119 107 120 bool exfat_valid_name(const char *name) 108 121 { 109 /* TODO */ 122 size_t off = 0; 123 wchar_t ch; 124 125 while ((ch = str_decode(name, &off, STR_NO_LIMIT)) != 0) { 126 if (!exfat_valid_char(ch)) 127 return false; 128 } 110 129 return true; 111 130 } -
uspace/srv/fs/exfat/exfat_directory.c
rbf84871 r63bcbbc 112 112 rc = block_put(di->b); 113 113 di->b = NULL; 114 if (rc != EOK) 115 return rc; 114 116 } 115 117 if (!di->b) { … … 266 268 if (idx == 2 || idx == 3) 267 269 continue; 268 checksum = ((checksum << 15) | (checksum >> 1)) + (uint16_t)bytes[idx]; 270 checksum = ((checksum << 15) | (checksum >> 1)) + 271 (uint16_t)bytes[idx]; 269 272 } 270 273 return checksum; … … 310 313 array[1].stream.valid_data_size = host2uint64_t_le(ds->valid_data_size); 311 314 array[1].stream.data_size = host2uint64_t_le(ds->data_size); 312 array[0].file.checksum = host2uint16_t_le(exfat_directory_set_checksum((uint8_t *)array, 315 array[0].file.checksum = 316 host2uint16_t_le(exfat_directory_set_checksum((uint8_t *)array, 313 317 count * sizeof(exfat_dentry_t))); 314 318 … … 352 356 uctablep = EXFAT_NODE(fn); 353 357 354 uctable_chars = ALIGN_DOWN(uctablep->size, sizeof(uint16_t)) / sizeof(uint16_t); 358 uctable_chars = ALIGN_DOWN(uctablep->size, 359 sizeof(uint16_t)) / sizeof(uint16_t); 355 360 uctable = (uint16_t *) malloc(uctable_chars * sizeof(uint16_t)); 356 361 rc = exfat_read_uctable(di->bs, uctablep, (uint8_t *)uctable); … … 417 422 return rc; 418 423 419 if (i == df.file.count - 2) 420 chars = ds.stream.name_size - EXFAT_NAME_PART_LEN*(df.file.count - 2); 424 if (i == df.file.count - 2) { 425 chars = ds.stream.name_size - 426 EXFAT_NAME_PART_LEN*(df.file.count - 2); 427 } 428 421 429 rc = exfat_directory_get(di, &de); 422 430 if (rc != EOK) -
uspace/srv/fs/exfat/exfat_fat.c
rbf84871 r63bcbbc 50 50 #include <malloc.h> 51 51 #include <mem.h> 52 #include <str.h> 52 53 53 54 … … 322 323 (found == 0) ? EXFAT_CLST_EOF : lifo[found - 1]); 323 324 if (rc != EOK) 324 break;325 goto exit_error; 325 326 found++; 326 327 rc = bitmap_set_cluster(bs, service_id, clst); 327 328 if (rc != EOK) 328 break;329 goto exit_error; 329 330 330 331 } … … 339 340 } 340 341 342 rc = ENOSPC; 343 344 exit_error: 345 341 346 /* If something wrong - free the clusters */ 342 347 while (found--) { … … 347 352 free(lifo); 348 353 fibril_mutex_unlock(&exfat_alloc_lock); 349 return ENOSPC;354 return rc; 350 355 } 351 356 … … 537 542 int exfat_sanity_check(exfat_bs_t *bs, service_id_t service_id) 538 543 { 539 /* TODO */ 544 if (str_cmp((char const *)bs->oem_name, "EXFAT ")) 545 return ENOTSUP; 546 else if (uint16_t_le2host(bs->signature) != 0xAA55) 547 return ENOTSUP; 548 else if (uint32_t_le2host(bs->fat_sector_count) == 0) 549 return ENOTSUP; 550 else if (uint32_t_le2host(bs->data_clusters) == 0) 551 return ENOTSUP; 552 else if (bs->fat_count != 1) 553 return ENOTSUP; 554 else if ((bs->bytes_per_sector + bs->sec_per_cluster) > 25) { 555 /* exFAT does not support cluster size > 32 Mb */ 556 return ENOTSUP; 557 } 540 558 return EOK; 541 559 } -
uspace/srv/fs/exfat/exfat_ops.c
rbf84871 r63bcbbc 657 657 return rc; 658 658 } 659 660 rc = exfat_zero_cluster(bs, service_id, nodep->firstc); 661 if (rc != EOK) { 662 (void) exfat_node_put(FS_NODE(nodep)); 663 return rc; 664 } 665 659 666 nodep->size = BPC(bs); 660 667 } else { … … 739 746 */ 740 747 rc = exfat_directory_write_file(&di, name); 741 if (rc != EOK) 742 return rc; 748 if (rc != EOK) { 749 (void) exfat_directory_close(&di); 750 fibril_mutex_unlock(&parentp->idx->lock); 751 return rc; 752 } 743 753 rc = exfat_directory_close(&di); 744 if (rc != EOK) 745 return rc; 754 if (rc != EOK) { 755 fibril_mutex_unlock(&parentp->idx->lock); 756 return rc; 757 } 746 758 747 759 fibril_mutex_unlock(&parentp->idx->lock); … … 1258 1270 exfat_directory_t di; 1259 1271 rc = exfat_directory_open(nodep, &di); 1260 if (rc != EOK) goto err; 1272 if (rc != EOK) 1273 goto err; 1274 1261 1275 rc = exfat_directory_seek(&di, pos); 1262 1276 if (rc != EOK) { … … 1268 1282 &df, &ds); 1269 1283 if (rc == EOK) 1270 goto hit; 1271 if (rc == ENOENT) 1272 goto miss; 1284 goto hit; 1285 else if (rc == ENOENT) 1286 goto miss; 1287 1288 (void) exfat_directory_close(&di); 1273 1289 1274 1290 err: … … 1279 1295 miss: 1280 1296 rc = exfat_directory_close(&di); 1281 if (rc !=EOK)1297 if (rc != EOK) 1282 1298 goto err; 1283 1299 rc = exfat_node_put(fn); … … 1397 1413 1398 1414 (void) async_data_write_finalize(callid, 1399 1415 b->data + pos % BPS(bs), bytes); 1400 1416 b->dirty = true; /* need to sync block */ 1401 1417 rc = block_put(b);
Note:
See TracChangeset
for help on using the changeset viewer.