Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Sep 2010 16:14:59 -0700
From:      mdf@FreeBSD.org
To:        FreeBSD Arch <freebsd-arch@freebsd.org>, Poul-Henning Kamp <phk@phk.freebsd.dk>
Subject:   Extending sbufs with a drain, take 2
Message-ID:  <AANLkTim16YitneEE7kkWzwssQasab3qG9dygv%2BTuHa7x@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
After the discussion here with phk, I have reworked my patches.  If
I've misunderstood the intent, I welcome corrections.  Do these
patches seem reasonable?

---

Refactor sbuf code so that most uses of sbuf_extend() are in a new
sbuf_put_byte().  This makes it easier to add drain functionality when a
buffer would overflow as there are fewer code points.

http://people.freebsd.org/~mdf/0001-Refactor-sbuf-code-so-that-most-uses-of-sbuf_extend-.patch

---

Fix small errors in the sbuf(9) man page.

http://people.freebsd.org/~mdf/0002-Fix-small-errors-in-the-sbuf-9-man-page.patch

---

Add drain functionality to sbufs.  The drain is a function that is
called when the sbuf internal buffer is filled.  For kernel sbufs with a
drain, the internal buffer will never be expanded.  For userland sbufs
with a drain, the internal buffer may still be expanded by
sbuf_[v]printf(3).

http://people.freebsd.org/~mdf/0003-Add-drain-functionality-to-sbufs.-The-drain-is-a-fun.patch

---

Add a drain function for struct sysctl_req, and use it for a variety
of handlers that had to do awkward things to get a large enough
FIXEDLEN buffer.

http://people.freebsd.org/~mdf/0004-Add-a-drain-function-for-struct-sysctl_req-and-use-i.patch

---

Fix an incorrect use of sbuf_overflowed() after a call to sbuf_finish().

http://people.freebsd.org/~mdf/0005-Fix-an-incorrect-use-of-sbuf_overflowed-after-a-call.patch

---

Replace sbuf_overflowed() with sbuf_error(), which returns any error
code associated with overflow or with the drain function.

http://people.freebsd.org/~mdf/0006-Replace-sbuf_overflowed-with-sbuf_error-which-return.patch

Thanks,
matthew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTim16YitneEE7kkWzwssQasab3qG9dygv%2BTuHa7x>