* Query from the BPF framework as to whether or not the buffer current in * the store position can actually be written to. This may return false if * the store buffer is assigned to userspace before the hold buffer is * acknowledged. */
| 447 | * acknowledged. |
| 448 | */ |
| 449 | int |
| 450 | bpf_zerocopy_canwritebuf(struct bpf_d *d) |
| 451 | { |
| 452 | struct zbuf *zb; |
| 453 | |
| 454 | KASSERT(d->bd_bufmode == BPF_BUFMODE_ZBUF, |
| 455 | ("bpf_zerocopy_canwritebuf: not in zbuf mode")); |
| 456 | |
| 457 | zb = (struct zbuf *)d->bd_sbuf; |
| 458 | KASSERT(zb != NULL, ("bpf_zerocopy_canwritebuf: bd_sbuf NULL")); |
| 459 | |
| 460 | if (zb->zb_flags & ZBUF_FLAG_ASSIGNED) |
| 461 | return (0); |
| 462 | return (1); |
| 463 | } |
| 464 | |
| 465 | /* |
| 466 | * Free zero copy buffers at request of descriptor. |