CVS commit: src/usr.bin/stat

2024-03-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 14 00:07:20 UTC 2024

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

Log Message:
stat: fix lint warning about constant argument to '!'

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/stat/stat.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/stat/stat.c
diff -u src/usr.bin/stat/stat.c:1.50 src/usr.bin/stat/stat.c:1.51
--- src/usr.bin/stat/stat.c:1.50	Mon Jan 29 22:01:58 2024
+++ src/usr.bin/stat/stat.c	Thu Mar 14 00:07:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stat.c,v 1.50 2024/01/29 22:01:58 christos Exp $ */
+/*	$NetBSD: stat.c,v 1.51 2024/03/14 00:07:20 rillig Exp $ */
 
 /*
  * Copyright (c) 2002-2011 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: stat.c,v 1.50 2024/01/29 22:01:58 christos Exp $");
+__RCSID("$NetBSD: stat.c,v 1.51 2024/03/14 00:07:20 rillig Exp $");
 #endif
 
 #if ! HAVE_NBTOOL_CONFIG_H
@@ -1077,7 +1077,7 @@ format1(const struct stat *st,
 	 * First prefixlen chars are not encoded.
 	 */
 	if ((flags & FLAG_POUND) != 0 && ofmt == FMTF_STRING) {
-		flags &= !FLAG_POUND;
+		flags = 0;
 		strncpy(visbuf, sdata, prefixlen);
 		/* Avoid GCC warnings. */
 		visbuf[prefixlen] = 0;



CVS commit: src/usr.bin/stat

2024-03-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 14 00:07:20 UTC 2024

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

Log Message:
stat: fix lint warning about constant argument to '!'

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/stat/stat.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/audio/common

2024-03-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Mar 14 00:00:31 UTC 2024

Modified Files:
src/usr.bin/audio/common: wav.c

Log Message:
fix some sizeof() confusion.

using "const char search[4]" as a function parameter means that
"search" is actually a pointer type so "sizeof search" returns
8 on 64-bit platforms.  i mis-read this and used "sizeof *search"
which is always 1, noted by rillig.

instead of trying to avoid writing "4" twice, put it in a define
and use that in various places instead.  annoying.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/audio/common/wav.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/audio/common/wav.c
diff -u src/usr.bin/audio/common/wav.c:1.22 src/usr.bin/audio/common/wav.c:1.23
--- src/usr.bin/audio/common/wav.c:1.22	Tue Mar 12 00:34:38 2024
+++ src/usr.bin/audio/common/wav.c	Thu Mar 14 00:00:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: wav.c,v 1.22 2024/03/12 00:34:38 mrg Exp $	*/
+/*	$NetBSD: wav.c,v 1.23 2024/03/14 00:00:31 mrg Exp $	*/
 
 /*
  * Copyright (c) 2002, 2009, 2013, 2015, 2019, 2024 Matthew R. Green
@@ -33,7 +33,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: wav.c,v 1.22 2024/03/12 00:34:38 mrg Exp $");
+__RCSID("$NetBSD: wav.c,v 1.23 2024/03/14 00:00:31 mrg Exp $");
 #endif
 
 
@@ -91,8 +91,10 @@ wav_enc_from_val(int encoding)
  * WAV format helpers
  */
 
+#define RIFFNAMELEN	4
+
 static bool
-find_riff_chunk(const char search[4], size_t *remainp, char **wherep, uint32_t *partlen)
+find_riff_chunk(const char *search, size_t *remainp, char **wherep, uint32_t *partlen)
 {
 	wav_audioheaderpart part;
 
@@ -116,7 +118,7 @@ find_riff_chunk(const char search[4], si
 			emsg = " (odd length, adjusted)";
 			len += 1;
 		}
-		if (strncmp(part.name, search, sizeof *search) == 0) {
+		if (strncmp(part.name, search, RIFFNAMELEN) == 0) {
 			*partlen = len;
 			if (verbose > 1)
 fprintf(stderr, "Found part %.04s length %d%s\n",
@@ -148,10 +150,10 @@ audio_wav_parse_hdr(void *hdr, size_t sz
 	uint32_t len = 0;
 	u_int16_t fmttag;
 	static const char
-	strfmt[4] = "fmt ",
-	strRIFF[4] = "RIFF",
-	strWAVE[4] = "WAVE",
-	strdata[4] = "data";
+	strfmt[RIFFNAMELEN] = "fmt ",
+	strRIFF[RIFFNAMELEN] = "RIFF",
+	strWAVE[RIFFNAMELEN] = "WAVE",
+	strdata[RIFFNAMELEN] = "data";
 	bool found;
 
 	if (sz < 32)



CVS commit: src/usr.bin/audio/common

2024-03-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Mar 14 00:00:31 UTC 2024

Modified Files:
src/usr.bin/audio/common: wav.c

Log Message:
fix some sizeof() confusion.

using "const char search[4]" as a function parameter means that
"search" is actually a pointer type so "sizeof search" returns
8 on 64-bit platforms.  i mis-read this and used "sizeof *search"
which is always 1, noted by rillig.

instead of trying to avoid writing "4" twice, put it in a define
and use that in various places instead.  annoying.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/audio/common/wav.c

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



CVS commit: src/external/mpl/bind

2024-03-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 13 12:56:31 UTC 2024

Modified Files:
src/external/mpl/bind: Makefile.inc
src/external/mpl/bind/include: config.h

Log Message:
centrally control if we are building kerberos


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/mpl/bind/Makefile.inc
cvs rdiff -u -r1.16 -r1.17 src/external/mpl/bind/include/config.h

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

Modified files:

Index: src/external/mpl/bind/Makefile.inc
diff -u src/external/mpl/bind/Makefile.inc:1.14 src/external/mpl/bind/Makefile.inc:1.15
--- src/external/mpl/bind/Makefile.inc:1.14	Sun Feb 25 13:50:43 2024
+++ src/external/mpl/bind/Makefile.inc	Wed Mar 13 08:56:31 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.14 2024/02/25 18:50:43 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.15 2024/03/13 12:56:31 christos Exp $
 
 .if !defined(BIND9_MAKEFILE_INC)
 BIND9_MAKEFILE_INC=yes
@@ -79,6 +79,7 @@ LIBDPLIBS+=  pthread  ${NETBSDSRCDIR
 .endif
 
 .if ${MKKERBEROS} != "no"
+CPPFLAGS+=-DWITH_KERBEROS
 .if !defined (LIB) || empty(LIB)
 LDADD+= -lgssapi -lheimntlm ${LIBKRB5_LDADD}
 DPADD+= ${LIBGSSAPI} ${LIBHEIMNTLM} ${LIBKRB5_DPADD}

Index: src/external/mpl/bind/include/config.h
diff -u src/external/mpl/bind/include/config.h:1.16 src/external/mpl/bind/include/config.h:1.17
--- src/external/mpl/bind/include/config.h:1.16	Wed Feb 21 17:52:52 2024
+++ src/external/mpl/bind/include/config.h	Wed Mar 13 08:56:31 2024
@@ -178,6 +178,7 @@
 /* Define to 1 if you have the  header file. */
 #define HAVE_GLOB_H 1
 
+#ifdef WITH_KERBEROS
 /* Define to 1 if you have the Kerberos Framework available */
 #define HAVE_GSSAPI 1
 
@@ -195,6 +196,7 @@
 
 /* Define to 1 if you have the `gss_acquire_cred' function. */
 #define HAVE_GSS_ACQUIRE_CRED 1
+#endif
 
 /* Define to 1 if you have the  header file. */
 /* #undef HAVE_IDN2_H */
@@ -214,6 +216,7 @@
 /* Use json-c library */
 /* #undef HAVE_JSON_C */
 
+#ifdef WITH_KERBEROS
 /* Define to 1 if you have the  header file. */
 /* #undef HAVE_KRB5_H */
 
@@ -222,6 +225,7 @@
 
 /* Define to 1 if you have the  header file. */
 #define HAVE_KRB5_KRB5_H 1
+#endif
 
 /* Define if libidn2 was found */
 /* #undef HAVE_LIBIDN2 */



CVS commit: src/external/mpl/bind

2024-03-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 13 12:56:31 UTC 2024

Modified Files:
src/external/mpl/bind: Makefile.inc
src/external/mpl/bind/include: config.h

Log Message:
centrally control if we are building kerberos


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/mpl/bind/Makefile.inc
cvs rdiff -u -r1.16 -r1.17 src/external/mpl/bind/include/config.h

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



CVS commit: src/sys/arch/evbmips/evbmips

2024-03-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 13 12:44:30 UTC 2024

Modified Files:
src/sys/arch/evbmips/evbmips: interrupt.c

Log Message:
evbmips/interrupt.c: No need for __diagused with KASSERT.

KASSERT already references all the variables even in !DIAGNOSTIC
builds (but evaluates nothing at run-time in that case).

That said: Is the curlwp->l_blcnt assertion correct?  Can't curlwp be
changed in this interrupt handler by preemption?


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/evbmips/evbmips/interrupt.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/evbmips/evbmips/interrupt.c
diff -u src/sys/arch/evbmips/evbmips/interrupt.c:1.27 src/sys/arch/evbmips/evbmips/interrupt.c:1.28
--- src/sys/arch/evbmips/evbmips/interrupt.c:1.27	Wed Mar 13 06:59:01 2024
+++ src/sys/arch/evbmips/evbmips/interrupt.c	Wed Mar 13 12:44:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: interrupt.c,v 1.27 2024/03/13 06:59:01 skrll Exp $	*/
+/*	$NetBSD: interrupt.c,v 1.28 2024/03/13 12:44:30 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.27 2024/03/13 06:59:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.28 2024/03/13 12:44:30 riastradh Exp $");
 
 #include 
 #include 
@@ -53,9 +53,9 @@ cpu_intr(int ppl, vaddr_t pc, uint32_t s
 	struct cpu_info * const ci = curcpu();
 	uint32_t pending;
 	int ipl;
-	const int mtx_count __diagused = ci->ci_mtx_count;
-	const u_int biglock_count __diagused = ci->ci_biglock_count;
-	const u_int blcnt __diagused = curlwp->l_blcnt;
+	const int mtx_count = ci->ci_mtx_count;
+	const u_int biglock_count = ci->ci_biglock_count;
+	const u_int blcnt = curlwp->l_blcnt;
 
 	KASSERT(ci->ci_cpl == IPL_HIGH);
 	KDASSERT(mips_cp0_status_read() & MIPS_SR_INT_IE);



CVS commit: src/sys/arch/evbmips/evbmips

2024-03-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 13 12:44:30 UTC 2024

Modified Files:
src/sys/arch/evbmips/evbmips: interrupt.c

Log Message:
evbmips/interrupt.c: No need for __diagused with KASSERT.

KASSERT already references all the variables even in !DIAGNOSTIC
builds (but evaluates nothing at run-time in that case).

That said: Is the curlwp->l_blcnt assertion correct?  Can't curlwp be
changed in this interrupt handler by preemption?


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/evbmips/evbmips/interrupt.c

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



CVS commit: src/doc

2024-03-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Mar 13 08:13:56 UTC 2024

Modified Files:
src/doc: CHANGES

Log Message:
Mention ascaudio(4).


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

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



CVS commit: src/doc

2024-03-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Mar 13 08:13:56 UTC 2024

Modified Files:
src/doc: CHANGES

Log Message:
Mention ascaudio(4).


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.3043 src/doc/CHANGES:1.3044
--- src/doc/CHANGES:1.3043	Sun Mar  3 17:43:32 2024
+++ src/doc/CHANGES	Wed Mar 13 08:13:56 2024
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3043 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3044 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -285,3 +285,4 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 	bind: Import 9.18.24 [christos 20240221]
 	sqlite3(1): Import 3.45.1. [christos 20240301]
 	elftoolchain: Import svn r4037. [christos 20240303]
+	mac68k: Add ascaudio(4) ASC audio driver. [nat 20240313]



CVS commit: src/sys/arch/mac68k

2024-03-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Mar 13 07:55:29 UTC 2024

Modified Files:
src/sys/arch/mac68k/conf: files.mac68k majors.mac68k
Added Files:
src/sys/arch/mac68k/conf: AUDIO AUDIOSBC
src/sys/arch/mac68k/obio: ascaudio.c ascaudiovar.h ascreg.h

Log Message:
Apple Sound Chip audio support for 68k Macintoshoes.

This provies a sound device and support for wsbell(4).

Manual page to be added in a followup commit.

As posted to port-mac68k.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/mac68k/conf/AUDIO \
src/sys/arch/mac68k/conf/AUDIOSBC
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/mac68k/conf/files.mac68k
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/mac68k/conf/majors.mac68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/mac68k/obio/ascaudio.c \
src/sys/arch/mac68k/obio/ascaudiovar.h src/sys/arch/mac68k/obio/ascreg.h

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

Modified files:

Index: src/sys/arch/mac68k/conf/files.mac68k
diff -u src/sys/arch/mac68k/conf/files.mac68k:1.132 src/sys/arch/mac68k/conf/files.mac68k:1.133
--- src/sys/arch/mac68k/conf/files.mac68k:1.132	Tue Jan  9 04:16:25 2024
+++ src/sys/arch/mac68k/conf/files.mac68k	Wed Mar 13 07:55:28 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mac68k,v 1.132 2024/01/09 04:16:25 thorpej Exp $
+#	$NetBSD: files.mac68k,v 1.133 2024/03/13 07:55:28 nat Exp $
 
 # mac68k-specific configuration info
 
@@ -43,10 +43,16 @@ device	ams: wsmousedev
 attach	ams at adb
 file	arch/mac68k/dev/ams.c		ams needs-flag
 
+# ASC (beeper)
 device	asc
 attach	asc at obio
 file	arch/mac68k/obio/asc.c		asc needs-flag
 
+#ASC audio
+device	ascaudio: audiobus, auconv, mulaw, aurateconv, auvolconv
+attach	ascaudio at obio
+file	arch/mac68k/obio/ascaudio.c	ascaudio needs-flag
+
 device	nubus { }
 attach	nubus at mainbus
 file	arch/mac68k/nubus/nubus.c	nubus

Index: src/sys/arch/mac68k/conf/majors.mac68k
diff -u src/sys/arch/mac68k/conf/majors.mac68k:1.27 src/sys/arch/mac68k/conf/majors.mac68k:1.28
--- src/sys/arch/mac68k/conf/majors.mac68k:1.27	Sat Apr  4 16:06:14 2020
+++ src/sys/arch/mac68k/conf/majors.mac68k	Wed Mar 13 07:55:28 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.mac68k,v 1.27 2020/04/04 16:06:14 jdolecek Exp $
+#	$NetBSD: majors.mac68k,v 1.28 2024/03/13 07:55:28 nat Exp $
 #
 # Device majors for mac68k
 #
@@ -52,6 +52,7 @@ device-major	ksyms		char 52			ksyms
 device-major	wsfont		char 53			wsfont
 device-major	cpi		char 54			cpi
 device-major	sysmon		char 55			sysmon
+device-major	audio		char 56			audio
 
 #device-major	obsolete	char 98			obsolete (nsmb)
 

Added files:

Index: src/sys/arch/mac68k/conf/AUDIO
diff -u /dev/null src/sys/arch/mac68k/conf/AUDIO:1.1
--- /dev/null	Wed Mar 13 07:55:29 2024
+++ src/sys/arch/mac68k/conf/AUDIO	Wed Mar 13 07:55:28 2024
@@ -0,0 +1,17 @@
+# $NetBSD: AUDIO,v 1.1 2024/03/13 07:55:28 nat Exp $
+#
+# WSFB with audio enabled.
+
+include 	"arch/mac68k/conf/WSFB"
+
+no asc0 at obio?
+
+# DEFQUALTY	0x0	22257 Monaural playback.
+# LOWQUALITY	0x1	Half playback rate.
+# HIGHQUALITY	0x2	Best Quality supported by ASC.
+
+ascaudio*	at obio? flags 0x0		# ASC/EASC audio
+audio*		at audiobus?
+spkr*		at audio?			# PC speaker (synthesized)
+wsbell*		at spkr? 			# Console beep
+
Index: src/sys/arch/mac68k/conf/AUDIOSBC
diff -u /dev/null src/sys/arch/mac68k/conf/AUDIOSBC:1.1
--- /dev/null	Wed Mar 13 07:55:29 2024
+++ src/sys/arch/mac68k/conf/AUDIOSBC	Wed Mar 13 07:55:28 2024
@@ -0,0 +1,17 @@
+# $NetBSD: AUDIOSBC,v 1.1 2024/03/13 07:55:28 nat Exp $
+#
+# WSFB with audio enabled.
+
+include 	"arch/mac68k/conf/WSFBSBC"
+
+no asc0 at obio?
+
+# DEFQUALTY	0x0	22257 Monaural playback.
+# LOWQUALITY	0x1	Half playback rate.
+# HIGHQUALITY	0x2	Best Quality supported by ASC.
+
+ascaudio*	at obio? flags 0x0		# ASC/EASC audio
+audio*		at audiobus?
+spkr*		at audio?			# PC speaker (synthesized)
+wsbell*		at spkr? 			# Console beep
+

Index: src/sys/arch/mac68k/obio/ascaudio.c
diff -u /dev/null src/sys/arch/mac68k/obio/ascaudio.c:1.1
--- /dev/null	Wed Mar 13 07:55:29 2024
+++ src/sys/arch/mac68k/obio/ascaudio.c	Wed Mar 13 07:55:28 2024
@@ -0,0 +1,970 @@
+/* $NetBSD: ascaudio.c,v 1.1 2024/03/13 07:55:28 nat Exp $ */
+
+/*-
+ * Copyright (c) 2017, 2023 Nathanial Sloss 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 

CVS commit: src/sys/arch/mac68k

2024-03-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Mar 13 07:55:29 UTC 2024

Modified Files:
src/sys/arch/mac68k/conf: files.mac68k majors.mac68k
Added Files:
src/sys/arch/mac68k/conf: AUDIO AUDIOSBC
src/sys/arch/mac68k/obio: ascaudio.c ascaudiovar.h ascreg.h

Log Message:
Apple Sound Chip audio support for 68k Macintoshoes.

This provies a sound device and support for wsbell(4).

Manual page to be added in a followup commit.

As posted to port-mac68k.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/mac68k/conf/AUDIO \
src/sys/arch/mac68k/conf/AUDIOSBC
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/mac68k/conf/files.mac68k
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/mac68k/conf/majors.mac68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/mac68k/obio/ascaudio.c \
src/sys/arch/mac68k/obio/ascaudiovar.h src/sys/arch/mac68k/obio/ascreg.h

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



Re: CVS commit: src/sys/arch/evbmips/evbmips

2024-03-13 Thread Andrius V
Thanks, should take remember this for the future reference.

On Wed, Mar 13, 2024 at 8:59 AM Nick Hudson  wrote:
>
> Module Name:src
> Committed By:   skrll
> Date:   Wed Mar 13 06:59:01 UTC 2024
>
> Modified Files:
> src/sys/arch/evbmips/evbmips: interrupt.c
>
> Log Message:
> Remove #ifdef DIAGNOSTIC by using __diagused. NFCI.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbmips/evbmips/interrupt.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
>


CVS commit: src/sys/netbt

2024-03-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Mar 13 07:22:16 UTC 2024

Added Files:
src/sys/netbt: hci_le.h

Log Message:
Bluetooth low energy - A beginning at least.

This was the start of support for low energy bluetooth support that I have
not as yet completed.

I'm committing this as it gives the hci defines for an impementation in NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/netbt/hci_le.h

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

Added files:

Index: src/sys/netbt/hci_le.h
diff -u /dev/null src/sys/netbt/hci_le.h:1.1
--- /dev/null	Wed Mar 13 07:22:16 2024
+++ src/sys/netbt/hci_le.h	Wed Mar 13 07:22:16 2024
@@ -0,0 +1,368 @@
+/* $NetBSD: hci_le.h,v 1.1 2024/03/13 07:22:16 nat Exp $ */
+
+/*-
+ * Copyright (c) 2020 Nathanial Sloss 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define HCI_ADVERT_DATA_SIZE		31  /* advertising data size */
+#define HCI_SCAN_DATA_SIZE		31  /* scan resp. data size */
+ 
+/* LE Event masks */
+#define HCI_LE_EVMSK_ALL			0x001f
+#define HCI_LE_EVMSK_NONE			0x
+#define HCI_LE_EVMSK_CON_COMPL			0x0001
+#define HCI_LE_EVMSK_ADV_REPORT			0x0002
+#define HCI_LE_EVMSK_CON_UPDATE_COMPL		0x0004
+#define HCI_LE_EVMSK_READ_REMOTE_FEATURES_COMPL	0x0008
+#define HCI_LE_EVMSK_LONG_TERM_KEY_REQ		0x0010
+/* 0x0020 - 0x8000 - reserved for future use */
+
+/**
+ **
+ ** OGF 0x08	Bluetooth Low Energy (LE) Link commands
+ **
+ **/
+
+#define HCI_OGF_LE0x08
+
+#define HCI_OCF_LE_SET_EVENT_MASK			0x0001
+#define HCI_CMD_LE_SET_EVENT_MASK			0x2001
+typedef struct {
+	uint8_t		event_mask[HCI_EVENT_MASK_SIZE]; /* event_mask */
+} __packed hci_le_set_event_mask_cp;
+
+typedef hci_status_rp	hci_le_set_event_mask_rp;
+
+#define HCI_OCF_LE_READ_BUFFER_SIZE			0x0002
+#define HCI_CMD_LE_READ_BUFFER_SIZE			0x2002
+/* No command parameter(s) */
+
+typedef struct {
+	uint8_t		status; 	/* status 0x00 = success */
+	uint16_t	le_data_pktlen; /* buffer len*/
+	uint8_t		le_num_pkts; 	/* no. acl data packets */
+} __packed hci_le_read_buffer_size_rp;
+
+#define HCI_OCF_LE_READ_LOCAL_FEATURES			0x0003
+#define HCI_CMD_LE_READ_LOCAL_FEATURES			0x2003
+/* No command parameter(s) */
+
+typedef struct {
+	uint8_t		status; 	/* status 0x00 = success */
+	uint8_t		features[HCI_FEATURES_SIZE];	/* le features */
+} __packed hci_le_read_local_features_rp;
+
+#define HCI_OCF_LE_SET_RND_ADDR0x0005
+#define HCI_CMD_LE_SET_RND_ADDR0x2005
+typedef struct {
+	bdaddr_t	bdaddr; 	/* random local address */
+} __packed hci_le_set_rnd_addr_cp;
+
+typedef hci_status_rp	hci_le_set_rnd_addr_rp;
+/* XXX NS Finish defines. */
+#define HCI_OCF_LE_SET_ADVERT_PARAM			0x0006
+#define HCI_CMD_LE_SET_ADVERT_PARAM			0x2006
+typedef struct {
+	uint16_t	min_interval; 	/* min interval * 0.625ms */
+	uint16_t	max_interval; 	/* max_interval * 0.625ms */
+	uint8_t		advert_type;
+	uint8_t		own_address_type;
+	uint8_t		direct_address_type;
+	bdaddr_t	direct_address; /* remote address */
+	uint8_t		advert_channel_map;
+	uint8_t		advert_filter_policy;
+} __packed hci_le_set_advert_param_cp;
+
+typedef hci_status_rp	hci_le_set_advert_param_rp;
+
+#define HCF_OCF_LE_READ_ADVERT_CHAN_TX_PWR		0x0007
+#define HCF_CMD_LE_READ_ADVERT_CHAN_TX_PWR	

CVS commit: src/sys/netbt

2024-03-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Mar 13 07:22:16 UTC 2024

Added Files:
src/sys/netbt: hci_le.h

Log Message:
Bluetooth low energy - A beginning at least.

This was the start of support for low energy bluetooth support that I have
not as yet completed.

I'm committing this as it gives the hci defines for an impementation in NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/netbt/hci_le.h

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



CVS commit: src/sys/arch/evbmips/evbmips

2024-03-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Mar 13 06:59:01 UTC 2024

Modified Files:
src/sys/arch/evbmips/evbmips: interrupt.c

Log Message:
Remove #ifdef DIAGNOSTIC by using __diagused. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbmips/evbmips/interrupt.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/evbmips/evbmips/interrupt.c
diff -u src/sys/arch/evbmips/evbmips/interrupt.c:1.26 src/sys/arch/evbmips/evbmips/interrupt.c:1.27
--- src/sys/arch/evbmips/evbmips/interrupt.c:1.26	Tue Mar 12 21:27:14 2024
+++ src/sys/arch/evbmips/evbmips/interrupt.c	Wed Mar 13 06:59:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: interrupt.c,v 1.26 2024/03/12 21:27:14 andvar Exp $	*/
+/*	$NetBSD: interrupt.c,v 1.27 2024/03/13 06:59:01 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.26 2024/03/12 21:27:14 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.27 2024/03/13 06:59:01 skrll Exp $");
 
 #include 
 #include 
@@ -53,11 +53,10 @@ cpu_intr(int ppl, vaddr_t pc, uint32_t s
 	struct cpu_info * const ci = curcpu();
 	uint32_t pending;
 	int ipl;
-#ifdef DIAGNOSTIC
-	const int mtx_count = ci->ci_mtx_count;
-	const u_int biglock_count = ci->ci_biglock_count;
-	const u_int blcnt = curlwp->l_blcnt;
-#endif
+	const int mtx_count __diagused = ci->ci_mtx_count;
+	const u_int biglock_count __diagused = ci->ci_biglock_count;
+	const u_int blcnt __diagused = curlwp->l_blcnt;
+
 	KASSERT(ci->ci_cpl == IPL_HIGH);
 	KDASSERT(mips_cp0_status_read() & MIPS_SR_INT_IE);
 
@@ -94,11 +93,9 @@ cpu_intr(int ppl, vaddr_t pc, uint32_t s
 			/* Process I/O and error interrupts. */
 			evbmips_iointr(ipl, pending, );
 		}
-#ifdef DIAGNOSTIC
 		KASSERT(biglock_count == ci->ci_biglock_count);
 		KASSERT(blcnt == curlwp->l_blcnt);
 		KASSERT(mtx_count == ci->ci_mtx_count);
-#endif
 
 		/*
 		 * If even our spl is higher now (due to interrupting while



CVS commit: src/sys/arch/evbmips/evbmips

2024-03-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Mar 13 06:59:01 UTC 2024

Modified Files:
src/sys/arch/evbmips/evbmips: interrupt.c

Log Message:
Remove #ifdef DIAGNOSTIC by using __diagused. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbmips/evbmips/interrupt.c

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



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

2024-03-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Mar 13 06:56:24 UTC 2024

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

Log Message:
tests/lint: ensure that lint correctly decays array parameter types


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/expr_sizeof.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/expr_sizeof.c
diff -u src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.14 src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.15
--- src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.14	Sat Aug  5 10:13:39 2023
+++ src/tests/usr.bin/xlint/lint1/expr_sizeof.c	Wed Mar 13 06:56:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: expr_sizeof.c,v 1.14 2023/08/05 10:13:39 rillig Exp $	*/
+/*	$NetBSD: expr_sizeof.c,v 1.15 2024/03/13 06:56:24 rillig Exp $	*/
 # 3 "expr_sizeof.c"
 
 /*
@@ -199,3 +199,17 @@ struct s24 {
 };
 /* expect+1: error: negative array dimension (-24) [20] */
 typedef int sizeof_s24[-(int)sizeof(struct s24)];
+
+void
+sizeof_array_parameter(short arr[12345])
+{
+	// The size of an array parameter is the size of the decayed pointer.
+	// Subtracting 'sizeof(void *)' makes the test platform-independent.
+	typedef int sizeof_arr[-(int)(sizeof arr - sizeof(void *))];
+
+	// The 2 comes from 'sizeof(short)', as the type 'array[size] of elem'
+	// decays into the type 'pointer to elem', not 'pointer to array[size]
+	// of elem'.
+	/* expect+1: error: negative array dimension (-2) [20] */
+	typedef int sizeof_arr_elem[-(int)(sizeof *arr)];
+}



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

2024-03-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Mar 13 06:56:24 UTC 2024

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

Log Message:
tests/lint: ensure that lint correctly decays array parameter types


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/expr_sizeof.c

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



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

2024-03-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Mar 13 06:48:49 UTC 2024

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

Log Message:
lint: trim down the check for snprintb formats


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/lint1/cksnprintb.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/cksnprintb.c
diff -u src/usr.bin/xlint/lint1/cksnprintb.c:1.10 src/usr.bin/xlint/lint1/cksnprintb.c:1.11
--- src/usr.bin/xlint/lint1/cksnprintb.c:1.10	Sun Mar 10 16:27:16 2024
+++ src/usr.bin/xlint/lint1/cksnprintb.c	Wed Mar 13 06:48:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cksnprintb.c,v 1.10 2024/03/10 16:27:16 rillig Exp $	*/
+/*	$NetBSD: cksnprintb.c,v 1.11 2024/03/13 06:48:49 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: cksnprintb.c,v 1.10 2024/03/10 16:27:16 rillig Exp $");
+__RCSID("$NetBSD: cksnprintb.c,v 1.11 2024/03/13 06:48:49 rillig Exp $");
 #endif
 
 #include 
@@ -51,35 +51,10 @@ typedef struct {
 	quoted_iterator it;
 	uint64_t field_width;
 	uint64_t covered;
-	unsigned covered_start[64];
-	unsigned covered_end[64];
+	const char *covered_start[64];
+	int covered_len[64];
 } checker;
 
-static bool
-match_string_literal(const tnode_t *tn, const buffer **str)
-{
-	while (tn->tn_op == CVT)
-		tn = tn->u.ops.left;
-	return tn->tn_op == ADDR
-	&& tn->u.ops.left->tn_op == STRING
-	&& (*str = tn->u.ops.left->u.str_literals, (*str)->data != NULL);
-}
-
-static bool
-match_snprintb_call(const function_call *call,
-const buffer **fmt, const tnode_t **val)
-{
-	const char *func;
-
-	return call->func->tn_op == ADDR
-	&& call->func->u.ops.left->tn_op == NAME
-	&& (func = call->func->u.ops.left->u.sym->s_name, true)
-	&& ((strcmp(func, "snprintb") == 0 && call->args_len == 4)
-		|| (strcmp(func, "snprintb_m") == 0 && call->args_len == 5))
-	&& match_string_literal(call->args[2], fmt)
-	&& (*val = call->args[3], true);
-}
-
 static int
 len(quoted_iterator it)
 {
@@ -126,52 +101,36 @@ check_hex_escape(const buffer *buf, quot
 }
 
 static void
-check_overlap(checker *ck, uint64_t dir_lsb, uint64_t width,
-	  size_t start, size_t end)
+check_bit(checker *ck, uint64_t dir_lsb, uint64_t width,
+	  const char *start, int len)
 {
 	unsigned lsb = (unsigned)(ck->new_style ? dir_lsb : dir_lsb - 1);
 	if (lsb >= 64 || width == 0 || width > 64)
 		return;
 
 	uint64_t field_mask = value_bits((unsigned)width) << lsb;
-	uint64_t overlap = ck->covered & field_mask;
-	if (overlap == 0)
-		goto update_covered;
-
 	for (unsigned i = lsb; i < 64; i++) {
-		if (!(overlap & bit(i)))
-			continue;
-		/* '%.*s' overlaps earlier '%.*s' on bit %u */
-		warning(376,
-		(int)(end - start), ck->fmt->data + start,
-		(int)(ck->covered_end[i] - ck->covered_start[i]),
-		ck->fmt->data + ck->covered_start[i],
-		ck->new_style ? i : i + 1);
-		break;
+		if (ck->covered & field_mask & bit(i)) {
+			/* '%.*s' overlaps earlier '%.*s' on bit %u */
+			warning(376,
+			len, start, ck->covered_len[i],
+			ck->covered_start[i],
+			ck->new_style ? i : i + 1);
+			break;
+		}
 	}
 
-update_covered:
 	ck->covered |= field_mask;
 	for (unsigned i = lsb; i < 64; i++) {
 		if (field_mask & bit(i)) {
-			ck->covered_start[i] = (unsigned)start;
-			ck->covered_end[i] = (unsigned)end;
+			ck->covered_start[i] = start;
+			ck->covered_len[i] = len;
 		}
 	}
-}
-
-static void
-check_reachable(checker *ck, uint64_t dir_lsb, uint64_t width,
-		size_t start, size_t end)
-{
-	unsigned lsb = (unsigned)(ck->new_style ? dir_lsb : dir_lsb - 1);
-	if (lsb >= 64 || width == 0 || width > 64)
-		return;
 
-	uint64_t field_mask = value_bits((unsigned)width) << lsb;
 	if (!(possible_bits(ck->value) & field_mask))
 		/* directive '%.*s' is unreachable by input value */
-		warning(378, (int)(end - start), ck->fmt->data + start);
+		warning(378, len, start);
 }
 
 static bool
@@ -266,45 +225,37 @@ check_directive(checker *ck)
 		check_hex_escape(fmt, bit);
 	if (has_width)
 		check_hex_escape(fmt, width);
-	if (has_bit && bit.octal_digits == 0 && bit.hex_digits == 0) {
+	if (has_bit && bit.octal_digits == 0 && bit.hex_digits == 0)
 		/* bit position '%.*s' in '%.*s' should be escaped as ... */
 		warning(369, len(bit), start(bit, fmt),
 		range(dir, *it), start(dir, fmt));
-	}
-	if (has_width && width.octal_digits == 0 && width.hex_digits == 0) {
+	if (has_width && width.octal_digits == 0 && width.hex_digits == 0)
 		/* field width '%.*s' in '%.*s' should be escaped as ... */
 		warning(370, len(width), start(width, fmt),
 		range(dir, *it), start(dir, fmt));
-	}
-	if (has_bit && (new_style ? bit.value > 63 : bit.value - 1 > 31)) {
+	if (has_bit && (new_style ? bit.value > 63 : bit.value - 1 > 31))
 		/* bit position '%.*s' (%ju) in 

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

2024-03-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Mar 13 06:48:49 UTC 2024

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

Log Message:
lint: trim down the check for snprintb formats


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/lint1/cksnprintb.c

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