* Set up a drain function and argument on an sbuf to flush data to * when the sbuf buffer overflows. */
| 369 | * when the sbuf buffer overflows. |
| 370 | */ |
| 371 | void |
| 372 | sbuf_set_drain(struct sbuf *s, sbuf_drain_func *func, void *ctx) |
| 373 | { |
| 374 | |
| 375 | assert_sbuf_state(s, 0); |
| 376 | assert_sbuf_integrity(s); |
| 377 | KASSERT(func == s->s_drain_func || s->s_len == 0, |
| 378 | ("Cannot change drain to %p on non-empty sbuf %p", func, s)); |
| 379 | s->s_drain_func = func; |
| 380 | s->s_drain_arg = ctx; |
| 381 | } |
| 382 | |
| 383 | /* |
| 384 | * Call the drain and process the return. |
no outgoing calls
no test coverage detected