Changeset b9060a83 in mainline
- Timestamp:
- 2011-06-12T09:45:17Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 17fa0280
- Parents:
- 010b52d8
- Location:
- uspace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/filegen/filegen.c
r010b52d8 rb9060a83 73 73 close(fd); 74 74 crc = ~crc; 75 printf("%s : %x\n", argv[1], crc);75 printf("%s : %x\n", argv[1], crc); 76 76 77 77 return 0; -
uspace/srv/fs/fat/fat_fat.c
r010b52d8 rb9060a83 304 304 305 305 offset = (clst + clst/2); 306 if (offset / BPS(bs) >= SF(bs)) 307 return ERANGE; 308 306 309 rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno + 307 310 offset / BPS(bs), BLOCK_FLAGS_NONE); … … 309 312 return rc; 310 313 311 byte1 = ((uint8_t*) b->data)[offset]; 312 314 byte1 = ((uint8_t*) b->data)[offset % BPS(bs)]; 313 315 /* This cluster access spans a sector boundary. Check only for FAT12 */ 314 if ((offset % BPS(bs) + 1 == BPS(bs))) {316 if ((offset % BPS(bs)) + 1 == BPS(bs)) { 315 317 /* Is it last sector of FAT? */ 316 318 if (offset / BPS(bs) < SF(bs)) { … … 341 343 } 342 344 else 343 byte2 = ((uint8_t*) b->data)[ offset+1];345 byte2 = ((uint8_t*) b->data)[(offset % BPS(bs))+1]; 344 346 345 347 #ifdef __BE__ … … 351 353 *value = uint16_t_le2host(*value); 352 354 if (IS_ODD(clst)) 353 *value = *value>> 4;355 *value = (*value) >> 4; 354 356 else 355 *value = *value& FAT12_MASK;356 357 *value = (*value) & FAT12_MASK; 358 357 359 rc = block_put(b); 358 359 360 return rc; 360 361 } … … 473 474 474 475 offset = (clst + clst/2); 476 if (offset / BPS(bs) >= SF(bs)) 477 return ERANGE; 478 475 479 rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno + 476 480 offset / BPS(bs), BLOCK_FLAGS_NONE); … … 478 482 return rc; 479 483 480 byte1 = ((uint8_t*) b->data)[offset ];484 byte1 = ((uint8_t*) b->data)[offset % BPS(bs)]; 481 485 bool border = false; 482 486 /* This cluster access spans a sector boundary. Check only for FAT12 */ 483 if ( offset % BPS(bs)+1 == BPS(bs)) {487 if ((offset % BPS(bs))+1 == BPS(bs)) { 484 488 /* Is it last sector of FAT? */ 485 489 if (offset / BPS(bs) < SF(bs)) { … … 492 496 } 493 497 /* 494 * Combining value with last byte of current sector and495 * first byte of next sector496 */498 * Combining value with last byte of current sector and 499 * first byte of next sector 500 */ 497 501 byte2 = ((uint8_t*) b1->data)[0]; 498 502 border = true; … … 505 509 } 506 510 else 507 byte2 = ((uint8_t*) b->data)[ offset+1];511 byte2 = ((uint8_t*) b->data)[(offset % BPS(bs))+1]; 508 512 509 513 if (IS_ODD(clst)) { … … 520 524 byte2 = byte2 | (value >> 8); 521 525 522 ((uint8_t*) b->data)[ offset] = byte1;526 ((uint8_t*) b->data)[(offset % BPS(bs))] = byte1; 523 527 if (border) { 524 528 ((uint8_t*) b1->data)[0] = byte2; … … 531 535 } 532 536 } else 533 ((uint8_t*) b->data)[ offset+1] = byte2;537 ((uint8_t*) b->data)[(offset % BPS(bs))+1] = byte2; 534 538 535 539 b->dirty = true; /* need to sync block */
Note:
See TracChangeset
for help on using the changeset viewer.