Export sbuf_drain to orchestrate lock and drain action

While exporting large amounts of data to a sysctl
request, datastructures may need to be locked.

Exporting the sbuf_drain function allows the
coordination between drain events and held
locks, to avoid stalls.

PR:		254333
Reviewed By:	jhb
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29481
This commit is contained in:
Richard Scheffenegger 2021-03-31 18:25:53 +02:00
parent baacf70137
commit c804c8f2c5
2 changed files with 2 additions and 1 deletions

View File

@ -383,7 +383,7 @@ sbuf_set_drain(struct sbuf *s, sbuf_drain_func *func, void *ctx)
/*
* Call the drain and process the return.
*/
static int
int
sbuf_drain(struct sbuf *s)
{
int len;

View File

@ -95,6 +95,7 @@ int sbuf_vprintf(struct sbuf *, const char *, __va_list)
int sbuf_nl_terminate(struct sbuf *);
int sbuf_putc(struct sbuf *, int);
void sbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *);
int sbuf_drain(struct sbuf *);
int sbuf_trim(struct sbuf *);
int sbuf_error(const struct sbuf *);
int sbuf_finish(struct sbuf *);