Changeset 61bc901 in mainline for uspace/lib/libfs/libfs.c
- Timestamp:
- 2008-08-07T21:20:54Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a61d1fc3
- Parents:
- d2c1fd5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libfs/libfs.c
rd2c1fd5 r61bc901 334 334 #define RD_READ_BLOCK (RD_BASE + 1) 335 335 336 bool libfs_blockread(int phone, void *buffer, size_t *bufpos, size_t *buflen, 337 size_t *pos, void *dst, size_t size, size_t block_size) 336 /** Read data from a block device. 337 * 338 * @param phone Phone to be used to communicate with the device. 339 * @param buffer Communication buffer shared with the device. 340 * @param bufpos Pointer to the first unread valid offset within the 341 * communication buffer. 342 * @param buflen Pointer to the number of unread bytes that are ready in 343 * the communication buffer. 344 * @param pos Device position to be read. 345 * @param dst Destination buffer. 346 * @param size Size of the destination buffer. 347 * @param block_size Block size to be used for the transfer. 348 * 349 * @return True on success, false on failure. 350 */ 351 bool libfs_blockread(int phone, void *buffer, off_t *bufpos, size_t *buflen, 352 off_t *pos, void *dst, size_t size, size_t block_size) 338 353 { 339 size_t offset = 0;354 off_t offset = 0; 340 355 size_t left = size; 341 356 … … 349 364 350 365 if (rd > 0) { 366 /* 367 * Copy the contents of the communication buffer to the 368 * destination buffer. 369 */ 351 370 memcpy(dst + offset, buffer + *bufpos, rd); 352 371 offset += rd; … … 357 376 358 377 if (*bufpos == *buflen) { 378 /* Refill the communication buffer with a new block. */ 359 379 ipcarg_t retval; 360 380 int rc = async_req_2_1(phone, RD_READ_BLOCK,
Note:
See TracChangeset
for help on using the changeset viewer.