]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
MFC r212365, r212367:
authormdf <mdf@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 1 Jun 2011 17:36:52 +0000 (17:36 +0000)
committermdf <mdf@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 1 Jun 2011 17:36:52 +0000 (17:36 +0000)
commit749b7d1b21da5b22111116cd41b92fdbb8a6994f
treec5b98e2427e32bde11b97fdd364a8cf6ea9694b1
parent564b2a96ccf5c964158483a8637e8a05d7f9a39b
MFC r212365, r212367:

r212365: 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.

r212367: 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).

Sbufs now have three basic uses:
1) static string manipulation.  Overflow is marked.
2) dynamic string manipulation.  Overflow triggers string growth.
3) drained string manipulation.  Overflow triggers draining.

In all cases the manipulation is 'safe' in that overflow is detected and
managed.

Note that r212367 had to be minorly re-implemented to dynamically
allocate space for a function pointer, a void * argument, and an int
error, to not break the ABI/KBI.

git-svn-id: svn://svn.freebsd.org/base/stable/8@222574 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
share/man/man9/Makefile
share/man/man9/sbuf.9
sys/kern/subr_sbuf.c
sys/sys/sbuf.h