CVS commit: src/lib/libc/arch/arm

2021-06-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 30 00:00:49 UTC 2021

Modified Files:
src/lib/libc/arch/arm/gen: swapcontext.S
src/lib/libc/arch/arm/sys: __clone.S

Log Message:
Fix previous. For Thumb-1:
- sp cannot be manipulated directly
- {add,sub}s should be used instead of {add,sub}


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/arch/arm/gen/swapcontext.S
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/arch/arm/sys/__clone.S

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

Modified files:

Index: src/lib/libc/arch/arm/gen/swapcontext.S
diff -u src/lib/libc/arch/arm/gen/swapcontext.S:1.16 src/lib/libc/arch/arm/gen/swapcontext.S:1.17
--- src/lib/libc/arch/arm/gen/swapcontext.S:1.16	Tue Jun 29 23:29:12 2021
+++ src/lib/libc/arch/arm/gen/swapcontext.S	Wed Jun 30 00:00:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: swapcontext.S,v 1.16 2021/06/29 23:29:12 rin Exp $	*/
+/*	$NetBSD: swapcontext.S,v 1.17 2021/06/30 00:00:49 rin Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "assym.h"
 
 #if defined(LIBC_SCCS) && !defined(lint)
-RCSID("$NetBSD: swapcontext.S,v 1.16 2021/06/29 23:29:12 rin Exp $")
+RCSID("$NetBSD: swapcontext.S,v 1.17 2021/06/30 00:00:49 rin Exp $")
 #endif /* LIBC_SCCS && !lint */
 
 ENTRY(swapcontext)
@@ -85,9 +85,13 @@ ENTRY(swapcontext)
 	b	PLT_SYM(_C_LABEL(setcontext))
 #else
 	push	{lr}
-	sub	sp, #4
+	mov	r1, sp
+	subs	r1, #4
+	mov	sp, r1
 	bl	PLT_SYM(_C_LABEL(setcontext))
-	add	sp, #4
+	mov	r1, sp
+	adds	r1, #4
+	mov	sp, r1
 	pop	{pc}
 #endif
 #if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__)

Index: src/lib/libc/arch/arm/sys/__clone.S
diff -u src/lib/libc/arch/arm/sys/__clone.S:1.10 src/lib/libc/arch/arm/sys/__clone.S:1.11
--- src/lib/libc/arch/arm/sys/__clone.S:1.10	Tue Jun 29 23:29:12 2021
+++ src/lib/libc/arch/arm/sys/__clone.S	Wed Jun 30 00:00:49 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: __clone.S,v 1.10 2021/06/29 23:29:12 rin Exp $ */
+/* $NetBSD: __clone.S,v 1.11 2021/06/30 00:00:49 rin Exp $ */
 
 /*
  * Copyright (c) 2001 Christopher Gilbert
@@ -122,9 +122,13 @@ ENTRY(__clone)
 #else
 .Lcerror:
 	push	{lr}
-	sub	sp, #4
+	mov	r1, sp
+	subs	r1, #4
+	mov	sp, r1
 	bl	CERROR
-	add	sp, #4
+	mov	r1, sp
+	adds	r1, #4
+	mov	sp, r1
 	pop	{pc}
 #endif
 END(__clone)



CVS commit: src/lib/libc/arch/arm

2021-06-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 29 23:29:12 UTC 2021

Modified Files:
src/lib/libc/arch/arm/gen: swapcontext.S
src/lib/libc/arch/arm/sys: __clone.S

Log Message:
Align sp to 8-byte boundary as required by EABI.

IIUC, this change only affects libc compiled for ``Thumb-mode userland'',
which we've not officially supported yet.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/arch/arm/gen/swapcontext.S
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/arch/arm/sys/__clone.S

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

Modified files:

Index: src/lib/libc/arch/arm/gen/swapcontext.S
diff -u src/lib/libc/arch/arm/gen/swapcontext.S:1.15 src/lib/libc/arch/arm/gen/swapcontext.S:1.16
--- src/lib/libc/arch/arm/gen/swapcontext.S:1.15	Wed Nov 21 21:01:41 2018
+++ src/lib/libc/arch/arm/gen/swapcontext.S	Tue Jun 29 23:29:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: swapcontext.S,v 1.15 2018/11/21 21:01:41 skrll Exp $	*/
+/*	$NetBSD: swapcontext.S,v 1.16 2021/06/29 23:29:12 rin Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "assym.h"
 
 #if defined(LIBC_SCCS) && !defined(lint)
-RCSID("$NetBSD: swapcontext.S,v 1.15 2018/11/21 21:01:41 skrll Exp $")
+RCSID("$NetBSD: swapcontext.S,v 1.16 2021/06/29 23:29:12 rin Exp $")
 #endif /* LIBC_SCCS && !lint */
 
 ENTRY(swapcontext)
@@ -85,7 +85,9 @@ ENTRY(swapcontext)
 	b	PLT_SYM(_C_LABEL(setcontext))
 #else
 	push	{lr}
+	sub	sp, #4
 	bl	PLT_SYM(_C_LABEL(setcontext))
+	add	sp, #4
 	pop	{pc}
 #endif
 #if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__)

Index: src/lib/libc/arch/arm/sys/__clone.S
diff -u src/lib/libc/arch/arm/sys/__clone.S:1.9 src/lib/libc/arch/arm/sys/__clone.S:1.10
--- src/lib/libc/arch/arm/sys/__clone.S:1.9	Sat Nov 30 20:20:42 2013
+++ src/lib/libc/arch/arm/sys/__clone.S	Tue Jun 29 23:29:12 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: __clone.S,v 1.9 2013/11/30 20:20:42 joerg Exp $ */
+/* $NetBSD: __clone.S,v 1.10 2021/06/29 23:29:12 rin Exp $ */
 
 /*
  * Copyright (c) 2001 Christopher Gilbert
@@ -122,7 +122,9 @@ ENTRY(__clone)
 #else
 .Lcerror:
 	push	{lr}
+	sub	sp, #4
 	bl	CERROR
+	add	sp, #4
 	pop	{pc}
 #endif
 END(__clone)



CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm

2021-06-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 29 23:26:00 UTC 2021

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm: aeabi_cfcmp.S
divmodsi4.S divsi3.S modsi3.S

Log Message:
Align sp to 8-byte boundary as required by EABI.

This is especially important for non-leaf functions; GCC optimizes codes
based on assumption that sp is aligned properly.

Mostly fix broken earmv5 userland compiled by GCC10 due to alignment
faults in ld.elf_so, where {ld,st}rd are used for [sp, #8x].

No regression for ATF is observed for earmv[67]{,hf}{,eb}.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S
cvs rdiff -u -r1.1.1.4 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S

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

Modified files:

Index: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S:1.1.1.1 src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S:1.2
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S:1.1.1.1	Sat Feb 27 18:59:31 2016
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S	Tue Jun 29 23:26:00 2021
@@ -28,8 +28,10 @@
 .p2align 2
 DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmpeq)
 push {r0-r3, lr}
+sub sp, #4
 bl __aeabi_cfcmpeq_check_nan
 cmp r0, #1
+add sp, #4
 pop {r0-r3, lr}
 
 // NaN has been ruled out, so __aeabi_cfcmple can't trap
@@ -56,13 +58,16 @@ DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmp
 // Per the RTABI, this function must preserve r0-r11.
 // Save lr in the same instruction for compactness
 push {r0-r3, lr}
+sub sp, #4
 
 bl __aeabi_fcmplt
 cmp r0, #1
 moveq ip, #0
 beq 1f
 
+add sp, #4
 ldm sp, {r0-r3}
+sub sp, #4
 bl __aeabi_fcmpeq
 cmp r0, #1
 moveq ip, #(APSR_C | APSR_Z)
@@ -70,6 +75,7 @@ DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmp
 
 1:
 msr CPSR_f, ip
+add sp, #4
 pop {r0-r3}
 POP_PC()
 END_COMPILERRT_FUNCTION(__aeabi_cfcmple)

Index: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S:1.1.1.4 src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S:1.2
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S:1.1.1.4	Sat Feb 27 18:59:31 2016
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S	Tue Jun 29 23:26:00 2021
@@ -17,8 +17,10 @@
 
 #define ESTABLISH_FRAME\
 push   {r4-r7, lr}   ;\
-add r7, sp, #12
+add r7, sp, #12   ;\
+sub sp, #4
 #define CLEAR_FRAME_AND_RETURN \
+add sp, #4   ;\
 pop{r4-r7, pc}
 
 	.syntax unified
Index: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S:1.1.1.4 src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S:1.2
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S:1.1.1.4	Sat Feb 27 18:59:31 2016
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S	Tue Jun 29 23:26:00 2021
@@ -16,8 +16,10 @@
 
 #define ESTABLISH_FRAME \
 push   {r4, r7, lr};\
-add r7, sp, #4
+add r7, sp, #4   ;\
+sub sp, #4
 #define CLEAR_FRAME_AND_RETURN \
+add sp, #4   ;\
 pop{r4, r7, pc}
 
 	.syntax unified
Index: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S:1.1.1.4 src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S:1.2
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S:1.1.1.4	Sat Feb 27 18:59:31 2016
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S	Tue Jun 29 23:26:00 2021
@@ -16,8 +16,10 @@
 
 #define ESTABLISH_FRAME \
 push   {r4, r7, lr};\
-add r7, sp, #4
+add r7, sp, #4   ;\
+sub sp, #4
 #define CLEAR_FRAME_AND_RETURN \
+add sp, #4   ;\
 pop{r4, r7, pc}
 
 	.syntax unified



CVS commit: src

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:40:54 UTC 2021

Modified Files:
src/external/cddl/osnet/sys/sys: vnode.h
src/share/man/man9: errno.9 vnsubr.9
src/sys/dev: firmload.c fss.c kloader.c vnd.c
src/sys/kern: kern_acct.c kern_core.c kern_descrip.c kern_ktrace_vfs.c
kern_module_vfs.c subr_exec_fd.c subr_kobj_vfs.c tty_ptm.c
vfs_syscalls.c vfs_vnops.c
src/sys/miscfs/fdesc: fdesc_vnops.c
src/sys/modules/lua: lua.c
src/sys/sys: filedesc.h vnode.h
src/sys/ufs/lfs: ulfs_extattr.c ulfs_quota1.c
src/sys/ufs/ufs: ufs_extattr.c ufs_quota1.c

Log Message:
Add containment for the cloning devices hack in vn_open.

Cloning devices (and also things like /dev/stderr) work by allocating
a struct file, stuffing it in the file table (which is a layer
violation), stuffing the file descriptor number for it in a magic
field of struct lwp (which is gross), and then "failing" with one of
two magic errnos, EDUPFD or EMOVEFD.

Before this commit, all callers of vn_open in the kernel (there are
quite a few) were expected to check for these errors and handle the
situation. Needless to say, none of them except for open() itself did,
resulting in internal negative errnos being returned to userspace.

This hack is fairly deeply rooted and cannot be eliminated all at
once. This commit adds logic to handle the magic errnos inside
vn_open; now on success vn_open returns either a vnode or an integer
file descriptor, along with a flag that says whether the underlying
code requested EDUPFD or EMOVEFD. Callers not prepared to cope with
file descriptors can pass NULL for the extra return values, in which
case if a file descriptor would be produced vn_open fails with
EOPNOTSUPP.

Since I'm rearranging vn_open's signature anyway, stop exposing struct
nameidata. Instead, take three arguments: an optional vnode to use as
the starting point (like openat()), the path, and additional namei
flags to use, restricted to NOCHROOT and TRYEMULROOT. (Other namei
behavior, e.g. NOFOLLOW, can be requested via the open flags.)

This change requires a kernel bump. Ride the one an hour ago.
(That was supposed to be coordinated; did not intend to let an hour
slip by. My fault.)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/external/cddl/osnet/sys/sys/vnode.h
cvs rdiff -u -r1.5 -r1.6 src/share/man/man9/errno.9
cvs rdiff -u -r1.47 -r1.48 src/share/man/man9/vnsubr.9
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/firmload.c
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/fss.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/kloader.c
cvs rdiff -u -r1.281 -r1.282 src/sys/dev/vnd.c
cvs rdiff -u -r1.97 -r1.98 src/sys/kern/kern_acct.c
cvs rdiff -u -r1.34 -r1.35 src/sys/kern/kern_core.c
cvs rdiff -u -r1.250 -r1.251 src/sys/kern/kern_descrip.c
cvs rdiff -u -r1.2 -r1.3 src/sys/kern/kern_ktrace_vfs.c
cvs rdiff -u -r1.17 -r1.18 src/sys/kern/kern_module_vfs.c
cvs rdiff -u -r1.11 -r1.12 src/sys/kern/subr_exec_fd.c \
src/sys/kern/subr_kobj_vfs.c
cvs rdiff -u -r1.42 -r1.43 src/sys/kern/tty_ptm.c
cvs rdiff -u -r1.549 -r1.550 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.215 -r1.216 src/sys/kern/vfs_vnops.c
cvs rdiff -u -r1.137 -r1.138 src/sys/miscfs/fdesc/fdesc_vnops.c
cvs rdiff -u -r1.24 -r1.25 src/sys/modules/lua/lua.c
cvs rdiff -u -r1.68 -r1.69 src/sys/sys/filedesc.h
cvs rdiff -u -r1.296 -r1.297 src/sys/sys/vnode.h
cvs rdiff -u -r1.16 -r1.17 src/sys/ufs/lfs/ulfs_extattr.c
cvs rdiff -u -r1.11 -r1.12 src/sys/ufs/lfs/ulfs_quota1.c
cvs rdiff -u -r1.52 -r1.53 src/sys/ufs/ufs/ufs_extattr.c
cvs rdiff -u -r1.23 -r1.24 src/sys/ufs/ufs/ufs_quota1.c

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

Modified files:

Index: src/external/cddl/osnet/sys/sys/vnode.h
diff -u src/external/cddl/osnet/sys/sys/vnode.h:1.18 src/external/cddl/osnet/sys/sys/vnode.h:1.19
--- src/external/cddl/osnet/sys/sys/vnode.h:1.18	Thu Apr 15 06:59:57 2021
+++ src/external/cddl/osnet/sys/sys/vnode.h	Tue Jun 29 22:40:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode.h,v 1.18 2021/04/15 06:59:57 christos Exp $	*/
+/*	$NetBSD: vnode.h,v 1.19 2021/06/29 22:40:53 dholland Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -239,7 +239,6 @@ zfs_vn_open(const char *pnamep, enum uio
 vnode_t **vpp, enum create crwhy, mode_t umask)
 {
 	struct pathbuf *pb;
-	struct nameidata nd;
 	int error;
 
 	ASSERT(seg == UIO_SYSSPACE);
@@ -247,12 +246,12 @@ zfs_vn_open(const char *pnamep, enum uio
 	ASSERT(crwhy == CRCREAT);
 	ASSERT(umask == 0);
 
+	filemode |= O_NOFOLLOW;
+
 	pb = pathbuf_create(pnamep);
-	NDINIT(, LOOKUP, NOFOLLOW, pb);
-	error = vn_open(, filemode, createmode);
+	error = vn_open(NULL, pb, 0, filemode, createmode, vpp, NULL, NULL);
 	if (error == 0) {
-		VOP_UNLOCK(nd.ni_vp, 0);
-		*vpp = nd.ni_vp;
+		VOP_UNLOCK(*vpp, 0);
 	}
 	pathbuf_destroy(pb);
 	return (error);

Index: src/share/man/man9/errno.9
diff -u src/share/man/man9/errno.9:1.5 

CVS commit: src/sys

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:40:06 UTC 2021

Modified Files:
src/sys/rump/include/rump: rump_namei.h
src/sys/sys: namei.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.114 -r1.115 src/sys/sys/namei.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/rump/include/rump/rump_namei.h
diff -u src/sys/rump/include/rump/rump_namei.h:1.47 src/sys/rump/include/rump/rump_namei.h:1.48
--- src/sys/rump/include/rump/rump_namei.h:1.47	Wed Jun 16 01:52:39 2021
+++ src/sys/rump/include/rump/rump_namei.h	Tue Jun 29 22:40:06 2021
@@ -1,11 +1,11 @@
-/*	$NetBSD: rump_namei.h,v 1.47 2021/06/16 01:52:39 dholland Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.48 2021/06/29 22:40:06 dholland Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.58 2020/05/30 20:16:14 ad Exp 
+ *   from: NetBSD: namei.src,v 1.60 2021/06/29 22:39:21 dholland Exp 
  */
 
 #ifndef _RUMP_RUMP_NAMEI_H_

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.114 src/sys/sys/namei.h:1.115
--- src/sys/sys/namei.h:1.114	Wed Jun 16 01:52:39 2021
+++ src/sys/sys/namei.h	Tue Jun 29 22:40:06 2021
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.114 2021/06/16 01:52:39 dholland Exp $	*/
+/*	$NetBSD: namei.h,v 1.115 2021/06/29 22:40:06 dholland Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.58 2020/05/30 20:16:14 ad Exp 
+ *   from: NetBSD: namei.src,v 1.60 2021/06/29 22:39:21 dholland Exp 
  */
 
 /*
@@ -102,7 +102,6 @@ struct componentname {
 	 */
 	const char 	*cn_nameptr;	/* pointer to looked up name */
 	size_t		cn_namelen;	/* length of looked up comp */
-	size_t		cn_consume;	/* chars to consume in lookup */
 };
 
 /*



CVS commit: src/sys

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:39:21 UTC 2021

Modified Files:
src/sys/fs/puffs: puffs_vnops.c
src/sys/fs/union: union_vnops.c
src/sys/fs/unionfs: unionfs_subr.c
src/sys/kern: vfs_getcwd.c vfs_lookup.c
src/sys/sys: namei.src

Log Message:
Now remove cn_consume from struct componentname.

This change requires a kernel bump.

Note though that I'm not going to version the VOP_LOOKUP args
structure (or any other args structure) as code that doesn't touch
cn_consume doesn't need attention and code that does will fail on it
without further intervention.


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/sys/fs/puffs/puffs_vnops.c
cvs rdiff -u -r1.76 -r1.77 src/sys/fs/union/union_vnops.c
cvs rdiff -u -r1.14 -r1.15 src/sys/fs/unionfs/unionfs_subr.c
cvs rdiff -u -r1.60 -r1.61 src/sys/kern/vfs_getcwd.c
cvs rdiff -u -r1.228 -r1.229 src/sys/kern/vfs_lookup.c
cvs rdiff -u -r1.59 -r1.60 src/sys/sys/namei.src

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

Modified files:

Index: src/sys/fs/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.218 src/sys/fs/puffs/puffs_vnops.c:1.219
--- src/sys/fs/puffs/puffs_vnops.c:1.218	Tue Jun 29 22:34:07 2021
+++ src/sys/fs/puffs/puffs_vnops.c	Tue Jun 29 22:39:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_vnops.c,v 1.218 2021/06/29 22:34:07 dholland Exp $	*/
+/*	$NetBSD: puffs_vnops.c,v 1.219 2021/06/29 22:39:20 dholland Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.218 2021/06/29 22:34:07 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.219 2021/06/29 22:39:20 dholland Exp $");
 
 #include 
 #include 
@@ -711,9 +711,10 @@ puffs_vnop_lookup(void *v)
 	/* XXX */
 	if ((lookup_msg->pvnr_cn.pkcn_flags & REQUIREDIR) == 0)
 		cnp->cn_flags &= ~REQUIREDIR;
-	if (lookup_msg->pvnr_cn.pkcn_consume)
-		cnp->cn_consume = MIN(lookup_msg->pvnr_cn.pkcn_consume,
-		strlen(cnp->cn_nameptr) - cnp->cn_namelen);
+	if (lookup_msg->pvnr_cn.pkcn_consume) {
+		printf("puffs: warning: ignoring cn_consume of %zu chars\n",
+		lookup_msg->pvnr_cn.pkcn_consume);
+	}
 
 	VPTOPP(vp)->pn_nlookup++;
 

Index: src/sys/fs/union/union_vnops.c
diff -u src/sys/fs/union/union_vnops.c:1.76 src/sys/fs/union/union_vnops.c:1.77
--- src/sys/fs/union/union_vnops.c:1.76	Tue Jun 29 22:38:46 2021
+++ src/sys/fs/union/union_vnops.c	Tue Jun 29 22:39:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vnops.c,v 1.76 2021/06/29 22:38:46 dholland Exp $	*/
+/*	$NetBSD: union_vnops.c,v 1.77 2021/06/29 22:39:20 dholland Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993, 1994, 1995
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.76 2021/06/29 22:38:46 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.77 2021/06/29 22:39:20 dholland Exp $");
 
 #include 
 #include 
@@ -358,12 +358,6 @@ start:
 	if (upperdvp != NULLVP) {
 		uerror = union_lookup1(um->um_uppervp, ,
 	, cnp);
-		if (cnp->cn_consume != 0) {
-			if (uppervp != upperdvp)
-VOP_UNLOCK(uppervp);
-			*ap->a_vpp = uppervp;
-			return (uerror);
-		}
 		if (uerror == ENOENT || uerror == EJUSTRETURN) {
 			if (cnp->cn_flags & ISWHITEOUT) {
 iswhiteout = 1;
@@ -415,18 +409,6 @@ start:
 
 		if (lowervp != lowerdvp)
 			VOP_UNLOCK(lowerdvp);
-
-		if (cnp->cn_consume != 0) {
-			if (uppervp != NULLVP) {
-if (uppervp == upperdvp)
-	vrele(uppervp);
-else
-	vput(uppervp);
-uppervp = NULLVP;
-			}
-			*ap->a_vpp = lowervp;
-			return (lerror);
-		}
 	} else {
 		lerror = ENOENT;
 		if ((cnp->cn_flags & ISDOTDOT) && dun->un_pvp != NULLVP) {

Index: src/sys/fs/unionfs/unionfs_subr.c
diff -u src/sys/fs/unionfs/unionfs_subr.c:1.14 src/sys/fs/unionfs/unionfs_subr.c:1.15
--- src/sys/fs/unionfs/unionfs_subr.c:1.14	Thu Jun  1 02:45:13 2017
+++ src/sys/fs/unionfs/unionfs_subr.c	Tue Jun 29 22:39:20 2021
@@ -317,7 +317,6 @@ unionfs_relookup(struct vnode *dvp, stru
 	cn->cn_cred = cnp->cn_cred;
 
 	cn->cn_nameptr = pnbuf;
-	cn->cn_consume = cnp->cn_consume;
 
 	if (nameiop == DELETE)
 		cn->cn_flags |= (cnp->cn_flags & DOWHITEOUT);
@@ -629,7 +628,6 @@ unionfs_vn_create_on_upper(struct vnode 
 	cn.cn_flags = (LOCKPARENT | LOCKLEAF | ISLASTCN);
 	cn.cn_cred = cred;
 	cn.cn_nameptr = pnbuf;
-	cn.cn_consume = 0;
 
 	vref(udvp);
 	if ((error = relookup(udvp, , , 0)) != 0)
@@ -860,7 +858,6 @@ unionfs_check_rmdir(struct vnode *vp, ka
 			cn.cn_nameiop = LOOKUP;
 			cn.cn_flags = (LOCKPARENT | LOCKLEAF | RDONLY | ISLASTCN);
 			cn.cn_cred = cred;
-			cn.cn_consume = 0;
 
 			/*
 			 * check entry in lower.

Index: src/sys/kern/vfs_getcwd.c
diff -u src/sys/kern/vfs_getcwd.c:1.60 src/sys/kern/vfs_getcwd.c:1.61
--- src/sys/kern/vfs_getcwd.c:1.60	Sat May 16 18:31:50 2020
+++ src/sys/kern/vfs_getcwd.c	Tue Jun 29 22:39:21 2021
@@ -1,4 

CVS commit: src/sys/fs

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:38:46 UTC 2021

Modified Files:
src/sys/fs/union: union_vnops.c
src/sys/fs/unionfs: unionfs_vnops.c

Log Message:
Onionfs needs to know about parsepath too, in case it has one of the
other cases underneath it.

The solution here is not really very good (take the longer
path-to-consume if they're different) but it will serve for the cases
that exist.

(If we were to add a fs that really uses different naming semantics,
we'd have to take additional steps; probably it doesn't make sense to
allow unionfs to union such a thing with a normal fs and attempting it
should fail at mount time.)

Update fs/unionfs as well to avoid increasing the current set of
compile failures there. Though maybe it's time to just remove
fs/unionfs.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/fs/union/union_vnops.c
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/unionfs/unionfs_vnops.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/fs/union/union_vnops.c
diff -u src/sys/fs/union/union_vnops.c:1.75 src/sys/fs/union/union_vnops.c:1.76
--- src/sys/fs/union/union_vnops.c:1.75	Tue Jun 29 22:34:07 2021
+++ src/sys/fs/union/union_vnops.c	Tue Jun 29 22:38:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vnops.c,v 1.75 2021/06/29 22:34:07 dholland Exp $	*/
+/*	$NetBSD: union_vnops.c,v 1.76 2021/06/29 22:38:46 dholland Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993, 1994, 1995
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.75 2021/06/29 22:34:07 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.76 2021/06/29 22:38:46 dholland Exp $");
 
 #include 
 #include 
@@ -93,6 +93,7 @@ __KERNEL_RCSID(0, "$NetBSD: union_vnops.
 #include 
 #include 
 
+int union_parsepath(void *);
 int union_lookup(void *);
 int union_create(void *);
 int union_whiteout(void *);
@@ -144,7 +145,7 @@ static int union_lookup1(struct vnode *,
 int (**union_vnodeop_p)(void *);
 const struct vnodeopv_entry_desc union_vnodeop_entries[] = {
 	{ _default_desc, vn_default_error },
-	{ _parsepath_desc, genfs_parsepath },	/* parsepath */
+	{ _parsepath_desc, union_parsepath },	/* parsepath */
 	{ _lookup_desc, union_lookup },		/* lookup */
 	{ _create_desc, union_create },		/* create */
 	{ _whiteout_desc, union_whiteout },		/* whiteout */
@@ -197,6 +198,40 @@ const struct vnodeopv_desc union_vnodeop
 	((vp)->v_type == VBLK || (vp)->v_type == VCHR || \
 	(vp)->v_type == VSOCK || (vp)->v_type == VFIFO)
 
+int
+union_parsepath(void *v)
+{
+	struct vop_parsepath_args /* {
+		struct vnode *a_dvp;
+		const char *a_name;
+		size_t *a_retval;
+	} */ *ap = v;
+	struct vnode *upperdvp, *lowerdvp;
+	size_t upper, lower;
+	int error;
+
+	upperdvp = UPPERVP(ap->a_dvp);
+	lowerdvp = LOWERVP(ap->a_dvp);
+
+	error = VOP_PARSEPATH(upperdvp, ap->a_name, );
+	if (error) {
+		return error;
+	}
+
+	error = VOP_PARSEPATH(lowerdvp, ap->a_name, );
+	if (error) {
+		return error;
+	}
+
+	/*
+	 * If they're different, use the larger one. This is not a
+	 * comprehensive solution, but it's sufficient for the
+	 * non-default cases of parsepath that currently exist.
+	 */
+	*ap->a_retval = MAX(upper, lower);
+	return 0;
+}
+
 static int
 union_lookup1(struct vnode *udvp, struct vnode **dvpp, struct vnode **vpp,
 	struct componentname *cnp)

Index: src/sys/fs/unionfs/unionfs_vnops.c
diff -u src/sys/fs/unionfs/unionfs_vnops.c:1.15 src/sys/fs/unionfs/unionfs_vnops.c:1.16
--- src/sys/fs/unionfs/unionfs_vnops.c:1.15	Tue Jun 29 22:34:08 2021
+++ src/sys/fs/unionfs/unionfs_vnops.c	Tue Jun 29 22:38:46 2021
@@ -65,6 +65,42 @@
 #endif
 
 static int
+unionfs_parsepath(void *v)
+{
+	struct vop_parsepath_args /* {
+		struct vnode *a_dvp;
+		const char *a_name;
+		size_t *a_retval;
+	} */ *ap = v;
+	struct unionfs_node *dunp;
+	struct vnode *upperdvp, *lowerdvp;
+	size_t upper, lower;
+	int error;
+
+	dunp = VTOUNIONFS(ap->a_dvp);
+	upperdvp = dunp->un_uppervp;
+	lowerdvp = dunp->un_lowervp;
+
+	error = VOP_PARSEPATH(upperdvp, ap->a_name, );
+	if (error) {
+		return error;
+	}
+
+	error = VOP_PARSEPATH(lowerdvp, ap->a_name, );
+	if (error) {
+		return error;
+	}
+
+	/*
+	 * If they're different, use the larger one. This is not a
+	 * comprehensive solution, but it's sufficient for the
+	 * non-default cases of parsepath that currently exist.
+	 */
+	*ap->a_retval = MAX(upper, lower);
+	return 0;
+}
+
+static int
 unionfs_lookup(void *v)
 {
 	struct vop_lookup_args *ap = v;
@@ -1814,7 +1850,7 @@ unionfs_revoke(void *v)
 int (**unionfs_vnodeop_p)(void *);
 const struct vnodeopv_entry_desc unionfs_vnodeop_entries[] = {
 	{ _default_desc, vn_default_error },
-	{ _parsepath_desc, genfs_parsepath },	/* parsepath */
+	{ _parsepath_desc, unionfs_parsepath },	/* parsepath */
 	{ _lookup_desc, unionfs_lookup },		/* lookup */
 	{ _create_desc, unionfs_create },		/* create */
 	{ 

CVS commit: src/sys/rump/librump/rumpvfs

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:38:10 UTC 2021

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
Add parsepath for rumpfs in place of using cn_consume.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/rump/librump/rumpvfs/rumpfs.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/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.163 src/sys/rump/librump/rumpvfs/rumpfs.c:1.164
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.163	Tue Jun 29 22:34:09 2021
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Tue Jun 29 22:38:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.163 2021/06/29 22:34:09 dholland Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.164 2021/06/29 22:38:10 dholland Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.163 2021/06/29 22:34:09 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.164 2021/06/29 22:38:10 dholland Exp $");
 
 #include 
 #include 
@@ -61,6 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1
 #include 
 #include 
 
+static int rump_vop_parsepath(void *);
 static int rump_vop_lookup(void *);
 static int rump_vop_getattr(void *);
 static int rump_vop_setattr(void *);
@@ -90,7 +91,7 @@ static int rump_vop_fcntl(void *);
 int (**rump_vnodeop_p)(void *);
 const struct vnodeopv_entry_desc rump_vnodeop_entries[] = {
 	{ _default_desc, vn_default_error },
-	{ _parsepath_desc, genfs_parsepath },
+	{ _parsepath_desc, rump_vop_parsepath },
 	{ _lookup_desc, rump_vop_lookup },
 	{ _getattr_desc, rump_vop_getattr },
 	{ _setattr_desc, rump_vop_setattr },
@@ -634,6 +635,33 @@ rumpfs_update(int flags, struct vnode *v
 }
 
 /*
+ * parsepath for rump file systems - check for etfs entries.
+ */
+static int
+rump_vop_parsepath(void *v)
+{
+	struct vop_parsepath_args /* {
+		struct vnode *a_dvp;
+		const char *a_name;
+		size_t *a_retval;
+	}; */ *ap = v;
+	struct etfs *et;
+	bool found;
+
+	/* check for etfs */
+	if (ap->a_dvp == rootvnode) {
+		mutex_enter(_lock);
+		found = etfs_find(ap->a_name, , false);
+		mutex_exit(_lock);
+		if (found) {
+			*ap->a_retval = et->et_keylen;
+			return 0;
+		}
+	}
+	return genfs_parsepath(v);
+}
+
+/*
  * Simple lookup for rump file systems.
  *
  * uhm, this is twisted.  C F C C, hope of C C F C looming
@@ -654,7 +682,6 @@ rump_vop_lookup(void *v)
 	struct etfs *et;
 	bool dotdot = (cnp->cn_flags & ISDOTDOT) != 0;
 	int rv = 0;
-	const char *cp;
 
 	*vpp = NULL;
 
@@ -687,19 +714,18 @@ rump_vop_lookup(void *v)
 		mutex_exit(_lock);
 
 		if (found) {
+			if (et->et_keylen != cnp->cn_namelen) {
+/*
+ * This can theoretically happen if an
+ * etfs entry is added or removed
+ * while lookups are being done as we
+ * don't hold etfs_lock across here
+ * and parsepath. Won't ordinarily be
+ * the case. No biggie, just retry.
+ */
+return ERESTART;
+			}
 			rn = et->et_rn;
-			cnp->cn_consume += et->et_keylen - cnp->cn_namelen;
-			/*
-			 * consume trailing slashes if any and clear
-			 * REQUIREDIR if we consumed the full path.
-			 */
-			cp = >cn_nameptr[cnp->cn_namelen];
-			cp += cnp->cn_consume;
-			KASSERT(*cp == '\0' || *cp == '/');
-			if (*cp == '\0' && rn->rn_va.va_type != VDIR)
-cnp->cn_flags &= ~REQUIREDIR;
-			while (*cp++ == '/')
-cnp->cn_consume++;
 			goto getvnode;
 		}
 	}



CVS commit: src/sys/fs/hfs

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:37:50 UTC 2021

Modified Files:
src/sys/fs/hfs: hfs_vnops.c

Log Message:
Implement VOP_PARSEPATH() for hfs.

This checks for a following "/rsrc" at the end of the pathname (to
indicate the resource fork of a file) and assimilates it into the
component name to be looked up. Then cn_namelen will already include
this text in lookup, and it's no longer necessary to muck with
cn_consume.

Invalid uses of "/rsrc" are ignored rather than rejected, which
appears to be the same as the old behavior. It is possible that the
parsepath logic should only consume the "/rsrc" if the name names a
file and not a directory, which would require looking it up in
parsepath and be a general nuisance; I hope not. It's also possible
that the whole thing doesn't work at all now, or it didn't before, as
I don't have any way to test it.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/fs/hfs/hfs_vnops.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/fs/hfs/hfs_vnops.c
diff -u src/sys/fs/hfs/hfs_vnops.c:1.37 src/sys/fs/hfs/hfs_vnops.c:1.38
--- src/sys/fs/hfs/hfs_vnops.c:1.37	Tue Jun 29 22:34:06 2021
+++ src/sys/fs/hfs/hfs_vnops.c	Tue Jun 29 22:37:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hfs_vnops.c,v 1.37 2021/06/29 22:34:06 dholland Exp $	*/
+/*	$NetBSD: hfs_vnops.c,v 1.38 2021/06/29 22:37:50 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.37 2021/06/29 22:34:06 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.38 2021/06/29 22:37:50 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -132,6 +132,7 @@ __KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,
 
 #include 
 
+int	hfs_vop_parsepath(void *);
 int	hfs_vop_lookup(void *);
 int	hfs_vop_open(void *);
 int	hfs_vop_close(void *);
@@ -331,6 +332,29 @@ const struct vnodeopv_desc hfs_fifoop_op
 	{ _fifoop_p, hfs_fifoop_entries };
 
 int
+hfs_vop_parsepath(void *v)
+{
+	struct vop_parsepath_args /* {
+		struct vnode *a_dvp;
+		const char *a_name;
+		size_t *a_retval;
+	} */ *ap = v;
+	size_t len;
+	int error;
+
+	error = genfs_parsepath(v);
+	if (error) {
+		return error;
+	}
+
+	len = *ap->a_retval;
+	if (!strcmp(ap->a_name + len, "/rsrc")) {
+		*ap->a_retval += 5;
+	}
+	return 0;
+}
+
+int
 hfs_vop_lookup(void *v)
 {
 	struct vop_lookup_v2_args /* {
@@ -346,6 +370,8 @@ hfs_vop_lookup(void *v)
 	struct vnode *vdp;		/* vnode for directory being searched */
 	hfs_catalog_key_t key;	/* hfs+ catalog search key for requested child */
 	hfs_catalog_keyed_record_t rec; /* catalog record of requested child */
+	size_t namelen;
+	int use_resource_fork = 0;
 	unichar_t* unicn;		/* name of component, in Unicode */
 	const char *pname;
 	int error;
@@ -420,12 +446,18 @@ hfs_vop_lookup(void *v)
 
 		hfslib_init_cbargs();
 
+		namelen = cnp->cn_namelen;
+		if (namelen > 5 &&
+		!strcmp(cnp->cn_nameptr + namelen - 5, "/rsrc")) {
+			namelen -= 5;
+			use_resource_fork = 1;
+		}
+
 		/* XXX: when decomposing, string could grow
 		   and we have to handle overflow */
-		unicn = malloc(cnp->cn_namelen * sizeof(unicn[0]),
-		M_TEMP, M_WAITOK);
-		len = utf8_to_utf16(unicn, cnp->cn_namelen,
-		cnp->cn_nameptr, cnp->cn_namelen, 0, NULL);
+		unicn = malloc(namelen * sizeof(unicn[0]), M_TEMP, M_WAITOK);
+		len = utf8_to_utf16(unicn, namelen,
+		cnp->cn_nameptr, namelen, 0, NULL);
 		for (ni = 0; ni < len; ni++)
 			if (unicn[ni] == (unichar_t)':')
 unicn[ni] = (unichar_t)'/';
@@ -462,13 +494,11 @@ hfs_vop_lookup(void *v)
 		}
 
 		if (rec.type == HFS_REC_FILE
-		&& strcmp(cnp->cn_nameptr+cnp->cn_namelen, "/rsrc") == 0
+		&& use_resource_fork
 		&& rec.file.rsrc_fork.logical_size > 0) {
-		/* advance namei next pointer to end of stirng */
-		cnp->cn_consume = 5;
-		cnp->cn_flags &= ~REQUIREDIR; /* XXX: needed? */
-		error = hfs_vget_internal(vdp->v_mount, rec.file.cnid,
-			HFS_RSRCFORK, );
+		/* advance namei next pointer to end of string */
+			error = hfs_vget_internal(vdp->v_mount, rec.file.cnid,
+			HFS_RSRCFORK, );
 		} else
 			error = hfs_vget_internal(vdp->v_mount, rec.file.cnid,
 			HFS_DATAFORK, );



CVS commit: src/sys

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:37:11 UTC 2021

Modified Files:
src/sys/kern: vnode_if.c
src/sys/rump/include/rump: rumpvnode_if.h
src/sys/rump/librump/rumpvfs: rumpvnode_if.c
src/sys/sys: vnode_if.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/kern/vnode_if.c
cvs rdiff -u -r1.34 -r1.35 src/sys/rump/include/rump/rumpvnode_if.h
cvs rdiff -u -r1.34 -r1.35 src/sys/rump/librump/rumpvfs/rumpvnode_if.c
cvs rdiff -u -r1.105 -r1.106 src/sys/sys/vnode_if.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/kern/vnode_if.c
diff -u src/sys/kern/vnode_if.c:1.112 src/sys/kern/vnode_if.c:1.113
--- src/sys/kern/vnode_if.c:1.112	Mon May 18 08:30:06 2020
+++ src/sys/kern/vnode_if.c	Tue Jun 29 22:37:11 2021
@@ -1,13 +1,13 @@
-/*	$NetBSD: vnode_if.c,v 1.112 2020/05/18 08:30:06 hannken Exp $	*/
+/*	$NetBSD: vnode_if.c,v 1.113 2021/06/29 22:37:11 dholland Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp
+ *	NetBSD: vnode_if.src,v 1.81 2021/06/29 22:34:08 dholland Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.69 2020/02/23 22:14:04 ad Exp
+ *	NetBSD: vnode_if.sh,v 1.70 2020/05/16 18:31:50 christos Exp
  */
 
 /*
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.112 2020/05/18 08:30:06 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.113 2021/06/29 22:37:11 dholland Exp $");
 
 #include 
 #include 
@@ -145,6 +145,40 @@ VOP_BWRITE(struct vnode *vp,
 	return error;
 }
 
+const int vop_parsepath_vp_offsets[] = {
+	VOPARG_OFFSETOF(struct vop_parsepath_args,a_dvp),
+	VDESC_NO_OFFSET
+};
+const struct vnodeop_desc vop_parsepath_desc = {
+	VOP_PARSEPATH_DESCOFFSET,
+	"vop_parsepath",
+	0,
+	vop_parsepath_vp_offsets,
+	VDESC_NO_OFFSET,
+	VDESC_NO_OFFSET,
+	VDESC_NO_OFFSET,
+};
+int
+VOP_PARSEPATH(struct vnode *dvp,
+const char *name,
+size_t *retval)
+{
+	int error;
+	bool mpsafe;
+	struct vop_parsepath_args a;
+	struct mount *mp;
+	a.a_desc = VDESC(vop_parsepath);
+	a.a_dvp = dvp;
+	a.a_name = name;
+	a.a_retval = retval;
+	error = vop_pre(dvp, , , FST_YES);
+	if (error)
+		return error;
+	error = (VCALL(dvp, VOFFSET(vop_parsepath), ));
+	vop_post(dvp, mp, mpsafe, FST_YES);
+	return error;
+}
+
 const int vop_lookup_vp_offsets[] = {
 	VOPARG_OFFSETOF(struct vop_lookup_v2_args,a_dvp),
 	VDESC_NO_OFFSET
@@ -2000,6 +2034,7 @@ const struct vnodeop_desc * const vfs_op
 	_default_desc,	/* MUST BE FIRST */
 
 	_bwrite_desc,
+	_parsepath_desc,
 	_lookup_desc,
 	_create_desc,
 	_mknod_desc,

Index: src/sys/rump/include/rump/rumpvnode_if.h
diff -u src/sys/rump/include/rump/rumpvnode_if.h:1.34 src/sys/rump/include/rump/rumpvnode_if.h:1.35
--- src/sys/rump/include/rump/rumpvnode_if.h:1.34	Sat May 16 18:31:52 2020
+++ src/sys/rump/include/rump/rumpvnode_if.h	Tue Jun 29 22:37:11 2021
@@ -1,13 +1,13 @@
-/*	$NetBSD: rumpvnode_if.h,v 1.34 2020/05/16 18:31:52 christos Exp $	*/
+/*	$NetBSD: rumpvnode_if.h,v 1.35 2021/06/29 22:37:11 dholland Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp
+ *	NetBSD: vnode_if.src,v 1.81 2021/06/29 22:34:08 dholland Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.69 2020/02/23 22:14:04 ad Exp
+ *	NetBSD: vnode_if.sh,v 1.70 2020/05/16 18:31:50 christos Exp
  */
 
 /*
@@ -55,6 +55,7 @@ struct acl;
 #endif
 
 int RUMP_VOP_BWRITE(struct vnode *, struct buf *);
+int RUMP_VOP_PARSEPATH(struct vnode *, const char *, size_t *);
 int RUMP_VOP_LOOKUP(struct vnode *, struct vnode **, struct componentname *);
 int RUMP_VOP_CREATE(struct vnode *, struct vnode **, struct componentname *, 
 struct vattr *);

Index: src/sys/rump/librump/rumpvfs/rumpvnode_if.c
diff -u src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.34 src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.35
--- src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.34	Sat May 16 18:31:53 2020
+++ src/sys/rump/librump/rumpvfs/rumpvnode_if.c	Tue Jun 29 22:37:11 2021
@@ -1,13 +1,13 @@
-/*	$NetBSD: rumpvnode_if.c,v 1.34 2020/05/16 18:31:53 christos Exp $	*/
+/*	$NetBSD: rumpvnode_if.c,v 1.35 2021/06/29 22:37:11 dholland Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp
+ *	NetBSD: vnode_if.src,v 1.81 2021/06/29 22:34:08 dholland Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.69 2020/02/23 22:14:04 ad Exp
+ *	NetBSD: vnode_if.sh,v 1.70 2020/05/16 18:31:50 christos Exp
  */
 
 /*
@@ -40,7 +40,7 @@
  */

CVS commit: src/sys

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:34:10 UTC 2021

Modified Files:
src/sys/coda: coda_vnops.c
src/sys/fs/adosfs: advnops.c
src/sys/fs/autofs: autofs_vnops.c
src/sys/fs/cd9660: cd9660_vnops.c
src/sys/fs/efs: efs_vnops.c
src/sys/fs/filecorefs: filecore_vnops.c
src/sys/fs/hfs: hfs_vnops.c
src/sys/fs/msdosfs: msdosfs_vnops.c
src/sys/fs/nilfs: nilfs_vnops.c
src/sys/fs/ntfs: ntfs_vnops.c
src/sys/fs/ptyfs: ptyfs_vnops.c
src/sys/fs/puffs: puffs_vnops.c
src/sys/fs/sysvbfs: sysvbfs.c
src/sys/fs/tmpfs: tmpfs_fifoops.c tmpfs_specops.c tmpfs_vnops.c
src/sys/fs/udf: udf_vnops.c
src/sys/fs/union: union_vnops.c
src/sys/fs/unionfs: unionfs_vnops.c
src/sys/fs/v7fs: v7fs_extern.c
src/sys/kern: vfs_lookup.c vnode_if.src
src/sys/miscfs/deadfs: dead_vnops.c
src/sys/miscfs/fdesc: fdesc_vnops.c
src/sys/miscfs/fifofs: fifo_vnops.c
src/sys/miscfs/genfs: genfs.h genfs_vnops.c
src/sys/miscfs/kernfs: kernfs_vnops.c
src/sys/miscfs/procfs: procfs_vnops.c
src/sys/miscfs/specfs: spec_vnops.c
src/sys/nfs: nfs_vnops.c
src/sys/rump/librump/rumpvfs: rumpfs.c
src/sys/ufs/chfs: chfs_vnops.c
src/sys/ufs/ext2fs: ext2fs_vnops.c
src/sys/ufs/ffs: ffs_vnops.c
src/sys/ufs/lfs: lfs_vnops.c
src/sys/ufs/mfs: mfs_vnops.c

Log Message:
- Add a new vnode op: VOP_PARSEPATH.
 - Move namei_getcomponent to genfs_vnops.c and call it genfs_parsepath.
 - Add a parsepath entry to every vnode ops table.

VOP_PARSEPATH takes a directory vnode to be searched and a complete
following path and chooses how much of that path to consume. To begin
with, all parsepath calls are genfs_parsepath, which locates the first
'/' as always.

Note that the call doesn't take the whole struct componentname, only
the string. The other bits of struct componentname should not be
needed and there's no reason to cause potential complications by
exposing them.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/coda/coda_vnops.c
cvs rdiff -u -r1.55 -r1.56 src/sys/fs/adosfs/advnops.c
cvs rdiff -u -r1.6 -r1.7 src/sys/fs/autofs/autofs_vnops.c
cvs rdiff -u -r1.58 -r1.59 src/sys/fs/cd9660/cd9660_vnops.c
cvs rdiff -u -r1.41 -r1.42 src/sys/fs/efs/efs_vnops.c
cvs rdiff -u -r1.47 -r1.48 src/sys/fs/filecorefs/filecore_vnops.c
cvs rdiff -u -r1.36 -r1.37 src/sys/fs/hfs/hfs_vnops.c
cvs rdiff -u -r1.104 -r1.105 src/sys/fs/msdosfs/msdosfs_vnops.c
cvs rdiff -u -r1.42 -r1.43 src/sys/fs/nilfs/nilfs_vnops.c
cvs rdiff -u -r1.65 -r1.66 src/sys/fs/ntfs/ntfs_vnops.c
cvs rdiff -u -r1.63 -r1.64 src/sys/fs/ptyfs/ptyfs_vnops.c
cvs rdiff -u -r1.217 -r1.218 src/sys/fs/puffs/puffs_vnops.c
cvs rdiff -u -r1.18 -r1.19 src/sys/fs/sysvbfs/sysvbfs.c
cvs rdiff -u -r1.12 -r1.13 src/sys/fs/tmpfs/tmpfs_fifoops.c
cvs rdiff -u -r1.13 -r1.14 src/sys/fs/tmpfs/tmpfs_specops.c
cvs rdiff -u -r1.145 -r1.146 src/sys/fs/tmpfs/tmpfs_vnops.c
cvs rdiff -u -r1.114 -r1.115 src/sys/fs/udf/udf_vnops.c
cvs rdiff -u -r1.74 -r1.75 src/sys/fs/union/union_vnops.c
cvs rdiff -u -r1.14 -r1.15 src/sys/fs/unionfs/unionfs_vnops.c
cvs rdiff -u -r1.7 -r1.8 src/sys/fs/v7fs/v7fs_extern.c
cvs rdiff -u -r1.227 -r1.228 src/sys/kern/vfs_lookup.c
cvs rdiff -u -r1.80 -r1.81 src/sys/kern/vnode_if.src
cvs rdiff -u -r1.63 -r1.64 src/sys/miscfs/deadfs/dead_vnops.c
cvs rdiff -u -r1.136 -r1.137 src/sys/miscfs/fdesc/fdesc_vnops.c
cvs rdiff -u -r1.82 -r1.83 src/sys/miscfs/fifofs/fifo_vnops.c
cvs rdiff -u -r1.36 -r1.37 src/sys/miscfs/genfs/genfs.h
cvs rdiff -u -r1.210 -r1.211 src/sys/miscfs/genfs/genfs_vnops.c
cvs rdiff -u -r1.167 -r1.168 src/sys/miscfs/kernfs/kernfs_vnops.c
cvs rdiff -u -r1.216 -r1.217 src/sys/miscfs/procfs/procfs_vnops.c
cvs rdiff -u -r1.181 -r1.182 src/sys/miscfs/specfs/spec_vnops.c
cvs rdiff -u -r1.317 -r1.318 src/sys/nfs/nfs_vnops.c
cvs rdiff -u -r1.162 -r1.163 src/sys/rump/librump/rumpvfs/rumpfs.c
cvs rdiff -u -r1.42 -r1.43 src/sys/ufs/chfs/chfs_vnops.c
cvs rdiff -u -r1.132 -r1.133 src/sys/ufs/ext2fs/ext2fs_vnops.c
cvs rdiff -u -r1.133 -r1.134 src/sys/ufs/ffs/ffs_vnops.c
cvs rdiff -u -r1.336 -r1.337 src/sys/ufs/lfs/lfs_vnops.c
cvs rdiff -u -r1.61 -r1.62 src/sys/ufs/mfs/mfs_vnops.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/coda/coda_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.114 src/sys/coda/coda_vnops.c:1.115
--- src/sys/coda/coda_vnops.c:1.114	Sat Nov 14 11:42:56 2020
+++ src/sys/coda/coda_vnops.c	Tue Jun 29 22:34:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.114 2020/11/14 11:42:56 hannken Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.115 2021/06/29 22:34:05 dholland Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.114 2020/11/14 11:42:56 hannken Exp $");
+__KERNEL_RCSID(0, 

CVS commit: src/sys/kern

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:29:59 UTC 2021

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

Log Message:
Adjust namei internals to be able to make an external call to parse
the pathname. (Basically, this means change the signature of
namei_getcomponent(), and thus lookup_parsepath(), to pass in the
directory vnode and to allow failures.)


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/kern/vfs_lookup.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/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.226 src/sys/kern/vfs_lookup.c:1.227
--- src/sys/kern/vfs_lookup.c:1.226	Wed Jun 16 01:51:57 2021
+++ src/sys/kern/vfs_lookup.c	Tue Jun 29 22:29:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.226 2021/06/16 01:51:57 dholland Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.227 2021/06/29 22:29:59 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.226 2021/06/16 01:51:57 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.227 2021/06/29 22:29:59 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -229,16 +229,19 @@ namei_hash(const char *name, const char 
  * Find the end of the first path component in NAME and return its
  * length.
  */
-static size_t
-namei_getcomponent(const char *name)
+static int
+namei_getcomponent(struct vnode *dvp, const char *name, size_t *ret)
 {
 	size_t pos;
 
+	(void)dvp;
+
 	pos = 0;
 	while (name[pos] != '\0' && name[pos] != '/') {
 		pos++;
 	}
-	return pos;
+	*ret = pos;
+	return 0;
 }
 
 
@@ -840,9 +843,10 @@ namei_follow(struct namei_state *state, 
  * Inspect the leading path component and update the state accordingly.
  */
 static int
-lookup_parsepath(struct namei_state *state)
+lookup_parsepath(struct namei_state *state, struct vnode *searchdir)
 {
 	const char *cp;			/* pointer into pathname argument */
+	int error;
 
 	struct componentname *cnp = state->cnp;
 	struct nameidata *ndp = state->ndp;
@@ -861,7 +865,11 @@ lookup_parsepath(struct namei_state *sta
 	 * is held.
 	 */
 	cnp->cn_consume = 0;
-	cnp->cn_namelen = namei_getcomponent(cnp->cn_nameptr);
+	error = namei_getcomponent(searchdir, cnp->cn_nameptr,
+   >cn_namelen);
+	if (error) {
+		return error;
+	}
 	cp = cnp->cn_nameptr + cnp->cn_namelen;
 	if (cnp->cn_namelen > KERNEL_NAME_MAX) {
 		return ENAMETOOLONG;
@@ -1325,7 +1333,7 @@ lookup_fastforward(struct namei_state *s
 		 */
 		KASSERT(cnp->cn_nameptr[0] != '/');
 		KASSERT(cnp->cn_nameptr[0] != '\0');
-		if ((error = lookup_parsepath(state)) != 0) {
+		if ((error = lookup_parsepath(state, searchdir)) != 0) {
 			break;
 		}
 
@@ -1500,9 +1508,13 @@ lookup_fastforward(struct namei_state *s
 			}
 			cnp->cn_nameptr = oldnameptr;
 			ndp->ni_pathlen = oldpathlen;
-			error = lookup_parsepath(state);
-			if (error == 0) {
+			if (searchdir == NULL) {
 error = EOPNOTSUPP;
+			} else {
+error = lookup_parsepath(state, searchdir);
+if (error == 0) {
+	error = EOPNOTSUPP;
+}
 			}
 		}
 	} else if (plock != NULL) {
@@ -2049,7 +2061,7 @@ lookup_for_nfsd(struct nameidata *ndp, s
 static int
 do_lookup_for_nfsd_index(struct namei_state *state)
 {
-	int error = 0;
+	int error;
 
 	struct componentname *cnp = state->cnp;
 	struct nameidata *ndp = state->ndp;
@@ -2068,7 +2080,12 @@ do_lookup_for_nfsd_index(struct namei_st
 	ndp->ni_dvp = NULL;
 
 	cnp->cn_consume = 0;
-	cnp->cn_namelen = namei_getcomponent(cnp->cn_nameptr);
+	error = namei_getcomponent(startdir, cnp->cn_nameptr,
+   >cn_namelen);
+	if (error) {
+		return error;
+	}
+
 	cp = cnp->cn_nameptr + cnp->cn_namelen;
 	KASSERT(cnp->cn_namelen <= KERNEL_NAME_MAX);
 	ndp->ni_pathlen -= cnp->cn_namelen;
@@ -2199,7 +2216,10 @@ relookup(struct vnode *dvp, struct vnode
 	if ((uint32_t)newhash != (uint32_t)cnp->cn_hash)
 		panic("relookup: bad hash");
 #endif
-	newlen = namei_getcomponent(cnp->cn_nameptr);
+	error = namei_getcomponent(dvp, cnp->cn_nameptr, );
+	if (error) {
+		panic("relookup: parsepath failed with error %d", error);
+	}
 	if (cnp->cn_namelen != newlen)
 		panic("relookup: bad len");
 	cp = cnp->cn_nameptr + cnp->cn_namelen;



CVS commit: src

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 21:33:09 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile lex_char_uchar.c
src/usr.bin/xlint/common: inittyp.c
Removed Files:
src/tests/usr.bin/xlint/lint1: lex_char_uchar.exp

Log Message:
lint: fix wrong warning about out-of-range value '\xff' for char

This only affects platforms where char has the same representation as
unsigned char.


To generate a diff of this commit:
cvs rdiff -u -r1.1069 -r1.1070 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.71 -r1.72 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/lex_char_uchar.c
cvs rdiff -u -r1.2 -r0 src/tests/usr.bin/xlint/lint1/lex_char_uchar.exp
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/inittyp.c

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1069 src/distrib/sets/lists/tests/mi:1.1070
--- src/distrib/sets/lists/tests/mi:1.1069	Tue Jun 29 13:58:13 2021
+++ src/distrib/sets/lists/tests/mi	Tue Jun 29 21:33:08 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1069 2021/06/29 13:58:13 rillig Exp $
+# $NetBSD: mi,v 1.1070 2021/06/29 21:33:08 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6205,7 +6205,7 @@
 ./usr/tests/usr.bin/xlint/lint1/emit.ctests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/emit.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/emit.exp-ln			tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/xlint/lint1/emit.lnobsolete		obsolete
+./usr/tests/usr.bin/xlint/lint1/emit.lntests-obsolete		obsolete
 ./usr/tests/usr.bin/xlint/lint1/expr_range.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/expr_range.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/feat_stacktrace.c		tests-usr.bin-tests	compattestfile,atf
@@ -6223,7 +6223,7 @@
 ./usr/tests/usr.bin/xlint/lint1/lex_char.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_char.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_char_uchar.c		tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/xlint/lint1/lex_char_uchar.exp		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/lex_char_uchar.exp		tests-obsolete		obsolete
 ./usr/tests/usr.bin/xlint/lint1/lex_comment.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_comment.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_floating.c			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.71 src/tests/usr.bin/xlint/lint1/Makefile:1.72
--- src/tests/usr.bin/xlint/lint1/Makefile:1.71	Tue Jun 29 13:58:13 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Tue Jun 29 21:33:09 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.71 2021/06/29 13:58:13 rillig Exp $
+# $NetBSD: Makefile,v 1.72 2021/06/29 21:33:09 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -126,7 +126,6 @@ FILES+=		gcc_typeof_after_statement.exp
 FILES+=		lex_char.c
 FILES+=		lex_char.exp
 FILES+=		lex_char_uchar.c
-FILES+=		lex_char_uchar.exp
 FILES+=		lex_comment.c
 FILES+=		lex_comment.exp
 FILES+=		lex_floating.c

Index: src/tests/usr.bin/xlint/lint1/lex_char_uchar.c
diff -u src/tests/usr.bin/xlint/lint1/lex_char_uchar.c:1.2 src/tests/usr.bin/xlint/lint1/lex_char_uchar.c:1.3
--- src/tests/usr.bin/xlint/lint1/lex_char_uchar.c:1.2	Tue Jun 29 14:19:51 2021
+++ src/tests/usr.bin/xlint/lint1/lex_char_uchar.c	Tue Jun 29 21:33:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex_char_uchar.c,v 1.2 2021/06/29 14:19:51 rillig Exp $	*/
+/*	$NetBSD: lex_char_uchar.c,v 1.3 2021/06/29 21:33:09 rillig Exp $	*/
 # 3 "lex_char_uchar.c"
 
 /*
@@ -9,9 +9,11 @@
 /* lint1-only-if uchar */
 
 /*
- * FIXME: The warning is bogus; it must be possible to initialize a char
- *  variable with a character constant.
- * See tree.c, function convert_constant.
+ * Before inittyp.c 1.23 from 2021-06-29, the following initialization
+ * triggered a wrong warning "conversion of 'int' to 'char' is out of range",
+ * but only on platforms where char has the same representation as unsigned
+ * char.  There are only few of these platforms, which allowed this bug to
+ * survive for almost 26 years, since the initial commit of lint on
+ * 1995-07-03.
  */
-/* expect+1: conversion of 'int' to 'char' is out of range [119] */
 char ch = '\xff';

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.22 src/usr.bin/xlint/common/inittyp.c:1.23
--- src/usr.bin/xlint/common/inittyp.c:1.22	Sat Mar 27 11:08:00 2021
+++ 

CVS commit: src/sys/net

2021-06-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 29 21:19:58 UTC 2021

Modified Files:
src/sys/net: if.c if.h if_stats.c if_stats.h

Log Message:
Make if_stats_init, if_attach, if_initialize return void.

percpu_alloc can't fail.

Author: Maya Rashish 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.485 -r1.486 src/sys/net/if.c
cvs rdiff -u -r1.290 -r1.291 src/sys/net/if.h
cvs rdiff -u -r1.3 -r1.4 src/sys/net/if_stats.c
cvs rdiff -u -r1.2 -r1.3 src/sys/net/if_stats.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/net/if.c
diff -u src/sys/net/if.c:1.485 src/sys/net/if.c:1.486
--- src/sys/net/if.c:1.485	Mon May 17 04:07:43 2021
+++ src/sys/net/if.c	Tue Jun 29 21:19:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.485 2021/05/17 04:07:43 yamaguchi Exp $	*/
+/*	$NetBSD: if.c,v 1.486 2021/06/29 21:19:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.485 2021/05/17 04:07:43 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.486 2021/06/29 21:19:58 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -702,10 +702,9 @@ skip:
  * ether_ifattach(ifp, enaddr);
  * if_register(ifp);
  */
-int
+void
 if_initialize(ifnet_t *ifp)
 {
-	int rv = 0;
 
 	KASSERT(if_indexlim > 0);
 	TAILQ_INIT(>if_addrlist);
@@ -748,25 +747,11 @@ if_initialize(ifnet_t *ifp)
 	psref_target_init(>if_psref, ifnet_psref_class);
 	ifp->if_ioctl_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
 	LIST_INIT(>if_multiaddrs);
-	if ((rv = if_stats_init(ifp)) != 0) {
-		goto fail;
-	}
+	if_stats_init(ifp);
 
 	IFNET_GLOBAL_LOCK();
 	if_getindex(ifp);
 	IFNET_GLOBAL_UNLOCK();
-
-	return 0;
-
-fail:
-	IF_AFDATA_LOCK_DESTROY(ifp);
-
-	pfil_run_ifhooks(if_pfil, PFIL_IFNET_DETACH, ifp);
-	(void)pfil_head_destroy(ifp->if_pfil);
-
-	IFQ_LOCK_DESTROY(>if_snd);
-
-	return rv;
 }
 
 /*
@@ -1142,19 +1127,13 @@ if_input(struct ifnet *ifp, struct mbuf 
  * migrate softint-based if_input without much changes. If you don't
  * want to enable it, use if_initialize instead.
  */
-int
+void
 if_attach(ifnet_t *ifp)
 {
-	int rv;
-
-	rv = if_initialize(ifp);
-	if (rv != 0)
-		return rv;
 
+	if_initialize(ifp);
 	ifp->if_percpuq = if_percpuq_create(ifp);
 	if_register(ifp);
-
-	return 0;
 }
 
 void

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.290 src/sys/net/if.h:1.291
--- src/sys/net/if.h:1.290	Mon May 17 04:07:43 2021
+++ src/sys/net/if.h	Tue Jun 29 21:19:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.290 2021/05/17 04:07:43 yamaguchi Exp $	*/
+/*	$NetBSD: if.h,v 1.291 2021/06/29 21:19:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -1115,9 +1115,9 @@ void if_activate_sadl(struct ifnet *, st
 void	if_set_sadl(struct ifnet *, const void *, u_char, bool);
 void	if_alloc_sadl(struct ifnet *);
 void	if_free_sadl(struct ifnet *, int);
-int	if_initialize(struct ifnet *);
+void	if_initialize(struct ifnet *);
 void	if_register(struct ifnet *);
-int	if_attach(struct ifnet *); /* Deprecated. Use if_initialize and if_register */
+void	if_attach(struct ifnet *); /* Deprecated. Use if_initialize and if_register */
 void	if_attachdomain(void);
 void	if_deactivate(struct ifnet *);
 bool	if_is_deactivated(const struct ifnet *);

Index: src/sys/net/if_stats.c
diff -u src/sys/net/if_stats.c:1.3 src/sys/net/if_stats.c:1.4
--- src/sys/net/if_stats.c:1.3	Fri Feb 14 22:04:12 2020
+++ src/sys/net/if_stats.c	Tue Jun 29 21:19:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stats.c,v 1.3 2020/02/14 22:04:12 thorpej Exp $	*/
+/*	$NetBSD: if_stats.c,v 1.4 2021/06/29 21:19:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_stats.c,v 1.3 2020/02/14 22:04:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_stats.c,v 1.4 2021/06/29 21:19:58 riastradh Exp $");
 
 #include 
 #include 
@@ -45,13 +45,10 @@ __KERNEL_RCSID(0, "$NetBSD: if_stats.c,v
  * if_stats_init --
  *	Initialize statistics storage for a network interface.
  */
-int
+void
 if_stats_init(ifnet_t * const ifp)
 {
 	ifp->if_stats = percpu_alloc(IF_STATS_SIZE);
-	if (ifp->if_stats == NULL)
-		return ENOMEM;
-	return 0;
 }
 
 /*

Index: src/sys/net/if_stats.h
diff -u src/sys/net/if_stats.h:1.2 src/sys/net/if_stats.h:1.3
--- src/sys/net/if_stats.h:1.2	Fri Feb 14 22:04:12 2020
+++ src/sys/net/if_stats.h	Tue Jun 29 21:19:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stats.h,v 1.2 2020/02/14 22:04:12 thorpej Exp $	*/
+/*	$NetBSD: if_stats.h,v 1.3 2021/06/29 21:19:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -115,7 +115,7 @@ if_statsub_ref(net_stat_ref_t nsr, if_st
 	_NET_STATSUB_REF(nsr, x, v);
 }
 
-int	if_stats_init(ifnet_t *);
+void	if_stats_init(ifnet_t *);
 void	

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

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 21:16:54 UTC 2021

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

Log Message:
lint: rename xsign to convert_integer

The term sign-extend was too specific, the function actually does a
broader conversion.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.297 -r1.298 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.113 src/usr.bin/xlint/lint1/externs1.h:1.114
--- src/usr.bin/xlint/lint1/externs1.h:1.113	Mon Jun 28 08:52:55 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Tue Jun 29 21:16:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.113 2021/06/28 08:52:55 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.114 2021/06/29 21:16:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -78,7 +78,7 @@ extern	FILE	*yyin;
 
 extern	void	initscan(void);
 extern	int	msb(int64_t, tspec_t, int);
-extern	int64_t	xsign(int64_t, tspec_t, int);
+extern	int64_t	convert_integer(int64_t, tspec_t, int);
 extern	void	clear_warn_flags(void);
 extern	sym_t	*getsym(sbuf_t *);
 extern	void	cleanup(void);

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.48 src/usr.bin/xlint/lint1/lex.c:1.49
--- src/usr.bin/xlint/lint1/lex.c:1.48	Tue Jun 29 13:48:24 2021
+++ src/usr.bin/xlint/lint1/lex.c	Tue Jun 29 21:16:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.48 2021/06/29 13:48:24 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.49 2021/06/29 21:16:54 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.48 2021/06/29 13:48:24 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.49 2021/06/29 21:16:54 rillig Exp $");
 #endif
 
 #include 
@@ -668,7 +668,7 @@ lex_integer_constant(const char *yytext,
 		break;
 	}
 
-	uq = (uint64_t)xsign((int64_t)uq, typ, -1);
+	uq = (uint64_t)convert_integer((int64_t)uq, typ, -1);
 
 	yylval.y_val = xcalloc(1, sizeof(*yylval.y_val));
 	yylval.y_val->v_tspec = typ;
@@ -703,10 +703,10 @@ msb(int64_t q, tspec_t t, int len)
 }
 
 /*
- * Extends the sign of q.
+ * Extend or truncate q to match t.  If t is signed, sign-extend.
  */
 int64_t
-xsign(int64_t q, tspec_t t, int len)
+convert_integer(int64_t q, tspec_t t, int len)
 {
 	uint64_t vbits;
 

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.297 src/usr.bin/xlint/lint1/tree.c:1.298
--- src/usr.bin/xlint/lint1/tree.c:1.297	Tue Jun 29 20:44:38 2021
+++ src/usr.bin/xlint/lint1/tree.c	Tue Jun 29 21:16:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.297 2021/06/29 20:44:38 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.298 2021/06/29 21:16:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.297 2021/06/29 20:44:38 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.298 2021/06/29 21:16:54 rillig Exp $");
 #endif
 
 #include 
@@ -2402,13 +2402,8 @@ convert_constant(op_t op, int arg, const
 	}
 
 	if (is_integer(nt)) {
-		/*
-		 * FIXME: There must be no sign extension when converting
-		 *  from int to char on a platform where char == unsigned
-		 *  char.  See test lex_char_uchar.c.
-		 */
 		sz = tp->t_bitfield ? tp->t_flen : size_in_bits(nt);
-		nv->v_quad = xsign(nv->v_quad, nt, sz);
+		nv->v_quad = convert_integer(nv->v_quad, nt, sz);
 	}
 
 	if (range_check && op != CVT)
@@ -3027,7 +3022,7 @@ fold(tnode_t *tn)
 		 * shifts of signed values are implementation dependent.
 		 */
 		q = ul >> sr;
-		q = xsign(q, t, size_in_bits(t) - (int)sr);
+		q = convert_integer(q, t, size_in_bits(t) - (int)sr);
 		break;
 	case LT:
 		q = (utyp ? ul < ur : sl < sr) ? 1 : 0;
@@ -3068,7 +3063,7 @@ fold(tnode_t *tn)
 			warning(141, op_name(tn->tn_op));
 	}
 
-	v->v_quad = xsign(q, t, -1);
+	v->v_quad = convert_integer(q, t, -1);
 
 	cn = expr_new_constant(tn->tn_type, v);
 	if (tn->tn_left->tn_system_dependent)



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

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 21:05:32 UTC 2021

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

Log Message:
lint: do not modify tnode_t->tn_type in check_init_expr

This is a very small step towards having all shared type_t objects only
referenced via const pointers.  Since the types may be shared, it is a
bad idea to try to modify them, so better let the compiler check this.
It's a long way to reach this goal, but this small step is already
possible.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.199 src/usr.bin/xlint/lint1/init.c:1.200
--- src/usr.bin/xlint/lint1/init.c:1.199	Sat Jun 19 15:23:57 2021
+++ src/usr.bin/xlint/lint1/init.c	Tue Jun 29 21:05:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.199 2021/06/19 15:23:57 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.200 2021/06/29 21:05:32 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.199 2021/06/19 15:23:57 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.200 2021/06/29 21:05:32 rillig Exp $");
 #endif
 
 #include 
@@ -381,14 +381,17 @@ static void
 check_init_expr(const type_t *tp, sym_t *sym, tnode_t *tn)
 {
 	tnode_t *ln;
+	type_t *ltp;
 	tspec_t lt, rt;
 	struct memory_block *tmem;
 
+	ltp = expr_dup_type(tp);
+	ltp->t_const = false;
+
 	/* Create a temporary node for the left side. */
 	ln = expr_zalloc(sizeof(*ln));
 	ln->tn_op = NAME;
-	ln->tn_type = expr_dup_type(tp);
-	ln->tn_type->t_const = false;
+	ln->tn_type = ltp;
 	ln->tn_lvalue = true;
 	ln->tn_sym = sym;
 



CVS commit: src/sys/dev

2021-06-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jun 29 21:04:04 UTC 2021

Modified Files:
src/sys/dev/hdaudio: hdaudiodevs.h hdaudiodevs_data.h
src/sys/dev/mii: miidevs.h miidevs_data.h
src/sys/dev/pci: pcidevs.h pcidevs_data.h
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Regen for new sys/dev/devlist2h.awk


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hdaudio/hdaudiodevs.h \
src/sys/dev/hdaudio/hdaudiodevs_data.h
cvs rdiff -u -r1.165 -r1.166 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.154 -r1.155 src/sys/dev/mii/miidevs_data.h
cvs rdiff -u -r1.1412 -r1.1413 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1411 -r1.1412 src/sys/dev/pci/pcidevs_data.h
cvs rdiff -u -r1.783 -r1.784 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/hdaudio/hdaudiodevs.h
diff -u src/sys/dev/hdaudio/hdaudiodevs.h:1.5 src/sys/dev/hdaudio/hdaudiodevs.h:1.6
--- src/sys/dev/hdaudio/hdaudiodevs.h:1.5	Wed Apr 29 07:36:22 2020
+++ src/sys/dev/hdaudio/hdaudiodevs.h	Tue Jun 29 21:04:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hdaudiodevs.h,v 1.5 2020/04/29 07:36:22 nia Exp $	*/
+/*	$NetBSD: hdaudiodevs.h,v 1.6 2021/06/29 21:04:02 pgoyette Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -259,3 +259,7 @@
 
 /* VMware */
 #define	HDAUDIO_PRODUCT_VMWARE_VIRTUAL_HDA	0x1975		/* Virtual HDA */
+
+/* Define format strings for non-existent values */
+#define hdaudio_id1_format	"vendor %4.4x"
+#define hdaudio_id2_format	"product %4.4x"
Index: src/sys/dev/hdaudio/hdaudiodevs_data.h
diff -u src/sys/dev/hdaudio/hdaudiodevs_data.h:1.5 src/sys/dev/hdaudio/hdaudiodevs_data.h:1.6
--- src/sys/dev/hdaudio/hdaudiodevs_data.h:1.5	Wed Apr 29 07:36:22 2020
+++ src/sys/dev/hdaudio/hdaudiodevs_data.h	Tue Jun 29 21:04:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hdaudiodevs_data.h,v 1.5 2020/04/29 07:36:22 nia Exp $	*/
+/*	$NetBSD: hdaudiodevs_data.h,v 1.6 2021/06/29 21:04:02 pgoyette Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -35,7 +35,7 @@
  * SUCH DAMAGE.
  */
 
-static const uint16_t hdaudio_vendors[] = {
+static const uint32_t hdaudio_vendors[] = {
 	HDAUDIO_VENDOR_ATI, 1, 0,
 	HDAUDIO_VENDOR_NVIDIA, 5, 0,
 	HDAUDIO_VENDOR_REALTEK, 12, 0,
@@ -49,7 +49,7 @@ static const uint16_t hdaudio_vendors[] 
 	HDAUDIO_VENDOR_SIGMATEL, 24, 0,
 };
 
-static const uint16_t hdaudio_products[] = {
+static const uint32_t hdaudio_products[] = {
 	HDAUDIO_VENDOR_ATI, HDAUDIO_PRODUCT_ATI_RS600_HDMI_1, 
 	78, 84, 0,
 	HDAUDIO_VENDOR_ATI, HDAUDIO_PRODUCT_ATI_RS600_HDMI_2, 

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.165 src/sys/dev/mii/miidevs.h:1.166
--- src/sys/dev/mii/miidevs.h:1.165	Tue Jun 23 14:35:59 2020
+++ src/sys/dev/mii/miidevs.h	Tue Jun 29 21:04:02 2021
@@ -1,7 +1,7 @@
-/*	$NetBSD: miidevs.h,v 1.165 2020/06/23 14:35:59 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.166 2021/06/29 21:04:02 pgoyette Exp $	*/
 
 /*
- * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
+ * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
  *	NetBSD: miidevs,v 1.168 2020/06/23 14:35:36 msaitoh Exp
@@ -56,76 +56,76 @@
  * Use "make -f Makefile.miidevs" to regenerate miidevs.h and miidevs_data.h
  */
 
-#define	MII_OUI_AMD	0x1a	/* Advanced Micro Devices */
-#define	MII_OUI_TRIDIUM	0x0001f0	/* Tridium */
-#define	MII_OUI_DATATRACK	0x0002c6	/* Data Track Technology */
-#define	MII_OUI_AGERE	0x00053d	/* Agere */
-#define	MII_OUI_QUAKE	0x000897	/* Quake Technologies */
-#define	MII_OUI_BANKSPEED	0x0006b8	/* Bankspeed Pty */
-#define	MII_OUI_NETEXCELL	0x0008bb	/* NetExcell */
-#define	MII_OUI_NETAS	0x0009c3	/* Netas */
-#define	MII_OUI_BROADCOM2	0x000af7	/* Broadcom Corporation */
-#define	MII_OUI_AELUROS	0x000b25	/* Aeluros */
-#define	MII_OUI_RALINK	0x000c43	/* Ralink Technology */
-#define	MII_OUI_ASIX	0x000ec6	/* ASIX */
-#define	MII_OUI_BROADCOM	0x001018	/* Broadcom Corporation */
-#define	MII_OUI_MICREL	0x0010a1	/* Micrel */
-#define	MII_OUI_ALTIMA	0x0010a9	/* Altima Communications */
-#define	MII_OUI_ENABLESEMI	0x0010dd	/* Enable Semiconductor */
-#define	MII_OUI_SUNPLUS	0x001105	/* Sunplus Technology */
-#define	MII_OUI_TERANETICS	0x0014a6	/* Teranetics */
-#define	MII_OUI_RALINK2	0x0017a5	/* Ralink Technology */
-#define	MII_OUI_AQUANTIA	0x0017b6	/* Aquantia Corporation */
-#define	MII_OUI_BROADCOM3	0x001be9	/* Broadcom Corporation */
-#define	MII_OUI_LEVEL1	0x00207b	/* Level 1 */
-#define	MII_OUI_MARVELL	0x005043	/* Marvell Semiconductor */
-#define	MII_OUI_QUALSEMI	0x006051	/* Quality Semiconductor */
-#define	MII_OUI_AMLOGIC	0x006051	/* Amlogic */
-#define	MII_OUI_DAVICOM	0x00606e	/* Davicom Semiconductor */
-#define	MII_OUI_SMSC	0x00800f	/* SMSC */
-#define	MII_OUI_SEEQ	0x00a07d	/* Seeq */
-#define	MII_OUI_ICS	0x00a0be	

CVS commit: src

2021-06-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jun 29 21:03:37 UTC 2021

Modified Files:
src/lib/libpci: Makefile
src/sys/arch/arm/amlogic: gxlphy.c
src/sys/dev: dev_verbose.c dev_verbose.h devlist2h.awk
src/sys/dev/hdaudio: hdaudio.c
src/sys/dev/mii: Makefile.miidevs gentbi.c mii_physubr.c mii_verbose.c
mii_verbose.h miivar.h ukphy.c
src/sys/dev/pci: pci_subr.c
src/sys/dev/pci/ixgbe: ixgbe.c
src/sys/rump/librump/rumpdev: Makefile.rumpdev
src/sys/sys: param.h
Removed Files:
src/sys/dev/mii: devlist2h.awk

Log Message:
Rework the xxxVERBOSE option to share the common module-hook-based
verbose mechanism with MIIVERBOSE.  This reduces some duplicated code
and allows us to once again permit auto-unload of MIIVERBOSE.

Change details:
* Update dev/devlist2h.awk to accomodate miidevs, including generation
  of MII_STR_oui_model definitions and use of oui and model rather than
  vendor and product.  This also changes the compressed data in the
  xxxdevs_data.h files to uint32_t (since mii oui's are up to 6 hex
  digits long)
* Update a couple of phy drivers to use new calls to get verbose data
* Regen all of the xxxdevs{,_data}.h files (separate commit, coming
  very soon)
* Update mii/mii_verbose.[ch] and mii/mii_physubr.c to use the various
  DEV_VERBOSE_xxx macros
* Update the pci, usb, and hdaudio code as needed, to #include the
  xxxdevs.h files (in order to get the proper printf format strings)
* Since dev/dev_verbose.c now uses non-literal printf format strings,
  (to deal with the vendor/product vs oui/model issue), we need to
  make sure it gets compiled with -Wno-error=format-nonliteral, even
  in userland's libpci and librumpdev!
* Bump kernel version for the change in module interfaces

Welcome to 9.99.86!

XXX It might be useful in the future to extend the MII_STR_oui_model
XXX definitions to PCI as well (and perhaps USB and HDAUDIO).  This
XXX would allow for a single centralized location for the products'
XXX descriptions, rather than being dispersed among individual
XXX drivers' xxx_match tables.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libpci/Makefile
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/amlogic/gxlphy.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/dev_verbose.c src/sys/dev/devlist2h.awk
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dev_verbose.h
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/hdaudio/hdaudio.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/mii/Makefile.miidevs
cvs rdiff -u -r1.11 -r0 src/sys/dev/mii/devlist2h.awk
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/mii/gentbi.c
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/mii/mii_verbose.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/mii/mii_verbose.h
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/mii/miivar.h
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/mii/ukphy.c
cvs rdiff -u -r1.225 -r1.226 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.284 -r1.285 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.13 -r1.14 src/sys/rump/librump/rumpdev/Makefile.rumpdev
cvs rdiff -u -r1.696 -r1.697 src/sys/sys/param.h

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

Modified files:

Index: src/lib/libpci/Makefile
diff -u src/lib/libpci/Makefile:1.5 src/lib/libpci/Makefile:1.6
--- src/lib/libpci/Makefile:1.5	Sun Sep 21 14:32:37 2014
+++ src/lib/libpci/Makefile	Tue Jun 29 21:03:36 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2014/09/21 14:32:37 christos Exp $
+#	$NetBSD: Makefile,v 1.6 2021/06/29 21:03:36 pgoyette Exp $
 
 .include 
 
@@ -10,6 +10,8 @@ SYSDIR= ${NETBSDSRCDIR}/sys/
 .PATH.c: ${SYSDIR}/dev/pci ${SYSDIR}/dev
 CPPFLAGS+= -I${SYSDIR}
 
+COPTS.dev_verbose.c+= -Wno-error=format-nonliteral
+
 MAN=	pci.3
 
 MLINKS=	pci.3 pcibus_conf_read.3 \

Index: src/sys/arch/arm/amlogic/gxlphy.c
diff -u src/sys/arch/arm/amlogic/gxlphy.c:1.4 src/sys/arch/arm/amlogic/gxlphy.c:1.5
--- src/sys/arch/arm/amlogic/gxlphy.c:1.4	Sat Mar 28 18:37:18 2020
+++ src/sys/arch/arm/amlogic/gxlphy.c	Tue Jun 29 21:03:36 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gxlphy.c,v 1.4 2020/03/28 18:37:18 thorpej Exp $ */
+/* $NetBSD: gxlphy.c,v 1.5 2021/06/29 21:03:36 pgoyette Exp $ */
 
 /*
  * Copyright (c) 2019 Jared McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gxlphy.c,v 1.4 2020/03/28 18:37:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gxlphy.c,v 1.5 2021/06/29 21:03:36 pgoyette Exp $");
 
 #include 
 #include 
@@ -148,9 +148,10 @@ gxlphyattach(device_t parent, device_t s
 	int oui = MII_OUI(ma->mii_id1, ma->mii_id2);
 	int model = MII_MODEL(ma->mii_id2);
 	int rev = MII_REV(ma->mii_id2);
-	const char *descr;
+	char descr[MII_MAX_DESCR_LEN];
 
-	if ((descr = mii_get_descr(oui, model)) != NULL)
+	mii_get_descr(descr, sizeof(descr), oui, model);
+	if (descr[0])
 		aprint_normal(": %s (OUI 0x%06x, model 0x%04x), rev. %d\n",
 		   descr, oui, model, rev);
 	else

Index: 

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

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 20:44:38 UTC 2021

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

Log Message:
lint: do not sign-extend pointers

Sign extension only makes sense for integer types.

No idea why the code had tried to sign-extend pointers for the past 26
years.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.296 src/usr.bin/xlint/lint1/tree.c:1.297
--- src/usr.bin/xlint/lint1/tree.c:1.296	Tue Jun 29 14:19:51 2021
+++ src/usr.bin/xlint/lint1/tree.c	Tue Jun 29 20:44:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.296 2021/06/29 14:19:51 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.297 2021/06/29 20:44:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.296 2021/06/29 14:19:51 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.297 2021/06/29 20:44:38 rillig Exp $");
 #endif
 
 #include 
@@ -2401,15 +2401,7 @@ convert_constant(op_t op, int arg, const
 		v->v_unsigned_since_c90 = false;
 	}
 
-	switch (nt) {
-	case FLOAT:
-	case FCOMPLEX:
-	case DOUBLE:
-	case DCOMPLEX:
-	case LDOUBLE:
-	case LCOMPLEX:
-		break;
-	default:
+	if (is_integer(nt)) {
 		/*
 		 * FIXME: There must be no sign extension when converting
 		 *  from int to char on a platform where char == unsigned
@@ -2417,7 +2409,6 @@ convert_constant(op_t op, int arg, const
 		 */
 		sz = tp->t_bitfield ? tp->t_flen : size_in_bits(nt);
 		nv->v_quad = xsign(nv->v_quad, nt, sz);
-		break;
 	}
 
 	if (range_check && op != CVT)



CVS commit: src

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 14:19:51 UTC 2021

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

Log Message:
lint: document where to fix the wrong warning for '\xff'


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/lex_char_uchar.c \
src/tests/usr.bin/xlint/lint1/lex_char_uchar.exp
cvs rdiff -u -r1.295 -r1.296 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/lex_char_uchar.c
diff -u src/tests/usr.bin/xlint/lint1/lex_char_uchar.c:1.1 src/tests/usr.bin/xlint/lint1/lex_char_uchar.c:1.2
--- src/tests/usr.bin/xlint/lint1/lex_char_uchar.c:1.1	Tue Jun 29 13:58:13 2021
+++ src/tests/usr.bin/xlint/lint1/lex_char_uchar.c	Tue Jun 29 14:19:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex_char_uchar.c,v 1.1 2021/06/29 13:58:13 rillig Exp $	*/
+/*	$NetBSD: lex_char_uchar.c,v 1.2 2021/06/29 14:19:51 rillig Exp $	*/
 # 3 "lex_char_uchar.c"
 
 /*
@@ -11,6 +11,7 @@
 /*
  * FIXME: The warning is bogus; it must be possible to initialize a char
  *  variable with a character constant.
+ * See tree.c, function convert_constant.
  */
 /* expect+1: conversion of 'int' to 'char' is out of range [119] */
 char ch = '\xff';
Index: src/tests/usr.bin/xlint/lint1/lex_char_uchar.exp
diff -u src/tests/usr.bin/xlint/lint1/lex_char_uchar.exp:1.1 src/tests/usr.bin/xlint/lint1/lex_char_uchar.exp:1.2
--- src/tests/usr.bin/xlint/lint1/lex_char_uchar.exp:1.1	Tue Jun 29 13:58:13 2021
+++ src/tests/usr.bin/xlint/lint1/lex_char_uchar.exp	Tue Jun 29 14:19:51 2021
@@ -1 +1 @@
-lex_char_uchar.c(16): warning: conversion of 'int' to 'char' is out of range [119]
+lex_char_uchar.c(17): warning: conversion of 'int' to 'char' is out of range [119]

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.295 src/usr.bin/xlint/lint1/tree.c:1.296
--- src/usr.bin/xlint/lint1/tree.c:1.295	Tue Jun 29 10:12:35 2021
+++ src/usr.bin/xlint/lint1/tree.c	Tue Jun 29 14:19:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.295 2021/06/29 10:12:35 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.296 2021/06/29 14:19:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.295 2021/06/29 10:12:35 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.296 2021/06/29 14:19:51 rillig Exp $");
 #endif
 
 #include 
@@ -2410,6 +2410,11 @@ convert_constant(op_t op, int arg, const
 	case LCOMPLEX:
 		break;
 	default:
+		/*
+		 * FIXME: There must be no sign extension when converting
+		 *  from int to char on a platform where char == unsigned
+		 *  char.  See test lex_char_uchar.c.
+		 */
 		sz = tp->t_bitfield ? tp->t_flen : size_in_bits(nt);
 		nv->v_quad = xsign(nv->v_quad, nt, sz);
 		break;



CVS commit: src

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 13:58:13 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile lex_integer.c
lex_integer_ilp32.c msg_259.c msg_259_ilp32.c t_integration.sh
Added Files:
src/tests/usr.bin/xlint/lint1: lex_char_uchar.c lex_char_uchar.exp

Log Message:
tests/lint: add test that only runs where char == unsigned char

There a 4 regular NetBSD builds where lint is activated.  All these
builds run on platforms where char == signed char.

The official test runs from https://releng.netbsd.org/test-results.html
mostly have char == signed char as well.

However, lint behaves differently on platforms with char == unsigned
char.  On these platforms, a simple "char ch = '\xff'" leads to the
bogus warning that "conversion of 'int' to 'char' is out of range".


To generate a diff of this commit:
cvs rdiff -u -r1.1068 -r1.1069 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.70 -r1.71 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/lex_char_uchar.c \
src/tests/usr.bin/xlint/lint1/lex_char_uchar.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/lex_integer.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c \
src/tests/usr.bin/xlint/lint1/msg_259_ilp32.c
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_259.c
cvs rdiff -u -r1.65 -r1.66 src/tests/usr.bin/xlint/lint1/t_integration.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1068 src/distrib/sets/lists/tests/mi:1.1069
--- src/distrib/sets/lists/tests/mi:1.1068	Tue Jun 29 09:19:17 2021
+++ src/distrib/sets/lists/tests/mi	Tue Jun 29 13:58:13 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1068 2021/06/29 09:19:17 rillig Exp $
+# $NetBSD: mi,v 1.1069 2021/06/29 13:58:13 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6222,6 +6222,8 @@
 ./usr/tests/usr.bin/xlint/lint1/gcc_typeof_after_statement.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_char.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_char.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/lex_char_uchar.c		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/lex_char_uchar.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_comment.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_comment.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_floating.c			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.70 src/tests/usr.bin/xlint/lint1/Makefile:1.71
--- src/tests/usr.bin/xlint/lint1/Makefile:1.70	Tue Jun 29 09:44:25 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Tue Jun 29 13:58:13 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.70 2021/06/29 09:44:25 rillig Exp $
+# $NetBSD: Makefile,v 1.71 2021/06/29 13:58:13 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -125,6 +125,8 @@ FILES+=		gcc_typeof_after_statement.c
 FILES+=		gcc_typeof_after_statement.exp
 FILES+=		lex_char.c
 FILES+=		lex_char.exp
+FILES+=		lex_char_uchar.c
+FILES+=		lex_char_uchar.exp
 FILES+=		lex_comment.c
 FILES+=		lex_comment.exp
 FILES+=		lex_floating.c

Index: src/tests/usr.bin/xlint/lint1/lex_integer.c
diff -u src/tests/usr.bin/xlint/lint1/lex_integer.c:1.3 src/tests/usr.bin/xlint/lint1/lex_integer.c:1.4
--- src/tests/usr.bin/xlint/lint1/lex_integer.c:1.3	Tue Jun 29 08:46:10 2021
+++ src/tests/usr.bin/xlint/lint1/lex_integer.c	Tue Jun 29 13:58:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex_integer.c,v 1.3 2021/06/29 08:46:10 rillig Exp $	*/
+/*	$NetBSD: lex_integer.c,v 1.4 2021/06/29 13:58:13 rillig Exp $	*/
 # 3 "lex_integer.c"
 
 /*
@@ -7,7 +7,7 @@
  * C99 6.4.4.1 "Integer constants"
  */
 
-/* lint1-only-on-lp64 */
+/* lint1-only-if lp64 */
 
 void sinki(int);
 void sinku(unsigned int);

Index: src/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c
diff -u src/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c:1.1 src/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c:1.2
--- src/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c:1.1	Tue Jun 29 09:19:17 2021
+++ src/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c	Tue Jun 29 13:58:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex_integer_ilp32.c,v 1.1 2021/06/29 09:19:17 rillig Exp $	*/
+/*	$NetBSD: lex_integer_ilp32.c,v 1.2 2021/06/29 13:58:13 rillig Exp $	*/
 # 3 "lex_integer_ilp32.c"
 
 /*
@@ -7,7 +7,7 @@
  * C99 6.4.4.1 "Integer constants"
  */
 
-/* lint1-only-on-ilp32 */
+/* lint1-only-if ilp32 */
 
 void sinki(int);
 void sinku(unsigned int);
Index: 

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

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 13:48:24 UTC 2021

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

Log Message:
lint: clean up lex_character_constant

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/xlint/lint1/lex.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/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.47 src/usr.bin/xlint/lint1/lex.c:1.48
--- src/usr.bin/xlint/lint1/lex.c:1.47	Tue Jun 29 07:23:21 2021
+++ src/usr.bin/xlint/lint1/lex.c	Tue Jun 29 13:48:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.47 2021/06/29 07:23:21 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.48 2021/06/29 13:48:24 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.47 2021/06/29 07:23:21 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.48 2021/06/29 13:48:24 rillig Exp $");
 #endif
 
 #include 
@@ -820,7 +820,6 @@ lex_character_constant(void)
 {
 	size_t	n;
 	int val, c;
-	char	cv;
 
 	n = 0;
 	val = 0;
@@ -844,8 +843,12 @@ lex_character_constant(void)
 		error(73);
 	}
 	if (n == 1) {
-		cv = (char)val;
-		val = cv;
+		/*
+		 * XXX: use the target platform's 'char' instead of the
+		 *  'char' from the execution environment, to be able to
+		 *  run lint for powerpc on x86_64.
+		 */
+		val = (char)val;
 	}
 
 	yylval.y_val = xcalloc(1, sizeof(*yylval.y_val));



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

2021-06-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 29 11:35:28 UTC 2021

Modified Files:
src/sys/arch/evbarm/conf: std.hdl_g

Log Message:
KERNEL_BASE is 0xc000 for HDL_G.

With this change, HDL-G boots multiuser!


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/std.hdl_g

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

Modified files:

Index: src/sys/arch/evbarm/conf/std.hdl_g
diff -u src/sys/arch/evbarm/conf/std.hdl_g:1.7 src/sys/arch/evbarm/conf/std.hdl_g:1.8
--- src/sys/arch/evbarm/conf/std.hdl_g:1.7	Sun Oct  7 07:48:44 2018
+++ src/sys/arch/evbarm/conf/std.hdl_g	Tue Jun 29 11:35:28 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.hdl_g,v 1.7 2018/10/07 07:48:44 skrll Exp $
+#	$NetBSD: std.hdl_g,v 1.8 2021/06/29 11:35:28 rin Exp $
 #
 # standard NetBSD/evbarm for I-O DATA HDL-G options
 
@@ -15,3 +15,5 @@ options 	ARM_INTR_IMPL="

CVS commit: src/doc

2021-06-29 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Jun 29 10:26:17 UTC 2021

Modified Files:
src/doc: CHANGES

Log Message:
doc: removed uscanner


To generate a diff of this commit:
cvs rdiff -u -r1.2812 -r1.2813 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.2812 src/doc/CHANGES:1.2813
--- src/doc/CHANGES:1.2812	Sat Jun 19 06:19:35 2021
+++ src/doc/CHANGES	Tue Jun 29 10:26:17 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2812 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2813 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -383,3 +383,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	libfido2: Import 1.7.0 [christos 20210616]
 	m68k: Switch to GCC 10.  [mrg 20210619]
 	arm: Switch to GCC 10.  [mrg 20210619]
+	uscanner(4): Removed from the tree. [nia 20210629]



CVS commit: src/share/man/man4

2021-06-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jun 29 10:26:00 UTC 2021

Modified Files:
src/share/man/man4: lagg.4

Log Message:
Remove unnecessary Pp, fix formatting, remove empty line.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/lagg.4

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

Modified files:

Index: src/share/man/man4/lagg.4
diff -u src/share/man/man4/lagg.4:1.2 src/share/man/man4/lagg.4:1.3
--- src/share/man/man4/lagg.4:1.2	Mon Jun 21 06:36:28 2021
+++ src/share/man/man4/lagg.4	Tue Jun 29 10:26:00 2021
@@ -1,5 +1,4 @@
-
-.\"	$NetBSD: lagg.4,v 1.2 2021/06/21 06:36:28 yamaguchi Exp $
+.\"	$NetBSD: lagg.4,v 1.3 2021/06/29 10:26:00 wiz Exp $
 .\"
 .\" Copyright (c) 2005, 2006 Reyk Floeter 
 .\"
@@ -81,7 +80,7 @@ The interface preferentially uses the ch
 the smallest numeric in the priority.
 .Pp
 The driver currently supports the aggregation protocols
-.Ic failover,
+.Ic failover ,
 .Ic loadbalance ,
 .Ic lacp ,
 and
@@ -153,7 +152,6 @@ command.
 .Pp
 The MTU of the first interface to be added is used as the lagg MTU.
 All additional interfaces are required to have exactly the same value.
-.Pp
 .Sh EXAMPLES
 Create a link aggregation using LACP with two
 .Xr wm 4
@@ -177,7 +175,6 @@ Gigabit Ethernet interfaces and set each
 	laggport wm0 pri 1000 laggport wm1 pri 2000 \e
 	192.168.1.1 netmask 255.255.255.0
 .Ed
-.Pp
 .Sh SEE ALSO
 .Xr ifconfig 8
 .Sh HISTORY



CVS commit: src/share/man/man4

2021-06-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jun 29 10:25:33 UTC 2021

Modified Files:
src/share/man/man4: ddb.4

Log Message:
Fix date.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/share/man/man4/ddb.4

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

Modified files:

Index: src/share/man/man4/ddb.4
diff -u src/share/man/man4/ddb.4:1.200 src/share/man/man4/ddb.4:1.201
--- src/share/man/man4/ddb.4:1.200	Mon Jun 21 02:12:00 2021
+++ src/share/man/man4/ddb.4	Tue Jun 29 10:25:33 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ddb.4,v 1.200 2021/06/21 02:12:00 thorpej Exp $
+.\"	$NetBSD: ddb.4,v 1.201 2021/06/29 10:25:33 wiz Exp $
 .\"
 .\" Copyright (c) 1997 - 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -56,7 +56,7 @@
 .\" any improvements or extensions that they make and grant Carnegie Mellon
 .\" the rights to redistribute these changes.
 .\"
-.Dd Jiune 20, 2021
+.Dd June 20, 2021
 .Dt DDB 4
 .Os
 .Sh NAME



CVS commit: src/sys/conf

2021-06-29 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Jun 29 10:24:41 UTC 2021

Modified Files:
src/sys/conf: majors.usb

Log Message:
mark urio/uscanner device majors obsolete


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/conf/majors.usb

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

Modified files:

Index: src/sys/conf/majors.usb
diff -u src/sys/conf/majors.usb:1.2 src/sys/conf/majors.usb:1.3
--- src/sys/conf/majors.usb:1.2	Mon Feb  3 13:28:11 2020
+++ src/sys/conf/majors.usb	Tue Jun 29 10:24:41 2021
@@ -1,4 +1,4 @@
-# $NetBSD: majors.usb,v 1.2 2020/02/03 13:28:11 kre Exp $
+# $NetBSD: majors.usb,v 1.3 2021/06/29 10:24:41 nia Exp $
 #
 # MI major assignments for USB devices
 #
@@ -7,5 +7,5 @@ device-major	uhid		char 221		uhid
 device-major	ulpt		char 222		ulpt
 device-major	ugen		char 223		ugen
 device-major	ucom		char 224		ucom
-#device-major	urio		char 225		urio
-device-major	uscanner	char 226		uscanner
+#device-major	obsolete	char 225		obsolete (urio)
+#device-major	obsolete	char 226		obsolete (uscanner)



CVS commit: src

2021-06-29 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Jun 29 10:22:37 UTC 2021

Modified Files:
src/distrib/sets/lists/man: mi
src/etc: MAKEDEV.tmpl
src/share/man/man4: Makefile usb.4 usscanner.4
src/sys/arch/aarch64/conf: majors.aarch64
src/sys/arch/algor/conf: P4032 P5064 P6032 majors.algor
src/sys/arch/alpha/conf: GENERIC majors.alpha
src/sys/arch/amd64/conf: ALL XEN3_DOM0 majors.amd64
src/sys/arch/arm/conf: majors.arm32
src/sys/arch/cats/conf: GENERIC
src/sys/arch/cobalt/conf: majors.cobalt
src/sys/arch/epoc32/conf: majors.epoc32
src/sys/arch/evbarm/conf: HDL_G HPT5325 MINI2440 MMNET_GENERIC
MPCSA_GENERIC POGO SHEEVAPLUG SMDK2410 TS7200 TWINTAIL
src/sys/arch/evbmips/conf: majors.evbmips
src/sys/arch/evbppc/conf: OPENBLOCKS266_OPT PMPPC majors.evbppc
src/sys/arch/hpcarm/conf: majors.hpcarm
src/sys/arch/hpcmips/conf: GENERIC TX3922 VR41XX majors.hpcmips
src/sys/arch/hppa/conf: GENERIC
src/sys/arch/i386/conf: ALL XEN3PAE_DOM0 majors.i386
src/sys/arch/ia64/conf: majors.ia64
src/sys/arch/landisk/conf: GENERIC majors.landisk
src/sys/arch/ofppc/conf: GENERIC
src/sys/arch/or1k/conf: majors.or1k
src/sys/arch/playstation2/conf: DEBUG majors.playstation2
src/sys/arch/powerpc/conf: majors.powerpc
src/sys/arch/prep/conf: GENERIC
src/sys/arch/sandpoint/conf: GENERIC
src/sys/arch/sgimips/conf: majors.sgimips
src/sys/arch/sparc64/conf: majors.sparc64
src/sys/arch/x68k/conf: GENERIC majors.x68k
src/sys/arch/zaurus/conf: majors.zaurus
src/sys/dev: DEVNAMES
src/sys/dev/usb: FILES TODO.usbmp files.usb usbdevices.config
src/sys/rump/librump/rumpkern: devsw.c
Removed Files:
src/share/man/man4: uscanner.4
src/sys/dev/usb: uscanner.c

Log Message:
Remove uscanner(4) driver

This exists for compatibility with a Linux interface which was apparently
deprecated in Linux 2.6. There are various mailing list threads going
back to 2004 where the usefulness of this driver is discussed, but
the conclusion is that scanner software has all moved to using ugen(4)
instead, and enabling this driver will not help you scan things.


To generate a diff of this commit:
cvs rdiff -u -r1.1722 -r1.1723 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.222 -r1.223 src/etc/MAKEDEV.tmpl
cvs rdiff -u -r1.713 -r1.714 src/share/man/man4/Makefile
cvs rdiff -u -r1.117 -r1.118 src/share/man/man4/usb.4
cvs rdiff -u -r1.12 -r0 src/share/man/man4/uscanner.4
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/usscanner.4
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/aarch64/conf/majors.aarch64
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/algor/conf/P4032
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/algor/conf/P5064
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/algor/conf/P6032
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/algor/conf/majors.algor
cvs rdiff -u -r1.411 -r1.412 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/conf/majors.alpha
cvs rdiff -u -r1.166 -r1.167 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.192 -r1.193 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/amd64/conf/majors.amd64
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/arm/conf/majors.arm32
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/cats/conf/GENERIC
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/cobalt/conf/majors.cobalt
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/epoc32/conf/majors.epoc32
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/evbarm/conf/HDL_G
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/evbarm/conf/HPT5325
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/evbarm/conf/MINI2440
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/evbarm/conf/MMNET_GENERIC
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/evbarm/conf/MPCSA_GENERIC
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/conf/POGO
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/evbarm/conf/SHEEVAPLUG
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/evbarm/conf/SMDK2410
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/evbarm/conf/TS7200
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/evbarm/conf/TWINTAIL
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/evbmips/conf/majors.evbmips
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/evbppc/conf/PMPPC
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/evbppc/conf/majors.evbppc
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hpcarm/conf/majors.hpcarm
cvs rdiff -u -r1.244 -r1.245 src/sys/arch/hpcmips/conf/GENERIC
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/hpcmips/conf/TX3922
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/hpcmips/conf/VR41XX
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/hpcmips/conf/majors.hpcmips
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/hppa/conf/GENERIC
cvs rdiff -u -r1.498 -r1.499 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/i386/conf/XEN3PAE_DOM0
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/i386/conf/majors.i386
cvs 

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

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 10:12:35 UTC 2021

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

Log Message:
lint: fix typos in comment


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.294 src/usr.bin/xlint/lint1/tree.c:1.295
--- src/usr.bin/xlint/lint1/tree.c:1.294	Mon Jun 28 11:27:00 2021
+++ src/usr.bin/xlint/lint1/tree.c	Tue Jun 29 10:12:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.294 2021/06/28 11:27:00 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.295 2021/06/29 10:12:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.294 2021/06/28 11:27:00 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.295 2021/06/29 10:12:35 rillig Exp $");
 #endif
 
 #include 
@@ -2257,9 +2257,9 @@ convert_constant_check_range_signed(op_t
  * of unsigned types or all truncated bits plus the
  * msb of the target for signed types are considered
  * to be significant bits. Loss of significant bits
- * means that at least on of the bits was set in an
- * unsigned type or that at least one, but not all of
- * the bits was set in an signed type.
+ * means that at least one of the bits was set in an
+ * unsigned type or that at least one but not all of
+ * the bits was set in a signed type.
  * Loss of significant bits means that it is not
  * possible, also not with necessary casts, to convert
  * back to the original type. A example for a



CVS commit: src/tools/compat

2021-06-29 Thread Chris Pinnock
Module Name:src
Committed By:   cjep
Date:   Tue Jun 29 10:02:34 UTC 2021

Modified Files:
src/tools/compat: README

Log Message:
Note OpenBSD cross-build progress


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tools/compat/README

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

Modified files:

Index: src/tools/compat/README
diff -u src/tools/compat/README:1.18 src/tools/compat/README:1.19
--- src/tools/compat/README:1.18	Mon Jun 28 07:18:01 2021
+++ src/tools/compat/README	Tue Jun 29 10:02:34 2021
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.18 2021/06/28 07:18:01 cjep Exp $
+$NetBSD: README,v 1.19 2021/06/29 10:02:34 cjep Exp $
 
 Special notes for cross-hosting a NetBSD build on certain platforms.  
 Only those platforms which have been tested to complete a "build.sh" run
@@ -61,6 +61,15 @@ HP-UX
 
 * zlib must be available.
 
+OpenBSD
+---
+
+As of -current 20210629, ./build.sh will build src on OpenBSD 6.9
+for some platforms. Known problems:
+* MIPS targets do not currently build. 
+* The LLVM RT library will not build and consequently nor will X on 
+  amd64 and i386.
+
 NetBSD (earlier releases)
 -
 



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

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 09:44:25 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: Makefile
Added Files:
src/tests/usr.bin/xlint/lint1: accept.sh

Log Message:
tests/lint: add 'make accept' to update the expected output


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/accept.sh

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.69 src/tests/usr.bin/xlint/lint1/Makefile:1.70
--- src/tests/usr.bin/xlint/lint1/Makefile:1.69	Tue Jun 29 09:19:17 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Tue Jun 29 09:44:25 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.69 2021/06/29 09:19:17 rillig Exp $
+# $NetBSD: Makefile,v 1.70 2021/06/29 09:44:25 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -161,4 +161,7 @@ sync-mi: .PHONY
 	mv "$$mi.tmp" "$$mi";		\
 	cvs diff "$$mi" || true
 
+accept: .PHONY
+	@sh ./accept.sh ''
+
 .include 

Added files:

Index: src/tests/usr.bin/xlint/lint1/accept.sh
diff -u /dev/null src/tests/usr.bin/xlint/lint1/accept.sh:1.1
--- /dev/null	Tue Jun 29 09:44:25 2021
+++ src/tests/usr.bin/xlint/lint1/accept.sh	Tue Jun 29 09:44:25 2021
@@ -0,0 +1,90 @@
+#! /bin/sh
+# $NetBSD: accept.sh,v 1.1 2021/06/29 09:44:25 rillig Exp $
+#
+# Copyright (c) 2021 The NetBSD Foundation, Inc.
+# 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.
+#
+
+# usage: accept.sh ...
+#
+#	Accept the actual output from running the lint tests and save them
+#	back into the .exp files.
+
+set -eu
+
+. './t_integration.sh'
+
+for pattern in "$@"; do
+	for test in *$pattern*.c; do
+		base=${test%.*}
+		cfile="$base.c"
+		expfile="$base.exp"
+		tmpfile="$base.exp.tmp"
+		ln_file="$base.ln"
+
+		configure_test_case "$cfile"
+		if [ $skip = yes ]; then
+			continue
+		fi
+
+		if [ ! -f "$ln_file" ]; then
+			ln_file='/dev/null'
+		fi
+
+		if "$lint1" $flags "$base.c" "$ln_file" > "$tmpfile"; then
+			if [ -s "$tmpfile" ]; then
+echo "$base produces output but exits successfully"
+sed 's,^,| ,' "$tmpfile"
+			fi
+			rm -f "$expfile" "$tmpfile"
+		else
+			if [ -f "$tmpfile" ] && cmp -s "$tmpfile" "$expfile"; then
+rm "$tmpfile"
+			else
+echo "replacing $base"
+mv "$tmpfile" "$expfile"
+			fi
+		fi
+
+		case "$base" in (msg_*)
+			if [ ! -f "$expfile" ]; then
+echo "$base should produce warnings"
+			elif grep '^TODO: "Add example code' "$base.c" >/dev/null; then
+: 'ok, this test is not yet written'
+			else
+msgid=${base}
+msgid=${msgid#msg_00}
+msgid=${msgid#msg_0}
+msgid=${msgid#msg_}
+msgid=${msgid%_*}
+if ! grep "\\[$msgid\\]" "$expfile" >/dev/null; then
+	echo "$base should trigger the message '$msgid'"
+fi
+			fi
+		esac
+
+	done
+done
+
+lua '../check-expect.lua' *.c



CVS commit: src

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 09:19:17 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile msg_259.c msg_259.exp
t_integration.sh
Added Files:
src/tests/usr.bin/xlint/lint1: lex_integer_ilp32.c
lex_integer_ilp32.exp msg_259_ilp32.c msg_259_ilp32.exp

Log Message:
tests/lint: add tests for ILP32 platforms

Previously, all tests for lint had to produce the exact same output, no
matter which platform they ran on.  This differs from practical needs
since lint is intended to produce different results depending on whether
the platform is ILP32 or LP64.

Examples for these are type conversions and the widths of the integer
types during lexical analysis.


To generate a diff of this commit:
cvs rdiff -u -r1.1067 -r1.1068 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.68 -r1.69 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c \
src/tests/usr.bin/xlint/lint1/lex_integer_ilp32.exp \
src/tests/usr.bin/xlint/lint1/msg_259_ilp32.c \
src/tests/usr.bin/xlint/lint1/msg_259_ilp32.exp
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_259.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_259.exp
cvs rdiff -u -r1.64 -r1.65 src/tests/usr.bin/xlint/lint1/t_integration.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1067 src/distrib/sets/lists/tests/mi:1.1068
--- src/distrib/sets/lists/tests/mi:1.1067	Sun Jun 27 19:10:29 2021
+++ src/distrib/sets/lists/tests/mi	Tue Jun 29 09:19:17 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1067 2021/06/27 19:10:29 rillig Exp $
+# $NetBSD: mi,v 1.1068 2021/06/29 09:19:17 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6228,6 +6228,8 @@
 ./usr/tests/usr.bin/xlint/lint1/lex_floating.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_integer.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_integer.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/lex_integer_ilp32.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_string.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_string.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_wide_char.c			tests-usr.bin-tests	compattestfile,atf
@@ -6754,6 +6756,8 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_258.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_259.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_259.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_259_ilp32.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_259_ilp32.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_260.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_260.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_261.c			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.68 src/tests/usr.bin/xlint/lint1/Makefile:1.69
--- src/tests/usr.bin/xlint/lint1/Makefile:1.68	Sun Jun 27 19:10:29 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Tue Jun 29 09:19:17 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.68 2021/06/27 19:10:29 rillig Exp $
+# $NetBSD: Makefile,v 1.69 2021/06/29 09:19:17 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -131,6 +131,8 @@ FILES+=		lex_floating.c
 FILES+=		lex_floating.exp
 FILES+=		lex_integer.c
 FILES+=		lex_integer.exp
+FILES+=		lex_integer_ilp32.c
+FILES+=		lex_integer_ilp32.exp
 FILES+=		lex_string.c
 FILES+=		lex_string.exp
 FILES+=		lex_wide_char.c
@@ -138,6 +140,8 @@ FILES+=		lex_wide_char.exp
 FILES+=		lex_wide_string.c
 FILES+=		lex_wide_string.exp
 FILES+=		${:U0 ${:U:${:Urange=${MAX_MESSAGE}}}:C,^.$,0&,:C,^..$,0&,:@i@msg_${i}.c msg_${i}.exp@:Nmsg_176.exp}
+FILES+=		msg_259_ilp32.c
+FILES+=		msg_259_ilp32.exp
 FILES+=		op_colon.c
 FILES+=		op_colon.exp
 FILES+=		stmt_for.c

Index: src/tests/usr.bin/xlint/lint1/msg_259.c
diff -u src/tests/usr.bin/xlint/lint1/msg_259.c:1.6 src/tests/usr.bin/xlint/lint1/msg_259.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_259.c:1.6	Thu Feb  4 07:39:39 2021
+++ src/tests/usr.bin/xlint/lint1/msg_259.c	Tue Jun 29 09:19:17 2021
@@ -1,8 +1,9 @@
-/*	$NetBSD: msg_259.c,v 1.6 2021/02/04 07:39:39 rillig Exp $	*/
+/*	$NetBSD: msg_259.c,v 1.7 2021/06/29 09:19:17 rillig Exp $	*/
 # 3 "msg_259.c"
 
 // Test for message: 

CVS commit: src/external/gpl3/gcc.old/dist/gcc

2021-06-29 Thread Chris Pinnock
Module Name:src
Committed By:   cjep
Date:   Tue Jun 29 08:51:04 UTC 2021

Modified Files:
src/external/gpl3/gcc.old/dist/gcc: config.host

Log Message:
PR toolchain/56180. Additional to yesterday's commit in gcc, also needed in
gcc.old. Add configuration so that gcc can find the LTO plugin when
cross-building NetBSD from OpenBSD hosts.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gcc.old/dist/gcc/config.host

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

Modified files:

Index: src/external/gpl3/gcc.old/dist/gcc/config.host
diff -u src/external/gpl3/gcc.old/dist/gcc/config.host:1.10 src/external/gpl3/gcc.old/dist/gcc/config.host:1.11
--- src/external/gpl3/gcc.old/dist/gcc/config.host:1.10	Fri Apr  9 23:14:17 2021
+++ src/external/gpl3/gcc.old/dist/gcc/config.host	Tue Jun 29 08:51:03 2021
@@ -277,6 +277,7 @@ case ${host} in
   *-*-openbsd*)
 out_host_hook_obj=host-openbsd.o
 host_xmake_file="${host_xmake_file} x-openbsd"
+host_lto_plugin_soname=liblto_plugin.so.0.0
 ;;
   *-*-netbsd*)
 out_host_hook_obj=host-netbsd.o



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

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 08:46:10 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: lex_integer.c t_integration.sh

Log Message:
tests/lint: allow tests to be skipped depending on platform properties


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/lex_integer.c
cvs rdiff -u -r1.63 -r1.64 src/tests/usr.bin/xlint/lint1/t_integration.sh

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/lex_integer.c
diff -u src/tests/usr.bin/xlint/lint1/lex_integer.c:1.2 src/tests/usr.bin/xlint/lint1/lex_integer.c:1.3
--- src/tests/usr.bin/xlint/lint1/lex_integer.c:1.2	Sun Jun 27 10:14:43 2021
+++ src/tests/usr.bin/xlint/lint1/lex_integer.c	Tue Jun 29 08:46:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex_integer.c,v 1.2 2021/06/27 10:14:43 rillig Exp $	*/
+/*	$NetBSD: lex_integer.c,v 1.3 2021/06/29 08:46:10 rillig Exp $	*/
 # 3 "lex_integer.c"
 
 /*
@@ -7,7 +7,7 @@
  * C99 6.4.4.1 "Integer constants"
  */
 
-/* lint1-not-on-arch: i386 (has 32-bit long) */
+/* lint1-only-on-lp64 */
 
 void sinki(int);
 void sinku(unsigned int);

Index: src/tests/usr.bin/xlint/lint1/t_integration.sh
diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.63 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.64
--- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.63	Sun Jun 27 19:41:15 2021
+++ src/tests/usr.bin/xlint/lint1/t_integration.sh	Tue Jun 29 08:46:10 2021
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.63 2021/06/27 19:41:15 rillig Exp $
+# $NetBSD: t_integration.sh,v 1.64 2021/06/29 08:46:10 rillig Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -36,24 +36,45 @@ configure_test_case()
 
 	# shellcheck disable=SC2016
 	awk='
+		function is_ilp32() {
+			return match(machine_arch, /^(arm|coldfire|hppa|i386|m68000|m68k|mips|mips64|or1k|powerpc|riscv32|sh3|sparc|vax)$/)
+		}
+
+		function is_lp64() {
+			return match(machine_arch, /^(aarch64|alpha|ia64|mipsn64|powerpc64|riscv64|sparc64|x86_64)$/)
+		}
+
 		BEGIN {
 			machine_arch = "'"$machine_arch"'"
 			flags = "-g -S -w"
+			seen_only_on_arch = 0
+			match_only_on_arch = 0
 			skip = 0
 		}
-		/^\/\* (lint1-flags|lint1-extra-flags): .*\*\/$/ {
-			if ($2 == "lint1-flags:")
-flags = ""
-			for (i = 3; i < NF; i++)
-flags = flags " " $i
-		}
-		/^\/\* lint1-only-on-arch: .* \*\/$/ && $3 != machine_arch {
-			skip = 1
-		}
-		/^\/\* lint1-not-on-arch: .* \*\/$/ && $3 == machine_arch {
-			skip = 1
+		$1 == "/*" && $2 ~ /^lint1-/ && $NF == "*/" {
+			if ($2 == "lint1-flags:" || $2 == "lint1-extra-flags:") {
+if ($2 == "lint1-flags:")
+	flags = ""
+for (i = 3; i < NF; i++)
+	flags = flags " " $i
+			}
+			if ($2 == "lint1-only-on-arch") {
+seen_only_on_arch = 1
+if ($3 == machine_arch)
+	match_only_on_arch = 1
+			}
+			if ($2 == "lint1-not-on-arch" && $3 == machine_arch)
+skip = 1
+			if ($2 == "lint1-only-on-ilp32" && !is_ilp32())
+skip = 1
+			if ($2 == "lint1-only-on-lp64" && !is_lp64())
+skip = 1
 		}
+
 		END {
+			if (seen_only_on_arch && !match_only_on_arch)
+skip = 1
+
 			printf("flags='\''%s'\''\n", flags)
 			printf("skip=%s\n", skip ? "yes" : "no")
 		}



CVS commit: src/usr.sbin/sysinst

2021-06-29 Thread Chris Pinnock
Module Name:src
Committed By:   cjep
Date:   Tue Jun 29 08:02:50 UTC 2021

Modified Files:
src/usr.sbin/sysinst: msg_xlat.sh

Log Message:
1. Rework the IFS handling when checking consistency of formatting in
sysinst messages. Closes PR toolchain/56181.
2. Whilst here, change some shell clauses to be more portable.

Patch developed by kre. Also reviewed by martin. Cross-builds tested
on NetBSD, OpenBSD, FreeBSD and Darwin.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/sysinst/msg_xlat.sh

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

Modified files:

Index: src/usr.sbin/sysinst/msg_xlat.sh
diff -u src/usr.sbin/sysinst/msg_xlat.sh:1.2 src/usr.sbin/sysinst/msg_xlat.sh:1.3
--- src/usr.sbin/sysinst/msg_xlat.sh:1.2	Thu Nov  5 19:13:21 2020
+++ src/usr.sbin/sysinst/msg_xlat.sh	Tue Jun 29 08:02:50 2021
@@ -1,5 +1,5 @@
 #! /bin/sh
-#	$NetBSD: msg_xlat.sh,v 1.2 2020/11/05 19:13:21 christos Exp $
+#	$NetBSD: msg_xlat.sh,v 1.3 2021/06/29 08:02:50 cjep Exp $
 
 #-
 # Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -37,32 +37,35 @@ usage()
 	exit 1
 }
 
-error() {
+error()
+{
 	echo "$PROG: ERROR $@" >&2
 }
 
-count_fmtargs=
+IGNORE_MISSING_TRANSLATIONS=false
+count_fmtargs=false
 msg_defs=msg_defs.h
+
 while getopts cd:f:i f
 do
-	case $f in
-	c) count_fmtargs=1;;
+	case "$f" in
+	c) count_fmtargs=true;;
 	d) msg_defs=$OPTARG;;
 	f) fmt_count=$OPTARG;;
-	i) IGNORE_MISSING_TRANSLATIONS=y;;
+	i) IGNORE_MISSING_TRANSLATIONS=true;;
 	*) usage;;
 	esac
 done
 shift $(($OPTIND - 1))
-[ "$#" = 0 ] || usage
+if [ "$#" -ne 0 ]; then usage; fi
 
-nl="
-"
-msg_long="((msg)(long)"
-close_paren=")"
-open_brace="{"
-close_brace="}"
-slash="/"
+nl='
+'
+msg_long='((msg)(long)'
+close_paren=')'
+open_brace='{'
+close_brace='}'
+slash=/
 
 rval=0
 
@@ -70,13 +73,13 @@ rval=0
 exec 3<&0
 
 # Read existing list of format arg counts
-[ -n "$fmt_count" ] && {
+if [ -n "$fmt_count" ]; then
 	exec <$fmt_count || exit 2
 	while read name count
 	do
 		eval count_$name=\$count
 	done
-}
+fi
 
 # Read header file and set up map of message names to numbers
 
@@ -84,12 +87,14 @@ exec <$msg_defs || exit 2
 
 while read define MSG_name number rest
 do
-	[ -z "$number" -o -n "$rest" ] && continue
-	[ "$define" = "#define" ] || continue
+	if [ -z "$number" ] || [ -n "$rest" ]; then continue; fi
+	if [ "$define" != "#define" ]; then continue; fi
+
 	name="${MSG_name#MSG_}"
-	[ "$name" = "${MSG_name}" ] && continue
+	if [ "$name" = "${MSG_name}" ]; then continue; fi
+
 	msg_number="${number#$msg_long}"
-	[ "$msg_number" = "$number" ] && continue
+	if [ "$msg_number" = "$number" ]; then continue; fi
 	msg_number="${msg_number%$close_paren}"
 
 	eval $MSG_name=$msg_number
@@ -105,101 +110,106 @@ exec <&3 3<&-
 
 name=
 msg=
-OIFS="$IFS"
 while
 	IFS=
 	read -r line
 do
-	[ -z "$name" ] && {
+	if [ -z "$name" ]; then
 		IFS=" 	"
 		set -- $line
-		[ "$1" = message ] || continue
+		if [ "$1" != message ]; then continue; fi
 		name="$2"
 		eval number=\$MSG_$name
-		[ -z "$number" ] && {
+		if [ -z "$number" ]; then
 			error "unknown message \"$name\""
-			[ -n "$IGNORE_MISSING_TRANSLATIONS" ] || rval=1
+			$IGNORE_MISSING_TRANSLATIONS || rval=1
 			number=unknown
-		}
+		fi
 		l=${line#*$open_brace}
-		[ "$l" = "$line" ] && continue
+		if [ "$l" = "$line" ]; then continue; fi
 		line="{$l"
-	}
-	[ -z "$msg" ] && {
-		l="${line#$open_brace}"
-		[ "$l" = "$line" ] && continue
+	fi
+	if [ -z "$msg" ]; then
+		l=${line#$open_brace}
+		if [ "$l" = "$line" ]; then continue; fi
 		msg="$line"
-	} || msg="$msg$nl$line"
-	m="${msg%$close_brace}"
-	[ "$m" = "$msg" ] && {
+	else
+		msg="$msg$nl$line"
+	fi
+	m=${msg%$close_brace}
+	if [ "$m" = "$msg" ]; then
 		# Allow */* comment */ (eg XXX translate)
-		m="${msg%%$close_brace*$slash[*]*[*]$slash}"
-		[ "$m" = "$msg" ] &&
-			continue
-	}
+		m=${msg%%$close_brace*$slash[*]*[*]$slash}
+		if [ "$m" = "$msg" ]; then continue; fi
+	fi
 	# We need the %b to expand the \n that exist in the message file
-	msg="$(printf "%bz" "${m#$open_brace}")"
-	msg="${msg%z}"
+	msg=$(printf %bz "${m#$open_brace}")
+	msg=${msg%z}
 	eval old=\"\$MSGTEXT_$number\"
-	[ -n "$old" -a "$number" != unknown ] && {
+	if [ -n "$old" ] &&  [ "$number" != unknown ]; then
 		error "Two translations for message \"$name\""
-		[ -n "$IGNORE_MISSING_TRANSLATIONS" ] || rval=1
-	}
+		$IGNORE_MISSING_TRANSLATIONS || rval=1
+	fi
 	eval MSGTEXT_$number=\"\${msg}\"
 	# echo $number $msg
 	sv_name="$name"
 	sv_msg="$msg"
 	name=
 	msg=
-	[ -z "$count_fmtargs" -a -z "$fmt_count" ] && continue
+	if ! $count_fmtargs && [ -z "$fmt_count" ]; then continue; fi
+
+	IFS=%
+	set -- $sv_msg
 
-	IFS='%'
-	set -- - x$sv_msg
-	[ -n "$count_fmtargs" ] && {
+	# For our purposes, empty messages are the same as words without %
+	if [ $# -eq 0 ]; then set -- x; fi
+	
+	if $count_fmtargs; then
 		echo $number $#
 		continue
-	}
+	fi
 	eval 

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

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 07:37:34 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: Makefile

Log Message:
tests/lint: do not modify t_integration on "make add-test"

The test names are no longer listed individually.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/xlint/lint1/Makefile

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

Modified files:

Index: src/usr.bin/xlint/lint1/Makefile
diff -u src/usr.bin/xlint/lint1/Makefile:1.74 src/usr.bin/xlint/lint1/Makefile:1.75
--- src/usr.bin/xlint/lint1/Makefile:1.74	Mon Jun 28 09:09:14 2021
+++ src/usr.bin/xlint/lint1/Makefile	Tue Jun 29 07:37:34 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.74 2021/06/28 09:09:14 mrg Exp $
+#	$NetBSD: Makefile,v 1.75 2021/06/29 07:37:34 rillig Exp $
 
 .include 
 
@@ -94,8 +94,6 @@ add-test: .PHONY
 		"FILES+=		$$test.exp" \
 		'.' 'w' 'q' \
 	| ed Makefile; \
-	${MAKE} sync-mi; \
-	printf '%s\n' '/^test_case /i' "test_case $$test" '.' 'w' 'q' \
-	| ed t_integration.sh
+	${MAKE} sync-mi
 
 .include 



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

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 07:28:02 UTC 2021

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

Log Message:
tests/lint: add test for character constant using backslash-newline


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/lex_char.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/lex_char.c
diff -u src/tests/usr.bin/xlint/lint1/lex_char.c:1.3 src/tests/usr.bin/xlint/lint1/lex_char.c:1.4
--- src/tests/usr.bin/xlint/lint1/lex_char.c:1.3	Tue Jun 29 07:17:43 2021
+++ src/tests/usr.bin/xlint/lint1/lex_char.c	Tue Jun 29 07:28:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex_char.c,v 1.3 2021/06/29 07:17:43 rillig Exp $	*/
+/*	$NetBSD: lex_char.c,v 1.4 2021/06/29 07:28:01 rillig Exp $	*/
 # 3 "lex_char.c"
 
 /*
@@ -58,3 +58,14 @@ test(void)
 	/* U+000D carriage return */
 	sink('\r');
 }
+
+/*
+ * Even though backslash-newline is not supported by C99, lint accepts it
+ * in any mode, even for traditional C.
+ */
+char ch = '\
+\
+\
+\
+\
+x';



CVS commit: src

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 07:23:21 UTC 2021

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

Log Message:
lint: fix lexical analysis of character constants in traditional C

The code now follows the wording of the C Reference Manual from 1978.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_077.c \
src/tests/usr.bin/xlint/lint1/msg_077.exp
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/xlint/lint1/lex.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_077.c
diff -u src/tests/usr.bin/xlint/lint1/msg_077.c:1.3 src/tests/usr.bin/xlint/lint1/msg_077.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_077.c:1.3	Tue Jun 29 07:17:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_077.c	Tue Jun 29 07:23:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_077.c,v 1.3 2021/06/29 07:17:43 rillig Exp $	*/
+/*	$NetBSD: msg_077.c,v 1.4 2021/06/29 07:23:21 rillig Exp $	*/
 # 3 "msg_077.c"
 
 /* Test for message: bad octal digit %c [77] */
@@ -22,4 +22,5 @@ char single_digit = '\8';	/* expect: bad
  * anyway.
  * https://mail-index.netbsd.org/tech-toolchain/2021/03/16/msg003933.html
  */
+/* expect+1: multi-character character constant [294] */
 char several_digits = '\08';
Index: src/tests/usr.bin/xlint/lint1/msg_077.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_077.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_077.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_077.exp:1.3	Tue Jun 29 07:17:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_077.exp	Tue Jun 29 07:23:21 2021
@@ -1 +1,2 @@
 msg_077.c(8): warning: bad octal digit 8 [77]
+msg_077.c(26): warning: multi-character character constant [294]

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.46 src/usr.bin/xlint/lint1/lex.c:1.47
--- src/usr.bin/xlint/lint1/lex.c:1.46	Sun Jun 20 20:32:42 2021
+++ src/usr.bin/xlint/lint1/lex.c	Tue Jun 29 07:23:21 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.46 2021/06/20 20:32:42 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.47 2021/06/29 07:23:21 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.46 2021/06/20 20:32:42 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.47 2021/06/29 07:23:21 rillig Exp $");
 #endif
 
 #include 
@@ -987,10 +987,7 @@ get_escaped_char(int delim)
 			do {
 v = (v << 3) + (c - '0');
 c = inpc();
-			} while (--n > 0 && isdigit(c) && (tflag || c <= '7'));
-			if (tflag && n > 0 && isdigit(c))
-/* bad octal digit %c */
-warning(77, c);
+			} while (--n > 0 && '0' <= c && c <= '7');
 			pbc = c;
 			if (v > TARG_UCHAR_MAX) {
 /* character escape does not fit in character */



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

2021-06-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jun 29 07:17:43 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: lex_char.c lex_char.exp msg_076.c
msg_076.exp msg_077.c msg_077.exp msg_080.c msg_080.exp msg_082.c
msg_250.c msg_250.exp msg_251.c msg_251.exp msg_253.c msg_253.exp
msg_254.c msg_254.exp msg_262.c msg_262.exp msg_263.c msg_263.exp

Log Message:
tests/lint: add tests for the lexical analysis


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/lex_char.c \
src/tests/usr.bin/xlint/lint1/lex_char.exp \
src/tests/usr.bin/xlint/lint1/msg_076.c \
src/tests/usr.bin/xlint/lint1/msg_076.exp \
src/tests/usr.bin/xlint/lint1/msg_077.c \
src/tests/usr.bin/xlint/lint1/msg_077.exp \
src/tests/usr.bin/xlint/lint1/msg_080.c \
src/tests/usr.bin/xlint/lint1/msg_080.exp \
src/tests/usr.bin/xlint/lint1/msg_250.c \
src/tests/usr.bin/xlint/lint1/msg_250.exp \
src/tests/usr.bin/xlint/lint1/msg_251.c \
src/tests/usr.bin/xlint/lint1/msg_251.exp \
src/tests/usr.bin/xlint/lint1/msg_253.c \
src/tests/usr.bin/xlint/lint1/msg_253.exp \
src/tests/usr.bin/xlint/lint1/msg_254.c \
src/tests/usr.bin/xlint/lint1/msg_254.exp \
src/tests/usr.bin/xlint/lint1/msg_262.c \
src/tests/usr.bin/xlint/lint1/msg_262.exp \
src/tests/usr.bin/xlint/lint1/msg_263.c \
src/tests/usr.bin/xlint/lint1/msg_263.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_082.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/lex_char.c
diff -u src/tests/usr.bin/xlint/lint1/lex_char.c:1.2 src/tests/usr.bin/xlint/lint1/lex_char.c:1.3
--- src/tests/usr.bin/xlint/lint1/lex_char.c:1.2	Sun Jun 20 18:23:07 2021
+++ src/tests/usr.bin/xlint/lint1/lex_char.c	Tue Jun 29 07:17:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex_char.c,v 1.2 2021/06/20 18:23:07 rillig Exp $	*/
+/*	$NetBSD: lex_char.c,v 1.3 2021/06/29 07:17:43 rillig Exp $	*/
 # 3 "lex_char.c"
 
 /*
@@ -34,9 +34,27 @@ test(void)
 	/* octal */
 	sink('\177');
 
-	/* newline */
-	sink('\n');
-
 	/* expect+1: empty character constant */
 	sink('');
+
+	/* U+0007 alarm/bell */
+	sink('\a');
+
+	/* U+0008 backspace */
+	sink('\b');
+
+	/* U+0009 horizontal tabulation */
+	sink('\t');
+
+	/* U+000A line feed */
+	sink('\n');
+
+	/* U+000B vertical tabulation */
+	sink('\v');
+
+	/* U+000C form feed */
+	sink('\f');
+
+	/* U+000D carriage return */
+	sink('\r');
 }
Index: src/tests/usr.bin/xlint/lint1/lex_char.exp
diff -u src/tests/usr.bin/xlint/lint1/lex_char.exp:1.2 src/tests/usr.bin/xlint/lint1/lex_char.exp:1.3
--- src/tests/usr.bin/xlint/lint1/lex_char.exp:1.2	Sun Jun 20 18:23:07 2021
+++ src/tests/usr.bin/xlint/lint1/lex_char.exp	Tue Jun 29 07:17:43 2021
@@ -2,4 +2,4 @@ lex_char.c(16): error: empty character c
 lex_char.c(25): warning: multi-character character constant [294]
 lex_char.c(25): warning: conversion of 'int' to 'char' is out of range, arg #1 [295]
 lex_char.c(29): warning: dubious escape \e [79]
-lex_char.c(41): error: empty character constant [73]
+lex_char.c(38): error: empty character constant [73]
Index: src/tests/usr.bin/xlint/lint1/msg_076.c
diff -u src/tests/usr.bin/xlint/lint1/msg_076.c:1.2 src/tests/usr.bin/xlint/lint1/msg_076.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_076.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_076.c	Tue Jun 29 07:17:43 2021
@@ -1,7 +1,6 @@
-/*	$NetBSD: msg_076.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_076.c,v 1.3 2021/06/29 07:17:43 rillig Exp $	*/
 # 3 "msg_076.c"
 
 // Test for message: character escape does not fit in character [76]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+char ch = '\777';		/* expect: [76] */
Index: src/tests/usr.bin/xlint/lint1/msg_076.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_076.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_076.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_076.exp:1.2	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_076.exp	Tue Jun 29 07:17:43 2021
@@ -1 +1 @@
-msg_076.c(6): error: syntax error ':' [249]
+msg_076.c(6): warning: character escape does not fit in character [76]
Index: src/tests/usr.bin/xlint/lint1/msg_077.c
diff -u src/tests/usr.bin/xlint/lint1/msg_077.c:1.2 src/tests/usr.bin/xlint/lint1/msg_077.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_077.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_077.c	Tue Jun 29 07:17:43 2021
@@ -1,7 +1,25 @@
-/*	$NetBSD: msg_077.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_077.c,v 1.3 2021/06/29 07:17:43 rillig Exp $	*/
 # 3 "msg_077.c"
 
-// Test for message: bad octal digit %c [77]
+/* Test for message: bad octal digit %c [77] */
 
-TODO: "Add example code that triggers the above message." 

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

2021-06-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jun 29 06:28:07 UTC 2021

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_cas_8.S

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S:1.7 src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S:1.8
--- src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S:1.7	Tue Mar  4 16:15:28 2014
+++ src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S	Tue Jun 29 06:28:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_cas_8.S,v 1.7 2014/03/04 16:15:28 matt Exp $ */
+/* $NetBSD: atomic_cas_8.S,v 1.8 2021/06/29 06:28:07 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@ ENTRY_NP(_atomic_cas_8)
 	mcr	p15, 0, r3, c7, c10, 4	/* data synchronization barrier */
 #endif
 2:	RET/* return. */
-	END(_atomic_cas_8)
+END(_atomic_cas_8)
 
 ATOMIC_OP_ALIAS(atomic_cas_8,_atomic_cas_8)
 STRONG_ALIAS(_atomic_cas_char,_atomic_cas_8)