CVS commit: src/tests/lib/libutil

2024-02-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Feb 14 20:51:17 UTC 2024

Modified Files:
src/tests/lib/libutil: t_snprintb.c

Log Message:
tests/libutil/snprintb_m: add tests for small line length


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libutil/t_snprintb.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/lib/libutil/t_snprintb.c
diff -u src/tests/lib/libutil/t_snprintb.c:1.12 src/tests/lib/libutil/t_snprintb.c:1.13
--- src/tests/lib/libutil/t_snprintb.c:1.12	Sat Jan 27 21:42:29 2024
+++ src/tests/lib/libutil/t_snprintb.c	Wed Feb 14 20:51:17 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: t_snprintb.c,v 1.12 2024/01/27 21:42:29 rillig Exp $ */
+/* $NetBSD: t_snprintb.c,v 1.13 2024/02/14 20:51:17 rillig Exp $ */
 
 /*
  * Copyright (c) 2002, 2004, 2008, 2010, 2024 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008, 2010\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_snprintb.c,v 1.12 2024/01/27 21:42:29 rillig Exp $");
+__RCSID("$NetBSD: t_snprintb.c,v 1.13 2024/02/14 20:51:17 rillig Exp $");
 
 #include 
 #include 
@@ -573,36 +573,44 @@ ATF_TC_BODY(snprintb, tc)
 
 static void
 h_snprintb_m_loc(const char *file, size_t line,
-const char *fmt, size_t fmtlen, uint64_t val, int line_max,
-const char *res, size_t reslen)
+size_t bufsize, const char *fmt, size_t fmtlen, uint64_t val, size_t max,
+size_t exp_rv, const char *res, size_t reslen)
 {
 	char buf[1024];
 
-	int rv = snprintb_m(buf, sizeof(buf), fmt, val, line_max);
+	ATF_REQUIRE(bufsize > 1);
+	ATF_REQUIRE(bufsize <= sizeof(buf));
 
-	ATF_REQUIRE_MSG(rv >= 0, "formatting %jx with '%s' returns error %d",
+	memset(buf, 'Z', sizeof(buf));
+	int rv = snprintb_m(buf, bufsize, fmt, val, max);
+	ATF_REQUIRE_MSG(rv >= 0,
+	"formatting %jx with '%s' returns error %d",
 	(uintmax_t)val, vis_arr(fmt, fmtlen), rv);
 
-	size_t buflen = rv;
+	size_t total = rv;
 	ATF_CHECK_MSG(
-	buflen == reslen && memcmp(buf, res, reslen) == 0,
+	total == exp_rv && memcmp(buf, res, reslen) == 0,
 	"failed:\n"
 	"\ttest case: %s:%zu\n"
 	"\tformat: %s\n"
 	"\tvalue: %#jx\n"
+	"\tmax: %zu\n"
 	"\twant: %zu bytes %s\n"
 	"\thave: %zu bytes %s\n",
 	file, line,
 	vis_arr(fmt, fmtlen),
 	(uintmax_t)val,
-	reslen, vis_arr(res, reslen),
-	buflen, vis_arr(buf, buflen));
+	max,
+	exp_rv, vis_arr(res, reslen),
+	total, vis_arr(buf, reslen));
 }
 
-#define	h_snprintb_m(fmt, val, line_max, res)\
+#define	h_snprintb_m_len(bufsize, fmt, val, line_max, exp_rv, res)	\
 	h_snprintb_m_loc(__FILE__, __LINE__,\
-	fmt, sizeof(fmt) - 1, val, line_max,			\
-	res, sizeof(res) - 1)
+	bufsize, fmt, sizeof(fmt) - 1, val, line_max,		\
+	exp_rv, res, sizeof(res) - 1)
+#define	h_snprintb_m(fmt, val, max, res)\
+	h_snprintb_m_len(1024, fmt, val, max, sizeof(res) - 1, res)
 
 ATF_TC(snprintb_m);
 ATF_TC_HEAD(snprintb_m, tc)
@@ -611,6 +619,68 @@ ATF_TC_HEAD(snprintb_m, tc)
 }
 ATF_TC_BODY(snprintb_m, tc)
 {
+	// old-style format, small maximum line length
+	h_snprintb_m_len(
+	68,
+	"\020"
+	"\001bit1"
+	"\002bit2"
+	"\003bit3",
+	0x,
+	6,
+	143,
+	/*   0 */ "0x>\0"
+	/*   8 */ "0x<>\0"
+	/*  17 */ "0xb>\0"
+	/*  26 */ "0xi>\0"
+	/*  35 */ "0xt>\0"
+	/*  44 */ "0x1>\0"
+	/*  53 */ "0x<>\0"
+	/*  62 */ "0xff\0"
+	/*  67 */ "ZZZ"
+	/*  70 */ "ZZ"
+	/*  80 */ "ZZ"
+	/*  90 */ "ZZ"
+	/* 100 */ "ZZ"
+	/* 110 */ "ZZ"
+	/* 116 */ "\0\0"	/* FIXME: out-of-bounds write */
+	/* 118 */ "ZZ"
+	/* 120 */ "ZZ"
+	/* 130 */ "ZZ"
+	/* 140 */ "ZZ"
+	);
+
+	// new-style format, small maximum line length
+	h_snprintb_m_len(
+	68,
+	"\177\020"
+	"b\000bit1\0"
+	"b\001bit2\0"
+	"b\002bit3\0",
+	0x,
+	6,
+	143,
+	/*   0 */ "0x>\0"
+	/*   8 */ "0x<>\0"
+	/*  17 */ "0xb>\0"
+	/*  26 */ "0xi>\0"
+	/*  35 */ "0xt>\0"
+	/*  44 */ "0x1>\0"
+	/*  53 */ "0x<>\0"
+	/*  62 */ "0xff\0"
+	/*  67 */ "ZZZ"
+	/*  70 */ "ZZ"
+	/*  80 */ "ZZ"
+	/*  90 */ "ZZ"
+	/* 100 */ "ZZ"
+	/* 110 */ "ZZ"
+	/* 116 */ "\0\0"	/* FIXME: out-of-bounds write */
+	/* 118 */ "ZZ"
+	/* 120 */ "ZZ"
+	/* 130 */ "ZZ"
+	/* 140 */ "ZZ"
+	);
+
 	h_snprintb_m(
 	"\177\020"
 	"b\0LSB\0"



CVS commit: src/tests/lib/libutil

2024-02-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Feb 14 20:51:17 UTC 2024

Modified Files:
src/tests/lib/libutil: t_snprintb.c

Log Message:
tests/libutil/snprintb_m: add tests for small line length


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libutil/t_snprintb.c

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



CVS commit: src/doc

2024-02-14 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Feb 14 19:20:29 UTC 2024

Modified Files:
src/doc: CHANGES

Log Message:
doc: Fix syntax


To generate a diff of this commit:
cvs rdiff -u -r1.3036 -r1.3037 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.3036 src/doc/CHANGES:1.3037
--- src/doc/CHANGES:1.3036	Tue Feb 13 15:40:28 2024
+++ src/doc/CHANGES	Wed Feb 14 19:20:29 2024
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3036 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3037 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -278,3 +278,4 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 		[macallan 20240213]
 	bind: Apply bind security patches: CVE-2023-4408 CVE-2023-5517
 		CVE-2023-5679 CVE-2023-6516 CVE-2023-50387 CVE-2023-50868
+		[christos 20240213]



CVS commit: src/doc

2024-02-14 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Feb 14 19:20:29 UTC 2024

Modified Files:
src/doc: CHANGES

Log Message:
doc: Fix syntax


To generate a diff of this commit:
cvs rdiff -u -r1.3036 -r1.3037 src/doc/CHANGES

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



CVS commit: src/common/lib/libc/atomic

2024-02-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 14 18:00:02 UTC 2024

Modified Files:
src/common/lib/libc/atomic: atomic_load.c

Log Message:
sprinkle unused.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_load.c

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



CVS commit: src/common/lib/libc/atomic

2024-02-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 14 18:00:02 UTC 2024

Modified Files:
src/common/lib/libc/atomic: atomic_load.c

Log Message:
sprinkle unused.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_load.c

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

Modified files:

Index: src/common/lib/libc/atomic/atomic_load.c
diff -u src/common/lib/libc/atomic/atomic_load.c:1.4 src/common/lib/libc/atomic/atomic_load.c:1.5
--- src/common/lib/libc/atomic/atomic_load.c:1.4	Sat Apr  9 19:38:57 2022
+++ src/common/lib/libc/atomic/atomic_load.c	Wed Feb 14 13:00:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_load.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $	*/
+/*	$NetBSD: atomic_load.c,v 1.5 2024/02/14 18:00:02 christos Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: atomic_load.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $");
+__RCSID("$NetBSD: atomic_load.c,v 1.5 2024/02/14 18:00:02 christos Exp $");
 
 #include "atomic_op_namespace.h"
 
@@ -36,8 +36,9 @@ __RCSID("$NetBSD: atomic_load.c,v 1.4 20
 
 #define atomic_load_n(n,b) \
 uint ## b ## _t __atomic_load_ ## n(const volatile void *, int); \
+/*ARGSUSED*/ \
 uint ## b ## _t \
-__atomic_load_ ## n(const volatile void *ptr, int memmodel) \
+__atomic_load_ ## n(const volatile void *ptr, int memmodel __unused) \
 { \
 	uint## b ##_t val; \
 	val = *(const volatile uint ## b ## _t *)ptr; \



CVS commit: [netbsd-10] src/doc

2024-02-14 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Feb 14 15:10:47 UTC 2024

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Change entry for #594


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.196 -r1.1.2.197 src/doc/CHANGES-10.0

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

Modified files:

Index: src/doc/CHANGES-10.0
diff -u src/doc/CHANGES-10.0:1.1.2.196 src/doc/CHANGES-10.0:1.1.2.197
--- src/doc/CHANGES-10.0:1.1.2.196	Wed Feb 14 15:08:52 2024
+++ src/doc/CHANGES-10.0	Wed Feb 14 15:10:47 2024
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-10.0,v 1.1.2.196 2024/02/14 15:08:52 sborrill Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.197 2024/02/14 15:10:47 sborrill Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -15523,9 +15523,7 @@ sys/sys/param.h	(manually edited)
 
 usr.sbin/sysinst/label.c			1.51
 
-	PR 57927: when comparing old and new partition state during
-	renumbering, ignore differences in the install target flag -
-	the backend might have flipped it off already to ensure only
-	a single partition is marked as install target.
+	PR 57927: fix moving of the install target to a new
+ 	partition.
 	[martin, ticket #594]
 



CVS commit: [netbsd-10] src/doc

2024-02-14 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Feb 14 15:10:47 UTC 2024

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Change entry for #594


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.196 -r1.1.2.197 src/doc/CHANGES-10.0

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



CVS commit: [netbsd-10] src/doc

2024-02-14 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Feb 14 15:08:53 UTC 2024

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Ticket #594


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.195 -r1.1.2.196 src/doc/CHANGES-10.0

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

Modified files:

Index: src/doc/CHANGES-10.0
diff -u src/doc/CHANGES-10.0:1.1.2.195 src/doc/CHANGES-10.0:1.1.2.196
--- src/doc/CHANGES-10.0:1.1.2.195	Tue Feb  6 12:38:53 2024
+++ src/doc/CHANGES-10.0	Wed Feb 14 15:08:52 2024
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-10.0,v 1.1.2.195 2024/02/06 12:38:53 martin Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.196 2024/02/14 15:08:52 sborrill Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -15520,3 +15520,12 @@ external/gpl2/groff/tmac/mdoc.local		(ma
 sys/sys/param.h	(manually edited)
 
 	Welcome to 10.0_RC4
+
+usr.sbin/sysinst/label.c			1.51
+
+	PR 57927: when comparing old and new partition state during
+	renumbering, ignore differences in the install target flag -
+	the backend might have flipped it off already to ensure only
+	a single partition is marked as install target.
+	[martin, ticket #594]
+



CVS commit: [netbsd-10] src/doc

2024-02-14 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Feb 14 15:08:53 UTC 2024

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Ticket #594


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.195 -r1.1.2.196 src/doc/CHANGES-10.0

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



CVS commit: [netbsd-10] src/usr.sbin/sysinst

2024-02-14 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Feb 14 15:08:29 UTC 2024

Modified Files:
src/usr.sbin/sysinst [netbsd-10]: label.c

Log Message:
Pull up the following revisions(s) (requested by martin in ticket #594):
usr.sbin/sysinst/label.c:   revision 1.51

PR 57927: when comparing old and new partition state during renumbering,
ignore differences in the install target flag - the backend might have
flipped it off already to ensure only a single partition is marked
as install target.


To generate a diff of this commit:
cvs rdiff -u -r1.46.2.2 -r1.46.2.3 src/usr.sbin/sysinst/label.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.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.46.2.2 src/usr.sbin/sysinst/label.c:1.46.2.3
--- src/usr.sbin/sysinst/label.c:1.46.2.2	Sun Nov 26 12:40:50 2023
+++ src/usr.sbin/sysinst/label.c	Wed Feb 14 15:08:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: label.c,v 1.46.2.2 2023/11/26 12:40:50 bouyer Exp $	*/
+/*	$NetBSD: label.c,v 1.46.2.3 2024/02/14 15:08:29 sborrill Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.46.2.2 2023/11/26 12:40:50 bouyer Exp $");
+__RCSID("$NetBSD: label.c,v 1.46.2.3 2024/02/14 15:08:29 sborrill Exp $");
 #endif
 
 #include 
@@ -512,7 +512,8 @@ renumber_partitions(struct partition_usa
 		for (i = 0; i < pset->num; i++) {
 			if (pset->infos[i].cur_start != info.start)
 continue;
-			if (pset->infos[i].cur_flags != info.flags)
+			if ((pset->infos[i].cur_flags & ~PTI_INSTALL_TARGET)
+			!= (info.flags & ~PTI_INSTALL_TARGET))
 continue;
 			if ((info.fs_type != FS_UNUSED &&
 			info.fs_type == pset->infos[i].fs_type) ||



CVS commit: [netbsd-10] src/usr.sbin/sysinst

2024-02-14 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Feb 14 15:08:29 UTC 2024

Modified Files:
src/usr.sbin/sysinst [netbsd-10]: label.c

Log Message:
Pull up the following revisions(s) (requested by martin in ticket #594):
usr.sbin/sysinst/label.c:   revision 1.51

PR 57927: when comparing old and new partition state during renumbering,
ignore differences in the install target flag - the backend might have
flipped it off already to ensure only a single partition is marked
as install target.


To generate a diff of this commit:
cvs rdiff -u -r1.46.2.2 -r1.46.2.3 src/usr.sbin/sysinst/label.c

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



CVS commit: src/usr.sbin/sysinst

2024-02-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 14 13:52:11 UTC 2024

Modified Files:
src/usr.sbin/sysinst: label.c

Log Message:
PR 57927: when comparing old and new partition state during renumbering,
ignore differences in the install target flag - the backend might have
flipped it off already to ensure only a single partition is marked
as install target.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/sysinst/label.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.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.50 src/usr.sbin/sysinst/label.c:1.51
--- src/usr.sbin/sysinst/label.c:1.50	Mon Nov 20 18:03:55 2023
+++ src/usr.sbin/sysinst/label.c	Wed Feb 14 13:52:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: label.c,v 1.50 2023/11/20 18:03:55 martin Exp $	*/
+/*	$NetBSD: label.c,v 1.51 2024/02/14 13:52:11 martin Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.50 2023/11/20 18:03:55 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.51 2024/02/14 13:52:11 martin Exp $");
 #endif
 
 #include 
@@ -510,7 +510,8 @@ renumber_partitions(struct partition_usa
 		for (i = 0; i < pset->num; i++) {
 			if (pset->infos[i].cur_start != info.start)
 continue;
-			if (pset->infos[i].cur_flags != info.flags)
+			if ((pset->infos[i].cur_flags & ~PTI_INSTALL_TARGET)
+			!= (info.flags & ~PTI_INSTALL_TARGET))
 continue;
 			if ((info.flags & PTI_SPECIAL_PARTS) !=
 			(pset->infos[i].flags & PTI_SPECIAL_PARTS))



CVS commit: src/usr.sbin/sysinst

2024-02-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 14 13:52:11 UTC 2024

Modified Files:
src/usr.sbin/sysinst: label.c

Log Message:
PR 57927: when comparing old and new partition state during renumbering,
ignore differences in the install target flag - the backend might have
flipped it off already to ensure only a single partition is marked
as install target.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/sysinst/label.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/dec

2024-02-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Feb 14 12:59:44 UTC 2024

Modified Files:
src/sys/dev/dec: lk201_ws.c lk201var.h

Log Message:
Use proper macro for return values and remove #if 0'ed out block.

Mostly from OpenBSD/vax. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dec/lk201_ws.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dec/lk201var.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/dec

2024-02-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Feb 14 12:59:44 UTC 2024

Modified Files:
src/sys/dev/dec: lk201_ws.c lk201var.h

Log Message:
Use proper macro for return values and remove #if 0'ed out block.

Mostly from OpenBSD/vax. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dec/lk201_ws.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dec/lk201var.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/dec/lk201_ws.c
diff -u src/sys/dev/dec/lk201_ws.c:1.10 src/sys/dev/dec/lk201_ws.c:1.11
--- src/sys/dev/dec/lk201_ws.c:1.10	Mon Jul 11 10:55:35 2016
+++ src/sys/dev/dec/lk201_ws.c	Wed Feb 14 12:59:44 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: lk201_ws.c,v 1.10 2016/07/11 10:55:35 skrll Exp $ */
+/* $NetBSD: lk201_ws.c,v 1.11 2024/02/14 12:59:44 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lk201_ws.c,v 1.10 2016/07/11 10:55:35 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lk201_ws.c,v 1.11 2024/02/14 12:59:44 tsutsui Exp $");
 
 #include 
 #include 
@@ -133,17 +133,10 @@ lk201_decode(struct lk201_state *lks, in
 	}
 
 	switch (datain) {
-#if 0
-	case LK_KEY_UP:
-		for (i = 0; i < LK_KLL; i++)
-			lks->down_keys_list[i] = -1;
-		*type = WSCONS_EVENT_ALL_KEYS_UP;
-		return (1);
-#endif
 	case LK_POWER_UP:
 		printf("lk201_decode: powerup detected\n");
 		lk201_init(lks);
-		return (0);
+		return LKD_NODATA;
 	case LK_KDOWN_ERROR:
 	case LK_POWER_ERROR:
 	case LK_OUTPUT_ERROR:
@@ -152,7 +145,7 @@ lk201_decode(struct lk201_state *lks, in
 		/* FALLTHRU */
 	case LK_KEY_REPEAT: /* autorepeat handled by wskbd */
 	case LK_MODE_CHANGE: /* ignore silently */
-		return (0);
+		return LKD_NODATA;
 	}
 
 
@@ -164,18 +157,18 @@ lk201_decode(struct lk201_state *lks, in
 	*dataout = lks->down_keys_list[i] -
 	MIN_LK201_KEY;
 	lks->down_keys_list[i] = -1;
-	return (LKD_MORE);
+	return LKD_MORE;
 }
-			return (LKD_NODATA);
+			return LKD_NODATA;
 		} else {
 			for (i = 0; i < LK_KLL; i++)
 lks->down_keys_list[i] = -1;
 			*type = WSCONS_EVENT_ALL_KEYS_UP;
-			return (LKD_COMPLETE);
+			return LKD_COMPLETE;
 		}
 	} else if (datain < MIN_LK201_KEY || datain > MAX_LK201_KEY) {
 		printf("lk201_decode: %x\n", datain);
-		return (0);
+		return LKD_NODATA;
 	}
 
 	*dataout = datain - MIN_LK201_KEY;
@@ -185,7 +178,7 @@ lk201_decode(struct lk201_state *lks, in
 		if (lks->down_keys_list[i] == datain) {
 			*type = WSCONS_EVENT_KEY_UP;
 			lks->down_keys_list[i] = -1;
-			return (1);
+			return LKD_COMPLETE;
 		}
 		if (lks->down_keys_list[i] == -1 && freeslot == -1)
 			freeslot = i;
@@ -193,12 +186,12 @@ lk201_decode(struct lk201_state *lks, in
 
 	if (freeslot == -1) {
 		printf("lk201_decode: down(%d) no free slot\n", datain);
-		return (0);
+		return LKD_NODATA;
 	}
 
 	*type = WSCONS_EVENT_KEY_DOWN;
 	lks->down_keys_list[freeslot] = datain;
-	return (1);
+	return LKD_COMPLETE;
 }
 
 void

Index: src/sys/dev/dec/lk201var.h
diff -u src/sys/dev/dec/lk201var.h:1.7 src/sys/dev/dec/lk201var.h:1.8
--- src/sys/dev/dec/lk201var.h:1.7	Fri Jan  2 21:32:26 2015
+++ src/sys/dev/dec/lk201var.h	Wed Feb 14 12:59:44 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: lk201var.h,v 1.7 2015/01/02 21:32:26 jklos Exp $ */
+/* $NetBSD: lk201var.h,v 1.8 2024/02/14 12:59:44 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -54,7 +54,7 @@ void lk201_bell(struct lk201_state *, st
 void lk201_set_leds(struct lk201_state *, int);
 void lk201_set_keyclick(struct lk201_state *, int);
 
+/* Values returned by lk201_decode */
 #define LKD_NODATA	0x00
 #define LKD_COMPLETE	0x01
 #define LKD_MORE	0x02
-



CVS commit: src/sys/dev/dec

2024-02-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Feb 14 12:49:47 UTC 2024

Modified Files:
src/sys/dev/dec: dzkbd.c

Log Message:
Fix a fatal typo that causes dzkbd_cngetc() to stall.

Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dec/dzkbd.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/dec

2024-02-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Feb 14 12:49:47 UTC 2024

Modified Files:
src/sys/dev/dec: dzkbd.c

Log Message:
Fix a fatal typo that causes dzkbd_cngetc() to stall.

Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dec/dzkbd.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/dec/dzkbd.c
diff -u src/sys/dev/dec/dzkbd.c:1.31 src/sys/dev/dec/dzkbd.c:1.32
--- src/sys/dev/dec/dzkbd.c:1.31	Fri Feb  2 15:44:43 2024
+++ src/sys/dev/dec/dzkbd.c	Wed Feb 14 12:49:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: dzkbd.c,v 1.31 2024/02/02 15:44:43 tsutsui Exp $	*/
+/*	$NetBSD: dzkbd.c,v 1.32 2024/02/14 12:49:47 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dzkbd.c,v 1.31 2024/02/02 15:44:43 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dzkbd.c,v 1.32 2024/02/14 12:49:47 tsutsui Exp $");
 
 #include 
 #include 
@@ -237,7 +237,7 @@ dzkbd_cngetc(void *v, u_int *type, int *
 
 	do {
 		c = dzgetc(dzi->dzi_ls);
-	} while (!lk201_decode(>dzi_ks, 0, c, type, data) == LKD_NODATA);
+	} while (lk201_decode(>dzi_ks, 0, c, type, data) == LKD_NODATA);
 }
 
 static void