* Wrapper functions for various buffering methods. If the set of buffer * modes expands, we will probably want to introduce a switch data structure * similar to protosw, et. */
| 361 | * similar to protosw, et. |
| 362 | */ |
| 363 | static void |
| 364 | bpf_append_bytes(struct bpf_d *d, caddr_t buf, u_int offset, void *src, |
| 365 | u_int len) |
| 366 | { |
| 367 | |
| 368 | BPFD_LOCK_ASSERT(d); |
| 369 | |
| 370 | switch (d->bd_bufmode) { |
| 371 | case BPF_BUFMODE_BUFFER: |
| 372 | return (bpf_buffer_append_bytes(d, buf, offset, src, len)); |
| 373 | |
| 374 | case BPF_BUFMODE_ZBUF: |
| 375 | counter_u64_add(d->bd_zcopy, 1); |
| 376 | return (bpf_zerocopy_append_bytes(d, buf, offset, src, len)); |
| 377 | |
| 378 | default: |
| 379 | panic("bpf_buf_append_bytes"); |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | static void |
| 384 | bpf_append_mbuf(struct bpf_d *d, caddr_t buf, u_int offset, void *src, |
no test coverage detected