* Append the segments that describe a single mbuf chain to a * scatter/gather list. If there are insufficient segments, then this * fails with EFBIG. */
| 438 | * fails with EFBIG. |
| 439 | */ |
| 440 | int |
| 441 | sglist_append_mbuf(struct sglist *sg, struct mbuf *m0) |
| 442 | { |
| 443 | struct sgsave save; |
| 444 | struct mbuf *m; |
| 445 | int error; |
| 446 | |
| 447 | if (sg->sg_maxseg == 0) |
| 448 | return (EINVAL); |
| 449 | |
| 450 | error = 0; |
| 451 | SGLIST_SAVE(sg, save); |
| 452 | for (m = m0; m != NULL; m = m->m_next) { |
| 453 | if (m->m_len > 0) { |
| 454 | if ((m->m_flags & M_EXTPG) != 0) |
| 455 | error = sglist_append_mbuf_epg(sg, m, |
| 456 | mtod(m, vm_offset_t), m->m_len); |
| 457 | else |
| 458 | error = sglist_append(sg, m->m_data, |
| 459 | m->m_len); |
| 460 | if (error) { |
| 461 | SGLIST_RESTORE(sg, save); |
| 462 | return (error); |
| 463 | } |
| 464 | } |
| 465 | } |
| 466 | return (0); |
| 467 | } |
| 468 | |
| 469 | /* |
| 470 | * Append the segments that describe a buffer spanning an array of VM |
no test coverage detected