Changeset 6843a9c in mainline for uspace/srv/fs/exfat/exfat_directory.c
- Timestamp:
- 2012-06-29T13:02:14Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 722912e
- Parents:
- ba72f2b (diff), 0bbd13e (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat_directory.c
rba72f2b r6843a9c 92 92 int rc = EOK; 93 93 94 if (di->b) 94 if (di->b) { 95 95 rc = block_put(di->b); 96 di->b = NULL; 97 } 96 98 97 99 return rc; … … 101 103 { 102 104 uint32_t i; 103 int rc ;105 int rc = EOK; 104 106 105 107 i = (di->pos * sizeof(exfat_dentry_t)) / BPS(di->bs); … … 108 110 109 111 if (di->b && di->bnum != i) { 110 block_put(di->b);112 rc = block_put(di->b); 111 113 di->b = NULL; 114 if (rc != EOK) 115 return rc; 112 116 } 113 117 if (!di->b) { … … 126 130 di->bnum = i; 127 131 } 128 return EOK;132 return rc; 129 133 } 130 134 … … 264 268 if (idx == 2 || idx == 3) 265 269 continue; 266 checksum = ((checksum << 15) | (checksum >> 1)) + (uint16_t)bytes[idx]; 270 checksum = ((checksum << 15) | (checksum >> 1)) + 271 (uint16_t)bytes[idx]; 267 272 } 268 273 return checksum; … … 285 290 for (i = 0; i < count; i++) { 286 291 rc = exfat_directory_get(di, &de); 287 if (rc != EOK) 288 return rc; 292 if (rc != EOK) { 293 free(array); 294 return rc; 295 } 289 296 array[i] = *de; 290 297 rc = exfat_directory_next(di); … … 306 313 array[1].stream.valid_data_size = host2uint64_t_le(ds->valid_data_size); 307 314 array[1].stream.data_size = host2uint64_t_le(ds->data_size); 308 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, 309 317 count * sizeof(exfat_dentry_t))); 310 318 … … 312 320 for (i = 0; i < count; i++) { 313 321 rc = exfat_directory_get(di, &de); 314 if (rc != EOK) 315 return rc; 322 if (rc != EOK) { 323 free(array); 324 return rc; 325 } 316 326 *de = array[i]; 317 327 di->b->dirty = true; … … 346 356 uctablep = EXFAT_NODE(fn); 347 357 348 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); 349 360 uctable = (uint16_t *) malloc(uctable_chars * sizeof(uint16_t)); 350 361 rc = exfat_read_uctable(di->bs, uctablep, (uint8_t *)uctable); … … 360 371 ds.stream.valid_data_size = 0; 361 372 ds.stream.data_size = 0; 362 ds.stream.name_size = utf16_length(wname);373 ds.stream.name_size = exfat_utf16_length(wname); 363 374 ds.stream.hash = host2uint16_t_le(exfat_name_hash(wname, uctable, 364 375 uctable_chars)); … … 411 422 return rc; 412 423 413 if (i == df.file.count - 2) 414 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 415 429 rc = exfat_directory_get(di, &de); 416 430 if (rc != EOK) … … 424 438 425 439 di->b->dirty = true; 426 sname += chars;427 440 } 428 441 … … 434 447 int rc, count; 435 448 exfat_dentry_t *de; 449 450 di->pos = pos; 436 451 437 452 rc = exfat_directory_get(di, &de);
Note:
See TracChangeset
for help on using the changeset viewer.