CVS commit: src/bin/pax

2021-11-05 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat Nov  6 01:19:19 UTC 2021

Modified Files:
src/bin/pax: pax.1

Log Message:
pax.1: minor grammar fixes


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.71 src/bin/pax/pax.1:1.72
--- src/bin/pax/pax.1:1.71	Tue Mar 19 00:36:14 2019
+++ src/bin/pax/pax.1	Sat Nov  6 01:19:19 2021
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.71 2019/03/19 00:36:14 gutteridge Exp $
+.\"$NetBSD: pax.1,v 1.72 2021/11/06 01:19:19 gutteridge Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -489,7 +489,7 @@ Multiple characteristics can be concaten
 and multiple
 .Fl p
 options can be specified.
-The meaning of the specification characters are as follows:
+The meanings of the specification characters are as follows:
 .Bl -tag -width 2n
 .It Cm a
 Do not preserve file access times.
@@ -571,7 +571,7 @@ operands according to the substitution e
 using the syntax of the
 .Xr ed 1
 utility regular expressions.
-The format of these regular expressions are:
+The format of these regular expressions is:
 .Dl /old/new/[gps]
 As in
 .Xr ed 1 ,



CVS commit: src/bin/pax

2021-11-05 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat Nov  6 01:19:19 UTC 2021

Modified Files:
src/bin/pax: pax.1

Log Message:
pax.1: minor grammar fixes


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src

2021-11-05 Thread Joerg Sonnenberger
On Thu, Nov 04, 2021 at 06:17:20PM -0700, Alistair Crooks wrote:
> I think you're misreading the diff - it will only wrap if the minimum size
> is 0x, which is...ummm...highly unlikely (it's defined to be 0
> right now, the type is unsigned)

I'm not so much worried about the constant, but the right hand size.
Without looking at the types, I can't be sure that "context->pwdlen + 1"
doesn't overflow or that "context->m_cost - 1" can't underflow. Much
easier and safer to just use a type cast...

Joerg


CVS commit: src/sys/dev/pci

2021-11-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Nov  5 23:39:47 UTC 2021

Modified Files:
src/sys/dev/pci: if_mcx.c

Log Message:
mcx(4): ensure that RQT size is always a power of two.
Fixes PR kern/56484.
Thanks riastradh for the power of two patch :). OK: mrg, jmcneill, riastradh.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/if_mcx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2021-11-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Nov  5 23:39:47 UTC 2021

Modified Files:
src/sys/dev/pci: if_mcx.c

Log Message:
mcx(4): ensure that RQT size is always a power of two.
Fixes PR kern/56484.
Thanks riastradh for the power of two patch :). OK: mrg, jmcneill, riastradh.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/if_mcx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.22 src/sys/dev/pci/if_mcx.c:1.23
--- src/sys/dev/pci/if_mcx.c:1.22	Sun Sep 26 20:14:07 2021
+++ src/sys/dev/pci/if_mcx.c	Fri Nov  5 23:39:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.22 2021/09/26 20:14:07 jmcneill Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.23 2021/11/05 23:39:47 andvar Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.101 2021/06/02 19:16:11 patrick Exp $ */
 
 /*
@@ -23,7 +23,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.22 2021/09/26 20:14:07 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.23 2021/11/05 23:39:47 andvar Exp $");
 
 #include 
 #include 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -2956,6 +2957,8 @@ mcx_attach(device_t parent, device_t sel
 
 	sc->sc_nqueues = uimin(MCX_MAX_QUEUES, msix);
 	sc->sc_nqueues = uimin(sc->sc_nqueues, ncpu);
+	/* Round down to a power of two.  */
+	sc->sc_nqueues = 1U << ilog2(sc->sc_nqueues);
 	sc->sc_queues = kmem_zalloc(sc->sc_nqueues * sizeof(*sc->sc_queues),
 	KM_SLEEP);
 



CVS commit: src/share/man/man3

2021-11-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov  5 22:39:36 UTC 2021

Modified Files:
src/share/man/man3: ilog2.3

Log Message:
Rework ilog2(3) man page.

- Tweak title.
- Clarify semantics -- round down, not any other way.
- xref ffs(3)
- Fix return type: int.
- Fix language about input type.
  . Any unsigned type is fine.
  . Types smaller than uint32_t will be safely converted to uint32_t.
- Note that it is a constant expression if x is constant.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man3/ilog2.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man3/ilog2.3
diff -u src/share/man/man3/ilog2.3:1.5 src/share/man/man3/ilog2.3:1.6
--- src/share/man/man3/ilog2.3:1.5	Tue May 10 06:39:45 2011
+++ src/share/man/man3/ilog2.3	Fri Nov  5 22:39:35 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: ilog2.3,v 1.5 2011/05/10 06:39:45 jruoho Exp $ $
+.\" $NetBSD: ilog2.3,v 1.6 2021/11/05 22:39:35 riastradh Exp $ $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,34 +27,53 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 10, 2011
+.Dd November 5, 2021
 .Dt ILOG2 3
 .Os
 .Sh NAME
 .Nm ilog2
-.Nd integer logarithm
+.Nd integer base-2 logarithm
 .Sh SYNOPSIS
 .In sys/bitops.h
-.Ft size
+.Ft int
 .Fn ilog2 "size x"
 .Sh DESCRIPTION
-The
+For positive
+.Fa x ,
+the
 .Fn ilog2
-macro returns an integer (binary) logarithm of
-.Fa x .
-It is the logarithm for base 2; the binary logarithm of
-.Fa x
-is the power to which the number 2 must be raised to obtain the value
+macro returns the integer part of the base-2 logarithm of
+.Fa x ;
+that is,
+.Fo floor
+.Fn log_2 x
+.Fc .
+If
+.Fa n Li = Fn ilog2 x ,
+then
+.Fa n
+is the largest integer such that
+.No 2** Ns Fa n Li <= Fa x ;
+in other words,
+.Fn ilog2
+returns the largest integer to which 2 can be raised to obtain a value
+at most
 .Fa x .
 .Pp
-The type of the input parameter should be either
-.Vt uint32_t
-or
-.Vt uint64_t .
+The type of the input parameter must be unsigned.
+.Pp
+If
+.Fa x
+is a constant expression, then so is
+.Fn ilog2 x .
 .Sh ERRORS
-A value \-1 is returned on error.
+.Fn ilog2
+returns \-1 when
+.Fa x
+is zero.
 .Sh SEE ALSO
 .Xr bitops 3 ,
+.Xr ffs 3 ,
 .Xr ilogb 3 ,
 .Xr log2 3 ,
 .Xr imax 9 ,



CVS commit: src/share/man/man3

2021-11-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov  5 22:39:36 UTC 2021

Modified Files:
src/share/man/man3: ilog2.3

Log Message:
Rework ilog2(3) man page.

- Tweak title.
- Clarify semantics -- round down, not any other way.
- xref ffs(3)
- Fix return type: int.
- Fix language about input type.
  . Any unsigned type is fine.
  . Types smaller than uint32_t will be safely converted to uint32_t.
- Note that it is a constant expression if x is constant.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man3/ilog2.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/indent

2021-11-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Nov  5 22:06:43 UTC 2021

Modified Files:
src/usr.bin/indent: lexi.c

Log Message:
indent: consistently use token.e[-1] for the last added character

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/usr.bin/indent/lexi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.131 src/usr.bin/indent/lexi.c:1.132
--- src/usr.bin/indent/lexi.c:1.131	Fri Nov  5 21:08:04 2021
+++ src/usr.bin/indent/lexi.c	Fri Nov  5 22:06:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.131 2021/11/05 21:08:04 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.132 2021/11/05 22:06:43 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c	8.1 (
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.131 2021/11/05 21:08:04 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.132 2021/11/05 22:06:43 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -394,7 +394,7 @@ lex_word(void)
 static void
 lex_char_or_string(void)
 {
-for (char delim = *token.s;;) {
+for (char delim = token.e[-1];;) {
 	if (*inp.s == '\n') {
 	diag(1, "Unterminated literal");
 	return;
@@ -576,7 +576,7 @@ lexi(void)
 bool unary_delim = false;	/* whether the current token forces a
  * following operator to be unary */
 
-switch (*token.s) {
+switch (token.e[-1]) {
 case '\n':
 	unary_delim = ps.next_unary;
 	ps.next_col_1 = true;
@@ -652,7 +652,7 @@ lexi(void)
 	lsym = ps.next_unary ? lsym_unary_op : lsym_binary_op;
 	unary_delim = true;
 
-	if (*inp.s == token.s[0]) {	/* ++, -- */
+	if (*inp.s == token.e[-1]) {	/* ++, -- */
 	*token.e++ = *inp.s++;
 	if (ps.prev_token == lsym_ident ||
 		ps.prev_token == lsym_rparen_or_rbracket) {
@@ -724,25 +724,22 @@ lexi(void)
 	break;
 
 default:
-	if (token.s[0] == '/' && (*inp.s == '*' || *inp.s == '/')) {
-	/* it is start of comment */
+	if (token.e[-1] == '/' && (*inp.s == '*' || *inp.s == '/')) {
 	*token.e++ = inbuf_next();
-
 	lsym = lsym_comment;
 	unary_delim = ps.next_unary;
 	break;
 	}
 
-	while (token.e[-1] == *inp.s || *inp.s == '=') {
-	/* handle '||', '&&', etc., and also things as in 'int *i' */
+	/* handle '||', '&&', etc., and also things as in 'int *i' */
+	while (token.e[-1] == *inp.s || *inp.s == '=')
 	token_add_char(inbuf_next());
-	}
 
 	lsym = ps.next_unary ? lsym_unary_op : lsym_binary_op;
 	unary_delim = true;
 }
 
-if (inp.s >= inp.e)		/* check for input buffer empty */
+if (inp.s >= inp.e)
 	inbuf_read_line();
 
 ps.next_unary = unary_delim;



CVS commit: src/usr.bin/indent

2021-11-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Nov  5 22:06:43 UTC 2021

Modified Files:
src/usr.bin/indent: lexi.c

Log Message:
indent: consistently use token.e[-1] for the last added character

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/usr.bin/indent/lexi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/indent

2021-11-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Nov  5 21:52:17 UTC 2021

Modified Files:
src/usr.bin/indent: args.c

Log Message:
indent: clean up argument parsing

In struct pro, place the dependent member below its dependency.

In load_profile, consistently use -1 when outside a comment.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/indent/args.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/indent

2021-11-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Nov  5 21:52:17 UTC 2021

Modified Files:
src/usr.bin/indent: args.c

Log Message:
indent: clean up argument parsing

In struct pro, place the dependent member below its dependency.

In load_profile, consistently use -1 when outside a comment.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/indent/args.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/args.c
diff -u src/usr.bin/indent/args.c:1.68 src/usr.bin/indent/args.c:1.69
--- src/usr.bin/indent/args.c:1.68	Sun Oct 31 22:38:12 2021
+++ src/usr.bin/indent/args.c	Fri Nov  5 21:52:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.68 2021/10/31 22:38:12 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.69 2021/11/05 21:52:17 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.68 2021/10/31 22:38:12 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.69 2021/11/05 21:52:17 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -66,9 +66,9 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 #endif
 
 #define bool_option(name, value, var) \
-	{name, true, value, false, 0, 0, assert_type(&(opt.var), bool *)}
+	{name, true, false, value, 0, 0, assert_type(&(opt.var), bool *)}
 #define bool_options(name, var) \
-	{name, true, false, true, 0, 0, assert_type(&(opt.var), bool *)}
+	{name, true, true, false, 0, 0, assert_type(&(opt.var), bool *)}
 #define int_option(name, var, min, max) \
 	{name, false, false, false, min, max, assert_type(&(opt.var), int *)}
 
@@ -76,8 +76,8 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 static const struct pro {
 const char p_name[5];	/* e.g. "bl", "cli" */
 bool p_is_bool;
-bool p_bool_value;
 bool p_may_negate;
+bool p_bool_value;		/* only relevant if !p_may_negate */
 short i_min;
 short i_max;
 void *p_var;		/* the associated variable */
@@ -272,10 +272,10 @@ load_profile(const char *fname, bool mus
 	int ch, comment_ch = -1;
 
 	while ((ch = getc(f)) != EOF) {
-	if (ch == '*' && comment_ch < 0 && n > 0 && buf[n - 1] == '/') {
+	if (ch == '*' && comment_ch == -1 && n > 0 && buf[n - 1] == '/') {
 		n--;
-		comment_ch = ch;
-	} else if (comment_ch >= 0) {
+		comment_ch = '*';
+	} else if (comment_ch != -1) {
 		comment_ch = ch == '/' && comment_ch == '*' ? -1 : ch;
 	} else if (isspace((unsigned char)ch)) {
 		break;



CVS commit: src/usr.bin/indent

2021-11-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Nov  5 21:39:12 UTC 2021

Modified Files:
src/usr.bin/indent: indent.h io.c

Log Message:
indent: the '+ 1' in dump_line_code is not an off-by-one error


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.114 -r1.115 src/usr.bin/indent/io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.77 src/usr.bin/indent/indent.h:1.78
--- src/usr.bin/indent/indent.h:1.77	Fri Nov  5 19:33:28 2021
+++ src/usr.bin/indent/indent.h	Fri Nov  5 21:39:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.77 2021/11/05 19:33:28 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.78 2021/11/05 21:39:12 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -283,7 +283,8 @@ extern struct parser_state {
  * statement */
 short paren_indents[20];	/* indentation of the operand/argument of each
  * level of parentheses or brackets, relative
- * to the enclosing statement */
+ * to the enclosing statement; if negative,
+ * reflected at -1 */
 int cast_mask;		/* indicates which close parentheses
  * potentially close off casts */
 int not_cast_mask;		/* indicates which close parentheses

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.114 src/usr.bin/indent/io.c:1.115
--- src/usr.bin/indent/io.c:1.114	Thu Nov  4 19:23:57 2021
+++ src/usr.bin/indent/io.c	Fri Nov  5 21:39:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.114 2021/11/04 19:23:57 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.115 2021/11/05 21:39:12 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)io.c	8.1 (Be
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.114 2021/11/04 19:23:57 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.115 2021/11/05 21:39:12 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -150,8 +150,7 @@ dump_line_code(int ind)
 for (int i = 0; i < ps.p_l_follow; i++) {
 	if (ps.paren_indents[i] >= 0) {
 	int paren_ind = ps.paren_indents[i];
-	/* XXX: the '+ 1' smells like an off-by-one error. */
-	ps.paren_indents[i] = (short)-(paren_ind + target_ind + 1);
+	ps.paren_indents[i] = (short)(-1 - (paren_ind + target_ind));
 	debug_println(
 		"setting paren_indents[%d] from %d to %d for column %d",
 		i, paren_ind, ps.paren_indents[i], target_ind + 1);



CVS commit: src/usr.bin/indent

2021-11-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Nov  5 21:39:12 UTC 2021

Modified Files:
src/usr.bin/indent: indent.h io.c

Log Message:
indent: the '+ 1' in dump_line_code is not an off-by-one error


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.114 -r1.115 src/usr.bin/indent/io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/indent

2021-11-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Nov  5 21:08:04 UTC 2021

Modified Files:
src/usr.bin/indent: lexi.c

Log Message:
indent: add debug output for remaining members of parser_status


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/indent/lexi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.130 src/usr.bin/indent/lexi.c:1.131
--- src/usr.bin/indent/lexi.c:1.130	Fri Nov  5 19:33:28 2021
+++ src/usr.bin/indent/lexi.c	Fri Nov  5 21:08:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.130 2021/11/05 19:33:28 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.131 2021/11/05 21:08:04 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c	8.1 (
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.130 2021/11/05 19:33:28 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.131 2021/11/05 21:08:04 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -297,11 +297,17 @@ debug_lexi(lexer_symbol lsym)
 debug_ps_bool(next_col_1);
 debug_ps_bool(curr_col_1);
 debug_ps_bool(next_unary);
-// procname
+if (strcmp(ps.procname, prev_ps.procname) != 0)
+	debug_println("ps.procname = '%s'", ps.procname);
 debug_ps_bool(want_blank);
 debug_ps_int(paren_level);
 debug_ps_int(p_l_follow);
-// paren_indents
+if (ps.paren_level != prev_ps.paren_level) {
+	debug_printf("ps.paren_indents:");
+	for (int i = 0; i < ps.paren_level; i++)
+	debug_printf(" %d", ps.paren_indents[i]);
+	debug_println("");
+}
 debug_ps_int(cast_mask);
 debug_ps_int(not_cast_mask);
 



CVS commit: src/usr.bin/indent

2021-11-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Nov  5 21:08:04 UTC 2021

Modified Files:
src/usr.bin/indent: lexi.c

Log Message:
indent: add debug output for remaining members of parser_status


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/indent/lexi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/indent

2021-11-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Nov  5 19:42:48 UTC 2021

Modified Files:
src/usr.bin/indent: indent.c

Log Message:
indent: rename process_keyword_do to process_do, same for 'else'

Before the symbols from the tokenizer had the prefix 'lsym', the symbols
could not be simply called 'else' and 'do'. The functions for processing
the tokens followed that naming scheme.

When the prefix 'lsym' was introduced, the word 'keyword' was no longer
needed, neither in the constants nor in the function names.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/usr.bin/indent/indent.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.208 src/usr.bin/indent/indent.c:1.209
--- src/usr.bin/indent/indent.c:1.208	Fri Nov  5 19:33:28 2021
+++ src/usr.bin/indent/indent.c	Fri Nov  5 19:42:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.208 2021/11/05 19:33:28 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.209 2021/11/05 19:42:48 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.208 2021/11/05 19:33:28 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.209 2021/11/05 19:42:48 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -1084,7 +1084,7 @@ process_rbrace(bool *spaced_expr, int *d
 }
 
 static void
-process_keyword_do(bool *force_nl, bool *last_else)
+process_do(bool *force_nl, bool *last_else)
 {
 ps.in_stmt = false;
 
@@ -1101,7 +1101,7 @@ process_keyword_do(bool *force_nl, bool 
 }
 
 static void
-process_keyword_else(bool *force_nl, bool *last_else)
+process_else(bool *force_nl, bool *last_else)
 {
 ps.in_stmt = false;
 
@@ -1491,11 +1491,11 @@ main_loop(void)
 	goto copy_token;
 
 	case lsym_do:
-	process_keyword_do(_nl, _else);
+	process_do(_nl, _else);
 	goto copy_token;
 
 	case lsym_else:
-	process_keyword_else(_nl, _else);
+	process_else(_nl, _else);
 	goto copy_token;
 
 	case lsym_typedef:



CVS commit: src/usr.bin/indent

2021-11-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Nov  5 19:42:48 UTC 2021

Modified Files:
src/usr.bin/indent: indent.c

Log Message:
indent: rename process_keyword_do to process_do, same for 'else'

Before the symbols from the tokenizer had the prefix 'lsym', the symbols
could not be simply called 'else' and 'do'. The functions for processing
the tokens followed that naming scheme.

When the prefix 'lsym' was introduced, the word 'keyword' was no longer
needed, neither in the constants nor in the function names.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/usr.bin/indent/indent.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2021-11-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Nov  5 19:33:29 UTC 2021

Modified Files:
src/tests/usr.bin/indent: token_comment.c
src/usr.bin/indent: indent.c indent.h lexi.c pr_comment.c

Log Message:
indent: rename ps.curr_newline to next_col_1

For symmetry with ps.curr_col_1.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/indent/token_comment.c
cvs rdiff -u -r1.207 -r1.208 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.129 -r1.130 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.96 -r1.97 src/usr.bin/indent/pr_comment.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/indent/token_comment.c
diff -u src/tests/usr.bin/indent/token_comment.c:1.17 src/tests/usr.bin/indent/token_comment.c:1.18
--- src/tests/usr.bin/indent/token_comment.c:1.17	Thu Nov  4 18:38:37 2021
+++ src/tests/usr.bin/indent/token_comment.c	Fri Nov  5 19:33:28 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token_comment.c,v 1.17 2021/11/04 18:38:37 rillig Exp $ */
+/* $NetBSD: token_comment.c,v 1.18 2021/11/05 19:33:28 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -41,7 +41,7 @@
  * - with varying opt.comment_column (-c0, -c1, -c33, -c80)
  * - with varying opt.decl_comment_column (-cd0, -cd1, -cd20, -cd33, -cd80)
  * - with/without ps.decl_on_line
- * - with/without ps.curr_newline
+ * - with/without ps.next_col_1
  *
  * - very long comments that overflow the buffer 'com'
  * - comments that come from save_com

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.207 src/usr.bin/indent/indent.c:1.208
--- src/usr.bin/indent/indent.c:1.207	Thu Nov  4 20:31:04 2021
+++ src/usr.bin/indent/indent.c	Fri Nov  5 19:33:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.207 2021/11/04 20:31:04 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.208 2021/11/05 19:33:28 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.207 2021/11/04 20:31:04 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.208 2021/11/05 19:33:28 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -513,7 +513,7 @@ main_init_globals(void)
 
 ps.s_sym[0] = psym_stmt_list;
 ps.prev_token = lsym_semicolon;
-ps.curr_newline = true;
+ps.next_col_1 = true;
 
 const char *suffix = getenv("SIMPLE_BACKUP_SUFFIX");
 if (suffix != NULL)

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.76 src/usr.bin/indent/indent.h:1.77
--- src/usr.bin/indent/indent.h:1.76	Wed Nov  3 21:47:35 2021
+++ src/usr.bin/indent/indent.h	Fri Nov  5 19:33:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.76 2021/11/03 21:47:35 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.77 2021/11/05 19:33:28 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -263,9 +263,9 @@ extern struct parser_state {
 lexer_symbol prev_token;
 bool prev_is_type;
 bool curr_is_type;
-bool curr_newline;
 bool curr_col_1;		/* whether the current token started in column
  * 1 of the unformatted input */
+bool next_col_1;
 bool next_unary;		/* whether the following operator should be
  * unary */
 

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.129 src/usr.bin/indent/lexi.c:1.130
--- src/usr.bin/indent/lexi.c:1.129	Mon Nov  1 23:44:08 2021
+++ src/usr.bin/indent/lexi.c	Fri Nov  5 19:33:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.129 2021/11/01 23:44:08 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.130 2021/11/05 19:33:28 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c	8.1 (
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.129 2021/11/01 23:44:08 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.130 2021/11/05 19:33:28 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -294,7 +294,7 @@ debug_lexi(lexer_symbol lsym)
 
 debug_println("ps.prev_token = %s", lsym_name(ps.prev_token));
 debug_ps_bool(prev_is_type);
-debug_ps_bool(curr_newline);
+debug_ps_bool(next_col_1);
 debug_ps_bool(curr_col_1);
 debug_ps_bool(next_unary);
 // procname
@@ -546,8 +546,8 @@ lexer_symbol
 lexi(void)
 {
 token.e = token.s;
-ps.curr_col_1 = ps.curr_newline;
-ps.curr_newline = false;
+ps.curr_col_1 = ps.next_col_1;
+ps.next_col_1 = false;
 ps.prev_is_type = ps.curr_is_type;
 ps.curr_is_type = false;
 
@@ -573,7 +573,7 @@ lexi(void)
 switch (*token.s) {
 case '\n':
 	unary_delim = ps.next_unary;
-	ps.curr_newline = true;
+	ps.next_col_1 = true;
 	

CVS commit: src

2021-11-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Nov  5 19:33:29 UTC 2021

Modified Files:
src/tests/usr.bin/indent: token_comment.c
src/usr.bin/indent: indent.c indent.h lexi.c pr_comment.c

Log Message:
indent: rename ps.curr_newline to next_col_1

For symmetry with ps.curr_col_1.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/indent/token_comment.c
cvs rdiff -u -r1.207 -r1.208 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.129 -r1.130 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.96 -r1.97 src/usr.bin/indent/pr_comment.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/aarch64/include

2021-11-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Nov  5 15:18:18 UTC 2021

Modified Files:
src/sys/arch/aarch64/include: signal.h

Log Message:
Normally, to support COMPAT_NETBSD32 we need to define
__HAVE_STRUCT_SIGCONTEXT in order to support the old
"sigcontext" style of handlers for 32-bit binaries.
However, we only support 32-bit EABI binaries on AArch64,
and by happy accident (due to a libc bug introduced in
2006), 32-bit NetBSD EABI binaries never used "sigcontext"
style handlers.  So, we don't need to carry any of this
baggage forward.

This addresses the AArch64 case of PR kern/56487.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/signal.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/aarch64/include/signal.h
diff -u src/sys/arch/aarch64/include/signal.h:1.3 src/sys/arch/aarch64/include/signal.h:1.4
--- src/sys/arch/aarch64/include/signal.h:1.3	Wed Oct 27 04:45:42 2021
+++ src/sys/arch/aarch64/include/signal.h	Fri Nov  5 15:18:18 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: signal.h,v 1.3 2021/10/27 04:45:42 thorpej Exp $ */
+/* $NetBSD: signal.h,v 1.4 2021/11/05 15:18:18 thorpej Exp $ */
 
 #ifndef _AARCH64_SIGNAL_H_
 #define	_AARCH64_SIGNAL_H_
@@ -6,8 +6,16 @@
 #include 
 
 #ifdef _KERNEL
-/* This is needed to support COMPAT_NETBSD32. */ 
-#define	__HAVE_STRUCT_SIGCONTEXT
+/*
+ * Normally, to support COMPAT_NETBSD32 we need to define
+ * __HAVE_STRUCT_SIGCONTEXT in order to support the old
+ * "sigcontext" style of handlers for 32-bit binaries.
+ * However, we only support 32-bit EABI binaries on AArch64,
+ * and by happy accident (due to a libc bug introduced in
+ * 2006), 32-bit NetBSD EABI binaries never used "sigcontext"
+ * style handlers.  So, we don't need to carry any of this
+ * baggage forward.
+ */
 #endif /* _KERNEL */
 
 #endif /* ! _AARCH64_SIGNAL_H_ */



CVS commit: src/sys/arch/aarch64/include

2021-11-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Nov  5 15:18:18 UTC 2021

Modified Files:
src/sys/arch/aarch64/include: signal.h

Log Message:
Normally, to support COMPAT_NETBSD32 we need to define
__HAVE_STRUCT_SIGCONTEXT in order to support the old
"sigcontext" style of handlers for 32-bit binaries.
However, we only support 32-bit EABI binaries on AArch64,
and by happy accident (due to a libc bug introduced in
2006), 32-bit NetBSD EABI binaries never used "sigcontext"
style handlers.  So, we don't need to carry any of this
baggage forward.

This addresses the AArch64 case of PR kern/56487.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/signal.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src

2021-11-05 Thread Alistair Crooks
I think you're misreading the diff - it will only wrap if the minimum size
is 0x, which is...ummm...highly unlikely (it's defined to be 0
right now, the type is unsigned)

On Thu, 4 Nov 2021 at 15:56, Joerg Sonnenberger  wrote:

> On Mon, Nov 01, 2021 at 03:09:59AM +, Alistair G. Crooks wrote:
> > Module Name:  src
> > Committed By: agc
> > Date: Mon Nov  1 03:09:59 UTC 2021
> >
> > Modified Files:
> >   src/external/apache2/argon2/dist/phc-winner-argon2/src: argon2.c
> core.c
> >   src/lib/libcrypt: Makefile
> >
> > Log Message:
> > Remove the
> >
> >   COPTS.*+=   -Wno-error=.*
> >
> > lines for building argon2 sources, by fixing the problems at source.
> >
> > Addresses Rin Okuyama's concerns on tech-userlevel/tech-crypto in
> >
> >   Message-ID: 
>
> The +1 part seems questionable to me as it can actually introduce a wrap
> around, can't it?
>
> Joerg
>
>


CVS commit: src/sys/arch/evbarm/gumstix

2021-11-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Nov  5 07:39:23 UTC 2021

Modified Files:
src/sys/arch/evbarm/gumstix: gxpcic.c

Log Message:
Apply patch from PR port-evbarm/52209

Gumstix: KDASSERT in pxa2x0_gpio if no PCMCIA  bushead given but present


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/gumstix/gxpcic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/gumstix/gxpcic.c
diff -u src/sys/arch/evbarm/gumstix/gxpcic.c:1.13 src/sys/arch/evbarm/gumstix/gxpcic.c:1.14
--- src/sys/arch/evbarm/gumstix/gxpcic.c:1.13	Sat Feb  2 20:06:48 2013
+++ src/sys/arch/evbarm/gumstix/gxpcic.c	Fri Nov  5 07:39:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gxpcic.c,v 1.13 2013/02/02 20:06:48 christos Exp $ */
+/*	$NetBSD: gxpcic.c,v 1.14 2021/11/05 07:39:22 skrll Exp $ */
 /*
  * Copyright (C) 2005, 2006 WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -158,20 +158,22 @@ gxpcic_attach(device_t parent, device_t 
 {
 	struct pxapcic_softc *sc = device_private(self);
 	struct pxaip_attach_args *pxa = aux;
-	int nslot, i;
+	int nslot, i, j;
 
 	sc->sc_dev = self;
 	sc->sc_iot = pxa->pxa_iot;
 
 	nslot = gxpcic_count_slot(sc);
 
-	for (i = 0; i < nslot; i++) {
-		if (!gxpcic_slot_irqs[i].valid) 
+	for (i = 0, j = 0; i < nslot; i++) {
+		if (!gxpcic_slot_irqs[i].valid) {
+			j++;
 			continue;
-		sc->sc_irqpin[i] = gxpcic_slot_irqs[i].prdy;
-		sc->sc_irqcfpin[i] = gxpcic_slot_irqs[i].cd;
+		}
+		sc->sc_irqpin[i - j] = gxpcic_slot_irqs[i].prdy;
+		sc->sc_irqcfpin[i - j] = gxpcic_slot_irqs[i].cd;
 	}
-	sc->sc_nslots = nslot;
+	sc->sc_nslots = i - j;
 
 	pxapcic_attach_common(sc, _socket_setup);
 }
@@ -205,13 +207,12 @@ gxpcic_read(struct pxapcic_socket *so, i
 
 	switch (which) {
 	case PXAPCIC_CARD_STATUS:
-		reg = pxa2x0_gpio_get_function(gxpcic_slot_irqs[so->socket].cd);
+		reg = pxa2x0_gpio_get_function(so->sc->sc_irqcfpin[so->socket]);
 		return (HAVE_CARD(reg) ?
 		PXAPCIC_CARD_VALID : PXAPCIC_CARD_INVALID);
 
 	case PXAPCIC_CARD_READY:
-		reg = pxa2x0_gpio_get_function(
-		gxpcic_slot_irqs[so->socket].prdy);
+		reg = pxa2x0_gpio_get_function(so->sc->sc_irqpin[so->socket]);
 		return (reg & GPIO_SET ? 1 : 0);
 
 	default:



CVS commit: src/sys/arch/evbarm/gumstix

2021-11-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Nov  5 07:39:23 UTC 2021

Modified Files:
src/sys/arch/evbarm/gumstix: gxpcic.c

Log Message:
Apply patch from PR port-evbarm/52209

Gumstix: KDASSERT in pxa2x0_gpio if no PCMCIA  bushead given but present


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/gumstix/gxpcic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2021-11-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Nov  5 06:15:42 UTC 2021

Modified Files:
src/sys/dev/pci: if_wmreg.h

Log Message:
 Fix comment. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/dev/pci/if_wmreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.120 src/sys/dev/pci/if_wmreg.h:1.121
--- src/sys/dev/pci/if_wmreg.h:1.120	Wed Sep 16 15:04:02 2020
+++ src/sys/dev/pci/if_wmreg.h	Fri Nov  5 06:15:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.120 2020/09/16 15:04:02 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.121 2021/11/05 06:15:42 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -974,8 +974,8 @@ struct livengood_tcpip_ctxdesc {
 #define	WMREG_PHPM	0x0e14	/* PHY Power Management */
 #define	PHPM_SPD_EN		__BIT(0)	/* Smart Power Down */
 #define	PHPM_D0A_LPLU		__BIT(1)	/* D0 Low Power Link Up */
-#define	PHPM_NOND0A_LPLU	__BIT(2)	/* D0 Low Power Link Up */
-#define	PHPM_NOND0A_GBE_DIS	__BIT(3)	/* D0 Low Power Link Up */
+#define	PHPM_NOND0A_LPLU	__BIT(2)	/* Non-D0a LPLU */
+#define	PHPM_NOND0A_GBE_DIS	__BIT(3)	/* Disable 1G in non-D0a */
 #define	PHPM_GO_LINK_D		__BIT(5)	/* Go Link Disconnect */
 
 #define WMREG_EEER	0x0e30	/* Energy Efficiency Ethernet "EEE" */



CVS commit: src/sys/dev/pci

2021-11-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Nov  5 06:15:42 UTC 2021

Modified Files:
src/sys/dev/pci: if_wmreg.h

Log Message:
 Fix comment. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/dev/pci/if_wmreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.