CVS commit: src/doc

2022-08-10 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug 10 13:38:26 UTC 2022

Modified Files:
src/doc: HACKS

Log Message:
Note that aes_ccm_tag() still fails with GCC 10.4 with -O2 on m68k.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/doc/HACKS

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.229 src/doc/HACKS:1.230
--- src/doc/HACKS:1.229	Tue May 31 19:14:10 2022
+++ src/doc/HACKS	Wed Aug 10 13:38:26 2022
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.229 2022/05/31 19:14:10 christos Exp $
+# $NetBSD: HACKS,v 1.230 2022/08/10 13:38:26 rin Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -974,9 +974,9 @@ descr	Disable optimization on tc.c, loge
 kcah
 
 port	m68k
-hack	compile aes_ccm_tag() with -O0 for GCC8 and GCC9
+hack	compile aes_ccm_tag() with -O0
 cdate	Mon Aug 10 06:27:29 UTC 2020
-mdate	Mon Oct  5 22:00:00 JST 2020
+mdate	Wed Aug 10 00:00:00 UTC 2022
 who	rin
 file	src/sys/crypto/aes/aes_ccm.c: 1.5
 descr	GCC 9.4 and 8.3 miscompile aes_ccm_tag() for m68k with optimization
@@ -984,6 +984,7 @@ descr	GCC 9.4 and 8.3 miscompile aes_ccm
 	For 9.4, -O0 and -O1 work but -O2 fails for amiga (A1200, 68060) and
 	mac68k (Quadra 840AV, 68040). Whereas -O0 and -O2 work but -O1 fails
 	for sun3 (TME, 68020 emulator) and sun2 (TME, 68010 emulator).
+	aes_ccm_selftest() still fails with GCC 10.4 and -O2.
 kcah
 
 port	sh3



CVS commit: src/doc

2022-08-10 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug 10 13:38:26 UTC 2022

Modified Files:
src/doc: HACKS

Log Message:
Note that aes_ccm_tag() still fails with GCC 10.4 with -O2 on m68k.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/doc/HACKS

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



CVS commit: src/usr.sbin/inetd

2022-08-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 10 08:38:43 UTC 2022

Modified Files:
src/usr.sbin/inetd: Makefile

Log Message:
Remove RPC define


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/inetd/Makefile

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/inetd/Makefile
diff -u src/usr.sbin/inetd/Makefile:1.31 src/usr.sbin/inetd/Makefile:1.32
--- src/usr.sbin/inetd/Makefile:1.31	Tue Aug  9 23:35:38 2022
+++ src/usr.sbin/inetd/Makefile	Wed Aug 10 04:38:43 2022
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
-#	$NetBSD: Makefile,v 1.31 2022/08/10 03:35:38 dholland Exp $
+#	$NetBSD: Makefile,v 1.32 2022/08/10 08:38:43 christos Exp $
 
 .include 
 
@@ -15,9 +15,6 @@ WARNS=	6
 # Enables debug printouts when in debug mode
 CPPFLAGS+=-DDEBUG_ENABLE
 
-# Enables SunRPC support
-CPPFLAGS+=-DRPC
-
 CPPFLAGS+=-DLIBWRAP
 # Use LIBWRAP_INTERNAL for libwrap checking of inetd's `internal' services.
 #CPPFLAGS+=-DLIBWRAP_INTERNAL



CVS commit: src/usr.sbin/inetd

2022-08-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 10 08:38:43 UTC 2022

Modified Files:
src/usr.sbin/inetd: Makefile

Log Message:
Remove RPC define


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/inetd/Makefile

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



CVS commit: src/usr.sbin/inetd

2022-08-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 10 08:37:53 UTC 2022

Modified Files:
src/usr.sbin/inetd: inetd.c inetd.h parse.c

Log Message:
PR/56963: Mark Davies: inetd not configured for rpc
Move RPC includes to inetd.h


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/inetd/parse.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/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.140 src/usr.sbin/inetd/inetd.c:1.141
--- src/usr.sbin/inetd/inetd.c:1.140	Tue Aug  9 23:35:38 2022
+++ src/usr.sbin/inetd/inetd.c	Wed Aug 10 04:37:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.140 2022/08/10 03:35:38 dholland Exp $	*/
+/*	$NetBSD: inetd.c,v 1.141 2022/08/10 08:37:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.140 2022/08/10 03:35:38 dholland Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.141 2022/08/10 08:37:53 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -193,14 +193,6 @@ __RCSID("$NetBSD: inetd.c,v 1.140 2022/0
 #include 
 #include 
 
-#include 
-
-#ifdef RPC
-#include 
-#include 
-#include 
-#endif
-
 #include 
 #include 
 #include 

Index: src/usr.sbin/inetd/inetd.h
diff -u src/usr.sbin/inetd/inetd.h:1.5 src/usr.sbin/inetd/inetd.h:1.6
--- src/usr.sbin/inetd/inetd.h:1.5	Tue Oct 12 18:51:28 2021
+++ src/usr.sbin/inetd/inetd.h	Wed Aug 10 04:37:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.h,v 1.5 2021/10/12 22:51:28 rillig Exp $	*/
+/*	$NetBSD: inetd.h,v 1.6 2022/08/10 08:37:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -73,6 +73,18 @@
 #include 
 #include 
 
+#ifndef NO_RPC
+#define RPC
+#endif
+
+#include 
+
+#ifdef RPC
+#include 
+#include 
+#include 
+#endif
+
 
 #include "pathnames.h"
 

Index: src/usr.sbin/inetd/parse.c
diff -u src/usr.sbin/inetd/parse.c:1.4 src/usr.sbin/inetd/parse.c:1.5
--- src/usr.sbin/inetd/parse.c:1.4	Tue Aug  9 23:35:38 2022
+++ src/usr.sbin/inetd/parse.c	Wed Aug 10 04:37:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.4 2022/08/10 03:35:38 dholland Exp $	*/
+/*	$NetBSD: parse.c,v 1.5 2022/08/10 08:37:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.4 2022/08/10 03:35:38 dholland Exp $");
+__RCSID("$NetBSD: parse.c,v 1.5 2022/08/10 08:37:53 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -91,10 +91,6 @@ __RCSID("$NetBSD: parse.c,v 1.4 2022/08/
 #include 
 #include 
 
-#ifdef RPC
-#include 
-#endif
-
 #include "inetd.h"
 
 static void	config(void);



CVS commit: src/usr.sbin/inetd

2022-08-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 10 08:37:53 UTC 2022

Modified Files:
src/usr.sbin/inetd: inetd.c inetd.h parse.c

Log Message:
PR/56963: Mark Davies: inetd not configured for rpc
Move RPC includes to inetd.h


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/inetd/parse.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/inetd

2022-08-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Aug 10 03:35:39 UTC 2022

Modified Files:
src/usr.sbin/inetd: Makefile inetd.c parse.c

Log Message:
PR bin/56963 Mark Davies: inetd not configured for rpc

Instead of using negative flags to turn on positive flags, set -DRPC
in the makefile. Corrects a problem where the SunRPC code in parse.c
was accidentally left disabled.

This is a prime example of why we don't like negative flags...


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.139 -r1.140 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/inetd/parse.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/inetd/Makefile
diff -u src/usr.sbin/inetd/Makefile:1.30 src/usr.sbin/inetd/Makefile:1.31
--- src/usr.sbin/inetd/Makefile:1.30	Tue Oct 12 19:08:04 2021
+++ src/usr.sbin/inetd/Makefile	Wed Aug 10 03:35:38 2022
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
-#	$NetBSD: Makefile,v 1.30 2021/10/12 19:08:04 christos Exp $
+#	$NetBSD: Makefile,v 1.31 2022/08/10 03:35:38 dholland Exp $
 
 .include 
 
@@ -15,6 +15,9 @@ WARNS=	6
 # Enables debug printouts when in debug mode
 CPPFLAGS+=-DDEBUG_ENABLE
 
+# Enables SunRPC support
+CPPFLAGS+=-DRPC
+
 CPPFLAGS+=-DLIBWRAP
 # Use LIBWRAP_INTERNAL for libwrap checking of inetd's `internal' services.
 #CPPFLAGS+=-DLIBWRAP_INTERNAL

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.139 src/usr.sbin/inetd/inetd.c:1.140
--- src/usr.sbin/inetd/inetd.c:1.139	Sun Oct 17 04:14:49 2021
+++ src/usr.sbin/inetd/inetd.c	Wed Aug 10 03:35:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.139 2021/10/17 04:14:49 ryo Exp $	*/
+/*	$NetBSD: inetd.c,v 1.140 2022/08/10 03:35:38 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.139 2021/10/17 04:14:49 ryo Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.140 2022/08/10 03:35:38 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -193,11 +193,6 @@ __RCSID("$NetBSD: inetd.c,v 1.139 2021/1
 #include 
 #include 
 
-
-#ifndef NO_RPC
-#define RPC
-#endif
-
 #include 
 
 #ifdef RPC

Index: src/usr.sbin/inetd/parse.c
diff -u src/usr.sbin/inetd/parse.c:1.3 src/usr.sbin/inetd/parse.c:1.4
--- src/usr.sbin/inetd/parse.c:1.3	Sun May 22 11:27:37 2022
+++ src/usr.sbin/inetd/parse.c	Wed Aug 10 03:35:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.3 2022/05/22 11:27:37 andvar Exp $	*/
+/*	$NetBSD: parse.c,v 1.4 2022/08/10 03:35:38 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.3 2022/05/22 11:27:37 andvar Exp $");
+__RCSID("$NetBSD: parse.c,v 1.4 2022/08/10 03:35:38 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -91,6 +91,10 @@ __RCSID("$NetBSD: parse.c,v 1.3 2022/05/
 #include 
 #include 
 
+#ifdef RPC
+#include 
+#endif
+
 #include "inetd.h"
 
 static void	config(void);
@@ -321,7 +325,7 @@ config(void)
 if (sep->se_fd != -1)
 	register_rpc(sep);
 			} else
-#endif
+#endif /* RPC */
 			{
 if (sep->se_fd >= 0)
 	close_sep(sep);



CVS commit: src/usr.sbin/inetd

2022-08-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Aug 10 03:35:39 UTC 2022

Modified Files:
src/usr.sbin/inetd: Makefile inetd.c parse.c

Log Message:
PR bin/56963 Mark Davies: inetd not configured for rpc

Instead of using negative flags to turn on positive flags, set -DRPC
in the makefile. Corrects a problem where the SunRPC code in parse.c
was accidentally left disabled.

This is a prime example of why we don't like negative flags...


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.139 -r1.140 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/inetd/parse.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/raidframe

2022-08-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Aug 10 01:16:39 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_disks.c rf_driver.c rf_netbsdkintf.c

Log Message:
raidframe: reject invalid values for numCol and numSpares

numCol and numSpares are "int" so they can be "-1" internally,
which means negative values need to be rejected, as well as
values higher than RF_MAXCOL/RF_MAXSPARES.

explicitly nul-terminate all strings coming from userland.

some minor CSE that avoids signed arith.

this fixes issues in the RAIDFRAME_ADD_HOT_SPARE,
RAIDFRAME_CONFIGURE, RAIDFRAME_DELETE_COMPONENT,
RAIDFRAME_INCORPORATE_HOT_SPARE, and RAIDFRAME_REBUILD_IN_PLACE
ioctl commands.

Reported-by: syzbot+b584943ad1f8ab9d4...@syzkaller.appspotmail.com

https://syzkaller.appspot.com/bug?id=61e07e418261f8eec8a37a9226725fe31820edd0
https://syzkaller.appspot.com/bug?id=ca0c997b40de81c0f0b44790217731f142003149
https://syzkaller.appspot.com/bug?id=6fc452d228453494655a85264591dd9054cc0b08
https://syzkaller.appspot.com/bug?id=873f0271682713a27adc9a49dd7109c70b35fda3

XXX: pullup-8, pullup-9.

ok oster@ riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/raidframe/rf_disks.c
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/raidframe/rf_driver.c
cvs rdiff -u -r1.407 -r1.408 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_disks.c
diff -u src/sys/dev/raidframe/rf_disks.c:1.92 src/sys/dev/raidframe/rf_disks.c:1.93
--- src/sys/dev/raidframe/rf_disks.c:1.92	Sun Dec  8 12:14:40 2019
+++ src/sys/dev/raidframe/rf_disks.c	Wed Aug 10 01:16:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_disks.c,v 1.92 2019/12/08 12:14:40 mlelstv Exp $	*/
+/*	$NetBSD: rf_disks.c,v 1.93 2022/08/10 01:16:38 mrg Exp $	*/
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -60,7 +60,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.92 2019/12/08 12:14:40 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.93 2022/08/10 01:16:38 mrg Exp $");
 
 #include 
 
@@ -318,11 +318,12 @@ static int
 rf_AllocDiskStructures(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr)
 {
 	int ret;
+	size_t entries = raidPtr->numCol + RF_MAXSPARE;
 
 	/* We allocate RF_MAXSPARE on the first row so that we
 	   have room to do hot-swapping of spares */
-	raidPtr->Disks = RF_MallocAndAdd((raidPtr->numCol + RF_MAXSPARE) *
-	sizeof(*raidPtr->Disks), raidPtr->cleanupList);
+	raidPtr->Disks = RF_MallocAndAdd(
+	entries * sizeof(*raidPtr->Disks), raidPtr->cleanupList);
 	if (raidPtr->Disks == NULL) {
 		ret = ENOMEM;
 		goto fail;
@@ -330,9 +331,7 @@ rf_AllocDiskStructures(RF_Raid_t *raidPt
 
 	/* get space for device specific stuff.. */
 	raidPtr->raid_cinfo = RF_MallocAndAdd(
-	(raidPtr->numCol + RF_MAXSPARE) * sizeof(*raidPtr->raid_cinfo),
-	raidPtr->cleanupList);
-
+	entries * sizeof(*raidPtr->raid_cinfo), raidPtr->cleanupList);
 	if (raidPtr->raid_cinfo == NULL) {
 		ret = ENOMEM;
 		goto fail;
@@ -607,7 +606,7 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, cha
 	error = vn_bdev_openpath(pb, , curlwp);
 	pathbuf_destroy(pb);
 	if (error) {
-		printf("open device: %s failed!\n", diskPtr->devname);
+		printf("open device: '%s' failed: %d\n", diskPtr->devname, error);
 		if (error == ENXIO) {
 			/* the component isn't there... must be dead :-( */
 			diskPtr->status = rf_ds_failed;

Index: src/sys/dev/raidframe/rf_driver.c
diff -u src/sys/dev/raidframe/rf_driver.c:1.139 src/sys/dev/raidframe/rf_driver.c:1.140
--- src/sys/dev/raidframe/rf_driver.c:1.139	Fri Jul 23 02:35:14 2021
+++ src/sys/dev/raidframe/rf_driver.c	Wed Aug 10 01:16:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_driver.c,v 1.139 2021/07/23 02:35:14 oster Exp $	*/
+/*	$NetBSD: rf_driver.c,v 1.140 2022/08/10 01:16:38 mrg Exp $	*/
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -66,7 +66,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.139 2021/07/23 02:35:14 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.140 2022/08/10 01:16:38 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_diagnostic.h"
@@ -341,6 +341,11 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Conf
 			  (void (*) (void *)) rf_FreeAllocList,
 			  raidPtr->cleanupList);
 
+	KASSERT(cfgPtr->numCol < RF_MAXCOL);
+	KASSERT(cfgPtr->numCol >= 0);
+	KASSERT(cfgPtr->numSpare < RF_MAXSPARE);
+	KASSERT(cfgPtr->numSpare >= 0);
+
 	raidPtr->numCol = cfgPtr->numCol;
 	raidPtr->numSpare = cfgPtr->numSpare;
 

Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.407 src/sys/dev/raidframe/rf_netbsdkintf.c:1.408
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.407	Sat Apr 16 16:40:54 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Wed Aug 10 01:16:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: 

CVS commit: src/sys/dev/raidframe

2022-08-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Aug 10 01:16:39 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_disks.c rf_driver.c rf_netbsdkintf.c

Log Message:
raidframe: reject invalid values for numCol and numSpares

numCol and numSpares are "int" so they can be "-1" internally,
which means negative values need to be rejected, as well as
values higher than RF_MAXCOL/RF_MAXSPARES.

explicitly nul-terminate all strings coming from userland.

some minor CSE that avoids signed arith.

this fixes issues in the RAIDFRAME_ADD_HOT_SPARE,
RAIDFRAME_CONFIGURE, RAIDFRAME_DELETE_COMPONENT,
RAIDFRAME_INCORPORATE_HOT_SPARE, and RAIDFRAME_REBUILD_IN_PLACE
ioctl commands.

Reported-by: syzbot+b584943ad1f8ab9d4...@syzkaller.appspotmail.com

https://syzkaller.appspot.com/bug?id=61e07e418261f8eec8a37a9226725fe31820edd0
https://syzkaller.appspot.com/bug?id=ca0c997b40de81c0f0b44790217731f142003149
https://syzkaller.appspot.com/bug?id=6fc452d228453494655a85264591dd9054cc0b08
https://syzkaller.appspot.com/bug?id=873f0271682713a27adc9a49dd7109c70b35fda3

XXX: pullup-8, pullup-9.

ok oster@ riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/raidframe/rf_disks.c
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/raidframe/rf_driver.c
cvs rdiff -u -r1.407 -r1.408 src/sys/dev/raidframe/rf_netbsdkintf.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/db

2022-08-09 Thread Charlotte Koch
Module Name:src
Committed By:   charlotte
Date:   Wed Aug 10 00:28:00 UTC 2022

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

Log Message:
db(1): Don't lie in the usage message re: `-q`


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/db/db.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/db/db.c
diff -u src/usr.bin/db/db.c:1.27 src/usr.bin/db/db.c:1.28
--- src/usr.bin/db/db.c:1.27	Wed Aug 25 23:11:51 2021
+++ src/usr.bin/db/db.c	Wed Aug 10 00:28:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: db.c,v 1.27 2021/08/25 23:11:51 rillig Exp $	*/
+/*	$NetBSD: db.c,v 1.28 2022/08/10 00:28:00 charlotte Exp $	*/
 
 /*-
  * Copyright (c) 2002-2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include 
 #ifndef lint
 #ifdef __RCSID
-__RCSID("$NetBSD: db.c,v 1.27 2021/08/25 23:11:51 rillig Exp $");
+__RCSID("$NetBSD: db.c,v 1.28 2022/08/10 00:28:00 charlotte Exp $");
 #endif /* __RCSID */
 #endif /* not lint */
 
@@ -741,7 +741,7 @@ usage(void)
 "   -N   don't NUL terminate key\n"
 "   -O outsepoutput field separator string  [default: a tab]\n"
 "   -P pagesize  database page size  [default: 4096]\n"
-"   -q   quiet operation (missing keys aren't errors)\n"
+"   -q   quiet operation\n"
 "   -R   replace existing keys\n"
 "   -S visitem   items to strvis(3) encode: 'k'ey, 'v'alue, 'b'oth\n"
 "   -T visspec   options to control -S and -U; like vis(1) options\n"



CVS commit: src/usr.bin/db

2022-08-09 Thread Charlotte Koch
Module Name:src
Committed By:   charlotte
Date:   Wed Aug 10 00:28:00 UTC 2022

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

Log Message:
db(1): Don't lie in the usage message re: `-q`


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/db/db.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/mixerctl

2022-08-09 Thread Charlotte Koch
Module Name:src
Committed By:   charlotte
Date:   Wed Aug 10 00:14:22 UTC 2022

Modified Files:
src/tests/usr.bin/mixerctl: t_mixerctl.sh

Log Message:
Add a TNF copyright statement in t_mixerctl.sh


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/mixerctl/t_mixerctl.sh

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/mixerctl/t_mixerctl.sh
diff -u src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.11 src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.12
--- src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.11	Sat Dec 18 10:50:48 2021
+++ src/tests/usr.bin/mixerctl/t_mixerctl.sh	Wed Aug 10 00:14:22 2022
@@ -1,4 +1,32 @@
-# $NetBSD: t_mixerctl.sh,v 1.11 2021/12/18 10:50:48 kre Exp $
+# $NetBSD: t_mixerctl.sh,v 1.12 2022/08/10 00:14:22 charlotte Exp $
+#
+# Copyright (c) 2017 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Charlotte Koch.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
 
 audio_setup() {
 	# Open /dev/pad0 so we have a configured audio device.



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

2022-08-09 Thread Charlotte Koch
Module Name:src
Committed By:   charlotte
Date:   Wed Aug 10 00:14:22 UTC 2022

Modified Files:
src/tests/usr.bin/mixerctl: t_mixerctl.sh

Log Message:
Add a TNF copyright statement in t_mixerctl.sh


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/mixerctl/t_mixerctl.sh

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



CVS commit: src/sys/dev/ic

2022-08-09 Thread Christopher KOBAYASHI
Module Name:src
Committed By:   sekiya
Date:   Tue Aug  9 23:58:46 UTC 2022

Modified Files:
src/sys/dev/ic: dwc_gmac.c

Log Message:
Turn off AWIN_GMAC_MAC_CONF_ACS, so that all received packets retain FCS
bytes.

ether_input() can now trust M_HASFCS to accurately represent the packet
contents.

Discussed on tech-net@


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.76 src/sys/dev/ic/dwc_gmac.c:1.77
--- src/sys/dev/ic/dwc_gmac.c:1.76	Fri Aug  5 21:03:43 2022
+++ src/sys/dev/ic/dwc_gmac.c	Tue Aug  9 23:58:46 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.76 2022/08/05 21:03:43 sekiya Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.77 2022/08/09 23:58:46 sekiya Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.76 2022/08/05 21:03:43 sekiya Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.77 2022/08/09 23:58:46 sekiya Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -803,7 +803,6 @@ dwc_gmac_miibus_statchg(struct ifnet *if
 	conf |= AWIN_GMAC_MAC_CONF_FRAMEBURST
 	| AWIN_GMAC_MAC_CONF_DISABLERXOWN
 	| AWIN_GMAC_MAC_CONF_DISABLEJABBER
-	| AWIN_GMAC_MAC_CONF_ACS
 	| AWIN_GMAC_MAC_CONF_RXENABLE
 	| AWIN_GMAC_MAC_CONF_TXENABLE;
 	switch (IFM_SUBTYPE(mii->mii_media_active)) {
@@ -1229,8 +1228,6 @@ dwc_gmac_rx_intr(struct dwc_gmac_softc *
 	struct mbuf *m, *mnew;
 	int i, len, error;
 
-	uint16_t etype;
-
 	mutex_enter(>sc_rxq.r_mtx);
 	for (i = sc->sc_rxq.r_cur; ; i = RX_NEXT(i)) {
 		bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map,
@@ -1313,29 +1310,8 @@ dwc_gmac_rx_intr(struct dwc_gmac_softc *
 		/* finalize mbuf */
 		m->m_pkthdr.len = m->m_len = len;
 		m_set_rcvif(m, ifp);
+		m->m_flags |= M_HASFCS;
 
-#define ETYPE_OFFSET 20
-		etype = (m->m_data[ETYPE_OFFSET] << 8) + m->m_data[ETYPE_OFFSET+1];
-
-		/*
-		 * The hardware doesn't trim the four FCS bytes for us, so
-		 * we need to trim it ourselves.
-		 * Having the upper layer remove it by passing M_HASFCS breaks
-		 * protocols that don't have FCS bytes at the end of the packet
-		 * (AppleTalk, for example), so we do it here instead.
-		 */
-
-		switch (etype) {
-			case ETHERTYPE_ATALK:
-			case ETHERTYPE_AARP:
-/* No FCS removal needed */
-break;
-			default:
-/* remove FCS */
-m_adj(m, -ETHER_CRC_LEN);
-break;
-		}
-	
 		if_percpuq_enqueue(sc->sc_ipq, m);
 
 skip:



CVS commit: src/sys/dev/ic

2022-08-09 Thread Christopher KOBAYASHI
Module Name:src
Committed By:   sekiya
Date:   Tue Aug  9 23:58:46 UTC 2022

Modified Files:
src/sys/dev/ic: dwc_gmac.c

Log Message:
Turn off AWIN_GMAC_MAC_CONF_ACS, so that all received packets retain FCS
bytes.

ether_input() can now trust M_HASFCS to accurately represent the packet
contents.

Discussed on tech-net@


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/ic/dwc_gmac.c

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



CVS commit: src/sys/modules

2022-08-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Aug  9 20:05:14 UTC 2022

Modified Files:
src/sys/modules/ffs: Makefile
src/sys/modules/ufs: Makefile

Log Message:
Now that UFS_DIRHASH is default for biuilt-in file system modules, we
need to update the loadable module builds, too.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/modules/ffs/Makefile
cvs rdiff -u -r1.7 -r1.8 src/sys/modules/ufs/Makefile

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



CVS commit: src/sys/modules

2022-08-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Aug  9 20:05:14 UTC 2022

Modified Files:
src/sys/modules/ffs: Makefile
src/sys/modules/ufs: Makefile

Log Message:
Now that UFS_DIRHASH is default for biuilt-in file system modules, we
need to update the loadable module builds, too.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/modules/ffs/Makefile
cvs rdiff -u -r1.7 -r1.8 src/sys/modules/ufs/Makefile

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

Modified files:

Index: src/sys/modules/ffs/Makefile
diff -u src/sys/modules/ffs/Makefile:1.21 src/sys/modules/ffs/Makefile:1.22
--- src/sys/modules/ffs/Makefile:1.21	Sat Jan  8 01:58:16 2022
+++ src/sys/modules/ffs/Makefile	Tue Aug  9 20:05:14 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.21 2022/01/08 01:58:16 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.22 2022/08/09 20:05:14 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -6,8 +6,7 @@
 
 KMOD=	ffs
 CPPFLAGS+=	-DFFS_EI -DWAPBL -DAPPLE_UFS -DQUOTA -DQUOTA2
-CPPFLAGS+=	-DUFS_EXTATTR -DUFS_ACL
-#CPPFLAGS+=	-DUFS_DIRHASH	# disabled - suspected of corrupting memory
+CPPFLAGS+=	-DUFS_EXTATTR -DUFS_ACL -DUFS_DIRHASH
 
 CWARNFLAGS.clang=	-Wno-conversion
 COPTS.ffs_appleufs.c+=   ${NO_ADDR_OF_PACKED_MEMBER}

Index: src/sys/modules/ufs/Makefile
diff -u src/sys/modules/ufs/Makefile:1.7 src/sys/modules/ufs/Makefile:1.8
--- src/sys/modules/ufs/Makefile:1.7	Sat Jan  8 02:00:49 2022
+++ src/sys/modules/ufs/Makefile	Tue Aug  9 20:05:14 2022
@@ -1,12 +1,11 @@
-#	$NetBSD: Makefile,v 1.7 2022/01/08 02:00:49 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.8 2022/08/09 20:05:14 pgoyette Exp $
 
 .include "../Makefile.inc"
 
 KMOD=	ufs
 
 CPPFLAGS+=	-DFFS_EI -DWAPBL -DAPPLE_UFS -DQUOTA -DQUOTA2
-CPPFLAGS+=	-DUFS_EXTATTR -DUFS_ACL
-#CPPFLAGS+=	-DUFS_DIRHASH	# disabled - suspected of corrupting memory
+CPPFLAGS+=	-DUFS_EXTATTR -DUFS_ACL -DUFS_DIRHASH
 
 CWARNFLAGS.clang=	-Wno-conversion
 



CVS commit: src/sys/dev/pci

2022-08-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  9 12:42:05 UTC 2022

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

Log Message:
virtio(4): Move comment for virtio_vq_intr.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/pci/virtio.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/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.55 src/sys/dev/pci/virtio.c:1.56
--- src/sys/dev/pci/virtio.c:1.55	Sat Jun 18 22:11:01 2022
+++ src/sys/dev/pci/virtio.c	Tue Aug  9 12:42:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.55 2022/06/18 22:11:01 andvar Exp $	*/
+/*	$NetBSD: virtio.c,v 1.56 2022/08/09 12:42:05 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.55 2022/06/18 22:11:01 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.56 2022/08/09 12:42:05 riastradh Exp $");
 
 #include 
 #include 
@@ -465,13 +465,6 @@ vq_sync_indirect(struct virtio_softc *sc
 			ops);
 }
 
-/*
- * Can be used as sc_intrhand.
- */
-/*
- * Scan vq, bus_dmamap_sync for the vqs (not for the payload),
- * and calls (*vq_done)() if some entries are consumed.
- */
 bool
 virtio_vq_is_enqueued(struct virtio_softc *sc, struct virtqueue *vq)
 {
@@ -486,6 +479,12 @@ virtio_vq_is_enqueued(struct virtio_soft
 	return (vq->vq_used_idx != virtio_rw16(sc, vq->vq_used->idx)) ? 1 : 0;
 }
 
+/*
+ * Scan vq, bus_dmamap_sync for the vqs (not for the payload),
+ * and calls (*vq_done)() if some entries are consumed.
+ *
+ * Can be used as sc_intrhand.
+ */
 int
 virtio_vq_intr(struct virtio_softc *sc)
 {



CVS commit: src/sys/dev/pci

2022-08-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  9 12:42:05 UTC 2022

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

Log Message:
virtio(4): Move comment for virtio_vq_intr.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/pci/virtio.c

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



CVS commit: src/bin/df

2022-08-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Aug  9 08:14:03 UTC 2022

Modified Files:
src/bin/df: df.c

Log Message:
Sync usage with man page.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/bin/df/df.c

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

Modified files:

Index: src/bin/df/df.c
diff -u src/bin/df/df.c:1.100 src/bin/df/df.c:1.101
--- src/bin/df/df.c:1.100	Mon Aug  8 16:50:35 2022
+++ src/bin/df/df.c	Tue Aug  9 08:14:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: df.c,v 1.100 2022/08/08 16:50:35 kre Exp $ */
+/*	$NetBSD: df.c,v 1.101 2022/08/09 08:14:03 wiz Exp $ */
 
 /*
  * Copyright (c) 1980, 1990, 1993, 1994
@@ -45,7 +45,7 @@ __COPYRIGHT(
 #if 0
 static char sccsid[] = "@(#)df.c	8.7 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: df.c,v 1.100 2022/08/08 16:50:35 kre Exp $");
+__RCSID("$NetBSD: df.c,v 1.101 2022/08/09 08:14:03 wiz Exp $");
 #endif
 #endif /* not lint */
 
@@ -623,7 +623,7 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-	"Usage: %s [-alnW] [-G|-Pbk|-bfgHhikm] [-t type] [file | "
+	"Usage: %s [-aclnW] [-G|-bkP|-bfgHhikmN] [-t type] [file | "
 	"file_system]...\n",
 	getprogname());
 	exit(1);



CVS commit: src/bin/df

2022-08-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Aug  9 08:14:03 UTC 2022

Modified Files:
src/bin/df: df.c

Log Message:
Sync usage with man page.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/bin/df/df.c

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



CVS commit: src/bin/df

2022-08-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Aug  9 08:13:56 UTC 2022

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

Log Message:
Sort options, fix macro, add RCS Id.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/bin/df/df.1

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



CVS commit: src/bin/df

2022-08-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Aug  9 08:13:56 UTC 2022

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

Log Message:
Sort options, fix macro, add RCS Id.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/bin/df/df.1

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

Modified files:

Index: src/bin/df/df.1
diff -u src/bin/df/df.1:1.57 src/bin/df/df.1:1.58
--- src/bin/df/df.1:1.57	Mon Aug  8 16:50:35 2022
+++ src/bin/df/df.1	Tue Aug  9 08:13:56 2022
@@ -1,3 +1,5 @@
+.\" $NetBSD: df.1,v 1.58 2022/08/09 08:13:56 wiz Exp $
+.\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -36,7 +38,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl aclnW
-.Op Fl G | Fl Pbk | Fl bfgHhikmN
+.Op Fl G | Fl bkP | Fl bfgHhikmN
 .Op Fl t Ar type
 .Oo Ar file | Ar file_system Oc Ns ...
 .Sh DESCRIPTION
@@ -246,7 +248,7 @@ If more than one of
 .Fl h ,
 .Fl k
 or
-.FL m
+.Fl m
 is given, the last of those specified is used.
 .Sh ENVIRONMENT
 .Bl -tag -width BLOCKSIZE



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

2022-08-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Aug  9 08:09:44 UTC 2022

Modified Files:
src/sys/arch/mac68k/dev: grf_subr.c

Log Message:
Switch from ``(1 << depth) color'' to ``(depth)-bpp color'' in
attach message.

For depth == 32, fix ``0 color'', and prevent ambiguous ``16Mi color''.

I don't know whether there is 24-bpp graphic card for mac68k or not,
although.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/mac68k/dev/grf_subr.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/mac68k/dev

2022-08-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Aug  9 08:09:44 UTC 2022

Modified Files:
src/sys/arch/mac68k/dev: grf_subr.c

Log Message:
Switch from ``(1 << depth) color'' to ``(depth)-bpp color'' in
attach message.

For depth == 32, fix ``0 color'', and prevent ambiguous ``16Mi color''.

I don't know whether there is 24-bpp graphic card for mac68k or not,
although.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/mac68k/dev/grf_subr.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/mac68k/dev/grf_subr.c
diff -u src/sys/arch/mac68k/dev/grf_subr.c:1.24 src/sys/arch/mac68k/dev/grf_subr.c:1.25
--- src/sys/arch/mac68k/dev/grf_subr.c:1.24	Sat Aug  7 16:18:57 2021
+++ src/sys/arch/mac68k/dev/grf_subr.c	Tue Aug  9 08:09:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_subr.c,v 1.24 2021/08/07 16:18:57 thorpej Exp $	*/
+/*	$NetBSD: grf_subr.c,v 1.25 2022/08/09 08:09:44 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: grf_subr.c,v 1.24 2021/08/07 16:18:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_subr.c,v 1.25 2022/08/09 08:09:44 rin Exp $");
 
 #include 
 #include 
@@ -54,7 +54,7 @@ grf_establish(struct grfbus_softc *sc, n
 	if (gm->psize == 1)
 		printf("monochrome\n");
 	else
-		printf("%d color\n", 1 << gm->psize);
+		printf("%hu-bpp color\n", gm->psize);
 
 	/* Attach grf semantics to the hardware. */
 	ga.ga_name = "grf";



CVS commit: src

2022-08-09 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Aug  9 08:03:22 UTC 2022

Modified Files:
src/share/man/man7: sysctl.7
src/sys/netipsec: key.c key_var.h

Log Message:
Add sysctl entry to improve interconnectivity to some VPN appliances, pointed 
out by seil-team@IIJ.

If we want to allow different identifier types on IDii and IDir, set
net.key.allow_different_idtype=1.  Default(=0) is the same as before.


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/share/man/man7/sysctl.7
cvs rdiff -u -r1.275 -r1.276 src/sys/netipsec/key.c
cvs rdiff -u -r1.5 -r1.6 src/sys/netipsec/key_var.h

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

Modified files:

Index: src/share/man/man7/sysctl.7
diff -u src/share/man/man7/sysctl.7:1.157 src/share/man/man7/sysctl.7:1.158
--- src/share/man/man7/sysctl.7:1.157	Mon Jul 25 14:46:53 2022
+++ src/share/man/man7/sysctl.7	Tue Aug  9 08:03:22 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysctl.7,v 1.157 2022/07/25 14:46:53 pgoyette Exp $
+.\"	$NetBSD: sysctl.7,v 1.158 2022/08/09 08:03:22 knakahara Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
 .\"
-.Dd July 25, 2022
+.Dd August 9, 2022
 .Dt SYSCTL 7
 .Os
 .Sh NAME
@@ -2143,6 +2143,7 @@ The currently defined variable and names
 .It esp_keymin	integer	yes
 .It esp_auth	integer	yes
 .It ah_keymin	integer	yes
+.It allow_different_idtype	boolean	yes
 .El
 The variables are as follows:
 .Bl -tag -width "123456"
@@ -2192,6 +2193,10 @@ on ACQUIRE PF_KEY message.
 Minimum AH key length, in bits,
 The value is used when the kernel creates proposal payload
 on ACQUIRE PF_KEY message.
+.It Li allow_different_idtype
+A boolean that allow or disallow different identifier types
+on IDii and IDir.
+Allowing that can improve interconnectivity to some VPN appliances.
 .El
 .It Li net.local ( Dv PF_LOCAL )
 Get or set various global information about

Index: src/sys/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.275 src/sys/netipsec/key.c:1.276
--- src/sys/netipsec/key.c:1.275	Tue May 24 20:50:20 2022
+++ src/sys/netipsec/key.c	Tue Aug  9 08:03:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.275 2022/05/24 20:50:20 andvar Exp $	*/
+/*	$NetBSD: key.c,v 1.276 2022/08/09 08:03:22 knakahara 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.275 2022/05/24 20:50:20 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.276 2022/08/09 08:03:22 knakahara Exp $");
 
 /*
  * This code is referred to RFC 2367
@@ -534,6 +534,7 @@ static const int maxsize[] = {
 static int ipsec_esp_keymin = 256;
 static int ipsec_esp_auth = 0;
 static int ipsec_ah_keymin = 128;
+static bool ipsec_allow_different_idtype = false;
 
 #ifdef SYSCTL_DECL
 SYSCTL_DECL(_net_key);
@@ -6171,7 +6172,14 @@ key_setident(struct secashead *sah, stru
 	if (idsrc->sadb_ident_type != iddst->sadb_ident_type) {
 		IPSECLOG(LOG_DEBUG, "ident type mismatched src %u, dst %u.\n",
 		idsrc->sadb_ident_type, iddst->sadb_ident_type);
-		return EINVAL;
+		/*
+		 * Some VPN appliances(e.g. NetScreen) can send different
+		 * identifier types on IDii and IDir, so be able to allow
+		 * such message.
+		 */
+		if (!ipsec_allow_different_idtype) {
+			return EINVAL;
+		}
 	}
 
 	switch (idsrc->sadb_ident_type) {
@@ -9034,6 +9042,11 @@ sysctl_net_keyv2_setup(struct sysctllog 
 		   SYSCTL_DESCR("PF_KEY statistics"),
 		   sysctl_net_key_stats, 0, NULL, 0,
 		   CTL_NET, IPSEC_PFKEY, CTL_CREATE, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		   CTLTYPE_BOOL, "allow_different_idtype", NULL,
+		   NULL, 0, _allow_different_idtype, 0,
+		   CTL_NET, IPSEC_PFKEY, KEYCTL_ALLOW_DIFFERENT_IDTYPE, CTL_EOL);
 }
 
 /*

Index: src/sys/netipsec/key_var.h
diff -u src/sys/netipsec/key_var.h:1.5 src/sys/netipsec/key_var.h:1.6
--- src/sys/netipsec/key_var.h:1.5	Sat Apr 28 13:23:17 2018
+++ src/sys/netipsec/key_var.h	Tue Aug  9 08:03:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: key_var.h,v 1.5 2018/04/28 13:23:17 maxv Exp $	*/
+/*	$NetBSD: key_var.h,v 1.6 2022/08/09 08:03:22 knakahara Exp $	*/
 /*	$FreeBSD: key_var.h,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$KAME: key_var.h,v 1.11 2001/09/12 23:05:07 sakane Exp $	*/
 
@@ -49,7 +49,8 @@
 #define KEYCTL_PREFERED_OLDSA		12
 #define KEYCTL_DUMPSA			13
 #define KEYCTL_DUMPSP			14
-#define KEYCTL_MAXID			15
+#define KEYCTL_ALLOW_DIFFERENT_IDTYPE	15
+#define KEYCTL_MAXID			16
 
 #ifdef _KERNEL
 #define _ARRAYLEN(p) (sizeof(p)/sizeof(p[0]))



CVS commit: src

2022-08-09 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Aug  9 08:03:22 UTC 2022

Modified Files:
src/share/man/man7: sysctl.7
src/sys/netipsec: key.c key_var.h

Log Message:
Add sysctl entry to improve interconnectivity to some VPN appliances, pointed 
out by seil-team@IIJ.

If we want to allow different identifier types on IDii and IDir, set
net.key.allow_different_idtype=1.  Default(=0) is the same as before.


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/share/man/man7/sysctl.7
cvs rdiff -u -r1.275 -r1.276 src/sys/netipsec/key.c
cvs rdiff -u -r1.5 -r1.6 src/sys/netipsec/key_var.h

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



CVS commit: src/usr.bin/db

2022-08-09 Thread Charlotte Koch
Module Name:src
Committed By:   charlotte
Date:   Tue Aug  9 07:56:19 UTC 2022

Modified Files:
src/usr.bin/db: db.1

Log Message:
PR bin/51878: db(1)'s man page to describe the actual behavior of '-q'


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/db/db.1

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/db/db.1
diff -u src/usr.bin/db/db.1:1.27 src/usr.bin/db/db.1:1.28
--- src/usr.bin/db/db.1:1.27	Fri Feb 17 11:43:24 2012
+++ src/usr.bin/db/db.1	Tue Aug  9 07:56:19 2022
@@ -1,4 +1,4 @@
-.\" 	$NetBSD: db.1,v 1.27 2012/02/17 11:43:24 wiz Exp $
+.\" 	$NetBSD: db.1,v 1.28 2022/08/09 07:56:19 charlotte Exp $
 .\"
 .\" Copyright (c) 2002-2009,2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -196,7 +196,7 @@ options may be useful to encode the NUL 
 .
 .It Fl q
 Quiet operation.
-In read mode, missing keys are not considered to be an error.
+In read mode, missing keys are considered to be an error.
 In delete
 .Pq Fl d
 and write



CVS commit: src/usr.bin/db

2022-08-09 Thread Charlotte Koch
Module Name:src
Committed By:   charlotte
Date:   Tue Aug  9 07:56:19 UTC 2022

Modified Files:
src/usr.bin/db: db.1

Log Message:
PR bin/51878: db(1)'s man page to describe the actual behavior of '-q'


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/db/db.1

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



CVS commit: src/doc

2022-08-09 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Aug  9 07:39:21 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Minor alteration to the description of what df -b does (plus tiny reformat)


To generate a diff of this commit:
cvs rdiff -u -r1.2895 -r1.2896 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/doc

2022-08-09 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Aug  9 07:39:21 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Minor alteration to the description of what df -b does (plus tiny reformat)


To generate a diff of this commit:
cvs rdiff -u -r1.2895 -r1.2896 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.2895 src/doc/CHANGES:1.2896
--- src/doc/CHANGES:1.2895	Tue Aug  9 06:57:30 2022
+++ src/doc/CHANGES	Tue Aug  9 07:39:21 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2895 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2896 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -635,6 +635,6 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	kernel: Enable UFS_DIRHASH optimization if the architecture or
 		machine-specific kernel config file can use 128MB of RAM or
 		more.  [simonb 20220807]
-	df(1): Add -b (set blocksize), -H (-h using SI units), -N
-		(suppress the header line), and -f (show only free space)
+	df(1): Add -b (output unit: blocks; 512), -H (-h using SI units),
+		-N (suppress the header line), and -f (show only free space)
 		options.  [kre 20220808]



CVS commit: src/doc

2022-08-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Aug  9 06:57:30 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
CHANGES: update clone entry for later changes


To generate a diff of this commit:
cvs rdiff -u -r1.2894 -r1.2895 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/doc

2022-08-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Aug  9 06:57:30 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
CHANGES: update clone entry for later changes


To generate a diff of this commit:
cvs rdiff -u -r1.2894 -r1.2895 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.2894 src/doc/CHANGES:1.2895
--- src/doc/CHANGES:1.2894	Mon Aug  8 20:47:00 2022
+++ src/doc/CHANGES	Tue Aug  9 06:57:30 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2894 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2895 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -630,7 +630,7 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	gcc(1): Import GCC 10.4.  [mrg 20220722]
 	kernel: Give threads created by the Solaris compatibility layer
 		(i.e. ZFS/DTrace) better names.  [riastradh 20220730]
-	clone(2): Make clone and __clone only available when _GNU_SOURCE
+	clone(2): Make clone only available when _GNU_SOURCE
 		is defined.  [wiz 20220801]
 	kernel: Enable UFS_DIRHASH optimization if the architecture or
 		machine-specific kernel config file can use 128MB of RAM or



CVS commit: src/sys/kern

2022-08-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  8 22:31:45 UTC 2022

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

Log Message:
rasctl(2): Avoid arithmetic overflow.

Reported-by: syzbot+40b6085d020ae47a6...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=8fb9b5dee9b056e4f8ad3b937dc5be1296608c5f


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/kern/kern_ras.c

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



CVS commit: src/sys/kern

2022-08-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  8 22:31:45 UTC 2022

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

Log Message:
rasctl(2): Avoid arithmetic overflow.

Reported-by: syzbot+40b6085d020ae47a6...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=8fb9b5dee9b056e4f8ad3b937dc5be1296608c5f


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/kern/kern_ras.c

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

Modified files:

Index: src/sys/kern/kern_ras.c
diff -u src/sys/kern/kern_ras.c:1.41 src/sys/kern/kern_ras.c:1.42
--- src/sys/kern/kern_ras.c:1.41	Wed Aug  3 09:40:25 2022
+++ src/sys/kern/kern_ras.c	Mon Aug  8 22:31:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ras.c,v 1.41 2022/08/03 09:40:25 riastradh Exp $	*/
+/*	$NetBSD: kern_ras.c,v 1.42 2022/08/08 22:31:45 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_ras.c,v 1.41 2022/08/03 09:40:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ras.c,v 1.42 2022/08/08 22:31:45 riastradh Exp $");
 
 #include 
 #include 
@@ -218,16 +218,15 @@ static int
 ras_purge(void *addr, size_t len)
 {
 	struct ras *rp, **link;
-	void *endaddr;
 	proc_t *p;
 
-	endaddr = (char *)addr + len;
 	p = curproc;
 
 	mutex_enter(>p_auxlock);
 	link = >p_raslist;
 	for (rp = *link; rp != NULL; link = >ras_next, rp = *link) {
-		if (addr == rp->ras_startaddr && endaddr == rp->ras_endaddr)
+		if (addr == rp->ras_startaddr &&
+		(char *)rp->ras_endaddr - (char *)rp->ras_startaddr == len)
 			break;
 	}
 	if (rp != NULL) {



CVS commit: src/doc

2022-08-08 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Aug  8 20:47:00 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Capitalize POSIX.


To generate a diff of this commit:
cvs rdiff -u -r1.2893 -r1.2894 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.2893 src/doc/CHANGES:1.2894
--- src/doc/CHANGES:1.2893	Mon Aug  8 20:43:31 2022
+++ src/doc/CHANGES	Mon Aug  8 20:47:00 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2893 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2894 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -626,7 +626,7 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	mfii(4): Support Newer devices up to SAS39{08,16} (Aero).
 		[msaitoh 20220716]
 	realpath(1): Added -e and -E options for compat with planned
-		posix requirement (made the default be -E).  [kre 20220721]
+		POSIX requirement (made the default be -E).  [kre 20220721]
 	gcc(1): Import GCC 10.4.  [mrg 20220722]
 	kernel: Give threads created by the Solaris compatibility layer
 		(i.e. ZFS/DTrace) better names.  [riastradh 20220730]



CVS commit: src/doc

2022-08-08 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Aug  8 20:47:00 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Capitalize POSIX.


To generate a diff of this commit:
cvs rdiff -u -r1.2893 -r1.2894 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/doc

2022-08-08 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Aug  8 20:43:31 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
doc: Recent changes from several developers


To generate a diff of this commit:
cvs rdiff -u -r1.2892 -r1.2893 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.2892 src/doc/CHANGES:1.2893
--- src/doc/CHANGES:1.2892	Thu Jul 21 09:56:34 2022
+++ src/doc/CHANGES	Mon Aug  8 20:43:31 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2892 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2893 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -627,3 +627,14 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		[msaitoh 20220716]
 	realpath(1): Added -e and -E options for compat with planned
 		posix requirement (made the default be -E).  [kre 20220721]
+	gcc(1): Import GCC 10.4.  [mrg 20220722]
+	kernel: Give threads created by the Solaris compatibility layer
+		(i.e. ZFS/DTrace) better names.  [riastradh 20220730]
+	clone(2): Make clone and __clone only available when _GNU_SOURCE
+		is defined.  [wiz 20220801]
+	kernel: Enable UFS_DIRHASH optimization if the architecture or
+		machine-specific kernel config file can use 128MB of RAM or
+		more.  [simonb 20220807]
+	df(1): Add -b (set blocksize), -H (-h using SI units), -N
+		(suppress the header line), and -f (show only free space)
+		options.  [kre 20220808]



CVS commit: src/doc

2022-08-08 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Aug  8 20:43:31 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
doc: Recent changes from several developers


To generate a diff of this commit:
cvs rdiff -u -r1.2892 -r1.2893 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/usr.bin/make/unit-tests

2022-08-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Aug  8 19:53:28 UTC 2022

Modified Files:
src/usr.bin/make/unit-tests: parse-var.mk

Log Message:
tests/make: document history of bug in parsing unbalanced expressions

The bug was introduced in var.c 1.323, which merged two flags that
sounded as if they had been exact opposites: VAR_NOSUBST (later named
VARE_NOSUBST) and VARE_WANTRES.

Before that commit, the branch where make only counted braces instead of
properly parsing the nested expression was only taken in the modifiers
':@var@body@' and '::=', but not in ':S' and ':C'.

After merging the two flags, the modifier parts of ':S' and ':C' had to
be balanced as well, otherwise parsing would fail in cases where the
expression was only parsed, not evaluated.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/parse-var.mk

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/make/unit-tests/parse-var.mk
diff -u src/usr.bin/make/unit-tests/parse-var.mk:1.3 src/usr.bin/make/unit-tests/parse-var.mk:1.4
--- src/usr.bin/make/unit-tests/parse-var.mk:1.3	Mon Aug  8 18:23:30 2022
+++ src/usr.bin/make/unit-tests/parse-var.mk	Mon Aug  8 19:53:28 2022
@@ -1,4 +1,4 @@
-# $NetBSD: parse-var.mk,v 1.3 2022/08/08 18:23:30 rillig Exp $
+# $NetBSD: parse-var.mk,v 1.4 2022/08/08 19:53:28 rillig Exp $
 #
 # Tests for parsing variable expressions.
 
@@ -14,8 +14,9 @@ VAR.${:U param }=	value
 .endif
 
 
-# Before var.c 1.1028 from 2022-08-08, the exact way of parsing an expression
-# depended on whether the expression was actually evaluated or merely parsed.
+# Since var.c 1.323 from 202-07-26 18:11 and before var.c 1.1028 from
+# 2022-08-08, the exact way of parsing an expression depended on whether the
+# expression was actually evaluated or merely parsed.
 #
 # If it was evaluated, nested expressions were parsed correctly, parsing each
 # modifier according to its exact definition (see varmod.mk).



CVS commit: src/usr.bin/make/unit-tests

2022-08-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Aug  8 19:53:28 UTC 2022

Modified Files:
src/usr.bin/make/unit-tests: parse-var.mk

Log Message:
tests/make: document history of bug in parsing unbalanced expressions

The bug was introduced in var.c 1.323, which merged two flags that
sounded as if they had been exact opposites: VAR_NOSUBST (later named
VARE_NOSUBST) and VARE_WANTRES.

Before that commit, the branch where make only counted braces instead of
properly parsing the nested expression was only taken in the modifiers
':@var@body@' and '::=', but not in ':S' and ':C'.

After merging the two flags, the modifier parts of ':S' and ':C' had to
be balanced as well, otherwise parsing would fail in cases where the
expression was only parsed, not evaluated.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/parse-var.mk

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



CVS commit: src/sys/sys

2022-08-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Aug  8 18:55:18 UTC 2022

Modified Files:
src/sys/sys: endian.h

Log Message:
sys/endian.h: fix typo in comment

Came here because lint complained about non-constant case expressions in
sys/arch/xen/xen/xennet_checksum.c, line 111 and 122, which read:

case htons(ETHERTYPE_IP):
case htons(ETHERTYPE_IPV6):

POSIX says:

On some implementations, these functions are defined as macros.

NetBSD implements these functions as macros, and on little-endian platforms,
as well as in lint mode, the macros expand to function calls.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/sys/endian.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/sys/endian.h
diff -u src/sys/sys/endian.h:1.30 src/sys/sys/endian.h:1.31
--- src/sys/sys/endian.h:1.30	Sat Feb 27 21:37:35 2016
+++ src/sys/sys/endian.h	Mon Aug  8 18:55:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $	*/
+/*	$NetBSD: endian.h,v 1.31 2022/08/08 18:55:18 rillig Exp $	*/
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -120,7 +120,7 @@ __END_DECLS
 #define	HTONL(x)	(void) (x)
 #define	HTONS(x)	(void) (x)
 
-#else	/* LITTLE_ENDIAN || !defined(__lint__) */
+#else	/* LITTLE_ENDIAN || defined(__lint__) */
 
 #define	ntohl(x)	bswap32(__CAST(uint32_t, (x)))
 #define	ntohs(x)	bswap16(__CAST(uint16_t, (x)))
@@ -131,7 +131,7 @@ __END_DECLS
 #define	NTOHS(x)	(x) = ntohs(__CAST(uint16_t, (x)))
 #define	HTONL(x)	(x) = htonl(__CAST(uint32_t, (x)))
 #define	HTONS(x)	(x) = htons(__CAST(uint16_t, (x)))
-#endif	/* LITTLE_ENDIAN || !defined(__lint__) */
+#endif	/* LITTLE_ENDIAN || defined(__lint__) */
 
 /*
  * Macros to convert to a specific endianness.



CVS commit: src/sys/sys

2022-08-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Aug  8 18:55:18 UTC 2022

Modified Files:
src/sys/sys: endian.h

Log Message:
sys/endian.h: fix typo in comment

Came here because lint complained about non-constant case expressions in
sys/arch/xen/xen/xennet_checksum.c, line 111 and 122, which read:

case htons(ETHERTYPE_IP):
case htons(ETHERTYPE_IPV6):

POSIX says:

On some implementations, these functions are defined as macros.

NetBSD implements these functions as macros, and on little-endian platforms,
as well as in lint mode, the macros expand to function calls.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/sys/endian.h

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



CVS commit: src/usr.bin/make

2022-08-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Aug  8 18:23:31 UTC 2022

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: parse-var.exp parse-var.mk
var-eval-short.exp varmod-defined.exp varname-dot-suffixes.exp

Log Message:
make: fix parsing of modifiers containing unbalanced subexpressions


To generate a diff of this commit:
cvs rdiff -u -r1.1027 -r1.1028 src/usr.bin/make/var.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/parse-var.exp \
src/usr.bin/make/unit-tests/parse-var.mk
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/var-eval-short.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-defined.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varname-dot-suffixes.exp

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/make/var.c
diff -u src/usr.bin/make/var.c:1.1027 src/usr.bin/make/var.c:1.1028
--- src/usr.bin/make/var.c:1.1027	Fri Aug  5 20:59:54 2022
+++ src/usr.bin/make/var.c	Mon Aug  8 18:23:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1027 2022/08/05 20:59:54 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1028 2022/08/08 18:23:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1027 2022/08/05 20:59:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1028 2022/08/08 18:23:30 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -2131,43 +2131,33 @@ ParseModifierPartExpr(const char **pp, L
 	*pp = p;
 }
 
-/*
- * In a part of a modifier, parse a subexpression but don't evaluate it.
- *
- * XXX: This whole block is very similar to Var_Parse with VARE_PARSE_ONLY.
- * There may be subtle edge cases though that are not yet covered in the unit
- * tests and that are parsed differently, depending on whether they are
- * evaluated or not.
- *
- * This subtle difference is not documented in the manual page, neither is
- * the difference between parsing ':D' and ':M' documented.  No code should
- * ever depend on these details, but who knows.
- */
+/* In a part of a modifier, parse a subexpression but don't evaluate it. */
 static void
 ParseModifierPartDollar(const char **pp, LazyBuf *part)
 {
 	const char *p = *pp;
-	const char *start = *pp;
 
 	if (p[1] == '(' || p[1] == '{') {
-		char startc = p[1];
-		int endc = startc == '(' ? ')' : '}';
-		int depth = 1;
-
-		for (p += 2; *p != '\0' && depth > 0; p++) {
-			if (p[-1] != '\\') {
-if (*p == startc)
-	depth++;
-if (*p == endc)
-	depth--;
-			}
-		}
-		LazyBuf_AddBytesBetween(part, start, p);
-		*pp = p;
+		FStr unused;
+		Var_Parse(, SCOPE_GLOBAL, VARE_PARSE_ONLY, );
+		/* TODO: handle errors */
+		FStr_Done();
 	} else {
-		LazyBuf_Add(part, *start);
-		*pp = p + 1;
+		/*
+		 * Only skip the '$' but not the next character; see
+		 * ParseModifierPartSubst, the case for "Unescaped '$' at
+		 * end", which also doesn't skip '$' + delimiter.  That is a
+		 * hack as well, but for now it's consistent in both cases.
+		 */
+		p++;
 	}
+
+	/*
+	 * XXX: There should be no need to add anything to the buffer, as it
+	 * will be discarded anyway.
+	 */
+	LazyBuf_AddBytesBetween(part, *pp, p);
+	*pp = p;
 }
 
 /* See ParseModifierPart for the documentation. */
@@ -4498,6 +4488,8 @@ Var_Parse(const char **pp, GNode *scope,
 	if (Var_Parse_FastLane(pp, emode, out_val))
 		return VPR_OK;
 
+	/* TODO: Reduce computations in parse-only mode. */
+
 	DEBUG2(VAR, "Var_Parse: %s (%s)\n", start, VarEvalMode_Name[emode]);
 
 	*out_val = FStr_InitRefer(NULL);
@@ -4524,7 +4516,7 @@ Var_Parse(const char **pp, GNode *scope,
 	}
 
 	expr.name = v->name.str;
-	if (v->inUse) {
+	if (v->inUse && VarEvalMode_ShouldEval(emode)) {
 		if (scope->fname != NULL) {
 			fprintf(stderr, "In a command near ");
 			PrintLocation(stderr, false, scope);

Index: src/usr.bin/make/unit-tests/parse-var.exp
diff -u src/usr.bin/make/unit-tests/parse-var.exp:1.2 src/usr.bin/make/unit-tests/parse-var.exp:1.3
--- src/usr.bin/make/unit-tests/parse-var.exp:1.2	Sat Aug  6 21:26:05 2022
+++ src/usr.bin/make/unit-tests/parse-var.exp	Mon Aug  8 18:23:30 2022
@@ -1,5 +1 @@
-make: Unfinished modifier for "BRACE_GROUP" (',' missing)
-make: "parse-var.mk" line 47: Malformed conditional (0 && ${BRACE_GROUP:S,${BRACE_PAIR:S,{,{{,},,})
-make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
-exit status 1
+exit status 0
Index: src/usr.bin/make/unit-tests/parse-var.mk
diff -u src/usr.bin/make/unit-tests/parse-var.mk:1.2 src/usr.bin/make/unit-tests/parse-var.mk:1.3
--- src/usr.bin/make/unit-tests/parse-var.mk:1.2	Sat Aug  6 21:26:05 2022
+++ src/usr.bin/make/unit-tests/parse-var.mk	Mon Aug  8 18:23:30 2022
@@ -1,4 +1,4 @@
-# $NetBSD: parse-var.mk,v 1.2 2022/08/06 21:26:05 rillig Exp $
+# $NetBSD: 

CVS commit: src/usr.bin/make

2022-08-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Aug  8 18:23:31 UTC 2022

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: parse-var.exp parse-var.mk
var-eval-short.exp varmod-defined.exp varname-dot-suffixes.exp

Log Message:
make: fix parsing of modifiers containing unbalanced subexpressions


To generate a diff of this commit:
cvs rdiff -u -r1.1027 -r1.1028 src/usr.bin/make/var.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/parse-var.exp \
src/usr.bin/make/unit-tests/parse-var.mk
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/var-eval-short.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-defined.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varname-dot-suffixes.exp

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



CVS commit: src/bin/df

2022-08-08 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Aug  8 16:50:35 UTC 2022

Modified Files:
src/bin/df: df.1 df.c

Log Message:
Add 4 new flags:
-b (from FreeBSD) - set blocksize to blocks (512 bytes)
(overrides a contrary setting in BLOCKSIZE)
-H (from FreeBSD and Linux): -h using SI units (powers of 10).  Ugh.
-N suppress the header line (except with -P which requires it).
-f show only free space (or inodes) in a minimal format (implies -N)
(that is, with one file[system] specified, print 1 number only)
With -c, show only the total.
Intended to be useful for scripting (aka, I needed it.)

While here, improve the usage message (group options where they apply,
there is no reason, for example, that -g should be shown differently
to -k -m ..., and those options aren't at all useful with -G)

Update the man page to match.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/bin/df/df.1
cvs rdiff -u -r1.99 -r1.100 src/bin/df/df.c

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

Modified files:

Index: src/bin/df/df.1
diff -u src/bin/df/df.1:1.56 src/bin/df/df.1:1.57
--- src/bin/df/df.1:1.56	Wed Jan  6 20:38:09 2021
+++ src/bin/df/df.1	Mon Aug  8 16:50:35 2022
@@ -1,5 +1,3 @@
-.\"	$NetBSD: df.1,v 1.56 2021/01/06 20:38:09 ginsbach Exp $
-.\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -29,7 +27,7 @@
 .\"
 .\"	@(#)df.1	8.2 (Berkeley) 1/13/92
 .\"
-.Dd January 2, 2021
+.Dd August 8, 2022
 .Dt DF 1
 .Os
 .Sh NAME
@@ -37,10 +35,10 @@
 .Nd display free disk space
 .Sh SYNOPSIS
 .Nm
-.Op Fl acglnW
-.Op Fl Ghkm | Fl ihkm | Fl Pk
+.Op Fl aclnW
+.Op Fl G | Fl Pbk | Fl bfgHhikmN
 .Op Fl t Ar type
-.Op Ar file | Ar file_system ...
+.Oo Ar file | Ar file_system Oc Ns ...
 .Sh DESCRIPTION
 .Nm
 displays statistics about the amount of free disk space on the specified
@@ -52,8 +50,12 @@ By default, all sizes are reported in 51
 If neither a file or a
 .Ar file_system
 operand is specified,
-statistics for all mounted file systems are displayed
+statistics for all mounted,
+and not hidden (i.e.: not mounted with
+.Dv MNT_IGNORE ) ,
+file systems are displayed
 (subject to the
+.Fl a ,
 .Fl l
 and
 .Fl t
@@ -68,26 +70,68 @@ on the file system is less than
 The following options are available:
 .Bl -tag -width Ds
 .It Fl a
-Show all mount points,
+If no
+.Ar file ,
+or
+.Ar file_system
+arguments are givem, show all mount points,
 including those that were mounted with the
 .Dv MNT_IGNORE
 flag.
+Note that for file systems specified on the command
+line, that mount option is never considered.
+.It Fl b
+Show space as units of basic blocks (512 bytes).
+This is normally the default; this option can be used to
+override a conflicting setting in the environment variable
+.Ev BLOCKSIZE .
 .It Fl c
 Display a grand total for all shown mount points.
+When combined with
+.Fl f
+only the total for the mount points which otherwise
+would be included is shown, not the individual entries.
+.It Fl f
+Display only the available free space (or with
+.Fl i ,
+free inodes) in a minimal format.
+When there is to be only one line of output, only the value
+is shown, otherwise the value and the mount point,
+separated by a single space, are printed.
+For free space, the
+.Fl b ,
+.Fl g ,
+.Fl H ,
+.Fl h ,
+.Fl k
+and
+.Fl m
+options, and
+.Ev BLOCKSIZE
+are all used as normal.
+This option implies
+.Fl N
+and is incompatible with
+.Fl P
+and
+.Fl G .
 .It Fl G
 Display all the fields of the structure(s) returned by
 .Xr statvfs 2 .
 This option cannot be used with the
+.Fl f ,
 .Fl i
 or
 .Fl P
-options, and it is modelled after the Solaris
+options, and is modelled after the Solaris
 .Fl g
 option.
 This option will override the
+.Fl b ,
 .Fl g ,
+.Fl H ,
 .Fl h ,
-.Fl k ,
+.Fl k
 and
 .Fl m
 options, as well as any setting of
@@ -95,20 +139,32 @@ options, as well as any setting of
 .It Fl g
 The
 .Fl g
-option causes the numbers to be reported in gigabytes (1024*1024*1024
+option causes size numbers to be reported in gigabytes (1024*1024*1024
 bytes).
 .It Fl h
-"Human-readable" output.
+Use
+.Dq human-readable
+output for space data.
 Use unit suffixes: Byte, Kilobyte, Megabyte,
 Gigabyte, Terabyte, Petabyte, Exabyte in order to reduce the number of
 digits to four or less.
+.It Fl H
+As with
+.Fl h
+but using powers of 10 (1000) rather than 2 (1024).
 .It Fl i
 Include statistics on the number of free inodes.
+When combined with
+.Fl f
+only the number of free inodes is shown.
 .It Fl k
-By default, all sizes are reported in 512-byte block counts.
+By default, all sizes are reported in 512-byte block counts,
+unless the
+.Ev BLOCKSIZE
+environment variable is set.
 The
 .Fl k
-option causes the numbers to be reported in kilobytes (1024 bytes).
+option causes the size numbers to be 

CVS commit: src/bin/df

2022-08-08 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Aug  8 16:50:35 UTC 2022

Modified Files:
src/bin/df: df.1 df.c

Log Message:
Add 4 new flags:
-b (from FreeBSD) - set blocksize to blocks (512 bytes)
(overrides a contrary setting in BLOCKSIZE)
-H (from FreeBSD and Linux): -h using SI units (powers of 10).  Ugh.
-N suppress the header line (except with -P which requires it).
-f show only free space (or inodes) in a minimal format (implies -N)
(that is, with one file[system] specified, print 1 number only)
With -c, show only the total.
Intended to be useful for scripting (aka, I needed it.)

While here, improve the usage message (group options where they apply,
there is no reason, for example, that -g should be shown differently
to -k -m ..., and those options aren't at all useful with -G)

Update the man page to match.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/bin/df/df.1
cvs rdiff -u -r1.99 -r1.100 src/bin/df/df.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-08-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  8 08:55:43 UTC 2022

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

Log Message:
To avoid releasing mutex temporally, use new wm_set_mdio_slow_mode_hv_locked().


To generate a diff of this commit:
cvs rdiff -u -r1.756 -r1.757 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.756 src/sys/dev/pci/if_wm.c:1.757
--- src/sys/dev/pci/if_wm.c:1.756	Mon Aug  8 08:52:36 2022
+++ src/sys/dev/pci/if_wm.c	Mon Aug  8 08:55:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.756 2022/08/08 08:52:36 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.757 2022/08/08 08:55:42 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.756 2022/08/08 08:52:36 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.757 2022/08/08 08:55:42 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1119,6 +1119,7 @@ static int	wm_k1_gig_workaround_hv(struc
 static int	wm_k1_workaround_lv(struct wm_softc *);
 static int	wm_link_stall_workaround_hv(struct wm_softc *);
 static int	wm_set_mdio_slow_mode_hv(struct wm_softc *);
+static int	wm_set_mdio_slow_mode_hv_locked(struct wm_softc *);
 static void	wm_configure_k1_ich8lan(struct wm_softc *, int);
 static void	wm_reset_init_script_82575(struct wm_softc *);
 static void	wm_reset_mdicnfg_82580(struct wm_softc *);
@@ -17136,13 +17137,32 @@ static int
 wm_set_mdio_slow_mode_hv(struct wm_softc *sc)
 {
 	int rv;
+
+	rv = sc->phy.acquire(sc);
+	if (rv != 0) {
+		device_printf(sc->sc_dev, "%s: failed to get semaphore\n",
+		__func__);
+		return rv;
+	}
+
+	rv = wm_set_mdio_slow_mode_hv_locked(sc);
+
+	sc->phy.release(sc);
+
+	return rv;
+}
+
+static int
+wm_set_mdio_slow_mode_hv_locked(struct wm_softc *sc)
+{
+	int rv;
 	uint16_t reg;
 
-	rv = wm_gmii_hv_readreg(sc->sc_dev, 1, HV_KMRN_MODE_CTRL, );
+	rv = wm_gmii_hv_readreg_locked(sc->sc_dev, 1, HV_KMRN_MODE_CTRL, );
 	if (rv != 0)
 		return rv;
 
-	return wm_gmii_hv_writereg(sc->sc_dev, 1, HV_KMRN_MODE_CTRL,
+	return wm_gmii_hv_writereg_locked(sc->sc_dev, 1, HV_KMRN_MODE_CTRL,
 	reg | HV_KMRN_MDIO_SLOW);
 }
 
@@ -17290,11 +17310,11 @@ wm_phy_is_accessible_pchlan(struct wm_so
 	 */
 	rv = 0;
 	if (sc->sc_type < WM_T_PCH_LPT) {
-		sc->phy.release(sc);
-		wm_set_mdio_slow_mode_hv(sc);
-		rv = wm_gmii_hv_readreg(sc->sc_dev, 2, MII_PHYIDR1, );
-		rv |= wm_gmii_hv_readreg(sc->sc_dev, 2, MII_PHYIDR2, );
-		sc->phy.acquire(sc);
+		wm_set_mdio_slow_mode_hv_locked(sc);
+		rv = wm_gmii_hv_readreg_locked(sc->sc_dev, 2, MII_PHYIDR1,
+		);
+		rv |= wm_gmii_hv_readreg_locked(sc->sc_dev, 2, MII_PHYIDR2,
+		);
 	}
 	if ((rv != 0) || MII_INVALIDID(id1) || MII_INVALIDID(id2)) {
 		device_printf(sc->sc_dev, "XXX return with false\n");



CVS commit: src/sys/dev/pci

2022-08-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  8 08:55:43 UTC 2022

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

Log Message:
To avoid releasing mutex temporally, use new wm_set_mdio_slow_mode_hv_locked().


To generate a diff of this commit:
cvs rdiff -u -r1.756 -r1.757 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-08-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  8 08:52:37 UTC 2022

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

Log Message:
Consistency use -1 instead of 1 for some error code. Advised by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.755 -r1.756 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.755 src/sys/dev/pci/if_wm.c:1.756
--- src/sys/dev/pci/if_wm.c:1.755	Mon Aug  8 07:49:18 2022
+++ src/sys/dev/pci/if_wm.c	Mon Aug  8 08:52:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.755 2022/08/08 07:49:18 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.756 2022/08/08 08:52:36 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.755 2022/08/08 07:49:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.756 2022/08/08 08:52:36 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -14567,7 +14567,7 @@ wm_nvm_validate_checksum(struct wm_softc
 
 	for (i = 0; i < NVM_SIZE; i++) {
 		if (wm_nvm_read(sc, i, 1, _data))
-			return 1;
+			return -1;
 		checksum += eeprom_data;
 	}
 
@@ -14917,7 +14917,7 @@ retry:
 			goto retry;
 		}
 		aprint_error_dev(sc->sc_dev, "could not acquire SWSM SMBI\n");
-		return 1;
+		return -1;
 	}
 
 	/* Get the FW semaphore. */
@@ -14940,7 +14940,7 @@ retry:
 		"could not acquire SWSM SWESMBI\n");
 		/* Release semaphores */
 		wm_put_swsm_semaphore(sc);
-		return 1;
+		return -1;
 	}
 	return 0;
 }
@@ -14987,7 +14987,7 @@ wm_get_swfw_semaphore(struct wm_softc *s
 			aprint_error_dev(sc->sc_dev,
 			"%s: failed to get semaphore\n",
 			__func__);
-			return 1;
+			return -1;
 		}
 		swfw_sync = CSR_READ(sc, WMREG_SW_FW_SYNC);
 		if ((swfw_sync & (swmask | fwmask)) == 0) {
@@ -15003,7 +15003,7 @@ wm_get_swfw_semaphore(struct wm_softc *s
 	device_printf(sc->sc_dev,
 	"failed to get swfw semaphore mask 0x%x swfw 0x%x\n",
 	mask, swfw_sync);
-	return 1;
+	return -1;
 }
 
 static void
@@ -15151,7 +15151,7 @@ wm_get_swfwhw_semaphore(struct wm_softc 
 	device_printf(sc->sc_dev,
 	"failed to get swfwhw semaphore ext_ctrl 0x%x\n", ext_ctrl);
 	mutex_exit(sc->sc_ich_phymtx); /* Use PHY mtx for both PHY and NVM */
-	return 1;
+	return -1;
 }
 
 static void
@@ -15208,7 +15208,7 @@ wm_get_swflag_ich8lan(struct wm_softc *s
 
 out:
 	mutex_exit(sc->sc_ich_phymtx);
-	return 1;
+	return -1;
 }
 
 static void



CVS commit: src/sys/dev/pci

2022-08-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  8 08:52:37 UTC 2022

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

Log Message:
Consistency use -1 instead of 1 for some error code. Advised by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.755 -r1.756 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-08-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  8 07:49:18 UTC 2022

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

Log Message:
Pass an error code correctly if phy.acquire() failed.

This is not a real bug because the return value is not used.


To generate a diff of this commit:
cvs rdiff -u -r1.754 -r1.755 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-08-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  8 07:49:18 UTC 2022

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

Log Message:
Pass an error code correctly if phy.acquire() failed.

This is not a real bug because the return value is not used.


To generate a diff of this commit:
cvs rdiff -u -r1.754 -r1.755 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.754 src/sys/dev/pci/if_wm.c:1.755
--- src/sys/dev/pci/if_wm.c:1.754	Mon Aug  8 07:44:40 2022
+++ src/sys/dev/pci/if_wm.c	Mon Aug  8 07:49:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.754 2022/08/08 07:44:40 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.755 2022/08/08 07:49:18 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.754 2022/08/08 07:44:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.755 2022/08/08 07:49:18 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -16399,9 +16399,10 @@ wm_set_eee_pchlan(struct wm_softc *sc)
 		return 0;
 	}
 
-	if (sc->phy.acquire(sc)) {
+	rv = sc->phy.acquire(sc);
+	if (rv != 0) {
 		device_printf(dev, "%s: failed to get semaphore\n", __func__);
-		return 0;
+		return rv;
 	}
 
 	rv = sc->phy.readreg_locked(dev, 1, I82579_LPI_CTRL, _ctrl);



CVS commit: src/sys/dev/pci

2022-08-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  8 07:44:40 UTC 2022

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

Log Message:
Pass an error code to the upper layer instead of -1. Advised by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.753 -r1.754 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.753 src/sys/dev/pci/if_wm.c:1.754
--- src/sys/dev/pci/if_wm.c:1.753	Mon Aug  8 05:45:29 2022
+++ src/sys/dev/pci/if_wm.c	Mon Aug  8 07:44:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.753 2022/08/08 05:45:29 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.754 2022/08/08 07:44:40 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.753 2022/08/08 05:45:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.754 2022/08/08 07:44:40 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4745,7 +4745,7 @@ wm_write_smbus_addr(struct wm_softc *sc)
 
 	rv = wm_gmii_hv_readreg_locked(sc->sc_dev, 2, HV_SMB_ADDR, _data);
 	if (rv != 0)
-		return -1;
+		return rv;
 
 	phy_data &= ~HV_SMB_ADDR_ADDR;
 	phy_data |= __SHIFTOUT(strap, STRAP_SMBUSADDR);
@@ -11627,9 +11627,10 @@ wm_gmii_i82544_readreg(device_t dev, int
 	struct wm_softc *sc = device_private(dev);
 	int rv;
 
-	if (sc->phy.acquire(sc)) {
+	rv = sc->phy.acquire(sc); 
+	if (rv != 0) {
 		device_printf(dev, "%s: failed to get semaphore\n", __func__);
-		return -1;
+		return rv;
 	}
 
 	rv = wm_gmii_i82544_readreg_locked(dev, phy, reg, val);
@@ -11678,9 +11679,10 @@ wm_gmii_i82544_writereg(device_t dev, in
 	struct wm_softc *sc = device_private(dev);
 	int rv;
 
-	if (sc->phy.acquire(sc)) {
+	rv = sc->phy.acquire(sc);
+	if (rv != 0) {
 		device_printf(dev, "%s: failed to get semaphore\n", __func__);
-		return -1;
+		return rv;
 	}
 
 	rv = wm_gmii_i82544_writereg_locked(dev, phy, reg & MII_ADDRMASK, val);
@@ -11730,14 +11732,15 @@ wm_gmii_i80003_readreg(device_t dev, int
 	struct wm_softc *sc = device_private(dev);
 	int page_select;
 	uint16_t temp, temp2;
-	int rv = 0;
+	int rv;
 
 	if (phy != 1) /* Only one PHY on kumeran bus */
 		return -1;
 
-	if (sc->phy.acquire(sc)) {
+	rv = sc->phy.acquire(sc);
+	if (rv != 0) {
 		device_printf(dev, "%s: failed to get semaphore\n", __func__);
-		return -1;
+		return rv;
 	}
 
 	if ((reg & MII_ADDRMASK) < GG82563_MIN_ALT_REG)
@@ -11793,9 +11796,10 @@ wm_gmii_i80003_writereg(device_t dev, in
 	if (phy != 1) /* Only one PHY on kumeran bus */
 		return -1;
 
-	if (sc->phy.acquire(sc)) {
+	rv = sc->phy.acquire(sc); 
+	if (rv != 0) {
 		device_printf(dev, "%s: failed to get semaphore\n", __func__);
-		return -1;
+		return rv;
 	}
 
 	if ((reg & MII_ADDRMASK) < GG82563_MIN_ALT_REG)
@@ -11848,9 +11852,10 @@ wm_gmii_bm_readreg(device_t dev, int phy
 	uint16_t page = reg >> BME1000_PAGE_SHIFT;
 	int rv;
 
-	if (sc->phy.acquire(sc)) {
+	rv = sc->phy.acquire(sc);
+	if (rv != 0) {
 		device_printf(dev, "%s: failed to get semaphore\n", __func__);
-		return -1;
+		return rv;
 	}
 
 	if ((sc->sc_type != WM_T_82574) && (sc->sc_type != WM_T_82583))
@@ -11895,9 +11900,10 @@ wm_gmii_bm_writereg(device_t dev, int ph
 	uint16_t page = reg >> BME1000_PAGE_SHIFT;
 	int rv;
 
-	if (sc->phy.acquire(sc)) {
+	rv = sc->phy.acquire(sc);
+	if (rv != 0) {
 		device_printf(dev, "%s: failed to get semaphore\n", __func__);
-		return -1;
+		return rv;
 	}
 
 	if ((sc->sc_type != WM_T_82574) && (sc->sc_type != WM_T_82583))
@@ -12113,9 +12119,11 @@ wm_gmii_hv_readreg(device_t dev, int phy
 
 	DPRINTF(sc, WM_DEBUG_GMII, ("%s: %s called\n",
 		device_xname(dev), __func__));
-	if (sc->phy.acquire(sc)) {
+
+	rv = sc->phy.acquire(sc);
+	if (rv != 0) {
 		device_printf(dev, "%s: failed to get semaphore\n", __func__);
-		return -1;
+		return rv;
 	}
 
 	rv = wm_gmii_hv_readreg_locked(dev, phy, reg, val);
@@ -12178,9 +12186,10 @@ wm_gmii_hv_writereg(device_t dev, int ph
 	DPRINTF(sc, WM_DEBUG_GMII, ("%s: %s called\n",
 		device_xname(dev), __func__));
 
-	if (sc->phy.acquire(sc)) {
+	rv = sc->phy.acquire(sc);
+	if (rv != 0) {
 		device_printf(dev, "%s: failed to get semaphore\n", __func__);
-		return -1;
+		return rv;
 	}
 
 	rv = wm_gmii_hv_writereg_locked(dev, phy, reg, val);
@@ -12261,9 +12270,10 @@ wm_gmii_82580_readreg(device_t dev, int 
 	struct wm_softc *sc = device_private(dev);
 	int rv;
 
-	if (sc->phy.acquire(sc) != 0) {
+	rv = sc->phy.acquire(sc);
+	if (rv != 0) {
 		device_printf(dev, "%s: failed to get semaphore\n", __func__);
-		return -1;
+		return rv;
 	}
 
 #ifdef DIAGNOSTIC
@@ -12292,9 +12302,10 @@ wm_gmii_82580_writereg(device_t dev, int
 	struct wm_softc *sc = device_private(dev);
 	int rv;
 
-	if (sc->phy.acquire(sc) != 0) {
+	rv = sc->phy.acquire(sc);
+	if (rv != 0) {
 		device_printf(dev, "%s: failed to get 

CVS commit: src/sys/dev/pci

2022-08-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  8 07:44:40 UTC 2022

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

Log Message:
Pass an error code to the upper layer instead of -1. Advised by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.753 -r1.754 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-08-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  8 05:45:29 UTC 2022

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

Log Message:
Modify debug messages so that we can determine where it happened.


To generate a diff of this commit:
cvs rdiff -u -r1.752 -r1.753 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.752 src/sys/dev/pci/if_wm.c:1.753
--- src/sys/dev/pci/if_wm.c:1.752	Fri Aug  5 05:50:54 2022
+++ src/sys/dev/pci/if_wm.c	Mon Aug  8 05:45:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.752 2022/08/05 05:50:54 skrll Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.753 2022/08/08 05:45:29 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.752 2022/08/05 05:50:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.753 2022/08/08 05:45:29 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -15558,7 +15558,7 @@ wm_init_phy_workarounds_pchlan(struct wm
 break;
 
 		if (wm_phy_resetisblocked(sc) == true) {
-			device_printf(sc->sc_dev, "XXX reset is blocked(3)\n");
+			device_printf(sc->sc_dev, "XXX reset is blocked(2)\n");
 			break;
 		}
 
@@ -15591,7 +15591,7 @@ wm_init_phy_workarounds_pchlan(struct wm
 	if (rv == 0) {
 		/* Check to see if able to reset PHY.  Print error if not */
 		if (wm_phy_resetisblocked(sc)) {
-			device_printf(sc->sc_dev, "XXX reset is blocked(4)\n");
+			device_printf(sc->sc_dev, "XXX reset is blocked(3)\n");
 			goto out;
 		}
 



CVS commit: src/sys/dev/pci

2022-08-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  8 05:45:29 UTC 2022

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

Log Message:
Modify debug messages so that we can determine where it happened.


To generate a diff of this commit:
cvs rdiff -u -r1.752 -r1.753 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/common/lib/libprop

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 23:49:46 UTC 2022

Modified Files:
src/common/lib/libprop: prop_object.c

Log Message:
proplib: Allocate sizeof(*ctx), not sizeof(struct ...).

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/common/lib/libprop/prop_object.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/libprop/prop_object.c
diff -u src/common/lib/libprop/prop_object.c:1.34 src/common/lib/libprop/prop_object.c:1.35
--- src/common/lib/libprop/prop_object.c:1.34	Thu Aug  4 09:02:29 2022
+++ src/common/lib/libprop/prop_object.c	Sun Aug  7 23:49:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_object.c,v 1.34 2022/08/04 09:02:29 riastradh Exp $	*/
+/*	$NetBSD: prop_object.c,v 1.35 2022/08/07 23:49:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@@ -718,8 +718,7 @@ _prop_object_internalize_context_alloc(c
 {
 	struct _prop_object_internalize_context *ctx;
 
-	ctx = _PROP_MALLOC(sizeof(struct _prop_object_internalize_context),
-			   M_TEMP);
+	ctx = _PROP_MALLOC(sizeof(*ctx), M_TEMP);
 	if (ctx == NULL)
 		return (NULL);
 



CVS commit: src/common/lib/libprop

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 23:49:46 UTC 2022

Modified Files:
src/common/lib/libprop: prop_object.c

Log Message:
proplib: Allocate sizeof(*ctx), not sizeof(struct ...).

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/common/lib/libprop/prop_object.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-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 23:49:30 UTC 2022

Modified Files:
src/sys/dev/usb: usbnet.c

Log Message:
usbnet(9): Simplify assertions now that urndis(4) is less sketchy.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/usb/usbnet.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/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.94 src/sys/dev/usb/usbnet.c:1.95
--- src/sys/dev/usb/usbnet.c:1.94	Sat Mar  5 06:55:49 2022
+++ src/sys/dev/usb/usbnet.c	Sun Aug  7 23:49:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.94 2022/03/05 06:55:49 riastradh Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.95 2022/08/07 23:49:30 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.94 2022/03/05 06:55:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.95 2022/08/07 23:49:30 riastradh Exp $");
 
 #include 
 #include 
@@ -166,8 +166,7 @@ fail:
 static void
 uno_stop(struct usbnet *un, struct ifnet *ifp, int disable)
 {
-	KASSERTMSG(!un->un_pri->unp_ifp_attached || IFNET_LOCKED(ifp),
-	"%s", ifp->if_xname);
+	KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
 	usbnet_isowned_core(un);
 	if (un->un_ops->uno_stop)
 		(*un->un_ops->uno_stop)(ifp, disable);
@@ -835,8 +834,7 @@ usbnet_init_rx_tx(struct usbnet * const 
 	usbd_status err;
 	int error = 0;
 
-	KASSERTMSG(!unp->unp_ifp_attached || IFNET_LOCKED(ifp),
-	"%s", ifp->if_xname);
+	KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
 
 	usbnet_isowned_core(un);
 
@@ -868,9 +866,7 @@ usbnet_init_rx_tx(struct usbnet * const 
 	}
 
 	/* Indicate we are up and running. */
-	/* XXX urndis calls usbnet_init_rx_tx before usbnet_attach_ifp.  */
-	KASSERTMSG(!unp->unp_ifp_attached || IFNET_LOCKED(ifp),
-	"%s", ifp->if_xname);
+	KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
 	ifp->if_flags |= IFF_RUNNING;
 
 	/*
@@ -1085,8 +1081,7 @@ usbnet_stop(struct usbnet *un, struct if
 
 	USBNETHIST_FUNC(); USBNETHIST_CALLED();
 
-	KASSERTMSG(!unp->unp_ifp_attached || IFNET_LOCKED(ifp),
-	"%s", ifp->if_xname);
+	KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
 	usbnet_isowned_core(un);
 
 	/*
@@ -1146,8 +1141,7 @@ usbnet_stop(struct usbnet *un, struct if
 	usbnet_ep_close_pipes(un);
 
 	/* Everything is quesced now. */
-	KASSERTMSG(!unp->unp_ifp_attached || IFNET_LOCKED(ifp),
-	"%s", ifp->if_xname);
+	KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
 	ifp->if_flags &= ~IFF_RUNNING;
 }
 



CVS commit: src/sys/dev/usb

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 23:49:30 UTC 2022

Modified Files:
src/sys/dev/usb: usbnet.c

Log Message:
usbnet(9): Simplify assertions now that urndis(4) is less sketchy.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/usb/usbnet.c

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



CVS commit: src

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 23:42:09 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c
src/external/cddl/osnet/sys/kern: opensolaris.c
src/share/mk: bsd.kmodule.mk

Log Message:
bsd.kmodule.mk: Build modules with KDTRACE_HOOKS if MKDTRACE=yes.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/external/cddl/osnet/dev/sdt/sdt.c
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/sys/kern/opensolaris.c
cvs rdiff -u -r1.80 -r1.81 src/share/mk/bsd.kmodule.mk

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



CVS commit: src

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 23:42:09 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c
src/external/cddl/osnet/sys/kern: opensolaris.c
src/share/mk: bsd.kmodule.mk

Log Message:
bsd.kmodule.mk: Build modules with KDTRACE_HOOKS if MKDTRACE=yes.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/external/cddl/osnet/dev/sdt/sdt.c
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/sys/kern/opensolaris.c
cvs rdiff -u -r1.80 -r1.81 src/share/mk/bsd.kmodule.mk

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

Modified files:

Index: src/external/cddl/osnet/dev/sdt/sdt.c
diff -u src/external/cddl/osnet/dev/sdt/sdt.c:1.22 src/external/cddl/osnet/dev/sdt/sdt.c:1.23
--- src/external/cddl/osnet/dev/sdt/sdt.c:1.22	Sun Aug  7 20:47:05 2022
+++ src/external/cddl/osnet/dev/sdt/sdt.c	Sun Aug  7 23:42:09 2022
@@ -39,7 +39,7 @@
  * unloaded; in particular, probes may not span multiple kernel modules.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.22 2022/08/07 20:47:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.23 2022/08/07 23:42:09 riastradh Exp $");
 
 #include 
 #include 
@@ -68,7 +68,6 @@ __KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.22
 #include 
 #include 
 #include 
-#define KDTRACE_HOOKS
 #include 
 
 #include 

Index: src/external/cddl/osnet/sys/kern/opensolaris.c
diff -u src/external/cddl/osnet/sys/kern/opensolaris.c:1.3 src/external/cddl/osnet/sys/kern/opensolaris.c:1.4
--- src/external/cddl/osnet/sys/kern/opensolaris.c:1.3	Sun Jul 25 06:07:42 2021
+++ src/external/cddl/osnet/sys/kern/opensolaris.c	Sun Aug  7 23:42:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: opensolaris.c,v 1.3 2021/07/25 06:07:42 skrll Exp $	*/
+/*	$NetBSD: opensolaris.c,v 1.4 2022/08/07 23:42:09 riastradh Exp $	*/
 /*-
  * Copyright 2007 John Birrell 
  *
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 cpu_core_t	cpu_core[MAXCPUS];
 solaris_cpu_t	solaris_cpu[MAXCPUS];
@@ -66,3 +67,5 @@ void
 opensolaris_fini(void *dummy)
 {
 }
+
+SDT_PROBE_DEFINE1(sdt, , , set__error, "int");

Index: src/share/mk/bsd.kmodule.mk
diff -u src/share/mk/bsd.kmodule.mk:1.80 src/share/mk/bsd.kmodule.mk:1.81
--- src/share/mk/bsd.kmodule.mk:1.80	Wed Aug  3 09:37:36 2022
+++ src/share/mk/bsd.kmodule.mk	Sun Aug  7 23:42:09 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kmodule.mk,v 1.80 2022/08/03 09:37:36 riastradh Exp $
+#	$NetBSD: bsd.kmodule.mk,v 1.81 2022/08/07 23:42:09 riastradh Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -30,6 +30,7 @@ CFLAGS+=	-ffreestanding ${COPTS}
 CPPFLAGS+=	-nostdinc -I. -I${.CURDIR} -isystem $S -isystem $S/arch
 CPPFLAGS+=	-isystem ${S}/../common/include
 CPPFLAGS+=	-D_KERNEL -D_MODULE -DSYSCTL_INCLUDE_DESCR
+CPPFLAGS+=	${${MKDTRACE:Uno} != "no" :? -DKDTRACE_HOOKS :}
 
 CWARNFLAGS.clang+=	-Wno-error=constant-conversion
 



Re: CVS commit: src/sys/kern

2022-08-07 Thread Taylor R Campbell
Reverted and alternative proposed on tech-kern!  Sorry for the
unilateral toe-stomping.


CVS commit: src/sys/kern

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 23:03:59 UTC 2022

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

Log Message:
Revert "module(9): Disable module autounload by default."

Needs more discussion.  Maybe better with an opt-in mechanism to
replace the opt-out mechanism than by disabling it altogether by
default.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/kern/kern_module.c

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

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.156 src/sys/kern/kern_module.c:1.157
--- src/sys/kern/kern_module.c:1.156	Sun Aug  7 21:17:18 2022
+++ src/sys/kern/kern_module.c	Sun Aug  7 23:03:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.156 2022/08/07 21:17:18 riastradh Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.157 2022/08/07 23:03:59 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.156 2022/08/07 21:17:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.157 2022/08/07 23:03:59 riastradh Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -96,7 +96,7 @@ bool		module_autoload_on = false;
 #endif
 u_int		module_count;
 u_int		module_builtinlist;
-u_int		module_autotime = 0;
+u_int		module_autotime = 10;
 u_int		module_gen = 1;
 static kcondvar_t module_thread_cv;
 static kmutex_t module_thread_lock;



CVS commit: src/sys/kern

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 23:03:59 UTC 2022

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

Log Message:
Revert "module(9): Disable module autounload by default."

Needs more discussion.  Maybe better with an opt-in mechanism to
replace the opt-out mechanism than by disabling it altogether by
default.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/kern/kern_module.c

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



CVS commit: src/share/misc

2022-08-07 Thread Adrian Steinmann
Module Name:src
Committed By:   ast
Date:   Sun Aug  7 22:43:28 UTC 2022

Modified Files:
src/share/misc: bsd-family-tree

Log Message:
Update what has been released by the BSD family during the last
two years; that is, since May 2020 after NetBSD 8.2 was registered
in this file.

Merge some additional information from the FreeBSD and DragonFly
versions that had several updates during this time. Added OpenBSD
and macos release dates for the same interval.

Where some release dates don't match exactly (release vs. announce
date) in the various bsd-family-tree files, assume the respective
flavor to be authoritive for its dates in this file.

Reviewed by: Sergey A. Osokin 


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/share/misc/bsd-family-tree

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

Modified files:

Index: src/share/misc/bsd-family-tree
diff -u src/share/misc/bsd-family-tree:1.82 src/share/misc/bsd-family-tree:1.83
--- src/share/misc/bsd-family-tree:1.82	Thu Jun 11 09:15:31 2020
+++ src/share/misc/bsd-family-tree	Sun Aug  7 22:43:28 2022
@@ -402,19 +402,42 @@ FreeBSD 5.2   |  |  
  | |  |   |  |   ||DragonFly 5.6.1
  | |   FreeBSD  macOS|   |||
  | | 11.3   10.15|   |||
- |  FreeBSD   |  |   |OpenBSD 6.6  |
- |   12.1   macOS|   `---.||
- | |   10.15.1   |   ||DragonFly 5.6.2
- | |  |  *--NetBSD   |||
- | v  |  |   9.0 |||
- ||  |   |||
- ||  |   ||DragonFly 5.8
- ||  |   |||
- ||  |   ||DragonFly 5.6.3
- ||  |NetBSD  ||
- ||  | 8.2||
+ |  FreeBSD   |   |  |   |OpenBSD 6.6  |
+ |   12.1 | macOS|   `---.||
+ | |  |10.15.1   |   ||DragonFly 5.6.2
+ | |  |   |  *--NetBSD   |||
+ | |  |   |  |   9.0 |||
+ | |  |   |  ||  |||
+ | |  |   |  ||  ||DragonFly 5.8
+ | |  |   |  ||  |||
+ | |  |   |  ||  ||DragonFly 5.6.3
+ | |  |   |  ||   NetBSD  ||
+ | |  |   |  ||8.2|DragonFly 5.8.1
+ | |  |   |  ||   OpenBSD 6.7  |
+ | |   FreeBSD|  ||   ||
+ | | 11.4 |  ||   ||
+ | |  |  ||   |DragonFly 5.8.2
+ | |  |  ||   |DragonFly 5.8.3
+ | |  |  |  NetBSD 9.1OpenBSD 6.8  |
+ |  FreeBSD   |  ||   ||
+ |   12.2   macOS||   ||
+ | | 11  ||   ||
+ | `--.   |  ||   ||
+ ||   |  ||   ||
+ *--FreeBSD   |   |  ||   ||
+ |   13.0 |   |  |  NetBSD 9.2OpenBSD 6.9  DragonFly 6.0
+ | |  |   |  ||   ||
+ | |  |   |  ||   ||
+ | |   FreeBSD  macOS||   OpenBSD 7.0  DragonFly 6.2.1
+ | | 12.312  ||   ||
+ | |  |  ||   ||
+ | |  |  ||   OpenBSD 7.1  |
+ |  FreeBSD   |  ||   ||
+ |   13.1 |  ||   ||
+ ||  ||   |DragonFly 6.2.2
+ ||  |  NetBSD 9.3||
  ||  |||
-FreeBSD 13 -current   |  NetBSD -current   OpenBSD -current

CVS commit: src/share/misc

2022-08-07 Thread Adrian Steinmann
Module Name:src
Committed By:   ast
Date:   Sun Aug  7 22:43:28 UTC 2022

Modified Files:
src/share/misc: bsd-family-tree

Log Message:
Update what has been released by the BSD family during the last
two years; that is, since May 2020 after NetBSD 8.2 was registered
in this file.

Merge some additional information from the FreeBSD and DragonFly
versions that had several updates during this time. Added OpenBSD
and macos release dates for the same interval.

Where some release dates don't match exactly (release vs. announce
date) in the various bsd-family-tree files, assume the respective
flavor to be authoritive for its dates in this file.

Reviewed by: Sergey A. Osokin 


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/share/misc/bsd-family-tree

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



Re: CVS commit: src/sys/kern

2022-08-07 Thread Paul Goyette

On Sun, 7 Aug 2022, Paul Goyette wrote:


On Sun, 7 Aug 2022, Taylor R Campbell wrote:


Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 21:17:18 UTC 2022

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

Log Message:
module(9): Disable module autounload by default.

I don't know why this was ever enabled by default; many modules are
still not safe to unload, let alone autounload.  If any autounload is
to happen by default, it should only be for modules that have opted
into it in some way after audit.


One reason for the current behavior involves the modules used for
various emulations.  When a file is executed, and none of the
currently-loaded modules can "deal" with it, we load _all_ of the
available emulation modules with the hope that one of them will
"deal with" the new executable, and with the expectation that the
remaining emulation modules will just "go away".

Modules that are known to be unsafe to unload should declare that
in their modcmd() unload (by returning EBUSY).  After all, one
might well expect that the module itself is the most likely place
that the unloadable status would be known.

Making no-autounload as the default seems like using a 20-pound
sledge hammer on a carpet tack.


I might also note that making such a fundamental behavior change
when we're so close to the -10 release, without actually providing
the suggested "opt-in" mechanism to retain current behavior, is
not very user friendly.   :-)

At least this should be discussed (on tech-kern@, perhaps) before
being unilaterally decided and committed.  IIRC, we had this
discussion some time ago, and the decision at that time was to
retain current behavior.  Unfortunately, I didn't save any pointer
to that old discussion.  :-(




++--+--+
| Paul Goyette   | PGP Key fingerprint: | E-mail addresses:|
| (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com|
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org  |
| & Network Engineer |  | pgoyett...@gmail.com |
++--+--+

!DSPAM:62f0321a29502088639869!




++--+--+
| Paul Goyette   | PGP Key fingerprint: | E-mail addresses:|
| (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com|
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org  |
| & Network Engineer |  | pgoyett...@gmail.com |
++--+--+


Re: CVS commit: src/sys/kern

2022-08-07 Thread Paul Goyette

On Sun, 7 Aug 2022, Taylor R Campbell wrote:


Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 21:17:18 UTC 2022

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

Log Message:
module(9): Disable module autounload by default.

I don't know why this was ever enabled by default; many modules are
still not safe to unload, let alone autounload.  If any autounload is
to happen by default, it should only be for modules that have opted
into it in some way after audit.


One reason for the current behavior involves the modules used for
various emulations.  When a file is executed, and none of the
currently-loaded modules can "deal" with it, we load _all_ of the
available emulation modules with the hope that one of them will
"deal with" the new executable, and with the expectation that the
remaining emulation modules will just "go away".

Modules that are known to be unsafe to unload should declare that
in their modcmd() unload (by returning EBUSY).  After all, one
might well expect that the module itself is the most likely place
that the unloadable status would be known.

Making no-autounload as the default seems like using a 20-pound
sledge hammer on a carpet tack.


++--+--+
| Paul Goyette   | PGP Key fingerprint: | E-mail addresses:|
| (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com|
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org  |
| & Network Engineer |  | pgoyett...@gmail.com |
++--+--+


CVS commit: src/sys/kern

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 21:17:18 UTC 2022

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

Log Message:
module(9): Disable module autounload by default.

I don't know why this was ever enabled by default; many modules are
still not safe to unload, let alone autounload.  If any autounload is
to happen by default, it should only be for modules that have opted
into it in some way after audit.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/kern/kern_module.c

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

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.155 src/sys/kern/kern_module.c:1.156
--- src/sys/kern/kern_module.c:1.155	Sun Aug  7 20:44:39 2022
+++ src/sys/kern/kern_module.c	Sun Aug  7 21:17:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.155 2022/08/07 20:44:39 riastradh Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.156 2022/08/07 21:17:18 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.155 2022/08/07 20:44:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.156 2022/08/07 21:17:18 riastradh Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -96,7 +96,7 @@ bool		module_autoload_on = false;
 #endif
 u_int		module_count;
 u_int		module_builtinlist;
-u_int		module_autotime = 10;
+u_int		module_autotime = 0;
 u_int		module_gen = 1;
 static kcondvar_t module_thread_cv;
 static kmutex_t module_thread_lock;



CVS commit: src/sys/kern

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 21:17:18 UTC 2022

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

Log Message:
module(9): Disable module autounload by default.

I don't know why this was ever enabled by default; many modules are
still not safe to unload, let alone autounload.  If any autounload is
to happen by default, it should only be for modules that have opted
into it in some way after audit.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/kern/kern_module.c

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



CVS commit: src

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 20:47:05 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c
src/sys/modules/dtrace/sdt: Makefile

Log Message:
dtrace_sdt: Register sdt providers and probes in loaded modules too.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/external/cddl/osnet/dev/sdt/sdt.c
cvs rdiff -u -r1.6 -r1.7 src/sys/modules/dtrace/sdt/Makefile

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

Modified files:

Index: src/external/cddl/osnet/dev/sdt/sdt.c
diff -u src/external/cddl/osnet/dev/sdt/sdt.c:1.21 src/external/cddl/osnet/dev/sdt/sdt.c:1.22
--- src/external/cddl/osnet/dev/sdt/sdt.c:1.21	Mon Mar 28 12:33:20 2022
+++ src/external/cddl/osnet/dev/sdt/sdt.c	Sun Aug  7 20:47:05 2022
@@ -39,7 +39,7 @@
  * unloaded; in particular, probes may not span multiple kernel modules.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.21 2022/03/28 12:33:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.22 2022/08/07 20:47:05 riastradh Exp $");
 
 #include 
 #include 
@@ -52,6 +52,9 @@ __KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.21
 #endif
 #include 
 #include 
+#ifdef __NetBSD__
+#include 
+#endif
 #ifdef __FreeBSD__
 #include 
 #include 
@@ -113,6 +116,10 @@ static dtrace_pops_t sdt_pops = {
 };
 
 #ifdef __NetBSD__
+struct linker_file {
+	struct module	lf_mod;
+};
+
 static int
 sdt_open(dev_t dev, int flags, int mode, struct lwp *l)
 {
@@ -204,14 +211,19 @@ sdt_create_probe(struct sdt_probe *probe
 
 	SDT_KASSERT(prov != NULL, ("probe defined without a provider"));
 
-#ifdef __FreeBSD__
 	/* If no module name was specified, use the module filename. */
 	if (*probe->mod == 0) {
+#ifdef __NetBSD__
+		const char *modname = (probe->sdtp_lf == NULL ? "netbsd" :
+		module_name(>sdtp_lf->lf_mod));
+		strlcpy(mod, modname, sizeof(mod));
+#endif
+#ifdef __FreeBSD__
 		len = strlcpy(mod, probe->sdtp_lf->filename, sizeof(mod));
 		if (len > 3 && strcmp(mod + len - 3, ".ko") == 0)
 			mod[len - 3] = '\0';
-	} else
 #endif
+	} else
 		strlcpy(mod, probe->mod, sizeof(mod));
 
 	/*
@@ -258,6 +270,9 @@ sdt_enable(void *arg __unused, dtrace_id
 	struct sdt_probe *probe = parg;
 
 	probe->id = id;
+#ifdef __NetBSD__
+	module_hold(>sdtp_lf->lf_mod);
+#endif
 #ifdef __FreeBSD__
 	probe->sdtp_lf->nenabled++;
 	if (strcmp(probe->prov->name, "lockstat") == 0)
@@ -271,6 +286,9 @@ sdt_disable(void *arg __unused, dtrace_i
 {
 	struct sdt_probe *probe = parg;
 
+#ifdef __NetBSD__
+	module_rele(>sdtp_lf->lf_mod);
+#endif
 #ifdef __FreeBSD__
 	SDT_KASSERT(probe->sdtp_lf->nenabled > 0, ("no probes enabled"));
 	if (strcmp(probe->prov->name, "lockstat") == 0)
@@ -411,63 +429,154 @@ __link_set_decl(sdt_providers_set, struc
 __link_set_decl(sdt_probes_set, struct sdt_probe);
 __link_set_decl(sdt_argtypes_set, struct sdt_argtype);
 
-/*
- * Unfortunately we don't have linker set functions and event handlers
- * to support loading and unloading probes in modules... Currently if
- * modules have probes, if the modules are loaded when sdt is loaded
- * they will work, but they will crash unloading.
- */
+static struct module_callbacks *sdt_link_set_callbacks;
+
 static void
-sdt_link_set_load(void)
+sdt_link_set_load_provider(struct sdt_provider *const *provider)
+{
+
+	sdt_create_provider(*provider);
+}
+
+static void
+sdt_link_set_unload_provider(struct sdt_provider *const *curr)
+{
+	struct sdt_provider *prov, *tmp;
+
+	/*
+	 * Go through all the providers declared in this linker file and
+	 * unregister any that aren't declared in another loaded file.
+	 */
+	TAILQ_FOREACH_SAFE(prov, _prov_list, prov_entry, tmp) {
+		if (strcmp(prov->name, (*curr)->name) != 0)
+			continue;
+
+		if (prov->sdt_refs == 1) {
+			if (dtrace_unregister(prov->id) != 0) {
+return;
+			}
+			TAILQ_REMOVE(_prov_list, prov, prov_entry);
+			free(__UNCONST(prov->name), M_SDT);
+			free(prov, M_SDT);
+		} else
+			prov->sdt_refs--;
+		break;
+	}
+}
+
+static void
+sdt_link_set_load_probe(struct sdt_probe *const *probe, struct module *mod)
+{
+	struct linker_file *lf = mod == NULL ? NULL :
+	container_of(mod, struct linker_file, lf_mod);
+
+	(*probe)->sdtp_lf = lf;
+	sdt_create_probe(*probe);
+	TAILQ_INIT(&(*probe)->argtype_list);
+}
+
+static void
+sdt_link_set_load_argtype(struct sdt_argtype *const *argtype)
+{
+
+	(*argtype)->probe->n_args++;
+	TAILQ_INSERT_TAIL(&(*argtype)->probe->argtype_list,
+	*argtype, argtype_entry);
+}
+
+static void
+sdt_link_set_load_module(struct module *mod)
 {
 	struct sdt_provider * const *provider;
 	struct sdt_probe * const *probe;
 	struct sdt_argtype * const *argtype;
+	void *p;
+	size_t size, n;
 
-	__link_set_foreach(provider, sdt_providers_set) {
-		sdt_create_provider(*provider);
+	/*
+	 * Skip builtin modules -- they are handled separately with
+	 * __link_set_foreach.
+	 */
+	if (module_source(mod) == MODULE_SOURCE_KERNEL)
+		return;
+
+	if 

CVS commit: src

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 20:47:05 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c
src/sys/modules/dtrace/sdt: Makefile

Log Message:
dtrace_sdt: Register sdt providers and probes in loaded modules too.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/external/cddl/osnet/dev/sdt/sdt.c
cvs rdiff -u -r1.6 -r1.7 src/sys/modules/dtrace/sdt/Makefile

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



CVS commit: src/sys/kern

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 20:44:39 UTC 2022

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

Log Message:
module(9): Call callbacks in topological order on load.

They are called in reverse topological order on unload.

dtrace_sdt will rely on this soon to ensure provider definitions are
processed before their uses.

ok chs@


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/kern/kern_module.c

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



CVS commit: src/sys/kern

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 20:44:39 UTC 2022

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

Log Message:
module(9): Call callbacks in topological order on load.

They are called in reverse topological order on unload.

dtrace_sdt will rely on this soon to ensure provider definitions are
processed before their uses.

ok chs@


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/kern/kern_module.c

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

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.154 src/sys/kern/kern_module.c:1.155
--- src/sys/kern/kern_module.c:1.154	Sat May  7 04:30:41 2022
+++ src/sys/kern/kern_module.c	Sun Aug  7 20:44:39 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.154 2022/05/07 04:30:41 rin Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.155 2022/08/07 20:44:39 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.154 2022/05/07 04:30:41 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.155 2022/08/07 20:44:39 riastradh Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1889,7 +1889,7 @@ module_register_callbacks(void (*load)(s
 
 	kernconfig_lock();
 	TAILQ_INSERT_TAIL(, modcb, modcb_list);
-	TAILQ_FOREACH(mod, _list, mod_chain)
+	TAILQ_FOREACH_REVERSE(mod, _list, modlist, mod_chain)
 		load(mod);
 	kernconfig_unlock();
 



CVS commit: src/sys

2022-08-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Aug  7 20:14:01 UTC 2022

Modified Files:
src/sys/compat/linux/arch/m68k: linux_machdep.c
src/sys/netinet6: ip6_mroute.h

Log Message:
Remove extra whitespaces added by an ancient stupid script.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/compat/linux/arch/m68k/linux_machdep.c
cvs rdiff -u -r1.19 -r1.20 src/sys/netinet6/ip6_mroute.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/compat/linux/arch/m68k/linux_machdep.c
diff -u src/sys/compat/linux/arch/m68k/linux_machdep.c:1.43 src/sys/compat/linux/arch/m68k/linux_machdep.c:1.44
--- src/sys/compat/linux/arch/m68k/linux_machdep.c:1.43	Tue Sep  7 11:43:04 2021
+++ src/sys/compat/linux/arch/m68k/linux_machdep.c	Sun Aug  7 20:14:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.43 2021/09/07 11:43:04 riastradh Exp $	*/
+/*	$NetBSD: linux_machdep.c,v 1.44 2022/08/07 20:14:01 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.43 2021/09/07 11:43:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.44 2022/08/07 20:14:01 tsutsui Exp $");
 
 #define COMPAT_LINUX 1
 
@@ -151,7 +151,7 @@ setup_linux_sigframe(struct frame *frame
 #endif
 		kf.sf_c.c_sc.sc_ss.ss_format = ft;
 		kf.sf_c.c_sc.sc_ss.ss_vector = frame->f_vector;
-		memcpy( _c.c_sc.sc_ss.ss_frame, >F_u,
+		memcpy(_c.c_sc.sc_ss.ss_frame, >F_u,
 			(size_t) exframesize[ft]);
 		/*
 		 * Leave an indicator that we need to clean up the kernel
@@ -307,7 +307,7 @@ setup_linux_rt_sigframe(struct frame *fr
 	kf.sf_uc.uc_mc.mc_version = LINUX_MCONTEXT_VERSION;
 
 	/* general registers and pc/sr */
-	memcpy( kf.sf_uc.uc_mc.mc_gregs.gr_regs, frame->f_regs, sizeof(u_int)*16);
+	memcpy(kf.sf_uc.uc_mc.mc_gregs.gr_regs, frame->f_regs, sizeof(u_int)*16);
 	kf.sf_uc.uc_mc.mc_gregs.gr_pc = frame->f_pc;
 	kf.sf_uc.uc_mc.mc_gregs.gr_sr = frame->f_sr;
 
@@ -318,7 +318,7 @@ setup_linux_rt_sigframe(struct frame *fr
 #endif
 		kf.sf_uc.uc_ss.ss_format = ft;
 		kf.sf_uc.uc_ss.ss_vector = frame->f_vector;
-		memcpy( _uc.uc_ss.ss_frame, >F_u,
+		memcpy(_uc.uc_ss.ss_frame, >F_u,
 			(size_t) exframesize[ft]);
 		/*
 		 * Leave an indicator that we need to clean up the kernel
@@ -596,7 +596,7 @@ bad:
 		if (frame->f_stackadj < sz)	/* just in case... */
 			goto bad;
 		frame->f_stackadj -= sz;
-		memcpy( >F_u, >sc_ss.ss_frame, sz);
+		memcpy(>F_u, >sc_ss.ss_frame, sz);
 #ifdef DEBUG
 		if (sigdebug & SDB_FOLLOW)
 			printf("linux_sys_sigreturn(%d): copy in %d of frame type %d\n",
@@ -726,7 +726,7 @@ bad:		
 	/*
 	 * Restore the user supplied information.
 	 */
-	memcpy( frame->f_regs, tuc.uc_mc.mc_gregs.gr_regs, sizeof(u_int)*16);
+	memcpy(frame->f_regs, tuc.uc_mc.mc_gregs.gr_regs, sizeof(u_int)*16);
 	frame->f_pc = tuc.uc_mc.mc_gregs.gr_pc;
 	/* Privileged bits of  sr  are silently ignored on Linux/m68k. */
 	frame->f_sr = tuc.uc_mc.mc_gregs.gr_sr & ~(PSL_MBZ|PSL_IPL|PSL_S);
@@ -742,7 +742,7 @@ bad:		
 		if (frame->f_stackadj < sz)	/* just in case... */
 			goto bad;
 		frame->f_stackadj -= sz;
-		memcpy( >F_u, _ss.ss_frame, sz);
+		memcpy(>F_u, _ss.ss_frame, sz);
 #ifdef DEBUG
 		if (sigdebug & SDB_FOLLOW)
 			printf("linux_sys_rt_sigreturn(%d): copy in %d of frame type %d\n",

Index: src/sys/netinet6/ip6_mroute.h
diff -u src/sys/netinet6/ip6_mroute.h:1.19 src/sys/netinet6/ip6_mroute.h:1.20
--- src/sys/netinet6/ip6_mroute.h:1.19	Sun May 20 06:29:43 2018
+++ src/sys/netinet6/ip6_mroute.h	Sun Aug  7 20:14:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_mroute.h,v 1.19 2018/05/20 06:29:43 maxv Exp $	*/
+/*	$NetBSD: ip6_mroute.h,v 1.20 2022/08/07 20:14:00 tsutsui Exp $	*/
 /*	$KAME: ip6_mroute.h,v 1.17 2001/02/10 02:05:52 itojun Exp $	*/
 
 /*
@@ -93,7 +93,7 @@ typedef	struct if_set {
 #define	IF_SET(n, p)	((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
 #define	IF_CLR(n, p)	((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
 #define	IF_ISSET(n, p)	((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
-#define	IF_COPY(f, t)	memcpy( t, f, sizeof(*(f)))
+#define	IF_COPY(f, t)	memcpy(t, f, sizeof(*(f)))
 #define	IF_ZERO(p)	memset(p, 0, sizeof(*(p)))
 
 /*



CVS commit: src/sys

2022-08-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Aug  7 20:14:01 UTC 2022

Modified Files:
src/sys/compat/linux/arch/m68k: linux_machdep.c
src/sys/netinet6: ip6_mroute.h

Log Message:
Remove extra whitespaces added by an ancient stupid script.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/compat/linux/arch/m68k/linux_machdep.c
cvs rdiff -u -r1.19 -r1.20 src/sys/netinet6/ip6_mroute.h

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



CVS commit: src/usr.bin/calendar/calendars

2022-08-07 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sun Aug  7 19:37:15 UTC 2022

Modified Files:
src/usr.bin/calendar/calendars: calendar.netbsd

Log Message:
note the release NetBSD 9.3


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/calendar/calendars/calendar.netbsd

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/calendar/calendars/calendar.netbsd
diff -u src/usr.bin/calendar/calendars/calendar.netbsd:1.47 src/usr.bin/calendar/calendars/calendar.netbsd:1.48
--- src/usr.bin/calendar/calendars/calendar.netbsd:1.47	Mon May 17 15:59:28 2021
+++ src/usr.bin/calendar/calendars/calendar.netbsd	Sun Aug  7 19:37:15 2022
@@ -76,6 +76,7 @@
 07/25   NetBSD/mvme68k port started, 1995
 08/02   NetBSD 5.0.1 released, 2009
 08/02   NetBSD/vax port started, 1994
+08/04   NetBSD 9.3 released, 2022
 08/12   NetBSD/mipsco port started, 2000
 08/20   pkgsrc forked from FreeBSD Ports, 1997
 08/22   NetBSD 6.1.1 released, 2013



CVS commit: src/usr.bin/calendar/calendars

2022-08-07 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sun Aug  7 19:37:15 UTC 2022

Modified Files:
src/usr.bin/calendar/calendars: calendar.netbsd

Log Message:
note the release NetBSD 9.3


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/calendar/calendars/calendar.netbsd

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-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 11:25:33 UTC 2022

Modified Files:
src/sys/dev/usb: uirda.c

Log Message:
uirda(4): Unconditionally initializes mutexes and selq on attach.

We're going to unconditionally destroy them on detach.

Reported-by: syzbot+6b8aea3a51d8b1e5a...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=ec5ed628986cba5aab5705691596a2d27b0301fc


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/usb/uirda.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/usb/uirda.c
diff -u src/sys/dev/usb/uirda.c:1.52 src/sys/dev/usb/uirda.c:1.53
--- src/sys/dev/usb/uirda.c:1.52	Sun Sep 26 15:08:29 2021
+++ src/sys/dev/usb/uirda.c	Sun Aug  7 11:25:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uirda.c,v 1.52 2021/09/26 15:08:29 thorpej Exp $	*/
+/*	$NetBSD: uirda.c,v 1.53 2022/08/07 11:25:32 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uirda.c,v 1.52 2021/09/26 15:08:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uirda.c,v 1.53 2022/08/07 11:25:32 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -201,6 +201,10 @@ uirda_attach(device_t parent, device_t s
 	sc->sc_udev = dev;
 	sc->sc_iface = iface;
 
+	mutex_init(>sc_wr_buf_lk, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(>sc_rd_buf_lk, MUTEX_DEFAULT, IPL_NONE);
+	selinit(>sc_rd_sel);
+
 	if (sc->sc_hdszi == 0)
 		sc->sc_hdszi = UIRDA_INPUT_HEADER_SIZE;
 
@@ -280,10 +284,6 @@ uirda_attach(device_t parent, device_t s
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev);
 
-	mutex_init(>sc_wr_buf_lk, MUTEX_DEFAULT, IPL_NONE);
-	mutex_init(>sc_rd_buf_lk, MUTEX_DEFAULT, IPL_NONE);
-	selinit(>sc_rd_sel);
-
 	ia.ia_type = IR_TYPE_IRFRAME;
 	ia.ia_methods = sc->sc_irm ? sc->sc_irm : _methods;
 	ia.ia_handle = sc;



CVS commit: src/sys/dev/usb

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 11:25:33 UTC 2022

Modified Files:
src/sys/dev/usb: uirda.c

Log Message:
uirda(4): Unconditionally initializes mutexes and selq on attach.

We're going to unconditionally destroy them on detach.

Reported-by: syzbot+6b8aea3a51d8b1e5a...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=ec5ed628986cba5aab5705691596a2d27b0301fc


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

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



CVS commit: src

2022-08-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  7 11:06:19 UTC 2022

Modified Files:
src/bin/ksh: ksh.Man
src/games/fortune/strfile: strfile.c
src/sbin/newfs_udf: udf_core.h
src/sbin/pppoectl: pppoectl.c
src/sys/arch/bebox/stand/boot: fd.c
src/sys/dev/nand: nand.h
src/sys/fs/udf: udf.h
src/sys/sys: wait.h
src/usr.bin/audio/ctl: audioctl.1

Log Message:
fix various typos in comments, documentation and messages.
mainly s/paramater/parameter/ and s/reduntant/redundant/.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/bin/ksh/ksh.Man
cvs rdiff -u -r1.43 -r1.44 src/games/fortune/strfile/strfile.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/newfs_udf/udf_core.h
cvs rdiff -u -r1.30 -r1.31 src/sbin/pppoectl/pppoectl.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/bebox/stand/boot/fd.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/nand/nand.h
cvs rdiff -u -r1.53 -r1.54 src/sys/fs/udf/udf.h
cvs rdiff -u -r1.37 -r1.38 src/sys/sys/wait.h
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/audio/ctl/audioctl.1

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



CVS commit: src

2022-08-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  7 11:06:19 UTC 2022

Modified Files:
src/bin/ksh: ksh.Man
src/games/fortune/strfile: strfile.c
src/sbin/newfs_udf: udf_core.h
src/sbin/pppoectl: pppoectl.c
src/sys/arch/bebox/stand/boot: fd.c
src/sys/dev/nand: nand.h
src/sys/fs/udf: udf.h
src/sys/sys: wait.h
src/usr.bin/audio/ctl: audioctl.1

Log Message:
fix various typos in comments, documentation and messages.
mainly s/paramater/parameter/ and s/reduntant/redundant/.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/bin/ksh/ksh.Man
cvs rdiff -u -r1.43 -r1.44 src/games/fortune/strfile/strfile.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/newfs_udf/udf_core.h
cvs rdiff -u -r1.30 -r1.31 src/sbin/pppoectl/pppoectl.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/bebox/stand/boot/fd.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/nand/nand.h
cvs rdiff -u -r1.53 -r1.54 src/sys/fs/udf/udf.h
cvs rdiff -u -r1.37 -r1.38 src/sys/sys/wait.h
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/audio/ctl/audioctl.1

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

Modified files:

Index: src/bin/ksh/ksh.Man
diff -u src/bin/ksh/ksh.Man:1.27 src/bin/ksh/ksh.Man:1.28
--- src/bin/ksh/ksh.Man:1.27	Sat Oct 30 21:08:58 2021
+++ src/bin/ksh/ksh.Man	Sun Aug  7 11:06:18 2022
@@ -1,5 +1,5 @@
 '\" t
-.\" $NetBSD: ksh.Man,v 1.27 2021/10/30 21:08:58 andvar Exp $
+.\" $NetBSD: ksh.Man,v 1.28 2022/08/07 11:06:18 andvar Exp $
 .\"{{{}}}
 .\"{{{  Notes about man page
 .\" - use the pseudo-macros .sh( and .sh) to begin and end sh-specific
@@ -3004,7 +3004,7 @@ If the entire remaining command
 or file name is unique a space is printed after its completion, unless
 it is a directory name in which case \fB/\fP is appended.
 If there is no command or file name with the current partial word as its
-prefix, a bell character is output (usually causing a audio beep).
+prefix, a bell character is output (usually causing an audio beep).
 .\"}}}
 .\"{{{  complete-command ^X^[
 .IP "\fBcomplete-command ^X^[\fP"

Index: src/games/fortune/strfile/strfile.c
diff -u src/games/fortune/strfile/strfile.c:1.43 src/games/fortune/strfile/strfile.c:1.44
--- src/games/fortune/strfile/strfile.c:1.43	Sun May  2 12:50:44 2021
+++ src/games/fortune/strfile/strfile.c	Sun Aug  7 11:06:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: strfile.c,v 1.43 2021/05/02 12:50:44 rillig Exp $	*/
+/*	$NetBSD: strfile.c,v 1.44 2022/08/07 11:06:18 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)strfile.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: strfile.c,v 1.43 2021/05/02 12:50:44 rillig Exp $");
+__RCSID("$NetBSD: strfile.c,v 1.44 2022/08/07 11:06:18 andvar Exp $");
 #endif
 #endif /* not lint */
 #endif /* __NetBSD__ */
@@ -457,7 +457,7 @@ randomize(void)
 
 /*
  * fwrite_be_offt:
- *	Write out the off paramater as a 64 bit big endian number
+ *	Write out the off parameter as a 64 bit big endian number
  */
 
 static void

Index: src/sbin/newfs_udf/udf_core.h
diff -u src/sbin/newfs_udf/udf_core.h:1.2 src/sbin/newfs_udf/udf_core.h:1.3
--- src/sbin/newfs_udf/udf_core.h:1.2	Sat Apr  9 09:58:11 2022
+++ src/sbin/newfs_udf/udf_core.h	Sun Aug  7 11:06:18 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_core.h,v 1.2 2022/04/09 09:58:11 riastradh Exp $ */
+/* $NetBSD: udf_core.h,v 1.3 2022/08/07 11:06:18 andvar Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2021, 2022 Reinoud Zandijk
@@ -164,7 +164,7 @@ struct udf_create_context {
 	int	 serialnum;		/* format serialno */
 
 	int	 gmtoff;		/* in minutes	 */
-	int	 meta_perc;		/* format paramter   */
+	int	 meta_perc;		/* format parameter  */
 	int	 check_surface;		/* for spareables*/
 	int	 create_new_session;	/* for non empty recordables */
 
@@ -192,7 +192,7 @@ struct udf_create_context {
 	struct pri_vol_desc	*primary_vol;		/* identification*/
 	struct logvol_desc	*logical_vol;		/* main mapping v->p */
 	struct unalloc_sp_desc	*unallocated;		/* free UDF space*/
-	struct impvol_desc	*implementation;	/* likely reduntant  */
+	struct impvol_desc	*implementation;	/* likely redundant  */
 	struct logvol_int_desc	*logvol_integrity;	/* current integrity */
 	struct part_desc	*partitions[UDF_PARTITIONS]; /* partitions   */
 

Index: src/sbin/pppoectl/pppoectl.c
diff -u src/sbin/pppoectl/pppoectl.c:1.30 src/sbin/pppoectl/pppoectl.c:1.31
--- src/sbin/pppoectl/pppoectl.c:1.30	Fri May 14 09:08:59 2021
+++ src/sbin/pppoectl/pppoectl.c	Sun Aug  7 11:06:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pppoectl.c,v 1.30 2021/05/14 09:08:59 yamaguchi Exp $	*/
+/*	$NetBSD: pppoectl.c,v 1.31 2022/08/07 11:06:18 andvar Exp $	*/
 
 /*
  * Copyright (c) 1997 Joerg Wunsch
@@ -31,7 +31,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: pppoectl.c,v 1.30 2021/05/14 09:08:59 yamaguchi Exp $");

CVS commit: src

2022-08-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  7 10:12:20 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: locore.s
src/tests/dev/audio: audiotest.c
src/usr.bin/mail: format.c

Log Message:
fix some typos and grammar in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/alpha/alpha/locore.s
cvs rdiff -u -r1.23 -r1.24 src/tests/dev/audio/audiotest.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/mail/format.c

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



CVS commit: src

2022-08-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  7 10:12:20 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: locore.s
src/tests/dev/audio: audiotest.c
src/usr.bin/mail: format.c

Log Message:
fix some typos and grammar in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/alpha/alpha/locore.s
cvs rdiff -u -r1.23 -r1.24 src/tests/dev/audio/audiotest.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/mail/format.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/locore.s
diff -u src/sys/arch/alpha/alpha/locore.s:1.142 src/sys/arch/alpha/alpha/locore.s:1.143
--- src/sys/arch/alpha/alpha/locore.s:1.142	Wed Jul 20 18:25:10 2022
+++ src/sys/arch/alpha/alpha/locore.s	Sun Aug  7 10:12:19 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.142 2022/07/20 18:25:10 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.143 2022/08/07 10:12:19 andvar Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.142 2022/07/20 18:25:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.143 2022/08/07 10:12:19 andvar Exp $");
 
 #include "assym.h"
 
@@ -164,7 +164,7 @@ NESTED_NOPROFILE(locorestart,1,0,ra,0,0)
 	 * going to fake our return address as the kthread backstop.
 	 * Hitting the backstop will trigger a panic, and we want lwp0
 	 * to work like other kthreads in that regard.  We will still
-	 * leep the "main returned" backstop here in case something
+	 * keep the "main returned" backstop here in case something
 	 * goes horribly wrong.
 	 */
 	lda	ra, alpha_kthread_backstop
@@ -277,7 +277,7 @@ LEAF(exception_return, 1)			/* XXX shoul
 2:	/*
 	 * Check to see if a soft interrupt is pending.  We need to only
 	 * check for soft ints eligible to run at the new IPL.  We generate
-	 * the mask of elible soft ints to run by masking the ssir with:
+	 * the mask of eligible soft ints to run by masking the ssir with:
 	 *
 	 *	(ALPHA_ALL_SOFTINTS << ((ipl) << 1))
 	 *
@@ -1155,7 +1155,7 @@ LEAF_NOPROFILE(_ufetch_8, 2)
 	ldq_u	t0, 0(a1)	/* load dest quad */
 	insbl	a0, a1, a0	/* a0 = byte in target position */
 	mskbl	t0, a1, t0	/* clear target byte in destination */
-	or	a0, t0, a0	/* or in byte to destionation */
+	or	a0, t0, a0	/* or in byte to destination */
 	stq_u	a0, 0(a1)	/* *a1 = fetched byte! */
 	mov	zero, v0
 	RET
@@ -1171,7 +1171,7 @@ LEAF_NOPROFILE(_ufetch_16, 2)
 	ldq_u	t0, 0(a1)	/* load dest quad */
 	inswl	a0, a1, a0	/* a0 = short in target position */
 	mskwl	t0, a1, t0	/* clear target short in destination */
-	or	a0, t0, a0	/* or in short to destionation */
+	or	a0, t0, a0	/* or in short to destination */
 	stq_u	a0, 0(a1)	/* *a1 = fetched short! */
 	mov	zero, v0
 	RET

Index: src/tests/dev/audio/audiotest.c
diff -u src/tests/dev/audio/audiotest.c:1.23 src/tests/dev/audio/audiotest.c:1.24
--- src/tests/dev/audio/audiotest.c:1.23	Sat Aug  6 18:26:42 2022
+++ src/tests/dev/audio/audiotest.c	Sun Aug  7 10:12:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiotest.c,v 1.23 2022/08/06 18:26:42 andvar Exp $	*/
+/*	$NetBSD: audiotest.c,v 1.24 2022/08/07 10:12:19 andvar Exp $	*/
 
 /*
  * Copyright (C) 2019 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: audiotest.c,v 1.23 2022/08/06 18:26:42 andvar Exp $");
+__RCSID("$NetBSD: audiotest.c,v 1.24 2022/08/07 10:12:19 andvar Exp $");
 
 #include 
 #include 
@@ -2308,7 +2308,7 @@ DEF(rdwr_fallback_RDWR) {
 
 /*
  * On full-duplex hardware, the second descriptor's readability/writability
- * is not depend on the first descriptor('s open mode).
+ * does not depend on the first descriptor's open mode.
  * On half-duplex hardware, it depends on the first descriptor's open mode.
  */
 void

Index: src/usr.bin/mail/format.c
diff -u src/usr.bin/mail/format.c:1.16 src/usr.bin/mail/format.c:1.17
--- src/usr.bin/mail/format.c:1.16	Mon Apr 19 17:49:28 2021
+++ src/usr.bin/mail/format.c	Sun Aug  7 10:12:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: format.c,v 1.16 2021/04/19 17:49:28 christos Exp $	*/
+/*	$NetBSD: format.c,v 1.17 2022/08/07 10:12:19 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef __lint__
-__RCSID("$NetBSD: format.c,v 1.16 2021/04/19 17:49:28 christos Exp $");
+__RCSID("$NetBSD: format.c,v 1.17 2022/08/07 10:12:19 andvar Exp $");
 #endif /* not __lint__ */
 
 #include 
@@ -726,7 +726,7 @@ dateof(struct tm *tm, struct message *mp
 	 * the "Date:" field.
 	 *
 	 * NOTE: The range for the time is 00:00 to 23:60 (to allow
-	 * for a leep second), but I have seen this violated making
+	 * for a leap second), but I have seen this violated making
 	 * strptime() fail, e.g.,
 	 *
 	 *   Date: Tue, 24 Oct 2006 24:07:58 +0400



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

2022-08-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  7 09:51:00 UTC 2022

Modified Files:
src/sys/arch/evbarm/conf: files.ixdp425

Log Message:
s/networkproccesor/network processor/


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/files.ixdp425

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

Modified files:

Index: src/sys/arch/evbarm/conf/files.ixdp425
diff -u src/sys/arch/evbarm/conf/files.ixdp425:1.9 src/sys/arch/evbarm/conf/files.ixdp425:1.10
--- src/sys/arch/evbarm/conf/files.ixdp425:1.9	Wed Jan 23 14:24:14 2013
+++ src/sys/arch/evbarm/conf/files.ixdp425	Sun Aug  7 09:51:00 2022
@@ -1,6 +1,6 @@
-#	$NetBSD: files.ixdp425,v 1.9 2013/01/23 14:24:14 skrll Exp $
+#	$NetBSD: files.ixdp425,v 1.10 2022/08/07 09:51:00 andvar Exp $
 #
-# Intel IXP425 networkproccesor board configuration info
+# Intel IXP425 network processor board configuration info
 #
 
 # IXP425 Network Processor CPU support



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

2022-08-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  7 09:51:00 UTC 2022

Modified Files:
src/sys/arch/evbarm/conf: files.ixdp425

Log Message:
s/networkproccesor/network processor/


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/files.ixdp425

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



CVS commit: src/sys

2022-08-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  7 09:37:47 UTC 2022

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
fix typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/powerpc/oea/oea_machdep.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/pci/ixgbe/ix_txrx.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/powerpc/oea/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.83 src/sys/arch/powerpc/oea/oea_machdep.c:1.84
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.83	Sun Dec  5 07:53:57 2021
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Sun Aug  7 09:37:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.83 2021/12/05 07:53:57 msaitoh Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.84 2022/08/07 09:37:46 andvar Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.83 2021/12/05 07:53:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.84 2022/08/07 09:37:46 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -420,7 +420,7 @@ oea_init(void (*handler)(void))
 	/*
 	 * If we are on a MPC601 processor, we need to zap any tlbsync
 	 * instructions into sync.  This differs from the above in
-	 * examing all kernel text, as opposed to just the exception handling.
+	 * examining all kernel text, as opposed to just the exception handling.
 	 * We sync the icache on every instruction found since there are
 	 * only very few of them.
 	 */

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.98 src/sys/dev/pci/ixgbe/ix_txrx.c:1.99
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.98	Wed May 11 17:22:20 2022
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sun Aug  7 09:37:47 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.98 2022/05/11 17:22:20 bouyer Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.99 2022/08/07 09:37:47 andvar Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.98 2022/05/11 17:22:20 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.99 2022/08/07 09:37:47 andvar Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -316,7 +316,7 @@ ixgbe_mq_start_locked(struct ifnet *ifp,
 #if __FreeBSD_version >= 1100036
 		/*
 		 * Since we're looking at the tx ring, we can check
-		 * to see if we're a VF by examing our tail register
+		 * to see if we're a VF by examining our tail register
 		 * address.
 		 */
 		if ((txr->adapter->feat_en & IXGBE_FEATURE_VF) &&
@@ -1964,7 +1964,7 @@ ixgbe_rxeof(struct ix_queue *que)
 		 * not be fragmented across sequential
 		 * descriptors, rather the next descriptor
 		 * is indicated in bits of the descriptor.
-		 * This also means that we might proceses
+		 * This also means that we might process
 		 * more than one packet at a time, something
 		 * that has never been true before, it
 		 * required eliminating global chain pointers



CVS commit: src/sys

2022-08-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  7 09:37:47 UTC 2022

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
fix typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/powerpc/oea/oea_machdep.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/pci/ixgbe/ix_txrx.c

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



CVS commit: src/bin/kill

2022-08-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  7 09:36:55 UTC 2022

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

Log Message:
kill(1): s/proceses/processes/


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/kill/kill.1

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

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.34 src/bin/kill/kill.1:1.35
--- src/bin/kill/kill.1:1.34	Sun Aug 15 10:58:04 2021
+++ src/bin/kill/kill.1	Sun Aug  7 09:36:55 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.34 2021/08/15 10:58:04 christos Exp $
+.\"	$NetBSD: kill.1,v 1.35 2022/08/07 09:36:55 andvar Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -151,7 +151,7 @@ STOP (non-catchable, non-ignorable, caus
 after which it can later be resumed using
 .Dv SIGCONT )
 .It 19
-CONT (stopped proceses resume execution)
+CONT (stopped processes resume execution)
 .El
 .Pp
 .Nm



CVS commit: src/bin/kill

2022-08-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  7 09:36:55 UTC 2022

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

Log Message:
kill(1): s/proceses/processes/


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/kill/kill.1

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-08-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug  7 08:37:48 UTC 2022

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

Log Message:
Provide and use (when appropriate) a bge_free_jumbo_mem.


To generate a diff of this commit:
cvs rdiff -u -r1.372 -r1.373 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/if_bgevar.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/pci

2022-08-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug  7 08:37:48 UTC 2022

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

Log Message:
Provide and use (when appropriate) a bge_free_jumbo_mem.


To generate a diff of this commit:
cvs rdiff -u -r1.372 -r1.373 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/if_bgevar.h

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.372 src/sys/dev/pci/if_bge.c:1.373
--- src/sys/dev/pci/if_bge.c:1.372	Sun Aug  7 08:26:18 2022
+++ src/sys/dev/pci/if_bge.c	Sun Aug  7 08:37:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.372 2022/08/07 08:26:18 skrll Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.373 2022/08/07 08:37:48 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.372 2022/08/07 08:26:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.373 2022/08/07 08:37:48 skrll Exp $");
 
 #include 
 #include 
@@ -223,9 +223,7 @@ static void bge_setmulti(struct bge_soft
 
 static void bge_handle_events(struct bge_softc *);
 static int bge_alloc_jumbo_mem(struct bge_softc *);
-#if 0 /* XXX */
 static void bge_free_jumbo_mem(struct bge_softc *);
-#endif
 static void *bge_jalloc(struct bge_softc *);
 static void bge_jfree(struct mbuf *, void *, size_t, void *);
 static int bge_newbuf_std(struct bge_softc *, int, struct mbuf *,
@@ -1313,7 +1311,6 @@ static int
 bge_alloc_jumbo_mem(struct bge_softc *sc)
 {
 	char *ptr, *kva;
-	bus_dma_segment_t	seg;
 	int		i, rseg, state, error;
 	struct bge_jpool_entry	 *entry;
 
@@ -1321,13 +1318,14 @@ bge_alloc_jumbo_mem(struct bge_softc *sc
 
 	/* Grab a big chunk o' storage. */
 	if (bus_dmamem_alloc(sc->bge_dmatag, BGE_JMEM, PAGE_SIZE, 0,
-	, 1, , BUS_DMA_NOWAIT)) {
+	>bge_cdata.bge_rx_jumbo_seg, 1, , BUS_DMA_NOWAIT)) {
 		aprint_error_dev(sc->bge_dev, "can't alloc rx buffers\n");
 		return ENOBUFS;
 	}
 
 	state = 1;
-	if (bus_dmamem_map(sc->bge_dmatag, , rseg, BGE_JMEM, (void **),
+	if (bus_dmamem_map(sc->bge_dmatag, >bge_cdata.bge_rx_jumbo_seg,
+	rseg, BGE_JMEM, (void **),
 	BUS_DMA_NOWAIT)) {
 		aprint_error_dev(sc->bge_dev,
 		"can't map DMA buffers (%d bytes)\n", (int)BGE_JMEM);
@@ -1386,7 +1384,8 @@ out:
 			bus_dmamem_unmap(sc->bge_dmatag, kva, BGE_JMEM);
 			/* FALLTHROUGH */
 		case 1:
-			bus_dmamem_free(sc->bge_dmatag, , rseg);
+			bus_dmamem_free(sc->bge_dmatag,
+			>bge_cdata.bge_rx_jumbo_seg, rseg);
 			break;
 		default:
 			break;
@@ -1396,6 +1395,26 @@ out:
 	return error;
 }
 
+static void
+bge_free_jumbo_mem(struct bge_softc *sc)
+{
+	struct bge_jpool_entry *entry, *tmp;
+
+	KASSERT(SLIST_EMPTY(>bge_jinuse_listhead));
+
+	SLIST_FOREACH_SAFE(entry, >bge_jfree_listhead, jpool_entries, tmp) {
+		kmem_free(entry, sizeof(*entry));
+	}
+
+	bus_dmamap_unload(sc->bge_dmatag, sc->bge_cdata.bge_rx_jumbo_map);
+
+	bus_dmamap_destroy(sc->bge_dmatag, sc->bge_cdata.bge_rx_jumbo_map);
+
+	bus_dmamem_unmap(sc->bge_dmatag, sc->bge_cdata.bge_jumbo_buf, BGE_JMEM);
+
+	bus_dmamem_free(sc->bge_dmatag, >bge_cdata.bge_rx_jumbo_seg, 1);
+}
+
 /*
  * Allocate a jumbo buffer.
  */
@@ -4071,6 +4090,9 @@ bge_release_resources(struct bge_softc *
 		sc->bge_intrhand = NULL;
 	}
 
+	if (sc->bge_cdata.bge_jumbo_buf != NULL)
+		bge_free_jumbo_mem(sc);
+
 	if (sc->bge_dmatag != NULL) {
 		bus_dmamap_unload(sc->bge_dmatag, sc->bge_ring_map);
 		bus_dmamap_destroy(sc->bge_dmatag, sc->bge_ring_map);

Index: src/sys/dev/pci/if_bgevar.h
diff -u src/sys/dev/pci/if_bgevar.h:1.30 src/sys/dev/pci/if_bgevar.h:1.31
--- src/sys/dev/pci/if_bgevar.h:1.30	Mon Jul 25 08:29:14 2022
+++ src/sys/dev/pci/if_bgevar.h	Sun Aug  7 08:37:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bgevar.h,v 1.30 2022/07/25 08:29:14 skrll Exp $	*/
+/*	$NetBSD: if_bgevar.h,v 1.31 2022/08/07 08:37:48 skrll Exp $	*/
 /*
  * Copyright (c) 2001 Wind River Systems
  * Copyright (c) 1997, 1998, 1999, 2001
@@ -218,6 +218,7 @@ struct bge_chain_data {
 	struct mbuf		*bge_rx_jumbo_chain[BGE_JUMBO_RX_RING_CNT];
 	bus_dmamap_t		bge_rx_std_map[BGE_STD_RX_RING_CNT];
 	bus_dmamap_t		bge_rx_jumbo_map;
+	bus_dma_segment_t	bge_rx_jumbo_seg;
 	/* Stick the jumbo mem management stuff here too. */
 	void *			bge_jslots[BGE_JSLOTS];
 	void *			bge_jumbo_buf;



CVS commit: src/sys/dev/pci

2022-08-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug  7 08:26:19 UTC 2022

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

Log Message:
Misc tidyup. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 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/sys/dev/pci

2022-08-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug  7 08:26:19 UTC 2022

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

Log Message:
Misc tidyup. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 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.371 src/sys/dev/pci/if_bge.c:1.372
--- src/sys/dev/pci/if_bge.c:1.371	Sun Aug  7 08:24:23 2022
+++ src/sys/dev/pci/if_bge.c	Sun Aug  7 08:26:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.371 2022/08/07 08:24:23 skrll Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.372 2022/08/07 08:26:18 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.371 2022/08/07 08:24:23 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.372 2022/08/07 08:26:18 skrll Exp $");
 
 #include 
 #include 
@@ -5603,10 +5603,10 @@ bge_init(struct ifnet *ifp)
 	 * entry of the ring.
 	 */
 	if (sc->bge_chipid == BGE_CHIPID_BCM5705_A0) {
-		uint32_t		v, i;
+		u_int i;
 		for (i = 0; i < 10; i++) {
 			DELAY(20);
-			v = bge_readmem_ind(sc, BGE_STD_RX_RINGS + 8);
+			uint32_t v = bge_readmem_ind(sc, BGE_STD_RX_RINGS + 8);
 			if (v == (MCLBYTES - ETHER_ALIGN))
 break;
 		}



CVS commit: src/sys/dev/pci

2022-08-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug  7 08:24:24 UTC 2022

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

Log Message:
Unwrap a long line and remove unecessary brackets. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.370 -r1.371 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.370 src/sys/dev/pci/if_bge.c:1.371
--- src/sys/dev/pci/if_bge.c:1.370	Sun Aug  7 08:19:38 2022
+++ src/sys/dev/pci/if_bge.c	Sun Aug  7 08:24:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.370 2022/08/07 08:19:38 skrll Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.371 2022/08/07 08:24:23 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.370 2022/08/07 08:19:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.371 2022/08/07 08:24:23 skrll Exp $");
 
 #include 
 #include 
@@ -1424,17 +1424,15 @@ bge_jfree(struct mbuf *m, void *buf, siz
 {
 	struct bge_jpool_entry *entry;
 	struct bge_softc * const sc = arg;
-	int i, s;
+	int s;
 
 	if (sc == NULL)
 		panic("bge_jfree: can't find softc pointer!");
 
 	/* calculate the slot this buffer belongs to */
+	int i = ((char *)buf - (char *)sc->bge_cdata.bge_jumbo_buf) / BGE_JLEN;
 
-	i = ((char *)buf
-	 - (char *)sc->bge_cdata.bge_jumbo_buf) / BGE_JLEN;
-
-	if ((i < 0) || (i >= BGE_JSLOTS))
+	if (i < 0 || i >= BGE_JSLOTS)
 		panic("bge_jfree: asked to free buffer that we don't manage!");
 
 	s = splvm();



CVS commit: src/sys/dev/pci

2022-08-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug  7 08:24:24 UTC 2022

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

Log Message:
Unwrap a long line and remove unecessary brackets. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.370 -r1.371 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/sys/dev/pci

2022-08-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug  7 08:19:39 UTC 2022

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

Log Message:
Fix the KNF. oops.


To generate a diff of this commit:
cvs rdiff -u -r1.369 -r1.370 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.369 src/sys/dev/pci/if_bge.c:1.370
--- src/sys/dev/pci/if_bge.c:1.369	Sun Aug  7 08:12:47 2022
+++ src/sys/dev/pci/if_bge.c	Sun Aug  7 08:19:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.369 2022/08/07 08:12:47 skrll Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.370 2022/08/07 08:19:38 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,10 +79,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.369 2022/08/07 08:12:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.370 2022/08/07 08:19:38 skrll Exp $");
 
 #include 
-#include 
+#include 
 
 #include 
 #include 



  1   2   3   4   5   6   7   8   9   10   >