CVS commit: src/sys/dev/pci

2022-05-18 Thread Brian Buhrow
Module Name:src
Committed By:   buhrow
Date:   Thu May 19 04:43:43 UTC 2022

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

Log Message:
For chips which contain an ASF/IPMI firmware, instruct the chip to shut the 
host ASF firmware
down when attaching the device so the IPMI BMC can use the same physical port 
even when NetBSD
doesn't have a network configuration on the device.  By contrast, when the 
device gets a
network configuration assigned to it and bge_init() is called, the host ASF 
firmware is brought
up so both NetBSD and the IPMI BMc can use the same
physical port.

This now matches FreeBSD behavior, as well as  behavior from NetBSD-5.2.

Tested on a Sunfire X2200-M2 system with the following chip:

bge1 at pci7 dev 4 function 1: Broadcom BCM5715 Gigabit Ethernet
bge1: interrupting at ioapic0 pin 11
bge1: HW config 00d4, 0014, ,  
bge1: ASIC BCM5715 A3 (0x9003), Ethernet address 00:1e:68:XX:XX:XX
bge1: setting short Tx thresholds
brgphy1 at bge1 phy 1: BCM5714 1000BASE-T/X media interface, rev. 0
brgphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 
1000baseT-FDX, auto


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 src/sys/dev/pci/if_bge.c

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.352 src/sys/dev/pci/if_bge.c:1.353
--- src/sys/dev/pci/if_bge.c:1.352	Thu Apr  7 19:33:38 2022
+++ src/sys/dev/pci/if_bge.c	Thu May 19 04:43:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.352 2022/04/07 19:33:38 andvar Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.353 2022/05/19 04:43:43 buhrow Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.352 2022/04/07 19:33:38 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.353 2022/05/19 04:43:43 buhrow Exp $");
 
 #include 
 #include 
@@ -3640,7 +3640,7 @@ bge_attach(device_t parent, device_t sel
 	BGE_SETBIT_FLUSH(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM);
 
 	bge_stop_fw(sc);
-	bge_sig_pre_reset(sc, BGE_RESET_START);
+	bge_sig_pre_reset(sc, BGE_RESET_SHUTDOWN);
 	if (bge_reset(sc))
 		aprint_error_dev(sc->bge_dev, "chip reset failed\n");
 
@@ -3674,8 +3674,8 @@ bge_attach(device_t parent, device_t sel
 	"HW config %08x, %08x, %08x, %08x %08x\n",
 	hwcfg, hwcfg2, hwcfg3, hwcfg4, hwcfg5);
 
-	bge_sig_legacy(sc, BGE_RESET_START);
-	bge_sig_post_reset(sc, BGE_RESET_START);
+	bge_sig_legacy(sc, BGE_RESET_SHUTDOWN);
+	bge_sig_post_reset(sc, BGE_RESET_SHUTDOWN);
 
 	if (bge_chipinit(sc)) {
 		aprint_error_dev(sc->bge_dev, "chip initialization failed\n");



CVS commit: src/sys/dev/pci

2022-05-18 Thread Brian Buhrow
Module Name:src
Committed By:   buhrow
Date:   Thu May 19 04:43:43 UTC 2022

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

Log Message:
For chips which contain an ASF/IPMI firmware, instruct the chip to shut the 
host ASF firmware
down when attaching the device so the IPMI BMC can use the same physical port 
even when NetBSD
doesn't have a network configuration on the device.  By contrast, when the 
device gets a
network configuration assigned to it and bge_init() is called, the host ASF 
firmware is brought
up so both NetBSD and the IPMI BMc can use the same
physical port.

This now matches FreeBSD behavior, as well as  behavior from NetBSD-5.2.

Tested on a Sunfire X2200-M2 system with the following chip:

bge1 at pci7 dev 4 function 1: Broadcom BCM5715 Gigabit Ethernet
bge1: interrupting at ioapic0 pin 11
bge1: HW config 00d4, 0014, ,  
bge1: ASIC BCM5715 A3 (0x9003), Ethernet address 00:1e:68:XX:XX:XX
bge1: setting short Tx thresholds
brgphy1 at bge1 phy 1: BCM5714 1000BASE-T/X media interface, rev. 0
brgphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 
1000baseT-FDX, auto


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 src/sys/dev/pci/if_bge.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/makemandb

2022-05-18 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Thu May 19 04:08:03 UTC 2022

Modified Files:
src/usr.sbin/makemandb: apropos-utils.c apropos.c

Log Message:
apropos(1): improve error handling in edge cases

Patch from RVP on NetBSD-Users, with an additional comment tweak by me.
Summary from RVP:

1. Ignore SIGPIPE so that we're not killed in the middle of some
   DB operation by a botched $PAGER:

$ env PAGER=/non-existent apropos -p ...

2. Return proper exit status in case of write errors:

$ apropos ... >/dev/full || echo fail


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/makemandb/apropos-utils.c
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/makemandb/apropos.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/makemandb/apropos-utils.c
diff -u src/usr.sbin/makemandb/apropos-utils.c:1.48 src/usr.sbin/makemandb/apropos-utils.c:1.49
--- src/usr.sbin/makemandb/apropos-utils.c:1.48	Sat Nov 27 22:30:25 2021
+++ src/usr.sbin/makemandb/apropos-utils.c	Thu May 19 04:08:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: apropos-utils.c,v 1.48 2021/11/27 22:30:25 rillig Exp $	*/
+/*	$NetBSD: apropos-utils.c,v 1.49 2022/05/19 04:08:03 gutteridge Exp $	*/
 /*-
  * Copyright (c) 2011 Abhinav Upadhyay 
  * All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: apropos-utils.c,v 1.48 2021/11/27 22:30:25 rillig Exp $");
+__RCSID("$NetBSD: apropos-utils.c,v 1.49 2022/05/19 04:08:03 gutteridge Exp $");
 
 #include 
 #include 
@@ -665,7 +665,7 @@ get_stmt_col_text(sqlite3_stmt *stmt, in
  * Execute the full text search query and return the number of results
  * obtained.
  */
-static unsigned int
+static int
 execute_search_query(sqlite3 *db, char *query, query_args *args)
 {
 	sqlite3_stmt *stmt;
@@ -699,8 +699,8 @@ execute_search_query(sqlite3 *db, char *
 		return -1;
 	}
 
-	unsigned int nresults = 0;
-	while (sqlite3_step(stmt) == SQLITE_ROW) {
+	int nresults = rc = 0;
+	while (rc == 0 && sqlite3_step(stmt) == SQLITE_ROW) {
 		nresults++;
 		callback_args.section = get_stmt_col_text(stmt, 0);
 		name_temp = get_stmt_col_text(stmt, 1);
@@ -725,11 +725,11 @@ execute_search_query(sqlite3 *db, char *
 		}
 		callback_args.name = name;
 		callback_args.other_data = args->callback_data;
-		(args->callback)(_args);
+		rc = (args->callback)(_args);
 		free(name);
 	}
 	sqlite3_finalize(stmt);
-	return nresults;
+	return (rc < 0) ? rc : nresults;
 }
 
 
@@ -752,9 +752,9 @@ run_query_internal(sqlite3 *db, const ch
 		return -1;
 	}
 
-	execute_search_query(db, query, args);
+	int rc = execute_search_query(db, query, args);
 	sqlite3_free(query);
-	return *(args->errmsg) == NULL ? 0 : -1;
+	return (rc < 0 || *(args->errmsg) != NULL) ? -1 : 0;
 }
 
 static char *
@@ -845,10 +845,10 @@ callback_html(query_callback_args *callb
 	callback_args->snippet = qsnippet;
 	callback_args->snippet_length = length;
 	callback_args->other_data = orig_data->data;
-	(*callback)(callback_args);
+	int rc = (*callback)(callback_args);
 	free(qsnippet);
 	free(qname_description);
-	return 0;
+	return rc;
 }
 
 /*
@@ -968,12 +968,12 @@ callback_pager(query_callback_args *call
 	callback_args->snippet = psnippet;
 	callback_args->snippet_length = psnippet_length;
 	callback_args->other_data = orig_data->data;
-	(orig_data->callback)(callback_args);
+	int rc = (orig_data->callback)(callback_args);
 	free(ul_section);
 	free(ul_name);
 	free(ul_name_desc);
 	free(psnippet);
-	return 0;
+	return rc;
 }
 
 struct term_args {
@@ -1013,11 +1013,11 @@ callback_term(query_callback_args *callb
 	callback_args->name = ul_name;
 	callback_args->name_desc = ul_name_desc;
 	callback_args->other_data = orig_data->data;
-	(orig_data->callback)(callback_args);
+	int rc = (orig_data->callback)(callback_args);
 	free(ul_section);
 	free(ul_name);
 	free(ul_name_desc);
-	return 0;
+	return rc;
 }
 
 /*

Index: src/usr.sbin/makemandb/apropos.c
diff -u src/usr.sbin/makemandb/apropos.c:1.25 src/usr.sbin/makemandb/apropos.c:1.26
--- src/usr.sbin/makemandb/apropos.c:1.25	Tue May 17 00:21:22 2022
+++ src/usr.sbin/makemandb/apropos.c	Thu May 19 04:08:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: apropos.c,v 1.25 2022/05/17 00:21:22 gutteridge Exp $	*/
+/*	$NetBSD: apropos.c,v 1.26 2022/05/19 04:08:03 gutteridge Exp $	*/
 /*-
  * Copyright (c) 2011 Abhinav Upadhyay 
  * All rights reserved.
@@ -31,9 +31,10 @@
  */
 
 #include 
-__RCSID("$NetBSD: apropos.c,v 1.25 2022/05/17 00:21:22 gutteridge Exp $");
+__RCSID("$NetBSD: apropos.c,v 1.26 2022/05/19 04:08:03 gutteridge Exp $");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -223,6 +224,10 @@ main(int argc, char *argv[])
 		const char *pager = getenv("PAGER");
 		if (pager == NULL)
 			pager = _PATH_PAGER;
+
+		/* Don't get killed by a broken pipe */
+		signal(SIGPIPE, SIG_IGN);
+
 		/* Open a pipe to the pager */
 		if ((cbdata.out = popen(pager, "w")) == NULL) {
 			

CVS commit: src/usr.sbin/makemandb

2022-05-18 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Thu May 19 04:08:03 UTC 2022

Modified Files:
src/usr.sbin/makemandb: apropos-utils.c apropos.c

Log Message:
apropos(1): improve error handling in edge cases

Patch from RVP on NetBSD-Users, with an additional comment tweak by me.
Summary from RVP:

1. Ignore SIGPIPE so that we're not killed in the middle of some
   DB operation by a botched $PAGER:

$ env PAGER=/non-existent apropos -p ...

2. Return proper exit status in case of write errors:

$ apropos ... >/dev/full || echo fail


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/makemandb/apropos-utils.c
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/makemandb/apropos.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/usb

2022-05-18 Thread Charlotte Koch
Module Name:src
Committed By:   charlotte
Date:   Thu May 19 03:58:13 UTC 2022

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Regen for real


To generate a diff of this commit:
cvs rdiff -u -r1.794 -r1.795 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.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/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.794 src/sys/dev/usb/usbdevs.h:1.795
--- src/sys/dev/usb/usbdevs.h:1.794	Thu May 19 03:42:51 2022
+++ src/sys/dev/usb/usbdevs.h	Thu May 19 03:58:13 2022
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.794 2022/05/19 03:42:51 charlotte Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.795 2022/05/19 03:58:13 charlotte Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.802 2022/05/10 15:28:45 mlelstv Exp
+ *	NetBSD: usbdevs,v 1.803 2022/05/19 03:42:12 charlotte Exp
  */
 
 /*-
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.794 src/sys/dev/usb/usbdevs_data.h:1.795
--- src/sys/dev/usb/usbdevs_data.h:1.794	Thu May 19 03:42:51 2022
+++ src/sys/dev/usb/usbdevs_data.h	Thu May 19 03:58:13 2022
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.794 2022/05/19 03:42:51 charlotte Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.795 2022/05/19 03:58:13 charlotte Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.802 2022/05/10 15:28:45 mlelstv Exp
+ *	NetBSD: usbdevs,v 1.803 2022/05/19 03:42:12 charlotte Exp
  */
 
 /*-



CVS commit: src/sys/dev/usb

2022-05-18 Thread Charlotte Koch
Module Name:src
Committed By:   charlotte
Date:   Thu May 19 03:58:13 UTC 2022

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Regen for real


To generate a diff of this commit:
cvs rdiff -u -r1.794 -r1.795 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.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/usb

2022-05-18 Thread Charlotte Koch
Module Name:src
Committed By:   charlotte
Date:   Thu May 19 03:42:51 UTC 2022

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.793 -r1.794 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.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/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.793 src/sys/dev/usb/usbdevs.h:1.794
--- src/sys/dev/usb/usbdevs.h:1.793	Tue May 10 15:29:04 2022
+++ src/sys/dev/usb/usbdevs.h	Thu May 19 03:42:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdevs.h,v 1.793 2022/05/10 15:29:04 mlelstv Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.794 2022/05/19 03:42:51 charlotte Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -2363,6 +2363,7 @@
 #define	USB_PRODUCT_MICROSOFT_XBOX_CONTROLLER_S10	0x0285		/* Xbox Controller S (1.0) */
 #define	USB_PRODUCT_MICROSOFT_XBOX_CONTROLLER_HUB	0x0288		/* Xbox Controller Hub */
 #define	USB_PRODUCT_MICROSOFT_XBOX_CONTROLLER_S12	0x0289		/* Xbox Controller S (1.2) */
+#define	USB_PRODUCT_MICROSOFT_XBOX_360_CONTROLLER	0x028e		/* Xbox 360 Controller */
 #define	USB_PRODUCT_MICROSOFT_XBOX_360_WIRELESS_RECEIVER	0x0291		/* Xbox 360 Wireless Receiver */
 #define	USB_PRODUCT_MICROSOFT_24GHZ_XCVR10	0x071d		/* 2.4GHz Transceiver V1.0 */
 #define	USB_PRODUCT_MICROSOFT_24GHZ_XCVR20	0x071f		/* 2.4GHz Transceiver V2.0 */
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.793 src/sys/dev/usb/usbdevs_data.h:1.794
--- src/sys/dev/usb/usbdevs_data.h:1.793	Tue May 10 15:29:04 2022
+++ src/sys/dev/usb/usbdevs_data.h	Thu May 19 03:42:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdevs_data.h,v 1.793 2022/05/10 15:29:04 mlelstv Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.794 2022/05/19 03:42:51 charlotte Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -3148,6 +3148,8 @@ static const uint32_t usb_products[] = {
 	14500, 5921, 5877, 0,
 	USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_XBOX_CONTROLLER_S12, 
 	14500, 5921, 13095, 14538, 0,
+	USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_XBOX_360_CONTROLLER, 
+	14500, 14544, 5921, 0,
 	USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_XBOX_360_WIRELESS_RECEIVER, 
 	14500, 14544, 651, 13631, 0,
 	USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_24GHZ_XCVR10, 
@@ -5845,7 +5847,7 @@ static const char usb_words[] = { "." 
 	"Multiple\0" /* 1 refs @ 5899 */
 	"Flash\0" /* 9 refs @ 5908 */
 	"Reader\0" /* 25 refs @ 5914 */
-	"Controller\0" /* 21 refs @ 5921 */
+	"Controller\0" /* 22 refs @ 5921 */
 	"MacAlly\0" /* 1 refs @ 5932 */
 	"AU9814\0" /* 1 refs @ 5940 */
 	"MicroConnectors/StrongMan\0" /* 1 refs @ 5947 */
@@ -6962,14 +6964,14 @@ static const char usb_words[] = { "." 
 	"NIC\0" /* 2 refs @ 14485 */
 	"Laser\0" /* 1 refs @ 14489 */
 	"6000\0" /* 3 refs @ 14495 */
-	"Xbox\0" /* 6 refs @ 14500 */
+	"Xbox\0" /* 7 refs @ 14500 */
 	"Memory\0" /* 4 refs @ 14505 */
 	"Unit\0" /* 1 refs @ 14512 */
 	"Movie\0" /* 1 refs @ 14517 */
 	"Playback\0" /* 1 refs @ 14523 */
 	"(1.0)\0" /* 1 refs @ 14532 */
 	"(1.2)\0" /* 1 refs @ 14538 */
-	"360\0" /* 1 refs @ 14544 */
+	"360\0" /* 2 refs @ 14544 */
 	"2.4GHz\0" /* 4 refs @ 14548 */
 	"Transceiver\0" /* 5 refs @ 14555 */
 	"V1.0\0" /* 1 refs @ 14567 */



CVS commit: src/sys/dev/usb

2022-05-18 Thread Charlotte Koch
Module Name:src
Committed By:   charlotte
Date:   Thu May 19 03:42:51 UTC 2022

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.793 -r1.794 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.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/usb

2022-05-18 Thread Charlotte Koch
Module Name:src
Committed By:   charlotte
Date:   Thu May 19 03:42:12 UTC 2022

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
usbdevs: Add Xbox 360 controller


To generate a diff of this commit:
cvs rdiff -u -r1.802 -r1.803 src/sys/dev/usb/usbdevs

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/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.802 src/sys/dev/usb/usbdevs:1.803
--- src/sys/dev/usb/usbdevs:1.802	Tue May 10 15:28:45 2022
+++ src/sys/dev/usb/usbdevs	Thu May 19 03:42:12 2022
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.802 2022/05/10 15:28:45 mlelstv Exp $
+$NetBSD: usbdevs,v 1.803 2022/05/19 03:42:12 charlotte Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -2356,6 +2356,7 @@ product MICROSOFT XBOX_DVD_PLAYBACK	0x02
 product MICROSOFT XBOX_CONTROLLER_S10	0x0285	Xbox Controller S (1.0)
 product MICROSOFT XBOX_CONTROLLER_HUB	0x0288	Xbox Controller Hub
 product MICROSOFT XBOX_CONTROLLER_S12	0x0289	Xbox Controller S (1.2)
+product MICROSOFT XBOX_360_CONTROLLER	0x028e	Xbox 360 Controller
 product MICROSOFT XBOX_360_WIRELESS_RECEIVER 0x0291 Xbox 360 Wireless Receiver
 product MICROSOFT 24GHZ_XCVR10		0x071d	2.4GHz Transceiver V1.0
 product MICROSOFT 24GHZ_XCVR20		0x071f	2.4GHz Transceiver V2.0



CVS commit: src/sys/dev/usb

2022-05-18 Thread Charlotte Koch
Module Name:src
Committed By:   charlotte
Date:   Thu May 19 03:42:12 UTC 2022

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
usbdevs: Add Xbox 360 controller


To generate a diff of this commit:
cvs rdiff -u -r1.802 -r1.803 src/sys/dev/usb/usbdevs

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



CVS commit: src/sys/dev/pci

2022-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 19 02:23:59 UTC 2022

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

Log Message:
Don't set the more flag when there is no packet to process.

 Move the location of the loop limit check next to the DD bit test. This
change prevent from scheduling the next txrx_work that does nothing.


To generate a diff of this commit:
cvs rdiff -u -r1.732 -r1.733 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.732 src/sys/dev/pci/if_wm.c:1.733
--- src/sys/dev/pci/if_wm.c:1.732	Thu May 19 02:22:59 2022
+++ src/sys/dev/pci/if_wm.c	Thu May 19 02:23:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.732 2022/05/19 02:22:59 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.733 2022/05/19 02:23:59 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.732 2022/05/19 02:22:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.733 2022/05/19 02:23:59 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -8968,14 +8968,6 @@ wm_txeof(struct wm_txqueue *txq, u_int l
 	 */
 	for (i = txq->txq_sdirty; txq->txq_sfree != WM_TXQUEUELEN(txq);
 	 i = WM_NEXTTXS(txq, i), txq->txq_sfree++) {
-		if (limit-- == 0) {
-			more = true;
-			DPRINTF(sc, WM_DEBUG_TX,
-			("%s: TX: loop limited, job %d is not processed\n",
-device_xname(sc->sc_dev), i));
-			break;
-		}
-
 		txs = >txq_soft[i];
 
 		DPRINTF(sc, WM_DEBUG_TX, ("%s: TX: checking job %d\n",
@@ -8992,6 +8984,14 @@ wm_txeof(struct wm_txqueue *txq, u_int l
 			break;
 		}
 
+		if (limit-- == 0) {
+			more = true;
+			DPRINTF(sc, WM_DEBUG_TX,
+			("%s: TX: loop limited, job %d is not processed\n",
+device_xname(sc->sc_dev), i));
+			break;
+		}
+
 		count++;
 		DPRINTF(sc, WM_DEBUG_TX,
 		("%s: TX: job %d done: descs %d..%d\n",
@@ -9297,14 +9297,6 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 	KASSERT(mutex_owned(rxq->rxq_lock));
 
 	for (i = rxq->rxq_ptr;; i = WM_NEXTRX(i)) {
-		if (limit-- == 0) {
-			more = true;
-			DPRINTF(sc, WM_DEBUG_RX,
-			("%s: RX: loop limited, descriptor %d is not processed\n",
-device_xname(sc->sc_dev), i));
-			break;
-		}
-
 		rxs = >rxq_soft[i];
 
 		DPRINTF(sc, WM_DEBUG_RX,
@@ -9326,6 +9318,14 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 			break;
 		}
 
+		if (limit-- == 0) {
+			more = true;
+			DPRINTF(sc, WM_DEBUG_RX,
+			("%s: RX: loop limited, descriptor %d is not processed\n",
+device_xname(sc->sc_dev), i));
+			break;
+		}
+
 		count++;
 		if (__predict_false(rxq->rxq_discard)) {
 			DPRINTF(sc, WM_DEBUG_RX,



CVS commit: src/sys/dev/pci

2022-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 19 02:23:59 UTC 2022

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

Log Message:
Don't set the more flag when there is no packet to process.

 Move the location of the loop limit check next to the DD bit test. This
change prevent from scheduling the next txrx_work that does nothing.


To generate a diff of this commit:
cvs rdiff -u -r1.732 -r1.733 src/sys/dev/pci/if_wm.c

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



CVS commit: src/sys/dev/pci

2022-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 19 02:22:59 UTC 2022

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

Log Message:
Call wm_xxeof() only when limit > 0.

 It's not required to call wm_xxeof() when limit == 0. It means that
all xxeof processing will be done by softint or workqueue. Currently,
wm_xxeof() returns quickly before checking the descriptor head when
limit == 0 and return with ture to set the more flag.


To generate a diff of this commit:
cvs rdiff -u -r1.731 -r1.732 src/sys/dev/pci/if_wm.c

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



CVS commit: src/sys/dev/pci

2022-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 19 02:22:59 UTC 2022

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

Log Message:
Call wm_xxeof() only when limit > 0.

 It's not required to call wm_xxeof() when limit == 0. It means that
all xxeof processing will be done by softint or workqueue. Currently,
wm_xxeof() returns quickly before checking the descriptor head when
limit == 0 and return with ture to set the more flag.


To generate a diff of this commit:
cvs rdiff -u -r1.731 -r1.732 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.731 src/sys/dev/pci/if_wm.c:1.732
--- src/sys/dev/pci/if_wm.c:1.731	Tue May 17 00:02:57 2022
+++ src/sys/dev/pci/if_wm.c	Thu May 19 02:22:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.731 2022/05/17 00:02:57 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.732 2022/05/19 02:22:59 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.731 2022/05/17 00:02:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.732 2022/05/19 02:22:59 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9958,14 +9958,18 @@ wm_intr_legacy(void *arg)
 		WM_Q_EVCNT_INCR(rxq, intr);
 	}
 #endif
-	/*
-	 * wm_rxeof() does *not* call upper layer functions directly,
-	 * as if_percpuq_enqueue() just call softint_schedule().
-	 * So, we can call wm_rxeof() in interrupt context.
-	 */
-	more = wm_rxeof(rxq, rxlimit);
+	if (rxlimit > 0) {
+		/*
+		 * wm_rxeof() does *not* call upper layer functions directly,
+		 * as if_percpuq_enqueue() just call softint_schedule().
+		 * So, we can call wm_rxeof() in interrupt context.
+		 */
+		more = wm_rxeof(rxq, rxlimit);
+	} else
+		more = true;
 
 	mutex_exit(rxq->rxq_lock);
+
 	mutex_enter(txq->txq_lock);
 
 	if (txq->txq_stopping) {
@@ -9981,10 +9985,12 @@ wm_intr_legacy(void *arg)
 		WM_Q_EVCNT_INCR(txq, txdw);
 	}
 #endif
-	more |= wm_txeof(txq, txlimit);
-	if (!IF_IS_EMPTY(>if_snd))
+	if (txlimit > 0) {
+		more |= wm_txeof(txq, txlimit);
+		if (!IF_IS_EMPTY(>if_snd))
+			more = true;
+	} else
 		more = true;
-
 	mutex_exit(txq->txq_lock);
 	WM_CORE_LOCK(sc);
 
@@ -10096,8 +10102,11 @@ wm_txrxintr_msix(void *arg)
 	}
 
 	WM_Q_EVCNT_INCR(txq, txdw);
-	txmore = wm_txeof(txq, txlimit);
-	/* wm_deferred start() is done in wm_handle_queue(). */
+	if (txlimit > 0) {
+		txmore = wm_txeof(txq, txlimit);
+		/* wm_deferred start() is done in wm_handle_queue(). */
+	} else
+		txmore = true;
 	mutex_exit(txq->txq_lock);
 
 	DPRINTF(sc, WM_DEBUG_RX,
@@ -10110,7 +10119,10 @@ wm_txrxintr_msix(void *arg)
 	}
 
 	WM_Q_EVCNT_INCR(rxq, intr);
-	rxmore = wm_rxeof(rxq, rxlimit);
+	if (rxlimit > 0) {
+		rxmore = wm_rxeof(rxq, rxlimit);
+	} else
+		rxmore = true;
 	mutex_exit(rxq->rxq_lock);
 
 	wm_itrs_writereg(sc, wmq);



CVS commit: src/games/gomoku

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 22:35:13 UTC 2022

Modified Files:
src/games/gomoku: bdinit.c

Log Message:
gomoku: reduce scope of local variables

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/games/gomoku/bdinit.c

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

Modified files:

Index: src/games/gomoku/bdinit.c
diff -u src/games/gomoku/bdinit.c:1.15 src/games/gomoku/bdinit.c:1.16
--- src/games/gomoku/bdinit.c:1.15	Wed May 18 22:30:19 2022
+++ src/games/gomoku/bdinit.c	Wed May 18 22:35:13 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bdinit.c,v 1.15 2022/05/18 22:30:19 rillig Exp $	*/
+/*	$NetBSD: bdinit.c,v 1.16 2022/05/18 22:35:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)bdinit.c	8.2 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: bdinit.c,v 1.15 2022/05/18 22:30:19 rillig Exp $");
+__RCSID("$NetBSD: bdinit.c,v 1.16 2022/05/18 22:35:13 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -126,7 +126,7 @@ bdinit(struct spotstr *bp)
 }
 			}
 			/*
-			 * Allocate a frame structure for non blocked frames.
+			 * Allocate a frame structure for non-blocked frames.
 			 */
 			for (int r = 4; --r >= 0; ) {
 if ((sp->s_flags & (BFLAG << r)) != 0)
@@ -158,7 +158,7 @@ bdinit(struct spotstr *bp)
  * Initialize the overlap array.
  * Each entry in the array is a bit mask with eight bits corresponding
  * to whether frame B overlaps frame A (as indexed by overlap[A * FAREA + B]).
- * The eight bits coorespond to whether A and B are open ended (length 6) or
+ * The eight bits correspond to whether A and B are open-ended (length 6) or
  * closed (length 5).
  *	0	A closed and B closed
  *	1	A closed and B open
@@ -174,45 +174,40 @@ bdinit(struct spotstr *bp)
 static void
 init_overlap(void)
 {
-	struct spotstr *sp1, *sp2;
-	struct combostr *cbp;
-	int n, d1, d2;
-	int mask, bmask, vertex, s;
-	u_char *op;
-	short *ip;
 
 	memset(overlap, 0, sizeof(overlap));
 	memset(intersect, 0, sizeof(intersect));
-	op = [FAREA * FAREA];
-	ip = [FAREA * FAREA];
+	u_char *op = [FAREA * FAREA];
+	short *ip = [FAREA * FAREA];
+
 	for (unsigned fi = FAREA; fi-- > 0; ) {	/* each frame */
-	cbp = [fi];
+	struct combostr *cbp = [fi];
 	op -= FAREA;
 	ip -= FAREA;
-	sp1 = [vertex = cbp->c_vertex];
-	d1 = dd[cbp->c_dir];
+	int vertex = cbp->c_vertex;
+	struct spotstr *sp1 = [vertex];
+	int d1 = dd[cbp->c_dir];
 	/*
 	 * s = 5 if closed, 6 if open.
 	 * At this point black & white are the same.
 	 */
-	s = 5 + sp1->s_fval[BLACK][cbp->c_dir].c.b;
+	int s = 5 + sp1->s_fval[BLACK][cbp->c_dir].c.b;
 	/* for each spot in frame A */
 	for (int i = 0; i < s; i++, sp1 += d1, vertex += d1) {
 		/* the sixth spot in frame A only overlaps if it is open */
-		mask = (i == 5) ? 0xC : 0xF;
+		int mask = (i == 5) ? 0xC : 0xF;
 		/* for each direction */
 		for (int r = 4; --r >= 0; ) {
-		bmask = BFLAG << r;
-		sp2 = sp1;
-		d2 = dd[r];
+		struct spotstr *sp2 = sp1;
+		int d2 = dd[r];
 		/* for each frame that intersects at spot sp1 */
 		for (int f = 0; f < 6; f++, sp2 -= d2) {
 			if (sp2->s_occ == BORDER)
 			break;
-			if ((sp2->s_flags & bmask) != 0)
+			if ((sp2->s_flags & BFLAG << r) != 0)
 			continue;
-			n = (int)(sp2->s_frame[r] - frames);
-			ip[n] = vertex;
+			int n = (int)(sp2->s_frame[r] - frames);
+			ip[n] = (short)vertex;
 			op[n] |= (f == 5) ? mask & 0xA : mask;
 			if (r == cbp->c_dir) {
 			/* compute the multiple spot overlap values */



CVS commit: src/games/gomoku

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 22:35:13 UTC 2022

Modified Files:
src/games/gomoku: bdinit.c

Log Message:
gomoku: reduce scope of local variables

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/games/gomoku/bdinit.c

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



CVS commit: src/games/gomoku

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 22:30:19 UTC 2022

Modified Files:
src/games/gomoku: bdinit.c bdisp.c makemove.c pickmove.c stoc.c

Log Message:
gomoku: reduce scope of 'for' loop variables

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/games/gomoku/bdinit.c
cvs rdiff -u -r1.27 -r1.28 src/games/gomoku/bdisp.c
cvs rdiff -u -r1.16 -r1.17 src/games/gomoku/makemove.c \
src/games/gomoku/stoc.c
cvs rdiff -u -r1.33 -r1.34 src/games/gomoku/pickmove.c

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

Modified files:

Index: src/games/gomoku/bdinit.c
diff -u src/games/gomoku/bdinit.c:1.14 src/games/gomoku/bdinit.c:1.15
--- src/games/gomoku/bdinit.c:1.14	Wed May 18 21:45:40 2022
+++ src/games/gomoku/bdinit.c	Wed May 18 22:30:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bdinit.c,v 1.14 2022/05/18 21:45:40 rillig Exp $	*/
+/*	$NetBSD: bdinit.c,v 1.15 2022/05/18 22:30:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)bdinit.c	8.2 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: bdinit.c,v 1.14 2022/05/18 21:45:40 rillig Exp $");
+__RCSID("$NetBSD: bdinit.c,v 1.15 2022/05/18 22:30:19 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -49,7 +49,6 @@ static void init_overlap(void);
 void
 bdinit(struct spotstr *bp)
 {
-	int i, j, r;
 	struct spotstr *sp;
 	struct combostr *cbp;
 
@@ -57,7 +56,7 @@ bdinit(struct spotstr *bp)
 
 	/* mark the borders as such */
 	sp = bp;
-	for (i = 1 + BSZ + 1; --i >= 0; sp++) {
+	for (int i = 1 + BSZ + 1; --i >= 0; sp++) {
 		sp->s_occ = BORDER;			/* top border */
 		sp->s_flags = BFLAGALL;
 	}
@@ -65,8 +64,8 @@ bdinit(struct spotstr *bp)
 	/* fill entire board with EMPTY spots */
 	memset(frames, 0, sizeof(frames));
 	cbp = frames;
-	for (j = 0; ++j < BSZ + 1; sp++) {		/* for each row */
-		for (i = 0; ++i < BSZ + 1; sp++) {	/* for each column */
+	for (int j = 0; ++j < BSZ + 1; sp++) {		/* for each row */
+		for (int i = 0; ++i < BSZ + 1; sp++) {	/* for each column */
 			sp->s_occ = EMPTY;
 			sp->s_flags = 0;
 			sp->s_wval = 0;
@@ -129,7 +128,7 @@ bdinit(struct spotstr *bp)
 			/*
 			 * Allocate a frame structure for non blocked frames.
 			 */
-			for (r = 4; --r >= 0; ) {
+			for (int r = 4; --r >= 0; ) {
 if ((sp->s_flags & (BFLAG << r)) != 0)
 	continue;
 cbp->c_combo.s = sp->s_fval[BLACK][r].s;
@@ -145,7 +144,7 @@ bdinit(struct spotstr *bp)
 	}
 
 	/* mark the borders as such */
-	for (i = BSZ + 1; --i >= 0; sp++) {
+	for (int i = BSZ + 1; --i >= 0; sp++) {
 		sp->s_occ = BORDER;			/* bottom border */
 		sp->s_flags = BFLAGALL;
 	}
@@ -177,8 +176,7 @@ init_overlap(void)
 {
 	struct spotstr *sp1, *sp2;
 	struct combostr *cbp;
-	unsigned frameix;
-	int i, f, r, n, d1, d2;
+	int n, d1, d2;
 	int mask, bmask, vertex, s;
 	u_char *op;
 	short *ip;
@@ -187,28 +185,28 @@ init_overlap(void)
 	memset(intersect, 0, sizeof(intersect));
 	op = [FAREA * FAREA];
 	ip = [FAREA * FAREA];
-	for (frameix = FAREA; frameix-- > 0; ) {	/* each frame */
-	cbp = [frameix];
+	for (unsigned fi = FAREA; fi-- > 0; ) {	/* each frame */
+	cbp = [fi];
 	op -= FAREA;
 	ip -= FAREA;
 	sp1 = [vertex = cbp->c_vertex];
-	d1 = dd[r = cbp->c_dir];
+	d1 = dd[cbp->c_dir];
 	/*
 	 * s = 5 if closed, 6 if open.
 	 * At this point black & white are the same.
 	 */
-	s = 5 + sp1->s_fval[BLACK][r].c.b;
+	s = 5 + sp1->s_fval[BLACK][cbp->c_dir].c.b;
 	/* for each spot in frame A */
-	for (i = 0; i < s; i++, sp1 += d1, vertex += d1) {
+	for (int i = 0; i < s; i++, sp1 += d1, vertex += d1) {
 		/* the sixth spot in frame A only overlaps if it is open */
 		mask = (i == 5) ? 0xC : 0xF;
 		/* for each direction */
-		for (r = 4; --r >= 0; ) {
+		for (int r = 4; --r >= 0; ) {
 		bmask = BFLAG << r;
 		sp2 = sp1;
 		d2 = dd[r];
 		/* for each frame that intersects at spot sp1 */
-		for (f = 0; f < 6; f++, sp2 -= d2) {
+		for (int f = 0; f < 6; f++, sp2 -= d2) {
 			if (sp2->s_occ == BORDER)
 			break;
 			if ((sp2->s_flags & bmask) != 0)

Index: src/games/gomoku/bdisp.c
diff -u src/games/gomoku/bdisp.c:1.27 src/games/gomoku/bdisp.c:1.28
--- src/games/gomoku/bdisp.c:1.27	Mon May 16 22:03:16 2022
+++ src/games/gomoku/bdisp.c	Wed May 18 22:30:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bdisp.c,v 1.27 2022/05/16 22:03:16 rillig Exp $	*/
+/*	$NetBSD: bdisp.c,v 1.28 2022/05/18 22:30:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)bdisp.c	8.2 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: bdisp.c,v 1.27 2022/05/16 22:03:16 rillig Exp $");
+__RCSID("$NetBSD: bdisp.c,v 1.28 2022/05/18 22:30:19 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -98,22 +98,21 @@ cursfini(void)
 void
 bdisp_init(void)
 {
-	int i, j;
 
 	/* top border */
-	for (i = 1; i < BSZ + 1; i++) {
+	for (int i = 1; i < BSZ + 

CVS commit: src/games/gomoku

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 22:30:19 UTC 2022

Modified Files:
src/games/gomoku: bdinit.c bdisp.c makemove.c pickmove.c stoc.c

Log Message:
gomoku: reduce scope of 'for' loop variables

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/games/gomoku/bdinit.c
cvs rdiff -u -r1.27 -r1.28 src/games/gomoku/bdisp.c
cvs rdiff -u -r1.16 -r1.17 src/games/gomoku/makemove.c \
src/games/gomoku/stoc.c
cvs rdiff -u -r1.33 -r1.34 src/games/gomoku/pickmove.c

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



CVS commit: src/games/gomoku

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 21:45:40 UTC 2022

Modified Files:
src/games/gomoku: bdinit.c

Log Message:
gomoku: rename local variable

Not every array of "characters" is a string.  In this case, it's rather
an array of bool.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/games/gomoku/bdinit.c

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

Modified files:

Index: src/games/gomoku/bdinit.c
diff -u src/games/gomoku/bdinit.c:1.13 src/games/gomoku/bdinit.c:1.14
--- src/games/gomoku/bdinit.c:1.13	Mon May 16 20:57:01 2022
+++ src/games/gomoku/bdinit.c	Wed May 18 21:45:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bdinit.c,v 1.13 2022/05/16 20:57:01 rillig Exp $	*/
+/*	$NetBSD: bdinit.c,v 1.14 2022/05/18 21:45:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)bdinit.c	8.2 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: bdinit.c,v 1.13 2022/05/16 20:57:01 rillig Exp $");
+__RCSID("$NetBSD: bdinit.c,v 1.14 2022/05/18 21:45:40 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -180,16 +180,16 @@ init_overlap(void)
 	unsigned frameix;
 	int i, f, r, n, d1, d2;
 	int mask, bmask, vertex, s;
-	u_char *str;
+	u_char *op;
 	short *ip;
 
 	memset(overlap, 0, sizeof(overlap));
 	memset(intersect, 0, sizeof(intersect));
-	str = [FAREA * FAREA];
+	op = [FAREA * FAREA];
 	ip = [FAREA * FAREA];
 	for (frameix = FAREA; frameix-- > 0; ) {	/* each frame */
 	cbp = [frameix];
-	str -= FAREA;
+	op -= FAREA;
 	ip -= FAREA;
 	sp1 = [vertex = cbp->c_vertex];
 	d1 = dd[r = cbp->c_dir];
@@ -215,36 +215,36 @@ init_overlap(void)
 			continue;
 			n = (int)(sp2->s_frame[r] - frames);
 			ip[n] = vertex;
-			str[n] |= (f == 5) ? mask & 0xA : mask;
+			op[n] |= (f == 5) ? mask & 0xA : mask;
 			if (r == cbp->c_dir) {
 			/* compute the multiple spot overlap values */
 			switch (i) {
 			case 0:	/* sp1 is the first spot in A */
 if (f == 4)
-str[n] |= 0xA0;
+op[n] |= 0xA0;
 else if (f != 5)
-str[n] |= 0xF0;
+op[n] |= 0xF0;
 break;
 			case 1:	/* sp1 is the second spot in A */
 if (f == 5)
-str[n] |= 0xA0;
+op[n] |= 0xA0;
 else
-str[n] |= 0xF0;
+op[n] |= 0xF0;
 break;
 			case 4:	/* sp1 is the penultimate spot in A */
 if (f == 0)
-str[n] |= 0xC0;
+op[n] |= 0xC0;
 else
-str[n] |= 0xF0;
+op[n] |= 0xF0;
 break;
 			case 5:	/* sp1 is the last spot in A */
 if (f == 1)
-str[n] |= 0xC0;
+op[n] |= 0xC0;
 else if (f != 0)
-str[n] |= 0xF0;
+op[n] |= 0xF0;
 break;
 			default:
-str[n] |= 0xF0;
+op[n] |= 0xF0;
 			}
 			}
 		}



CVS commit: src/games/gomoku

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 21:45:40 UTC 2022

Modified Files:
src/games/gomoku: bdinit.c

Log Message:
gomoku: rename local variable

Not every array of "characters" is a string.  In this case, it's rather
an array of bool.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/games/gomoku/bdinit.c

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



CVS commit: src

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 20:10:11 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_160.c msg_160.exp
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: do not warn about '==' on the right-hand side of ','


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_160.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_160.exp
cvs rdiff -u -r1.440 -r1.441 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 20:10:11 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_160.c msg_160.exp
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: do not warn about '==' on the right-hand side of ','


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_160.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_160.exp
cvs rdiff -u -r1.440 -r1.441 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/msg_160.c
diff -u src/tests/usr.bin/xlint/lint1/msg_160.c:1.7 src/tests/usr.bin/xlint/lint1/msg_160.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_160.c:1.7	Wed May 18 19:25:12 2022
+++ src/tests/usr.bin/xlint/lint1/msg_160.c	Wed May 18 20:10:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_160.c,v 1.7 2022/05/18 19:25:12 rillig Exp $	*/
+/*	$NetBSD: msg_160.c,v 1.8 2022/05/18 20:10:11 rillig Exp $	*/
 # 3 "msg_160.c"
 
 // Test for message: operator '==' found where '=' was expected [160]
@@ -68,8 +68,6 @@ assignment_in_comma_expression(int len)
 	 * comma is a preparation, most often an assignment, and the
 	 * right-hand operand of the comma is the actual condition.
 	 */
-	/* FIXME: The following code is totally fine. */
-	/* expect+1: warning: operator '==' found where '=' was expected [160] */
 	if (len = 3 * len + 1, len == 0)
 		return;
 
@@ -86,8 +84,6 @@ assignment_in_comma_expression(int len)
 	 * In this case the parentheses are redundant, it's quite possible
 	 * that they come from a macro expansion though.
 	 */
-	/* FIXME: The following code is totally fine. */
-	/* expect+1: warning: operator '==' found where '=' was expected [160] */
 	if ((len = 3 * len + 1, len == 0))
 		return;
 
@@ -97,8 +93,6 @@ assignment_in_comma_expression(int len)
 	 * parentheses must therefore not be interpreted as changing the
 	 * intention from a condition to an assignment.
 	 */
-	/* FIXME: The following code is totally fine. */
-	/* expect+1: warning: operator '==' found where '=' was expected [160] */
 	if ((len = 3 * len + 1, len == 0) && len < 2)
 		return;
 }

Index: src/tests/usr.bin/xlint/lint1/msg_160.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_160.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_160.exp:1.7
--- src/tests/usr.bin/xlint/lint1/msg_160.exp:1.6	Wed May 18 19:25:12 2022
+++ src/tests/usr.bin/xlint/lint1/msg_160.exp	Wed May 18 20:10:11 2022
@@ -1,5 +1,2 @@
 msg_160.c(30): warning: operator '==' found where '=' was expected [160]
 msg_160.c(43): warning: operator '==' found where '=' was expected [160]
-msg_160.c(73): warning: operator '==' found where '=' was expected [160]
-msg_160.c(91): warning: operator '==' found where '=' was expected [160]
-msg_160.c(102): warning: operator '==' found where '=' was expected [160]

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.440 src/usr.bin/xlint/lint1/tree.c:1.441
--- src/usr.bin/xlint/lint1/tree.c:1.440	Wed May 18 20:01:21 2022
+++ src/usr.bin/xlint/lint1/tree.c	Wed May 18 20:10:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.440 2022/05/18 20:01:21 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.441 2022/05/18 20:10:11 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.440 2022/05/18 20:01:21 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.441 2022/05/18 20:10:11 rillig Exp $");
 #endif
 
 #include 
@@ -4274,7 +4274,7 @@ check_expr_misc(const tnode_t *tn, bool 
 		check_expr_misc(rn, cvctx, ccond, eq, false, false, szof);
 		break;
 	case COMMA:
-		check_expr_misc(rn, vctx, cond, eq, false, false, szof);
+		check_expr_misc(rn, vctx, cond, false, false, false, szof);
 		break;
 	default:
 		if (mp->m_binary)



CVS commit: src/sys/opencrypto

2022-05-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 18 20:03:58 UTC 2022

Modified Files:
src/sys/opencrypto: cryptodev.c

Log Message:
crypto(4): Simplify error test in cryptodev_op.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/opencrypto/cryptodev.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/opencrypto/cryptodev.c
diff -u src/sys/opencrypto/cryptodev.c:1.111 src/sys/opencrypto/cryptodev.c:1.112
--- src/sys/opencrypto/cryptodev.c:1.111	Wed May 18 20:03:45 2022
+++ src/sys/opencrypto/cryptodev.c	Wed May 18 20:03:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptodev.c,v 1.111 2022/05/18 20:03:45 riastradh Exp $ */
+/*	$NetBSD: cryptodev.c,v 1.112 2022/05/18 20:03:58 riastradh Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $	*/
 /*	$OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $	*/
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.111 2022/05/18 20:03:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.112 2022/05/18 20:03:58 riastradh Exp $");
 
 #include 
 #include 
@@ -647,22 +647,12 @@ cryptodev_op(struct csession *cse, struc
 			error = EINVAL;
 			goto bail;
 		}
-		crp->crp_mac=cse->tmp_mac;
+		crp->crp_mac = cse->tmp_mac;
 	}
 
 	cv_init(>crp_cv, "crydev");
-
 	error = crypto_dispatch(crp);
-
-	/*
-	 * Don't touch crp before returned by any error or received
-	 * cv_signal(>crp_cv). It is required to restructure locks.
-	 */
-
-	switch (error) {
-	case 0:
-		break;
-	default:
+	if (error) {
 		DPRINTF("not waiting, error.\n");
 		cv_destroy(>crp_cv);
 		goto bail;



CVS commit: src/sys/opencrypto

2022-05-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 18 20:03:58 UTC 2022

Modified Files:
src/sys/opencrypto: cryptodev.c

Log Message:
crypto(4): Simplify error test in cryptodev_op.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/opencrypto/cryptodev.c

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



CVS commit: src/sys/opencrypto

2022-05-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 18 20:03:45 UTC 2022

Modified Files:
src/sys/opencrypto: cryptodev.c

Log Message:
crypto(4): Narrow scope of cryptodev_mtx to cover wait.

No functional change intended -- this only removes an unnecessary
lock/unlock cycle in the error case.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/opencrypto/cryptodev.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/opencrypto/cryptodev.c
diff -u src/sys/opencrypto/cryptodev.c:1.110 src/sys/opencrypto/cryptodev.c:1.111
--- src/sys/opencrypto/cryptodev.c:1.110	Wed May 18 20:03:32 2022
+++ src/sys/opencrypto/cryptodev.c	Wed May 18 20:03:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptodev.c,v 1.110 2022/05/18 20:03:32 riastradh Exp $ */
+/*	$NetBSD: cryptodev.c,v 1.111 2022/05/18 20:03:45 riastradh Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $	*/
 /*	$OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $	*/
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.110 2022/05/18 20:03:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.111 2022/05/18 20:03:45 riastradh Exp $");
 
 #include 
 #include 
@@ -653,7 +653,6 @@ cryptodev_op(struct csession *cse, struc
 	cv_init(>crp_cv, "crydev");
 
 	error = crypto_dispatch(crp);
-	mutex_enter(_mtx);
 
 	/*
 	 * Don't touch crp before returned by any error or received
@@ -665,11 +664,11 @@ cryptodev_op(struct csession *cse, struc
 		break;
 	default:
 		DPRINTF("not waiting, error.\n");
-		mutex_exit(_mtx);
 		cv_destroy(>crp_cv);
 		goto bail;
 	}
 
+	mutex_enter(_mtx);
 	while (!(crp->crp_devflags & CRYPTODEV_F_RET)) {
 		DPRINTF("cse->sid[%d]: sleeping on cv %p for crp %p\n",
 			(uint32_t)cse->sid, >crp_cv, crp);



CVS commit: src/sys/opencrypto

2022-05-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 18 20:03:45 UTC 2022

Modified Files:
src/sys/opencrypto: cryptodev.c

Log Message:
crypto(4): Narrow scope of cryptodev_mtx to cover wait.

No functional change intended -- this only removes an unnecessary
lock/unlock cycle in the error case.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/opencrypto/cryptodev.c

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



CVS commit: src/sys/opencrypto

2022-05-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 18 20:03:32 UTC 2022

Modified Files:
src/sys/opencrypto: cryptodev.c

Log Message:
crypto(4): Nix long-dead code and comments.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/opencrypto/cryptodev.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/opencrypto/cryptodev.c
diff -u src/sys/opencrypto/cryptodev.c:1.109 src/sys/opencrypto/cryptodev.c:1.110
--- src/sys/opencrypto/cryptodev.c:1.109	Wed May 18 20:02:49 2022
+++ src/sys/opencrypto/cryptodev.c	Wed May 18 20:03:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptodev.c,v 1.109 2022/05/18 20:02:49 riastradh Exp $ */
+/*	$NetBSD: cryptodev.c,v 1.110 2022/05/18 20:03:32 riastradh Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $	*/
 /*	$OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $	*/
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.109 2022/05/18 20:02:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.110 2022/05/18 20:03:32 riastradh Exp $");
 
 #include 
 #include 
@@ -652,34 +652,15 @@ cryptodev_op(struct csession *cse, struc
 
 	cv_init(>crp_cv, "crydev");
 
-	/*
-	 * XXX there was a comment here which said that we went to
-	 * XXX splcrypto() but needed to only if CRYPTO_F_CBIMM,
-	 * XXX disabled on NetBSD since 1.6O due to a race condition.
-	 * XXX But crypto_dispatch went to splcrypto() itself!  (And
-	 * XXX now takes the cryptodev_mtx mutex itself).  We do, however,
-	 * XXX need to hold the mutex across the call to cv_wait().
-	 * XXX (should we arrange for crypto_dispatch to return to
-	 * XXX  us with it held?  it seems quite ugly to do so.)
-	 */
-#ifdef notyet
-eagain:
-#endif
 	error = crypto_dispatch(crp);
 	mutex_enter(_mtx);
 
-	/* 
+	/*
 	 * Don't touch crp before returned by any error or received
 	 * cv_signal(>crp_cv). It is required to restructure locks.
 	 */
 
 	switch (error) {
-#ifdef notyet	/* don't loop forever -- but EAGAIN not possible here yet */
-	case EAGAIN:
-		mutex_exit(_mtx);
-		goto eagain;
-		break;
-#endif
 	case 0:
 		break;
 	default:
@@ -1056,7 +1037,6 @@ csecreate(struct fcrypt *fcr, u_int64_t 
 	}
 }
 
-/* csefree: call with cryptodev_mtx held. */
 static int
 csefree(struct csession *cse)
 {



CVS commit: src/sys/opencrypto

2022-05-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 18 20:03:32 UTC 2022

Modified Files:
src/sys/opencrypto: cryptodev.c

Log Message:
crypto(4): Nix long-dead code and comments.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/opencrypto/cryptodev.c

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



CVS commit: src/sys/opencrypto

2022-05-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 18 20:02:49 UTC 2022

Modified Files:
src/sys/opencrypto: cryptodev.c

Log Message:
crypto(4): Use IPL_NONE, not IPL_NET, for /dev/crypto pools.

These are used (pool_get/put) only from thread context, never from
interrupt or even soft interrupt context.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/opencrypto/cryptodev.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/opencrypto/cryptodev.c
diff -u src/sys/opencrypto/cryptodev.c:1.108 src/sys/opencrypto/cryptodev.c:1.109
--- src/sys/opencrypto/cryptodev.c:1.108	Tue May 17 09:53:09 2022
+++ src/sys/opencrypto/cryptodev.c	Wed May 18 20:02:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptodev.c,v 1.108 2022/05/17 09:53:09 riastradh Exp $ */
+/*	$NetBSD: cryptodev.c,v 1.109 2022/05/18 20:02:49 riastradh Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $	*/
 /*	$OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $	*/
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.108 2022/05/17 09:53:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.109 2022/05/18 20:02:49 riastradh Exp $");
 
 #include 
 #include 
@@ -2118,9 +2118,9 @@ cryptoattach(int num)
 	mutex_init(_mtx, MUTEX_DEFAULT, IPL_NONE);
 
 	pool_init(, sizeof(struct fcrypt), 0, 0, 0, "fcrpl",
-	NULL, IPL_NET);	/* XXX IPL_NET ("splcrypto") */
+	NULL, IPL_NONE);
 	pool_init(, sizeof(struct csession), 0, 0, 0, "csepl",
-	NULL, IPL_NET);	/* XXX IPL_NET ("splcrypto") */
+	NULL, IPL_NONE);
 
 	/*
 	 * Preallocate space for 64 users, with 5 sessions each.



CVS commit: src/sys/opencrypto

2022-05-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 18 20:02:49 UTC 2022

Modified Files:
src/sys/opencrypto: cryptodev.c

Log Message:
crypto(4): Use IPL_NONE, not IPL_NET, for /dev/crypto pools.

These are used (pool_get/put) only from thread context, never from
interrupt or even soft interrupt context.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/opencrypto/cryptodev.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/lint1

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 20:01:21 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: reduce negations in typeok_point, document check_expr_misc

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.439 -r1.440 src/usr.bin/xlint/lint1/tree.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/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.439 src/usr.bin/xlint/lint1/tree.c:1.440
--- src/usr.bin/xlint/lint1/tree.c:1.439	Sat Apr 30 22:31:23 2022
+++ src/usr.bin/xlint/lint1/tree.c	Wed May 18 20:01:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.439 2022/04/30 22:31:23 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.440 2022/05/18 20:01:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.439 2022/04/30 22:31:23 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.440 2022/05/18 20:01:21 rillig Exp $");
 #endif
 
 #include 
@@ -788,15 +788,28 @@ is_null_pointer(const tnode_t *tn)
 static bool
 typeok_point(const tnode_t *ln, const type_t *ltp, tspec_t lt)
 {
-	if (lt == FUNC || lt == VOID || ltp->t_bitfield ||
-	((lt != STRUCT && lt != UNION) && !ln->tn_lvalue)) {
-		/* With allow_c90 we already got an error */
-		if (!allow_c90)
-			/* unacceptable operand of '%s' */
-			error(111, op_name(POINT));
-		return false;
-	}
-	return true;
+	if (is_struct_or_union(lt))
+		return true;
+
+	if (lt == FUNC || lt == VOID || ltp->t_bitfield)
+		goto wrong;
+
+	/*
+	 * Some C dialects from before C90 tolerated any lvalue on the
+	 * left-hand side of the '.' operator, allowing things like
+	 * char st[100]; st.st_mtime, assuming that the member 'st_mtime'
+	 * only occurred in a single struct; see typeok_arrow.
+	 */
+	if (ln->tn_lvalue)
+		return true;
+
+wrong:
+	/* With allow_c90 we already got an error */
+	if (!allow_c90)
+		/* unacceptable operand of '%s' */
+		error(111, op_name(POINT));
+
+	return false;
 }
 
 static bool
@@ -4196,6 +4209,20 @@ check_expr_op(const tnode_t *tn, op_t op
 	return true;
 }
 
+/*
+ *	vctx			???
+ *	cond			whether the expression is a condition that
+ *will be compared with 0
+ *	eqwarn			whether the operator '==' might be a
+ *misspelled '='
+ *	fcall			whether the expression is a function call
+ *	retval_discarded	whether the return value of a function call
+ *is discarded; such calls will be analyzed by
+ *lint2 in messages 4, 8 and 9
+ *	szof			whether the expression is part of a sizeof
+ *expression, which means that its value is
+ *discarded since only the type is relevant
+ */
 void
 check_expr_misc(const tnode_t *tn, bool vctx, bool cond,
 		bool eqwarn, bool fcall, bool retval_discarded, bool szof)



CVS commit: src/usr.bin/xlint/lint1

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 20:01:21 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: reduce negations in typeok_point, document check_expr_misc

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.439 -r1.440 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src/games/gomoku

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 19:29:00 UTC 2022

Modified Files:
src/games/gomoku: main.c

Log Message:
gomoku: call setprogname, for portability

No functional change on NetBSD, but the games are distributed to other
platforms as well.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/games/gomoku/main.c

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

Modified files:

Index: src/games/gomoku/main.c
diff -u src/games/gomoku/main.c:1.38 src/games/gomoku/main.c:1.39
--- src/games/gomoku/main.c:1.38	Mon May 16 21:53:41 2022
+++ src/games/gomoku/main.c	Wed May 18 19:29:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.38 2022/05/16 21:53:41 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.39 2022/05/18 19:29:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\
 #if 0
 static char sccsid[] = "@(#)main.c	8.4 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.38 2022/05/16 21:53:41 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.39 2022/05/18 19:29:00 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -100,6 +100,8 @@ main(int argc, char **argv)
 	/* Revoke setgid privileges */
 	setgid(getgid());
 
+	setprogname(argv[0]);
+
 	tmp = getlogin();
 	if (tmp != NULL) {
 		strlcpy(user, tmp, sizeof(user));



CVS commit: src/games/gomoku

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 19:29:00 UTC 2022

Modified Files:
src/games/gomoku: main.c

Log Message:
gomoku: call setprogname, for portability

No functional change on NetBSD, but the games are distributed to other
platforms as well.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/games/gomoku/main.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/xlint/lint1

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 19:25:12 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_160.c msg_160.exp

Log Message:
tests/lint: add more examples for warning in comma expression


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_160.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_160.exp

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/xlint/lint1/msg_160.c
diff -u src/tests/usr.bin/xlint/lint1/msg_160.c:1.6 src/tests/usr.bin/xlint/lint1/msg_160.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_160.c:1.6	Sat Oct  9 21:25:39 2021
+++ src/tests/usr.bin/xlint/lint1/msg_160.c	Wed May 18 19:25:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_160.c,v 1.6 2021/10/09 21:25:39 rillig Exp $	*/
+/*	$NetBSD: msg_160.c,v 1.7 2022/05/18 19:25:12 rillig Exp $	*/
 # 3 "msg_160.c"
 
 // Test for message: operator '==' found where '=' was expected [160]
@@ -57,14 +57,48 @@ unparenthesized(int a, int b, int c, _Bo
 	eval(a == (b == c));
 }
 
-/* Seen in bin/csh/dir.c 1.35 from 2020-08-09, line 223. */
 void
-assignment_in_comma_expression(void)
+assignment_in_comma_expression(int len)
 {
-	int len;
 
+	/*
+	 * No extra parentheses, just a comma operator.
+	 *
+	 * The usual interpretation is that the left-hand operand of the
+	 * comma is a preparation, most often an assignment, and the
+	 * right-hand operand of the comma is the actual condition.
+	 */
+	/* FIXME: The following code is totally fine. */
+	/* expect+1: warning: operator '==' found where '=' was expected [160] */
+	if (len = 3 * len + 1, len == 0)
+		return;
+
+	/* Seen in bin/csh/dir.c 1.35 from 2020-08-09, line 223. */
+	/*
+	 * The extra parentheses are typically used to inform the compiler
+	 * that an assignment using '=' is intentional, in particular it is
+	 * not a typo of the comparison operator '=='.
+	 *
+	 * The comma operator in a condition is seldom used, which makes it
+	 * reasonable to assume that the code author selected the operators
+	 * on purpose.
+	 *
+	 * In this case the parentheses are redundant, it's quite possible
+	 * that they come from a macro expansion though.
+	 */
+	/* FIXME: The following code is totally fine. */
+	/* expect+1: warning: operator '==' found where '=' was expected [160] */
+	if ((len = 3 * len + 1, len == 0))
+		return;
+
+	/*
+	 * If the comma expression is part of a larger expression, the
+	 * parentheses are required to mark the operator precedence.  The
+	 * parentheses must therefore not be interpreted as changing the
+	 * intention from a condition to an assignment.
+	 */
 	/* FIXME: The following code is totally fine. */
 	/* expect+1: warning: operator '==' found where '=' was expected [160] */
-	if ((len = 3, len == 0))
+	if ((len = 3 * len + 1, len == 0) && len < 2)
 		return;
 }

Index: src/tests/usr.bin/xlint/lint1/msg_160.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_160.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_160.exp:1.6
--- src/tests/usr.bin/xlint/lint1/msg_160.exp:1.5	Sat Oct  9 21:25:39 2021
+++ src/tests/usr.bin/xlint/lint1/msg_160.exp	Wed May 18 19:25:12 2022
@@ -1,3 +1,5 @@
 msg_160.c(30): warning: operator '==' found where '=' was expected [160]
 msg_160.c(43): warning: operator '==' found where '=' was expected [160]
-msg_160.c(68): warning: operator '==' found where '=' was expected [160]
+msg_160.c(73): warning: operator '==' found where '=' was expected [160]
+msg_160.c(91): warning: operator '==' found where '=' was expected [160]
+msg_160.c(102): warning: operator '==' found where '=' was expected [160]



CVS commit: src/tests/usr.bin/xlint/lint1

2022-05-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May 18 19:25:12 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_160.c msg_160.exp

Log Message:
tests/lint: add more examples for warning in comma expression


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_160.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_160.exp

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

2022-05-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May 18 16:39:03 UTC 2022

Modified Files:
src/usr.sbin/sysinst: configmenu.c defs.h menus.mi msg.mi.de msg.mi.en
msg.mi.es msg.mi.fr msg.mi.pl net.c util.c

Log Message:
When not invoked via some explicit "configure network" menu item,
auto-detect an already working network setup and offer to "just use" it
whenver we need connectivity.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/sysinst/configmenu.c
cvs rdiff -u -r1.81 -r1.82 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/sysinst/menus.mi
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/sysinst/msg.mi.de
cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/sysinst/msg.mi.en
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/msg.mi.es
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/sysinst/msg.mi.fr
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/sysinst/msg.mi.pl
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/sysinst/net.c
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/sysinst/util.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/configmenu.c
diff -u src/usr.sbin/sysinst/configmenu.c:1.16 src/usr.sbin/sysinst/configmenu.c:1.17
--- src/usr.sbin/sysinst/configmenu.c:1.16	Sun May 15 16:38:25 2022
+++ src/usr.sbin/sysinst/configmenu.c	Wed May 18 16:39:03 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: configmenu.c,v 1.16 2022/05/15 16:38:25 jmcneill Exp $ */
+/* $NetBSD: configmenu.c,v 1.17 2022/05/18 16:39:03 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -230,7 +230,7 @@ static int
 set_network(struct menudesc *menu, void *arg)
 {
 	network_up = 0;
-	if (config_network())
+	if (config_network(1))
 		mnt_net_config();
 	return 0;
 }

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.81 src/usr.sbin/sysinst/defs.h:1.82
--- src/usr.sbin/sysinst/defs.h:1.81	Thu Apr 21 17:30:15 2022
+++ src/usr.sbin/sysinst/defs.h	Wed May 18 16:39:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.81 2022/04/21 17:30:15 martin Exp $	*/
+/*	$NetBSD: defs.h,v 1.82 2022/05/18 16:39:03 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -789,7 +789,7 @@ extern int network_up;
 extern char net_namesvr[STRSIZE];
 int	get_via_ftp(unsigned int);
 int	get_via_nfs(void);
-int	config_network(void);
+int	config_network(int force);
 void	mnt_net_config(void);
 void	make_url(char *, struct ftpinfo *, const char *);
 int	get_pkgsrc(void);

Index: src/usr.sbin/sysinst/menus.mi
diff -u src/usr.sbin/sysinst/menus.mi:1.24 src/usr.sbin/sysinst/menus.mi:1.25
--- src/usr.sbin/sysinst/menus.mi:1.24	Wed Nov  4 14:29:40 2020
+++ src/usr.sbin/sysinst/menus.mi	Wed May 18 16:39:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: menus.mi,v 1.24 2020/11/04 14:29:40 martin Exp $	*/
+/*	$NetBSD: menus.mi,v 1.25 2022/05/18 16:39:03 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -277,7 +277,7 @@ menu utility, title MSG_NetBSD_VERSION_U
 		action {
 			extern int network_up;
 			network_up = 0;
-			config_network();
+			config_network(1);
 		};
 	option MSG_Partition_a_disk,
 		action {
@@ -407,7 +407,7 @@ menu ftpsource, y=-4, x=0, w=70, no box,
 		action {
 			extern int network_up;
 			network_up = 0;
-			config_network();
+			config_network(1);
 		};
 	option MSG_exit_menu_generic, exit, action { ((arg_rv*)arg)->rv = SET_RETRY; };
 
@@ -428,7 +428,7 @@ menu nfssource, y=-4, x=0, w=70, no box,
 		action {
 			extern int network_up;
 			network_up = 0;
-			config_network();
+			config_network(1);
 		};
 	option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
 
@@ -593,7 +593,7 @@ menu binpkg, y=-4, x=0, w=70, no box, no
 		action {
 			extern int network_up;
 			network_up = 0;
-			config_network();
+			config_network(1);
 			mnt_net_config();
 		};
 	option {src_legend(menu, MSG_transfer_method, url_proto(pkg.xfer));},

Index: src/usr.sbin/sysinst/msg.mi.de
diff -u src/usr.sbin/sysinst/msg.mi.de:1.37 src/usr.sbin/sysinst/msg.mi.de:1.38
--- src/usr.sbin/sysinst/msg.mi.de:1.37	Mon May 16 18:44:38 2022
+++ src/usr.sbin/sysinst/msg.mi.de	Wed May 18 16:39:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.de,v 1.37 2022/05/16 18:44:38 martin Exp $	*/
+/*	$NetBSD: msg.mi.de,v 1.38 2022/05/18 16:39:03 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1556,3 +1556,8 @@ message clone_target_hdr
 message clone_target_disp		{duplizierte Partition(en)}
 message clone_src_done
 {Quellauswahl OK, weiter mit der Zielauswahl}
+
+message network_ok
+{Ihr Netzwerk scheint bereits zu funktionieren. 
+Möchten Sie die Konfiguration überspringen 
+und die bisherigen Einstellungen verwenden?}

Index: src/usr.sbin/sysinst/msg.mi.en
diff -u src/usr.sbin/sysinst/msg.mi.en:1.40 src/usr.sbin/sysinst/msg.mi.en:1.41
--- src/usr.sbin/sysinst/msg.mi.en:1.40	Mon May 16 18:44:38 2022
+++ src/usr.sbin/sysinst/msg.mi.en	Wed May 18 16:39:03 

CVS commit: src/usr.sbin/sysinst

2022-05-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May 18 16:39:03 UTC 2022

Modified Files:
src/usr.sbin/sysinst: configmenu.c defs.h menus.mi msg.mi.de msg.mi.en
msg.mi.es msg.mi.fr msg.mi.pl net.c util.c

Log Message:
When not invoked via some explicit "configure network" menu item,
auto-detect an already working network setup and offer to "just use" it
whenver we need connectivity.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/sysinst/configmenu.c
cvs rdiff -u -r1.81 -r1.82 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/sysinst/menus.mi
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/sysinst/msg.mi.de
cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/sysinst/msg.mi.en
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/msg.mi.es
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/sysinst/msg.mi.fr
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/sysinst/msg.mi.pl
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/sysinst/net.c
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/sysinst/util.c

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



CVS commit: src/sys/netipsec

2022-05-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 18 15:20:18 UTC 2022

Modified Files:
src/sys/netipsec: key.c key_debug.c key_debug.h

Log Message:
PR/56841: Andrew Cagney: debug-log IPcomp CPI lookups:
- debug-logs why an SPI is rejected
- adds missing __VA_OPT__(,) to some printf macros
- debug-log SPI+proto when adding/updating entry


To generate a diff of this commit:
cvs rdiff -u -r1.273 -r1.274 src/sys/netipsec/key.c
cvs rdiff -u -r1.23 -r1.24 src/sys/netipsec/key_debug.c
cvs rdiff -u -r1.10 -r1.11 src/sys/netipsec/key_debug.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.273 src/sys/netipsec/key.c:1.274
--- src/sys/netipsec/key.c:1.273	Sun Jan  2 15:28:53 2022
+++ src/sys/netipsec/key.c	Wed May 18 11:20:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.273 2022/01/02 20:28:53 andvar Exp $	*/
+/*	$NetBSD: key.c,v 1.274 2022/05/18 15:20:18 christos Exp $	*/
 /*	$FreeBSD: key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.273 2022/01/02 20:28:53 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.274 2022/05/18 15:20:18 christos Exp $");
 
 /*
  * This code is referred to RFC 2367
@@ -700,9 +700,9 @@ static void key_init_sav(struct secasvar
 static void key_wait_sav(struct secasvar *);
 static void key_destroy_sav(struct secasvar *);
 static struct secasvar *key_newsav(struct mbuf *,
-	const struct sadb_msghdr *, int *, const char*, int);
-#define	KEY_NEWSAV(m, sadb, e)\
-	key_newsav(m, sadb, e, __func__, __LINE__)
+	const struct sadb_msghdr *, int *, int, const char*, int);
+#define	KEY_NEWSAV(m, sadb, e, proto)\
+	key_newsav(m, sadb, e, proto, __func__, __LINE__)
 static void key_delsav (struct secasvar *);
 static struct secashead *key_getsah(const struct secasindex *, int);
 static struct secashead *key_getsah_ref(const struct secasindex *, int);
@@ -1288,8 +1288,11 @@ key_lookup_sa(
 		}
 	}
 	KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP,
-	"DP from %s:%u check_spi=%d, check_alg=%d\n",
-	where, tag, must_check_spi, must_check_alg);
+	"DP from %s:%u check_spi=%d(%#x), check_alg=%d(%d), proto=%d\n",
+	where, tag,
+	must_check_spi, ntohl(spi),
+	must_check_alg, algo,
+	proto);
 
 
 	/*
@@ -3279,7 +3282,7 @@ key_destroy_sah(struct secashead *sah)
  */
 static struct secasvar *
 key_newsav(struct mbuf *m, const struct sadb_msghdr *mhp,
-int *errp, const char* where, int tag)
+int *errp, int proto, const char* where, int tag)
 {
 	struct secasvar *newsav;
 	const struct sadb_sa *xsa;
@@ -3339,7 +3342,8 @@ key_newsav(struct mbuf *m, const struct 
 	newsav->pid = mhp->msg->sadb_msg_pid;
 
 	KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP,
-	"DP from %s:%u return SA:%p\n", where, tag, newsav);
+	"DP from %s:%u return SA:%p spi=%#x proto=%d\n",
+	where, tag, newsav, ntohl(newsav->spi), proto);
 	return newsav;
 
 error:
@@ -4679,75 +4683,103 @@ key_spidx_match_withmask(
 	if (spidx0->src.sa.sa_family != spidx1->src.sa.sa_family ||
 	spidx0->dst.sa.sa_family != spidx1->dst.sa.sa_family ||
 	spidx0->src.sa.sa_len != spidx1->src.sa.sa_len ||
-	spidx0->dst.sa.sa_len != spidx1->dst.sa.sa_len)
+	spidx0->dst.sa.sa_len != spidx1->dst.sa.sa_len) {
+		KEYDEBUG_PRINTF(KEYDEBUG_MATCH, ".sa wrong\n");
 		return 0;
+	}
 
 	/* if spidx.ul_proto == IPSEC_ULPROTO_ANY, ignore. */
 	if (spidx0->ul_proto != (u_int16_t)IPSEC_ULPROTO_ANY &&
-	spidx0->ul_proto != spidx1->ul_proto)
+	spidx0->ul_proto != spidx1->ul_proto) {
+		KEYDEBUG_PRINTF(KEYDEBUG_MATCH, "proto wrong\n");
 		return 0;
+	}
 
 	switch (spidx0->src.sa.sa_family) {
 	case AF_INET:
 		if (spidx0->src.sin.sin_port != IPSEC_PORT_ANY &&
-		spidx0->src.sin.sin_port != spidx1->src.sin.sin_port)
+		spidx0->src.sin.sin_port != spidx1->src.sin.sin_port) {
+			KEYDEBUG_PRINTF(KEYDEBUG_MATCH, "v4 src port wrong\n");
 			return 0;
+		}
 		if (!key_bb_match_withmask(>src.sin.sin_addr,
-		>src.sin.sin_addr, spidx0->prefs))
+	   >src.sin.sin_addr, spidx0->prefs)) {
+			KEYDEBUG_PRINTF(KEYDEBUG_MATCH, "v4 src addr wrong\n");
 			return 0;
+		}
 		break;
 	case AF_INET6:
 		if (spidx0->src.sin6.sin6_port != IPSEC_PORT_ANY &&
-		spidx0->src.sin6.sin6_port != spidx1->src.sin6.sin6_port)
+		spidx0->src.sin6.sin6_port != spidx1->src.sin6.sin6_port) {
+			KEYDEBUG_PRINTF(KEYDEBUG_MATCH, "v6 src port wrong\n");
 			return 0;
+		}
 		/*
 		 * scope_id check. if sin6_scope_id is 0, we regard it
 		 * as a wildcard scope, which matches any scope zone ID.
 		 */
 		if (spidx0->src.sin6.sin6_scope_id &&
 		spidx1->src.sin6.sin6_scope_id &&
-		spidx0->src.sin6.sin6_scope_id != spidx1->src.sin6.sin6_scope_id)
+		spidx0->src.sin6.sin6_scope_id != spidx1->src.sin6.sin6_scope_id) {

CVS commit: src/sys/netipsec

2022-05-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 18 15:20:18 UTC 2022

Modified Files:
src/sys/netipsec: key.c key_debug.c key_debug.h

Log Message:
PR/56841: Andrew Cagney: debug-log IPcomp CPI lookups:
- debug-logs why an SPI is rejected
- adds missing __VA_OPT__(,) to some printf macros
- debug-log SPI+proto when adding/updating entry


To generate a diff of this commit:
cvs rdiff -u -r1.273 -r1.274 src/sys/netipsec/key.c
cvs rdiff -u -r1.23 -r1.24 src/sys/netipsec/key_debug.c
cvs rdiff -u -r1.10 -r1.11 src/sys/netipsec/key_debug.h

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



CVS commit: src

2022-05-18 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed May 18 13:56:32 UTC 2022

Modified Files:
src/sys/arch/amiga/amiga: busfuncs.c
src/sys/arch/i386/include: segments.h
src/sys/arch/m68k/include: asm_single.h
src/sys/arch/next68k/next68k: nextrom.h
src/sys/arch/powerpc/powerpc: trap_subr.S
src/sys/dev/tc: stic.c
src/usr.sbin/btpand: btpand.c

Log Message:
fix typos in word "access" and it derivatives, mainly in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amiga/amiga/busfuncs.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/i386/include/segments.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/include/asm_single.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/next68k/next68k/nextrom.h
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/powerpc/powerpc/trap_subr.S
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/tc/stic.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/btpand/btpand.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/amiga/amiga/busfuncs.c
diff -u src/sys/arch/amiga/amiga/busfuncs.c:1.12 src/sys/arch/amiga/amiga/busfuncs.c:1.13
--- src/sys/arch/amiga/amiga/busfuncs.c:1.12	Tue Jul 19 15:55:26 2011
+++ src/sys/arch/amiga/amiga/busfuncs.c	Wed May 18 13:56:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: busfuncs.c,v 1.12 2011/07/19 15:55:26 dyoung Exp $	*/
+/*	$NetBSD: busfuncs.c,v 1.13 2022/05/18 13:56:31 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: busfuncs.c,v 1.12 2011/07/19 15:55:26 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: busfuncs.c,v 1.13 2022/05/18 13:56:31 andvar Exp $");
 
 /*
  * Amiga bus access methods for data widths > 1
@@ -208,7 +208,7 @@ amiga_contiguous_copy_region_2(bus_space
 
 /*
  * Interleaved methods.
- * These use single-byte acceses. In case of stride = 0, the contiguous
+ * These use single-byte accesses. In case of stride = 0, the contiguous
  * methods are preferred, as they only create word accesses.
  */
 

Index: src/sys/arch/i386/include/segments.h
diff -u src/sys/arch/i386/include/segments.h:1.69 src/sys/arch/i386/include/segments.h:1.70
--- src/sys/arch/i386/include/segments.h:1.69	Tue Jul 14 00:45:53 2020
+++ src/sys/arch/i386/include/segments.h	Wed May 18 13:56:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.69 2020/07/14 00:45:53 yamaguchi Exp $	*/
+/*	$NetBSD: segments.h,v 1.70 2022/05/18 13:56:32 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -247,7 +247,7 @@ struct idt_vec* idt_vec_ref(struct idt_v
 #define SDT_MEMROD	20	/* memory read only expand dwn limit */
 #define SDT_MEMRODA	21	/* memory read only expand dwn limit accessed */
 #define SDT_MEMRWD	22	/* memory read write expand dwn limit */
-#define SDT_MEMRWDA	23	/* memory read write expand dwn limit acessed */
+#define SDT_MEMRWDA	23	/* memory read write expand dwn limit accessed */
 #define SDT_MEME	24	/* memory execute only */
 #define SDT_MEMEA	25	/* memory execute only accessed */
 #define SDT_MEMER	26	/* memory execute read */

Index: src/sys/arch/m68k/include/asm_single.h
diff -u src/sys/arch/m68k/include/asm_single.h:1.9 src/sys/arch/m68k/include/asm_single.h:1.10
--- src/sys/arch/m68k/include/asm_single.h:1.9	Tue Oct 20 19:10:12 2009
+++ src/sys/arch/m68k/include/asm_single.h	Wed May 18 13:56:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm_single.h,v 1.9 2009/10/20 19:10:12 snj Exp $	*/
+/*	$NetBSD: asm_single.h,v 1.10 2022/05/18 13:56:32 andvar Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.
@@ -30,7 +30,7 @@
 /*
  * Provide bit manipulation macro's that resolve to a single instruction.
  * These can be considered atomic on single processor architectures when
- * no page faults can occur when acessing .
+ * no page faults can occur when accessing .
  * There primary use is to avoid race conditions when manipulating device
  * registers.
  */

Index: src/sys/arch/next68k/next68k/nextrom.h
diff -u src/sys/arch/next68k/next68k/nextrom.h:1.11 src/sys/arch/next68k/next68k/nextrom.h:1.12
--- src/sys/arch/next68k/next68k/nextrom.h:1.11	Sun Dec 18 04:29:32 2011
+++ src/sys/arch/next68k/next68k/nextrom.h	Wed May 18 13:56:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: nextrom.h,v 1.11 2011/12/18 04:29:32 tsutsui Exp $	*/
+/*	$NetBSD: nextrom.h,v 1.12 2022/05/18 13:56:32 andvar Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -135,7 +135,7 @@
 #define	NADDR		8
 
 struct mon_global {
-	char mg_simm[N_SIMM];	/* MUST BE FIRST (accesed early by locore) */
+	char mg_simm[N_SIMM];	/* MUST BE FIRST (accessed early by locore) */
 	char mg_flags;		/* MUST BE SECOND */
 #define	MGF_LOGINWINDOW		0x80
 #define	MGF_UART_SETUP		0x40

Index: src/sys/arch/powerpc/powerpc/trap_subr.S
diff -u src/sys/arch/powerpc/powerpc/trap_subr.S:1.85 src/sys/arch/powerpc/powerpc/trap_subr.S:1.86
--- 

CVS commit: src

2022-05-18 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed May 18 13:56:32 UTC 2022

Modified Files:
src/sys/arch/amiga/amiga: busfuncs.c
src/sys/arch/i386/include: segments.h
src/sys/arch/m68k/include: asm_single.h
src/sys/arch/next68k/next68k: nextrom.h
src/sys/arch/powerpc/powerpc: trap_subr.S
src/sys/dev/tc: stic.c
src/usr.sbin/btpand: btpand.c

Log Message:
fix typos in word "access" and it derivatives, mainly in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amiga/amiga/busfuncs.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/i386/include/segments.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/include/asm_single.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/next68k/next68k/nextrom.h
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/powerpc/powerpc/trap_subr.S
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/tc/stic.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/btpand/btpand.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/hpcarm/dev

2022-05-18 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed May 18 13:38:47 UTC 2022

Modified Files:
src/sys/arch/hpcarm/dev: ipaq_gpioreg.h

Log Message:
s/yhe/the/


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hpcarm/dev/ipaq_gpioreg.h

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

Modified files:

Index: src/sys/arch/hpcarm/dev/ipaq_gpioreg.h
diff -u src/sys/arch/hpcarm/dev/ipaq_gpioreg.h:1.6 src/sys/arch/hpcarm/dev/ipaq_gpioreg.h:1.7
--- src/sys/arch/hpcarm/dev/ipaq_gpioreg.h:1.6	Mon Apr 28 20:23:21 2008
+++ src/sys/arch/hpcarm/dev/ipaq_gpioreg.h	Wed May 18 13:38:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipaq_gpioreg.h,v 1.6 2008/04/28 20:23:21 martin Exp $	*/
+/*	$NetBSD: ipaq_gpioreg.h,v 1.7 2022/05/18 13:38:47 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.  All rights reserved.
@@ -69,7 +69,7 @@ Extended GPIO
 9	O(H)	IR_ON		Enables power to IR module
 10	O(H)	AUD_ON		Enables power to audio output amp.
 11	O(H)	AUD_PWR_ON	Enables power to all audio modules.
-12	O(H)	QMUTE		Mutes yhe onboard audio codec
+12	O(H)	QMUTE		Mutes the onboard audio codec
 13	O	IR_FSEL		FIR mode selection:H=FIR,L=SIR
 14	O(H)	LCD_5V_ON	Enables 5V to the LCD module
 15	O(H)	LVDD_ON		Enables 9V and -6.5V to the LCD module



CVS commit: src/sys/arch/hpcarm/dev

2022-05-18 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed May 18 13:38:47 UTC 2022

Modified Files:
src/sys/arch/hpcarm/dev: ipaq_gpioreg.h

Log Message:
s/yhe/the/


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hpcarm/dev/ipaq_gpioreg.h

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



CVS commit: src/sys/netinet

2022-05-18 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed May 18 13:37:52 UTC 2022

Modified Files:
src/sys/netinet: sctp_constants.h

Log Message:
s/yeild/yield/


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/sctp_constants.h

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



CVS commit: src/sys/netinet

2022-05-18 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed May 18 13:37:52 UTC 2022

Modified Files:
src/sys/netinet: sctp_constants.h

Log Message:
s/yeild/yield/


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/sctp_constants.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/netinet/sctp_constants.h
diff -u src/sys/netinet/sctp_constants.h:1.3 src/sys/netinet/sctp_constants.h:1.4
--- src/sys/netinet/sctp_constants.h:1.3	Sat Jan  1 08:34:35 2022
+++ src/sys/netinet/sctp_constants.h	Wed May 18 13:37:52 2022
@@ -1,5 +1,5 @@
 /*	$KAME: sctp_constants.h,v 1.17 2005/03/06 16:04:17 itojun Exp $	*/
-/*	$NetBSD: sctp_constants.h,v 1.3 2022/01/01 08:34:35 msaitoh Exp $ */
+/*	$NetBSD: sctp_constants.h,v 1.4 2022/05/18 13:37:52 andvar Exp $ */
 
 #ifndef __SCTP_CONSTANTS_H__
 #define __SCTP_CONSTANTS_H__
@@ -755,7 +755,7 @@
  * course the overhead of the next pointer as well). Using 15 as
  * an example will yield * ((8 * 15) + 8) or 128 bytes of overhead
  * for each timewait block that gets initialized. Increasing it to
- * 31 would yeild 256 bytes per block.
+ * 31 would yield 256 bytes per block.
  */
 /* Undef the following turns on per EP behavior */
 #define SCTP_VTAG_TIMEWAIT_PER_STACK 1



CVS commit: src/sys/dev/pci

2022-05-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 18 12:48:50 UTC 2022

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

Log Message:
ubsec(4): Nix dead code.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/pci/ubsec.c

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

Modified files:

Index: src/sys/dev/pci/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.52 src/sys/dev/pci/ubsec.c:1.53
--- src/sys/dev/pci/ubsec.c:1.52	Sun Jun 14 23:22:09 2020
+++ src/sys/dev/pci/ubsec.c	Wed May 18 12:48:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsec.c,v 1.52 2020/06/14 23:22:09 riastradh Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.53 2022/05/18 12:48:49 riastradh Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*	$OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.52 2020/06/14 23:22:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.53 2022/05/18 12:48:49 riastradh Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -1148,7 +1148,7 @@ ubsec_process(void *arg, struct cryptop 
 {
 	struct ubsec_q *q = NULL;
 	int err = 0, i, j, nicealign;
-	struct ubsec_softc *sc;
+	struct ubsec_softc *sc = arg;
 	struct cryptodesc *crd1, *crd2, *maccrd, *enccrd;
 	int encoffset = 0, macoffset = 0, cpskip, cpoffset;
 	int sskip, dskip, stheend, dtheend;
@@ -1158,13 +1158,6 @@ ubsec_process(void *arg, struct cryptop 
 	u_int16_t flags = 0;
 	int ivlen = 0, keylen = 0;
 
-	sc = arg;
-	KASSERT(sc != NULL /*, ("ubsec_process: null softc")*/);
-
-	if (crp == NULL || crp->crp_callback == NULL || sc == NULL) {
-		ubsecstats.hst_invalid++;
-		return (EINVAL);
-	}
 	if (UBSEC_SESSION(crp->crp_sid) >= sc->sc_nsessions) {
 		ubsecstats.hst_badsession++;
 		return (EINVAL);
@@ -2402,14 +2395,9 @@ ubsec_kfree(struct ubsec_softc *sc, stru
 static int
 ubsec_kprocess(void *arg, struct cryptkop *krp, int hint)
 {
-	struct ubsec_softc *sc;
+	struct ubsec_softc *sc = arg;
 	int r;
 
-	if (krp == NULL || krp->krp_callback == NULL)
-		return (EINVAL);
-	sc = arg;
-	KASSERT(sc != NULL /*, ("ubsec_kprocess: null softc")*/);
-
 	while (!SIMPLEQ_EMPTY(>sc_q2free)) {
 		struct ubsec_q2 *q;
 



CVS commit: src/sys/dev/pci

2022-05-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 18 12:48:50 UTC 2022

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

Log Message:
ubsec(4): Nix dead code.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/pci/ubsec.c

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