From owner-svn-src-head@FreeBSD.ORG Mon Jul 28 07:20:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 25AD786E; Mon, 28 Jul 2014 07:20:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1360E27F9; Mon, 28 Jul 2014 07:20:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S7KMZd080143; Mon, 28 Jul 2014 07:20:22 GMT (envelope-from gahr@svn.freebsd.org) Received: (from gahr@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S7KMxp080139; Mon, 28 Jul 2014 07:20:22 GMT (envelope-from gahr@svn.freebsd.org) Message-Id: <201407280720.s6S7KMxp080139@svn.freebsd.org> From: Pietro Cerutti Date: Mon, 28 Jul 2014 07:20:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269179 - in head: lib/libsbuf sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 07:20:23 -0000 Author: gahr (ports committer) Date: Mon Jul 28 07:20:22 2014 New Revision: 269179 URL: http://svnweb.freebsd.org/changeset/base/269179 Log: Unbreak the ABI by reverting r268494 until the compat shims are provided Modified: head/lib/libsbuf/Makefile head/sys/kern/subr_sbuf.c head/sys/sys/sbuf.h Modified: head/lib/libsbuf/Makefile ============================================================================== --- head/lib/libsbuf/Makefile Mon Jul 28 05:37:10 2014 (r269178) +++ head/lib/libsbuf/Makefile Mon Jul 28 07:20:22 2014 (r269179) @@ -4,7 +4,7 @@ LIB= sbuf SHLIBDIR?= /lib SRCS= subr_sbuf.c -SHLIB_MAJOR = 7 +SHLIB_MAJOR = 6 SYMBOL_MAPS= ${.CURDIR}/Symbol.map VERSION_DEF= ${.CURDIR}/Version.def Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Mon Jul 28 05:37:10 2014 (r269178) +++ head/sys/kern/subr_sbuf.c Mon Jul 28 07:20:22 2014 (r269179) @@ -152,16 +152,11 @@ static int sbuf_extend(struct sbuf *s, int addlen) { char *newbuf; - size_t newsize; + int newsize; if (!SBUF_CANEXTEND(s)) return (-1); newsize = sbuf_extendsize(s->s_size + addlen); - if (s->s_buf == s->s_static_buf && newsize <= sizeof(s->s_static_buf)) { - s->s_size = sizeof(s->s_static_buf); - return (0); - } - newbuf = SBMALLOC(newsize); if (newbuf == NULL) return (-1); @@ -181,7 +176,7 @@ sbuf_extend(struct sbuf *s, int addlen) * big enough to hold at least length characters. */ static struct sbuf * -sbuf_newbuf(struct sbuf *s, char *buf, size_t length, int flags) +sbuf_newbuf(struct sbuf *s, char *buf, int length, int flags) { memset(s, 0, sizeof(*s)); @@ -200,11 +195,6 @@ sbuf_newbuf(struct sbuf *s, char *buf, s if ((flags & SBUF_AUTOEXTEND) != 0) s->s_size = sbuf_extendsize(s->s_size); - if (s->s_size <= sizeof(s->s_static_buf)) { - s->s_buf = s->s_static_buf; - return (s); - } - s->s_buf = SBMALLOC(s->s_size); if (s->s_buf == NULL) return (NULL); @@ -293,19 +283,21 @@ sbuf_clear(struct sbuf *s) * Effectively truncates the sbuf at the new position. */ int -sbuf_setpos(struct sbuf *s, size_t pos) +sbuf_setpos(struct sbuf *s, ssize_t pos) { assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + KASSERT(pos >= 0, + ("attempt to seek to a negative position (%jd)", (intmax_t)pos)); KASSERT(pos < s->s_size, ("attempt to seek past end of sbuf (%jd >= %jd)", (intmax_t)pos, (intmax_t)s->s_size)); KASSERT(!SBUF_ISSECTION(s), ("attempt to seek when in a section")); - if (pos > s->s_len) + if (pos < 0 || pos > s->s_len) return (-1); s->s_len = pos; return (0); @@ -569,8 +561,7 @@ int sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap) { va_list ap_copy; - size_t len; - int error; + int error, len; assert_sbuf_integrity(s); assert_sbuf_state(s, 0); Modified: head/sys/sys/sbuf.h ============================================================================== --- head/sys/sys/sbuf.h Mon Jul 28 05:37:10 2014 (r269178) +++ head/sys/sys/sbuf.h Mon Jul 28 07:20:22 2014 (r269179) @@ -44,8 +44,8 @@ struct sbuf { sbuf_drain_func *s_drain_func; /* drain function */ void *s_drain_arg; /* user-supplied drain argument */ int s_error; /* current error code */ - size_t s_size; /* size of storage buffer */ - size_t s_len; /* current length of string */ + ssize_t s_size; /* size of storage buffer */ + ssize_t s_len; /* current length of string */ #define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ #define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */ #define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ @@ -55,9 +55,6 @@ struct sbuf { #define SBUF_INSECTION 0x00100000 /* set by sbuf_start_section() */ int s_flags; /* flags */ ssize_t s_sect_len; /* current length of section */ -#define SBUF_STATIC_LEN 64 /* static storage buffer length */ - char s_static_buf[SBUF_STATIC_LEN]; - /* static storage buffer */ }; __BEGIN_DECLS @@ -68,7 +65,7 @@ struct sbuf *sbuf_new(struct sbuf *, cha #define sbuf_new_auto() \ sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND) void sbuf_clear(struct sbuf *); -int sbuf_setpos(struct sbuf *, size_t); +int sbuf_setpos(struct sbuf *, ssize_t); int sbuf_bcat(struct sbuf *, const void *, size_t); int sbuf_bcpy(struct sbuf *, const void *, size_t); int sbuf_cat(struct sbuf *, const char *);