Rev 3048 | Rev 3252 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3048 | Rev 3251 | ||
---|---|---|---|
Line 328... | Line 328... | ||
328 | ops->node_put(cur); |
328 | ops->node_put(cur); |
329 | if (tmp) |
329 | if (tmp) |
330 | ops->node_put(tmp); |
330 | ops->node_put(tmp); |
331 | } |
331 | } |
332 | 332 | ||
- | 333 | #define RD_BASE 1024 // FIXME |
|
- | 334 | #define RD_READ_BLOCK (RD_BASE + 1) |
|
- | 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) |
|
- | 338 | { |
|
- | 339 | size_t offset = 0; |
|
- | 340 | size_t left = size; |
|
- | 341 | ||
- | 342 | while (left > 0) { |
|
- | 343 | size_t rd; |
|
- | 344 | ||
- | 345 | if (*bufpos + left < *buflen) |
|
- | 346 | rd = left; |
|
- | 347 | else |
|
- | 348 | rd = *buflen - *bufpos; |
|
- | 349 | ||
- | 350 | if (rd > 0) { |
|
- | 351 | memcpy(dst + offset, buffer + *bufpos, rd); |
|
- | 352 | offset += rd; |
|
- | 353 | *bufpos += rd; |
|
- | 354 | *pos += rd; |
|
- | 355 | left -= rd; |
|
- | 356 | } |
|
- | 357 | ||
- | 358 | if (*bufpos == *buflen) { |
|
- | 359 | ipcarg_t retval; |
|
- | 360 | int rc = async_req_2_1(phone, RD_READ_BLOCK, |
|
- | 361 | *pos / block_size, block_size, &retval); |
|
- | 362 | if ((rc != EOK) || (retval != EOK)) |
|
- | 363 | return false; |
|
- | 364 | ||
- | 365 | *bufpos = 0; |
|
- | 366 | *buflen = block_size; |
|
- | 367 | } |
|
- | 368 | } |
|
- | 369 | ||
- | 370 | return true; |
|
- | 371 | } |
|
- | 372 | ||
333 | /** @} |
373 | /** @} |
334 | */ |
374 | */ |