path: root/sys/sys
diff options
authorLawrence Stewart <lstewart@FreeBSD.org>2017-08-17 07:20:09 +0000
committerLawrence Stewart <lstewart@FreeBSD.org>2017-08-17 07:20:09 +0000
commita8ec96af28bf1e84f88039e68ff89c82e600f96b (patch)
treece576138e0a1aab297378eedbecd86059e3b384b /sys/sys
parent1e781c6f96614a362924113f91d28bd32dc60c7e (diff)
Implement simple record boundary tracking in sbuf(9) to avoid record splitting
during drain operations. When an sbuf is configured to use this feature by way of the SBUF_DRAINTOEOR sbuf_new() flag, top-level sections started with sbuf_start_section() create a record boundary marker that is used to avoid flushing partial records. Reviewed by: cem,imp,wblock MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D8536
Notes: svn path=/head/; revision=322614
Diffstat (limited to 'sys/sys')
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/sys/sbuf.h b/sys/sys/sbuf.h
index c05bafd1e598..d0f908be7b6b 100644
--- a/sys/sys/sbuf.h
+++ b/sys/sys/sbuf.h
@@ -49,6 +49,7 @@ struct sbuf {
#define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */
#define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */
#define SBUF_INCLUDENUL 0x00000002 /* nulterm byte is counted in len */
+#define SBUF_DRAINTOEOR 0x00000004 /* use section 0 as drain EOR marker */
#define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */
#define SBUF_DYNAMIC 0x00010000 /* s_buf must be freed */
#define SBUF_FINISHED 0x00020000 /* set by sbuf_finish() */
@@ -56,6 +57,7 @@ struct sbuf {
#define SBUF_INSECTION 0x00100000 /* set by sbuf_start_section() */
int s_flags; /* flags */
ssize_t s_sect_len; /* current length of section */
+ ssize_t s_rec_off; /* current record start offset */