Re: svn commit: r268494 - in head: lib/libsbuf sys/kern sys/sys

2014-07-25 Thread Xin Li
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 07/10/14 06:08, Pietro Cerutti wrote:
 Author: gahr (ports committer) Date: Thu Jul 10 13:08:51 2014 New
 Revision: 268494 URL:
 http://svnweb.freebsd.org/changeset/base/268494
 
 Log: Implement Short/Small String Optimization in SBUF(9) and
 change lengths and positions in the API from ssize_t and int to
 size_t.
 
 CR:   D388 Approved by:   des, bapt

Please fix the ABI breakage by creating the compatibility shims or
revert this change for now.

Once a library have converted to use versioned symbols, we are
promising not to break ABI compatibility and it's not Okay to break
that promise.

Cheers,
- -- 
Xin LI delp...@delphij.nethttps://www.delphij.net/
FreeBSD - The Power to Serve!   Live free or die
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0

iQIcBAEBCgAGBQJT0u+vAAoJEJW2GBstM+nsokoP/jz6o84f/NAwlWeMjBdYEXBk
vYBLZN8tWNNwppykdkiFps67HYBgaVI2rIKHfcIRaNT4BG1MdQ78jaes6NEukbBz
wJAeggpsJh8DuzfBEKDuXSG7VGfdrjaPa5PwfANgnwxFy8aagZA1xAyy6l9lUIqq
J+hWtmIbZSttn3nlyYQXVjcsCaOaCAn4HMBdfAMNV+4LJtNNDGhrwL5kUncLAru3
9PdFqgjJPuvbaI10L6vSIbthHnAj8pVtNsRj7W54zjkMvhfweT66hajDNMvmgc5O
9BcFNqCmtemqpVDf3gRPfwTIaoPgbHnJnZPrJ+Ria2D/S3HnFRr96wCGYiy6yP1x
G9Raf8/6qKDZ3WxjCJIOly6KVbKQxroy7SL59SW1h5LX9mgq5lqrkDeL9lRiLzwB
7LNzrGfvVUsufnLy0DQk9tiMGx4UTTjUFYcWWGK6m214lxJ/4+Zv6DlYU4m21Teg
OqsuL/W78j0/1x0j+d7tHP4uucISQHF8suehXhGTbdpio7Mi4G6SzeZfqpYXW6HP
ZwRvDJuiG8Q6o1V3Uhf+HvvEifjzm4779nycSyzq7T2qlRRU9Gs6rdJmRcR6E+pR
1iVQPNSDh4M/6GQ/NySxY8Xd1pdSvYumDzjh12RULY2agHuccYRhkRQWLLBqtV/U
wrS+hdXjlum9ZCoZRsn6
=FR8o
-END PGP SIGNATURE-
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268494 - in head: lib/libsbuf sys/kern sys/sys

2014-07-23 Thread Konstantin Belousov
On Mon, Jul 21, 2014 at 11:07:18AM +0200, Pietro Cerutti wrote:
 On 2014-Jul-18, 18:47, Bryan Drewery wrote:
  On 2014-07-10 08:08, Pietro Cerutti wrote:
   Author: gahr (ports committer)
   Date: Thu Jul 10 13:08:51 2014
   New Revision: 268494
   URL: http://svnweb.freebsd.org/changeset/base/268494
   
   Log:
 Implement Short/Small String Optimization in SBUF(9) and change 
   lengths and
 positions in the API from ssize_t and int to size_t.
   
 CR: D388
 Approved by:des, bapt
   
   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 Thu Jul 10 13:04:52 2014
   (r268493)
   +++ head/lib/libsbuf/Makefile Thu Jul 10 13:08:51 2014
   (r268494)
   @@ -4,7 +4,7 @@ LIB=  sbuf
SHLIBDIR?=   /lib
SRCS=subr_sbuf.c
   
   -SHLIB_MAJOR  = 6
   +SHLIB_MAJOR  = 7
   
SYMBOL_MAPS=${.CURDIR}/Symbol.map
VERSION_DEF= ${.CURDIR}/Version.def
   
  
  We have symbol versioning in libsbuf. Shouldn't need to bump the 
  version. Just need to add a compat function for everything. It would be 
  a lot of work, but bumping for ssize_t-size_t seems gratuitous to me.
 
 The bump was due mainly to the addition of the s_static_buf field to the
 sbuf struct.

So, how this invalidates the point of not breaking the ABI ?
We do not bump .so version for versioned libraries.

For all symbols (functions) which are affected by the change,
the compat shims in the old namespace must be provided.


pgpmttjOL06kP.pgp
Description: PGP signature


Re: svn commit: r268494 - in head: lib/libsbuf sys/kern sys/sys

2014-07-21 Thread Pietro Cerutti
On 2014-Jul-18, 18:47, Bryan Drewery wrote:
 On 2014-07-10 08:08, Pietro Cerutti wrote:
  Author: gahr (ports committer)
  Date: Thu Jul 10 13:08:51 2014
  New Revision: 268494
  URL: http://svnweb.freebsd.org/changeset/base/268494
  
  Log:
Implement Short/Small String Optimization in SBUF(9) and change 
  lengths and
positions in the API from ssize_t and int to size_t.
  
CR:   D388
Approved by:  des, bapt
  
  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   Thu Jul 10 13:04:52 2014
  (r268493)
  +++ head/lib/libsbuf/Makefile   Thu Jul 10 13:08:51 2014
  (r268494)
  @@ -4,7 +4,7 @@ LIB=sbuf
   SHLIBDIR?= /lib
   SRCS=  subr_sbuf.c
  
  -SHLIB_MAJOR= 6
  +SHLIB_MAJOR= 7
  
   SYMBOL_MAPS=${.CURDIR}/Symbol.map
   VERSION_DEF=   ${.CURDIR}/Version.def
  
 
 We have symbol versioning in libsbuf. Shouldn't need to bump the 
 version. Just need to add a compat function for everything. It would be 
 a lot of work, but bumping for ssize_t-size_t seems gratuitous to me.

The bump was due mainly to the addition of the s_static_buf field to the
sbuf struct.

-- 
Pietro Cerutti
The FreeBSD Project
g...@freebsd.org

PGP Public Key:
http://gahr.ch/pgp


pgpfoYyyeQK1H.pgp
Description: PGP signature


Re: svn commit: r268494 - in head: lib/libsbuf sys/kern sys/sys

2014-07-18 Thread Bryan Drewery

On 2014-07-10 08:08, Pietro Cerutti wrote:

Author: gahr (ports committer)
Date: Thu Jul 10 13:08:51 2014
New Revision: 268494
URL: http://svnweb.freebsd.org/changeset/base/268494

Log:
  Implement Short/Small String Optimization in SBUF(9) and change 
lengths and

  positions in the API from ssize_t and int to size_t.

  CR:   D388
  Approved by:  des, bapt

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   Thu Jul 10 13:04:52 2014(r268493)
+++ head/lib/libsbuf/Makefile   Thu Jul 10 13:08:51 2014(r268494)
@@ -4,7 +4,7 @@ LIB=sbuf
 SHLIBDIR?= /lib
 SRCS=  subr_sbuf.c

-SHLIB_MAJOR= 6
+SHLIB_MAJOR= 7

 SYMBOL_MAPS=${.CURDIR}/Symbol.map
 VERSION_DEF=   ${.CURDIR}/Version.def



We have symbol versioning in libsbuf. Shouldn't need to bump the 
version. Just need to add a compat function for everything. It would be 
a lot of work, but bumping for ssize_t-size_t seems gratuitous to me.


--
Regards,
Bryan Drewery
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268494 - in head: lib/libsbuf sys/kern sys/sys

2014-07-10 Thread Pietro Cerutti
Author: gahr (ports committer)
Date: Thu Jul 10 13:08:51 2014
New Revision: 268494
URL: http://svnweb.freebsd.org/changeset/base/268494

Log:
  Implement Short/Small String Optimization in SBUF(9) and change lengths and
  positions in the API from ssize_t and int to size_t.
  
  CR:   D388
  Approved by:  des, bapt

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   Thu Jul 10 13:04:52 2014(r268493)
+++ head/lib/libsbuf/Makefile   Thu Jul 10 13:08:51 2014(r268494)
@@ -4,7 +4,7 @@ LIB=sbuf
 SHLIBDIR?= /lib
 SRCS=  subr_sbuf.c 
 
-SHLIB_MAJOR= 6
+SHLIB_MAJOR= 7
 
 SYMBOL_MAPS=${.CURDIR}/Symbol.map
 VERSION_DEF=   ${.CURDIR}/Version.def

Modified: head/sys/kern/subr_sbuf.c
==
--- head/sys/kern/subr_sbuf.c   Thu Jul 10 13:04:52 2014(r268493)
+++ head/sys/kern/subr_sbuf.c   Thu Jul 10 13:08:51 2014(r268494)
@@ -152,11 +152,16 @@ static int
 sbuf_extend(struct sbuf *s, int addlen)
 {
char *newbuf;
-   int newsize;
+   size_t 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);
@@ -176,7 +181,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, int length, int flags)
+sbuf_newbuf(struct sbuf *s, char *buf, size_t length, int flags)
 {
 
memset(s, 0, sizeof(*s));
@@ -195,6 +200,11 @@ sbuf_newbuf(struct sbuf *s, char *buf, i
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);
@@ -283,21 +293,19 @@ sbuf_clear(struct sbuf *s)
  * Effectively truncates the sbuf at the new position.
  */
 int
-sbuf_setpos(struct sbuf *s, ssize_t pos)
+sbuf_setpos(struct sbuf *s, size_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  0 || pos  s-s_len)
+   if (pos  s-s_len)
return (-1);
s-s_len = pos;
return (0);
@@ -561,7 +569,8 @@ int
 sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap)
 {
va_list ap_copy;
-   int error, len;
+   size_t len;
+   int error;
 
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);

Modified: head/sys/sys/sbuf.h
==
--- head/sys/sys/sbuf.h Thu Jul 10 13:04:52 2014(r268493)
+++ head/sys/sys/sbuf.h Thu Jul 10 13:08:51 2014(r268494)
@@ -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 */
-   ssize_t  s_size;/* size of storage buffer */
-   ssize_t  s_len; /* current length of string */
+   size_t   s_size;/* size of storage buffer */
+   size_t   s_len; /* current length of string */
 #defineSBUF_FIXEDLEN   0x  /* fixed length buffer 
(default) */
 #defineSBUF_AUTOEXTEND 0x0001  /* automatically extend buffer 
*/
 #defineSBUF_USRFLAGMSK 0x  /* mask of flags the user may 
specify */
@@ -55,6 +55,9 @@ struct sbuf {
 #defineSBUF_INSECTION  0x0010  /* set by sbuf_start_section() 
*/
int  s_flags;   /* flags */
ssize_t  s_sect_len;/* current length of section */
+#define SBUF_STATIC_LEN64  /* static storage buffer length 
*/
+   char s_static_buf[SBUF_STATIC_LEN];
+   /* static storage buffer */
 };
 
 __BEGIN_DECLS
@@ -65,7 +68,7 @@ struct sbuf   *sbuf_new(struct sbuf *, cha
 #define sbuf_new_auto()\
sbuf_new(NULL, NULL, 0,