CVS commit: src/sys/kern

2024-01-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Jan  4 11:18:20 UTC 2024

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

Log Message:
dump topology information with aprint_debug instead of requiring to build
a DEBUG kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/kern/subr_cpu.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

2024-01-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Jan  4 11:18:20 UTC 2024

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

Log Message:
dump topology information with aprint_debug instead of requiring to build
a DEBUG kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/kern/subr_cpu.c

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

Modified files:

Index: src/sys/kern/subr_cpu.c
diff -u src/sys/kern/subr_cpu.c:1.19 src/sys/kern/subr_cpu.c:1.20
--- src/sys/kern/subr_cpu.c:1.19	Sat Jul  8 13:59:05 2023
+++ src/sys/kern/subr_cpu.c	Thu Jan  4 11:18:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_cpu.c,v 1.19 2023/07/08 13:59:05 riastradh Exp $	*/
+/*	$NetBSD: subr_cpu.c,v 1.20 2024/01/04 11:18:19 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012, 2019, 2020
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.19 2023/07/08 13:59:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.20 2024/01/04 11:18:19 mlelstv Exp $");
 
 #include 
 #include 
@@ -223,7 +223,6 @@ cpu_topology_link(struct cpu_info *ci, s
 static void
 cpu_topology_dump(void)
 {
-#ifdef DEBUG
 	CPU_INFO_ITERATOR cii;
 	struct cpu_info *ci, *ci2;
 	const char *names[] = { "core", "pkg", "1st" };
@@ -237,25 +236,24 @@ cpu_topology_dump(void)
 
 	for (CPU_INFO_FOREACH(cii, ci)) {
 		if (cpu_topology_haveslow)
-			printf("%s ", ci->ci_is_slow ? "slow" : "fast");
+			aprint_debug("%s ", ci->ci_is_slow ? "slow" : "fast");
 		for (rel = 0; rel < __arraycount(ci->ci_sibling); rel++) {
-			printf("%s has %d %s siblings:", cpu_name(ci),
+			aprint_debug("%s has %d %s siblings:", cpu_name(ci),
 			ci->ci_nsibling[rel], names[rel]);
 			ci2 = ci->ci_sibling[rel];
 			i = 0;
 			do {
-printf(" %s", cpu_name(ci2));
+aprint_debug(" %s", cpu_name(ci2));
 ci2 = ci2->ci_sibling[rel];
 			} while (++i < 64 && ci2 != ci->ci_sibling[rel]);
 			if (i == 64) {
-printf(" GAVE UP");
+aprint_debug(" GAVE UP");
 			}
-			printf("\n");
+			aprint_debug("\n");
 		}
-		printf("%s first in package: %s\n", cpu_name(ci),
+		aprint_debug("%s first in package: %s\n", cpu_name(ci),
 		cpu_name(ci->ci_package1st));
 	}
-#endif	/* DEBUG */
 }
 
 /*



Re: Network and port redirection with QEMU not working with package compiled on 10.0_RC1

2024-01-03 Thread Michael van Elst
baba...@babafou.eu.org (Marc Baudoin) writes:

>Has anybody got a working QEMU (at least network-wise) compiled
>on NetBSD 10.0_RC[12]?

No problems here, neither with qemu-8.1.0 (2023Q3) nor qemu-8.1.3 (2023Q4):

Host:
NetBSD tazz 10.99.10 NetBSD 10.99.10 (TAZZ) #311: Sun Dec 24 15:24:24 UTC 2023  
mlelstv@slowpoke:/scratch2/obj.amd64/scratch/netbsd-current/src/sys/arch/amd64/compile/TAZZ
 amd64

Guest:
NetBSD standalone 10.99.5 NetBSD 10.99.5 (GENERIC) #0: Sun Jul  9 00:01:55 UTC 
2023  mkre...@mkrepro.netbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64

configured with:

-netdev user,id=n1
-device virtio-net,netdev=n1



Re: Prob using CPIO

2024-01-01 Thread Michael van Elst
tgru...@gmail.com (Todd Gruhn) writes:

>I zip up much  music:

>   find . -depth -print | cpio -ov > file.cpio

>To unzip it , I must undo *cpio severa times severa times:

>   cpio -iv < file.cpio

Your 'zip' packs the local directory including the cpio file that
is being created. You don't have to cpio several times to unpack,
but the data (most likely) exists twice in the archive.


>Am I messing this up somehow? The *.cpio file is about 250MB...

Yes, don't include the resulting cpio file, easiest by writing
it to a separate directory.



Re: PSA: Clock drift and pkgin

2023-12-30 Thread Michael van Elst
mo...@rodents-montreal.org (Mouse) writes:

>> Modern hardware could easily do 100kHz.

>Not with curren^Wat least one moderately recent NetBSD version!

>At work, I had occasion to run 9.1/amd64 with HZ=8000.  This was to get
>8-bit data pushed out a parallel port at 8kHz; I added special-case
>hooks between the relevant driver and the clock (I forget whether
>softclock or hardclock).  It worked for its intended use fairly
>nicely...but when I tried one of my SIGALRM testers on it, instead of
>the 100Hz it asked for, I got signals at, IIRC, about 77Hz.


Scheduling and switching userland processes is heavy. For a test
try to schedule kernel callouts with high HZ values. That still
generates lots of overhead with the current design but you should
be able to go faster than 8kHz.



PSA: Clock drift and pkgin

2023-12-30 Thread Michael van Elst
On Sun, Dec 31, 2023 at 12:42:29AM +0100, Johnny Billquist wrote:
> > Better than 100Hz is possible and still precise. Something around 1000Hz
> > is necessary for human interaction. Modern hardware could easily do 100kHz.
> 
> ? If I remember right, anything less than 200ms is immediate response for a
> human brain. Which means you can get away with much coarser than even 100Hz.
> And there are certainly lots of examples of older computers with clocks
> running in the 10s of ms, where human interaction feels perfect.

You may not be able to react faster than 200ms, but you can notice
shorter time periods.


> I think that is a separate question/problem/issue. That we fail when guest
> and host run at the same rate is something I consider a flaw in the system.

With a fixed tick, they cannot run at the same speed. This becomes
obvious when you try to run at different speeds that aren't just
integer multiples.

N.B. my m68k emulator runs a HZ=100 guest without a problem. But that's
a fake, in reality it only runs 100 ticks per second on average, In
particular when the guest becomes idle.


Greetings,
-- 
        Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: PSA: Clock drift and pkgin

2023-12-30 Thread Michael van Elst
On Sat, Dec 30, 2023 at 10:48:26PM +0100, Johnny Billquist wrote:
> 
> Right. But if you expect high precision on delays and scheduling, then you
> start also having issues with just random unpredictable delays because of
> other interrupts, paging, and whatnot. So in the end, your high precision
> delays and scheduling becomes very imprecise again. So, is there really that
> much value in that higher resolution?

Better than 100Hz is possible and still precise. Something around 1000Hz
is necessary for human interaction. Modern hardware could easily do 100kHz.

Another advantage is that you can use independent timing (that's what
bites in the emulator case where guest and host clocks run at the same
rate).

-- 
            Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: PSA: Clock drift and pkgin

2023-12-30 Thread Michael van Elst
b...@softjar.se (Johnny Billquist) writes:

>Being able to measure time with high precision is desierable, but we can 
>already do that without being tickless.

We cannot delay with high precision. You can increase HZ to some degree,
but that comes at a price.



CVS commit: src/sys/dev/iscsi

2023-12-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 28 15:58:24 UTC 2023

Modified Files:
src/sys/dev/iscsi: iscsi_main.c

Log Message:
Use correct status value SCSI_BUSY (0x08) instead of XS_BUSY (7) when running
out of sessions. The bug had no impact as scsipi was only comparing
against SCSI_CHECK (0x02) and SCSI_QUEUE_FULL (0x28).


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/iscsi/iscsi_main.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/iscsi

2023-12-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 28 15:58:24 UTC 2023

Modified Files:
src/sys/dev/iscsi: iscsi_main.c

Log Message:
Use correct status value SCSI_BUSY (0x08) instead of XS_BUSY (7) when running
out of sessions. The bug had no impact as scsipi was only comparing
against SCSI_CHECK (0x02) and SCSI_QUEUE_FULL (0x28).


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

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

Modified files:

Index: src/sys/dev/iscsi/iscsi_main.c
diff -u src/sys/dev/iscsi/iscsi_main.c:1.41 src/sys/dev/iscsi/iscsi_main.c:1.42
--- src/sys/dev/iscsi/iscsi_main.c:1.41	Tue Sep 13 13:09:16 2022
+++ src/sys/dev/iscsi/iscsi_main.c	Thu Dec 28 15:58:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_main.c,v 1.41 2022/09/13 13:09:16 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_main.c,v 1.42 2023/12/28 15:58:24 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -490,7 +490,7 @@ iscsi_scsipi_request(struct scsipi_chann
 			DEB(9, ("ISCSI: refcount too high: %d, winsize %d\n",
 sess->s_refcount, sess->s_send_window));
 			xs->error = XS_BUSY;
-			xs->status = XS_BUSY;
+			xs->status = SCSI_BUSY;
 			scsipi_done(xs);
 			return;
 		}



CVS commit: src/sbin/iscsid

2023-12-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Dec 27 18:07:30 UTC 2023

Modified Files:
src/sbin/iscsid: iscsid_driverif.c

Log Message:
Treat port 0 (unset) as ISCSI_DEFAULT_PORT like before.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/iscsid/iscsid_driverif.c

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

Modified files:

Index: src/sbin/iscsid/iscsid_driverif.c
diff -u src/sbin/iscsid/iscsid_driverif.c:1.9 src/sbin/iscsid/iscsid_driverif.c:1.10
--- src/sbin/iscsid/iscsid_driverif.c:1.9	Sat Nov 25 08:06:02 2023
+++ src/sbin/iscsid/iscsid_driverif.c	Wed Dec 27 18:07:30 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsid_driverif.c,v 1.9 2023/11/25 08:06:02 mlelstv Exp $	*/
+/*	$NetBSD: iscsid_driverif.c,v 1.10 2023/12/27 18:07:30 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -285,7 +285,8 @@ make_connection(session_t * sess, iscsid
 	memset(, 0, sizeof(hints));
 	hints.ai_family = AF_UNSPEC;
 	hints.ai_socktype = SOCK_STREAM;
-	snprintf(portnum, sizeof(portnum), "%u", addr->port);
+	snprintf(portnum, sizeof(portnum), "%u", addr->port
+	? addr->port : ISCSI_DEFAULT_PORT);
 	ret = getaddrinfo((char *)addr->address, portnum, , );
 	switch (ret) {
 	case 0:
@@ -553,7 +554,8 @@ event_recover_connection(uint32_t sid, u
 	memset(, 0, sizeof(hints));
 	hints.ai_family = AF_UNSPEC;
 	hints.ai_socktype = SOCK_STREAM;
-	snprintf(portnum, sizeof(portnum), "%u", addr->port);
+	snprintf(portnum, sizeof(portnum), "%u", addr->port
+	? addr->port : ISCSI_DEFAULT_PORT);
 	ret = getaddrinfo((char *)addr->address, portnum, , );
 	if (ret) {
 		DEB(1, ("getaddrinfo failed (%s)", gai_strerror(ret)));



CVS commit: src/sbin/iscsid

2023-12-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Dec 27 18:07:30 UTC 2023

Modified Files:
src/sbin/iscsid: iscsid_driverif.c

Log Message:
Treat port 0 (unset) as ISCSI_DEFAULT_PORT like before.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/iscsid/iscsid_driverif.c

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



Re: After -10 patch that fixes kern/57669

2023-12-27 Thread Michael van Elst
joel.bertr...@systella.fr (=?UTF-8?Q?BERTRAND_Jo=c3=abl?=) writes:

>   I have seen Michael has applied patch to fix ccb_timout to -10 kernel.
>Thus, I have rebuilt my tree to have a unpatched kernel and I cannot now
>access to my NAS over iSCSI. Of course, I have reinstalled kernel /and/
>userland.

>   In dmesg, I only obtain :

>[71,854636] Invalid socket 7


Looks like there is a bug with the default port number.

Quick workaround is to specify the target with port number
like 1.2.3.4:3260.




Re: PSA: Clock drift and pkgin

2023-12-24 Thread Michael van Elst
sim...@netbsd.org (Simon Burge) writes:

>qemu uses ppoll() which is implemented with pollts() to do emulated
>timers, so that doesn't help here.  I don't know what simh uses, nor
>any of the other emulators.

simh uses pthread_cond_timedwait().

This actually waits using TIMER_ABSTIME for a deadline, but which is
converted to a timeout with ts2timo() and passed to sleepq_block()
as a number of ticks to wait for.

ts2timo() uses tvothz() which rounds up...



Re: PSA: Clock drift and pkgin

2023-12-23 Thread Michael van Elst
mo...@rodents-montreal.org (Mouse) writes:

>} else if (sec <= (LONG_MAX / 100))
>ticks = (((sec * 100) + (unsigned long)usec + (tick - 1))
>/ tick) + 1;

>which looks suspicious.  If sec is zero and usec is tick, that
>expression will return 2 instead of the 1 I suspect it needs to return.


The delay is always rounded up to the resolution of the clock,
so waiting for 1 microsecond waits at least 10ms.

The interval to the next tick can be arbitrarily short. Waiting
for at least 10ms therefore means to wait for the second next
tick.

In a tickless system, such a problem doesn't exist.



Re: Are The Packages Gone Again?

2023-12-19 Thread Michael van Elst
j...@m5.chicago.il.us ("Jay F. Shachter") writes:

>I was able to reinstall ghostscript (as I stated).  The others --
>ImageMagick6, atril, gv, libspectre and okular -- are gone.

At least there was no problem to build them.

-rw-r--r--  1 root  wheel  11102472 Sep 29 14:25 
final-amd64-10.0-2023Q3/All/ImageMagick6-6.9.12.91.tgz
-rw-r--r--  1 root  wheel   4430189 Sep 29 18:01 
final-amd64-10.0-2023Q3/All/atril-1.26.1nb1.tgz
-rw-r--r--  1 root  wheel220628 Sep 29 17:37 
final-amd64-10.0-2023Q3/All/gv-3.7.4nb12.tgz
-rw-r--r--  1 root  wheel 71680 Sep 29 13:50 
final-amd64-10.0-2023Q3/All/libspectre-0.2.9nb2.tgz
-rw-r--r--  1 root  wheel   9531552 Sep 30 00:34 
final-amd64-10.0-2023Q3/All/okular-23.04.3.tgz



Re: Change max ttys from 8 to 12?

2023-12-19 Thread Michael van Elst
u...@stderr.spb.ru (Valery Ushakov) writes:

>Switching from a fixed size array to a dynamic one is probably not too
>much work either.  But then, overall, I think that trying to make the
>kernel substitute for screen, tmux (in base), etc is kinda dead end,
>so I'd rather we don't encourage it.


We currently already have an inconsistent configuration. wscons
is limited to 8 screens but there are keyboard symbols to switch
to 10 screens where the last two cannot be used.

So bumping the screen limit to 10 shouldn't really be the question.

Bumping both limits to 12 (and augmenting keysyms and the keymaps
for this) would align this with the other *BSDs. The con side here
is that some keyboards either only have 10 function keys or already
use F11 and F12 for other purposes (like DEC keyboard has F11=ESC,
so ctrl-alt-f11 invokes DDB).



Re: Are The Packages Gone Again?

2023-12-19 Thread Michael van Elst
j...@m5.chicago.il.us ("Jay F. Shachter") writes:

>Are the NetBSD 10 packages gone again?  I recently removed ghostscript
>with the intention of re-installing it (gs was complaining that there
>was no libtiff.so, which is preposterous, because there was, but I
>didn't want to argue with it).

Can't tell why they are gone. My last private bulk build yielded:

-rw-r--r--  1 root  wheel  1390 Sep 29 07:47 
final-amd64-10.0-2023Q3/All/ghostscript-9.05nb31.tgz
-rw-r--r--  1 root  wheel  23276644 Sep 29 07:47 
final-amd64-10.0-2023Q3/All/ghostscript-agpl-10.01.2.tgz
-rw-r--r--  1 root  wheel  5460 Sep 30 01:12 
final-amd64-10.0-2023Q3/All/ghostscript-cidfonts-2901nb6.tgz
-rw-r--r--  1 root  wheel  5456 Sep 30 14:37 
final-amd64-10.0-2023Q3/All/ghostscript-cmaps-20020913nb3.tgz
-rw-r--r--  1 root  wheel827591 Sep 29 07:30 
final-amd64-10.0-2023Q3/All/ghostscript-fonts-8.11nb3.tgz
-rw-r--r--  1 root  wheel  14937225 Sep 30 04:45 
final-amd64-10.0-2023Q3/All/ghostscript-gpl-9.06nb47.tgz




CVS commit: src/sys/dev/pci

2023-12-16 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Dec 16 16:35:49 UTC 2023

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

Log Message:
- handle stuck transmitter (descriptor still owned)
- restart send queue after transmit
- count output packets
- use deferred start

Should fix PR 57694


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pci/if_rge.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_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.28 src/sys/dev/pci/if_rge.c:1.29
--- src/sys/dev/pci/if_rge.c:1.28	Thu Oct 19 23:43:40 2023
+++ src/sys/dev/pci/if_rge.c	Sat Dec 16 16:35:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.28 2023/10/19 23:43:40 mrg Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.29 2023/12/16 16:35:49 mlelstv Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.9 2020/12/12 11:48:53 jan Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.28 2023/10/19 23:43:40 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.29 2023/12/16 16:35:49 mlelstv Exp $");
 
 #include 
 
@@ -351,6 +351,7 @@ rge_attach(device_t parent, device_t sel
 	sc->sc_media.ifm_media = sc->sc_media.ifm_cur->ifm_media;
 
 	if_attach(ifp);
+	if_deferred_start_init(ifp, NULL);
 	ether_ifattach(ifp, eaddr);
 
 	if (pmf_device_register(self, NULL, NULL))
@@ -1385,10 +1386,14 @@ rge_txeof(struct rge_softc *sc)
 		m_freem(txq->txq_mbuf);
 		txq->txq_mbuf = NULL;
 
+		net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 		if (txstat & (RGE_TDCMDSTS_EXCESSCOLL | RGE_TDCMDSTS_COLL))
-			if_statinc(ifp, if_collisions);
+			if_statinc_ref(nsr, if_collisions);
 		if (txstat & RGE_TDCMDSTS_TXERR)
-			if_statinc(ifp, if_oerrors);
+			if_statinc_ref(nsr, if_oerrors);
+		else
+			if_statinc_ref(nsr, if_opackets);
+		IF_STAT_PUTREF(ifp);
 
 		bus_dmamap_sync(sc->sc_dmat, sc->rge_ldata.rge_tx_list_map,
 		idx * sizeof(struct rge_tx_desc),
@@ -1404,24 +1409,12 @@ rge_txeof(struct rge_softc *sc)
 
 	sc->rge_ldata.rge_txq_considx = cons;
 
-#if 0
-	if (ifq_is_oactive(>if_snd))
-		ifq_restart(>if_snd);
-	else if (free == 2)
-		ifq_serialize(>if_snd, >sc_task);
-	else
-		ifp->if_timer = 0;
-#else
-#if 0
-	if (!IF_IS_EMPTY(>if_snd))
-		rge_start(ifp);
-	else
 	if (free == 2)
-		if (0) { rge_txstart(>sc_task, sc); }
-	else
-#endif
-		ifp->if_timer = 0;
-#endif
+		rge_txstart(>sc_task, sc);
+
+	CLR(ifp->if_flags, IFF_OACTIVE);
+	ifp->if_timer = 0;
+	if_schedule_deferred_start(ifp);
 
 	return (1);
 }



CVS commit: src/sys/dev/pci

2023-12-16 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Dec 16 16:35:49 UTC 2023

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

Log Message:
- handle stuck transmitter (descriptor still owned)
- restart send queue after transmit
- count output packets
- use deferred start

Should fix PR 57694


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pci/if_rge.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/i386/stand/libsa

2023-12-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 14 08:06:23 UTC 2023

Modified Files:
src/sys/arch/i386/stand/libsa: nfs.c

Log Message:
Align again with libsa (NFS_NOSYMLINK fix).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/stand/libsa/nfs.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/i386/stand/libsa

2023-12-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 14 08:06:23 UTC 2023

Modified Files:
src/sys/arch/i386/stand/libsa: nfs.c

Log Message:
Align again with libsa (NFS_NOSYMLINK fix).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/stand/libsa/nfs.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/i386/stand/libsa/nfs.c
diff -u src/sys/arch/i386/stand/libsa/nfs.c:1.20 src/sys/arch/i386/stand/libsa/nfs.c:1.21
--- src/sys/arch/i386/stand/libsa/nfs.c:1.20	Tue Dec 12 09:16:17 2023
+++ src/sys/arch/i386/stand/libsa/nfs.c	Thu Dec 14 08:06:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs.c,v 1.20 2023/12/12 09:16:17 mlelstv Exp $	*/
+/*	$NetBSD: nfs.c,v 1.21 2023/12/14 08:06:23 mlelstv Exp $	*/
 
 /*-
  *  Copyright (c) 1993 John Brezak
@@ -597,9 +597,9 @@ nfs_open(const char *path, struct open_f
 	char namebuf[NFS_MAXPATHLEN + 1];
 	char linkbuf[NFS_MAXPATHLEN + 1];
 	int nlinks = 0;
+	n_long fa_type;
 #endif
 	int error = 0;
-	n_long fa_type;
 
 #ifdef NFS_DEBUG
  	if (debug)



CVS commit: src/sys/arch/i386/stand/libsa

2023-12-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Dec 12 09:16:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/libsa: nfs.c

Log Message:
Merge with generic libsa NFS code to minimize differences and to learn NFSv3.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/libsa/nfs.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/i386/stand/libsa

2023-12-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Dec 12 09:16:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/libsa: nfs.c

Log Message:
Merge with generic libsa NFS code to minimize differences and to learn NFSv3.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/libsa/nfs.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/i386/stand/libsa/nfs.c
diff -u src/sys/arch/i386/stand/libsa/nfs.c:1.19 src/sys/arch/i386/stand/libsa/nfs.c:1.20
--- src/sys/arch/i386/stand/libsa/nfs.c:1.19	Sun Dec 25 06:09:09 2011
+++ src/sys/arch/i386/stand/libsa/nfs.c	Tue Dec 12 09:16:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs.c,v 1.19 2011/12/25 06:09:09 tsutsui Exp $	*/
+/*	$NetBSD: nfs.c,v 1.20 2023/12/12 09:16:17 mlelstv Exp $	*/
 
 /*-
  *  Copyright (c) 1993 John Brezak
@@ -28,6 +28,16 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * XXX Does not currently implement:
+ * XXX
+ * XXX LIBSA_NO_FS_CLOSE
+ * XXX LIBSA_NO_FS_SEEK
+ * XXX LIBSA_NO_FS_WRITE
+ * XXX LIBSA_NO_FS_SYMLINK (does this even make sense?)
+ * XXX LIBSA_FS_SINGLECOMPONENT (does this even make sense?)
+ */
+
 #include 
 #include 
 #include 
@@ -43,6 +53,7 @@
 
 #include "rpcv2.h"
 #include "nfsv2.h"
+#include "nfsv3.h"
 
 #include 
 #include "net.h"
@@ -50,40 +61,11 @@
 #include "nfs.h"
 #include "rpc.h"
 
-/* Define our own NFS attributes. */
-struct nfsv2_fattrs {
-	n_long	fa_type;
-	n_long	fa_mode;
-	n_long	fa_nlink;
-	n_long	fa_uid;
-	n_long	fa_gid;
-	n_long	fa_size;
-	n_long	fa_blocksize;
-	n_long	fa_rdev;
-	n_long	fa_blocks;
-	n_long	fa_fsid;
-	n_long	fa_fileid;
-	struct nfsv2_time fa_atime;
-	struct nfsv2_time fa_mtime;
-	struct nfsv2_time fa_ctime;
-};
-
-
-struct nfs_read_args {
-	u_char	fh[NFS_FHSIZE];
-	n_long	off;
-	n_long	len;
-	n_long	xxx;			/* XXX what's this for? */
-};
+/* Storage for any filehandle (including length for V3) */
+#define NFS_FHSTORE (NFS_FHSIZE < NFS_V3FHSIZE ? NFS_V3FHSIZE + 4: NFS_FHSIZE)
 
 /* Data part of nfs rpc reply (also the largest thing we receive) */
 #define NFSREAD_SIZE 1024
-struct nfs_read_repl {
-	n_long	errno;
-	struct	nfsv2_fattrs fa;
-	n_long	count;
-	u_char	data[NFSREAD_SIZE];
-};
 
 #ifndef NFS_NOSYMLINK
 struct nfs_readlnk_repl {
@@ -93,36 +75,88 @@ struct nfs_readlnk_repl {
 };
 #endif
 
+static inline uint64_t
+getnquad(n_long x[2]) {
+	return (uint64_t)ntohl(x[0]) << 32 | ntohl(x[1]);
+}
+
+static inline void
+setnquad(n_long x[2], uint64_t v)
+{
+	x[0] = htonl((n_long)(v >> 32));
+	x[1] = htonl((n_long)(v & 0x));
+}
+
 struct nfs_iodesc {
 	struct	iodesc	*iodesc;
 	off_t	off;
-	u_char	fh[NFS_FHSIZE];
-	struct nfsv2_fattrs fa;	/* all in network order */
+	int	version;
+	u_char	fh[NFS_FHSTORE];
+	union {
+		/* all in network order */
+		struct nfsv2_fattr v2;
+		struct nfsv3_fattr v3;
+	} u_fa;
 };
 
-int	nfs_getrootfh(struct iodesc *, char *, u_char *);
+static inline size_t
+fhstore(int version, u_char *fh)
+{
+	size_t len;
+
+	switch (version) {
+	case NFS_VER2:
+		len = NFS_FHSIZE;
+		break;
+	case NFS_VER3:
+		len = fh[0] << 24 | fh[1] << 16 | fh[2] << 8 | fh[3];
+		if (len > NFS_V3FHSIZE)
+			len = NFS_V3FHSIZE;
+		len = 4 + roundup(len, 4);
+		break;
+	default:
+		len = 0;
+		break;
+	}
+
+	return len;
+}
+
+static inline size_t
+fhcopy(int version, u_char *src, u_char *dst)
+{
+	size_t len = fhstore(version, src);
+	memcpy(dst, src, len);
+	return len;
+}
+
+#define setfh(d, s) fhcopy((d)->version, (s), (d)->fh)
+#define getfh(d, s) fhcopy((d)->version, (d)->fh, (s))
+
+
+struct nfs_iodesc nfs_root_node;
+
+int	nfs_getrootfh(struct iodesc *, char *, u_char *, int *);
 int	nfs_lookupfh(struct nfs_iodesc *, const char *, int,
 	struct nfs_iodesc *);
-#ifndef NFS_NOSYMLINK
 int	nfs_readlink(struct nfs_iodesc *, char *);
-#endif
 ssize_t	nfs_readdata(struct nfs_iodesc *, off_t, void *, size_t);
 
 /*
  * Fetch the root file handle (call mount daemon)
- * Return zero or error number.
+ * On error, return non-zero and set errno.
  */
 int
-nfs_getrootfh(struct iodesc *d, char *path, u_char *fhp)
+nfs_getrootfh(struct iodesc *d, char *path, u_char *fhp, int *versionp)
 {
-	size_t len;
+	int len;
 	struct args {
 		n_long	len;
 		char	path[FNAME_SIZE];
 	} *args;
 	struct repl {
 		n_long	errno;
-		u_char	fh[NFS_FHSIZE];
+		u_char	fh[NFS_FHSTORE];
 	} *repl;
 	struct {
 		n_long	h[RPC_HEADER_WORDS];
@@ -136,32 +170,42 @@ nfs_getrootfh(struct iodesc *d, char *pa
 
 #ifdef NFS_DEBUG
 	if (debug)
-		printf("nfs_getrootfh: %s\n", path);
+		printf("%s: %s\n", __func__, path);
 #endif
 
 	args = 
 	repl = 
 
-	memset(args, 0, sizeof(*args));
+	(void)memset(args, 0, sizeof(*args));
 	len = strlen(path);
-	if (len > sizeof(args->path))
+	if ((size_t)len > sizeof(args->path))
 		len = sizeof(args->path);
 	args->len = htonl(len);
-	memcpy(args->path, path, len);
+	(void)memcpy(args->path, path, len);
 	len = 4 + roundup(len, 4);
 
-	cc = 

CVS commit: src/sys/lib/libsa

2023-12-12 Thread Michael van Elst
type = currfd->u_fa.v2.fa_type;
+			break;
+		case NFS_VER3:
+			fa_type = currfd->u_fa.v3.fa_type;
+			break;
+		default:
+			fa_type = htonl(NFNON);
+			break;
+		}
+		if (fa_type != htonl(NFDIR)) {
 			error = ENOTDIR;
 			goto out;
 		}
@@ -431,6 +647,7 @@ nfs_open(const char *path, struct open_f
 		newfd = alloc(sizeof(*newfd));
 		newfd->iodesc = currfd->iodesc;
 		newfd->off = 0;
+		newfd->version = currfd->version;
 
 		/*
 		 * Get next component of path name.
@@ -456,7 +673,18 @@ nfs_open(const char *path, struct open_f
 		/*
 		 * Check for symbolic link
 		 */
-		if (newfd->fa.fa_type == htonl(NFLNK)) {
+		switch (newfd->version) {
+		case NFS_VER2:
+			fa_type = newfd->u_fa.v2.fa_type;
+			break;
+		case NFS_VER3:
+			fa_type = newfd->u_fa.v3.fa_type;
+			break;
+		default:
+			fa_type = htonl(NFNON);
+			break;
+		}
+		if (fa_type == htonl(NFLNK)) {
 			int link_len, len;
 
 			error = nfs_readlink(newfd, linkbuf);
@@ -506,6 +734,7 @@ out:
 	currfd = alloc(sizeof(*currfd));
 	currfd->iodesc = nfs_root_node.iodesc;
 	currfd->off = 0;
+	currfd->version = nfs_root_node.version;
 
 	cp = path;
 	/*
@@ -613,7 +842,18 @@ __compactcall off_t
 nfs_seek(struct open_file *f, off_t offset, int where)
 {
 	struct nfs_iodesc *d = (struct nfs_iodesc *)f->f_fsdata;
-	n_long size = ntohl(d->fa.fa_size);
+	off_t size;
+
+	switch (d->version) {
+	case NFS_VER2:
+		size = ntohl(d->u_fa.v2.fa_size);
+		break;
+	case NFS_VER3:
+		size = getnquad(d->u_fa.v3.fa_size);
+		break;
+	default:
+		return -1;
+	}
 
 	switch (where) {
 	case SEEK_SET:
@@ -642,15 +882,29 @@ nfs_stat(struct open_file *f, struct sta
 	struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
 	n_long ftype, mode;
 
-	ftype = ntohl(fp->fa.fa_type);
-	mode  = ntohl(fp->fa.fa_mode);
-	mode |= nfs_stat_types[ftype & 7];
+	switch (fp->version) {
+	case NFS_VER2:
+		ftype = ntohl(fp->u_fa.v2.fa_type);
+		mode  = ntohl(fp->u_fa.v2.fa_mode);
+		sb->st_nlink = ntohl(fp->u_fa.v2.fa_nlink);
+		sb->st_uid   = ntohl(fp->u_fa.v2.fa_uid);
+		sb->st_gid   = ntohl(fp->u_fa.v2.fa_gid);
+		sb->st_size  = ntohl(fp->u_fa.v2.fa_size);
+		break;
+	case NFS_VER3:
+		ftype = ntohl(fp->u_fa.v3.fa_type);
+		mode  = ntohl(fp->u_fa.v3.fa_mode);
+		sb->st_nlink = ntohl(fp->u_fa.v3.fa_nlink);
+		sb->st_uid   = ntohl(fp->u_fa.v3.fa_uid);
+		sb->st_gid   = ntohl(fp->u_fa.v3.fa_gid);
+		sb->st_size  = getnquad(fp->u_fa.v3.fa_size);
+		break;
+	default:
+		return -1;
+	}
 
+	mode |= nfs_stat_types[ftype & 7];
 	sb->st_mode  = mode;
-	sb->st_nlink = ntohl(fp->fa.fa_nlink);
-	sb->st_uid   = ntohl(fp->fa.fa_uid);
-	sb->st_gid   = ntohl(fp->fa.fa_gid);
-	sb->st_size  = ntohl(fp->fa.fa_size);
 
 	return 0;
 }

Index: src/sys/lib/libsa/nfsv2.h
diff -u src/sys/lib/libsa/nfsv2.h:1.4 src/sys/lib/libsa/nfsv2.h:1.5
--- src/sys/lib/libsa/nfsv2.h:1.4	Sun Dec 11 12:24:46 2005
+++ src/sys/lib/libsa/nfsv2.h	Tue Dec 12 09:12:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfsv2.h,v 1.4 2005/12/11 12:24:46 christos Exp $	*/
+/*	$NetBSD: nfsv2.h,v 1.5 2023/12/12 09:12:55 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -144,19 +144,3 @@ struct nfsv2_fattr {
 	struct nfsv2_time fa_ctime;
 };
 
-struct nfsv2_sattr {
-	n_long	sa_mode;
-	n_long	sa_uid;
-	n_long	sa_gid;
-	n_long	sa_size;
-	struct nfsv2_time sa_atime;
-	struct nfsv2_time sa_mtime;
-};
-
-struct nfsv2_statfs {
-	n_long	sf_tsize;
-	n_long	sf_bsize;
-	n_long	sf_blocks;
-	n_long	sf_bfree;
-	n_long	sf_bavail;
-};

Index: src/sys/lib/libsa/rpcv2.h
diff -u src/sys/lib/libsa/rpcv2.h:1.3 src/sys/lib/libsa/rpcv2.h:1.4
--- src/sys/lib/libsa/rpcv2.h:1.3	Sun Dec 11 12:24:46 2005
+++ src/sys/lib/libsa/rpcv2.h	Tue Dec 12 09:12:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcv2.h,v 1.3 2005/12/11 12:24:46 christos Exp $	*/
+/*	$NetBSD: rpcv2.h,v 1.4 2023/12/12 09:12:55 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -75,6 +75,7 @@
 /* RPC Prog definitions */
 #define	RPCPROG_MNT	15
 #define	RPCMNT_VER1	1
+#define	RPCMNT_VER3	3
 #define	RPCMNT_MOUNT	1
 #define	RPCMNT_DUMP	2
 #define	RPCMNT_UMOUNT	3

Added files:

Index: src/sys/lib/libsa/nfsv3.h
diff -u /dev/null src/sys/lib/libsa/nfsv3.h:1.1
--- /dev/null	Tue Dec 12 09:12:55 2023
+++ src/sys/lib/libsa/nfsv3.h	Tue Dec 12 09:12:55 2023
@@ -0,0 +1,73 @@
+/*	$NetBSD: nfsv3.h,v 1.1 2023/12/12 09:12:55 mlelstv Exp $	*/
+
+/*
+ * Copyright (c) 2023 Michael van Elst
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Rick Macklem at The University of Guelph.
+ *
+ * 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
+ *no

CVS commit: src/sys/lib/libsa

2023-12-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Dec 12 09:12:55 UTC 2023

Modified Files:
src/sys/lib/libsa: nfs.c nfsv2.h rpcv2.h
Added Files:
src/sys/lib/libsa: nfsv3.h

Log Message:
Add NFSv3 support. Try NFSv3 and fall back to NFSv2.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/lib/libsa/nfs.c
cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libsa/nfsv2.h
cvs rdiff -u -r0 -r1.1 src/sys/lib/libsa/nfsv3.h
cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libsa/rpcv2.h

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



CVS commit: src/usr.sbin/crash

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 14:00:47 UTC 2023

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
Implement cngetc, don't abort.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/crash/crash.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/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.15 src/usr.sbin/crash/crash.c:1.16
--- src/usr.sbin/crash/crash.c:1.15	Wed Apr 12 17:53:32 2023
+++ src/usr.sbin/crash/crash.c	Mon Dec 11 14:00:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.15 2023/04/12 17:53:32 riastradh Exp $	*/
+/*	$NetBSD: crash.c,v 1.16 2023/12/11 14:00:47 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: crash.c,v 1.15 2023/04/12 17:53:32 riastradh Exp $");
+__RCSID("$NetBSD: crash.c,v 1.16 2023/12/11 14:00:47 mlelstv Exp $");
 #endif /* not lint */
 
 #include 
@@ -94,7 +94,6 @@ void lockdebug_lock_print(void) {
 }
 #endif
 
-
 static void
 cleanup(void)
 {
@@ -309,9 +308,11 @@ db_check_interrupt(void)
 int
 cngetc(void)
 {
+	char ch;
 
-	fprintf(stderr, "cngetc\n");
-	abort();
+	if (el_getc(elptr, ) <= 0)
+		return 0;
+	return (unsigned char)ch;
 }
 
 void



CVS commit: src/usr.sbin/crash

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 14:00:47 UTC 2023

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
Implement cngetc, don't abort.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/crash/crash.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/rpcinfo

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:56:48 UTC 2023

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

Log Message:
Use IANA registerd service name "sunrpc" instead of "rpcbind".


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/rpcinfo/rpcinfo.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/rpcinfo/rpcinfo.c
diff -u src/usr.bin/rpcinfo/rpcinfo.c:1.37 src/usr.bin/rpcinfo/rpcinfo.c:1.38
--- src/usr.bin/rpcinfo/rpcinfo.c:1.37	Fri May 24 23:09:45 2013
+++ src/usr.bin/rpcinfo/rpcinfo.c	Mon Dec 11 13:56:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcinfo.c,v 1.37 2013/05/24 23:09:45 christos Exp $	*/
+/*	$NetBSD: rpcinfo.c,v 1.38 2023/12/11 13:56:47 mlelstv Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -569,7 +569,7 @@ get_inet_address(struct sockaddr_in *add
 		} else {
 			(void)memset(, 0, sizeof hints);
 			hints.ai_family = AF_INET;
-			if ((error = getaddrinfo(host, "rpcbind", , ))
+			if ((error = getaddrinfo(host, "sunrpc", , ))
 			!= 0) {
 errx(1, "%s: %s", host, gai_strerror(error));
 			} else {
@@ -1628,7 +1628,7 @@ getclnthandle(const char *host, const st
 
 	/* Get the address of the rpcbind */
 	(void)memset(, 0, sizeof hints);
-	if (getaddrinfo(host, "rpcbind", , ) != 0) {
+	if (getaddrinfo(host, "sunrpc", , ) != 0) {
 		rpc_createerr.cf_stat = RPC_N2AXLATEFAILURE;
 		return NULL;
 	}



CVS commit: src/usr.bin/rpcinfo

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:56:48 UTC 2023

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

Log Message:
Use IANA registerd service name "sunrpc" instead of "rpcbind".


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/rpcinfo/rpcinfo.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/wscons

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:38:13 UTC 2023

Modified Files:
src/sys/dev/wscons: wsksymdef.h

Log Message:
Adjust next key value (it's not used anywhere).


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/wscons/wsksymdef.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/wscons/wsksymdef.h
diff -u src/sys/dev/wscons/wsksymdef.h:1.77 src/sys/dev/wscons/wsksymdef.h:1.78
--- src/sys/dev/wscons/wsksymdef.h:1.77	Wed Sep 22 17:37:32 2021
+++ src/sys/dev/wscons/wsksymdef.h	Mon Dec 11 13:38:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsksymdef.h,v 1.77 2021/09/22 17:37:32 nia Exp $ */
+/*	$NetBSD: wsksymdef.h,v 1.78 2023/12/11 13:38:13 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -687,7 +687,7 @@ action(KB_UA,	0,	0x1200,	"ua",	,	"Ukrain
 
 /* Define all the KB_xx numeric values using above table */
 #define KBF_ENUM(tag, tagf, value, cc, ccf, country) tag=value,
-enum { KB_ENC_FUN(KBF_ENUM) KB_NEXT=0x1d00 };
+enum { KB_ENC_FUN(KBF_ENUM) KB_NEXT=0x2200 };
 
 /* Define list of KB_xxx and country codes for array initialisation */
 #define KBF_ENCTAB(tag, tagf, value, cc, ccf, country) { tag, cc },



CVS commit: src/sys/dev/wscons

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:38:13 UTC 2023

Modified Files:
src/sys/dev/wscons: wsksymdef.h

Log Message:
Adjust next key value (it's not used anywhere).


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/wscons/wsksymdef.h

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



CVS commit: src/sys/dev/usb

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:35:40 UTC 2023

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

Log Message:
Regen


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

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

Modified files:

Index: src/sys/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.801 src/sys/dev/usb/usbdevs.h:1.802
--- src/sys/dev/usb/usbdevs.h:1.801	Thu Sep  7 20:04:18 2023
+++ src/sys/dev/usb/usbdevs.h	Mon Dec 11 13:35:40 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.801 2023/09/07 20:04:18 ad Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.802 2023/12/11 13:35:40 mlelstv Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.808 2023/05/14 22:30:13 pgoyette Exp
+ *	NetBSD: usbdevs,v 1.810 2023/12/11 13:33:35 mlelstv Exp
  */
 
 /*-
@@ -2902,6 +2902,7 @@
 #define	USB_PRODUCT_REALTEK_RTL8151	0x8151		/* RTL8151 PNA */
 #define	USB_PRODUCT_REALTEK_RTL8152	0x8152		/* RTL8152 */
 #define	USB_PRODUCT_REALTEK_RTL8153	0x8153		/* RTL8153 */
+#define	USB_PRODUCT_REALTEK_RTL8156	0x8156		/* RTL8156 */
 #define	USB_PRODUCT_REALTEK_RTL8188CE_0	0x8170		/* RTL8188CE */
 #define	USB_PRODUCT_REALTEK_RTL8171	0x8171		/* RTL8171 */
 #define	USB_PRODUCT_REALTEK_RTL8172	0x8172		/* RTL8172 */
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.801 src/sys/dev/usb/usbdevs_data.h:1.802
--- src/sys/dev/usb/usbdevs_data.h:1.801	Thu Sep  7 20:04:18 2023
+++ src/sys/dev/usb/usbdevs_data.h	Mon Dec 11 13:35:40 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.801 2023/09/07 20:04:18 ad Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.802 2023/12/11 13:35:40 mlelstv Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.808 2023/05/14 22:30:13 pgoyette Exp
+ *	NetBSD: usbdevs,v 1.810 2023/12/11 13:33:35 mlelstv Exp
  */
 
 /*-
@@ -3914,20 +3914,22 @@ static const uint32_t usb_products[] = {
 	17221, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8153, 
 	17229, 0,
+	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8156, 
+	17237, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CE_0, 
 	7357, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8171, 
-	17237, 0,
-	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8172, 
 	17245, 0,
-	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8173, 
+	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8172, 
 	17253, 0,
-	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8174, 
+	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8173, 
 	17261, 0,
+	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8174, 
+	17269, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_0, 
 	5293, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8191CU, 
-	17269, 0,
+	17277, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192CU, 
 	5273, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188EU, 
@@ -3937,7 +3939,7 @@ static const uint32_t usb_products[] = {
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_2, 
 	5293, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192CE, 
-	17279, 0,
+	17287, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188RU, 
 	17177, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CE_1, 
@@ -3947,181 +3949,181 @@ static const uint32_t usb_products[] = {
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187, 
 	8936, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187B_0, 
-	17289, 0,
+	17297, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CUS, 
 	7504, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192EU, 
-	17298, 0,
+	17306, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_3, 
 	5293, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187B_1, 
-	17289, 0,
+	17297, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187B_2, 
-	17289, 0,
+	17297, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8712, 
-	17308, 0,
-	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8713, 
 	17316, 0,
+	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8713, 
+	17324, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_COMBO, 
 	5293, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192SU, 
 	5431, 0,
 	USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY, 
-	17324, 0,
+	17332, 0,
 	USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY_PEARL_DUAL, 
-	17324, 17335, 13673, 0,
+	17332, 17343, 13673, 0,
 	USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY_PEARL, 
-	17324, 17335, 0,
+	17332, 17343, 0,
 	USB_VENDOR_ROCKFIRE, USB_PRODUCT_ROCKFIRE_GAMEPAD, 
-	12974, 17341, 0,
+	12974, 17349, 0,
 	USB_VENDOR_ROLAND, 

CVS commit: src/sys/dev/usb

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:35:40 UTC 2023

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

Log Message:
Regen


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

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



CVS commit: src/sys/dev/usb

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:33:35 UTC 2023

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

Log Message:
Add RTL8156


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

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.809 src/sys/dev/usb/usbdevs:1.810
--- src/sys/dev/usb/usbdevs:1.809	Thu Sep  7 20:04:18 2023
+++ src/sys/dev/usb/usbdevs	Mon Dec 11 13:33:35 2023
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.809 2023/09/07 20:04:18 ad Exp $
+$NetBSD: usbdevs,v 1.810 2023/12/11 13:33:35 mlelstv Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -2895,6 +2895,7 @@ product REALTEK RTL8150L	0x8150	RTL8150L
 product REALTEK RTL8151		0x8151	RTL8151 PNA
 product REALTEK RTL8152		0x8152	RTL8152
 product REALTEK RTL8153		0x8153	RTL8153
+product REALTEK RTL8156		0x8156	RTL8156
 product REALTEK RTL8188CE_0	0x8170	RTL8188CE
 product REALTEK RTL8171		0x8171	RTL8171
 product REALTEK RTL8172		0x8172	RTL8172



CVS commit: src/sys/dev/usb

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:33:35 UTC 2023

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

Log Message:
Add RTL8156


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

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



CVS commit: src/sys/dev/onewire

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:30:33 UTC 2023

Modified Files:
src/sys/dev/onewire: owtemp.c

Log Message:
Don't unregister envsys when not registered.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/onewire/owtemp.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/onewire/owtemp.c
diff -u src/sys/dev/onewire/owtemp.c:1.21 src/sys/dev/onewire/owtemp.c:1.22
--- src/sys/dev/onewire/owtemp.c:1.21	Tue Oct 10 19:21:38 2023
+++ src/sys/dev/onewire/owtemp.c	Mon Dec 11 13:30:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: owtemp.c,v 1.21 2023/10/10 19:21:38 kardel Exp $	*/
+/*	$NetBSD: owtemp.c,v 1.22 2023/12/11 13:30:33 mlelstv Exp $	*/
 /*	$OpenBSD: owtemp.c,v 1.1 2006/03/04 16:27:03 grange Exp $	*/
 
 /*-
@@ -51,7 +51,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: owtemp.c,v 1.21 2023/10/10 19:21:38 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: owtemp.c,v 1.22 2023/12/11 13:30:33 mlelstv Exp $");
 
 #include 
 #include 
@@ -161,6 +161,7 @@ owtemp_attach(device_t parent, device_t 
 	"%s S/N %012" PRIx64, sc->sc_chipname, ONEWIRE_ROM_SN(sc->sc_rom));
 	if (sysmon_envsys_sensor_attach(sc->sc_sme, >sc_sensor)) {
 		sysmon_envsys_destroy(sc->sc_sme);
+		sc->sc_sme = NULL;
 		return;
 	}
 
@@ -172,6 +173,7 @@ owtemp_attach(device_t parent, device_t 
 	if (sysmon_envsys_register(sc->sc_sme)) {
 		aprint_error_dev(self, "unable to register with sysmon\n");
 		sysmon_envsys_destroy(sc->sc_sme);
+		sc->sc_sme = NULL;
 		return;
 	}
 
@@ -183,7 +185,8 @@ owtemp_detach(device_t self, int flags)
 {
 	struct owtemp_softc *sc = device_private(self);
 
-	sysmon_envsys_unregister(sc->sc_sme);
+	if (sc->sc_sme != NULL)
+		sysmon_envsys_unregister(sc->sc_sme);
 	evcnt_detach(>sc_ev_rsterr);
 	evcnt_detach(>sc_ev_update);
 	evcnt_detach(>sc_ev_crcerr);



CVS commit: src/sys/dev/onewire

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:30:33 UTC 2023

Modified Files:
src/sys/dev/onewire: owtemp.c

Log Message:
Don't unregister envsys when not registered.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/onewire/owtemp.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/ic

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:29:03 UTC 2023

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

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/dw_hdmi.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/dw_hdmi.c
diff -u src/sys/dev/ic/dw_hdmi.c:1.10 src/sys/dev/ic/dw_hdmi.c:1.11
--- src/sys/dev/ic/dw_hdmi.c:1.10	Fri Mar 25 23:16:04 2022
+++ src/sys/dev/ic/dw_hdmi.c	Mon Dec 11 13:29:03 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dw_hdmi.c,v 1.10 2022/03/25 23:16:04 tnn Exp $ */
+/* $NetBSD: dw_hdmi.c,v 1.11 2023/12/11 13:29:03 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.10 2022/03/25 23:16:04 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.11 2023/12/11 13:29:03 mlelstv Exp $");
 
 #include 
 #include 
@@ -729,7 +729,7 @@ dwhdmi_audio_swvol_codec(audio_filter_ar
 {
 	struct dwhdmi_softc * const sc = arg->context;
 	const aint_t *src;
-	aint_t *dst;
+	int16_t *dst;
 	u_int sample_count;
 	u_int i;
 



CVS commit: src/sys/dev/ic

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:29:03 UTC 2023

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

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/dw_hdmi.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/ic

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:28:15 UTC 2023

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

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/anx_dp.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/anx_dp.c
diff -u src/sys/dev/ic/anx_dp.c:1.5 src/sys/dev/ic/anx_dp.c:1.6
--- src/sys/dev/ic/anx_dp.c:1.5	Sun Dec 19 12:43:37 2021
+++ src/sys/dev/ic/anx_dp.c	Mon Dec 11 13:28:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: anx_dp.c,v 1.5 2021/12/19 12:43:37 riastradh Exp $ */
+/* $NetBSD: anx_dp.c,v 1.6 2023/12/11 13:28:15 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2019 Jonathan A. Kollasch 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: anx_dp.c,v 1.5 2021/12/19 12:43:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: anx_dp.c,v 1.6 2023/12/11 13:28:15 mlelstv Exp $");
 
 #include 
 #include 
@@ -791,7 +791,7 @@ anxdp_audio_swvol_codec(audio_filter_arg
 {
 	struct anxdp_softc * const sc = arg->context;
 	const aint_t *src;
-	aint_t *dst;
+	int16_t *dst;
 	u_int sample_count;
 	u_int i;
 



CVS commit: src/sys/dev/ic

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:28:15 UTC 2023

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

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/anx_dp.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/i2c

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:27:24 UTC 2023

Modified Files:
src/sys/dev/i2c: es8316ac.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/es8316ac.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/i2c/es8316ac.c
diff -u src/sys/dev/i2c/es8316ac.c:1.5 src/sys/dev/i2c/es8316ac.c:1.6
--- src/sys/dev/i2c/es8316ac.c:1.5	Wed Jan 27 02:29:48 2021
+++ src/sys/dev/i2c/es8316ac.c	Mon Dec 11 13:27:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: es8316ac.c,v 1.5 2021/01/27 02:29:48 thorpej Exp $ */
+/* $NetBSD: es8316ac.c,v 1.6 2023/12/11 13:27:24 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: es8316ac.c,v 1.5 2021/01/27 02:29:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: es8316ac.c,v 1.6 2023/12/11 13:27:24 mlelstv Exp $");
 
 #include 
 #include 
@@ -298,7 +298,7 @@ escodec_swvol_codec(audio_filter_arg_t *
 {
 	struct escodec_softc * const sc = arg->context;
 	const aint_t *src;
-	aint_t *dst;
+	int16_t *dst;
 	u_int sample_count;
 	u_int i;
 



CVS commit: src/sys/dev/i2c

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:27:24 UTC 2023

Modified Files:
src/sys/dev/i2c: es8316ac.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/es8316ac.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/macppc/dev

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:06:06 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/macppc/dev/snapper.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/macppc/dev/snapper.c
diff -u src/sys/arch/macppc/dev/snapper.c:1.65 src/sys/arch/macppc/dev/snapper.c:1.66
--- src/sys/arch/macppc/dev/snapper.c:1.65	Thu Jun  2 16:22:27 2022
+++ src/sys/arch/macppc/dev/snapper.c	Mon Dec 11 13:06:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.65 2022/06/02 16:22:27 macallan Exp $	*/
+/*	$NetBSD: snapper.c,v 1.66 2023/12/11 13:06:06 mlelstv Exp $	*/
 /*	Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp	*/
 /*	Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp		*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.65 2022/06/02 16:22:27 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.66 2023/12/11 13:06:06 mlelstv Exp $");
 
 #include 
 #include 
@@ -187,7 +187,7 @@ snapper_volume(audio_filter_arg_t *arg)
 {
 	struct snapper_softc *sc;
 	const aint_t *src;
-	aint_t *dst;
+	int16_t *dst;
 	u_int sample_count;
 	u_int i;
 



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

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:06:06 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/macppc/dev/snapper.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/arm/broadcom

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:53:08 UTC 2023

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_com.c

Log Message:
Report UART clock.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/broadcom/bcm2835_com.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/arm/broadcom/bcm2835_com.c
diff -u src/sys/arch/arm/broadcom/bcm2835_com.c:1.8 src/sys/arch/arm/broadcom/bcm2835_com.c:1.9
--- src/sys/arch/arm/broadcom/bcm2835_com.c:1.8	Fri Jan 29 14:11:14 2021
+++ src/sys/arch/arm/broadcom/bcm2835_com.c	Mon Dec 11 12:53:08 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_com.c,v 1.8 2021/01/29 14:11:14 skrll Exp $ */
+/* $NetBSD: bcm2835_com.c,v 1.9 2023/12/11 12:53:08 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_com.c,v 1.8 2021/01/29 14:11:14 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_com.c,v 1.9 2023/12/11 12:53:08 mlelstv Exp $");
 
 #include 
 #include 
@@ -123,7 +123,8 @@ bcm_com_attach(device_t parent, device_t
 		intrstr);
 		return;
 	}
-	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
+	aprint_normal_dev(self, "interrupting on %s, clock %u Hz\n",
+	   intrstr, sc->sc_frequency);
 }
 
 static int



CVS commit: src/sys/arch/arm/broadcom

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:53:08 UTC 2023

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_com.c

Log Message:
Report UART clock.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/broadcom/bcm2835_com.c

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



CVS commit: src/sbin/swapctl

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:47:24 UTC 2023

Modified Files:
src/sbin/swapctl: swaplist.c

Log Message:
Avoid overflow of totals.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/swapctl/swaplist.c

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

Modified files:

Index: src/sbin/swapctl/swaplist.c
diff -u src/sbin/swapctl/swaplist.c:1.18 src/sbin/swapctl/swaplist.c:1.19
--- src/sbin/swapctl/swaplist.c:1.18	Tue May 31 09:34:25 2016
+++ src/sbin/swapctl/swaplist.c	Mon Dec 11 12:47:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: swaplist.c,v 1.18 2016/05/31 09:34:25 pgoyette Exp $	*/
+/*	$NetBSD: swaplist.c,v 1.19 2023/12/11 12:47:24 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1997 Matthew R. Green
@@ -28,7 +28,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: swaplist.c,v 1.18 2016/05/31 09:34:25 pgoyette Exp $");
+__RCSID("$NetBSD: swaplist.c,v 1.19 2023/12/11 12:47:24 mlelstv Exp $");
 #endif
 
 
@@ -61,8 +61,9 @@ list_swap(int pri, int kflag, int pflag,
 	char	szbuf[5], usbuf[5], avbuf[5]; /* size, used, avail */
 	const	char *header, *suff;
 	size_t	l;
-	int	hlen, totalsize, size, totalinuse, inuse, ncounted, pathmax;
+	int	hlen, size, inuse, ncounted, pathmax;
 	int	rnswap, nswap = swapctl(SWAP_NSWAP, 0, 0), i;
+	int64_t	totalsize, totalinuse;
 
 	if (nswap < 1) {
 		puts("no swap devices configured");



CVS commit: src/sbin/swapctl

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:47:24 UTC 2023

Modified Files:
src/sbin/swapctl: swaplist.c

Log Message:
Avoid overflow of totals.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/swapctl/swaplist.c

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



CVS commit: src/sbin/gpt

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:45:22 UTC 2023

Modified Files:
src/sbin/gpt: gpt.c

Log Message:
Be verbose about errors.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sbin/gpt/gpt.c

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



CVS commit: src/sbin/gpt

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:45:22 UTC 2023

Modified Files:
src/sbin/gpt: gpt.c

Log Message:
Be verbose about errors.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sbin/gpt/gpt.c

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

Modified files:

Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.85 src/sbin/gpt/gpt.c:1.86
--- src/sbin/gpt/gpt.c:1.85	Tue Sep 26 15:55:46 2023
+++ src/sbin/gpt/gpt.c	Mon Dec 11 12:45:22 2023
@@ -35,7 +35,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.85 2023/09/26 15:55:46 kre Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.86 2023/12/11 12:45:22 mlelstv Exp $");
 #endif
 
 #include 
@@ -386,8 +386,10 @@ gpt_gpt(gpt_t gpt, off_t lba, int found)
 	uint32_t crc;
 
 	hdr = gpt_read(gpt, lba, 1);
-	if (hdr == NULL)
+	if (hdr == NULL) {
+		gpt_warn(gpt, "Read failed");
 		return -1;
+	}
 
 	if (memcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)))
 		goto fail_hdr;
@@ -540,6 +542,7 @@ gpt_open(const char *dev, int flags, int
 			gpt->secsz = 512;	/* Fixed size for files. */
 		if (gpt->mediasz == 0) {
 			if (gpt->sb.st_size % gpt->secsz) {
+gpt_warn(gpt, "Media size not a multiple of sector size (%u)\n", gpt->secsz);
 errno = EINVAL;
 goto close;
 			}
@@ -602,6 +605,8 @@ gpt_open(const char *dev, int flags, int
 	if (gpt->fd != -1)
 		close(gpt->fd);
 	free(gpt);
+	if (!(flags & GPT_QUIET))
+		gpt_warn(gpt, "No GPT found");
 	return NULL;
 }
 



CVS commit: src/lib/libpuffs

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:42:18 UTC 2023

Modified Files:
src/lib/libpuffs: dispatcher.c

Log Message:
pathconf needs to return EINVAL when the variable is invalid
or cannot be associated with a file. This also needs to be true
when the node doesn't implement the pathconf function at all.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libpuffs/dispatcher.c

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



CVS commit: src/lib/libpuffs

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:42:18 UTC 2023

Modified Files:
src/lib/libpuffs: dispatcher.c

Log Message:
pathconf needs to return EINVAL when the variable is invalid
or cannot be associated with a file. This also needs to be true
when the node doesn't implement the pathconf function at all.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libpuffs/dispatcher.c

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

Modified files:

Index: src/lib/libpuffs/dispatcher.c
diff -u src/lib/libpuffs/dispatcher.c:1.49 src/lib/libpuffs/dispatcher.c:1.50
--- src/lib/libpuffs/dispatcher.c:1.49	Mon Mar  8 17:34:10 2021
+++ src/lib/libpuffs/dispatcher.c	Mon Dec 11 12:42:18 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dispatcher.c,v 1.49 2021/03/08 17:34:10 christos Exp $	*/
+/*	$NetBSD: dispatcher.c,v 1.50 2023/12/11 12:42:18 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007, 2008 Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: dispatcher.c,v 1.49 2021/03/08 17:34:10 christos Exp $");
+__RCSID("$NetBSD: dispatcher.c,v 1.50 2023/12/11 12:42:18 mlelstv Exp $");
 #endif /* !lint */
 
 #include 
@@ -893,7 +893,7 @@ dispatch(struct puffs_cc *pcc)
 		{
 			struct puffs_vnmsg_pathconf *auxt = auxbuf;
 			if (pops->puffs_node_pathconf == NULL) {
-error = 0;
+error = EINVAL;
 break;
 			}
 



CVS commit: src/tests/dev/audio

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 09:26:08 UTC 2023

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
mmap() fails for size == 0 with EINVAL unless the mapping is anonymous.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/tests/dev/audio/audiotest.c

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

Modified files:

Index: src/tests/dev/audio/audiotest.c
diff -u src/tests/dev/audio/audiotest.c:1.31 src/tests/dev/audio/audiotest.c:1.32
--- src/tests/dev/audio/audiotest.c:1.31	Thu Aug  3 08:36:38 2023
+++ src/tests/dev/audio/audiotest.c	Mon Dec 11 09:26:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiotest.c,v 1.31 2023/08/03 08:36:38 rin Exp $	*/
+/*	$NetBSD: audiotest.c,v 1.32 2023/12/11 09:26:08 mlelstv Exp $	*/
 
 /*
  * Copyright (C) 2019 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: audiotest.c,v 1.31 2023/08/03 08:36:38 rin Exp $");
+__RCSID("$NetBSD: audiotest.c,v 1.32 2023/12/11 09:26:08 mlelstv Exp $");
 
 #include 
 #include 
@@ -2773,13 +2773,13 @@ test_mmap_len(size_t len, off_t offset, 
 	reset_after_mmap();
 }
 #define f(l, o, e)	test_mmap_len(l, o, e)
-DEF(mmap_len_0)	{ f(0,   0,   0); }		/* len is 0 */
+DEF(mmap_len_0)	{ f(0,   0,   EINVAL); }	/* len is 0 */
 DEF(mmap_len_1)	{ f(1,   0,   0); }		/* len is smaller than lsize */
 DEF(mmap_len_2)	{ f(LS,  0,   0); }		/* len is the same as lsize */
 DEF(mmap_len_3)	{ f(LS1, 0,   EOVERFLOW); }	/* len is larger */
 DEF(mmap_len_4)	{ f(0,   -1,  EINVAL); }	/* offset is negative */
-DEF(mmap_len_5)	{ f(0,   LS,  0); }		/* pointless param but ok */
-DEF(mmap_len_6)	{ f(0,   LS1, EOVERFLOW); }	/* exceed */
+DEF(mmap_len_5)	{ f(0,   LS,  EINVAL); }	/* len is 0 */
+DEF(mmap_len_6)	{ f(0,   LS1, EINVAL); }	/* len is 0 */
 DEF(mmap_len_7)	{ f(1,   LS,  EOVERFLOW); }	/* exceed */
 /*
  * When you treat the offset as 32bit, offset will be 0 and thus it



CVS commit: src/tests/dev/audio

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 09:26:08 UTC 2023

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
mmap() fails for size == 0 with EINVAL unless the mapping is anonymous.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/tests/dev/audio/audiotest.c

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



Re: Experience with Epyc 8/9004 series CPUs?

2023-11-29 Thread Michael van Elst
kar...@netbsd.org (Frank Kardel) writes:

>As you said a "couple of years ago" I assume those CPUs where not 
>Zen4-architecture.

The new pkgbuilder is Zen3, so still too old.



CVS commit: src/sys/arch/x86/x86

2023-11-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Nov 29 11:40:37 UTC 2023

Modified Files:
src/sys/arch/x86/x86: intr.c

Log Message:
Fix use-after-free (source->is_type) when detecting unsharable
interrupts. Doesn't solve the interrupt conflict itself, but
avoids a panic.


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/x86/x86/intr.c

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



Re: NetBSD-current on thinkpad T495, sound issue (was "audio issue on -current")

2023-11-26 Thread Michael van Elst
shev.vt1...@gmail.com (Vitaly Shevtsov) writes:

>When I'm listening to music I get this error after some time:
>audio1(hdafg1): audio_write: device timeout, seq=16987,
>usrbuf=60224/H60224, outbuf=8192/8192

You get timeouts when the backend driver (hdafg1) doesn't
finish playing buffers. So that's probably a bug there or
maybe a bug in interrupt routing.

Here, audio1/hdafg1 is a digital output (HDMI) which also has
problems but with different symptoms. But the analog output
audio0/hdafg0 works fine.



CVS commit: src/sys/dev/iscsi

2023-11-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Nov 25 10:08:27 UTC 2023

Modified Files:
src/sys/dev/iscsi: iscsi.h iscsi_globals.h iscsi_ioctl.c iscsi_send.c
iscsi_text.c iscsi_utils.c

Log Message:
Adapt to bignum representation of target.
Fix negotiation for mutual authentication.
Prepare for more CHAP types.
Fix crashes for invalid socket descriptors passed to kernel.
Protect usecount with connection mutex, avoids race on connection close.
Minor cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/iscsi/iscsi.h
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/iscsi/iscsi_globals.h
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/iscsi/iscsi_ioctl.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/iscsi/iscsi_send.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/iscsi/iscsi_text.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/iscsi/iscsi_utils.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/iscsi

2023-11-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Nov 25 10:08:27 UTC 2023

Modified Files:
src/sys/dev/iscsi: iscsi.h iscsi_globals.h iscsi_ioctl.c iscsi_send.c
iscsi_text.c iscsi_utils.c

Log Message:
Adapt to bignum representation of target.
Fix negotiation for mutual authentication.
Prepare for more CHAP types.
Fix crashes for invalid socket descriptors passed to kernel.
Protect usecount with connection mutex, avoids race on connection close.
Minor cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/iscsi/iscsi.h
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/iscsi/iscsi_globals.h
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/iscsi/iscsi_ioctl.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/iscsi/iscsi_send.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/iscsi/iscsi_text.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/iscsi/iscsi_utils.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/iscsi/iscsi.h
diff -u src/sys/dev/iscsi/iscsi.h:1.4 src/sys/dev/iscsi/iscsi.h:1.5
--- src/sys/dev/iscsi/iscsi.h:1.4	Wed Jun 15 04:30:30 2016
+++ src/sys/dev/iscsi/iscsi.h	Sat Nov 25 10:08:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi.h,v 1.4 2016/06/15 04:30:30 mlelstv Exp $	*/
+/*	$NetBSD: iscsi.h,v 1.5 2023/11/25 10:08:27 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2006,2011 The NetBSD Foundation, Inc.
@@ -54,6 +54,13 @@ typedef enum {
   Indicates SRP authentication (for future use).
 */
 
+typedef enum {
+	ISCSI_CHAP_MD5		= 5,
+	ISCSI_CHAP_SHA1		= 6,
+	ISCSI_CHAP_SHA256	= 7,
+	ISCSI_CHAP_SHA3_256	= 8
+} iscsi_chap_types_t;
+
 typedef struct {
 	unsigned int		mutual_auth:1;
 	unsigned int		is_secure:1;

Index: src/sys/dev/iscsi/iscsi_globals.h
diff -u src/sys/dev/iscsi/iscsi_globals.h:1.27 src/sys/dev/iscsi/iscsi_globals.h:1.28
--- src/sys/dev/iscsi/iscsi_globals.h:1.27	Tue Sep 13 13:09:16 2022
+++ src/sys/dev/iscsi/iscsi_globals.h	Sat Nov 25 10:08:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_globals.h,v 1.27 2022/09/13 13:09:16 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_globals.h,v 1.28 2023/11/25 10:08:27 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -135,11 +135,10 @@
 /* Connection state */
 
 typedef enum {
-	/* first three correspond to CSG/NSG coding */
 	ST_SEC_NEG	= 0,	/* security negotiation phase */
-	ST_OP_NEG	= 1,	/* operational negotiation phase */
+	ST_SEC_FIN  	= 1,	/* switch from SEC after mutual CHAP */
+	ST_OP_NEG	= 2,	/* operational negotiation phase */
 	ST_FULL_FEATURE	= 3,	/* full feature phase */
-	/* rest is internal */
 	ST_WINDING_DOWN	= 4,	/* connection termination initiated, logging out */
 	ST_LOGOUT_SENT	= 5,	/* logout has been sent */
 	ST_SETTLING	= 6,	/* waiting for things to settle down */

Index: src/sys/dev/iscsi/iscsi_ioctl.c
diff -u src/sys/dev/iscsi/iscsi_ioctl.c:1.33 src/sys/dev/iscsi/iscsi_ioctl.c:1.34
--- src/sys/dev/iscsi/iscsi_ioctl.c:1.33	Tue Sep 13 13:09:16 2022
+++ src/sys/dev/iscsi/iscsi_ioctl.c	Sat Nov 25 10:08:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_ioctl.c,v 1.33 2022/09/13 13:09:16 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_ioctl.c,v 1.34 2023/11/25 10:08:27 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -728,18 +728,11 @@ create_connection(iscsi_login_parameters
 	}
 
 	rc = get_socket(par->socket, >c_sock);
-	fd_close(par->socket);
+	if (rc != EBADF)
+		fd_close(par->socket);
 
 	if (rc) {
 		DEBOUT(("Invalid socket %d\n", par->socket));
-
-		callout_destroy(>c_timeout);
-		rw_destroy(>c_sock_rw);
-		cv_destroy(>c_idle_cv);
-		cv_destroy(>c_ccb_cv);
-		cv_destroy(>c_pdu_cv);
-		cv_destroy(>c_conn_cv);
-		mutex_destroy(>c_lock);
 		free(conn, M_DEVBUF);
 		par->status = ISCSI_STATUS_INVALID_SOCKET;
 		return rc;
@@ -901,11 +894,13 @@ recreate_connection(iscsi_login_paramete
 		DEBOUT(("Too many connections (max = %d, curr = %d)\n",
 			sess->s_MaxConnections, sess->s_active_connections));
 
-		/* Always close the desecriptor */
-		fd_close(par->socket);
+		/* Close the desecriptor */
+		rc = EIO;
+		if (fd_getfile(par->socket) != NULL)
+			rc = fd_close(par->socket);
 
 		par->status = ISCSI_STATUS_MAXED_CONNECTIONS;
-		return EIO;
+		return rc;
 	}
 
 	rw_enter(>c_sock_rw, RW_WRITER);
@@ -915,7 +910,8 @@ recreate_connection(iscsi_login_paramete
 	}
 	rc = get_socket(par->socket, >c_sock);
 	rw_exit(>c_sock_rw);
-	fd_close(par->socket);
+	if (rc != EBADF)
+		fd_close(par->socket);
 
 	if (rc) {
 		DEBOUT(("Invalid socket %d\n", par->socket));
@@ -1739,19 +1735,23 @@ iscsi_cleanup_thread(void *par)
 			 * the send/recv threads have been killed
 			 */
 			DEBC(conn, 5, ("Cleanup: Waiting for threads to exit\n"));
+
+			mutex_enter(>c_lock);
 			while (conn->c_sendproc || conn->c_rcvproc)
-kpause("threads", false, hz, NULL);
+kpause("threads", false, hz, >c_lock);
 
 			for (s=1; conn->c_usecount > 0 && s < 3; ++s)
-kpause("usecount", false, 

CVS commit: src/sbin

2023-11-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Nov 25 08:06:02 UTC 2023

Modified Files:
src/sbin/iscsictl: iscsic_parse.c
src/sbin/iscsid: iscsid_driverif.c

Log Message:
Parse IPv6 targets and handle IPv6 addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/iscsictl/iscsic_parse.c
cvs rdiff -u -r1.8 -r1.9 src/sbin/iscsid/iscsid_driverif.c

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



CVS commit: src/sbin

2023-11-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Nov 25 08:06:02 UTC 2023

Modified Files:
src/sbin/iscsictl: iscsic_parse.c
src/sbin/iscsid: iscsid_driverif.c

Log Message:
Parse IPv6 targets and handle IPv6 addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/iscsictl/iscsic_parse.c
cvs rdiff -u -r1.8 -r1.9 src/sbin/iscsid/iscsid_driverif.c

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

Modified files:

Index: src/sbin/iscsictl/iscsic_parse.c
diff -u src/sbin/iscsictl/iscsic_parse.c:1.4 src/sbin/iscsictl/iscsic_parse.c:1.5
--- src/sbin/iscsictl/iscsic_parse.c:1.4	Fri Dec  3 13:27:38 2021
+++ src/sbin/iscsictl/iscsic_parse.c	Sat Nov 25 08:06:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsic_parse.c,v 1.4 2021/12/03 13:27:38 andvar Exp $	*/
+/*	$NetBSD: iscsic_parse.c,v 1.5 2023/11/25 08:06:02 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -48,50 +48,62 @@
 STATIC void
 get_address(iscsi_portal_address_t * portal, char *str, char *arg)
 {
-	char *sp, *sp2;
+	char *sp;
 	int val;
 
 	if (!str || !*str)
 		arg_error(arg, "Address is missing");
 
-	/* is there a port? don't check inside square brackets (IPv6 addr) */
-	for (sp = str + 1, val = 0; *sp && (*sp != ':' || val); sp++) {
-		if (*sp == '[')
-			val = 1;
-		else if (*sp == ']')
-			val = 0;
-	}
-
-	/* */
-	if (*sp) {
-		for (sp2 = sp + 1; *sp2 && *sp2 != ':'; sp2++);
-		/* if there's a second colon, assume it's an unbracketed IPv6 address */
-		if (!*sp2) {
-			/* truncate source, that's the address */
-			*sp++ = '\0';
-			if (sscanf(sp, "%d", ) != 1)
-arg_error(arg, "Bad address format: Expected port number");
-			if (val < 0 || val > 0x)
-arg_error(arg, "Bad address format: Port number out of range");
-			portal->port = (uint16_t) val;
-		}
-		/* is there a group tag? */
-		for (; isdigit((unsigned char)*sp); sp++);
-		if (*sp && *sp != ',')
-			arg_error(arg, "Bad address format: Extra character(s) '%c'", *sp);
-	} else
-		for (sp = str + 1; *sp && *sp != ','; sp++);
-
-	if (*sp) {
+	/* Parse and strip trailing group tag */
+	sp = strrchr(str, ',');
+	if (sp != NULL) {
 		if (sscanf(sp + 1, "%d", ) != 1)
 			arg_error(arg, "Bad address format: Expected group tag");
 		if (val < 0 || val > 0x)
 			arg_error(arg, "Bad address format: Group tag out of range");
 		portal->group_tag = (uint16_t) val;
-		/* truncate source, that's the address */
 		*sp = '\0';
 	}
-	/* only check length, don't verify correct format (too many possibilities) */
+
+	/* Skip over bracketed IPv6 address */
+	sp = strchr(str, ']');
+	if (sp != NULL)
+		sp++;
+	else
+		sp = str;
+
+	/* Parse and strip trailing port number */
+	sp = strchr(sp, ':');
+	if (sp != NULL) {
+		if (strchr(sp + 1, ':') != NULL) {
+			/*
+			 *  If there's a second colon, assume
+			 *  it's an unbracketed IPv6 address
+			 */
+			portal->port = 0;
+		} else {
+			if (sscanf(sp + 1, "%d", ) != 1)
+arg_error(arg, "Bad address format: Expected port number");
+			if (val < 0 || val > 0x)
+arg_error(arg, "Bad address format: Port number ut  of range");
+			portal->port = (uint16_t) val;
+			*sp = '\0';
+		}
+	}
+
+	/* Remove brackets */
+	if (*str == '[') {
+		sp = strchr(str, ']');
+		if (sp != NULL && !*(sp+1)) {
+			str = str + 1;
+			*sp = '\0';
+		}
+	}
+
+	/*
+	 * only check length, don't verify correct format
+	 * (too many possibilities)
+	 */
 	if (strlen(str) >= sizeof(portal->address))
 		arg_error(arg, "Bad address format: Address string too long");
 

Index: src/sbin/iscsid/iscsid_driverif.c
diff -u src/sbin/iscsid/iscsid_driverif.c:1.8 src/sbin/iscsid/iscsid_driverif.c:1.9
--- src/sbin/iscsid/iscsid_driverif.c:1.8	Sun May 29 13:35:45 2016
+++ src/sbin/iscsid/iscsid_driverif.c	Sat Nov 25 08:06:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsid_driverif.c,v 1.8 2016/05/29 13:35:45 mlelstv Exp $	*/
+/*	$NetBSD: iscsid_driverif.c,v 1.9 2023/11/25 08:06:02 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -98,23 +98,29 @@ set_node_name(iscsid_set_node_name_req_t
 static int
 bind_socket(int sock, uint8_t * addr)
 {
-	struct sockaddr_in serverAddress;
-	struct hostent *host;
+	struct addrinfo hints, *ai, *ai0;
+	int ret = FALSE;
 
 	DEB(8, ("Binding to <%s>", addr));
-	(void) memset(, 0x0, sizeof(serverAddress));
-	host = gethostbyname((char *)addr);
-	if (host == NULL)
-		return FALSE;
-	if (host->h_length > (int)sizeof(serverAddress.sin_addr))
-		return FALSE;
-	serverAddress.sin_family = host->h_addrtype;
-	serverAddress.sin_port = 0;
-	serverAddress.sin_len = host->h_length;
-	memcpy(_addr, host->h_addr_list[0], host->h_length);
+	
+	memset(, 0, sizeof(hints));
+	hints.ai_family = AF_UNSPEC;
+	hints.ai_socktype = SOCK_STREAM;
+	hints.ai_flags = AI_PASSIVE;
+	if (getaddrinfo((char *)addr, NULL, , ))
+		return ret;
+
+	for (ai = ai0; ai; ai = ai->ai_next) {
+		if (bind(sock, 

Re: iscsid - lfs and ipv6 issues

2023-11-19 Thread Michael van Elst
On Sun, Nov 19, 2023 at 12:34:13PM +0100, Ede Wolf wrote:
> Hello,
> 
> first of all a very big thanks to all of you. Since it seems I am the only
> one who is using ipv6 with iscsi, I do not need a fix. I can live (as I am
> doing now) with ipv4.
> I just know I do not have to waste any time in trying to figure out the
> syntax.

I think I've fixed IPv6 handling now (needs patches to iscsictl and
iscsid), at least it works here.


> Secondly: The iscsi target is ctld on FreeBSD. Currently even without any
> authentication.
> Now I doubt that an offline reporting is the case, because, relabelling the
> lun to 4.2BSD and mounting it with ffs does work. Without anything else
> being done on either side.

I can currently only test against istgt (from pkgsrc) on NetBSD and
a qnap NAS.

The error message (ENODEV) is only generated by LFS on failures to mount
a root filesystem. So no idea yet what error is triggered.

On the other hand, attempting to use LFS showed errors with handling
block sizes and running the filesystem tester (fsx) somewhen paniced
the system. Whatever was "fixed" in LFS was not good enough :-/



Greetings,
-- 
    Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: sys/dev/usb/if_axen.c

2023-11-19 Thread Michael van Elst
On Sun, Nov 19, 2023 at 06:40:19AM +, sc.dy...@gmail.com wrote:

There are regular Ethernet headers (padded/align with 0x).

> 1700366741.414702 axen_uno_rx_loop#0@0:  207b d26f4276 00e04c53 44580800
>      <-- pkt #1

>   0ec0pkt #1--> 
> 1700366741.414722 axen_uno_rx_loop#0@0:  207b d26f4276 00e04c53 44580800
>   0ed0   <-- pkt #2


No idea what this is, but it doesn't really look like garbage.

>   0bd0pkt #2--> 
> 1700366741.414739 axen_uno_rx_loop#0@0:  0008ec05 0080 0008ec05 0080


What is the format of these (64bit wide?) headers ?

>   0be0   <  pkt_hdr #1   > <  pkt_hdr #2   >
> 1700366741.414739 axen_uno_rx_loop#0@0:   0400e00b 400657b9 c0a80104
>   0bf0  <--  garbage  -->


Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CGD - unable to open after closing, using '-V gpt', argon2id and adiantum

2023-11-19 Thread Michael van Elst
luisvmen...@yandex.com (Luis Mendes) writes:

>== Now, trying to open the container again:
>cgdconfig -V gpt cgd0 NAME=nvme-crypt /etc/cgd/nvme-crypt
>After entering the four zeroes password, there's the message:
>"cgdconfig: verification failed, please reenter passphrase".

>What is wrong with this setup?

This way cgdconfig is looking inside the container for a GPT
label for validation. Did you create one ?

If you don't need to partition the container, you could
format a ffs filesystem for the whole disk (cgd0) and use
the 'ffs' verification method, which checks for a ffs 
superblock.

For other filesystems you need to partition (disklabel, mbr
or gpt) if you want the validation step and validate using
the partition information. But it's not strictly necessary to
validate, -V none will accept a wrong passphrase but e.g.
a mount will likely see garbage and fail.



Re: iscsid - lfs and ipv6 issues

2023-11-18 Thread Michael van Elst
On Sat, Nov 18, 2023 at 07:47:47PM +0700, Robert Elz wrote:
> 
> Using getaddrinfo() would be much better of course.

That's what I have now


-- 
    Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: iscsid - lfs and ipv6 issues

2023-11-18 Thread Michael van Elst
k...@munnari.oz.au (Robert Elz) writes:

>That looks to me as if it should work, and is a lot cleaner, though
>I doubt there's a great need to remove the [] if they were given.

getaddrinfo() doesn't strip or handle brackets.



Re: iscsid - lfs and ipv6 issues

2023-11-18 Thread Michael van Elst
k...@munnari.oz.au (Robert Elz) writes:

>  | The address parser looks broken.
>It certainly is, it is horrid.

>and the relevant function is get_address()

Maybe the patch below. It's still a bit naive (you can bracket anything,
not just ipv6 literals).

The address string is later used in iscsid_driverif.c, a name
is resolved with gethostbyname(), so while an ipv6 address might
be accepted, the code lacks ipv6 support.


Index: sbin/iscsictl/iscsic_parse.c
===
RCS file: /cvsroot/src/sbin/iscsictl/iscsic_parse.c,v
retrieving revision 1.4
diff -p -u -r1.4 iscsic_parse.c
--- sbin/iscsictl/iscsic_parse.c3 Dec 2021 13:27:38 -   1.4
+++ sbin/iscsictl/iscsic_parse.c18 Nov 2023 10:35:17 -
@@ -48,50 +48,55 @@
 STATIC void
 get_address(iscsi_portal_address_t * portal, char *str, char *arg)
 {
-   char *sp, *sp2;
+   char *sp;
int val;
 
if (!str || !*str)
arg_error(arg, "Address is missing");
 
-   /* is there a port? don't check inside square brackets (IPv6 addr) */
-   for (sp = str + 1, val = 0; *sp && (*sp != ':' || val); sp++) {
-   if (*sp == '[')
-   val = 1;
-   else if (*sp == ']')
-   val = 0;
-   }
-
-   /* */
-   if (*sp) {
-   for (sp2 = sp + 1; *sp2 && *sp2 != ':'; sp2++);
-   /* if there's a second colon, assume it's an unbracketed IPv6 
address */
-   if (!*sp2) {
-   /* truncate source, that's the address */
-   *sp++ = '\0';
-   if (sscanf(sp, "%d", ) != 1)
-   arg_error(arg, "Bad address format: Expected 
port number");
-   if (val < 0 || val > 0x)
-   arg_error(arg, "Bad address format: Port number 
out of range");
-   portal->port = (uint16_t) val;
-   }
-   /* is there a group tag? */
-   for (; isdigit((unsigned char)*sp); sp++);
-   if (*sp && *sp != ',')
-   arg_error(arg, "Bad address format: Extra character(s) 
'%c'", *sp);
-   } else
-   for (sp = str + 1; *sp && *sp != ','; sp++);
-
-   if (*sp) {
+   /* parse and strip trailing group tag */
+   sp = strchr(str, ',');
+   if (sp != NULL) {
if (sscanf(sp + 1, "%d", ) != 1)
arg_error(arg, "Bad address format: Expected group 
tag");
if (val < 0 || val > 0x)
arg_error(arg, "Bad address format: Group tag out of 
range");
portal->group_tag = (uint16_t) val;
-   /* truncate source, that's the address */
*sp = '\0';
}
-   /* only check length, don't verify correct format (too many 
possibilities) */
+
+   /* parse and strip trailing port number */
+   sp = strchr(str, ':');
+   if (sp != NULL) {
+   if (strchr(sp + 1, ':') != NULL) {
+   /*
+* if there's a second colon, assume
+* it's an unbracketed IPv6 address.
+*/
+   portal->port = 0;
+   } else {
+   if (sscanf(sp + 1, "%d", ) != 1)
+   arg_error(arg, "Bad address format: Expected 
port number");
+   if (val < 0 || val > 0x)
+   arg_error(arg, "Bad address format: Port number 
out of range");
+   portal->port = (uint16_t) val;
+   *sp = '\0';
+   }
+   }
+
+   /* remove brackets */
+   if (*str == '[') {
+   sp = strchr(str, ']');
+   if (sp != NULL && !*(sp+1)) {
+   str = str + 1;
+   *sp = '\0';
+   }
+   }
+
+   /*
+* only check length, don't verify correct format
+* (too many possibilities)
+*/
if (strlen(str) >= sizeof(portal->address))
arg_error(arg, "Bad address format: Address string too long");
 


Re: iscsid - lfs and ipv6 issues

2023-11-17 Thread Michael van Elst
lis...@nebelschwaden.de (Ede Wolf) writes:

>I am having two issues with iscsid/iscsictl. First, it seems, I cannot 
>mount an lfs formatted iscsi lun, no matter wether this drive is 
>gpt/wedge or plain disklabelled:

># mount -t lfs /dev/dk0 /import/
>mount_lfs: /dev/dk0 on /import: Operation not supported by device

This works here (as far as lfs works), but the error message is
rare. One possibility is that the SCSI driver reports an offline
unit. Can you tell what the iSCSI server is ?

>scsictl: add_send_target: Invalid option at or near '-a': Bad address 
>format: Extra character(s) ':'

The address parser looks broken. For some reason the first character is skipped 
when it tries to identify IPv6, I was successful with

iscsictl add_send_target -a 'x[ipv6-address]'


Greetings,


Re: sys/dev/usb/if_axen.c

2023-11-13 Thread Michael van Elst
mak...@ki.nu (Makoto Fujiwara) writes:

>I've compared to openbsd: if_axen.c 
>   https://raw.githubusercontent.com/openbsd/src/master/sys/dev/usb/if_axen.c
>to N, and there are so many differencies.

>Does this (N) if_axen.c works on any installation ?


axen seems to work, but I can see that the code does nonsense if
you receive something a buffer with pkt_count == 0.

I suggest to dump the whole buffer as it was received.



Re: [RFC 2] userconf(4): 2nd proposal

2023-11-04 Thread Michael van Elst
tlaro...@kergis.com writes:

>disable {drmkms}   # NEW: disable devices belonging to group "drmkms"

Almost noone would need to turn off all drmkms drivers. What you may
want to control is that a GPU isn't used as a console. Disabling a driver
is just our crude workaround to achieve this.

I don't think that autoconf is the right place for such a control,
it should be a boot parameter, maybe even something that can be
changed at runtime later.

The current system of boot parameters is limited and differs a lot
between platforms. We need a common way to set boot parameters and
these should be mostly defined in a platform-agnostic way.


>Hint: Linuces distributions "work" as proposed images on servers,
>where NetBSD fails.

Servers usually do no have drmkms capable hardware, and if they have,
you probably want to use that hardware.



Re: [RFC 2] userconf(4): 2nd proposal

2023-11-04 Thread Michael van Elst
r...@sdf.org (RVP) writes:

>On Sat, 4 Nov 2023, RVP wrote:

>> 1) Allowing shell-like patterns (not hard to implement):
>>
>> uc>  disable *drm* *usb$ # all with `drm' anywhere and those ending in 
>>

>Ah, since these are shell-like patterns there's not need for a `$' to
>denote EOL. So:


userconf already supports "patterns", just not in the way you think.



Re: rc.local nightmare

2023-10-30 Thread Michael van Elst
ea1...@gmail.com (Ramiro Aceves) writes:

>My script says on the console "Network connectivity to $TARGET is OK." 
>several times before the script dies. So ping works fine. (I have set 
>INTERVAL=3 seconds just to speed things up during testing.


Your script shouldn't create output from a background process.
When booting, output is piped through a logging process, and when
that exits, the next output will abort your process.

nohup doesn't help, it only redirects terminal output.

Ideally you should not print anything directly in a background
process but write a log file (or use logger / syslog).

To avoid any accidential problem, you should also redirect all
three standard handles (e.g. to /dev/null).

N.B. the connectivity check is a bit sensitive. I suggest to
probe with more than 1 packet and to also set a deadline (-w)
which allows for one extra second, e.g. ping -n -c 3 -w 4.




Re: file-backed cgd backup question

2023-10-22 Thread Michael van Elst
g...@lexort.com (Greg Troxel) writes:

>> vnd opens the backing file when the unit is created and closes
>> the backing file when the unit is destroyed. Then you can access
>> the file again.

>Is there a guarantee of cache consistency for writes before and reads
>after?

Before the unit is created you can access the file and after the
unit is destroyed you can access the file. That's always safe.

I also think that when the unit is configured but not opened
(by device access or mounts) it is safe to access the file.


>> The data is written directly to the allocated blocks of the file.
>> So exclusively opening  the backing file _or_ the vnd unit should
>> also be safe. But that's not much different from accessing any file
>> concurrently, which also leads to "corrupt", inconsistent backups.

>That's a different kind of corrupt.

Yes, but in the end it's the same, the "backup" isn't usuable.

You cannot access the backing file to get a consistent state of the
data while a unit is in use. And that's independent of how vnd accesses
the bits.

N.B. if you want to talk about dangers, think about fdiscard(). I
doubt that it is safe in the context of the vnd optimization.




Re: cpuctl ucode: no patch available

2023-10-21 Thread Michael van Elst
w...@netbsd.org (Thomas Klausner) writes:

>I read about a new microcode update for the AMD Zen family, downloaded
>the linux firmware repository and tried to apply it.

We don't support microcode updates for Zen (just some older AMD model).




Re: file-backed cgd backup question

2023-10-20 Thread Michael van Elst
g...@lexort.com (Greg Troxel) writes:

>I dimly knew this, but keep forgetting.  Reading vndconfig(8), it does
>not explain that the normal path leads to incorrect behavior (stale
>reads from file cache even after closing the vnd, mtime).

vnd opens the backing file when the unit is created and closes
the backing file when the unit is destroyed. Then you can access
the file again.

The data is written directly to the allocated blocks of the file.
So exclusively opening  the backing file _or_ the vnd unit should
also be safe. But that's not much different from accessing any file
concurrently, which also leads to "corrupt", inconsistent backups.

Updating the backing file mtime on close sounds useful. I'm not sure
what effect updating atime/mtime on every access would have.

> This
>optimization is sufficiently dangerous and not expected that it needs to
>be documented clearly and loudly.  I just added a note to the man page.

I think the reference to "ciphertext" should be adjusted and the
text should be toned more neutral when describing the functionality.

Pointing to the -i option to disable the optimization unconditionally
might also be helpful.



CVS commit: xsrc/external/mit/ctwm/dist

2023-10-20 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Fri Oct 20 10:18:56 UTC 2023

Modified Files:
xsrc/external/mit/ctwm/dist: signals.c

Log Message:
Use a SIGCHLD handler instead of ignoring the signal.

This avoids lockups when child processes were inherited (e.g. from .xsession)
but new children are waited for in system().


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 xsrc/external/mit/ctwm/dist/signals.c

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

Modified files:

Index: xsrc/external/mit/ctwm/dist/signals.c
diff -u xsrc/external/mit/ctwm/dist/signals.c:1.1.1.1 xsrc/external/mit/ctwm/dist/signals.c:1.2
--- xsrc/external/mit/ctwm/dist/signals.c:1.1.1.1	Wed Jul  5 07:36:07 2023
+++ xsrc/external/mit/ctwm/dist/signals.c	Fri Oct 20 10:18:55 2023
@@ -8,6 +8,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "ctwm_shutdown.h"
 #include "signals.h"
@@ -26,6 +28,15 @@ static bool sig_shutdown = false;
 // needs to trigger an action.
 bool SignalFlag = false;
 
+void ChildExit(int signum)
+{
+	int Errno = errno;
+	/* reap dead children, ignore status */
+	while (waitpid(-1, NULL, WNOHANG) > 0)
+		continue;
+	/* restore errno for interrupted sys calls */
+	errno = Errno;
+}
 
 /**
  * Setup signal handlers (run during startup)
@@ -46,9 +57,12 @@ setup_signal_handlers(void)
 	// die...
 	signal(SIGALRM, SIG_IGN);
 
-	// This should be set by default, but just in case; explicitly don't
-	// leave zombies.
-	signal(SIGCHLD, SIG_IGN);
+	/* Setting SIGCHLD to SIG_IGN detaches children from the parent
+	 * immediately, so it need not be waited for.
+	 * In fact, you cannot wait for it, so a function like system()
+	 * breaks.
+	 */
+	signal(SIGCHLD, ChildExit);
 
 	return;
 }



CVS commit: xsrc/external/mit/ctwm/dist

2023-10-20 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Fri Oct 20 10:18:56 UTC 2023

Modified Files:
xsrc/external/mit/ctwm/dist: signals.c

Log Message:
Use a SIGCHLD handler instead of ignoring the signal.

This avoids lockups when child processes were inherited (e.g. from .xsession)
but new children are waited for in system().


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 xsrc/external/mit/ctwm/dist/signals.c

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



Re: file-backed cgd backup question

2023-10-19 Thread Michael van Elst
w...@netbsd.org (Thomas Klausner) writes:

>For a cgd in a file that I mount via vnd+cgd, the file system contents
>inside may change, but the actual file on the hard disk outside only
>has 'access' time changes. So "smart" backup programs that check
>timestamps to find out if they need to re-hash files don't notice it
>was changed. How do you handle this? Manually touch it?

vnd has an optimization where the backing file isn't touched, but
the underlying device is accessed directly. Then file cache and
device aren't in sync and a backup program reading the file might
read stale data. vnd should probably update the file when
unconfiguring, but so far it does not.

The optimization is disabled under some conditions and explicitely
if you use 'vnconfig -i'. Then all operations are done by file
I/O and the timestamps of the backing file are maintained.
The extra caching of course affects performance.



Re: Unexpected out of memory kills when running parallel find instances over millions of files

2023-10-19 Thread Michael van Elst
mjgu...@gmail.com (Mateusz Guzik) writes:

>> While vnodes would be recyclable, they hardly get recycled unless
>> an filesystem object is deleted or the filesystem is unmounted.

>They get recycled all the time by vdrain thread if numvnodes goes above
>desiredvnodes, like it does in this test.

They should also be recycled when memory gets tight but they aren't.

As a consequence, not only the vnodes stay in memory, but also all
cached pages (the UVM objects).


>> Without swap, the kernel also has no chance to evict process pages
>> to grow the vnode cache further.

>It should not be trying to grow the vnode cache. If anything it should
>stop it from blowing out of proportion and definitely should not kill
>processes in presence of swaths of immediately freeable vnodes.

As long as you don't exceed maxvnodes (a value that got larger in
netbsd-10), almost nothing is freed.



Re: Unexpected out of memory kills when running parallel find instances over millions of files

2023-10-19 Thread Michael van Elst
mjgu...@gmail.com (Mateusz Guzik) writes:

>Running 20 find(1) instances, where each has a "private" tree with
>million of files runs into trouble with the kernel killing them (and
>others):
>[   785.194378] UVM: pid 1998.1998 (find), uid 0 killed: out of swap


>This should not be happening -- there is tons of reusable RAM as
>virtually all of the vnodes getting here are immediately recyclable.

While vnodes would be recyclable, they hardly get recycled unless
an filesystem object is deleted or the filesystem is unmounted.

>Specs are 24 cores, 24G of RAM and ufs2 with noatime. swap is *not* configured.

Without swap, the kernel also has no chance to evict process pages
to grow the vnode cache further.

You can try to avoid that situation by reducing the amount of cached
vnodes by setting kern.maxvnodes with sysctl. That value would need
to be more dynamic to actually exercise pressure when memory runs short.

N.B. it's possible for the system to lock up too. You can change maxvnodes
through ddb by setting the kernel variable desiredvnodes. There is a good
chance that the system recovers.



Re: NetBSD 10 Beta: Updating The Base System

2023-10-10 Thread Michael van Elst
On Tue, Oct 10, 2023 at 11:24:15AM -0500, Jay F. Shachter wrote:

> Please forgive my ignorance; how do I update my NetBSD 10 Beta system?

You can run sysinst to fetch sets from

http://cdn.netbsd.org/pub/NetBSD-daily/netbsd-10/latest/amd64/

or download the sets and unpack them manually.

There is also the sysupgrade tool in pkgsrc, but I never have used it.


> And does my PKG_PATH variable remain
> http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/10.0/All or
> do I now change it to something else?  Thank you in advance for any
> and all replies.

The path stays the same.


Greetings,
-- 
            Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: Bluetooth status, compatible USB Bluetooth adapters?

2023-10-04 Thread Michael van Elst
dyo...@pobox.com (David Young) writes:

>By the way, to interoperate with Bluetooth Low Energy devices, is
>anything beyond a compatible USB Bluetooth adapter needed?  For example,
>kernel or utility changes?

So far we don't support BLE at all. Devices that talk only BLE cannot be
used.

My Logitech mouse is BLE only, fortunately it comes with a dongle that
makes it appear as a regular (wired) USB mouse.



Re: cgd questions

2023-10-02 Thread Michael van Elst
w...@netbsd.org (Thomas Klausner) writes:

>Follow up question because it just happened to me:

>I have a USB Disk with ffs-on-cgd.  I unmounted the ffs but forgot
>unconfiguring the cgd before unplugging the disk.

>Can this cause problems? What kinds?

Shouldn't do any harm, there is no state on the disk but the data
itself and FFS has already flushed everything and waited for completion.

The cgd device probably doesn't detach immediately and an attempt
to use it may crash the system. But unconfiguring it immediately
after should be safe.



CVS commit: src/sys/dev/audio

2023-10-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Oct  1 09:34:29 UTC 2023

Modified Files:
src/sys/dev/audio: audio.c

Log Message:
Fix output for big-endian hardware.
Also optimize the output scaling routine.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.144 src/sys/dev/audio/audio.c:1.145
--- src/sys/dev/audio/audio.c:1.144	Mon Jun  5 16:26:05 2023
+++ src/sys/dev/audio/audio.c	Sun Oct  1 09:34:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.144 2023/06/05 16:26:05 mlelstv Exp $	*/
+/*	$NetBSD: audio.c,v 1.145 2023/10/01 09:34:28 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.144 2023/06/05 16:26:05 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.145 2023/10/01 09:34:28 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -9222,7 +9222,6 @@ audio_mixsample_to_linear(audio_filter_a
 	const aint2_t *m;
 	uint8_t *p;
 	u_int sample_count;
-	bool swap;
 	aint2_t v, xor;
 	u_int i, bps;
 	bool little;
@@ -9235,48 +9234,150 @@ audio_mixsample_to_linear(audio_filter_a
 	m = arg->src;
 	p = arg->dst;
 	sample_count = arg->count * fmt->channels;
-	swap = arg->dstfmt->encoding == AUDIO_ENCODING_SLINEAR_OE;
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-	little = !swap;
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
-	little = swap;
-#endif
+	little = arg->dstfmt->encoding == AUDIO_ENCODING_SLINEAR_LE;
 
 	bps = fmt->stride / NBBY;
+	xor = audio_format2_is_signed(fmt) ? 0 : (aint2_t)1 << 31;
 
-	xor = audio_format2_is_signed(fmt)
-	   ? 0 : 1 << (fmt->stride - 1);
-
-	for (i=0; i>= (4 - bps) * NBBY;
-
-		/* signed -> unsigned */
-		v ^= xor;
-
-		if (little) {
-			switch (bps) {
-			case 4: *p++ = v; v >>= 8; /* FALLTHROUGH */
-			case 3: *p++ = v; v >>= 8; /* FALLTHROUGH */
-			case 2: *p++ = v; v >>= 8; /* FALLTHROUGH */
-			case 1: *p++ = v; /* FALLTHROUGH */
+#if AUDIO_INTERNAL_BITS == 16
+	if (little) {
+		switch (bps) {
+		case 4:
+			for (i=0; i> 8;
 			}
-		} else {
-			switch (bps) {
-			case 4: *p++ = v >> 24; v <<= 8; /* FALLTHROUGH */
-			case 3: *p++ = v >> 24; v <<= 8; /* FALLTHROUGH */
-			case 2: *p++ = v >> 24; v <<= 8; /* FALLTHROUGH */
-			case 1: *p++ = v >> 24; /* FALLTHROUGH */
+			break;
+		case 3:
+			for (i=0; i> 8;
+			}
+			break;
+		case 2:
+			for (i=0; i> 8;
+			}
+			break;
+		case 1:
+			for (i=0; i> 8;
+			}
+			break;
+		}
+	} else {
+		switch (bps) {
+		case 4:
+			for (i=0; i> 8;
+*p++ = v;
+*p++ = 0;
+*p++ = 0;
+			}
+			break;
+		case 3:
+			for (i=0; i> 8;
+*p++ = v;
+*p++ = 0;
+			}
+			break;
+		case 2:
+			for (i=0; i> 8;
+*p++ = v;
+			}
+			break;
+		case 1:
+			for (i=0; i> 8;
+			}
+			break;
+		}
+	}
+#elif AUDIO_INTERNAL_BITS == 32
+	if (little) {
+		switch (bps) {
+		case 4:
+			for (i=0; i> 8;
+*p++ = v >> 16;
+*p++ = v >> 24;
+			}
+			break;
+		case 3:
+			for (i=0; i> 8;
+*p++ = v >> 16;
+*p++ = v >> 24;
+			}
+			break;
+		case 2:
+			for (i=0; i> 16;
+*p++ = v >> 24;
+			}
+			break;
+		case 1:
+			for (i=0; i> 24;
+			}
+			break;
+		}
+	} else {
+		switch (bps) {
+		case 4:
+			for (i=0; i> 24;
+*p++ = v >> 16;
+*p++ = v >> 8;
+*p++ = v;
+			}
+			break;
+		case 3:
+			for (i=0; i> 24;
+*p++ = v >> 16;
+*p++ = v >> 8;
+			}
+			break;
+		case 2:
+			for (i=0; i> 24;
+*p++ = v >> 16;
 			}
+			break;
+		case 1:
+			for (i=0; i> 24;
+			}
+			break;
 		}
 	}
-}
+#endif /* AUDIO_INTERNAL_BITS */
 
+}
 
 #endif /* NAUDIO > 0 */
 



CVS commit: src/sys/dev/audio

2023-10-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Oct  1 09:34:29 UTC 2023

Modified Files:
src/sys/dev/audio: audio.c

Log Message:
Fix output for big-endian hardware.
Also optimize the output scaling routine.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/dev/audio/audio.c

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



Re: Where are the 10.0 packages?

2023-09-28 Thread Michael van Elst
j...@m5.chicago.il.us ("Jay F. Shachter") writes:

>system a dhcp client of the other laptop), and I cannot, because the
>packages are no longer at
>http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/10.0/All where
>they used to be.

netbsd-10 got a second flag day, first when updating openssl, second
when bumping versions of dependent libraries.

The packages are being rebuilt and you should also update the base
system.



Re: dumping on RAIDframe

2023-09-25 Thread Michael van Elst
e...@math.uni-bonn.de (Edgar =?iso-8859-1?B?RnXf?=) writes:

>> you dump a memory block that isn't a multiple of a disk sector 
>> (according to disklabel)
>You mean this one (from disklabel raid0):
>   bytes/sector: 512
>?

Yes. Which makes it unlikely.

amd64/machdep.c:

this dumps at least DEV_BSIZE:

to_write = roundup(dump_headerbuf_ptr - dump_headerbuf, dbtob(1));
error = bdev->d_dump(dumpdev, dump_header_blkno,
dump_headerbuf, to_write);

and this is called with bytes being a multiple of the page size:

for (i = 0; i < bytes; i += n, dump_totalbytesleft -= n) {
n = bytes - i; 
if (n > BYTES_PER_DUMP)
n = BYTES_PER_DUMP;
...
error = (*dump)(dumpdev, blkno, (void *)dumpspace, n);
...
}




Re: dumping on RAIDframe

2023-09-25 Thread Michael van Elst
e...@math.uni-bonn.de (Edgar =?iso-8859-1?B?RnXf?=) writes:

>GO>Dumping to a RAID 1 set is supported in -8.  But yes, none of those 
>GO>values seem to align with each other.  18,1 is 'raid0b' thouugh, so that 
>GO>part seems correct.

>MvE> offset and size relate to the dump data (dumplo and dumpsize), not
>MvE> the partition.


The "device not ready" comes from the driver dump routine
returning EFAULT. The error code is abused, it is reported
when a) you dump a memory block that isn't a multiple of
a disk sector (according to disklabel) or b) you start a dump
while a dump is already running.

Maybe dump errors shouldn't be printed with DPRINTF.



Re: GPT attributes in dkwedge [PATCH]

2023-09-25 Thread Michael van Elst
k...@munnari.oz.au (Robert Elz) writes:

>Date:Mon, 25 Sep 2023 05:57:49 +
>From:Emmanuel Dreyfus 
>Message-ID:  

>  | bootme.cfg is searched in EFI paririon /EFI/NetBSD/boot.cfg

>Which EFI partition?   I think I have about 5 or 6, sprinkled around
>various bootable devices (more than one on some).


There can be multiple EFI system partitions on a drive, but it sometimes
confuses software, some boot procedures will only handle the first ESP.

But you "should" be able to select an ESP in UEFI just like you would
select a boot device in BIOS.



Re: dumping on RAIDframe

2023-09-25 Thread Michael van Elst
os...@netbsd.org (Greg Oster) writes:

>> dumping to dev 18,1 (offset=1090767, size=8252262):
>> 
>Dumping to a RAID 1 set is supported in -8.  But yes, none of those 
>values seem to align with each other.  18,1 is 'raid0b' thouugh, so that 
>part seems correct.

offset and size relate to the dump data (dumplo and dumpsize), not
the partition.



Re: GPT attributes in dkwedge [PATCH]

2023-09-25 Thread Michael van Elst
On Mon, Sep 25, 2023 at 05:57:49AM +, Emmanuel Dreyfus wrote:

> On Mon, Sep 25, 2023 at 12:20:00PM +0700, Robert Elz wrote:
> [bootme flag]
> > I'd always assumed it to be where efiboot should locate boot.cfg.
> > Where the kernel and root filesystems are located are in boot.cfg.
> 
> Bootme tels bootstrap where to look root partition. bootme.cfg is 
> searched in EFI paririon /EFI/NetBSD/boot.cfg  and root partition /boot.cfg. 

Boot partition and Root partition are something separate, even when the
default root partition is the same as the boot partition.

For EFI boot, the boot partition is where boot.cfg is searched
and where the kernel is loaded from, unless you specify something else
to the bootloader (e.g. in boot.cg). Where the kernel is loaded
from is passed to the kernel.

The kernel will use the informatiun to find the root partition,
unless you specify something else (or magic like the raidframe
hack comes into play).

So, the bootme flag effectively specifies the root partition, but only
by virtue of defaults being passed down the chain. The kernel should
not outguess things and interpret the flag itself.


-- 
            Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: GPT attributes in dkwedge [PATCH]

2023-09-18 Thread Michael van Elst
a...@absd.org (David Brownlee) writes:

>Our gpt(8) states "bootme flag is used to indicate which partition
>should be booted by UEFI boot code", which could be read either way.

The flag is used to find the partition to load /boot, /boot.cfg or
the kernel from. The boot disk information is also passed to the
kernel and may be used to find the root filesystem.

So in many cases bootme marks the root partition. It is rarely 
used on the EFI partition, but that's also a possibility.




Re: GPT attributes in dkwedge [PATCH]

2023-09-16 Thread Michael van Elst
On Sat, Sep 16, 2023 at 08:57:28PM +1000, Simon Burge wrote:

> The only corner case that an older kernel won't understand a longer root
> device name passed in by a newer /boot as the old kernel will still have
> the 16 char length limit.

Yes, old kernels will truncate the name. Since that's supposed to be
not found, the kernel will just come up without a root and ask.

A new record type on the other hand won't be understood and the kernel
will fall back to other root deducing methods and might scucceed in
finding a wrong partition. You could prevent this by always providing
an old dummy record with a non-empty string.

-- 
        Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: GPT attributes in dkwedge [PATCH]

2023-09-16 Thread Michael van Elst
mar...@duskware.de (Martin Husemann) writes:

>But the more general solution (which would be just as easy for the end
>user, but more flexibel) is to add support for a rootdev statement
>in boot.cfg and then put the label name or the guid there. Similar
>to evbarm taking a root=dev argument passed from the bootloarder.

You can already specify the root in boot.cfg.


>It would also be cool if boot.cfg could specify the partition to load
>the kernel from via something similiar to NAME=.

You can already specify the disk to load the kernel from with NAME=.



>You insist on this not working for multiboot (which I understand), but I

Multiboot specifies a BIOS drive number and 2 (or 3) partition numbers,
the interpretation of the partition numbers is not really defined
but commonly it's as MBR partition number (1..4 for primary 5+ for extended)
and optionally a BSD disklabel partition number (assuming the primary
partition happens to be identified as *BSD*).

That isn't really flexible or abstract enough or matches the
raidframe scenario and trying to do so (by fixing an interpretation)
is the wrong way to go.



>don't understand how you get this far at all with multiboot. And I think
>multiboot can pass a command line, so root=dev support and make it equivalent
>to the boot.cfg rootdev statement would solve it too.

The multiboot support code in the kernel already interprets the passed
command line, including a "root" option, and this also allows to pass
a wedge name.


There is one caveat. Since all x86 bootloader data is funneled through
the bootinfo structure we have:

struct btinfo_rootdevice {  
struct btinfo_common common;
char devname[16];   
};

So we have 16 chars to store the identifier (including a NAME= or
wedge: prefix), that's not enough for a UUID.




Re: GPT attributes in dkwedge [PATCH]

2023-09-15 Thread Michael van Elst
On Fri, Sep 15, 2023 at 03:15:10PM +, Emmanuel Dreyfus wrote:
> On Fri, Sep 15, 2023 at 03:06:46PM -0000, Michael van Elst wrote:
> > What about just telling the kernel what to use in /boot.cfg ?
> > No need to add more magic to the kernel.
> 
> Ths user took care of setting bootme so that botstrap finds 
> the kernel, and we should disregard this explicit setting
> when mounting root? 

That setting tells where /boot is loaded from and where /boot.cfg
is loaded from. The bootloader tells the kernel where the boot
partition is, traditionally in terms of offset and size, but optionally
as wedge identifier. The kernel will try to mount that partition.


-- 
            Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: GPT attributes in dkwedge [PATCH]

2023-09-15 Thread Michael van Elst
m...@netbsd.org (Emmanuel Dreyfus) writes:

>multitboot lets the bootloader pass boot device information as BIOS
>driver, partition number, subpartition number. This is intended
>for MBR extended partitions or MBR/disklabel.

What about just telling the kernel what to use in /boot.cfg ?
No need to add more magic to the kernel.



Re: heartbeat panic by heavy traffic

2023-09-15 Thread Michael van Elst
bou...@antioche.eu.org (Manuel Bouyer) writes:

>But the clock softint shouldn't be locked out for 16s, ever.

Then the clock softint must have a higher priority than
everything else including hard interrupts.

Obviously that's not how the system is designed, there
are no limits on how long specific events may take and
thus no guarantee for lower priority tasks to actually
execute with a certain time. That would be some kind
of real-time system.

Such systems also rarely panic if they detect a violation
of their rules.

In any case, locking out lower priority tasks by an
overwhelmed network layer probably isn't the bug that
we look for.



Re: heartbeat panic by heavy traffic

2023-09-15 Thread Michael van Elst
mar...@duskware.de (Martin Husemann) writes:

>On Fri, Sep 15, 2023 at 12:17:58PM +0900, Masanobu SAITOH wrote:
>> I think it would be good to change the default behavior from
>> panic to something others because GENERIC kernel enables HEARTBEAT.
>> by default. One of idea is to print warning message at sufficient intervals.

>I disagree. It is very important that we fix the underlying problem
>instead. Without hearbeat, this behaviour is still visible (but undiagnosable).

The crash here comes from how the network stack operates. Running at
a higher priority, it locks out the lower priority clock softint
and heartbeat detects that and crashes the system intentionally.

I don't consider that useful even in a test environment.



<    1   2   3   4   5   6   7   8   9   10   >