* Borrow a raw buffer from an ABD without copying the contents of the ABD * into the buffer. If the ABD is scattered, this will allocate a raw buffer * whose contents are undefined. To copy over the existing data in the ABD, use * abd_borrow_buf_copy() instead. */
| 635 | * abd_borrow_buf_copy() instead. |
| 636 | */ |
| 637 | void * |
| 638 | abd_borrow_buf(abd_t *abd, size_t n) |
| 639 | { |
| 640 | void *buf; |
| 641 | abd_verify(abd); |
| 642 | ASSERT3U(abd->abd_size, >=, n); |
| 643 | if (abd_is_linear(abd)) { |
| 644 | buf = abd_to_buf(abd); |
| 645 | } else { |
| 646 | buf = zio_buf_alloc(n); |
| 647 | } |
| 648 | (void) zfs_refcount_add_many(&abd->abd_children, n, buf); |
| 649 | return (buf); |
| 650 | } |
| 651 | |
| 652 | void * |
| 653 | abd_borrow_buf_copy(abd_t *abd, size_t n) |
no test coverage detected