Re: svn commit: r221993 - in head/sys: kern sys

2011-05-17 Thread Poul-Henning Kamp
In message 20110516211954.gj48...@deviant.kiev.zoral.com.ua, Kostik Belousov 
writes:

The bump was also needed after the r212367. Lets do one for two changes.

I have a few more changes coming, before the bump should happen.

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
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: r221993 - in head/sys: kern sys

2011-05-17 Thread Poul-Henning Kamp
In message 201105161747.40824@freebsd.org, John Baldwin writes:

 Yes I know, but sbufs are used on platforms where %z is not available
 so I prefer to use %jd, in particular since this is only assert strings.

Really?  They have %j but not %z?  intmax_t is newer than size_t.

Appearantly.

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
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: r221993 - in head/sys: kern sys

2011-05-17 Thread Poul-Henning Kamp
In message 20110516211954.gj48...@deviant.kiev.zoral.com.ua, Kostik Belousov 
writes:

struct sbuf is exposed to the libsubf.so consumers.
I think that libsbuf.so version shall be bumped (since no symver
compat can be provided, due to lack of versioning for libsbuf).

The bump was also needed after the r212367. Lets do one for two changes.

Ok, I'm done,

Question: Do we bumb the libsbuf version, or do we start using
symbol-versioning, and if so, how is that done ?

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
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: r221993 - in head/sys: kern sys

2011-05-17 Thread Kostik Belousov
On Tue, May 17, 2011 at 01:36:11PM +, Poul-Henning Kamp wrote:
 In message 20110516211954.gj48...@deviant.kiev.zoral.com.ua, Kostik 
 Belousov 
 writes:
 
 struct sbuf is exposed to the libsubf.so consumers.
 I think that libsbuf.so version shall be bumped (since no symver
 compat can be provided, due to lack of versioning for libsbuf).
 
 The bump was also needed after the r212367. Lets do one for two changes.
 
 Ok, I'm done,
 
 Question: Do we bumb the libsbuf version, or do we start using
 symbol-versioning, and if so, how is that done ?

We do bump the libsbuf version, regardless of the symbol versioning.
If symver is introduced, then it can be combined with the bump.

Please see http://people.freebsd.org/~deischen/symver/freebsd_versioning.txt
for the document describing the rules.

The exemplary use of the versioning for newly introduced library is
r221931.


pgpENv4dqIfJv.pgp
Description: PGP signature


Re: svn commit: r221993 - in head/sys: kern sys

2011-05-17 Thread Warner Losh

On May 17, 2011, at 7:44 AM, Kostik Belousov wrote:

 On Tue, May 17, 2011 at 01:36:11PM +, Poul-Henning Kamp wrote:
 In message 20110516211954.gj48...@deviant.kiev.zoral.com.ua, Kostik 
 Belousov 
 writes:
 
 struct sbuf is exposed to the libsubf.so consumers.
 I think that libsbuf.so version shall be bumped (since no symver
 compat can be provided, due to lack of versioning for libsbuf).
 
 The bump was also needed after the r212367. Lets do one for two changes.
 
 Ok, I'm done,
 
 Question: Do we bumb the libsbuf version, or do we start using
 symbol-versioning, and if so, how is that done ?
 
 We do bump the libsbuf version, regardless of the symbol versioning.
 If symver is introduced, then it can be combined with the bump.
 
 Please see http://people.freebsd.org/~deischen/symver/freebsd_versioning.txt
 for the document describing the rules.
 
 The exemplary use of the versioning for newly introduced library is
 r221931.

Also, there's a strong encouragement to go to symbol versioning as that makes 
our lives much easier going forward.

Warner

___
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: r221993 - in head/sys: kern sys

2011-05-16 Thread Poul-Henning Kamp
Author: phk
Date: Mon May 16 16:18:40 2011
New Revision: 221993
URL: http://svn.freebsd.org/changeset/base/221993

Log:
  Change the length quantities of sbufs to be ssize_t rather than int.
  
  Constify a couple of arguments.

Modified:
  head/sys/kern/subr_sbuf.c
  head/sys/sys/sbuf.h

Modified: head/sys/kern/subr_sbuf.c
==
--- head/sys/kern/subr_sbuf.c   Mon May 16 15:59:50 2011(r221992)
+++ head/sys/kern/subr_sbuf.c   Mon May 16 16:18:40 2011(r221993)
@@ -94,7 +94,8 @@ _assert_sbuf_integrity(const char *fun, 
KASSERT(s-s_buf != NULL,
(%s called with uninitialized or corrupt sbuf, fun));
KASSERT(s-s_len  s-s_size,
-   (wrote past end of sbuf (%d = %d), s-s_len, s-s_size));
+   (wrote past end of sbuf (%jd = %jd),
+   (intmax_t)s-s_len, (intmax_t)s-s_size));
 }
 
 static void
@@ -255,16 +256,17 @@ sbuf_clear(struct sbuf *s)
  * Effectively truncates the sbuf at the new position.
  */
 int
-sbuf_setpos(struct sbuf *s, int 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 (%d), pos));
+   (attempt to seek to a negative position (%jd), (intmax_t)pos));
KASSERT(pos  s-s_size,
-   (attempt to seek past end of sbuf (%d = %d), pos, s-s_size));
+   (attempt to seek past end of sbuf (%jd = %jd),
+   (intmax_t)pos, (intmax_t)s-s_size));
 
if (pos  0 || pos  s-s_len)
return (-1);
@@ -640,7 +642,7 @@ sbuf_trim(struct sbuf *s)
  * Check if an sbuf has an error.
  */
 int
-sbuf_error(struct sbuf *s)
+sbuf_error(const struct sbuf *s)
 {
 
return (s-s_error);
@@ -691,7 +693,7 @@ sbuf_data(struct sbuf *s)
 /*
  * Return the length of the sbuf data.
  */
-int
+ssize_t
 sbuf_len(struct sbuf *s)
 {
 
@@ -728,7 +730,7 @@ sbuf_delete(struct sbuf *s)
  * Check if an sbuf has been finished.
  */
 int
-sbuf_done(struct sbuf *s)
+sbuf_done(const struct sbuf *s)
 {
 
return (SBUF_ISFINISHED(s));

Modified: head/sys/sys/sbuf.h
==
--- head/sys/sys/sbuf.h Mon May 16 15:59:50 2011(r221992)
+++ head/sys/sys/sbuf.h Mon May 16 16:18:40 2011(r221993)
@@ -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 */
-   int  s_size;/* size of storage buffer */
-   int  s_len; /* current length of string */
+   ssize_t  s_size;/* size of storage buffer */
+   ssize_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 */
@@ -63,7 +63,7 @@ struct sbuf   *sbuf_new(struct sbuf *, cha
 #define sbuf_new_auto()\
sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND)
 voidsbuf_clear(struct sbuf *);
-int sbuf_setpos(struct sbuf *, int);
+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 *);
@@ -75,11 +75,11 @@ int  sbuf_vprintf(struct sbuf *, const 
 int sbuf_putc(struct sbuf *, int);
 voidsbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *);
 int sbuf_trim(struct sbuf *);
-int sbuf_error(struct sbuf *);
+int sbuf_error(const struct sbuf *);
 int sbuf_finish(struct sbuf *);
 char   *sbuf_data(struct sbuf *);
-int sbuf_len(struct sbuf *);
-int sbuf_done(struct sbuf *);
+ssize_t sbuf_len(struct sbuf *);
+int sbuf_done(const struct sbuf *);
 voidsbuf_delete(struct sbuf *);
 
 #ifdef _KERNEL
___
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: r221993 - in head/sys: kern sys

2011-05-16 Thread mdf
On Mon, May 16, 2011 at 9:18 AM, Poul-Henning Kamp p...@freebsd.org wrote:
 Author: phk
 Date: Mon May 16 16:18:40 2011
 New Revision: 221993
 URL: http://svn.freebsd.org/changeset/base/221993

 Log:
  Change the length quantities of sbufs to be ssize_t rather than int.

Why?

I don't object at all to changing the API to return ssize_t (though I
see no need), but changing the struct breaks the KBI for no
perceivable gain.  Do we really expect someone to put more than 2GB
into something that is a string buffer?

Thanks,
matthew

  Constify a couple of arguments.

 Modified:
  head/sys/kern/subr_sbuf.c
  head/sys/sys/sbuf.h

 Modified: head/sys/kern/subr_sbuf.c
 ==
 --- head/sys/kern/subr_sbuf.c   Mon May 16 15:59:50 2011        (r221992)
 +++ head/sys/kern/subr_sbuf.c   Mon May 16 16:18:40 2011        (r221993)
 @@ -94,7 +94,8 @@ _assert_sbuf_integrity(const char *fun,
        KASSERT(s-s_buf != NULL,
            (%s called with uninitialized or corrupt sbuf, fun));
        KASSERT(s-s_len  s-s_size,
 -           (wrote past end of sbuf (%d = %d), s-s_len, s-s_size));
 +           (wrote past end of sbuf (%jd = %jd),
 +           (intmax_t)s-s_len, (intmax_t)s-s_size));
  }

  static void
 @@ -255,16 +256,17 @@ sbuf_clear(struct sbuf *s)
  * Effectively truncates the sbuf at the new position.
  */
  int
 -sbuf_setpos(struct sbuf *s, int 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 (%d), pos));
 +           (attempt to seek to a negative position (%jd), (intmax_t)pos));
        KASSERT(pos  s-s_size,
 -           (attempt to seek past end of sbuf (%d = %d), pos, s-s_size));
 +           (attempt to seek past end of sbuf (%jd = %jd),
 +           (intmax_t)pos, (intmax_t)s-s_size));

        if (pos  0 || pos  s-s_len)
                return (-1);
 @@ -640,7 +642,7 @@ sbuf_trim(struct sbuf *s)
  * Check if an sbuf has an error.
  */
  int
 -sbuf_error(struct sbuf *s)
 +sbuf_error(const struct sbuf *s)
  {

        return (s-s_error);
 @@ -691,7 +693,7 @@ sbuf_data(struct sbuf *s)
  /*
  * Return the length of the sbuf data.
  */
 -int
 +ssize_t
  sbuf_len(struct sbuf *s)
  {

 @@ -728,7 +730,7 @@ sbuf_delete(struct sbuf *s)
  * Check if an sbuf has been finished.
  */
  int
 -sbuf_done(struct sbuf *s)
 +sbuf_done(const struct sbuf *s)
  {

        return (SBUF_ISFINISHED(s));

 Modified: head/sys/sys/sbuf.h
 ==
 --- head/sys/sys/sbuf.h Mon May 16 15:59:50 2011        (r221992)
 +++ head/sys/sys/sbuf.h Mon May 16 16:18:40 2011        (r221993)
 @@ -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 */
 -       int              s_size;        /* size of storage buffer */
 -       int              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   0x      /* fixed length buffer 
 (default) */
  #define        SBUF_AUTOEXTEND 0x0001      /* automatically extend 
 buffer */
  #define        SBUF_USRFLAGMSK 0x      /* mask of flags the user may 
 specify */
 @@ -63,7 +63,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 *, int);
 +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 *);
 @@ -75,11 +75,11 @@ int          sbuf_vprintf(struct sbuf *, const
  int             sbuf_putc(struct sbuf *, int);
  void            sbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *);
  int             sbuf_trim(struct sbuf *);
 -int             sbuf_error(struct sbuf *);
 +int             sbuf_error(const struct sbuf *);
  int             sbuf_finish(struct sbuf *);
  char           *sbuf_data(struct sbuf *);
 -int             sbuf_len(struct sbuf *);
 -int             sbuf_done(struct sbuf *);
 +ssize_t                 sbuf_len(struct sbuf *);
 +int             sbuf_done(const struct sbuf *);
  void            sbuf_delete(struct sbuf *);

  #ifdef _KERNEL

___
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: r221993 - in head/sys: kern sys

2011-05-16 Thread Pawel Jakub Dawidek
On Mon, May 16, 2011 at 04:18:40PM +, Poul-Henning Kamp wrote:
 Author: phk
 Date: Mon May 16 16:18:40 2011
 New Revision: 221993
 URL: http://svn.freebsd.org/changeset/base/221993
 
 Log:
   Change the length quantities of sbufs to be ssize_t rather than int.
   
   Constify a couple of arguments.
 
 Modified:
   head/sys/kern/subr_sbuf.c
   head/sys/sys/sbuf.h
 
 Modified: head/sys/kern/subr_sbuf.c
 ==
 --- head/sys/kern/subr_sbuf.c Mon May 16 15:59:50 2011(r221992)
 +++ head/sys/kern/subr_sbuf.c Mon May 16 16:18:40 2011(r221993)
 @@ -94,7 +94,8 @@ _assert_sbuf_integrity(const char *fun, 
   KASSERT(s-s_buf != NULL,
   (%s called with uninitialized or corrupt sbuf, fun));
   KASSERT(s-s_len  s-s_size,
 - (wrote past end of sbuf (%d = %d), s-s_len, s-s_size));
 + (wrote past end of sbuf (%jd = %jd),
 + (intmax_t)s-s_len, (intmax_t)s-s_size));

For ssize_t we have %zd.

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://yomoli.com


pgpMl1w9hZERA.pgp
Description: PGP signature


Re: svn commit: r221993 - in head/sys: kern sys

2011-05-16 Thread Poul-Henning Kamp
In message 20110516193833.ga2...@garage.freebsd.pl, Pawel Jakub Dawidek write
s:

 -(wrote past end of sbuf (%d =3D %d), s-s_len, s-s_size));
 +(wrote past end of sbuf (%jd =3D %jd),
 +(intmax_t)s-s_len, (intmax_t)s-s_size));

For ssize_t we have %zd.

Yes I know, but sbufs are used on platforms where %z is not available
so I prefer to use %jd, in particular since this is only assert strings.

Poul-Henning


-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
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: r221993 - in head/sys: kern sys

2011-05-16 Thread Poul-Henning Kamp
In message BANLkTin15ap=l5q6ji45b8-eqm9gg7q...@mail.gmail.com, m...@freebsd.or
g writes:

 Log:
 Change the length quantities of sbufs to be ssize_t rather than int.

Why?

Do we really expect someone to put more than 2GB
into something that is a string buffer?

That is exactly why I am doing it.

sbufs have gained a life outside FreeBSD, and while that particular
implementation has different internals, I would prefer if we can
keep the API unified across platforms.

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
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: r221993 - in head/sys: kern sys

2011-05-16 Thread Kostik Belousov
On Mon, May 16, 2011 at 04:18:40PM +, Poul-Henning Kamp wrote:
 Author: phk
 Date: Mon May 16 16:18:40 2011
 New Revision: 221993
 URL: http://svn.freebsd.org/changeset/base/221993
 
 Log:
   Change the length quantities of sbufs to be ssize_t rather than int.
   
   Constify a couple of arguments.

 Modified: head/sys/sys/sbuf.h
 ==
 --- head/sys/sys/sbuf.h   Mon May 16 15:59:50 2011(r221992)
 +++ head/sys/sys/sbuf.h   Mon May 16 16:18:40 2011(r221993)
 @@ -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 */
 - int  s_size;/* size of storage buffer */
 - int  s_len; /* current length of string */
 + ssize_t  s_size;/* size of storage buffer */
 + ssize_t  s_len; /* current length of string */
struct sbuf is exposed to the libsubf.so consumers.
I think that libsbuf.so version shall be bumped (since no symver
compat can be provided, due to lack of versioning for libsbuf).

The bump was also needed after the r212367. Lets do one for two changes.


pgpkH3lSrCXsw.pgp
Description: PGP signature


Re: svn commit: r221993 - in head/sys: kern sys

2011-05-16 Thread John Baldwin
On Monday, May 16, 2011 4:27:11 pm Poul-Henning Kamp wrote:
 In message 20110516193833.ga2...@garage.freebsd.pl, Pawel Jakub Dawidek 
write
 s:
 
  -  (wrote past end of sbuf (%d =3D %d), s-s_len, s-s_size));
  +  (wrote past end of sbuf (%jd =3D %jd),
  +  (intmax_t)s-s_len, (intmax_t)s-s_size));
 
 For ssize_t we have %zd.
 
 Yes I know, but sbufs are used on platforms where %z is not available
 so I prefer to use %jd, in particular since this is only assert strings.

Really?  They have %j but not %z?  intmax_t is newer than size_t.

-- 
John Baldwin
___
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