Page MenuHomeFreeBSD

Make sbuf_drain safe for external use

Authored by rscheff on Apr 2 2021, 8:12 AM.



While sbuf_drain was an internal function, two
KASSERTS checked the sanity of it being called.
However, an external caller may be ignorant if
there is any data to drain, or if an error has
already accumulated. Be nice and return immediately
with the accumulated error.

MFC after: 2 weeks

Diff Detail

R10 FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

I would separate the changes:

  1. Remove some constraints when sbuf_drain() is called.
  2. Simplify a user of sbuf_drain().
  • only the subr_sbuf.c changes
This revision is now accepted and ready to land.Apr 2 2021, 12:53 PM
This revision was automatically updated to reflect the committed changes.