CVS commit: src/tests/lib/libcurses

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 09:42:36 UTC 2023

Modified Files:
src/tests/lib/libcurses: testframe.txt

Log Message:
tests/libcurses: sync documentation with reality

Unknown escape sequences in string literals trigger an error, since
testlang_conf.l 1.22 from 2021-02-25.

The '\b' is recognized since testlang_conf.l 1.26 from 2021-11-15.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libcurses/testframe.txt

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



CVS commit: src/tests/lib/libcurses

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 09:42:36 UTC 2023

Modified Files:
src/tests/lib/libcurses: testframe.txt

Log Message:
tests/libcurses: sync documentation with reality

Unknown escape sequences in string literals trigger an error, since
testlang_conf.l 1.22 from 2021-02-25.

The '\b' is recognized since testlang_conf.l 1.26 from 2021-11-15.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libcurses/testframe.txt

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

Modified files:

Index: src/tests/lib/libcurses/testframe.txt
diff -u src/tests/lib/libcurses/testframe.txt:1.8 src/tests/lib/libcurses/testframe.txt:1.9
--- src/tests/lib/libcurses/testframe.txt:1.8	Tue Feb  9 20:31:02 2021
+++ src/tests/lib/libcurses/testframe.txt	Sun Dec  3 09:42:36 2023
@@ -1,4 +1,4 @@
-$NetBSD: testframe.txt,v 1.8 2021/02/09 20:31:02 rillig Exp $
+$NetBSD: testframe.txt,v 1.9 2023/12/03 09:42:36 rillig Exp $
 
 CURSES TESTFRAME
 
@@ -231,6 +231,7 @@ performed on them when they are parsed. 
 embed some control characters into the string.  Valid substitutions
 are:
 
+	\b	backspace
 	\e	escape
 	\n	new line
 	\r	carriage return
@@ -240,9 +241,6 @@ are:
 		represented by the octal number will be inserted into
 		the string.
 
-Any other invalid conversions will have the \ stripped and the
-subsequent characters inserted into the string.
-
 Integers may be specified by either a plain numeric (e.g. 12345) or by
 hexadecimal notation by prefixing the number with 0x (e.g. 0x3039).
 Internally, no distinction is made between the two formats and they



CVS commit: src/usr.bin/xlint

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 12:03:38 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: ckbool.c ckctype.c debug.c decl.c emit1.c
func.c lex.c mem1.c tree.c
src/usr.bin/xlint/lint2: chk.c read.c
src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: indent statement continuations consistently

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/xlint/lint1/ckbool.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/lint1/ckctype.c
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.380 -r1.381 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.78 -r1.79 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.175 -r1.176 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.193 -r1.194 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.583 -r1.584 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/xlint/lint2/chk.c
cvs rdiff -u -r1.87 -r1.88 src/usr.bin/xlint/lint2/read.c
cvs rdiff -u -r1.117 -r1.118 src/usr.bin/xlint/xlint/xlint.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/xlint/lint1/ckbool.c
diff -u src/usr.bin/xlint/lint1/ckbool.c:1.26 src/usr.bin/xlint/lint1/ckbool.c:1.27
--- src/usr.bin/xlint/lint1/ckbool.c:1.26	Wed Aug  2 18:51:25 2023
+++ src/usr.bin/xlint/lint1/ckbool.c	Sun Dec  3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ckbool.c,v 1.26 2023/08/02 18:51:25 rillig Exp $ */
+/* $NetBSD: ckbool.c,v 1.27 2023/12/03 12:03:38 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include 
 
 #if defined(__RCSID)
-__RCSID("$NetBSD: ckbool.c,v 1.26 2023/08/02 18:51:25 rillig Exp $");
+__RCSID("$NetBSD: ckbool.c,v 1.27 2023/12/03 12:03:38 rillig Exp $");
 #endif
 
 #include 
@@ -58,16 +58,16 @@ static bool
 is_assignment_bool_or_other(op_t op)
 {
 	return op == ASSIGN ||
-	   op == ANDASS || op == XORASS || op == ORASS ||
-	   op == RETURN || op == INIT || op == FARG;
+	op == ANDASS || op == XORASS || op == ORASS ||
+	op == RETURN || op == INIT || op == FARG;
 }
 
 static bool
 is_symmetric_bool_or_other(op_t op)
 {
 	return op == EQ || op == NE ||
-	   op == BITAND || op == BITXOR || op == BITOR ||
-	   op == COLON;
+	op == BITAND || op == BITXOR || op == BITOR ||
+	op == COLON;
 }
 
 static bool

Index: src/usr.bin/xlint/lint1/ckctype.c
diff -u src/usr.bin/xlint/lint1/ckctype.c:1.7 src/usr.bin/xlint/lint1/ckctype.c:1.8
--- src/usr.bin/xlint/lint1/ckctype.c:1.7	Wed Sep 13 20:31:58 2023
+++ src/usr.bin/xlint/lint1/ckctype.c	Sun Dec  3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ckctype.c,v 1.7 2023/09/13 20:31:58 rillig Exp $ */
+/* $NetBSD: ckctype.c,v 1.8 2023/12/03 12:03:38 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include 
 
 #if defined(__RCSID)
-__RCSID("$NetBSD: ckctype.c,v 1.7 2023/09/13 20:31:58 rillig Exp $");
+__RCSID("$NetBSD: ckctype.c,v 1.8 2023/12/03 12:03:38 rillig Exp $");
 #endif
 
 #include 
@@ -61,21 +61,21 @@ is_ctype_function(const char *name)
 
 	if (name[0] == 'i' && name[1] == 's')
 		return strcmp(name, "isalnum") == 0 ||
-		   strcmp(name, "isalpha") == 0 ||
-		   strcmp(name, "isblank") == 0 ||
-		   strcmp(name, "iscntrl") == 0 ||
-		   strcmp(name, "isdigit") == 0 ||
-		   strcmp(name, "isgraph") == 0 ||
-		   strcmp(name, "islower") == 0 ||
-		   strcmp(name, "isprint") == 0 ||
-		   strcmp(name, "ispunct") == 0 ||
-		   strcmp(name, "isspace") == 0 ||
-		   strcmp(name, "isupper") == 0 ||
-		   strcmp(name, "isxdigit") == 0;
+		strcmp(name, "isalpha") == 0 ||
+		strcmp(name, "isblank") == 0 ||
+		strcmp(name, "iscntrl") == 0 ||
+		strcmp(name, "isdigit") == 0 ||
+		strcmp(name, "isgraph") == 0 ||
+		strcmp(name, "islower") == 0 ||
+		strcmp(name, "isprint") == 0 ||
+		strcmp(name, "ispunct") == 0 ||
+		strcmp(name, "isspace") == 0 ||
+		strcmp(name, "isupper") == 0 ||
+		strcmp(name, "isxdigit") == 0;
 
 	if (name[0] == 't' && name[1] == 'o')
 		return strcmp(name, "tolower") == 0 ||
-		   strcmp(name, "toupper") == 0;
+		strcmp(name, "toupper") == 0;
 
 	return false;
 }

Index: src/usr.bin/xlint/lint1/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.64 src/usr.bin/xlint/lint1/debug.c:1.65
--- src/usr.bin/xlint/lint1/debug.c:1.64	Sat Dec  2 21:47:05 2023
+++ src/usr.bin/xlint/lint1/debug.c	Sun Dec  3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.64 2023/12/02 21:47:05 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.65 2023/12/03 12:03:38 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.64 2023/12/02 21:47:05 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.65 

CVS commit: src/usr.bin/xlint

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 12:03:38 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: ckbool.c ckctype.c debug.c decl.c emit1.c
func.c lex.c mem1.c tree.c
src/usr.bin/xlint/lint2: chk.c read.c
src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: indent statement continuations consistently

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/xlint/lint1/ckbool.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/lint1/ckctype.c
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.380 -r1.381 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.78 -r1.79 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.175 -r1.176 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.193 -r1.194 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.583 -r1.584 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/xlint/lint2/chk.c
cvs rdiff -u -r1.87 -r1.88 src/usr.bin/xlint/lint2/read.c
cvs rdiff -u -r1.117 -r1.118 src/usr.bin/xlint/xlint/xlint.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/xlint

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 12:24:49 UTC 2023

Modified Files:
src/usr.bin/xlint/common: lint.h
src/usr.bin/xlint/lint1: tree.c
src/usr.bin/xlint/lint2: lint2.h

Log Message:
lint: move function body brace to the left

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.584 -r1.585 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/xlint/lint2/lint2.h

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



CVS commit: src/usr.bin/xlint

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 12:24:49 UTC 2023

Modified Files:
src/usr.bin/xlint/common: lint.h
src/usr.bin/xlint/lint1: tree.c
src/usr.bin/xlint/lint2: lint2.h

Log Message:
lint: move function body brace to the left

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.584 -r1.585 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/xlint/lint2/lint2.h

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/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.44 src/usr.bin/xlint/common/lint.h:1.45
--- src/usr.bin/xlint/common/lint.h:1.44	Wed Sep 13 20:31:58 2023
+++ src/usr.bin/xlint/common/lint.h	Sun Dec  3 12:24:48 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.44 2023/09/13 20:31:58 rillig Exp $	*/
+/*	$NetBSD: lint.h,v 1.45 2023/12/03 12:24:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -120,7 +120,8 @@ typedef	struct {
 extern	ttab_t	ttab[];
 
 static inline const ttab_t *
-type_properties(tspec_t t) {
+type_properties(tspec_t t)
+{
 	return ttab + t;
 }
 
@@ -154,12 +155,31 @@ typedef struct lint2_type type_t;
 #include "externs.h"
 
 static inline bool
-ch_isalnum(char ch) { return isalnum((unsigned char)ch) != 0; }
+ch_isalnum(char ch)
+{
+	return isalnum((unsigned char)ch) != 0;
+}
+
 static inline bool
-ch_isdigit(char ch) { return isdigit((unsigned char)ch) != 0; }
+ch_isdigit(char ch)
+{
+	return isdigit((unsigned char)ch) != 0;
+}
+
 static inline bool
-ch_isprint(char ch) { return isprint((unsigned char)ch) != 0; }
+ch_isprint(char ch)
+{
+	return isprint((unsigned char)ch) != 0;
+}
+
 static inline bool
-ch_isspace(char ch) { return isspace((unsigned char)ch) != 0; }
+ch_isspace(char ch)
+{
+	return isspace((unsigned char)ch) != 0;
+}
+
 static inline bool
-ch_isupper(char ch) { return isupper((unsigned char)ch) != 0; }
+ch_isupper(char ch)
+{
+	return isupper((unsigned char)ch) != 0;
+}

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.584 src/usr.bin/xlint/lint1/tree.c:1.585
--- src/usr.bin/xlint/lint1/tree.c:1.584	Sun Dec  3 12:03:38 2023
+++ src/usr.bin/xlint/lint1/tree.c	Sun Dec  3 12:24:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.584 2023/12/03 12:03:38 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.585 2023/12/03 12:24:49 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.584 2023/12/03 12:03:38 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.585 2023/12/03 12:24:49 rillig Exp $");
 #endif
 
 #include 
@@ -93,7 +93,8 @@ width_in_bits(const type_t *tp)
 }
 
 static int
-portable_rank_cmp(tspec_t t1, tspec_t t2) {
+portable_rank_cmp(tspec_t t1, tspec_t t2)
+{
 	const ttab_t *p1 = type_properties(t1), *p2 = type_properties(t2);
 	lint_assert(p1->tt_rank_kind == p2->tt_rank_kind);
 	lint_assert(p1->tt_rank_value > 0);

Index: src/usr.bin/xlint/lint2/lint2.h
diff -u src/usr.bin/xlint/lint2/lint2.h:1.24 src/usr.bin/xlint/lint2/lint2.h:1.25
--- src/usr.bin/xlint/lint2/lint2.h:1.24	Thu Jul 13 08:40:38 2023
+++ src/usr.bin/xlint/lint2/lint2.h	Sun Dec  3 12:24:49 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lint2.h,v 1.24 2023/07/13 08:40:38 rillig Exp $ */
+/* $NetBSD: lint2.h,v 1.25 2023/12/03 12:24:49 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -186,7 +186,8 @@ typedef	struct hte {
 
 /* maps type indices into pointers to type structs */
 static inline type_t *
-TP(unsigned short type_id) {
+TP(unsigned short type_id)
+{
 	/* force sequence point for newly parsed type_id */
 	return tlst[type_id];
 }



CVS commit: src/usr.bin/xlint

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 13:12:40 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: ckctype.c ckgetopt.c decl.c emit1.c err.c
func.c init.c lex.c lint1.h mem1.c tree.c
src/usr.bin/xlint/lint2: chk.c lint2.h read.c
src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: re-wrap comments

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/lint1/ckctype.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/xlint/lint1/ckgetopt.c
cvs rdiff -u -r1.381 -r1.382 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.79 -r1.80 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.218 -r1.219 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.176 -r1.177 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.251 -r1.252 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.194 -r1.195 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.203 -r1.204 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.585 -r1.586 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.63 -r1.64 src/usr.bin/xlint/lint2/chk.c
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint2/lint2.h
cvs rdiff -u -r1.88 -r1.89 src/usr.bin/xlint/lint2/read.c
cvs rdiff -u -r1.118 -r1.119 src/usr.bin/xlint/xlint/xlint.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/xlint

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 13:12:40 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: ckctype.c ckgetopt.c decl.c emit1.c err.c
func.c init.c lex.c lint1.h mem1.c tree.c
src/usr.bin/xlint/lint2: chk.c lint2.h read.c
src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: re-wrap comments

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/lint1/ckctype.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/xlint/lint1/ckgetopt.c
cvs rdiff -u -r1.381 -r1.382 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.79 -r1.80 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.218 -r1.219 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.176 -r1.177 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.251 -r1.252 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.194 -r1.195 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.203 -r1.204 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.585 -r1.586 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.63 -r1.64 src/usr.bin/xlint/lint2/chk.c
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint2/lint2.h
cvs rdiff -u -r1.88 -r1.89 src/usr.bin/xlint/lint2/read.c
cvs rdiff -u -r1.118 -r1.119 src/usr.bin/xlint/xlint/xlint.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/xlint/lint1/ckctype.c
diff -u src/usr.bin/xlint/lint1/ckctype.c:1.8 src/usr.bin/xlint/lint1/ckctype.c:1.9
--- src/usr.bin/xlint/lint1/ckctype.c:1.8	Sun Dec  3 12:03:38 2023
+++ src/usr.bin/xlint/lint1/ckctype.c	Sun Dec  3 13:12:40 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ckctype.c,v 1.8 2023/12/03 12:03:38 rillig Exp $ */
+/* $NetBSD: ckctype.c,v 1.9 2023/12/03 13:12:40 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include 
 
 #if defined(__RCSID)
-__RCSID("$NetBSD: ckctype.c,v 1.8 2023/12/03 12:03:38 rillig Exp $");
+__RCSID("$NetBSD: ckctype.c,v 1.9 2023/12/03 13:12:40 rillig Exp $");
 #endif
 
 #include 
@@ -106,7 +106,7 @@ check_ctype_arg(const char *func, const 
 		return;
 
 	if (arg->tn_op == CVT && arg->tn_cast) {
-		/* argument to '%s' must be cast to 'unsigned char', not to '%s' */
+		/* argument to '%s' must be cast to 'unsigned char', not ... */
 		warning(342, func, type_name(arg->tn_type));
 		return;
 	}

Index: src/usr.bin/xlint/lint1/ckgetopt.c
diff -u src/usr.bin/xlint/lint1/ckgetopt.c:1.16 src/usr.bin/xlint/lint1/ckgetopt.c:1.17
--- src/usr.bin/xlint/lint1/ckgetopt.c:1.16	Fri May 20 21:18:55 2022
+++ src/usr.bin/xlint/lint1/ckgetopt.c	Sun Dec  3 13:12:40 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ckgetopt.c,v 1.16 2022/05/20 21:18:55 rillig Exp $ */
+/* $NetBSD: ckgetopt.c,v 1.17 2023/12/03 13:12:40 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: ckgetopt.c,v 1.16 2022/05/20 21:18:55 rillig Exp $");
+__RCSID("$NetBSD: ckgetopt.c,v 1.17 2023/12/03 13:12:40 rillig Exp $");
 #endif
 
 #include 
@@ -51,7 +51,7 @@ __RCSID("$NetBSD: ckgetopt.c,v 1.16 2022
  */
 
 static struct {
-	/*
+	/*-
 	 * 0	means outside a while loop with a getopt call.
 	 * 1	means directly inside a while loop with a getopt call.
 	 * > 1	means in a nested while loop; this is used for finishing the
@@ -61,8 +61,8 @@ static struct {
 
 	/*
 	 * The options string from the getopt call.  Whenever an option is
-	 * handled by a case label, it is set to ' '.  In the end, only ' '
-	 * and ':' should remain.
+	 * handled by a case label, it is set to ' '.  In the end, only ' ' and
+	 * ':' should remain.
 	 */
 	pos_t options_pos;
 	char *options;

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.381 src/usr.bin/xlint/lint1/decl.c:1.382
--- src/usr.bin/xlint/lint1/decl.c:1.381	Sun Dec  3 12:03:38 2023
+++ src/usr.bin/xlint/lint1/decl.c	Sun Dec  3 13:12:40 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.381 2023/12/03 12:03:38 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.382 2023/12/03 13:12:40 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.381 2023/12/03 12:03:38 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.382 2023/12/03 13:12:40 rillig Exp $");
 #endif
 
 #include 
@@ -150,10 +150,10 @@ expr_unqualified_type(const type_t *tp)
 
 	/*
 	 * In case of a struct or union type, the members should lose their
-	 * qualifiers as well, but that would require a deep copy of the
-	 * struct or union type.  This in turn would defeat the type
-	 * comparison in types_compatible, which simply tests whether
-	 * tp1->t_sou == tp2->t_sou.
+	 * qualifiers as well, but that would require a deep copy of the struct
+	 * or union type.  This in turn would defeat the type comparison in
+	 * types_compatible, which simply tests whet

CVS commit: src/tests/usr.bin/indent

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 14:26:10 UTC 2023

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

Log Message:
tests/indent: test compound expressions


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/fmt_expr.c

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



CVS commit: src/tests/usr.bin/indent

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 14:26:10 UTC 2023

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

Log Message:
tests/indent: test compound expressions


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/fmt_expr.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/fmt_expr.c
diff -u src/tests/usr.bin/indent/fmt_expr.c:1.10 src/tests/usr.bin/indent/fmt_expr.c:1.11
--- src/tests/usr.bin/indent/fmt_expr.c:1.10	Fri Jun 16 23:19:01 2023
+++ src/tests/usr.bin/indent/fmt_expr.c	Sun Dec  3 14:26:10 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: fmt_expr.c,v 1.10 2023/06/16 23:19:01 rillig Exp $ */
+/* $NetBSD: fmt_expr.c,v 1.11 2023/12/03 14:26:10 rillig Exp $ */
 
 /*
  * Tests for all kinds of expressions that are not directly related to unary
@@ -57,3 +57,28 @@
 // error: Standard Input:7: Unbalanced parentheses
 // warning: Standard Input:9: Extra ')'
 //indent end
+
+
+// A compound expression with an unknown type is indented other than one with
+// a known type.  Ideally, both cases should be treated the same.
+//indent input
+{
+	var = (type) { .member = value };
+	var = (type) { value, value, value };
+	var = (struct s) { .member = value };
+	var = (struct s) { value, value, value };
+}
+//indent end
+
+//indent run
+{
+	var = (type) {
+		.member = value
+	};
+	var = (type) {
+		value, value, value
+	};
+	var = (struct s){.member = value};
+	var = (struct s){value, value, value};
+}
+//indent end



CVS commit: src/sys/kern

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec  3 14:35:54 UTC 2023

Modified Files:
src/sys/kern: subr_vmem.c

Log Message:
bt_freetrim(): Restructure the loop as a LIST_FOREACH_SAFE() rather
than a while().  No real change in behavior now, but makes upcoming
enhancements easier.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/kern/subr_vmem.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/kern/subr_vmem.c
diff -u src/sys/kern/subr_vmem.c:1.112 src/sys/kern/subr_vmem.c:1.113
--- src/sys/kern/subr_vmem.c:1.112	Sun Dec  3 02:50:09 2023
+++ src/sys/kern/subr_vmem.c	Sun Dec  3 14:35:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_vmem.c,v 1.112 2023/12/03 02:50:09 thorpej Exp $	*/
+/*	$NetBSD: subr_vmem.c,v 1.113 2023/12/03 14:35:54 thorpej Exp $	*/
 
 /*-
  * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi,
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.112 2023/12/03 02:50:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.113 2023/12/03 14:35:54 thorpej Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -347,15 +347,17 @@ bt_free(vmem_t *vm, bt_t *bt)
 static void
 bt_freetrim(vmem_t *vm, int freelimit)
 {
-	bt_t *t;
+	bt_t *bt, *next_bt;
 	LIST_HEAD(, vmem_btag) tofree;
 
 	VMEM_ASSERT_LOCKED(vm);
 
 	LIST_INIT(&tofree);
 
-	while (vm->vm_nfreetags > freelimit) {
-		bt_t *bt = LIST_FIRST(&vm->vm_freetags);
+	LIST_FOREACH_SAFE(bt, &vm->vm_freetags, bt_freelist, next_bt) {
+		if (vm->vm_nfreetags <= freelimit) {
+			break;
+		}
 		LIST_REMOVE(bt, bt_freelist);
 		vm->vm_nfreetags--;
 		if (bt >= static_bts
@@ -372,9 +374,9 @@ bt_freetrim(vmem_t *vm, int freelimit)
 
 	VMEM_UNLOCK(vm);
 	while (!LIST_EMPTY(&tofree)) {
-		t = LIST_FIRST(&tofree);
-		LIST_REMOVE(t, bt_freelist);
-		pool_put(&vmem_btag_pool, t);
+		bt = LIST_FIRST(&tofree);
+		LIST_REMOVE(bt, bt_freelist);
+		pool_put(&vmem_btag_pool, bt);
 	}
 }
 #endif	/* defined(_KERNEL) */



CVS commit: src/sys/kern

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec  3 14:35:54 UTC 2023

Modified Files:
src/sys/kern: subr_vmem.c

Log Message:
bt_freetrim(): Restructure the loop as a LIST_FOREACH_SAFE() rather
than a while().  No real change in behavior now, but makes upcoming
enhancements easier.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/kern/subr_vmem.c

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



CVS commit: src/sys

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec  3 15:06:45 UTC 2023

Modified Files:
src/sys/kern: subr_vmem.c
src/sys/sys: vmem_impl.h

Log Message:
Split the boundary tag "type" field into "type" and "flags" fields.
Initialize the flags field to 0 before inserting into an arena's free
tag list.

NFC, but makes diff for a future enhancement smaller.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/kern/subr_vmem.c
cvs rdiff -u -r1.6 -r1.7 src/sys/sys/vmem_impl.h

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



CVS commit: src/sys

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec  3 15:06:45 UTC 2023

Modified Files:
src/sys/kern: subr_vmem.c
src/sys/sys: vmem_impl.h

Log Message:
Split the boundary tag "type" field into "type" and "flags" fields.
Initialize the flags field to 0 before inserting into an arena's free
tag list.

NFC, but makes diff for a future enhancement smaller.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/kern/subr_vmem.c
cvs rdiff -u -r1.6 -r1.7 src/sys/sys/vmem_impl.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/kern/subr_vmem.c
diff -u src/sys/kern/subr_vmem.c:1.113 src/sys/kern/subr_vmem.c:1.114
--- src/sys/kern/subr_vmem.c:1.113	Sun Dec  3 14:35:54 2023
+++ src/sys/kern/subr_vmem.c	Sun Dec  3 15:06:45 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_vmem.c,v 1.113 2023/12/03 14:35:54 thorpej Exp $	*/
+/*	$NetBSD: subr_vmem.c,v 1.114 2023/12/03 15:06:45 thorpej Exp $	*/
 
 /*-
  * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi,
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.113 2023/12/03 14:35:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.114 2023/12/03 15:06:45 thorpej Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -255,6 +255,7 @@ bt_refill_locked(vmem_t *vm)
 	vm->vm_nfreetags <= BT_MINRESERVE) {
 		bt = LIST_FIRST(&vmem_btag_freelist);
 		LIST_REMOVE(bt, bt_freelist);
+		bt->bt_flags = 0;
 		LIST_INSERT_HEAD(&vm->vm_freetags, bt, bt_freelist);
 		vm->vm_nfreetags++;
 		vmem_btag_freelist_count--;
@@ -271,6 +272,7 @@ bt_refill_locked(vmem_t *vm)
 		VMEM_LOCK(vm);
 		if (bt == NULL)
 			break;
+		bt->bt_flags = 0;
 		LIST_INSERT_HEAD(&vm->vm_freetags, bt, bt_freelist);
 		vm->vm_nfreetags++;
 	}

Index: src/sys/sys/vmem_impl.h
diff -u src/sys/sys/vmem_impl.h:1.6 src/sys/sys/vmem_impl.h:1.7
--- src/sys/sys/vmem_impl.h:1.6	Sat Dec  2 19:11:52 2023
+++ src/sys/sys/vmem_impl.h	Sun Dec  3 15:06:45 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmem_impl.h,v 1.6 2023/12/02 19:11:52 thorpej Exp $	*/
+/*	$NetBSD: vmem_impl.h,v 1.7 2023/12/03 15:06:45 thorpej Exp $	*/
 
 /*-
  * Copyright (c)2006 YAMAMOTO Takashi,
@@ -128,7 +128,8 @@ struct vmem_btag {
 #define	bt_freelist	bt_u.u_freelist
 	vmem_addr_t bt_start;
 	vmem_size_t bt_size;
-	int bt_type;
+	short bt_type;
+	short bt_flags;
 };
 
 #define	BT_TYPE_SPAN		1



CVS commit: src/usr.bin/xlint

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 18:17:41 UTC 2023

Modified Files:
src/usr.bin/xlint/common: externs.h inittyp.c lint.h
src/usr.bin/xlint/lint1: cgram.y decl.c emit1.c err.c externs1.h func.c
lex.c lint1.h main1.c mem1.c op.h tree.c
src/usr.bin/xlint/lint2: chk.c emit2.c externs2.h hash.c lint2.h
main2.c msg.c read.c
src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: in declarations, replace tab with space

Previously, in some cases, the keywords 'const' or 'struct' were
followed by a tab, which doesn't make sense.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.476 -r1.477 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.382 -r1.383 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.80 -r1.81 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.219 -r1.220 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.207 -r1.208 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.177 -r1.178 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.195 -r1.196 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.204 -r1.205 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/xlint/lint1/main1.c
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint1/op.h
cvs rdiff -u -r1.586 -r1.587 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/xlint/lint2/chk.c
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/xlint/lint2/emit2.c
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint2/externs2.h
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/xlint/lint2/hash.c
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/xlint/lint2/lint2.h
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/xlint/lint2/main2.c
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/xlint/lint2/msg.c
cvs rdiff -u -r1.89 -r1.90 src/usr.bin/xlint/lint2/read.c
cvs rdiff -u -r1.119 -r1.120 src/usr.bin/xlint/xlint/xlint.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/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.30 src/usr.bin/xlint/common/externs.h:1.31
--- src/usr.bin/xlint/common/externs.h:1.30	Sat Aug 12 20:48:24 2023
+++ src/usr.bin/xlint/common/externs.h	Sun Dec  3 18:17:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.30 2023/08/12 20:48:24 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.31 2023/12/03 18:17:41 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -42,21 +42,21 @@ const char *tspec_name(tspec_t);
 /*
  * mem.c
  */
-void	*xmalloc(size_t);
-void	*xcalloc(size_t, size_t);
-void	*xrealloc(void *, size_t);
-char	*xstrdup(const char *);
-char	*xasprintf(const char *, ...) __printflike(1, 2);
+void *xmalloc(size_t);
+void *xcalloc(size_t, size_t);
+void *xrealloc(void *, size_t);
+char *xstrdup(const char *);
+char *xasprintf(const char *, ...) __printflike(1, 2);
 
 /*
  * emit.c
  */
 #if defined(IS_LINT1) || defined(IS_LINT2)
-void	outopen(const char *);
-void	outclose(void);
-void	outchar(char);
-void	outstrg(const char *);
-void	outint(int);
-void	outname(const char *);
-void	outsrc(const char *);
+void outopen(const char *);
+void outclose(void);
+void outchar(char);
+void outstrg(const char *);
+void outint(int);
+void outname(const char *);
+void outsrc(const char *);
 #endif

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.40 src/usr.bin/xlint/common/inittyp.c:1.41
--- src/usr.bin/xlint/common/inittyp.c:1.40	Thu Jul 13 08:40:38 2023
+++ src/usr.bin/xlint/common/inittyp.c	Sun Dec  3 18:17:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.40 2023/07/13 08:40:38 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.41 2023/12/03 18:17:41 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: inittyp.c,v 1.40 2023/07/13 08:40:38 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.41 2023/12/03 18:17:41 rillig Exp $");
 #endif
 
 #if defined(IS_LINT1)
@@ -78,7 +78,7 @@ __RCSID("$NetBSD: inittyp.c,v 1.40 2023/
 #endif
 
 /* various type information */
-ttab_t	ttab[NTSPEC] = {
+ttab_t ttab[NTSPEC] = {
 	typeinfo(NULL, NO_TSPEC, NO_TSPEC, 0, 0, ' '),
 	typeinfo("signed", SIGNED, UNSIGN, 0, 0, ' '),
 	typeinfo("unsigned", SIGNED, UNSIGN, 0, 0, ' '),

Index: src/usr.bin/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.45 src/usr.bin/xlint/common/lint.h:1.46
--- src/usr.bin/xlint/common/lint.h:1.45	Sun Dec  3 12:24:48 2023
+++ src/usr.bin/xlint/common/lint.h	Sun Dec  3 18:17:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.45 2023/12/03 12:24:48 rillig Exp $	*/
+/*	$NetBSD: lint.h,v 1.46 2023/12/03 18:17:41 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -92,7 +92,7 @@ typedef en

CVS commit: src/usr.bin/xlint

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 18:17:41 UTC 2023

Modified Files:
src/usr.bin/xlint/common: externs.h inittyp.c lint.h
src/usr.bin/xlint/lint1: cgram.y decl.c emit1.c err.c externs1.h func.c
lex.c lint1.h main1.c mem1.c op.h tree.c
src/usr.bin/xlint/lint2: chk.c emit2.c externs2.h hash.c lint2.h
main2.c msg.c read.c
src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: in declarations, replace tab with space

Previously, in some cases, the keywords 'const' or 'struct' were
followed by a tab, which doesn't make sense.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.476 -r1.477 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.382 -r1.383 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.80 -r1.81 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.219 -r1.220 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.207 -r1.208 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.177 -r1.178 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.195 -r1.196 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.204 -r1.205 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/xlint/lint1/main1.c
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint1/op.h
cvs rdiff -u -r1.586 -r1.587 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/xlint/lint2/chk.c
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/xlint/lint2/emit2.c
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint2/externs2.h
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/xlint/lint2/hash.c
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/xlint/lint2/lint2.h
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/xlint/lint2/main2.c
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/xlint/lint2/msg.c
cvs rdiff -u -r1.89 -r1.90 src/usr.bin/xlint/lint2/read.c
cvs rdiff -u -r1.119 -r1.120 src/usr.bin/xlint/xlint/xlint.c

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



CVS commit: src/sys

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec  3 19:34:08 UTC 2023

Modified Files:
src/sys/kern: subr_vmem.c
src/sys/sys: vmem.h vmem_impl.h

Log Message:
Add the notion of "private boundary tags" to vmem.  This allows vmem to
be used VERY early in boot; such consumers statically allocate the vmem
arena and boundary tags, and then explicitly add those static, private
boundary tags to the arena tag free list using the new function vmem_add_bts().

Vmem arenas that use private boundary tags will NOT consume the statically
allocated bootstrap tags used by the vmem system itself; the assumption is
that the consumer of such an arena knows what they're doing, and is responsible
for all necessary resource management.  A macro, VMEM_EST_BTCOUNT(), is
provided to help such consumers size the static boundary tag store based
on the expected number of spans and early allocations.  Once the private
tags are exhausted, the arena will dynamically allocate tags as usual.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/kern/subr_vmem.c
cvs rdiff -u -r1.24 -r1.25 src/sys/sys/vmem.h
cvs rdiff -u -r1.7 -r1.8 src/sys/sys/vmem_impl.h

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



CVS commit: src/sys

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec  3 19:34:08 UTC 2023

Modified Files:
src/sys/kern: subr_vmem.c
src/sys/sys: vmem.h vmem_impl.h

Log Message:
Add the notion of "private boundary tags" to vmem.  This allows vmem to
be used VERY early in boot; such consumers statically allocate the vmem
arena and boundary tags, and then explicitly add those static, private
boundary tags to the arena tag free list using the new function vmem_add_bts().

Vmem arenas that use private boundary tags will NOT consume the statically
allocated bootstrap tags used by the vmem system itself; the assumption is
that the consumer of such an arena knows what they're doing, and is responsible
for all necessary resource management.  A macro, VMEM_EST_BTCOUNT(), is
provided to help such consumers size the static boundary tag store based
on the expected number of spans and early allocations.  Once the private
tags are exhausted, the arena will dynamically allocate tags as usual.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/kern/subr_vmem.c
cvs rdiff -u -r1.24 -r1.25 src/sys/sys/vmem.h
cvs rdiff -u -r1.7 -r1.8 src/sys/sys/vmem_impl.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/kern/subr_vmem.c
diff -u src/sys/kern/subr_vmem.c:1.114 src/sys/kern/subr_vmem.c:1.115
--- src/sys/kern/subr_vmem.c:1.114	Sun Dec  3 15:06:45 2023
+++ src/sys/kern/subr_vmem.c	Sun Dec  3 19:34:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_vmem.c,v 1.114 2023/12/03 15:06:45 thorpej Exp $	*/
+/*	$NetBSD: subr_vmem.c,v 1.115 2023/12/03 19:34:08 thorpej Exp $	*/
 
 /*-
  * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi,
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.114 2023/12/03 15:06:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.115 2023/12/03 19:34:08 thorpej Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -252,7 +252,8 @@ bt_refill_locked(vmem_t *vm)
 
 	mutex_enter(&vmem_btag_lock);
 	while (!LIST_EMPTY(&vmem_btag_freelist) &&
-	vm->vm_nfreetags <= BT_MINRESERVE) {
+	vm->vm_nfreetags <= BT_MINRESERVE &&
+	(vm->vm_flags & VM_PRIVTAGS) == 0) {
 		bt = LIST_FIRST(&vmem_btag_freelist);
 		LIST_REMOVE(bt, bt_freelist);
 		bt->bt_flags = 0;
@@ -360,6 +361,9 @@ bt_freetrim(vmem_t *vm, int freelimit)
 		if (vm->vm_nfreetags <= freelimit) {
 			break;
 		}
+		if (bt->bt_flags & BT_F_PRIVATE) {
+			continue;
+		}
 		LIST_REMOVE(bt, bt_freelist);
 		vm->vm_nfreetags--;
 		if (bt >= static_bts
@@ -381,6 +385,24 @@ bt_freetrim(vmem_t *vm, int freelimit)
 		pool_put(&vmem_btag_pool, bt);
 	}
 }
+
+/*
+ * Add private boundary tags (statically-allocated by the caller)
+ * to a vmem arena's free tag list.
+ */
+void
+vmem_add_bts(vmem_t *vm, struct vmem_btag *bts, unsigned int nbts)
+{
+	VMEM_LOCK(vm);
+	while (nbts != 0) {
+		bts->bt_flags = BT_F_PRIVATE;
+		LIST_INSERT_HEAD(&vm->vm_freetags, bts, bt_freelist);
+		vm->vm_nfreetags++;
+		bts++;
+		nbts--;
+	}
+	VMEM_UNLOCK(vm);
+}
 #endif	/* defined(_KERNEL) */
 
 /*

Index: src/sys/sys/vmem.h
diff -u src/sys/sys/vmem.h:1.24 src/sys/sys/vmem.h:1.25
--- src/sys/sys/vmem.h:1.24	Sat Dec  2 21:02:12 2023
+++ src/sys/sys/vmem.h	Sun Dec  3 19:34:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmem.h,v 1.24 2023/12/02 21:02:12 thorpej Exp $	*/
+/*	$NetBSD: vmem.h,v 1.25 2023/12/03 19:34:08 thorpej Exp $	*/
 
 /*-
  * Copyright (c)2006 YAMAMOTO Takashi,
@@ -93,6 +93,7 @@ void		vmem_printall(const char *, void (
 #define	VM_POPULATING	0x0004
 #define	VM_LARGEIMPORT	0x0008
 #define	VM_XIMPORT	0x0010
+#define	VM_PRIVTAGS	0x0020
 
 /* vmem_size typemask */
 #define VMEM_ALLOC	0x01

Index: src/sys/sys/vmem_impl.h
diff -u src/sys/sys/vmem_impl.h:1.7 src/sys/sys/vmem_impl.h:1.8
--- src/sys/sys/vmem_impl.h:1.7	Sun Dec  3 15:06:45 2023
+++ src/sys/sys/vmem_impl.h	Sun Dec  3 19:34:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmem_impl.h,v 1.7 2023/12/03 15:06:45 thorpej Exp $	*/
+/*	$NetBSD: vmem_impl.h,v 1.8 2023/12/03 19:34:08 thorpej Exp $	*/
 
 /*-
  * Copyright (c)2006 YAMAMOTO Takashi,
@@ -138,10 +138,22 @@ struct vmem_btag {
 #define	BT_TYPE_BUSY		4
 #define	BT_ISSPAN_P(bt)	((bt)->bt_type <= BT_TYPE_SPAN_STATIC)
 
+#define	BT_F_PRIVATE		0x0001
+
 #define	BT_END(bt)	((bt)->bt_start + (bt)->bt_size - 1)
 
+/*
+ * Provide an estimated number of boundary tags needed for a given
+ * number of allocations from the vmem arena.  This estimate is
+ * based on 2 boundary tags per allocation (see vmem_xalloc()) and
+ * 2 boundary tags per added span (one to describe the span, one to
+ * describe the span's free space; see vmem_add1()).
+ */
+#define	VMEM_EST_BTCOUNT(ns, na)	(((ns) * 2) + ((na) * 2))
+
 vmem_t *	vmem_init(vmem_t *, const char *, vmem_addr_t, vmem_size_t,
 		vmem_size_t, vmem_import_t *, vmem_release_t *, vmem_t *,
 		vmem_size_t, vm_flag_t, int);
+void		vmem_add

CVS commit: src/usr.bin/indent

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 20:42:32 UTC 2023

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

Log Message:
indent: fix line number counting in function definition

In a function definition that is split on two lines, if the first line
ends with a '*', the following line break didn't include the line
number.


To generate a diff of this commit:
cvs rdiff -u -r1.239 -r1.240 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.239 src/usr.bin/indent/lexi.c:1.240
--- src/usr.bin/indent/lexi.c:1.239	Mon Jun 26 20:23:40 2023
+++ src/usr.bin/indent/lexi.c	Sun Dec  3 20:42:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.239 2023/06/26 20:23:40 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.240 2023/12/03 20:42:31 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: lexi.c,v 1.239 2023/06/26 20:23:40 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.240 2023/12/03 20:42:31 rillig Exp $");
 
 #include 
 #include 
@@ -523,6 +523,8 @@ lex_asterisk_unary(void)
 	while (*inp_p == '*' || ch_isspace(*inp_p)) {
 		if (*inp_p == '*')
 			token_add_char('*');
+		if (*inp_p == '\n')
+			line_no++;
 		inp_skip();
 	}
 



CVS commit: src/usr.bin/indent

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 20:42:32 UTC 2023

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

Log Message:
indent: fix line number counting in function definition

In a function definition that is split on two lines, if the first line
ends with a '*', the following line break didn't include the line
number.


To generate a diff of this commit:
cvs rdiff -u -r1.239 -r1.240 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

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 21:03:58 UTC 2023

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

Log Message:
indent: use line number of the token start in diagnostics

Previously, the line number of the end of the token was used, which was
confusing in debug mode.


To generate a diff of this commit:
cvs rdiff -u -r1.387 -r1.388 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.204 -r1.205 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.232 -r1.233 src/usr.bin/indent/io.c
cvs rdiff -u -r1.240 -r1.241 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.171 -r1.172 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/usr.bin/indent

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 21:03:58 UTC 2023

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

Log Message:
indent: use line number of the token start in diagnostics

Previously, the line number of the end of the token was used, which was
confusing in debug mode.


To generate a diff of this commit:
cvs rdiff -u -r1.387 -r1.388 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.204 -r1.205 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.232 -r1.233 src/usr.bin/indent/io.c
cvs rdiff -u -r1.240 -r1.241 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.171 -r1.172 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/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.387 src/usr.bin/indent/indent.c:1.388
--- src/usr.bin/indent/indent.c:1.387	Tue Jun 27 04:41:23 2023
+++ src/usr.bin/indent/indent.c	Sun Dec  3 21:03:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.387 2023/06/27 04:41:23 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.388 2023/12/03 21:03:58 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.387 2023/06/27 04:41:23 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.388 2023/12/03 21:03:58 rillig Exp $");
 
 #include 
 #include 
@@ -80,7 +80,6 @@ struct buffer com;
 
 bool found_err;
 bool had_eof;
-int line_no = 1;
 
 static struct {
 	struct parser_state *item;
@@ -158,7 +157,7 @@ diag(int level, const char *msg, ...)
 
 	va_start(ap, msg);
 	fprintf(stderr, "%s: %s:%d: ",
-	level == 0 ? "warning" : "error", in_name, line_no);
+	level == 0 ? "warning" : "error", in_name, token_start_line_no);
 	vfprintf(stderr, msg, ap);
 	fprintf(stderr, "\n");
 	va_end(ap);
@@ -580,7 +579,7 @@ process_newline(void)
 	output_line();
 
 stay_in_line:
-	line_no++;
+	token_end_line_no++;
 }
 
 static bool
@@ -1109,7 +1108,8 @@ indent(void)
 		lexer_symbol lsym = lexi();
 
 		debug_blank_line();
-		debug_printf("line %d: %s", line_no, lsym_name[lsym]);
+		debug_printf("line %d: %s",
+		token_start_line_no, lsym_name[lsym]);
 		debug_print_buf("token", &token);
 		debug_buffers();
 		debug_blank_line();

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.204 src/usr.bin/indent/indent.h:1.205
--- src/usr.bin/indent/indent.h:1.204	Mon Jun 26 20:03:09 2023
+++ src/usr.bin/indent/indent.h	Sun Dec  3 21:03:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.204 2023/06/26 20:03:09 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.205 2023/12/03 21:03:58 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -249,7 +249,8 @@ extern struct options {
 
 extern bool found_err;
 extern bool had_eof;		/* whether input is exhausted */
-extern int line_no;		/* the current input line number */
+extern int token_start_line_no;
+extern int token_end_line_no;
 extern enum indent_enabled {
 	indent_on,
 	indent_off,

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.232 src/usr.bin/indent/io.c:1.233
--- src/usr.bin/indent/io.c:1.232	Tue Jun 27 04:41:23 2023
+++ src/usr.bin/indent/io.c	Sun Dec  3 21:03:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.232 2023/06/27 04:41:23 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.233 2023/12/03 21:03:58 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: io.c,v 1.232 2023/06/27 04:41:23 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.233 2023/12/03 21:03:58 rillig Exp $");
 
 #include 
 
@@ -46,6 +46,8 @@ __RCSID("$NetBSD: io.c,v 1.232 2023/06/2
 
 struct buffer inp;
 const char *inp_p;
+int token_start_line_no;
+int token_end_line_no = 1;
 
 struct output_state out;
 enum indent_enabled indent_enabled;

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.240 src/usr.bin/indent/lexi.c:1.241
--- src/usr.bin/indent/lexi.c:1.240	Sun Dec  3 20:42:31 2023
+++ src/usr.bin/indent/lexi.c	Sun Dec  3 21:03:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.240 2023/12/03 20:42:31 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.241 2023/12/03 21:03:58 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: lexi.c,v 1.240 2023/12/03 20:42:31 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.241 2023/12/03 21:03:58 rillig Exp $");
 
 #include 
 #include 
@@ -188,7 +188,7 @@ skip_line_continuation(void)
 	if (inp_p[0] == '\\' && inp_p[1] == '\n') {
 		inp_p++;
 		inp_skip();
-		line_no++;
+		token_end_line_no++;
 		return true;
 	}
 	return false;
@@ -245,7 +245,7 @@ lex_char_or_string(void)
 
 		if (token.s[token.len - 1] == '\\') {
 			if (*inp_p == '\n')
-line_no++;
+token_end_line_no++;
 			token_add_char(inp_next());
 		}
 	}
@@ -524,7 +524,7 @@ lex_asterisk_unary(void)
 		if (*inp_p == '*')
 			token_add_char('*');
 		if (*inp_p == '\n')
-			line_no++;

CVS commit: src/usr.bin/indent

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 21:40:44 UTC 2023

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

Log Message:
indent: group input-related variables into a struct

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.388 -r1.389 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.205 -r1.206 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.233 -r1.234 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.c
diff -u src/usr.bin/indent/indent.c:1.388 src/usr.bin/indent/indent.c:1.389
--- src/usr.bin/indent/indent.c:1.388	Sun Dec  3 21:03:58 2023
+++ src/usr.bin/indent/indent.c	Sun Dec  3 21:40:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.388 2023/12/03 21:03:58 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.389 2023/12/03 21:40:44 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.388 2023/12/03 21:03:58 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.389 2023/12/03 21:40:44 rillig Exp $");
 
 #include 
 #include 
@@ -87,7 +87,6 @@ static struct {
 	size_t cap;
 } ifdef;
 
-FILE *input;
 FILE *output;
 
 static const char *in_name = "Standard Input";

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.205 src/usr.bin/indent/indent.h:1.206
--- src/usr.bin/indent/indent.h:1.205	Sun Dec  3 21:03:58 2023
+++ src/usr.bin/indent/indent.h	Sun Dec  3 21:40:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.205 2023/12/03 21:03:58 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.206 2023/12/03 21:40:44 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -146,18 +146,28 @@ struct buffer {
 	size_t cap;
 };
 
-extern FILE *input;
-extern FILE *output;
-
 /*
- * The current line from the input file, used by the lexer to generate tokens.
- * To read from the line, start at inp_p and continue up to and including the
+ * The current input file, used by the lexer to generate tokens.
+ * To read from the input, start at p and continue up to and including the
  * next '\n'. To read beyond the '\n', call inp_skip or inp_next, which will
  * make the next line available, invalidating any pointers into the previous
  * line.
  */
-extern struct buffer inp;
-extern const char *inp_p;
+extern struct input_state {
+	FILE *f;
+	struct buffer line;
+	const char *p;
+	int token_start_line;
+	int token_end_line;
+} in;
+
+#define input in.f
+#define inp in.line
+#define inp_p in.p
+#define token_start_line_no in.token_start_line
+#define token_end_line_no in.token_end_line
+
+extern FILE *output;
 
 extern struct buffer token;	/* the current token to be processed, is
  * typically copied to the buffer 'code', or in
@@ -249,8 +259,6 @@ extern struct options {
 
 extern bool found_err;
 extern bool had_eof;		/* whether input is exhausted */
-extern int token_start_line_no;
-extern int token_end_line_no;
 extern enum indent_enabled {
 	indent_on,
 	indent_off,

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.233 src/usr.bin/indent/io.c:1.234
--- src/usr.bin/indent/io.c:1.233	Sun Dec  3 21:03:58 2023
+++ src/usr.bin/indent/io.c	Sun Dec  3 21:40:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.233 2023/12/03 21:03:58 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.234 2023/12/03 21:40:44 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,16 +38,15 @@
  */
 
 #include 
-__RCSID("$NetBSD: io.c,v 1.233 2023/12/03 21:03:58 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.234 2023/12/03 21:40:44 rillig Exp $");
 
 #include 
 
 #include "indent.h"
 
-struct buffer inp;
-const char *inp_p;
-int token_start_line_no;
-int token_end_line_no = 1;
+struct input_state in = {
+	.token_end_line = 1,
+};
 
 struct output_state out;
 enum indent_enabled indent_enabled;



CVS commit: src/usr.bin/indent

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 21:40:44 UTC 2023

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

Log Message:
indent: group input-related variables into a struct

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.388 -r1.389 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.205 -r1.206 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.233 -r1.234 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

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 21:44:43 UTC 2023

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

Log Message:
indent: inline input-related macros

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/usr.bin/indent/args.c
cvs rdiff -u -r1.389 -r1.390 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.206 -r1.207 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.234 -r1.235 src/usr.bin/indent/io.c
cvs rdiff -u -r1.241 -r1.242 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.172 -r1.173 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/usr.bin/indent/args.c
diff -u src/usr.bin/indent/args.c:1.85 src/usr.bin/indent/args.c:1.86
--- src/usr.bin/indent/args.c:1.85	Thu Jun 15 09:19:06 2023
+++ src/usr.bin/indent/args.c	Sun Dec  3 21:44:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.85 2023/06/15 09:19:06 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.86 2023/12/03 21:44:42 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: args.c,v 1.85 2023/06/15 09:19:06 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.86 2023/12/03 21:44:42 rillig Exp $");
 
 /* Read options from profile files and from the command line. */
 
@@ -168,8 +168,8 @@ set_special_option(const char *arg, cons
 	}
 
 	if (strcmp(arg, "st") == 0) {
-		if (input == NULL)
-			input = stdin;
+		if (in.f == NULL)
+			in.f = stdin;
 		if (output == NULL)
 			output = stdout;
 		return true;

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.389 src/usr.bin/indent/indent.c:1.390
--- src/usr.bin/indent/indent.c:1.389	Sun Dec  3 21:40:44 2023
+++ src/usr.bin/indent/indent.c	Sun Dec  3 21:44:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.389 2023/12/03 21:40:44 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.390 2023/12/03 21:44:42 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.389 2023/12/03 21:40:44 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.390 2023/12/03 21:44:42 rillig Exp $");
 
 #include 
 #include 
@@ -156,7 +156,7 @@ diag(int level, const char *msg, ...)
 
 	va_start(ap, msg);
 	fprintf(stderr, "%s: %s:%d: ",
-	level == 0 ? "warning" : "error", in_name, token_start_line_no);
+	level == 0 ? "warning" : "error", in_name, in.token_start_line);
 	vfprintf(stderr, msg, ap);
 	fprintf(stderr, "\n");
 	va_end(ap);
@@ -228,17 +228,17 @@ copy_to_bak_file(void)
 	if (bak == NULL)
 		err(1, "%s", backup_name);
 
-	while ((n = fread(buff, 1, sizeof(buff), input)) > 0)
+	while ((n = fread(buff, 1, sizeof(buff), in.f)) > 0)
 		if (fwrite(buff, 1, n, bak) != n)
 			err(1, "%s", backup_name);
-	if (fclose(input) != 0)
+	if (fclose(in.f) != 0)
 		err(1, "%s", in_name);
 	if (fclose(bak) != 0)
 		err(1, "%s", backup_name);
 
 	/* re-open the backup file as the input file */
-	input = fopen(backup_name, "r");
-	if (input == NULL)
+	in.f = fopen(backup_name, "r");
+	if (in.f == NULL)
 		err(1, "%s", backup_name);
 	/* now the original input file will be the output */
 	output = fopen(in_name, "w");
@@ -257,9 +257,9 @@ parse_command_line(int argc, char **argv
 		if (arg[0] == '-') {
 			set_option(arg, "Command line");
 
-		} else if (input == NULL) {
+		} else if (in.f == NULL) {
 			in_name = arg;
-			if ((input = fopen(in_name, "r")) == NULL)
+			if ((in.f = fopen(in_name, "r")) == NULL)
 err(1, "%s", in_name);
 
 		} else if (output == NULL) {
@@ -273,8 +273,8 @@ parse_command_line(int argc, char **argv
 			errx(1, "too many arguments: %s", arg);
 	}
 
-	if (input == NULL) {
-		input = stdin;
+	if (in.f == NULL) {
+		in.f = stdin;
 		output = stdout;
 	} else if (output == NULL)
 		copy_to_bak_file();
@@ -300,7 +300,7 @@ set_initial_indentation(void)
 	inp_read_line();
 
 	int ind = 0;
-	for (const char *p = inp_p;; p++) {
+	for (const char *p = in.p;; p++) {
 		if (*p == ' ')
 			ind++;
 		else if (*p == '\t')
@@ -417,7 +417,7 @@ read_preprocessing_line(void)
 
 	buf_add_char(&lab, '#');
 
-	while (inp_p[0] != '\n' || (state == COMM && !had_eof)) {
+	while (in.p[0] != '\n' || (state == COMM && !had_eof)) {
 		buf_add_char(&lab, inp_next());
 		switch (lab.s[lab.len - 1]) {
 		case '\\':
@@ -425,9 +425,9 @@ read_preprocessing_line(void)
 buf_add_char(&lab, inp_next());
 			break;
 		case '/':
-			if (inp_p[0] == '*' && state == PLAIN) {
+			if (in.p[0] == '*' && state == PLAIN) {
 state = COMM;
-buf_add_char(&lab, *inp_p++);
+buf_add_char(&lab, *in.p++);
 			}
 			break;
 		case '"':
@@ -443,9 +443,9 @@ read_preprocessing_line(void)
 state = CHR;
 			break;
 		case '*':
-			if (inp_p[0] == '/' && state == COMM) {
+			if (in.p[0] == '/' && state == COMM) {
 state = PLAIN;
-buf_add_char(&lab, *inp_p++);
+buf_add_char(&lab, *in.p++);
 			}

CVS commit: src/usr.bin/indent

2023-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec  3 21:44:43 UTC 2023

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

Log Message:
indent: inline input-related macros

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/usr.bin/indent/args.c
cvs rdiff -u -r1.389 -r1.390 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.206 -r1.207 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.234 -r1.235 src/usr.bin/indent/io.c
cvs rdiff -u -r1.241 -r1.242 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.172 -r1.173 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/alpha

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Dec  4 00:32:10 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: api_up1000.c dec_1000a.c dec_2000_300.c
dec_2100_a50.c dec_2100_a500.c dec_550.c dec_6600.c
dec_alphabook1.c dec_axppci_33.c dec_eb164.c dec_eb64plus.c
dec_eb66.c dec_kn20aa.c
src/sys/arch/alpha/jensenio: jensenio.c jensenio_bus_intio.c
jensenio_bus_io.c jensenio_bus_mem.c jenseniovar.h
src/sys/arch/alpha/pci: apecs.c apecs_bus_io.c apecs_bus_mem.c
apecsvar.h cia.c cia_bwx_bus_io.c cia_bwx_bus_mem.c
cia_swiz_bus_io.c cia_swiz_bus_mem.c ciavar.h dwlpx_bus_io.c
dwlpx_bus_mem.c dwlpxvar.h irongate.c irongate_bus_io.c
irongate_bus_mem.c irongatevar.h lca.c lca_bus_io.c lca_bus_mem.c
lcavar.h mcpcia.c mcpcia_bus_io.c mcpcia_bus_mem.c mcpciavar.h
pci_bwx_bus_io_chipdep.c pci_bwx_bus_mem_chipdep.c
pci_swiz_bus_io_chipdep.c pci_swiz_bus_mem_chipdep.c tsc.c
tsp_bus_io.c tsp_bus_mem.c tsvar.h ttwoga.c ttwoga_bus_io.c
ttwoga_bus_mem.c ttwogavar.h

Log Message:
Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/alpha/api_up1000.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/alpha/dec_1000a.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/alpha/dec_2000_300.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/alpha/alpha/dec_2100_a50.c \
src/sys/arch/alpha/alpha/dec_axppci_33.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/alpha/alpha/dec_2100_a500.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/dec_550.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/alpha/dec_alphabook1.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/alpha/alpha/dec_eb164.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/dec_eb64plus.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/alpha/dec_eb66.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/alpha/alpha/dec_kn20aa.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/jensenio/jensenio.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/jensenio/jensenio_bus_intio.c \
src/sys/arch/alpha/jensenio/jenseniovar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/jensenio/jensenio_bus_io.c \
src/sys/arch/alpha/jensenio/jensenio_bus_mem.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/alpha/pci/apecs.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/pci/apecs_bus_io.c \
src/sys/arch/alpha/pci/apecs_bus_mem.c \
src/sys/arch/alpha/pci/irongate_bus_mem.c \
src/sys/arch/alpha/pci/lca_bus_io.c src/sys/arch/alpha/pci/lca_bus_mem.c \
src/sys/arch/alpha/pci/lcavar.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/pci/apecsvar.h \
src/sys/arch/alpha/pci/dwlpxvar.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/alpha/pci/cia.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/pci/cia_bwx_bus_io.c \
src/sys/arch/alpha/pci/cia_bwx_bus_mem.c \
src/sys/arch/alpha/pci/mcpcia_bus_io.c \
src/sys/arch/alpha/pci/mcpcia_bus_mem.c \
src/sys/arch/alpha/pci/mcpciavar.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/pci/cia_swiz_bus_io.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/pci/cia_swiz_bus_mem.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/pci/ciavar.h \
src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/alpha/pci/dwlpx_bus_io.c \
src/sys/arch/alpha/pci/dwlpx_bus_mem.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/pci/irongate.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/pci/irongate_bus_io.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/pci/irongatevar.h \
src/sys/arch/alpha/pci/ttwogavar.h
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/alpha/pci/lca.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/pci/mcpcia.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/tsc.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/pci/tsp_bus_io.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/alpha/pci/tsp_bus_mem.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/pci/tsvar.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/pci/ttwoga.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/pci/ttwoga_bus_io.c \
src/sys/arch/alpha/pci/ttwoga_bus_mem.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/alpha

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Dec  4 00:32:10 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: api_up1000.c dec_1000a.c dec_2000_300.c
dec_2100_a50.c dec_2100_a500.c dec_550.c dec_6600.c
dec_alphabook1.c dec_axppci_33.c dec_eb164.c dec_eb64plus.c
dec_eb66.c dec_kn20aa.c
src/sys/arch/alpha/jensenio: jensenio.c jensenio_bus_intio.c
jensenio_bus_io.c jensenio_bus_mem.c jenseniovar.h
src/sys/arch/alpha/pci: apecs.c apecs_bus_io.c apecs_bus_mem.c
apecsvar.h cia.c cia_bwx_bus_io.c cia_bwx_bus_mem.c
cia_swiz_bus_io.c cia_swiz_bus_mem.c ciavar.h dwlpx_bus_io.c
dwlpx_bus_mem.c dwlpxvar.h irongate.c irongate_bus_io.c
irongate_bus_mem.c irongatevar.h lca.c lca_bus_io.c lca_bus_mem.c
lcavar.h mcpcia.c mcpcia_bus_io.c mcpcia_bus_mem.c mcpciavar.h
pci_bwx_bus_io_chipdep.c pci_bwx_bus_mem_chipdep.c
pci_swiz_bus_io_chipdep.c pci_swiz_bus_mem_chipdep.c tsc.c
tsp_bus_io.c tsp_bus_mem.c tsvar.h ttwoga.c ttwoga_bus_io.c
ttwoga_bus_mem.c ttwogavar.h

Log Message:
Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/alpha/api_up1000.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/alpha/dec_1000a.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/alpha/dec_2000_300.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/alpha/alpha/dec_2100_a50.c \
src/sys/arch/alpha/alpha/dec_axppci_33.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/alpha/alpha/dec_2100_a500.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/dec_550.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/alpha/dec_alphabook1.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/alpha/alpha/dec_eb164.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/dec_eb64plus.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/alpha/dec_eb66.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/alpha/alpha/dec_kn20aa.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/jensenio/jensenio.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/jensenio/jensenio_bus_intio.c \
src/sys/arch/alpha/jensenio/jenseniovar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/jensenio/jensenio_bus_io.c \
src/sys/arch/alpha/jensenio/jensenio_bus_mem.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/alpha/pci/apecs.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/pci/apecs_bus_io.c \
src/sys/arch/alpha/pci/apecs_bus_mem.c \
src/sys/arch/alpha/pci/irongate_bus_mem.c \
src/sys/arch/alpha/pci/lca_bus_io.c src/sys/arch/alpha/pci/lca_bus_mem.c \
src/sys/arch/alpha/pci/lcavar.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/pci/apecsvar.h \
src/sys/arch/alpha/pci/dwlpxvar.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/alpha/pci/cia.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/pci/cia_bwx_bus_io.c \
src/sys/arch/alpha/pci/cia_bwx_bus_mem.c \
src/sys/arch/alpha/pci/mcpcia_bus_io.c \
src/sys/arch/alpha/pci/mcpcia_bus_mem.c \
src/sys/arch/alpha/pci/mcpciavar.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/pci/cia_swiz_bus_io.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/pci/cia_swiz_bus_mem.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/pci/ciavar.h \
src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/alpha/pci/dwlpx_bus_io.c \
src/sys/arch/alpha/pci/dwlpx_bus_mem.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/pci/irongate.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/pci/irongate_bus_io.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/pci/irongatevar.h \
src/sys/arch/alpha/pci/ttwogavar.h
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/alpha/pci/lca.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/pci/mcpcia.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/tsc.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/pci/tsp_bus_io.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/alpha/pci/tsp_bus_mem.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/pci/tsvar.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/pci/ttwoga.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/pci/ttwoga_bus_io.c \
src/sys/arch/alpha/pci/ttwoga_bus_mem.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/alpha/alpha/api_up1000.c
diff -u src/sys/arch/alpha/alpha/api_up1000.c:1.31 src/s

CVS commit: src/sys/dev/vme

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Dec  4 01:49:29 UTC 2023

Modified Files:
src/sys/dev/vme: vme.c vmevar.h

Log Message:
Manage VME address space using vmem(9) rather than extent(9).

XXX PR kern/57748 applies here; we lose the last byte of A32 space.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/vme/vme.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/vme/vmevar.h

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



CVS commit: src/sys/dev/vme

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Dec  4 01:49:29 UTC 2023

Modified Files:
src/sys/dev/vme: vme.c vmevar.h

Log Message:
Manage VME address space using vmem(9) rather than extent(9).

XXX PR kern/57748 applies here; we lose the last byte of A32 space.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/vme/vme.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/vme/vmevar.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/vme/vme.c
diff -u src/sys/dev/vme/vme.c:1.29 src/sys/dev/vme/vme.c:1.30
--- src/sys/dev/vme/vme.c:1.29	Sat Aug  7 16:19:17 2021
+++ src/sys/dev/vme/vme.c	Mon Dec  4 01:49:29 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: vme.c,v 1.29 2021/08/07 16:19:17 thorpej Exp $ */
+/* $NetBSD: vme.c,v 1.30 2023/12/04 01:49:29 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -29,13 +29,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.29 2021/08/07 16:19:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.30 2023/12/04 01:49:29 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -47,7 +47,7 @@ static int vmesubmatch1(device_t, cfdata
 static int vmesubmatch(device_t, cfdata_t, const int *, void *);
 int vmematch(device_t, cfdata_t, void *);
 void vmeattach(device_t, device_t, void *);
-static struct extent *vme_select_map(struct vmebus_softc*, vme_am_t);
+static vmem_t *vme_select_map(struct vmebus_softc*, vme_am_t);
 
 #define VME_SLAVE_DUMMYDRV "vme_slv"
 
@@ -180,21 +180,48 @@ vmeattach(device_t parent, device_t self
 	/*
 	 * set up address space accounting - assume incomplete decoding
 	 */
-	sc->vme32ext = extent_create("vme32", 0, 0x, 0, 0, 0);
-	if (!sc->vme32ext) {
-		printf("error creating A32 map\n");
+	sc->vme32_arena = vmem_create("vme32",
+  0,		/* base */
+	/* XXX loses last byte */ 0x,	/* size */
+  1,		/* quantum */
+  NULL,		/* allocfn */
+  NULL,		/* releasefn */
+  NULL,		/* source */
+  0,		/* qcache_max */
+  VM_SLEEP,
+  IPL_NONE);
+	if (!sc->vme32_arena) {
+		device_printf(self, "error creating A32 map\n");
 		return;
 	}
 
-	sc->vme24ext = extent_create("vme24", 0, 0x00ff, 0, 0, 0);
-	if (!sc->vme24ext) {
-		printf("error creating A24 map\n");
+	sc->vme24_arena = vmem_create("vme24",
+  0,		/* base */
+  0x0100,	/* size */
+  1,		/* quantum */
+  NULL,		/* allocfn */
+  NULL,		/* releasefn */
+  NULL,		/* source */
+  0,		/* qcache_max */
+  VM_SLEEP,
+  IPL_NONE);
+	if (!sc->vme24_arena) {
+		device_printf(self, "error creating A24 map\n");
 		return;
 	}
 
-	sc->vme16ext = extent_create("vme16", 0, 0x, 0, 0, 0);
-	if (!sc->vme16ext) {
-		printf("error creating A16 map\n");
+	sc->vme16_arena = vmem_create("vme16",
+  0,		/* base */
+  0x0001,	/* size */
+  1,		/* quantum */
+  NULL,		/* allocfn */
+  NULL,		/* releasefn */
+  NULL,		/* source */
+  0,		/* qcache_max */
+  VM_SLEEP,
+  IPL_NONE);
+	if (!sc->vme16_arena) {
+		device_printf(self, "error creating A16 map\n");
 		return;
 	}
 
@@ -207,13 +234,13 @@ vmeattach(device_t parent, device_t self
 	config_search(self, NULL,
 	CFARGS(.search = vmesubmatch));
 
-#ifdef VMEDEBUG
-	if (sc->vme32ext)
-		extent_print(sc->vme32ext);
-	if (sc->vme24ext)
-		extent_print(sc->vme24ext);
-	if (sc->vme16ext)
-		extent_print(sc->vme16ext);
+#if 0	/* XXX VMEDEBUG */
+	if (sc->vme32_arena)
+		vmem_print(sc->vme32_arena);
+	if (sc->vme24_arena)
+		vmem_print(sc->vme24_arena);
+	if (sc->vme16_arena)
+		vmem_print(sc->vme16_arena);
 #endif
 }
 
@@ -230,38 +257,38 @@ vmedetach(device_t dev)
 
 	/* extent maps should be empty now */
 
-	if (sc->vme32ext) {
+	if (sc->vme32_arena) {
 #ifdef VMEDEBUG
-		extent_print(sc->vme32ext);
+		vmem_print(sc->vme32_arena);
 #endif
-		extent_destroy(sc->vme32ext);
+		vmem_destroy(sc->vme32_arena);
 	}
-	if (sc->vme24ext) {
+	if (sc->vme24_arena) {
 #ifdef VMEDEBUG
-		extent_print(sc->vme24ext);
+		vmem_print(sc->vme24_arena);
 #endif
-		extent_destroy(sc->vme24ext);
+		vmem_destroy(sc->vme24_arena);
 	}
-	if (sc->vme16ext) {
+	if (sc->vme16_arena) {
 #ifdef VMEDEBUG
-		extent_print(sc->vme16ext);
+		vmem_print(sc->vme16_arena);
 #endif
-		extent_destroy(sc->vme16ext);
+		vmem_destroy(sc->vme16_arena);
 	}
 
 	return (0);
 }
 #endif
 
-static struct extent *
+static vmem_t *
 vme_select_map(struct vmebus_softc *sc, vme_am_t ams)
 {
 	if ((ams & VME_AM_ADRSIZEMASK) == VME_AM_A32)
-		return (sc->vme32ext);
+		return (sc->vme32_arena);
 	else if ((ams & VME_AM_ADRSIZEMASK) == VME_AM_A24)
-		return (sc->vme24ext);
+		return (sc->vme24_arena);
 	else if ((ams & VME_AM_ADRSIZEMASK) == VME_AM_A16)
-		return (sc->vme16ext);
+		return (sc->vme16_arena);