CVS commit: src/usr.sbin/catman

2021-08-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 15 11:00:43 UTC 2021

Modified Files:
src/usr.sbin/catman: catman.8

Log Message:
Restore BSD BUGS section


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/catman/catman.8

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/catman/catman.8
diff -u src/usr.sbin/catman/catman.8:1.11 src/usr.sbin/catman/catman.8:1.12
--- src/usr.sbin/catman/catman.8:1.11	Tue Feb 25 05:36:05 2003
+++ src/usr.sbin/catman/catman.8	Sun Aug 15 07:00:43 2021
@@ -27,9 +27,9 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\"	$NetBSD: catman.8,v 1.11 2003/02/25 10:36:05 wiz Exp $
+.\"	$NetBSD: catman.8,v 1.12 2021/08/15 11:00:43 christos Exp $
 .\"
-.Dd July 30, 1993
+.Dd August 15, 2021
 .Dt CATMAN 8
 .Os
 .Sh NAME
@@ -104,3 +104,4 @@ Update manual pages in
 .Xr whatis 1
 .Sh BUGS
 Currently does not handle hard links.
+Acts oddly on nights with full moons.



CVS commit: src/usr.sbin/racoon

2021-08-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 14 17:08:21 UTC 2021

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

Log Message:
One more ldap change


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/racoon/Makefile

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

Modified files:

Index: src/usr.sbin/racoon/Makefile
diff -u src/usr.sbin/racoon/Makefile:1.39 src/usr.sbin/racoon/Makefile:1.40
--- src/usr.sbin/racoon/Makefile:1.39	Mon Apr 12 21:11:05 2021
+++ src/usr.sbin/racoon/Makefile	Sat Aug 14 13:08:21 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.39 2021/04/13 01:11:05 mrg Exp $
+# $NetBSD: Makefile,v 1.40 2021/08/14 17:08:21 christos Exp $
 
 WARNS?=	0	# XXX third-party program, many issues
 NOCLANGERROR=	# defined
@@ -60,8 +60,8 @@ CPPFLAGS+=-DINET6
 
 .if (${USE_LDAP} != "no")
 CPPFLAGS+=-DHAVE_LIBLDAP
-LDADD+=-lldap -llber -lssl
-DPADD+= ${LIBLDAP} ${LIBLBER} ${LIBSSL}
+LDADD+= ${LIBLDAP_LDADD}
+DPADD+= ${LIBLDAP_DPADD}
 .endif
 
 LDADD+= -lcrypto -lcrypt



CVS commit: src/usr.sbin/sysinst

2021-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug 12 09:33:59 UTC 2021

Modified Files:
src/usr.sbin/sysinst: defs.h disks.c upgrade.c

Log Message:
PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.74 -r1.75 src/usr.sbin/sysinst/disks.c
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/sysinst/upgrade.c

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

Modified files:

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.71 src/usr.sbin/sysinst/defs.h:1.72
--- src/usr.sbin/sysinst/defs.h:1.71	Tue Jul 13 09:13:00 2021
+++ src/usr.sbin/sysinst/defs.h	Thu Aug 12 09:33:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.71 2021/07/13 09:13:00 martin Exp $	*/
+/*	$NetBSD: defs.h,v 1.72 2021/08/12 09:33:59 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -713,13 +713,8 @@ void	disp_cur_fspart(int, int);
 int	make_filesystems(struct install_partition_desc *);
 int	make_fstab(struct install_partition_desc *);
 int	mount_disks(struct install_partition_desc *);
-/*
- * set_swap_if_low_ram and set_swap return -1 on error,
- * 0 if no swap was added on purpose and
- * 1 if swap has been added (and needs to be cleared later).
- */
-int	set_swap_if_low_ram(struct install_partition_desc *);
-int	set_swap(struct install_partition_desc *);
+void	set_swap_if_low_ram(struct install_partition_desc *);
+void	set_swap(struct install_partition_desc *);
 void	clear_swap(void);
 int	check_swap(const char *, int);
 char *bootxx_name(struct install_partition_desc *);

Index: src/usr.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.74 src/usr.sbin/sysinst/disks.c:1.75
--- src/usr.sbin/sysinst/disks.c:1.74	Sun Aug  8 21:50:10 2021
+++ src/usr.sbin/sysinst/disks.c	Thu Aug 12 09:33:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.74 2021/08/08 21:50:10 andvar Exp $ */
+/*	$NetBSD: disks.c,v 1.75 2021/08/12 09:33:59 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1921,16 +1921,15 @@ mount_disks(struct install_partition_des
 
 static char swap_dev[PATH_MAX];
 
-int
+void
 set_swap_if_low_ram(struct install_partition_desc *install)
 {
 	swap_dev[0] = 0;
 	if (get_ramsize() <= TINY_RAM_SIZE)
-		return set_swap(install);
-	return 0;
+		set_swap(install);
 }
 
-int
+void
 set_swap(struct install_partition_desc *install)
 {
 	size_t i;
@@ -1942,20 +1941,16 @@ set_swap(struct install_partition_desc *
 			break;
 	}
 	if (i >= install->num)
-		return 0;
+		return;
 
 	if (!install->infos[i].parts->pscheme->get_part_device(
 	install->infos[i].parts, install->infos[i].cur_part_id, swap_dev,
 	sizeof swap_dev, NULL, plain_name, true, true))
-		return -1;
+		return;
 
 	rval = swapctl(SWAP_ON, swap_dev, 0);
-	if (rval != 0) {
+	if (rval != 0)
 		swap_dev[0] = 0;
-		return -1;
-	}
-
-	return 1;
 }
 
 void

Index: src/usr.sbin/sysinst/upgrade.c
diff -u src/usr.sbin/sysinst/upgrade.c:1.17 src/usr.sbin/sysinst/upgrade.c:1.18
--- src/usr.sbin/sysinst/upgrade.c:1.17	Wed Nov  4 14:29:40 2020
+++ src/usr.sbin/sysinst/upgrade.c	Thu Aug 12 09:33:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: upgrade.c,v 1.17 2020/11/04 14:29:40 martin Exp $	*/
+/*	$NetBSD: upgrade.c,v 1.18 2021/08/12 09:33:59 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -81,8 +81,7 @@ do_upgrade(void)
 		install.cur_system = true;
 	}
 
-	if (set_swap_if_low_ram() < 0)
-		return;
+	set_swap_if_low_ram();
 
 	if (md_pre_update() < 0)
 		goto free_install;



CVS commit: src/usr.sbin/perfused

2021-08-08 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Aug  8 20:56:54 UTC 2021

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

Log Message:
perfused: use SOL_LOCAL


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/perfused/perfused.c

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

Modified files:

Index: src/usr.sbin/perfused/perfused.c
diff -u src/usr.sbin/perfused/perfused.c:1.25 src/usr.sbin/perfused/perfused.c:1.26
--- src/usr.sbin/perfused/perfused.c:1.25	Fri Dec 12 09:58:39 2014
+++ src/usr.sbin/perfused/perfused.c	Sun Aug  8 20:56:54 2021
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfused.c,v 1.25 2014/12/12 09:58:39 manu Exp $ */
+/*  $NetBSD: perfused.c,v 1.26 2021/08/08 20:56:54 nia Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -125,7 +125,7 @@ get_mount_info(int fd, struct perfuse_mo
 	 * We do not need peer creds beyond this point
 	 */
 	opt = 0;
-	if (setsockopt(fd, 0, LOCAL_CREDS, , sizeof(opt)) != 0)
+	if (setsockopt(fd, SOL_LOCAL, LOCAL_CREDS, , sizeof(opt)) != 0)
 		DWARN("%s: setsockopt LOCAL_CREDS failed", __func__);
 
 #ifdef PERFUSE_DEBUG



CVS commit: src/usr.sbin/rpc.pcnfsd

2021-08-03 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  3 20:59:20 UTC 2021

Modified Files:
src/usr.sbin/rpc.pcnfsd: common.h

Log Message:
s/pasword/password/


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/rpc.pcnfsd/common.h

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/rpc.pcnfsd/common.h
diff -u src/usr.sbin/rpc.pcnfsd/common.h:1.2 src/usr.sbin/rpc.pcnfsd/common.h:1.3
--- src/usr.sbin/rpc.pcnfsd/common.h:1.2	Tue Jul 25 22:20:26 1995
+++ src/usr.sbin/rpc.pcnfsd/common.h	Tue Aug  3 20:59:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: common.h,v 1.2 1995/07/25 22:20:26 gwr Exp $	*/
+/*	$NetBSD: common.h,v 1.3 2021/08/03 20:59:20 andvar Exp $	*/
 
 /* RE_SID: @(%)/usr/dosnfs/shades_SCCS/unix/pcnfsd/v2/src/SCCS/s.common.h 1.3 91/12/17 14:32:05 SMI */
 /*
@@ -89,7 +89,7 @@
 **-
 ** Define (via Makefile) the following symbol to use a cache of recently-used
 ** user names. This has certain uses in university and other settings
-** where (1) the pasword file is very large, and (2) a group of users
+** where (1) the password file is very large, and (2) a group of users
 ** frequently logs in together using the same account (for example,
 ** a class userid).
 **-
@@ -132,7 +132,7 @@
 ** to determine if a password entry contains a legal shell (and therefore
 ** identifies a user who may log in). The default is to check that
 ** the last two characters of the shell field are "sh", which should
-** cope with "sh", "csh", "ksh", "bash" See the routine get_pasword()
+** cope with "sh", "csh", "ksh", "bash" See the routine get_password()
 ** in pcnfsd_misc.c for more details.
 **
 ** Note: For some reason that I haven't yet figured out, getusershell()



CVS commit: src/usr.sbin/sysinst

2021-08-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  3 13:40:33 UTC 2021

Modified Files:
src/usr.sbin/sysinst: util.c

Log Message:
Cleanup alarm(3) handling in the timezone selection menu for error
cases, pointed out by RVP.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/sysinst/util.c

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

Modified files:

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.58 src/usr.sbin/sysinst/util.c:1.59
--- src/usr.sbin/sysinst/util.c:1.58	Tue Jul 20 16:40:12 2021
+++ src/usr.sbin/sysinst/util.c	Tue Aug  3 13:40:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.58 2021/07/20 16:40:12 martin Exp $	*/
+/*	$NetBSD: util.c,v 1.59 2021/08/03 13:40:33 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1881,25 +1881,26 @@ set_timezone(void)
 			   tzm_set_names, NULL, NULL,
 			   "\nPlease consult the install documents.",
 			   MSG_exit_menu_generic);
-	if (menu_no < 0)
-		goto done;	/* error - skip timezone setting */
+	if (menu_no >= 0) {
+		time_menu = menu_no;
+		process_menu(menu_no, NULL);
+		time_menu = -1;
 
-	time_menu = menu_no;
-	process_menu(menu_no, NULL);
-	time_menu = -1;
-
-	free_menu(menu_no);
+		free_menu(menu_no);
+	}
 
+	alarm(0);
 	signal(SIGALRM, SIG_IGN);
 
-	snprintf(localtime_target, sizeof(localtime_target),
-		 "/usr/share/zoneinfo/%s", tz_selected);
-	strlcpy(localtime_link, target_expand("/etc/localtime"),
-	sizeof localtime_link);
-	unlink(localtime_link);
-	symlink(localtime_target, localtime_link);
+	if (menu_no >= 0) {
+		snprintf(localtime_target, sizeof(localtime_target),
+			 "/usr/share/zoneinfo/%s", tz_selected);
+		strlcpy(localtime_link, target_expand("/etc/localtime"),
+		sizeof localtime_link);
+		unlink(localtime_link);
+		symlink(localtime_target, localtime_link);
+	}
 
-done:
 	return 1;
 }
 



CVS commit: src/usr.sbin/sysinst

2021-08-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  3 13:34:04 UTC 2021

Modified Files:
src/usr.sbin/sysinst: run.c

Log Message:
When reading output from a program we don't know how much it will
be - so scale the buffer (within reasonable limits).
Problem pointed out by RVP, triggered e.g. by disks with lots of GPT
partitions.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/sysinst/run.c

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

Modified files:

Index: src/usr.sbin/sysinst/run.c
diff -u src/usr.sbin/sysinst/run.c:1.13 src/usr.sbin/sysinst/run.c:1.14
--- src/usr.sbin/sysinst/run.c:1.13	Sat Nov 16 20:26:59 2019
+++ src/usr.sbin/sysinst/run.c	Tue Aug  3 13:34:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: run.c,v 1.13 2019/11/16 20:26:59 martin Exp $	*/
+/*	$NetBSD: run.c,v 1.14 2021/08/03 13:34:04 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -176,6 +176,7 @@ collect(int kind, char **buffer, const c
 {
 	size_t nbytes;		/* Number of bytes in buffer. */
 	size_t fbytes;		/* Number of bytes in file. */
+	size_t abytes;		/* allocated size of buffer */
 	struct stat st;		/* stat information. */
 	int ch;
 	FILE *f;
@@ -198,6 +199,9 @@ collect(int kind, char **buffer, const c
 		/* Open the file. */
 		f = fopen(fileorcmd, "r");
 		if (f == NULL) {
+			if (logfp)
+fprintf(logfp, "%s: failed to open %s\n",
+__func__, fileorcmd);
 			*buffer = NULL;
 			return -1;
 		}
@@ -205,25 +209,47 @@ collect(int kind, char **buffer, const c
 		/* Open the program. */
 		f = popen(fileorcmd, "r");
 		if (f == NULL) {
+			if (logfp)
+fprintf(logfp, "%s: failed to open %s\n",
+__func__, fileorcmd);
 			*buffer = NULL;
 			return -1;
 		}
-		fbytes = BUFSIZE;
+		fbytes = 0;
 	}
 
 	if (fbytes == 0)
-		fbytes = BUFSIZE;
+		abytes = BUFSIZE;
+	else
+		abytes = fbytes+1;
 
 	/* Allocate the buffer size. */
-	*buffer = cp = malloc(fbytes + 1);
+	*buffer = cp = malloc(abytes);
 	if (!cp)
 		nbytes =  -1;
 	else {
 		/* Read the buffer. */
 		nbytes = 0;
-		while (nbytes < fbytes && (ch = fgetc(f)) != EOF)
+		while ((ch = fgetc(f)) != EOF) {
+			if (nbytes >= abytes-1) {
+if (fbytes > 0 || abytes >= 512*BUFSIZE) {
+	free(cp);
+	*buffer = cp = NULL;
+	nbytes = -1;
+	break;
+}
+abytes *= 2;
+*buffer = cp = realloc(cp, abytes);
+if (!cp) {
+	nbytes =  -1;
+	break;
+}
+
+			}
 			cp[nbytes++] = ch;
-		cp[nbytes] = 0;
+		}
+		if (cp)
+			cp[nbytes] = 0;
 	}
 
 	if (kind == T_FILE)
@@ -231,6 +257,9 @@ collect(int kind, char **buffer, const c
 	else
 		pclose(f);
 
+	if (nbytes <= 0 && logfp)
+		fprintf(logfp, "%s: failed for %s\n", __func__, fileorcmd);
+
 	return nbytes;
 }
 



CVS commit: src/usr.sbin/diskpart

2021-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  1 18:02:22 UTC 2021

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

Log Message:
fix typo in definition: s/threshhold/threshold/


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/diskpart/diskpart.c

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

Modified files:

Index: src/usr.sbin/diskpart/diskpart.c
diff -u src/usr.sbin/diskpart/diskpart.c:1.20 src/usr.sbin/diskpart/diskpart.c:1.21
--- src/usr.sbin/diskpart/diskpart.c:1.20	Fri Jan  2 19:46:02 2015
+++ src/usr.sbin/diskpart/diskpart.c	Sun Aug  1 18:02:22 2021
@@ -37,7 +37,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "from: @(#)diskpart.c	8.3 (Berkeley) 11/30/94";
 #else
-__RCSID("$NetBSD: diskpart.c,v 1.20 2015/01/02 19:46:02 christos Exp $");
+__RCSID("$NetBSD: diskpart.c,v 1.21 2021/08/01 18:02:22 andvar Exp $");
 #endif
 #endif /* not lint */
 
@@ -123,7 +123,7 @@ main(int argc, char *argv[])
 	struct disklabel *dp;
 	int spc, def, part, layout, j, ch;
 	uint32_t curcyl;
-	int threshhold, numcyls[NPARTITIONS], startcyl[NPARTITIONS];
+	int threshold, numcyls[NPARTITIONS], startcyl[NPARTITIONS];
 	off_t totsize = 0;
 	const char *tyname;
 	char *lp;
@@ -185,10 +185,10 @@ main(int argc, char *argv[])
 	totsize == 0) {
 		badsecttable = dp->d_nsectors +
 		roundup(badsecttable, dp->d_nsectors);
-		threshhold = howmany(spc, badsecttable);
+		threshold = howmany(spc, badsecttable);
 	} else {
 		badsecttable = 0;
-		threshhold = 0;
+		threshold = 0;
 	}
 	/*
 	 * If disk size was specified, recompute number of cylinders
@@ -210,7 +210,7 @@ main(int argc, char *argv[])
 		curcyl = 0;
 		for (part = PART('a'); part < NPARTITIONS; part++)
 			curcyl += howmany(defpart[def][part], spc);
-		if (curcyl < dp->d_ncylinders - threshhold)
+		if (curcyl < dp->d_ncylinders - threshold)
 			break;
 	}
 	if (def >= NDEFAULTS) {



CVS commit: src/usr.sbin/altq/altqstat

2021-07-21 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 21 06:48:28 UTC 2021

Modified Files:
src/usr.sbin/altq/altqstat: qdisc_cbq.c

Log Message:
altqstat, cbq: follow uint64_t changes

PR kern/56319


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/altq/altqstat/qdisc_cbq.c

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

Modified files:

Index: src/usr.sbin/altq/altqstat/qdisc_cbq.c
diff -u src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.10 src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.11
--- src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.10	Wed Jul 21 06:45:10 2021
+++ src/usr.sbin/altq/altqstat/qdisc_cbq.c	Wed Jul 21 06:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: qdisc_cbq.c,v 1.10 2021/07/21 06:45:10 ozaki-r Exp $	*/
+/*	$NetBSD: qdisc_cbq.c,v 1.11 2021/07/21 06:48:28 ozaki-r Exp $	*/
 /*	$KAME: qdisc_cbq.c,v 1.7 2003/09/17 14:27:37 kjc Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -105,9 +105,9 @@ cbq_stat_loop(int fd, const char *ifname
 
 			printf("\tpriority: %d depth: %d",
 			   sp->priority, sp->depth);
-			printf(" offtime: %ld [ns] wrr_allot: %d bytes\n",
+			printf(" offtime: %"PRIi64" [ns] wrr_allot: %d bytes\n",
 			   sp->offtime, sp->wrr_allot);
-			printf("\tpsPerByte: %ld", sp->ps_per_byte);
+			printf("\tpsPerByte: %"PRIu64, sp->ps_per_byte);
 			printf("\t(%sbps)", rate2str(flow_bps));
 			if (lp->handle != NULL_CLASS_HANDLE) {
 printf(",\tMeasured: %s [bps]\n",
@@ -139,7 +139,7 @@ cbq_stat_loop(int fd, const char *ifname
 			   sp->maxidle >> RM_FILTER_GAIN,
 			   sp->minidle / RM_POWER);
 #else
-			printf("\tAvgIdle: %ld [ns],\t(maxidle: %ld minidle: %ld [ns])\n",
+			printf("\tAvgIdle: %"PRIi64" [ns],\t(maxidle: %"PRIi64" minidle: %"PRIi64" [ns])\n",
 			   sp->avgidle, sp->maxidle, sp->minidle);
 #endif
 		}



CVS commit: src/usr.sbin/altq/altqstat

2021-07-21 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 21 06:45:10 UTC 2021

Modified Files:
src/usr.sbin/altq/altqstat: qdisc_cbq.c

Log Message:
altqstat: follow changes of types of variables

PR kern/56319


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/altq/altqstat/qdisc_cbq.c

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

Modified files:

Index: src/usr.sbin/altq/altqstat/qdisc_cbq.c
diff -u src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.9 src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.10
--- src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.9	Wed Jul 21 06:42:07 2021
+++ src/usr.sbin/altq/altqstat/qdisc_cbq.c	Wed Jul 21 06:45:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: qdisc_cbq.c,v 1.9 2021/07/21 06:42:07 ozaki-r Exp $	*/
+/*	$NetBSD: qdisc_cbq.c,v 1.10 2021/07/21 06:45:10 ozaki-r Exp $	*/
 /*	$KAME: qdisc_cbq.c,v 1.7 2003/09/17 14:27:37 kjc Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -105,7 +105,7 @@ cbq_stat_loop(int fd, const char *ifname
 
 			printf("\tpriority: %d depth: %d",
 			   sp->priority, sp->depth);
-			printf(" offtime: %d [us] wrr_allot: %d bytes\n",
+			printf(" offtime: %ld [ns] wrr_allot: %d bytes\n",
 			   sp->offtime, sp->wrr_allot);
 			printf("\tpsPerByte: %ld", sp->ps_per_byte);
 			printf("\t(%sbps)", rate2str(flow_bps));
@@ -139,7 +139,7 @@ cbq_stat_loop(int fd, const char *ifname
 			   sp->maxidle >> RM_FILTER_GAIN,
 			   sp->minidle / RM_POWER);
 #else
-			printf("\tAvgIdle: %d [us],\t(maxidle: %d minidle: %d [us])\n",
+			printf("\tAvgIdle: %ld [ns],\t(maxidle: %ld minidle: %ld [ns])\n",
 			   sp->avgidle, sp->maxidle, sp->minidle);
 #endif
 		}



CVS commit: src/usr.sbin/altq/altqstat

2021-07-21 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 21 06:42:07 UTC 2021

Modified Files:
src/usr.sbin/altq/altqstat: qdisc_cbq.c

Log Message:
altqstat: show raw values of avgidle, maxidle and minidle

The values are sometimes small and cooked values of them can be less
informative such as 0 or -1.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/altq/altqstat/qdisc_cbq.c

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

Modified files:

Index: src/usr.sbin/altq/altqstat/qdisc_cbq.c
diff -u src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.8 src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.9
--- src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.8	Wed Jul 21 06:38:57 2021
+++ src/usr.sbin/altq/altqstat/qdisc_cbq.c	Wed Jul 21 06:42:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: qdisc_cbq.c,v 1.8 2021/07/21 06:38:57 ozaki-r Exp $	*/
+/*	$NetBSD: qdisc_cbq.c,v 1.9 2021/07/21 06:42:07 ozaki-r Exp $	*/
 /*	$KAME: qdisc_cbq.c,v 1.7 2003/09/17 14:27:37 kjc Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -133,10 +133,15 @@ cbq_stat_loop(int fd, const char *ifname
 
 			printf("\tQCount: %d,\t(qmax: %d)\n",
 			   sp->qcnt, sp->qmax);
+#if 0
 			printf("\tAvgIdle: %d [us],\t(maxidle: %d minidle: %d [us])\n",
 			   sp->avgidle >> RM_FILTER_GAIN,
 			   sp->maxidle >> RM_FILTER_GAIN,
 			   sp->minidle / RM_POWER);
+#else
+			printf("\tAvgIdle: %d [us],\t(maxidle: %d minidle: %d [us])\n",
+			   sp->avgidle, sp->maxidle, sp->minidle);
+#endif
 		}
 
 		/* swap the buffer pointers */



CVS commit: src/usr.sbin/altq/altqstat

2021-07-21 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 21 06:38:57 UTC 2021

Modified Files:
src/usr.sbin/altq/altqstat: qdisc_cbq.c

Log Message:
altqstat: adopt ps_per_byte

PR kern/56319


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/altq/altqstat/qdisc_cbq.c

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

Modified files:

Index: src/usr.sbin/altq/altqstat/qdisc_cbq.c
diff -u src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.7 src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.8
--- src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.7	Sat Oct 28 11:43:02 2006
+++ src/usr.sbin/altq/altqstat/qdisc_cbq.c	Wed Jul 21 06:38:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: qdisc_cbq.c,v 1.7 2006/10/28 11:43:02 peter Exp $	*/
+/*	$NetBSD: qdisc_cbq.c,v 1.8 2021/07/21 06:38:57 ozaki-r Exp $	*/
 /*	$KAME: qdisc_cbq.c,v 1.7 2003/09/17 14:27:37 kjc Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -100,14 +100,14 @@ cbq_stat_loop(int fd, const char *ifname
 			printf("Class %d on Interface %s: %s\n",
 			sp->handle, ifname, clnames[i]);
 
-			flow_bps = 8.0 / (double)sp->ns_per_byte
-			* 1000*1000*1000;
+			flow_bps = 8.0 / (double)sp->ps_per_byte
+			* 1000*1000*1000*1000;
 
 			printf("\tpriority: %d depth: %d",
 			   sp->priority, sp->depth);
 			printf(" offtime: %d [us] wrr_allot: %d bytes\n",
 			   sp->offtime, sp->wrr_allot);
-			printf("\tnsPerByte: %d", sp->ns_per_byte);
+			printf("\tpsPerByte: %ld", sp->ps_per_byte);
 			printf("\t(%sbps)", rate2str(flow_bps));
 			if (lp->handle != NULL_CLASS_HANDLE) {
 printf(",\tMeasured: %s [bps]\n",



CVS commit: src/usr.sbin/altq/libaltq

2021-07-21 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 21 06:36:33 UTC 2021

Modified Files:
src/usr.sbin/altq/libaltq: qop_cbq.c qop_cbq.h

Log Message:
libaltq, cbq: convert ns_per_byte to ps_per_byte

PR kern/56319


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/altq/libaltq/qop_cbq.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/altq/libaltq/qop_cbq.h

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/altq/libaltq/qop_cbq.c
diff -u src/usr.sbin/altq/libaltq/qop_cbq.c:1.11 src/usr.sbin/altq/libaltq/qop_cbq.c:1.12
--- src/usr.sbin/altq/libaltq/qop_cbq.c:1.11	Wed Jul 14 08:32:13 2021
+++ src/usr.sbin/altq/libaltq/qop_cbq.c	Wed Jul 21 06:36:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: qop_cbq.c,v 1.11 2021/07/14 08:32:13 ozaki-r Exp $	*/
+/*	$NetBSD: qop_cbq.c,v 1.12 2021/07/21 06:36:33 ozaki-r Exp $	*/
 /*	$KAME: qop_cbq.c,v 1.7 2002/05/31 06:03:35 kjc Exp $	*/
 /*
  * Copyright (c) Sun Microsystems, Inc. 1993-1998 All rights reserved.
@@ -78,8 +78,12 @@ static int cbq_delete_filter(struct fltr
 #define CTL_PBANDWIDTH	2
 #define NS_PER_MS	(100.0)
 #define NS_PER_SEC	(NS_PER_MS*1000.0)
+#define PS_PER_MS	(10.0)
+#define PS_PER_SEC	(PS_PER_MS*1000.0)
 #define RM_FILTER_GAIN	5
 
+#define PSEC_TO_USEC(ps)	((ps) / 1000.0 / 1000.0)
+
 #define CBQ_DEVICE	"/dev/altq/cbq"
 
 static int cbq_fd = -1;
@@ -484,8 +488,8 @@ qop_cbq_add_if(struct ifinfo **rp, const
 	if ((cbq_ifinfo = calloc(1, sizeof(*cbq_ifinfo))) == NULL)
 		return (QOPERR_NOMEM);
 
-	cbq_ifinfo->nsPerByte =
-		(1.0 / (double)bandwidth) * NS_PER_SEC * 8;
+	cbq_ifinfo->psPerByte =
+		(1.0 / (double)bandwidth) * PS_PER_SEC * 8;
 	cbq_ifinfo->is_wrr = is_wrr;
 	cbq_ifinfo->is_efficient = efficient;
 	cbq_ifinfo->no_control = no_control;
@@ -768,7 +772,7 @@ cbq_class_spec(struct ifinfo *ifinfo, u_
 {
 	struct cbq_ifinfo *cbq_ifinfo = ifinfo->private;
 	double  maxq, maxidle_s, maxidle, minidle,
-			lofftime, nsPerByte, ptime, cptime;
+			lofftime, psPerByte, ptime, cptime;
 	double		z = (double)(1 << RM_FILTER_GAIN);
 	double  g = (1.0 - 1.0 / z);
 	double  f;
@@ -792,22 +796,12 @@ cbq_class_spec(struct ifinfo *ifinfo, u_
 	else if (max_pkt_size > ifinfo->ifmtu)
 		max_pkt_size = ifinfo->ifmtu;
 
-nsPerByte = cbq_ifinfo->nsPerByte / f;
-	ptime = (double) av_pkt_size * (double)cbq_ifinfo->nsPerByte;
+psPerByte = cbq_ifinfo->psPerByte / f;
+	ptime = (double) av_pkt_size * (double)cbq_ifinfo->psPerByte;
 	cptime = ptime * (1.0 - f) / f;
-#if 1 /* ALTQ */
-	if (nsPerByte * (double)max_pkt_size > (double)INT_MAX) {
-		/*
-		 * this causes integer overflow in kernel!
-		 * (bandwidth < 6Kbps when max_pkt_size=1500)
-		 */
-		if (bandwidth != 0)
-			LOG(LOG_WARNING, 0, "warning: class is too slow!!");
-		nsPerByte = (double)(INT_MAX / max_pkt_size);
-	}
-#endif
+
 	if (maxburst == 0) {  /* use default */
-		if (cptime > 10.0 * NS_PER_MS)
+		if (cptime > 10.0 * PS_PER_MS)
 			maxburst = 4;
 		else
 			maxburst = 16;
@@ -823,9 +817,9 @@ cbq_class_spec(struct ifinfo *ifinfo, u_
 		"cbq_flowspec: maxburst=%d,minburst=%d,pkt_size=%d",
 		maxburst, minburst, av_pkt_size);
 		LOG(LOG_DEBUG, 0,
-		"  nsPerByte=%.2f ns, link's nsPerByte=%.2f, f=%.3f",
-		nsPerByte, cbq_ifinfo->nsPerByte, f);
-		packet_time = av_pkt_size * (int)nsPerByte / 1000;
+		"  psPerByte=%.2f ps, link's psPerByte=%.2f, f=%.3f",
+		psPerByte, cbq_ifinfo->psPerByte, f);
+		packet_time = av_pkt_size * (int)PSEC_TO_USEC(psPerByte);
 		LOG(LOG_DEBUG, 0,
 		"  packet time=%d [us]\n", packet_time);
 		if (maxburst * packet_time < 2) {
@@ -845,21 +839,21 @@ cbq_class_spec(struct ifinfo *ifinfo, u_
 	else
 		maxidle = ptime * maxidle_s;
 	if (IsDebug(DEBUG_ALTQ))
-		LOG(LOG_DEBUG, 0, "  maxidle=%.2f us", maxidle/1000.0);
+		LOG(LOG_DEBUG, 0, "  maxidle=%.2f us", PSEC_TO_USEC(maxidle));
 	if (minburst)
 		lofftime = cptime * (1.0 + 1.0/(1.0 - g) * (1.0 - gtom) / gtom);
 	else
 		lofftime = cptime;
-	minidle = -((double)max_pkt_size * (double)nsPerByte);
+	minidle = -((double)max_pkt_size * (double)psPerByte);
 	if (IsDebug(DEBUG_ALTQ))
 		LOG(LOG_DEBUG, 0, "  lofftime=%.2f us minidle=%.2f us",
-		lofftime/1000.0, minidle/1000.0);
+		PSEC_TO_USEC(lofftime), PSEC_TO_USEC(minidle));
 
-	maxidle = ((maxidle * 8.0) / nsPerByte) * pow(2, RM_FILTER_GAIN);
+	maxidle = ((maxidle * 8.0) / psPerByte) * pow(2, RM_FILTER_GAIN);
 #if 1 /* ALTQ */
 	/* also scale lofftime and minidle */
- 	lofftime = (lofftime * 8.0) / nsPerByte * pow(2, RM_FILTER_GAIN);
-	minidle = ((minidle * 8.0) / nsPerByte) * pow(2, RM_FILTER_GAIN);
+	lofftime = (lofftime * 8.0) / psPerByte * pow(2, RM_FILTER_GAIN);
+	minidle = ((minidle * 8.0) / psPerByte) * pow(2, RM_FILTER_GAIN);
 #endif
 	maxidle = maxidle / 1000.0;
 	lofftime = lofftime / 1000.0;
@@ -872,7 +866,7 @@ cbq_class_spec(struct ifinfo *ifinfo, u_
 		else
 			maxq = 

CVS commit: src/usr.sbin/sysinst

2021-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 20 16:41:27 UTC 2021

Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c

Log Message:
PR 56303: do not borrow from the default swap allocation if we are in
tiny ram conditions and will need to enable swap early.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/sysinst/bsddisklabel.c

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

Modified files:

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.58 src/usr.sbin/sysinst/bsddisklabel.c:1.59
--- src/usr.sbin/sysinst/bsddisklabel.c:1.58	Sat Feb 13 15:31:35 2021
+++ src/usr.sbin/sysinst/bsddisklabel.c	Tue Jul 20 16:41:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.58 2021/02/13 15:31:35 martin Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.59 2021/07/20 16:41:27 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1153,7 +1153,8 @@ fill_defaults(struct partition_usage_set
 			continue;
 		free_space -= wanted->infos[i].size;
 	}
-	if (free_space < 0 && swap < wanted->num) {
+	if (free_space < 0 && swap < wanted->num &&
+	get_ramsize() > TINY_RAM_SIZE) {
 		/* steel from swap partition */
 		daddr_t d = wanted->infos[swap].size;
 		daddr_t inc = roundup(-free_space, align);



CVS commit: src/usr.sbin/sysinst

2021-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 20 16:40:12 UTC 2021

Modified Files:
src/usr.sbin/sysinst: util.c

Log Message:
RAM size will not change during installation, do the sysctl() dance
only once.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/sysinst/util.c

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

Modified files:

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.57 src/usr.sbin/sysinst/util.c:1.58
--- src/usr.sbin/sysinst/util.c:1.57	Sun Jan 31 22:45:47 2021
+++ src/usr.sbin/sysinst/util.c	Tue Jul 20 16:40:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.57 2021/01/31 22:45:47 rillig Exp $	*/
+/*	$NetBSD: util.c,v 1.58 2021/07/20 16:40:12 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -264,11 +264,14 @@ file_mode_match(const char *path, unsign
 uint64_t
 get_ramsize(void)
 {
-	uint64_t ramsize;
-	size_t len = sizeof ramsize;
-	int mib[2] = {CTL_HW, HW_PHYSMEM64};
+	static uint64_t ramsize;
 
-	sysctl(mib, 2, , , NULL, 0);
+	if (ramsize == 0) {
+		size_t len = sizeof ramsize;
+		int mib[2] = {CTL_HW, HW_PHYSMEM64};
+
+		sysctl(mib, 2, , , NULL, 0);
+	}
 
 	/* Find out how many Megs ... round up. */
 	return (ramsize + MEG - 1) / MEG;



CVS commit: src/usr.sbin/sysinst

2021-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 17 19:27:23 UTC 2021

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

Log Message:
Use strlcpy() to copy the wedge device name (the code still assumes
the string is short enough and 0 terminated, but now gcc is happy).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/sysinst/gpt.c

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

Modified files:

Index: src/usr.sbin/sysinst/gpt.c
diff -u src/usr.sbin/sysinst/gpt.c:1.25 src/usr.sbin/sysinst/gpt.c:1.26
--- src/usr.sbin/sysinst/gpt.c:1.25	Sat Jul 17 18:07:22 2021
+++ src/usr.sbin/sysinst/gpt.c	Sat Jul 17 19:27:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt.c,v 1.25 2021/07/17 18:07:22 martin Exp $	*/
+/*	$NetBSD: gpt.c,v 1.26 2021/07/17 19:27:22 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -1380,7 +1380,7 @@ gpt_sanitize(int diskfd, const struct gp
 		if (found)
 			continue;
 		memset(, 0, sizeof(delw));
-		strncpy(delw.dkw_devname, devname, sizeof(delw.dkw_devname));
+		strlcpy(delw.dkw_devname, devname, sizeof(delw.dkw_devname));
 		(void)ioctl(diskfd, DIOCDWEDGE, );
 	}
 



CVS commit: src/usr.sbin/sysinst

2021-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 17 18:07:23 UTC 2021

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

Log Message:
PR 56310: if we fail to create a wedge this either means there is
a bug here (and we requested something nonsensial), or there are pre-
existing "foreign" wedges which disturb our work.
So remove all wedges on this disk that we do not know about and retry
to add our new wedge.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/sysinst/gpt.c

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

Modified files:

Index: src/usr.sbin/sysinst/gpt.c
diff -u src/usr.sbin/sysinst/gpt.c:1.24 src/usr.sbin/sysinst/gpt.c:1.25
--- src/usr.sbin/sysinst/gpt.c:1.24	Sat Jul 17 11:32:50 2021
+++ src/usr.sbin/sysinst/gpt.c	Sat Jul 17 18:07:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt.c,v 1.24 2021/07/17 11:32:50 martin Exp $	*/
+/*	$NetBSD: gpt.c,v 1.25 2021/07/17 18:07:22 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
 #include "md.h"
 #include "gpt_uuid.h"
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1325,8 +1326,71 @@ bsdlabel_fstype_to_str(uint8_t fstype)
 	return (str);
 }
 
+/*
+ * diskfd is an open file descriptor for a disk we had trouble with
+ * creating some new wedges.
+ * Go through all wedges actually on that disk, check if we have a
+ * record for them and remove all others.
+ * This should sync our internal model of partitions with the real state.
+ */
+static void
+gpt_sanitize(int diskfd, const struct gpt_disk_partitions *parts,
+struct gpt_part_entry *ignore)
+{
+	struct dkwedge_info *dkw, delw;
+	struct dkwedge_list dkwl;
+	size_t bufsize;
+	u_int i;
+
+	dkw = NULL;
+	dkwl.dkwl_buf = dkw;
+	dkwl.dkwl_bufsize = 0;
+
+	/* get a list of all wedges */
+	for (;;) {
+		if (ioctl(diskfd, DIOCLWEDGES, ) == -1)
+			return;
+		if (dkwl.dkwl_nwedges == dkwl.dkwl_ncopied)
+			break;
+		bufsize = dkwl.dkwl_nwedges * sizeof(*dkw);
+		if (dkwl.dkwl_bufsize < bufsize) {
+			dkw = realloc(dkwl.dkwl_buf, bufsize);
+			if (dkw == NULL)
+return;
+			dkwl.dkwl_buf = dkw;
+			dkwl.dkwl_bufsize = bufsize;
+		}
+	}
+
+	/* try to remove all the ones we do not know about */
+	for (i = 0; i < dkwl.dkwl_nwedges; i++) {
+		bool found = false;
+		const char *devname = dkw[i].dkw_devname;
+
+		for (struct gpt_part_entry *pe = parts->partitions;
+		pe != NULL; pe = pe->gp_next) {
+			if (pe == ignore)
+continue;
+			if ((pe->gp_flags & GPEF_WEDGE) &&
+			strcmp(pe->gp_dev_name, devname) == 0) {
+found = true;
+break;
+			}
+		}
+		if (found)
+			continue;
+		memset(, 0, sizeof(delw));
+		strncpy(delw.dkw_devname, devname, sizeof(delw.dkw_devname));
+		(void)ioctl(diskfd, DIOCDWEDGE, );
+	}
+
+	/* cleanup */
+	free(dkw);
+}
+
 static bool
-gpt_add_wedge(const char *disk, struct gpt_part_entry *p)
+gpt_add_wedge(const char *disk, struct gpt_part_entry *p,
+const struct gpt_disk_partitions *parts)
 {
 	struct dkwedge_info dkw;
 	const char *tname;
@@ -1355,9 +1419,16 @@ gpt_add_wedge(const char *disk, struct g
 	if (fd < 0)
 		return false;
 	if (ioctl(fd, DIOCAWEDGE, ) == -1) {
+		if (errno == EINVAL) {
+			/* sanitize existing wedges and try again */
+			gpt_sanitize(fd, parts, p);
+			if (ioctl(fd, DIOCAWEDGE, ) == 0)
+goto ok;
+		}
 		close(fd);
 		return false;
 	}
+ok:
 	close(fd);
 
 	strlcpy(p->gp_dev_name, dkw.dkw_devname, sizeof(p->gp_dev_name));
@@ -1405,10 +1476,8 @@ gpt_get_part_device(const struct disk_pa
 	if (usage == plain_name || usage == raw_dev_name)
 		life = true;
 	if (!(p->gp_flags & GPEF_WEDGE) && life &&
-	!gpt_add_wedge(arg->disk, p)) {
-		devname[0] = 0;
+	!gpt_add_wedge(arg->disk, p, parts))
 		return false;
-	}
 
 	switch (usage) {
 	case logical_name:



CVS commit: src/usr.sbin/sysinst

2021-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 17 11:32:50 UTC 2021

Modified Files:
src/usr.sbin/sysinst: gpt.c partman.c

Log Message:
PR 56310: avoid assert() failures (or crashes) when the runtime addition
of a wedge fails (for whatever reasons).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/sysinst/gpt.c
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/sysinst/partman.c

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

Modified files:

Index: src/usr.sbin/sysinst/gpt.c
diff -u src/usr.sbin/sysinst/gpt.c:1.23 src/usr.sbin/sysinst/gpt.c:1.24
--- src/usr.sbin/sysinst/gpt.c:1.23	Sun Jan 31 22:45:46 2021
+++ src/usr.sbin/sysinst/gpt.c	Sat Jul 17 11:32:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt.c,v 1.23 2021/01/31 22:45:46 rillig Exp $	*/
+/*	$NetBSD: gpt.c,v 1.24 2021/07/17 11:32:50 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -1404,8 +1404,11 @@ gpt_get_part_device(const struct disk_pa
 		usage = plain_name;
 	if (usage == plain_name || usage == raw_dev_name)
 		life = true;
-	if (!(p->gp_flags & GPEF_WEDGE) && life)
-		gpt_add_wedge(arg->disk, p);
+	if (!(p->gp_flags & GPEF_WEDGE) && life &&
+	!gpt_add_wedge(arg->disk, p)) {
+		devname[0] = 0;
+		return false;
+	}
 
 	switch (usage) {
 	case logical_name:

Index: src/usr.sbin/sysinst/partman.c
diff -u src/usr.sbin/sysinst/partman.c:1.51 src/usr.sbin/sysinst/partman.c:1.52
--- src/usr.sbin/sysinst/partman.c:1.51	Sun Jan 31 22:45:46 2021
+++ src/usr.sbin/sysinst/partman.c	Sat Jul 17 11:32:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: partman.c,v 1.51 2021/01/31 22:45:46 rillig Exp $ */
+/*	$NetBSD: partman.c,v 1.52 2021/07/17 11:32:50 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -2847,13 +2847,13 @@ pm_menufmt(menudesc *m, int opt, void *a
 dev_status);
 			break;
 		case PM_PART:
-			if (parts->pscheme->get_part_device != NULL)
-parts->pscheme->get_part_device(
-parts,  part_num,
-dev, sizeof dev, NULL, plain_name, false,
-true);
-			else
-strcpy(dev, "-");
+			if (parts->pscheme->get_part_device == NULL ||
+			!parts->pscheme->get_part_device(
+parts,  part_num,
+dev, sizeof dev, NULL, plain_name, false,
+true))
+	strcpy(dev, "-");
+
 			parts->pscheme->get_part_info(parts,
 			part_num, );
 			if (pm_cur->mounted != NULL &&



CVS commit: src/usr.sbin/sysinst

2021-07-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 14 18:56:05 UTC 2021

Modified Files:
src/usr.sbin/sysinst: disks.c

Log Message:
When converting partitions from one scheme to another, never fail
without providing (if requested) a proper error message.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/usr.sbin/sysinst/disks.c

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

Modified files:

Index: src/usr.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.72 src/usr.sbin/sysinst/disks.c:1.73
--- src/usr.sbin/sysinst/disks.c:1.72	Sun Jan 31 22:45:46 2021
+++ src/usr.sbin/sysinst/disks.c	Wed Jul 14 18:56:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.72 2021/01/31 22:45:46 rillig Exp $ */
+/*	$NetBSD: disks.c,v 1.73 2021/07/14 18:56:05 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -754,17 +754,23 @@ convert_scheme(struct pm_devs *p, bool i
 	new_scheme = select_part_scheme(p, old_parts->pscheme,
 	false, MSG_select_other_partscheme);
 
-	if (new_scheme == NULL)
+	if (new_scheme == NULL) {
+		if (err_msg)
+			*err_msg = INTERNAL_ERROR;
 		return false;
+	}
 
 	new_parts = new_scheme->create_new_for_disk(p->diskdev,
 	0, p->dlsize, is_boot_drive, NULL);
-	if (new_parts == NULL)
+	if (new_parts == NULL) {
+		if (err_msg)
+			*err_msg = MSG_out_of_memory;
 		return false;
+	}
 
 	convert_copy(old_parts, new_parts);
 
-	if (new_parts->num_part == 0) {
+	if (new_parts->num_part == 0 && old_parts->num_part != 0) {
 		/* need to cleanup */
 		new_parts->pscheme->free(new_parts);
 		return false;



CVS commit: src/usr.sbin/npf/npfctl

2021-07-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 14 09:15:01 UTC 2021

Modified Files:
src/usr.sbin/npf/npfctl: npfctl.c

Log Message:
PR/56307: Konrad Schroder: npfctl's error messages don't report the failing
filename.
Add the filename (but in quotes for consistency with other places in the file).
Also fix an err -> errx


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/usr.sbin/npf/npfctl/npfctl.c

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npfctl.c
diff -u src/usr.sbin/npf/npfctl/npfctl.c:1.64 src/usr.sbin/npf/npfctl/npfctl.c:1.65
--- src/usr.sbin/npf/npfctl/npfctl.c:1.64	Sat May 30 10:16:56 2020
+++ src/usr.sbin/npf/npfctl/npfctl.c	Wed Jul 14 05:15:01 2021
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: npfctl.c,v 1.64 2020/05/30 14:16:56 rmind Exp $");
+__RCSID("$NetBSD: npfctl.c,v 1.65 2021/07/14 09:15:01 christos Exp $");
 
 #include 
 #include 
@@ -301,17 +301,18 @@ npfctl_import(const char *path)
 	 * just leaving this responsibility for the caller.
 	 */
 	if ((fd = open(path, O_RDONLY)) == -1) {
-		err(EXIT_FAILURE, "could not open `%s'", path);
+		err(EXIT_FAILURE, "open: '%s'", path);
 	}
 	if (fstat(fd, ) == -1) {
-		err(EXIT_FAILURE, "stat");
+		err(EXIT_FAILURE, "stat: '%s'", path);
 	}
 	if ((blen = sb.st_size) == 0) {
-		err(EXIT_FAILURE, "the binary configuration file is empty");
+		errx(EXIT_FAILURE,
+		"the binary configuration file '%s' is empty", path);
 	}
 	blob = mmap(NULL, blen, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0);
 	if (blob == MAP_FAILED) {
-		err(EXIT_FAILURE, "mmap");
+		err(EXIT_FAILURE, "mmap: '%s'", path);
 	}
 	ncf = npf_config_import(blob, blen);
 	munmap(blob, blen);
@@ -329,7 +330,7 @@ npfctl_load(int fd)
 	 */
 	ncf = npfctl_import(NPF_DB_PATH);
 	if (ncf == NULL) {
-		err(EXIT_FAILURE, "npf_config_import");
+		err(EXIT_FAILURE, "npf_config_import: '%s'", NPF_DB_PATH);
 	}
 	if ((errno = npf_config_submit(ncf, fd, )) != 0) {
 		npfctl_print_error();
@@ -345,7 +346,7 @@ npfctl_open_dev(const char *path)
 	int fd;
 
 	if (lstat(path, ) == -1) {
-		err(EXIT_FAILURE, "fstat");
+		err(EXIT_FAILURE, "fstat: '%s'", path);
 	}
 	if ((st.st_mode & S_IFMT) == S_IFSOCK) {
 		struct sockaddr_un addr;
@@ -358,11 +359,11 @@ npfctl_open_dev(const char *path)
 		strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
 
 		if (connect(fd, (struct sockaddr *), sizeof(addr)) == -1) {
-			err(EXIT_FAILURE, "connect");
+			err(EXIT_FAILURE, "connect: '%s'", path);
 		}
 	} else {
 		if ((fd = open(path, O_RDONLY)) == -1) {
-			err(EXIT_FAILURE, "cannot open '%s'", path);
+			err(EXIT_FAILURE, "open: '%s'", path);
 		}
 	}
 	return fd;
@@ -416,7 +417,8 @@ npfctl_debug(int argc, char **argv)
 		puts("Loading the active configuration");
 		fd = npfctl_open_dev(NPF_DEV_PATH);
 		if ((ncf = npf_config_retrieve(fd)) == NULL) {
-			err(EXIT_FAILURE, "npf_config_retrieve");
+			err(EXIT_FAILURE, "npf_config_retrieve: '%s'",
+			NPF_DEV_PATH);
 		}
 	}
 



CVS commit: src/usr.sbin/altq/libaltq

2021-07-14 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 14 08:33:05 UTC 2021

Modified Files:
src/usr.sbin/altq/libaltq: parser.c

Log Message:
libaltq: allow longer config lines


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/altq/libaltq/parser.c

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

Modified files:

Index: src/usr.sbin/altq/libaltq/parser.c
diff -u src/usr.sbin/altq/libaltq/parser.c:1.11 src/usr.sbin/altq/libaltq/parser.c:1.12
--- src/usr.sbin/altq/libaltq/parser.c:1.11	Tue Aug 16 12:49:13 2011
+++ src/usr.sbin/altq/libaltq/parser.c	Wed Jul 14 08:33:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.11 2011/08/16 12:49:13 christos Exp $	*/
+/*	$NetBSD: parser.c,v 1.12 2021/07/14 08:33:05 ozaki-r Exp $	*/
 /*	$KAME: parser.c,v 1.16 2002/02/20 10:40:39 kjc Exp $	*/
 /*
  * Copyright (C) 1999-2002
@@ -76,7 +76,7 @@ static int conditioner_parser(char *);
 static int tc_action_parser(char *, char **, struct tc_action *);
 
 #define MAX_LINE	1024
-#define MAX_WORD	64
+#define MAX_WORD	128
 #define MAX_ARGS	64
 #define MAX_ACTIONS	16
 



CVS commit: src/usr.sbin/altq

2021-07-14 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 14 08:32:13 UTC 2021

Modified Files:
src/usr.sbin/altq/altqd: altq.conf.5
src/usr.sbin/altq/libaltq: qop_cbq.c qop_cbq.h

Log Message:
libaltq, cbq: add two options to interface

- no-control: don't create a control class automatically
- no-tbr: don't install TBR


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/altq/altqd/altq.conf.5
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/altq/libaltq/qop_cbq.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/altq/libaltq/qop_cbq.h

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/altq/altqd/altq.conf.5
diff -u src/usr.sbin/altq/altqd/altq.conf.5:1.18 src/usr.sbin/altq/altqd/altq.conf.5:1.19
--- src/usr.sbin/altq/altqd/altq.conf.5:1.18	Tue Apr  9 19:10:21 2019
+++ src/usr.sbin/altq/altqd/altq.conf.5	Wed Jul 14 08:32:13 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: altq.conf.5,v 1.18 2019/04/09 19:10:21 sevan Exp $
+.\"	$NetBSD: altq.conf.5,v 1.19 2021/07/14 08:32:13 ozaki-r Exp $
 .\"	$KAME: altq.conf.5,v 1.15 2002/11/17 02:51:49 kjc Exp $
 .\"
 .\" Copyright (C) 2000
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 9, 2019
+.Dd July 14, 2021
 .Dt ALTQ.CONF 5
 .Os
 .\"
@@ -281,6 +281,8 @@ excess bandwidth is available.
 .Op Cm tbrsize Ar bytes
 .Op Ar sched_type
 .Op Cm efficient
+.Op Cm no-control
+.Op Cm no-tbr
 .El
 .Bl -tag -width 8n -offset indent
 .It Ar if_name
@@ -310,6 +312,13 @@ By default, this mode is turned off.
 By adding the keyword
 .Cm efficient
 to the interface specification line, enables this mode.
+.It Cm no-control
+By default, the control class is automatically created when default class is
+created and one doesn't exist yet.
+This option suppresses the behavior on the interface.
+.It Cm no-tbr
+By default, a token bucket regulator is automatically created on each interface.
+This option suppresses the behavior on the interface.
 .El
 .Bl -tag -width class -offset indent
 .It Cm class

Index: src/usr.sbin/altq/libaltq/qop_cbq.c
diff -u src/usr.sbin/altq/libaltq/qop_cbq.c:1.10 src/usr.sbin/altq/libaltq/qop_cbq.c:1.11
--- src/usr.sbin/altq/libaltq/qop_cbq.c:1.10	Sat Oct 19 17:16:37 2013
+++ src/usr.sbin/altq/libaltq/qop_cbq.c	Wed Jul 14 08:32:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: qop_cbq.c,v 1.10 2013/10/19 17:16:37 christos Exp $	*/
+/*	$NetBSD: qop_cbq.c,v 1.11 2021/07/14 08:32:13 ozaki-r Exp $	*/
 /*	$KAME: qop_cbq.c,v 1.7 2002/05/31 06:03:35 kjc Exp $	*/
 /*
  * Copyright (c) Sun Microsystems, Inc. 1993-1998 All rights reserved.
@@ -112,6 +112,8 @@ cbq_interface_parser(const char *ifname,
 	u_int	tbrsize = 0;
 	u_int	is_efficient = 0;
 	u_int	is_wrr = 1;	/* weighted round-robin is default */
+	bool	no_control = false;
+	bool	no_tbr = false;
 
 	/*
 	 * process options
@@ -133,6 +135,10 @@ cbq_interface_parser(const char *ifname,
 			is_wrr = 1;
 		} else if (EQUAL(*argv, "cbq-prr")) {
 			is_wrr = 0;
+		} else if (EQUAL(*argv, "no-tbr")) {
+			no_tbr = true;
+		} else if (EQUAL(*argv, "no-control")) {
+			no_control = true;
 		} else {
 			LOG(LOG_ERR, 0, "Unknown keyword '%s'", *argv);
 			return (0);
@@ -140,12 +146,15 @@ cbq_interface_parser(const char *ifname,
 		argc--; argv++;
 	}
 
-	if (qcmd_tbr_register(ifname, bandwidth, tbrsize) != 0)
-		return (0);
+	if (!no_tbr) {
+		if (qcmd_tbr_register(ifname, bandwidth, tbrsize) != 0)
+			return (0);
+	}
 
 	if (qcmd_cbq_add_if(ifname, bandwidth,
-			is_wrr, is_efficient) != 0)
+			is_wrr, is_efficient, no_control) != 0)
 		return (0);
+
 	return (1);
 }
 
@@ -296,11 +305,13 @@ cbq_class_parser(const char *ifname, con
  * qcmd api
  */
 int
-qcmd_cbq_add_if(const char *ifname, u_int bandwidth, int is_wrr, int efficient)
+qcmd_cbq_add_if(const char *ifname, u_int bandwidth, int is_wrr, int efficient,
+bool no_control)
 {
 	int error;
 	
-	error = qop_cbq_add_if(NULL, ifname, bandwidth, is_wrr, efficient);
+	error = qop_cbq_add_if(NULL, ifname, bandwidth, is_wrr, efficient,
+	no_control);
 	if (error != 0)
 		LOG(LOG_ERR, errno, "%s: can't add cbq on interface '%s'",
 		qoperror(error), ifname);
@@ -333,7 +344,7 @@ qcmd_cbq_add_class(const char *ifname, c
 	(borrow = clname2clinfo(ifinfo, borrow_name)) == NULL)
 		error = QOPERR_BADCLASS;
 
-	if (flags & CBQCLF_DEFCLASS) {
+	if (flags & CBQCLF_DEFCLASS && !cbq_ifinfo->no_control) {
 		/*
 		 * if this is a default class and no ctl_class is defined,
 		 * we will create a ctl_class.
@@ -464,7 +475,7 @@ qcmd_cbq_add_ctl_filters(const char *ifn
  */
 int 
 qop_cbq_add_if(struct ifinfo **rp, const char *ifname,
-	   u_int bandwidth, int is_wrr, int efficient)
+	   u_int bandwidth, int is_wrr, int efficient, bool no_control)
 {
 	struct ifinfo *ifinfo = NULL;
 	struct cbq_ifinfo *cbq_ifinfo = NULL;
@@ -477,6 +488,7 @@ qop_cbq_add_if(struct ifinfo **rp, const

CVS commit: src/usr.sbin/sysinst

2021-07-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 13 09:13:00 UTC 2021

Modified Files:
src/usr.sbin/sysinst: Makefile.inc defs.h

Log Message:
PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/sysinst/Makefile.inc
cvs rdiff -u -r1.70 -r1.71 src/usr.sbin/sysinst/defs.h

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/Makefile.inc
diff -u src/usr.sbin/sysinst/Makefile.inc:1.40 src/usr.sbin/sysinst/Makefile.inc:1.41
--- src/usr.sbin/sysinst/Makefile.inc:1.40	Tue Apr 13 07:53:19 2021
+++ src/usr.sbin/sysinst/Makefile.inc	Tue Jul 13 09:13:00 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.40 2021/04/13 07:53:19 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.41 2021/07/13 09:13:00 martin Exp $
 #
 # Makefile for sysinst
 
@@ -94,6 +94,10 @@ CPPFLAGS+=	-I. -I${.CURDIR}/../.. -I${.C
 		${NODISKLABEL:D-DNO_DISKLABEL} \
 		${NOPARTMAN:D-DNO_PARTMAN}
 
+.if ${USE_XZ_SETS:Uno} != "no"
+CPPFLAGS+=	-DEXTRACT_NEEDS_BIG_RAM
+.endif
+
 .if ${RELEASEMACHINEDIR} != ${MACHINE}
 CPPFLAGS+=	-DARCH_SUBDIR="\"${RELEASEMACHINEDIR}\""
 CPPFLAGS+=	-DPKG_ARCH_SUBDIR="\"${MACHINE_ARCH}\""

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.70 src/usr.sbin/sysinst/defs.h:1.71
--- src/usr.sbin/sysinst/defs.h:1.70	Sun Jan 31 22:45:46 2021
+++ src/usr.sbin/sysinst/defs.h	Tue Jul 13 09:13:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.70 2021/01/31 22:45:46 rillig Exp $	*/
+/*	$NetBSD: defs.h,v 1.71 2021/07/13 09:13:00 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -68,7 +68,12 @@ const char *getfslabelname(uint, uint);
  * if a system does not have more ram (in MB) than this, swap will be enabled
  * very early (as soon as the swap partition has been created)
  */
+#ifdef	EXTRACT_NEEDS_BIG_RAM	/* we use an expensive decompressor */
+#define	TINY_RAM_SIZE		256
+#else
 #define	TINY_RAM_SIZE		32
+#endif
+
 /*
  * if a system has less ram (in MB) than this, we will not create a
  * tmpfs /tmp by default (to workaround PR misc/54886)



CVS commit: src/usr.sbin/sysinst

2021-07-12 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jul 12 19:03:20 UTC 2021

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

Log Message:
Revert 1.4, that just trades one problem for a different one
(splitting the message on % instead of white space, which affects
less messages, but makes a bigger mess of them when it happens).

The real problem is that the expansion of the message was unquoted,
which allowed the field splitting to happen at all (which was mitigated
by the way printf rescans its format string for each arg when there are
more args than conversions in the format) otherwise it would have been
a much bigger mess (both times).

Just add quotes where quotes are needed, no more splitting, all good.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/usr.sbin/sysinst/msg_xlat.sh:1.5
--- src/usr.sbin/sysinst/msg_xlat.sh:1.4	Sun Jul 11 10:51:46 2021
+++ src/usr.sbin/sysinst/msg_xlat.sh	Mon Jul 12 19:03:20 2021
@@ -1,5 +1,5 @@
 #! /bin/sh
-#	$NetBSD: msg_xlat.sh,v 1.4 2021/07/11 10:51:46 cjep Exp $
+#	$NetBSD: msg_xlat.sh,v 1.5 2021/07/12 19:03:20 kre Exp $
 
 #-
 # Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -174,7 +174,7 @@ do
 		$IGNORE_MISSING_TRANSLATIONS || rval=1
 	fi
 done
-IFS=%
+unset IFS
 
 if $count_fmtargs; then exit $rval; fi
 
@@ -210,7 +210,7 @@ while
 do
 	eval msg=\${MSGTEXT_$msgnum}
 	if [ -z "$msg" ]; then continue; fi
-	printf '%s\0' $msg
+	printf '%s\0' "$msg"
 done
 
 exit $rval



CVS commit: src/usr.sbin/cpuctl/arch

2021-07-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul 12 12:56:52 UTC 2021

Modified Files:
src/usr.sbin/cpuctl/arch: i386.c

Log Message:
 Add 0x96(Elkhart Lake) and 0x9c(Jasper Lake).
Not listed in SDM but listed in those spec update documents.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/usr.sbin/cpuctl/arch/i386.c

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.116 src/usr.sbin/cpuctl/arch/i386.c:1.117
--- src/usr.sbin/cpuctl/arch/i386.c:1.116	Sat Jul 10 17:18:05 2021
+++ src/usr.sbin/cpuctl/arch/i386.c	Mon Jul 12 12:56:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.116 2021/07/10 17:18:05 msaitoh Exp $	*/
+/*	$NetBSD: i386.c,v 1.117 2021/07/12 12:56:52 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.116 2021/07/10 17:18:05 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.117 2021/07/12 12:56:52 msaitoh Exp $");
 #endif /* not lint */
 
 #include 
@@ -354,6 +354,8 @@ const struct cpu_cpuid_nameclass i386_cp
 [0x8c] = "11th gen Core (Tiger Lake)",
 [0x8d] = "11th gen Core (Tiger Lake)",
 [0x8e] = "7th or 8th gen Core (Kaby Lake, Coffee Lake) or Xeon E (Coffee Lake)",
+[0x96] = "Atom x6000E (Elkhart Lake)",
+[0x9c] = "Pentium Silver N6xxx, Celeron N45xx, Celeron N51xx (Jasper Lake)",
 [0x9e] = "7th or 8th gen Core (Kaby Lake, Coffee Lake) or Xeon E (Coffee Lake)",
 [0xa5] = "10th gen Core (Comet Lake)",
 [0xa6] = "10th gen Core (Comet Lake)",



CVS commit: src/usr.sbin/sysinst

2021-07-11 Thread Chris Pinnock
Module Name:src
Committed By:   cjep
Date:   Sun Jul 11 10:51:46 UTC 2021

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

Log Message:
We need IFS to be set to % for the rest of the script so be explicit
about it. Fixes message truncation for non-English in sysinst.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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.3 src/usr.sbin/sysinst/msg_xlat.sh:1.4
--- src/usr.sbin/sysinst/msg_xlat.sh:1.3	Tue Jun 29 08:02:50 2021
+++ src/usr.sbin/sysinst/msg_xlat.sh	Sun Jul 11 10:51:46 2021
@@ -1,5 +1,5 @@
 #! /bin/sh
-#	$NetBSD: msg_xlat.sh,v 1.3 2021/06/29 08:02:50 cjep Exp $
+#	$NetBSD: msg_xlat.sh,v 1.4 2021/07/11 10:51:46 cjep Exp $
 
 #-
 # Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -174,7 +174,7 @@ do
 		$IGNORE_MISSING_TRANSLATIONS || rval=1
 	fi
 done
-unset IFS
+IFS=%
 
 if $count_fmtargs; then exit $rval; fi
 



CVS commit: src/usr.sbin/cpuctl/arch

2021-07-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jul 10 17:18:05 UTC 2021

Modified Files:
src/usr.sbin/cpuctl/arch: i386.c

Log Message:
0x6a and 0x6c are 3rd gen Xeon Scalable (Ice Lake).


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/usr.sbin/cpuctl/arch/i386.c

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.115 src/usr.sbin/cpuctl/arch/i386.c:1.116
--- src/usr.sbin/cpuctl/arch/i386.c:1.115	Tue Nov 24 00:48:39 2020
+++ src/usr.sbin/cpuctl/arch/i386.c	Sat Jul 10 17:18:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.115 2020/11/24 00:48:39 msaitoh Exp $	*/
+/*	$NetBSD: i386.c,v 1.116 2021/07/10 17:18:05 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.115 2020/11/24 00:48:39 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.116 2021/07/10 17:18:05 msaitoh Exp $");
 #endif /* not lint */
 
 #include 
@@ -344,8 +344,8 @@ const struct cpu_cpuid_nameclass i386_cp
 [0x5e] = "6th gen Core, Xeon E3-1[25]00 v5 (Skylake)",
 [0x5f] = "Atom (Goldmont, Denverton)",
 [0x66] = "8th gen Core i3 (Cannon Lake)",
-[0x6a] = "Future Xeon (Ice Lake)",
-[0x6c] = "Future Xeon (Ice Lake)",
+[0x6a] = "3rd gen Xeon Scalable (Ice Lake)",
+[0x6c] = "3rd gen Xeon Scalable (Ice Lake)",
 [0x7a] = "Atom (Goldmont Plus)",
 [0x7d] = "10th gen Core (Ice Lake)",
 [0x7e] = "10th gen Core (Ice Lake)",



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.sbin/hdaudioctl

2021-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 21 03:09:52 UTC 2021

Modified Files:
src/usr.sbin/hdaudioctl: graph.c hdaudioctl.c

Log Message:
fix proplib deprecation


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/hdaudioctl/graph.c \
src/usr.sbin/hdaudioctl/hdaudioctl.c

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

Modified files:

Index: src/usr.sbin/hdaudioctl/graph.c
diff -u src/usr.sbin/hdaudioctl/graph.c:1.5 src/usr.sbin/hdaudioctl/graph.c:1.6
--- src/usr.sbin/hdaudioctl/graph.c:1.5	Mon Jun 15 09:06:39 2020
+++ src/usr.sbin/hdaudioctl/graph.c	Sun Jun 20 23:09:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: graph.c,v 1.5 2020/06/15 13:06:39 sborrill Exp $ */
+/* $NetBSD: graph.c,v 1.6 2021/06/21 03:09:52 christos Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -95,7 +95,7 @@ hdaudioctl_graph(int fd, int argc, char 
 		HDAUDIO_FGRP_WIDGET_INFO, );
 		if (error != 0)
 			break;
-		prop_dictionary_get_cstring_nocopy(response, "name", );
+		prop_dictionary_get_string(response, "name", );
 		prop_dictionary_get_uint32(response, "cap", );
 		prop_dictionary_get_uint32(response, "config", );
 		prop_dictionary_get_uint8(response, "type", );
@@ -174,7 +174,7 @@ next:
 		HDAUDIO_AFG_WIDGET_INFO, );
 		if (error != 0)
 			break;
-		prop_dictionary_get_cstring_nocopy(response, "name", );
+		prop_dictionary_get_string(response, "name", );
 		prop_dictionary_get_uint8(response, "type", );
 		prop_dictionary_get_uint8(response, "nid", );
 
@@ -197,7 +197,7 @@ next:
 		HDAUDIO_AFG_WIDGET_INFO, );
 		if (error != 0)
 			break;
-		prop_dictionary_get_cstring_nocopy(response, "name", );
+		prop_dictionary_get_string(response, "name", );
 		prop_dictionary_get_uint8(response, "type", );
 		prop_dictionary_get_uint8(response, "nid", );
 
Index: src/usr.sbin/hdaudioctl/hdaudioctl.c
diff -u src/usr.sbin/hdaudioctl/hdaudioctl.c:1.5 src/usr.sbin/hdaudioctl/hdaudioctl.c:1.6
--- src/usr.sbin/hdaudioctl/hdaudioctl.c:1.5	Wed Jul  1 08:19:45 2020
+++ src/usr.sbin/hdaudioctl/hdaudioctl.c	Sun Jun 20 23:09:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudioctl.c,v 1.5 2020/07/01 12:19:45 sborrill Exp $ */
+/* $NetBSD: hdaudioctl.c,v 1.6 2021/06/21 03:09:52 christos Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -141,7 +141,7 @@ hdaudioctl_list(int fd)
 		prop_dictionary_get_uint16(dict, "vendor-id", );
 		prop_dictionary_get_uint16(dict, "product-id", );
 		prop_dictionary_get_uint32(dict, "subsystem-id", );
-		prop_dictionary_get_cstring_nocopy(dict, "device", );
+		prop_dictionary_get_string(dict, "device", );
 
 		printf("codecid 0x%02X nid 0x%02X vendor 0x%04X "
 		"product 0x%04X subsystem 0x%08X device %s\n",



CVS commit: src/usr.sbin/postinstall

2021-06-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Jun  7 05:29:22 UTC 2021

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
Don't overwrite changed autofs config files.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.38 src/usr.sbin/postinstall/postinstall.in:1.39
--- src/usr.sbin/postinstall/postinstall.in:1.38	Sun Apr 25 06:21:37 2021
+++ src/usr.sbin/postinstall/postinstall.in	Mon Jun  7 05:29:22 2021
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.38 2021/04/25 06:21:37 lukem Exp $
+# $NetBSD: postinstall.in,v 1.39 2021/06/07 05:29:22 mlelstv Exp $
 #
 # Copyright (c) 2002-2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -902,12 +902,12 @@ special_null
 		mkdir -p "${DEST_DIR}/etc/autofs"
 	fi
 	failed=$(( ${failed} + $? ))
-	populate_dir "$op" false "${SRC_DIR}/etc" \
+	populate_dir "$op" true "${SRC_DIR}/etc" \
 	"${DEST_DIR}/etc" \
 	644 \
 	auto_master
 	failed=$(( ${failed} + $? ))
-	populate_dir "$op" false "${SRC_DIR}/etc/autofs" \
+	populate_dir "$op" true "${SRC_DIR}/etc/autofs" \
 	"${DEST_DIR}/etc/autofs" \
 	644 \
 	${autofs_files}



CVS commit: src/usr.sbin/mountd

2021-06-05 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Jun  5 08:26:34 UTC 2021

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

Log Message:
Fix typo, its the element not the array ...


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/usr.sbin/mountd/mountd.c

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

Modified files:

Index: src/usr.sbin/mountd/mountd.c
diff -u src/usr.sbin/mountd/mountd.c:1.136 src/usr.sbin/mountd/mountd.c:1.137
--- src/usr.sbin/mountd/mountd.c:1.136	Fri Jun  4 10:46:57 2021
+++ src/usr.sbin/mountd/mountd.c	Sat Jun  5 08:26:34 2021
@@ -1,4 +1,4 @@
-/* 	$NetBSD: mountd.c,v 1.136 2021/06/04 10:46:57 hannken Exp $	 */
+/* 	$NetBSD: mountd.c,v 1.137 2021/06/05 08:26:34 hannken Exp $	 */
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)mountd.c  8.15 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: mountd.c,v 1.136 2021/06/04 10:46:57 hannken Exp $");
+__RCSID("$NetBSD: mountd.c,v 1.137 2021/06/05 08:26:34 hannken Exp $");
 #endif
 #endif/* not lint */
 
@@ -1294,7 +1294,7 @@ get_exportlist(int n)
 		(mel->mel_nexports > 0 || errno != EOPNOTSUPP))
 			syslog(LOG_ERR, "Can't update exports for %s (%m)",
 			mel_tab[i].mel_path);
-		for (j = 0; j < (int)mel_tab->mel_nexports; j++) {
+		for (j = 0; j < (int)mel->mel_nexports; j++) {
 			struct export_args *export = >mel_exports[j];
 
 			if (export->ex_indexfile)



CVS commit: src/usr.sbin/mountd

2021-06-04 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jun  4 10:46:57 UTC 2021

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

Log Message:
Change get_exportlist() to collect all exports and emit all
exports for a single mount in one call to nfssvc(2).

Should finally fix PR kern/5844 (NFS server sends "permission denied"
while mound re-read exports).


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.sbin/mountd/mountd.c

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

Modified files:

Index: src/usr.sbin/mountd/mountd.c
diff -u src/usr.sbin/mountd/mountd.c:1.135 src/usr.sbin/mountd/mountd.c:1.136
--- src/usr.sbin/mountd/mountd.c:1.135	Fri Jun  4 10:46:01 2021
+++ src/usr.sbin/mountd/mountd.c	Fri Jun  4 10:46:57 2021
@@ -1,4 +1,4 @@
-/* 	$NetBSD: mountd.c,v 1.135 2021/06/04 10:46:01 hannken Exp $	 */
+/* 	$NetBSD: mountd.c,v 1.136 2021/06/04 10:46:57 hannken Exp $	 */
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)mountd.c  8.15 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: mountd.c,v 1.135 2021/06/04 10:46:01 hannken Exp $");
+__RCSID("$NetBSD: mountd.c,v 1.136 2021/06/04 10:46:57 hannken Exp $");
 #endif
 #endif/* not lint */
 
@@ -235,6 +235,8 @@ static struct uucred def_anon = {
 	0,
 	{ 0 }
 };
+static struct mountd_exports_list *mel_tab;
+static int mel_tab_len;
 
 int  opt_flags;
 static int	have_v6 = 1;
@@ -1207,6 +1209,18 @@ nextline:
 }
 
 /*
+ * Compare two export lists by path.
+ */
+static int
+mel_compare(const void *a, const void *b)
+{
+	const struct mountd_exports_list *mela = a;
+	const struct mountd_exports_list *melb = b;
+
+	return strcmp(mela->mel_path, melb->mel_path);
+}
+
+/*
  * Get the export list
  */
 /* ARGSUSED */
@@ -1216,7 +1230,7 @@ get_exportlist(int n)
 	struct exportlist *ep, *ep2;
 	struct grouplist *grp, *tgrp;
 	struct statvfs *fsp;
-	int num, i;
+	int i, j;
 	FILE *exp_file;
 
 
@@ -1243,20 +1257,14 @@ get_exportlist(int n)
 	 * And delete exports that are in the kernel for all local
 	 * file systems.
 	 */
-	num = getmntinfo(, MNT_NOWAIT);
-	for (i = 0; i < num; i++) {
-		struct mountd_exports_list mel;
-
-		/* Delete all entries from the export list. */
-		mel.mel_path = fsp->f_mntonname;
-		mel.mel_nexports = 0;
-		if (nfssvc(NFSSVC_SETEXPORTSLIST, ) == -1 &&
-		errno != EOPNOTSUPP)
-			syslog(LOG_ERR, "Can't delete exports for %s (%m)",
-			fsp->f_mntonname);
-
-		fsp++;
+	mel_tab_len = getmntinfo(, MNT_NOWAIT);
+	mel_tab = ecalloc(mel_tab_len, sizeof(*mel_tab));
+	for (i = 0; i < mel_tab_len; i++) {
+		mel_tab[i].mel_path = estrdup(fsp[i].f_mntonname);
+		mel_tab[i].mel_nexports = 0;
+		mel_tab[i].mel_exports = NULL;
 	}
+	qsort(mel_tab, mel_tab_len, sizeof(mel_tab[0]), mel_compare);
 
 	/*
 	 * Read in the exports file and build the list, calling
@@ -1278,6 +1286,30 @@ get_exportlist(int n)
 
 		(void)fclose(exp_file);
 	}
+
+	for (i = 0; i < mel_tab_len; i++) {
+		struct mountd_exports_list *mel = _tab[i];
+
+		if (nfssvc(NFSSVC_REPLACEEXPORTSLIST, mel) == -1 &&
+		(mel->mel_nexports > 0 || errno != EOPNOTSUPP))
+			syslog(LOG_ERR, "Can't update exports for %s (%m)",
+			mel_tab[i].mel_path);
+		for (j = 0; j < (int)mel_tab->mel_nexports; j++) {
+			struct export_args *export = >mel_exports[j];
+
+			if (export->ex_indexfile)
+free(export->ex_indexfile);
+			if (export->ex_addr)
+free(export->ex_addr);
+			if (export->ex_mask)
+free(export->ex_mask);
+		}
+		if (mel->mel_nexports > 0)
+			free(mel->mel_exports);
+		free(__UNCONST(mel->mel_path));
+	}
+	free(mel_tab);
+	mel_tab_len = 0;
 }
 
 /*
@@ -1923,31 +1955,39 @@ add_export_arg(const char *path, int exf
 struct sockaddr *addrp, int addrlen, struct sockaddr *maskp, int masklen,
 char *indexfile)
 {
-	struct mountd_exports_list mel;
-	struct export_args export;
-	int error;
+	const struct mountd_exports_list mel_key = { .mel_path = path };
+	struct mountd_exports_list *mel;
+	struct export_args *export;
 
 	if (addrp != NULL && addrp->sa_family == AF_INET6 && have_v6 == 0)
 		return 0;
 
-	mel.mel_path = path;
-	mel.mel_nexports = 1;
-	mel.mel_exports = 
-
-	export.ex_flags = exflags;
-	export.ex_anon = *anoncrp;
-	export.ex_indexfile = indexfile;
-	export.ex_addr = addrp;
-	export.ex_addrlen = addrlen;
-	export.ex_mask = maskp;
-	export.ex_masklen = masklen;
-
-	error = nfssvc(NFSSVC_SETEXPORTSLIST, );
-
-	if (error) {
-		syslog(LOG_ERR, "Can't change attributes for %s: %m", path);
+	mel = bsearch(_key, mel_tab, mel_tab_len, sizeof(mel_tab[0]),
+	mel_compare);
+	if (mel == NULL) {
+		syslog(LOG_ERR, "Can't change attributes for %s: not found",
+		path);
 		return 1;
 	}
+	ereallocarr(>mel_exports, mel->mel_nexports + 1,
+	sizeof(*mel->mel_exports));
+	export = >mel_exports[mel->mel_nexports++];
+	memset(export, 0, sizeof(*export));
+
+	export->ex_flags = 

CVS commit: src/usr.sbin/mountd

2021-06-04 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jun  4 10:46:01 UTC 2021

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

Log Message:
Restructure do_nfssvc() and simplify the left cases GT_HOST and GT_NET.

Add a helper add_export_arg() that emits a single export_args item and
does the IPv6 check.
Always use the path of the mount point for the export.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/usr.sbin/mountd/mountd.c

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

Modified files:

Index: src/usr.sbin/mountd/mountd.c
diff -u src/usr.sbin/mountd/mountd.c:1.134 src/usr.sbin/mountd/mountd.c:1.135
--- src/usr.sbin/mountd/mountd.c:1.134	Tue Feb 16 10:00:27 2021
+++ src/usr.sbin/mountd/mountd.c	Fri Jun  4 10:46:01 2021
@@ -1,4 +1,4 @@
-/* 	$NetBSD: mountd.c,v 1.134 2021/02/16 10:00:27 hannken Exp $	 */
+/* 	$NetBSD: mountd.c,v 1.135 2021/06/04 10:46:01 hannken Exp $	 */
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)mountd.c  8.15 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: mountd.c,v 1.134 2021/02/16 10:00:27 hannken Exp $");
+__RCSID("$NetBSD: mountd.c,v 1.135 2021/06/04 10:46:01 hannken Exp $");
 #endif
 #endif/* not lint */
 
@@ -1918,6 +1918,40 @@ get_ht(void)
 	return (hp);
 }
 
+static int
+add_export_arg(const char *path, int exflags, struct uucred *anoncrp,
+struct sockaddr *addrp, int addrlen, struct sockaddr *maskp, int masklen,
+char *indexfile)
+{
+	struct mountd_exports_list mel;
+	struct export_args export;
+	int error;
+
+	if (addrp != NULL && addrp->sa_family == AF_INET6 && have_v6 == 0)
+		return 0;
+
+	mel.mel_path = path;
+	mel.mel_nexports = 1;
+	mel.mel_exports = 
+
+	export.ex_flags = exflags;
+	export.ex_anon = *anoncrp;
+	export.ex_indexfile = indexfile;
+	export.ex_addr = addrp;
+	export.ex_addrlen = addrlen;
+	export.ex_mask = maskp;
+	export.ex_masklen = masklen;
+
+	error = nfssvc(NFSSVC_SETEXPORTSLIST, );
+
+	if (error) {
+		syslog(LOG_ERR, "Can't change attributes for %s: %m", path);
+		return 1;
+	}
+
+	return 0;
+}
+
 /*
  * Do the nfssvc syscall to push the export info into the kernel.
  */
@@ -1930,92 +1964,37 @@ do_nfssvc(const char *line, size_t linen
 	struct sockaddr_storage ss;
 	struct addrinfo *ai;
 	int addrlen;
-	int done;
-	struct export_args export;
 
-	export.ex_flags = exflags;
-	export.ex_anon = *anoncrp;
-	export.ex_indexfile = ep->ex_indexfile;
 	if (grp->gr_type == GT_HOST) {
-		ai = grp->gr_ptr.gt_addrinfo;
-		addrp = ai->ai_addr;
-		addrlen = ai->ai_addrlen;
-	} else {
-		addrp = NULL;
-		ai = NULL;	/* XXXGCC -Wuninitialized */
-		addrlen = 0;	/* XXXGCC -Wuninitialized */
-	}
-	done = FALSE;
-	while (!done) {
-		struct mountd_exports_list mel;
-
-		switch (grp->gr_type) {
-		case GT_HOST:
-			if (addrp != NULL && addrp->sa_family == AF_INET6 &&
-			have_v6 == 0)
-goto skip;
-			export.ex_addr = addrp;
-			export.ex_addrlen = addrlen;
-			export.ex_masklen = 0;
-			break;
-		case GT_NET:
-			export.ex_addr = (struct sockaddr *)
-			>gr_ptr.gt_net.nt_net;
-			if (export.ex_addr->sa_family == AF_INET6 &&
-			have_v6 == 0)
-goto skip;
-			export.ex_addrlen = export.ex_addr->sa_len;
-			memset(, 0, sizeof ss);
-			ss.ss_family = export.ex_addr->sa_family;
-			ss.ss_len = export.ex_addr->sa_len;
-			if (allones(, grp->gr_ptr.gt_net.nt_len) != 0) {
-syslog(LOG_ERR,
-"\"%s\", line %ld: Bad network flag",
-line, (unsigned long)lineno);
-return (1);
-			}
-			export.ex_mask = (struct sockaddr *)
-			export.ex_masklen = ss.ss_len;
-			break;
-		default:
-			syslog(LOG_ERR, "\"%s\", line %ld: Bad netgroup type",
+		for (ai = grp->gr_ptr.gt_addrinfo; ai; ai = ai->ai_next) {
+			addrp = ai->ai_addr;
+			addrlen = ai->ai_addrlen;
+			if (add_export_arg(fsb->f_mntonname, exflags, anoncrp,
+			addrp, addrlen, NULL, 0, ep->ex_indexfile) != 0)
+return 1;
+		}
+	} else if (grp->gr_type == GT_NET) {
+		addrp = (struct sockaddr *)>gr_ptr.gt_net.nt_net;
+		addrlen = addrp->sa_len;
+		memset(, 0, sizeof ss);
+		ss.ss_family = addrp->sa_family;
+		ss.ss_len = addrp->sa_len;
+		if (allones(, grp->gr_ptr.gt_net.nt_len) != 0) {
+			syslog(LOG_ERR, "\"%s\", line %ld: Bad network flag",
 			line, (unsigned long)lineno);
-			return (1);
-		};
-
-		/*
-		 * XXX:
-		 * Maybe I should just use the fsb->f_mntonname path?
-		 */
-
-		mel.mel_path = dirp;
-		mel.mel_nexports = 1;
-		mel.mel_exports = 
-
-		if (nfssvc(NFSSVC_SETEXPORTSLIST, ) != 0) {
-			syslog(LOG_ERR,
-	"\"%s\", line %ld: Can't change attributes for %s to %s: %m",
-			line, (unsigned long)lineno,
-			dirp, (grp->gr_type == GT_HOST) ?
-			grp->gr_ptr.gt_addrinfo->ai_canonname :
-			(grp->gr_type == GT_NET) ?
-			grp->gr_ptr.gt_net.nt_name :
-			"Unknown");
-			return (1);
+			return 1;
 		}
-skip:
-		if (addrp) {
-			ai = 

CVS commit: src/usr.sbin/bootp/common

2021-05-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun May 30 02:28:35 UTC 2021

Modified Files:
src/usr.sbin/bootp/common: Makefile

Log Message:
address-of-packed-member warning is no longer a problem here.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/bootp/common/Makefile

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

Modified files:

Index: src/usr.sbin/bootp/common/Makefile
diff -u src/usr.sbin/bootp/common/Makefile:1.9 src/usr.sbin/bootp/common/Makefile:1.10
--- src/usr.sbin/bootp/common/Makefile:1.9	Sun Sep  6 07:20:31 2020
+++ src/usr.sbin/bootp/common/Makefile	Sun May 30 02:28:35 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2020/09/06 07:20:31 mrg Exp $
+#	$NetBSD: Makefile,v 1.10 2021/05/30 02:28:35 joerg Exp $
 
 LIBISPRIVATE=	yes
 
@@ -7,7 +7,6 @@ SRCS=	dovend.c dumptab.c getif.c hash.c 
 	report.c tzone.c
 CPPFLAGS+= -DETC_ETHERS -DSYSLOG -DDEBUG
 
-CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
 CWARNFLAGS.gcc+=	${GCC_NO_ADDR_OF_PACKED_MEMBER}
 
 .include 



CVS commit: src/usr.sbin/cpuctl/arch

2021-05-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 17 18:43:18 UTC 2021

Modified Files:
src/usr.sbin/cpuctl/arch: aarch64.c

Log Message:
Teach cpuctl(8) about some additional aarch64 feature bits.

(Descriptions for CSV3 and CSV2 are not very good, but the blurbs in
the arm arm are an entire paragraph long each.  Please fix if you have
a conciser summary!)


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/cpuctl/arch/aarch64.c

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/aarch64.c
diff -u src/usr.sbin/cpuctl/arch/aarch64.c:1.14 src/usr.sbin/cpuctl/arch/aarch64.c:1.15
--- src/usr.sbin/cpuctl/arch/aarch64.c:1.14	Sat Jan 16 15:34:37 2021
+++ src/usr.sbin/cpuctl/arch/aarch64.c	Mon May 17 18:43:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarch64.c,v 1.14 2021/01/16 15:34:37 jmcneill Exp $	*/
+/*	$NetBSD: aarch64.c,v 1.15 2021/05/17 18:43:18 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -29,7 +29,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: aarch64.c,v 1.14 2021/01/16 15:34:37 jmcneill Exp $");
+__RCSID("$NetBSD: aarch64.c,v 1.15 2021/05/17 18:43:18 riastradh Exp $");
 #endif /* no lint */
 
 #include 
@@ -169,6 +169,66 @@ struct fieldinfo id_aa64pfr0_fieldinfo[]
 			[3] = "GIC CPU interface sysregs v4.1 supported"
 		}
 	},
+	{
+		.bitpos = 28, .bitwidth = 4, .name = "RAS",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Reliability/Availability/Serviceability not supported",
+			[1] = "Reliability/Availability/Serviceability supported",
+			[2] = "Reliability/Availability/Serviceability ARMv8.4 supported",
+		},
+	},
+	{
+		.bitpos = 32, .bitwidth = 4, .name = "SVE",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Scalable Vector Extensions not implemented",
+			[1] = "Scalable Vector Extensions implemented",
+		},
+	},
+	{
+		.bitpos = 36, .bitwidth = 4, .name = "SEL2",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Secure EL2 not implemented",
+			[1] = "Secure EL2 implemented",
+		},
+	},
+	{
+		.bitpos = 40, .bitwidth = 4, .name = "MPAM",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Memory Partitioning and Monitoring not implemented",
+			[1] = "Memory Partitioning and Monitoring implemented",
+		},
+	},
+	{
+		.bitpos = 44, .bitwidth = 4, .name = "AMU",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Activity Monitors Extension not implemented",
+			[1] = "Activity Monitors Extension v1 ARMv8.4",
+			[2] = "Activity Monitors Extension v1 ARMv8.6",
+		},
+	},
+	{
+		.bitpos = 48, .bitwidth = 4, .name = "DIT",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "No Data-Independent Timing guarantees",
+			[1] = "Data-Independent Timing guaranteed by PSTATE.DIT",
+		},
+	},
+	{
+		.bitpos = 56, .bitwidth = 4, .name = "CSV2",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Branch prediction might be Spectred",
+			[1] = "Branch prediction maybe not Spectred",
+			[2] = "Branch prediction probably not Spectred",
+		},
+	},
+	{
+		.bitpos = 60, .bitwidth = 4, .name = "CSV3",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Faults might be Spectred",
+			[1] = "Faults maybe not Spectred",
+			[2] = "Faults probably not Spectred",
+		},
+	},
 	{ .bitwidth = 0 }	/* end of table */
 };
 



CVS commit: src/usr.sbin/sysinst

2021-05-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  9 11:06:20 UTC 2021

Modified Files:
src/usr.sbin/sysinst: label.c

Log Message:
Do not allow editing of start/size/fs-type for partitions that
are already carved in stone (e.g. defined in an outer MBR while we are
editing the inner disklabel).


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/sysinst/label.c

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

Modified files:

Index: src/usr.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.32 src/usr.sbin/sysinst/label.c:1.33
--- src/usr.sbin/sysinst/label.c:1.32	Sun Jan 31 22:45:46 2021
+++ src/usr.sbin/sysinst/label.c	Sun May  9 11:06:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: label.c,v 1.32 2021/01/31 22:45:46 rillig Exp $	*/
+/*	$NetBSD: label.c,v 1.33 2021/05/09 11:06:20 martin Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.32 2021/01/31 22:45:46 rillig Exp $");
+__RCSID("$NetBSD: label.c,v 1.33 2021/05/09 11:06:20 martin Exp $");
 #endif
 
 #include 
@@ -1070,9 +1070,23 @@ update_edit_ptn_menu(menudesc *m, void *
 			edit->pset->parts, edit->id, attr_no))
 continue;
 		}
+		/*
+		 * Do not allow editing of size/start/type when partition
+		 * is defined in some outer partition table already
+		 */
+		if ((edit->pset->infos[edit->index].flags & PUIFLG_IS_OUTER)
+		&& (m->opts[i].opt_action == edit_fs_type
+			|| m->opts[i].opt_action == edit_fs_start
+			|| m->opts[i].opt_action == edit_fs_size))
+continue;
 		/* Ok: we want this one */
 		m->opts[i].opt_flags &= ~OPT_IGNORE;
 	}
+
+	/* Avoid starting at a (now) disabled menu item */
+	while (m->cursel >= 0 && m->cursel < m->numopts
+	&& (m->opts[m->cursel].opt_flags & OPT_IGNORE))
+		m->cursel++;
 }
 
 static void
@@ -1123,7 +1137,10 @@ draw_edit_ptn_line(menudesc *m, int opt,
 
 	if (m->opts[opt].opt_flags & OPT_IGNORE
 	&& (opt != 3 || edit->info.fs_type == FS_UNUSED)
-	&& m->opts[opt].opt_action != edit_ptn_custom_type) {
+	&& m->opts[opt].opt_action != edit_ptn_custom_type
+	&& m->opts[opt].opt_action != edit_fs_type
+	&& m->opts[opt].opt_action != edit_fs_start
+	&& m->opts[opt].opt_action != edit_fs_size) {
 		wprintw(m->mw, "%*s -", col_width, "");
 		return;
 	}



CVS commit: src/usr.sbin/sysinst/arch/evbarm

2021-05-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  9 10:39:01 UTC 2021

Modified Files:
src/usr.sbin/sysinst/arch/evbarm: md.c

Log Message:
Keep MSDOS partition size and subtype consistent - some u-boot are picky.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/sysinst/arch/evbarm/md.c

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

Modified files:

Index: src/usr.sbin/sysinst/arch/evbarm/md.c
diff -u src/usr.sbin/sysinst/arch/evbarm/md.c:1.20 src/usr.sbin/sysinst/arch/evbarm/md.c:1.21
--- src/usr.sbin/sysinst/arch/evbarm/md.c:1.20	Sat Nov 28 13:05:58 2020
+++ src/usr.sbin/sysinst/arch/evbarm/md.c	Sun May  9 10:39:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.20 2020/11/28 13:05:58 jmcneill Exp $ */
+/*	$NetBSD: md.c,v 1.21 2021/05/09 10:39:00 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -333,10 +333,12 @@ bool
 md_parts_use_wholedisk(struct disk_partitions *parts)
 {
 	struct disk_part_info boot_part = {
-		.size = boardtype == BOARD_TYPE_NORMAL ? 
+		.size = boardtype == BOARD_TYPE_NORMAL ?
 		PART_BOOT_LARGE/parts->bytes_per_sector :
 		PART_BOOT/parts->bytes_per_sector,
-		.fs_type = PART_BOOT_TYPE, .fs_sub_type = MBR_PTYPE_FAT16L,
+		.fs_type = PART_BOOT_TYPE,
+		.fs_sub_type = boardtype == BOARD_TYPE_NORMAL ?
+		MBR_PTYPE_FAT32L : MBR_PTYPE_FAT16L,
 	};
 
 	return parts_use_wholedisk(parts, 1, _part);
@@ -368,15 +370,15 @@ evbarm_part_defaults(struct pm_devs *my_
 {
 	size_t i;
 
-	if (boardtype != BOARD_TYPE_NORMAL)
-		return;
-
 	for (i = 0; i < num_usage_infos; i++) {
 		if (infos[i].fs_type == PART_BOOT_TYPE &&
 		infos[i].mount[0] != 0 &&
 		strcmp(infos[i].mount, PART_BOOT_MOUNT) == 0) {
-			infos[i].size = PART_BOOT_LARGE /
-			my_pm->parts->bytes_per_sector;
+			infos[i].size = boardtype == BOARD_TYPE_NORMAL ?
+			PART_BOOT_LARGE/my_pm->parts->bytes_per_sector :
+			PART_BOOT/my_pm->parts->bytes_per_sector;
+			infos[i].fs_version = boardtype == BOARD_TYPE_NORMAL ?
+			MBR_PTYPE_FAT32L : MBR_PTYPE_FAT16L; 
 			return;
 		}
 	}



CVS commit: src/usr.sbin/sysinst

2021-05-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  9 10:37:49 UTC 2021

Modified Files:
src/usr.sbin/sysinst: mbr.c

Log Message:
For FS_MSDOS report the MBR type as fs_sub_type.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/sysinst/mbr.c

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

Modified files:

Index: src/usr.sbin/sysinst/mbr.c
diff -u src/usr.sbin/sysinst/mbr.c:1.38 src/usr.sbin/sysinst/mbr.c:1.39
--- src/usr.sbin/sysinst/mbr.c:1.38	Sun Jan 31 22:45:46 2021
+++ src/usr.sbin/sysinst/mbr.c	Sun May  9 10:37:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.38 2021/01/31 22:45:46 rillig Exp $ */
+/*	$NetBSD: mbr.c,v 1.39 2021/05/09 10:37:49 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1400,6 +1400,7 @@ mbr_do_get_part_info(const struct disk_p
 		case MBR_PTYPE_SPEEDSTOR_16S:
 		case MBR_PTYPE_EFI:
 			info->fs_type = FS_MSDOS;
+			info->fs_sub_type = mp->mbrp_type;
 			break;
 		case MBR_PTYPE_LNXEXT2:
 			info->fs_type = FS_EX2FS;



CVS commit: src/usr.sbin/postinstall

2021-04-25 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sun Apr 25 06:21:37 UTC 2021

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: re-align list output


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.37 src/usr.sbin/postinstall/postinstall.in:1.38
--- src/usr.sbin/postinstall/postinstall.in:1.37	Sun Apr 25 01:44:55 2021
+++ src/usr.sbin/postinstall/postinstall.in	Sun Apr 25 06:21:37 2021
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.37 2021/04/25 01:44:55 lukem Exp $
+# $NetBSD: postinstall.in,v 1.38 2021/04/25 06:21:37 lukem Exp $
 #
 # Copyright (c) 2002-2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2576,18 +2576,18 @@ _USAGE_
 list()
 {
 	echo "Default set of items (to apply if no items are provided by user):"
-	echo "  Item  Description"
-	echo "    ---"
+	echo " Item Description"
+	echo "  ---"
 	for i in ${defaultitems}; do
 		eval desc=\"\${desc_${i}}\"
-		printf "  %-12s  %s\n" "${i}" "${desc}"
+		printf " %-20s %s\n" "${i}" "${desc}"
 	done
 	echo "Items disabled by default (must be requested explicitly):"
-	echo "  Item  Description"
-	echo "    ---"
+	echo " Item Description"
+	echo "  ---"
 	for i in ${otheritems}; do
 		eval desc=\"\${desc_${i}}\"
-		printf "  %-12s  %s\n" "${i}" "${desc}"
+		printf " %-20s %s\n" "${i}" "${desc}"
 	done
 
 }



CVS commit: src/usr.sbin/postinstall

2021-04-24 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sun Apr 25 01:44:55 UTC 2021

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: sort the items. keep obsolete* last

Consistency and quality of life improvements to postinstall:

Order all of the items (including disabled) alphabetically.
Consistent comment style before each item block.
Move other functions used by do_*() before rather than after do_*().


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.36 src/usr.sbin/postinstall/postinstall.in:1.37
--- src/usr.sbin/postinstall/postinstall.in:1.36	Sun Apr 25 01:15:39 2021
+++ src/usr.sbin/postinstall/postinstall.in	Sun Apr 25 01:44:55 2021
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.36 2021/04/25 01:15:39 lukem Exp $
+# $NetBSD: postinstall.in,v 1.37 2021/04/25 01:44:55 lukem Exp $
 #
 # Copyright (c) 2002-2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -590,7 +590,8 @@ exclude()
 # find all the target symlinks of shared libaries and exclude them
 # from consideration for removal
 #
-exclude_libs() {
+exclude_libs()
+{
 	local target="$(ls -l -d lib*.so.* 2> /dev/null \
 	| ${AWK} '{ print $11; }' \
 	| ${SED} -e 's@.*/@@' | ${SORT} -u)"
@@ -808,43 +809,118 @@ find_makedev()
 #	items
 #	-
 #
+# NOTE: Keep these items sorted, except for obsolete* which are listed last.
+#
 
 #
-#	Bluetooth
+#	atf
 #
 
-additem bluetooth "Bluetooth configuration is up to date"
-do_bluetooth()
+handle_atf_user()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_bluetooth fix|check"
+	local op="$1"
+	local failed=0
+
+	local conf="${DEST_DIR}/etc/atf/common.conf"
+	if grep '[^#]*unprivileged-user[ \t]*=.*_atf' "${conf}" >/dev/null
+	then
+		if [ "$1" = "fix" ]; then
+			${SED} -e \
+			"/[^#]*unprivileged-user[\ t]*=/s/_atf/_tests/" \
+			"${conf}" >"${conf}.new"
+			failed=$(( ${failed} + $? ))
+			mv "${conf}.new" "${conf}"
+			failed=$(( ${failed} + $? ))
+			msg "Set unprivileged-user=_tests in ${conf}"
+		else
+			msg "unprivileged-user=_atf in ${conf} should be" \
+			"unprivileged-user=_tests"
+			failed=1
+		fi
+	fi
+
+	return ${failed}
+}
+
+additem atf "install missing atf configuration files and validate them"
+do_atf()
+{
+	[ -n "$1" ] || err 3 "USAGE: do_atf fix|check"
 	op="$1"
 	failed=0
 
-	populate_dir "${op}" true \
-		"${SRC_DIR}/etc/bluetooth" "${DEST_DIR}/etc/bluetooth" 644 \
-		hosts protocols btattach.conf btdevctl.conf
-	failed=$(( ${failed} + $? ))
-
-	move_file "${op}" "${DEST_DIR}/var/db/btdev.xml" \
-			"${DEST_DIR}/var/db/btdevctl.plist"
-	failed=$(( ${failed} + $? ))
+	# Ensure atf configuration files are in place.
+	if find_file_in_dirlist NetBSD.conf "NetBSD.conf" \
+	"${SRC_DIR}/external/bsd/atf/etc/atf" \
+	"${SRC_DIR}/etc/atf"; then
+			# ${dir} is set by find_file_in_dirlist()
+		populate_dir "${op}" true "${dir}" "${DEST_DIR}/etc/atf" 644 \
+		NetBSD.conf common.conf || failed=1
+	else
+		failed=1
+	fi
+	if find_file_in_dirlist atf-run.hooks "atf-run.hooks" \
+	"${SRC_DIR}/external/bsd/atf/dist/tools/sample" \
+	"${SRC_DIR}/etc/atf"; then
+			# ${dir} is set by find_file_in_dirlist()
+		populate_dir "${op}" true "${dir}" "${DEST_DIR}/etc/atf" 644 \
+		atf-run.hooks || failed=1
+	else
+		failed=1
+	fi
 
-	notfixed=""
-	if [ "${op}" = "fix" ]; then
-		notfixed="${NOT_FIXED}"
+	# Validate the _atf to _tests user/group renaming.
+	if [ -f "${DEST_DIR}/etc/atf/common.conf" ]; then
+		handle_atf_user "${op}" || failed=1
+	else
+		failed=1
 	fi
-	for _v in btattach btconfig btdevctl; do
-		if rcvar_is_enabled "${_v}"; then
-			msg \
-"${_v} is obsolete in rc.conf(5)${notfixed}: use bluetooth=YES"
-			failed=$(( ${failed} + 1 ))
-		fi
-	done
 
 	return ${failed}
 }
 
-fixblock() {
+
+#
+#	autofsconfig
+#
+
+additem autofsconfig "automounter configuration files"
+do_autofsconfig()
+{
+	[ -n "$1" ] || err 3 "USAGE: do_autofsconfig fix|check"
+	local autofs_files="
+include_ldap
+include_nis
+special_hosts
+special_media
+special_noauto
+special_null
+"
+	op="$1"
+	failed=0
+	if [ "$op" = "fix" ]; then
+		mkdir -p "${DEST_DIR}/etc/autofs"
+	fi
+	failed=$(( ${failed} + $? ))
+	populate_dir "$op" false "${SRC_DIR}/etc" \
+	"${DEST_DIR}/etc" \
+	644 \
+	auto_master
+	failed=$(( ${failed} + $? ))
+	populate_dir "$op" false "${SRC_DIR}/etc/autofs" \
+	"${DEST_DIR}/etc/autofs" \
+	644 \
+	${autofs_files}
+	return ${failed}
+}
+
+
+#
+#	blocklist
+#
+
+fixblock()
+{
 	local op="$1"
 	local target="${DEST_DIR}$2"
 
@@ -869,9 +945,6 @@ fixblock() {
 	fi
 }
 
-#
-#	blocklist update
-#
 additem blocklist "rename old files to blocklist"
 do_blocklist()
 {
@@ -897,9 +970,108 @@ do_blocklist()
 	

CVS commit: src/usr.sbin/postinstall

2021-04-24 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sun Apr 25 01:15:40 UTC 2021

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: comment and usage style

Use NOTE: for comments to be aware of.
Remove double space before "fix|check" in some items.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.35 src/usr.sbin/postinstall/postinstall.in:1.36
--- src/usr.sbin/postinstall/postinstall.in:1.35	Sun Apr 25 00:36:47 2021
+++ src/usr.sbin/postinstall/postinstall.in	Sun Apr 25 01:15:39 2021
@@ -1,8 +1,8 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.35 2021/04/25 00:36:47 lukem Exp $
+# $NetBSD: postinstall.in,v 1.36 2021/04/25 01:15:39 lukem Exp $
 #
-# Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
+# Copyright (c) 2002-2021 The NetBSD Foundation, Inc.
 # All rights reserved.
 #
 # This code is derived from software contributed to The NetBSD Foundation
@@ -35,7 +35,7 @@
 #
 
 #
-# XXX BE SURE TO USE ${DEST_DIR} PREFIX BEFORE ALL REAL FILE OPERATIONS XXX
+# NOTE: Be sure to use ${DEST_DIR} prefix before all real file operations.
 #
 
 #
@@ -517,7 +517,7 @@ file_exists_exact()
 #
 obsolete_paths()
 {
-	[ -n "$1" ] || err 3 "USAGE: obsolete_paths  fix|check"
+	[ -n "$1" ] || err 3 "USAGE: obsolete_paths fix|check"
 	op="$1"
 
 	failed=0
@@ -875,7 +875,7 @@ fixblock() {
 additem blocklist "rename old files to blocklist"
 do_blocklist()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_blocklist  fix|check"
+	[ -n "$1" ] || err 3 "USAGE: do_blocklist fix|check"
 	local op="$1"
 
 	# if we are actually using blocklistd
@@ -903,7 +903,7 @@ do_blocklist()
 additem ddbonpanic "verify ddb.onpanic is configured in sysctl.conf"
 do_ddbonpanic()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_ddbonpanic  fix|check"
+	[ -n "$1" ] || err 3 "USAGE: do_ddbonpanic fix|check"
 
 	if ${GREP} -E '^#*[[:space:]]*ddb\.onpanic[[:space:]]*\??=[[:space:]]*[[:digit:]]+' \
 		"${DEST_DIR}/etc/sysctl.conf" >/dev/null 2>&1
@@ -932,7 +932,7 @@ do_ddbonpanic()
 additem defaults "/etc/defaults/ being up to date"
 do_defaults()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_defaults  fix|check"
+	[ -n "$1" ] || err 3 "USAGE: do_defaults fix|check"
 	local op="$1"
 	local failed=0
 	local etcsets=$(getetcsets)
@@ -1256,7 +1256,7 @@ do_fontconfig()
 additem gid "required groups in /etc/group"
 do_gid()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_gid  fix|check"
+	[ -n "$1" ] || err 3 "USAGE: do_gid fix|check"
 
 	check_ids "$1" groups "${DEST_DIR}/etc/group" \
 	"${SRC_DIR}/etc/group" 14 \
@@ -1288,7 +1288,7 @@ do_gpio()
 additem hosts "/etc/hosts being up to date"
 do_hosts()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_hosts  fix|check"
+	[ -n "$1" ] || err 3 "USAGE: do_hosts fix|check"
 
 	modify_file "$1" "${DEST_DIR}/etc/hosts" "${SCRATCHDIR}/hosts" '
 		/^(127\.0\.0\.1|::1)[ 	]+[^\.]*$/ {
@@ -1306,7 +1306,7 @@ do_hosts()
 additem iscsi "/etc/iscsi is populated"
 do_iscsi()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_iscsi  fix|check"
+	[ -n "$1" ] || err 3 "USAGE: do_iscsi fix|check"
 
 	populate_dir "${op}" true \
 	"${SRC_DIR}/etc/iscsi" "${DEST_DIR}/etc/iscsi" 600 auths
@@ -1321,7 +1321,7 @@ do_iscsi()
 additem makedev "/dev/MAKEDEV being up to date"
 do_makedev()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_makedev   fix|check"
+	[ -n "$1" ] || err 3 "USAGE: do_makedev fix|check"
 	failed=0
 
 	if [ -f "${SRC_DIR}/etc/MAKEDEV.tmpl" ]; then
@@ -1357,7 +1357,7 @@ do_makedev()
 additem motd "contents of motd"
 do_motd()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_motd  fix|check"
+	[ -n "$1" ] || err 3 "USAGE: do_motd fix|check"
 
 	if ${GREP} -i 'http://www.NetBSD.org/Misc/send-pr.html' \
 		"${DEST_DIR}/etc/motd" >/dev/null 2>&1 \
@@ -1397,7 +1397,7 @@ do_motd()
 additem mtree "/etc/mtree/ being up to date"
 do_mtree()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_mtree  fix|check"
+	[ -n "$1" ] || err 3 "USAGE: do_mtree fix|check"
 	failed=0
 
 	compare_dir "$1" "${SRC_DIR}/etc/mtree" "${DEST_DIR}/etc/mtree" 444 special
@@ -1426,7 +1426,7 @@ do_mtree()
 additem named "named configuration update"
 do_named()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_named  fix|check"
+	[ -n "$1" ] || err 3 "USAGE: do_named fix|check"
 	op="$1"
 
 	move_file "${op}" \
@@ -1444,7 +1444,7 @@ do_named()
 additem pam "/etc/pam.d is populated"
 do_pam()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_pam  fix|check"
+	[ -n "$1" ] || err 3 "USAGE: do_pam fix|check"
 	op="$1"
 	failed=0
 
@@ -1465,7 +1465,7 @@ do_pam()
 additem periodic "/etc/{daily,weekly,monthly,security} being up to date"
 do_periodic()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_periodic  fix|check"
+	[ -n "$1" ] || err 3 "USAGE: do_periodic fix|check"
 
 	compare_dir "$1" "${SRC_DIR}/etc" "${DEST_DIR}/etc" 644 \
 		daily weekly monthly security
@@ 

CVS commit: src/usr.sbin/postinstall

2021-04-24 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sun Apr 25 00:36:47 UTC 2021

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: ensure SRC_DIR and DEST_DIR are quoted


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.34 src/usr.sbin/postinstall/postinstall.in:1.35
--- src/usr.sbin/postinstall/postinstall.in:1.34	Sun Apr 25 00:29:52 2021
+++ src/usr.sbin/postinstall/postinstall.in	Sun Apr 25 00:36:47 2021
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.34 2021/04/25 00:29:52 lukem Exp $
+# $NetBSD: postinstall.in,v 1.35 2021/04/25 00:36:47 lukem Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1599,7 +1599,7 @@ select_obsolete_files()
 {
 	if $SOURCEMODE; then
 		${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" \
-		${SRC_DIR}/distrib/sets/lists/$3/mi
+		"${SRC_DIR}/distrib/sets/lists/$3/mi"
 		return
 	fi
 
@@ -1610,9 +1610,9 @@ select_obsolete_files()
 	local obsolete_dir
 
 	if [ $3 = "etc" ] ;then
-		obsolete_dir=${SRC_DIR}/var/db/obsolete
+		obsolete_dir="${SRC_DIR}/var/db/obsolete"
 	else
-		obsolete_dir=${DEST_DIR}/var/db/obsolete
+		obsolete_dir="${DEST_DIR}/var/db/obsolete"
 	fi
 	${SED} -n -e "s@\.$1$2\$@\1@p" "${obsolete_dir}/$3"
 }
@@ -2397,7 +2397,7 @@ listarchsubdirs() {
 		echo "@ARCHSUBDIRS@"
 	else
 		${SED} -n -e '/ARCHDIR_SUBDIR/s/[[:space:]]//gp' \
-		${SRC_DIR}/compat/archdirs.mk
+		"${SRC_DIR}/compat/archdirs.mk"
 	fi
 }
 



CVS commit: src/usr.sbin/postinstall

2021-04-24 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sun Apr 25 00:29:52 UTC 2021

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: use correct DEST_DIR in obsolete_stand


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.33 src/usr.sbin/postinstall/postinstall.in:1.34
--- src/usr.sbin/postinstall/postinstall.in:1.33	Fri Aug 28 15:26:23 2020
+++ src/usr.sbin/postinstall/postinstall.in	Sun Apr 25 00:29:52 2021
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.33 2020/08/28 15:26:23 christos Exp $
+# $NetBSD: postinstall.in,v 1.34 2021/04/25 00:29:52 lukem Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2371,7 +2371,7 @@ obsolete_stand_internal()
 	${prefix}/stand/${MACHINE}-xen \
 	${prefix}/stand/${MACHINE}pae-xen
 	do
-		[ -d "${DESTDIR}${dir}" ] && obsolete_stand "${dir}"
+		[ -d "${DEST_DIR}${dir}" ] && obsolete_stand "${dir}"
 	done | obsolete_paths "${op}"
 	failed=$(( ${failed} + $? ))
 



CVS commit: src/usr.sbin/wsfontload

2021-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 24 09:18:44 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
wsfontload.8: clean up examples

add an example of loading a larger font since a lot of people ask.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/wsfontload/wsfontload.8

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/wsfontload/wsfontload.8
diff -u src/usr.sbin/wsfontload/wsfontload.8:1.30 src/usr.sbin/wsfontload/wsfontload.8:1.31
--- src/usr.sbin/wsfontload/wsfontload.8:1.30	Sat Apr 24 09:03:05 2021
+++ src/usr.sbin/wsfontload/wsfontload.8	Sat Apr 24 09:18:44 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wsfontload.8,v 1.30 2021/04/24 09:03:05 nia Exp $
+.\"	$NetBSD: wsfontload.8,v 1.31 2021/04/24 09:18:44 nia Exp $
 .\"
 .\" Copyright (c) 1999, 2001
 .\" 	Matthias Drochner.  All rights reserved.
@@ -117,23 +117,27 @@ configuration file.
 .Pa /etc/wscons.conf
 .Pa /usr/share/wscons/fonts
 .Sh EXAMPLES
-.Dl wsfontload -N myname -h 8 -e ibm /usr/share/wscons/fonts/vt220l.808
+Load the ISO-encoded 16x32 Spleen font and switch the first console
+screen to use it:
+.Pp
+.Bd -offset indent -unfilled
+# wsfontload -w 16 -h 32 -e iso -N spleen32 \\
+	/usr/share/wscons/fonts/spleen-16x32.fnt
+# wsconsctl -dw font=spleen32
+.Ed
 .Pp
 Load the IBM-encoded 8\(mu8-font from the
 .Xr wscons 4
-distribution.
+distribution:
+.Pp
+.Bd -offset indent -unfilled
+# wsfontload -N myname -h 8 -e ibm /usr/share/wscons/fonts/vt220l.808
+.Ed
+.Pp
 This (or another 8\(mu8-font) is necessary to use the
 50-line screen type on
 .Xr vga 4
 displays.
-.Pp
-.Dl wsfontload -N orator -e ibm /usr/share/wscons/fonts/orator.816
-.Dl wsconsctl -dw font=orator
-.Pp
-Load the
-.Dq orator
-IBM-encoded 8\(mu16 font and switch the first console screen
-(ttyE0, wsconsctl's default) to this alternate font.
 .Sh SEE ALSO
 .Xr wscons 4 ,
 .Xr wsconscfg 8 ,



CVS commit: src/usr.sbin/wsfontload

2021-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 24 09:03:05 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
wsfontload: clarify more


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/wsfontload/wsfontload.8

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/wsfontload/wsfontload.8
diff -u src/usr.sbin/wsfontload/wsfontload.8:1.29 src/usr.sbin/wsfontload/wsfontload.8:1.30
--- src/usr.sbin/wsfontload/wsfontload.8:1.29	Sat Apr 24 08:59:09 2021
+++ src/usr.sbin/wsfontload/wsfontload.8	Sat Apr 24 09:03:05 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wsfontload.8,v 1.29 2021/04/24 08:59:09 nia Exp $
+.\"	$NetBSD: wsfontload.8,v 1.30 2021/04/24 09:03:05 nia Exp $
 .\"
 .\" Copyright (c) 1999, 2001
 .\" 	Matthias Drochner.  All rights reserved.
@@ -93,8 +93,7 @@ Default is
 Sets the height of a font character in pixels.
 Default is 16.
 .It Fl l
-Print a list of available fonts that are built-in to the kernel
-(as opposed to fonts available to load from the filesystem).
+Print a list of fonts that have been loaded or are built-in to the kernel.
 .It Fl N Ar name
 Specifies a name which can be used later to refer to the font.
 If none is given, the
@@ -143,5 +142,3 @@ IBM-encoded 8\(mu16 font and switch the 
 Many features are missing.
 .Pp
 There is no way to remove a loaded font.
-.Pp
-There is no way to determine which fonts have been loaded.



CVS commit: src/usr.sbin/wsfontload

2021-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 24 08:59:09 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
wsfontload: clarify documentation of -l


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/wsfontload/wsfontload.8

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/wsfontload/wsfontload.8
diff -u src/usr.sbin/wsfontload/wsfontload.8:1.28 src/usr.sbin/wsfontload/wsfontload.8:1.29
--- src/usr.sbin/wsfontload/wsfontload.8:1.28	Sat Apr 24 07:52:07 2021
+++ src/usr.sbin/wsfontload/wsfontload.8	Sat Apr 24 08:59:09 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wsfontload.8,v 1.28 2021/04/24 07:52:07 wiz Exp $
+.\"	$NetBSD: wsfontload.8,v 1.29 2021/04/24 08:59:09 nia Exp $
 .\"
 .\" Copyright (c) 1999, 2001
 .\" 	Matthias Drochner.  All rights reserved.
@@ -93,7 +93,8 @@ Default is
 Sets the height of a font character in pixels.
 Default is 16.
 .It Fl l
-Print a list of available fonts.
+Print a list of available fonts that are built-in to the kernel
+(as opposed to fonts available to load from the filesystem).
 .It Fl N Ar name
 Specifies a name which can be used later to refer to the font.
 If none is given, the



CVS commit: src/usr.sbin/wsfontload

2021-04-24 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Apr 24 07:52:08 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8 wsfontload.c

Log Message:
wsfontload: make -l mode a separate line in the usage

Document it in the manpage.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/wsfontload/wsfontload.8
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/wsfontload/wsfontload.c

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

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.8
diff -u src/usr.sbin/wsfontload/wsfontload.8:1.27 src/usr.sbin/wsfontload/wsfontload.8:1.28
--- src/usr.sbin/wsfontload/wsfontload.8:1.27	Thu May 30 14:58:51 2019
+++ src/usr.sbin/wsfontload/wsfontload.8	Sat Apr 24 07:52:07 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wsfontload.8,v 1.27 2019/05/30 14:58:51 pgoyette Exp $
+.\"	$NetBSD: wsfontload.8,v 1.28 2021/04/24 07:52:07 wiz Exp $
 .\"
 .\" Copyright (c) 1999, 2001
 .\" 	Matthias Drochner.  All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 30, 2019
+.Dd April 24, 2021
 .Dt WSFONTLOAD 8
 .Os
 .Sh NAME
@@ -39,6 +39,7 @@
 .Op Fl N Ar name
 .Op Fl w Ar width
 .Op Ar fontfile
+.Nm Fl l
 .Sh DESCRIPTION
 The
 .Nm
@@ -91,6 +92,8 @@ Default is
 .It Fl h Ar height
 Sets the height of a font character in pixels.
 Default is 16.
+.It Fl l
+Print a list of available fonts.
 .It Fl N Ar name
 Specifies a name which can be used later to refer to the font.
 If none is given, the

Index: src/usr.sbin/wsfontload/wsfontload.c
diff -u src/usr.sbin/wsfontload/wsfontload.c:1.22 src/usr.sbin/wsfontload/wsfontload.c:1.23
--- src/usr.sbin/wsfontload/wsfontload.c:1.22	Sat Apr 24 00:49:26 2021
+++ src/usr.sbin/wsfontload/wsfontload.c	Sat Apr 24 07:52:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfontload.c,v 1.22 2021/04/24 00:49:26 macallan Exp $ */
+/* $NetBSD: wsfontload.c,v 1.23 2021/04/24 07:52:07 wiz Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -76,8 +76,10 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-		"usage: %s [-Bbvl] [-e encoding] [-f wsdev] [-h height]"
-		" [-N name] [-w width] [fontfile]\n",
+		"usage: %s [-Bbv] [-e encoding] [-f wsdev] [-h height]"
+		" [-N name] [-w width] [fontfile]\n"
+		"   %s -l\n",
+		  getprogname(),
 		  getprogname());
 	exit(1);
 }



CVS commit: src/usr.sbin/wsfontload

2021-04-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr 24 00:49:26 UTC 2021

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

Log Message:
add -l option to dump a list of available fonts


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/wsfontload/wsfontload.c

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

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.c
diff -u src/usr.sbin/wsfontload/wsfontload.c:1.21 src/usr.sbin/wsfontload/wsfontload.c:1.22
--- src/usr.sbin/wsfontload/wsfontload.c:1.21	Fri Jun 23 18:40:03 2017
+++ src/usr.sbin/wsfontload/wsfontload.c	Sat Apr 24 00:49:26 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfontload.c,v 1.21 2017/06/23 18:40:03 macallan Exp $ */
+/* $NetBSD: wsfontload.c,v 1.22 2021/04/24 00:49:26 macallan Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -76,7 +76,7 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-		"usage: %s [-Bbv] [-e encoding] [-f wsdev] [-h height]"
+		"usage: %s [-Bbvl] [-e encoding] [-f wsdev] [-h height]"
 		" [-N name] [-w width] [fontfile]\n",
 		  getprogname());
 	exit(1);
@@ -136,8 +136,8 @@ main(int argc, char **argv)
 	const char *wsdev;
 	struct wsdisplay_font f;
 	struct stat st;
-	int c, res, wsfd, ffd, verbose = 0;
 	size_t len;
+	int c, res, wsfd, ffd, verbose = 0, listfonts = 0;
 	int use_embedded_name = 1;
 	void *buf;
 	char nbuf[65];
@@ -153,11 +153,14 @@ main(int argc, char **argv)
 	f.bitorder = DEFBITORDER;
 	f.byteorder = DEFBYTEORDER;
 
-	while ((c = getopt(argc, argv, "f:w:h:e:N:bBv")) != -1) {
+	while ((c = getopt(argc, argv, "f:w:h:e:N:bBvl")) != -1) {
 		switch (c) {
 		case 'f':
 			wsdev = optarg;
 			break;
+		case 'l':
+			listfonts = 1;
+			break;
 		case 'w':
 			if (sscanf(optarg, "%d", ) != 1)
 errx(1, "invalid font width");
@@ -198,6 +201,25 @@ main(int argc, char **argv)
 	if (wsfd < 0)
 		err(2, "open ws-device %s", wsdev);
 
+	if (listfonts == 1) {
+		struct wsdisplayio_fontinfo fi;
+		int ret;
+		unsigned int i;
+
+		fi.fi_buffersize = 4096;
+		fi.fi_numentries = 0;
+		fi.fi_fonts = malloc(4096);
+		ret = ioctl(wsfd, WSDISPLAYIO_LISTFONTS, );
+		if (fi.fi_fonts == NULL || ret != 0) {
+			err(1, "error fetching font list\n");
+		}
+		for (i = 0; i < fi.fi_numentries; i++) {
+			printf("%s %dx%d\n", fi.fi_fonts[i].fd_name,
+			fi.fi_fonts[i].fd_width, fi.fi_fonts[i].fd_height);
+		}
+		return 0;
+	}	
+
 	if (argc > 0) {
 		ffd = open(argv[0], O_RDONLY, 0);
 		if (ffd < 0)



CVS commit: src/usr.sbin/sysinst

2021-04-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Apr 13 07:53:19 UTC 2021

Modified Files:
src/usr.sbin/sysinst: Makefile.inc

Log Message:
some platforms trip -fcommon here too.  we should fix this.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/sysinst/Makefile.inc

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/Makefile.inc
diff -u src/usr.sbin/sysinst/Makefile.inc:1.39 src/usr.sbin/sysinst/Makefile.inc:1.40
--- src/usr.sbin/sysinst/Makefile.inc:1.39	Tue Apr 13 04:59:00 2021
+++ src/usr.sbin/sysinst/Makefile.inc	Tue Apr 13 07:53:19 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.39 2021/04/13 04:59:00 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.40 2021/04/13 07:53:19 mrg Exp $
 #
 # Makefile for sysinst
 
@@ -253,5 +253,6 @@ check-lang:	msg.def msg_defs.h
 	@rm /tmp/sysinst.en
 
 COPTS.util.c+=	${GCC_NO_STRINGOP_TRUNCATION}
+COPTS+=		-fcommon
 
 .include 



CVS commit: src/usr.sbin/rpcbind

2021-04-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Apr 13 05:58:45 UTC 2021

Modified Files:
src/usr.sbin/rpcbind: rpcb_svc_com.c

Log Message:
avoid potential uninitialised variable use.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/rpcbind/rpcb_svc_com.c

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

Modified files:

Index: src/usr.sbin/rpcbind/rpcb_svc_com.c
diff -u src/usr.sbin/rpcbind/rpcb_svc_com.c:1.24 src/usr.sbin/rpcbind/rpcb_svc_com.c:1.25
--- src/usr.sbin/rpcbind/rpcb_svc_com.c:1.24	Sun Mar  7 00:23:06 2021
+++ src/usr.sbin/rpcbind/rpcb_svc_com.c	Tue Apr 13 05:58:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcb_svc_com.c,v 1.24 2021/03/07 00:23:06 christos Exp $	*/
+/*	$NetBSD: rpcb_svc_com.c,v 1.25 2021/04/13 05:58:45 mrg Exp $	*/
 /*	$FreeBSD: head/usr.sbin/rpcbind/rpcb_svc_com.c 301770 2016-06-09 22:25:00Z pfg $ */
 
 /*-
@@ -1275,6 +1275,8 @@ handle_reply(int fd, SVCXPRT *xprt)
 	char *uaddr;
 #endif
 
+	reply_msg.rm_xid = 0;
+
 	buffer = malloc(RPC_BUF_MAX);
 	if (buffer == NULL)
 		goto done;



CVS commit: src/usr.sbin/hdaudioctl

2021-04-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Apr 12 12:22:10 UTC 2021

Modified Files:
src/usr.sbin/hdaudioctl: hdaudioctl.8

Log Message:
hdaudioctl.8: add missing arguments

pointed out by RVP


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/hdaudioctl/hdaudioctl.8

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/hdaudioctl/hdaudioctl.8
diff -u src/usr.sbin/hdaudioctl/hdaudioctl.8:1.7 src/usr.sbin/hdaudioctl/hdaudioctl.8:1.8
--- src/usr.sbin/hdaudioctl/hdaudioctl.8:1.7	Mon Jun 15 13:06:39 2020
+++ src/usr.sbin/hdaudioctl/hdaudioctl.8	Mon Apr 12 12:22:10 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hdaudioctl.8,v 1.7 2020/06/15 13:06:39 sborrill Exp $
+.\"	$NetBSD: hdaudioctl.8,v 1.8 2021/04/12 12:22:10 nia Exp $
 .\"
 .\" Copyright (c) 2009 Precedence Technologies Ltd 
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 12, 2020
+.Dd April 12, 2021
 .Dt HDAUDIOCTL 8
 .Os
 .Sh NAME
@@ -55,7 +55,7 @@ Valid commands are:
 For each child codec of the chosen
 .Xr hdaudio 4
 device, display the nid, vendor, product, subsystem and device IDs.
-.It show
+.It show Ar codecid Ar nid
 Retrieve and display the current codec configuration in human-readable form.
 .It get Ar codecid Ar nid
 Retrieve and display the current codec configuration as a



CVS commit: src/usr.sbin/moused

2021-04-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Apr 12 09:30:32 UTC 2021

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

Log Message:
avoid attempting to print NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/moused/moused.c

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

Modified files:

Index: src/usr.sbin/moused/moused.c
diff -u src/usr.sbin/moused/moused.c:1.25 src/usr.sbin/moused/moused.c:1.26
--- src/usr.sbin/moused/moused.c:1.25	Sat Oct 18 08:33:31 2014
+++ src/usr.sbin/moused/moused.c	Mon Apr 12 09:30:32 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: moused.c,v 1.25 2014/10/18 08:33:31 snj Exp $ */
+/* $NetBSD: moused.c,v 1.26 2021/04/12 09:30:32 mrg Exp $ */
 /**
  ** Copyright (c) 1995 Michael Smith, All rights reserved.
  **
@@ -48,7 +48,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: moused.c,v 1.25 2014/10/18 08:33:31 snj Exp $");
+__RCSID("$NetBSD: moused.c,v 1.26 2021/04/12 09:30:32 mrg Exp $");
 #endif /* not lint */
 
 #include 
@@ -2540,11 +2540,11 @@ pnpparse(pnpid_t *id, char *buf, int len
 int i, j;
 
 id->revision = 0;
-id->eisaid = NULL;
+id->eisaid = "";
 id->serial = NULL;
 id->class = NULL;
-id->compat = NULL;
-id->description = NULL;
+id->compat = "";
+id->description = "";
 id->neisaid = 0;
 id->nserial = 0;
 id->nclass = 0;



CVS commit: src/usr.sbin/ac

2021-04-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Apr 12 09:29:53 UTC 2021

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

Log Message:
use strlcpy() to ensure desired nul termination.
trailing nul bytes are not needed here.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/ac/ac.c

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

Modified files:

Index: src/usr.sbin/ac/ac.c
diff -u src/usr.sbin/ac/ac.c:1.25 src/usr.sbin/ac/ac.c:1.26
--- src/usr.sbin/ac/ac.c:1.25	Fri Aug 31 19:55:23 2012
+++ src/usr.sbin/ac/ac.c	Mon Apr 12 09:29:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ac.c,v 1.25 2012/08/31 19:55:23 wiz Exp $ */
+/* $NetBSD: ac.c,v 1.26 2021/04/12 09:29:53 mrg Exp $ */
 
 /*-
  * Copyright (c) 1994 Christopher G. Demetriou
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ac.c,v 1.25 2012/08/31 19:55:23 wiz Exp $");
+__RCSID("$NetBSD: ac.c,v 1.26 2021/04/12 09:29:53 mrg Exp $");
 #endif
 
 #include 
@@ -214,7 +214,7 @@ find_login_ttys(void)
 Con = nCon;
 Maxcon += 10;
 			}
-			(void)strncpy(Con[Ncon++], tty->ty_name, UT_LINESIZE);
+			strlcpy(Con[Ncon++], tty->ty_name, UT_LINESIZE);
 		}
 	endttyent();
 	qsort(Con, Ncon, sizeof(Con[0]), compare);



CVS commit: src/usr.sbin/pstat

2021-04-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Apr 12 05:11:10 UTC 2021

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

Log Message:
fix a buffer size (off by one), and fix all the comments for the
3 other correctly sized buffers with the same comment/context.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/usr.sbin/pstat/pstat.c

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

Modified files:

Index: src/usr.sbin/pstat/pstat.c
diff -u src/usr.sbin/pstat/pstat.c:1.131 src/usr.sbin/pstat/pstat.c:1.132
--- src/usr.sbin/pstat/pstat.c:1.131	Sat Oct  3 14:01:16 2020
+++ src/usr.sbin/pstat/pstat.c	Mon Apr 12 05:11:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pstat.c,v 1.131 2020/10/03 14:01:16 christos Exp $	*/
+/*	$NetBSD: pstat.c,v 1.132 2021/04/12 05:11:09 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)pstat.c	8.16 (Berkeley) 5/9/95";
 #else
-__RCSID("$NetBSD: pstat.c,v 1.131 2020/10/03 14:01:16 christos Exp $");
+__RCSID("$NetBSD: pstat.c,v 1.132 2021/04/12 05:11:09 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -481,7 +481,7 @@ ufs_print(struct vnode *vp, int ovflw)
 	} dip;
 	struct ufsmount ump;
 	char flags[sizeof(ufs_flags) / sizeof(ufs_flags[0])];
-	char dev[4 + 1 + 7 + 1]; /* 12bit marjor + 20bit minor */
+	char dev[4 + 1 + 7 + 1]; /* 12bit major + 20bit minor */
 	char *name;
 	mode_t type;
 	dev_t rdev;
@@ -526,7 +526,7 @@ ext2fs_print(struct vnode *vp, int ovflw
 	struct inode inode, *ip = 
 	struct ext2fs_dinode dip;
 	char flags[sizeof(ufs_flags) / sizeof(ufs_flags[0])];
-	char dev[4 + 1 + 7 + 1]; /* 12bit marjor + 20bit minor */
+	char dev[4 + 1 + 7 + 1]; /* 12bit major + 20bit minor */
 	char *name;
 	mode_t type;
 
@@ -577,7 +577,7 @@ nfs_print(struct vnode *vp, int ovflw)
 {
 	struct nfsnode nfsnode, *np = 
 	char flags[sizeof(nfs_flags) / sizeof(nfs_flags[0])];
-	char dev[4 + 1 + 7 + 1]; /* 12bit marjor + 20bit minor */
+	char dev[4 + 1 + 7 + 1]; /* 12bit major + 20bit minor */
 	struct vattr va;
 	char *name;
 	mode_t type;
@@ -835,7 +835,7 @@ void
 ttyprt(struct tty *tp)
 {
 	char state[sizeof(ttystates) / sizeof(ttystates[0]) + 1];
-	char dev[2 + 3 + 1 + 5 + 1]; /* 12bit major + 20bit minor */
+	char dev[4 + 1 + 7 + 1]; /* 12bit major + 20bit minor */
 	struct linesw t_linesw;
 	const char *name;
 	char buffer;



CVS commit: src/usr.sbin/makefs

2021-04-03 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr  3 14:10:56 UTC 2021

Modified Files:
src/usr.sbin/makefs: makefs.8 makefs.c makefs.h walk.c

Log Message:
Add a -L option to follow all symbolic links.  Useful if you have symlinks
in a makefs directory tree but want to refer to the actual file.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/makefs/makefs.8
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/makefs/makefs.c
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/makefs/makefs.h
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/makefs/walk.c

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

Modified files:

Index: src/usr.sbin/makefs/makefs.8
diff -u src/usr.sbin/makefs/makefs.8:1.66 src/usr.sbin/makefs/makefs.8:1.67
--- src/usr.sbin/makefs/makefs.8:1.66	Sun Nov 15 00:18:48 2020
+++ src/usr.sbin/makefs/makefs.8	Sat Apr  3 14:10:56 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: makefs.8,v 1.66 2020/11/15 00:18:48 jmcneill Exp $
+.\"	$NetBSD: makefs.8,v 1.67 2021/04/03 14:10:56 simonb Exp $
 .\"
 .\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 14, 2020
+.Dd April 4, 2021
 .Dt MAKEFS 8
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@
 .Nd create a file system image from a directory tree
 .Sh SYNOPSIS
 .Nm
-.Op Fl rxZ
+.Op Fl LrxZ
 .Op Fl B Ar endian
 .Op Fl b Ar free-blocks
 .Op Fl d Ar debug-mask
@@ -158,6 +158,8 @@ An optional
 suffix may be provided to indicate that
 .Ar free-files
 indicates a percentage of the calculated image size.
+.It Fl L
+All symbolic links are followed.
 .It Fl M Ar minimum-size
 Set the minimum size of the file system image to
 .Ar minimum-size .

Index: src/usr.sbin/makefs/makefs.c
diff -u src/usr.sbin/makefs/makefs.c:1.53 src/usr.sbin/makefs/makefs.c:1.54
--- src/usr.sbin/makefs/makefs.c:1.53	Fri Nov 27 15:10:32 2015
+++ src/usr.sbin/makefs/makefs.c	Sat Apr  3 14:10:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: makefs.c,v 1.53 2015/11/27 15:10:32 joerg Exp $	*/
+/*	$NetBSD: makefs.c,v 1.54 2021/04/03 14:10:56 simonb Exp $	*/
 
 /*
  * Copyright (c) 2001-2003 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: makefs.c,v 1.53 2015/11/27 15:10:32 joerg Exp $");
+__RCSID("$NetBSD: makefs.c,v 1.54 2021/04/03 14:10:56 simonb Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -129,7 +129,7 @@ main(int argc, char *argv[])
 		err(1, "Unable to get system time");
 
 
-	while ((ch = getopt(argc, argv, "B:b:d:f:F:M:m:N:O:o:rs:S:t:T:xZ")) != -1) {
+	while ((ch = getopt(argc, argv, "B:b:d:f:F:LM:m:N:O:o:rs:S:t:T:xZ")) != -1) {
 		switch (ch) {
 
 		case 'B':
@@ -187,6 +187,10 @@ main(int argc, char *argv[])
 			specfile = optarg;
 			break;
 
+		case 'L':
+			fsoptions.follow = true;
+			break;
+
 		case 'M':
 			fsoptions.minsize =
 			strsuftoll("minimum size", optarg, 1LL, LLONG_MAX);
@@ -286,7 +290,8 @@ main(int argc, char *argv[])
 
 /* walk the tree */
 	TIMER_START(start);
-	root = walk_dir(argv[1], ".", NULL, NULL, fsoptions.replace);
+	root = walk_dir(argv[1], ".", NULL, NULL, fsoptions.replace,
+	fsoptions.follow);
 	TIMER_RESULTS(start, "walk_dir");
 
 	/* append extra directory */
@@ -297,7 +302,8 @@ main(int argc, char *argv[])
 		if (!S_ISDIR(sb.st_mode))
 			errx(1, "%s: not a directory", argv[i]);
 		TIMER_START(start);
-		root = walk_dir(argv[i], ".", NULL, root, fsoptions.replace);
+		root = walk_dir(argv[i], ".", NULL, root, fsoptions.replace,
+		fsoptions.follow);
 		TIMER_RESULTS(start, "walk_dir2");
 	}
 

Index: src/usr.sbin/makefs/makefs.h
diff -u src/usr.sbin/makefs/makefs.h:1.36 src/usr.sbin/makefs/makefs.h:1.37
--- src/usr.sbin/makefs/makefs.h:1.36	Wed Nov 25 00:48:49 2015
+++ src/usr.sbin/makefs/makefs.h	Sat Apr  3 14:10:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: makefs.h,v 1.36 2015/11/25 00:48:49 christos Exp $	*/
+/*	$NetBSD: makefs.h,v 1.37 2021/04/03 14:10:56 simonb Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -166,6 +166,7 @@ typedef struct makefs_fsinfo {
 	int	sectorsize;	/* sector size */
 	int	sparse;		/* sparse image, don't fill it with zeros */
 	int	replace;	/* replace files when merging */
+	int	follow;		/* follow symlinks */
 
 	void	*fs_specific;	/* File system specific additions. */
 	option_t *fs_options;	/* File system specific options */
@@ -180,7 +181,8 @@ const char *	inode_type(mode_t);
 int		set_option(const option_t *, const char *, char *, size_t);
 int		set_option_var(const option_t *, const char *, const char *,
 char *, size_t);
-fsnode *	walk_dir(const char *, const char *, fsnode *, fsnode *, int);
+fsnode *	walk_dir(const char *, const char *, fsnode *, fsnode *, int,
+int);
 void		free_fsnodes(fsnode *);
 option_t *	copy_opts(const option_t *);
 

Index: src/usr.sbin/makefs/walk.c
diff -u 

CVS commit: src/usr.sbin/mtree

2021-04-03 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr  3 13:37:18 UTC 2021

Modified Files:
src/usr.sbin/mtree: compare.c

Log Message:
Deal with the case when a device gets recreated (eg when mtree is called by
MAKEDEV) and the stat buffer contains information about the original device
before checking/setting the owner/group/mode of the new device file.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/mtree/compare.c

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

Modified files:

Index: src/usr.sbin/mtree/compare.c
diff -u src/usr.sbin/mtree/compare.c:1.59 src/usr.sbin/mtree/compare.c:1.60
--- src/usr.sbin/mtree/compare.c:1.59	Thu Mar 18 20:02:18 2021
+++ src/usr.sbin/mtree/compare.c	Sat Apr  3 13:37:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: compare.c,v 1.59 2021/03/18 20:02:18 cheusov Exp $	*/
+/*	$NetBSD: compare.c,v 1.60 2021/04/03 13:37:18 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)compare.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: compare.c,v 1.59 2021/03/18 20:02:18 cheusov Exp $");
+__RCSID("$NetBSD: compare.c,v 1.60 2021/04/03 13:37:18 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -137,6 +137,7 @@ compare(NODE *s, FTSENT *p)
 {
 	uint32_t len, val, flags;
 	int fd, label;
+	bool was_unlinked;
 	const char *cp, *tab;
 #if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2)
 	char *digestbuf;
@@ -144,6 +145,7 @@ compare(NODE *s, FTSENT *p)
 
 	tab = NULL;
 	label = 0;
+	was_unlinked = false;
 	switch(s->type) {
 	case F_BLOCK:
 		if (!S_ISBLK(p->fts_statp->st_mode))
@@ -210,19 +212,22 @@ typeerr:		LABEL;
 			  s->st_mode | nodetoino(s->type),
 			  s->st_rdev) == -1) ||
 			(lchown(p->fts_accpath, p->fts_statp->st_uid,
-			  p->fts_statp->st_gid) == -1) )
+			  p->fts_statp->st_gid) == -1) ) {
 printf(", not modified: %s%s\n",
 strerror(errno),
 flavor == F_FREEBSD9 ? "" : ")");
-			 else
+			} else {
 printf(", modified%s\n",
 flavor == F_FREEBSD9 ? "" : ")");
+was_unlinked = true;
+			}
 		} else
 			printf(")\n");
 		tab = "\t";
 	}
 	/* Set the uid/gid first, then set the mode. */
-	if (s->flags & (F_UID | F_UNAME) && s->st_uid != p->fts_statp->st_uid) {
+	if (s->flags & (F_UID | F_UNAME) &&
+	(was_unlinked || s->st_uid != p->fts_statp->st_uid)) {
 		LABEL;
 		printf(flavor == F_FREEBSD9 ?
 		"%suser expected %lu found %lu" : "%suser (%lu, %lu",
@@ -233,13 +238,15 @@ typeerr:		LABEL;
 strerror(errno),
 flavor == F_FREEBSD9 ? "" : ")");
 			else
-printf(", modified%s\n",
+printf(", modified%s%s\n",
+was_unlinked ? " by unlink" : "",
 flavor == F_FREEBSD9 ? "" : ")");
 		} else
 			printf(")\n");
 		tab = "\t";
 	}
-	if (s->flags & (F_GID | F_GNAME) && s->st_gid != p->fts_statp->st_gid) {
+	if (s->flags & (F_GID | F_GNAME) &&
+	(was_unlinked || s->st_gid != p->fts_statp->st_gid)) {
 		LABEL;
 		printf(flavor == F_FREEBSD9 ?
 		"%sgid expected %lu found %lu" : "%sgid (%lu, %lu",
@@ -250,7 +257,8 @@ typeerr:		LABEL;
 strerror(errno),
 flavor == F_FREEBSD9 ? "" : ")");
 			else
-printf(", modified%s\n",
+printf(", modified%s%s\n",
+was_unlinked ? " by unlink" : "",
 flavor == F_FREEBSD9 ? "" : ")");
 		}
 		else
@@ -258,8 +266,8 @@ typeerr:		LABEL;
 		tab = "\t";
 	}
 	if (s->flags & F_MODE &&
-	s->st_mode != (p->fts_statp->st_mode & MBITS)) {
-		if (lflag) {
+	(was_unlinked || s->st_mode != (p->fts_statp->st_mode & MBITS))) {
+		if (lflag && !was_unlinked) {
 			mode_t tmode, mode;
 
 			tmode = s->st_mode;
@@ -287,7 +295,8 @@ typeerr:		LABEL;
 strerror(errno),
 flavor == F_FREEBSD9 ? "" : ")");
 			else
-printf(", modified%s\n",
+printf(", modified%s%s\n",
+was_unlinked ? " by unlink" : "",
 flavor == F_FREEBSD9 ? "" : ")");
 		}
 		else



CVS commit: src/usr.sbin/rtadvd

2021-03-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 23 18:16:53 UTC 2021

Modified Files:
src/usr.sbin/rtadvd: advcap.c config.c dump.c if.c timer.c

Log Message:
print function names as %s: not <%s> everywhere for consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/rtadvd/advcap.c
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/rtadvd/config.c
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/rtadvd/dump.c
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/rtadvd/if.c
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/rtadvd/timer.c

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

Modified files:

Index: src/usr.sbin/rtadvd/advcap.c
diff -u src/usr.sbin/rtadvd/advcap.c:1.18 src/usr.sbin/rtadvd/advcap.c:1.19
--- src/usr.sbin/rtadvd/advcap.c:1.18	Sat Feb  2 22:19:31 2019
+++ src/usr.sbin/rtadvd/advcap.c	Tue Mar 23 14:16:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: advcap.c,v 1.18 2019/02/03 03:19:31 mrg Exp $	*/
+/*	$NetBSD: advcap.c,v 1.19 2021/03/23 18:16:53 christos Exp $	*/
 /*	$KAME: advcap.c,v 1.11 2003/05/19 09:46:50 keiichi Exp $	*/
 
 /*
@@ -139,7 +139,7 @@ getent(char *bp, char *name, char *cp)
 		tf = open(RM = cp, O_RDONLY);
 	}
 	if (tf < 0) {
-		logit(LOG_INFO, "<%s> open: %m", __func__);
+		logit(LOG_INFO, "%s: open `%s': %m", __func__, cp);
 		return (-2);
 	}
 	for (;;) {

Index: src/usr.sbin/rtadvd/config.c
diff -u src/usr.sbin/rtadvd/config.c:1.45 src/usr.sbin/rtadvd/config.c:1.46
--- src/usr.sbin/rtadvd/config.c:1.45	Mon Mar 22 14:41:11 2021
+++ src/usr.sbin/rtadvd/config.c	Tue Mar 23 14:16:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.c,v 1.45 2021/03/22 18:41:11 christos Exp $	*/
+/*	$NetBSD: config.c,v 1.46 2021/03/23 18:16:53 christos Exp $	*/
 /*	$KAME: config.c,v 1.93 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -169,44 +169,46 @@ getconfig(const char *intface, int exith
 	struct rdnss *rdnss;
 	struct dnssl *dnssl;
 
-#define MUSTHAVE(var, cap)	\
+#define MUSTHAVE(var, cap)		\
 do {\
 	int64_t t;			\
 	if ((t = agetnum(cap)) < 0) {	\
-		fprintf(stderr, "rtadvd: need %s for interface %s\n",	\
-			cap, intface);	\
+		logit(LOG_ERR, "%s: need %s for interface %s",		\
+		__func__, cap, intface);\
 		goto errexit;		\
 	}\
 	var = t;			\
- } while (0)
-#define MAYHAVE(var, cap, def)	\
+ } while (/*CONSTCOND*/0)
+
+#define MAYHAVE(var, cap, def)		\
  do {\
 	if ((var = agetnum(cap)) < 0)	\
 		var = def;		\
- } while (0)
-#define	ELM_MALLOC(p)	\
+ } while (/*CONSTCOND*/0)
+
+#define	ELM_MALLOC(p)			\
 	do {\
 		p = calloc(1, sizeof(*p));\
 		if (p == NULL) {	\
-			logit(LOG_ERR, "<%s> calloc failed: %m",	\
+			logit(LOG_ERR, "%s: calloc failed: %m",	\
 			__func__);	\
 			goto errexit;	\
 		}			\
 	} while(/*CONSTCOND*/0)
 
 	if (if_nametoindex(intface) == 0) {
-		logit(LOG_INFO, "<%s> interface %s not found, ignoring",
+		logit(LOG_INFO, "%s: interface %s not found, ignoring",
 		   __func__, intface);
 		return;
 	}
 
-	logit(LOG_DEBUG, "<%s> loading configuration for interface %s",
+	logit(LOG_DEBUG, "%s: loading configuration for interface %s",
 	   __func__, intface);
 
 	if ((stat = agetent(tbuf, intface)) <= 0) {
 		memset(tbuf, 0, sizeof(tbuf));
 		logit(LOG_INFO,
-		   "<%s> %s isn't defined in the configuration file"
+		   "%s: %s isn't defined in the configuration file"
 		   " or the configuration file doesn't exist."
 		   " Treat it as default",
 		__func__, intface);
@@ -222,7 +224,7 @@ getconfig(const char *intface, int exith
 	/* check if we are allowed to forward packets (if not determined) */
 	if (forwarding < 0) {
 		if ((forwarding = getinet6sysctl(IPV6CTL_FORWARDING)) < 0)
-			exit(1);
+			exit(EXIT_FAILURE);
 	}
 
 	/* get interface information */
@@ -233,7 +235,7 @@ getconfig(const char *intface, int exith
 	if (tmp->advlinkopt) {
 		if ((tmp->sdl = if_nametosdl(intface)) == NULL) {
 			logit(LOG_ERR,
-			   "<%s> can't get information of %s",
+			   "%s: can't get information of %s",
 			   __func__, intface);
 			goto errexit;
 		}
@@ -242,7 +244,7 @@ getconfig(const char *intface, int exith
 		tmp->ifindex = if_nametoindex(intface);
 		if (tmp->ifindex == 0) {
 			logit(LOG_ERR,
-			   "<%s> can't get information of %s",
+			   "%s: can't get information of %s",
 			   __func__, intface);
 			goto errexit;
 		}
@@ -252,7 +254,7 @@ getconfig(const char *intface, int exith
 	if ((tmp->phymtu = if_getmtu(intface)) == 0) {
 		tmp->phymtu = IPV6_MMTU;
 		logit(LOG_WARNING,
-		   "<%s> can't get interface mtu of %s. Treat as %d",
+		   "%s: can't get interface mtu of %s. Treat as %d",
 		   __func__, intface, IPV6_MMTU);
 	}
 
@@ -262,7 +264,7 @@ getconfig(const char *intface, int exith
 	MAYHAVE(val, "maxinterval", DEF_MAXRTRADVINTERVAL);
 	if (val < MIN_MAXINTERVAL || val > MAX_MAXINTERVAL) {
 		

CVS commit: src/usr.sbin/rtadvd

2021-03-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 23 18:16:21 UTC 2021

Modified Files:
src/usr.sbin/rtadvd: if.c if.h

Log Message:
interface indexes are unsigned


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/rtadvd/if.c
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/rtadvd/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/usr.sbin/rtadvd/if.c
diff -u src/usr.sbin/rtadvd/if.c:1.27 src/usr.sbin/rtadvd/if.c:1.28
--- src/usr.sbin/rtadvd/if.c:1.27	Mon Mar 22 14:41:11 2021
+++ src/usr.sbin/rtadvd/if.c	Tue Mar 23 14:16:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.27 2021/03/22 18:41:11 christos Exp $	*/
+/*	$NetBSD: if.c,v 1.28 2021/03/23 18:16:21 christos Exp $	*/
 /*	$KAME: if.c,v 1.36 2004/11/30 22:32:01 suz Exp $	*/
 
 /*
@@ -132,7 +132,7 @@ if_getmtu(const char *name)
 
 /* give interface index and its old flags, then new flags returned */
 int
-if_getflags(int ifindex, int oifflags)
+if_getflags(unsigned int ifindex, int oifflags)
 {
 	struct ifreq ifr;
 	int s;
@@ -194,7 +194,8 @@ lladdropt_fill(struct sockaddr_dl *sdl, 
 #define SIN6(s) ((const struct sockaddr_in6 *)(s))
 #define SDL(s) ((const struct sockaddr_dl *)(s))
 char *
-get_next_msg(char *buf, char *lim, int ifindex, size_t *lenp, int filter)
+get_next_msg(char *buf, char *lim, unsigned int ifindex, size_t *lenp,
+int filter)
 {
 	struct rt_msghdr *rtm;
 	struct ifa_msghdr *ifam;
@@ -294,7 +295,7 @@ get_addr(const void *buf)
 	return (rti_info[RTAX_DST])->sin6_addr;
 }
 
-int
+unsigned int
 get_rtm_ifindex(const void *buf)
 {
 	const struct rt_msghdr *rtm = buf;
@@ -306,20 +307,20 @@ get_rtm_ifindex(const void *buf)
 	return SDL(rti_info[RTAX_GATEWAY])->sdl_index;
 }
 
-int
+unsigned int
 get_ifm_ifindex(const void *buf)
 {
 	const struct if_msghdr *ifm = buf;
 
-	return (int)ifm->ifm_index;
+	return ifm->ifm_index;
 }
 
-int
+unsigned int
 get_ifam_ifindex(const void *buf)
 {
 	const struct ifa_msghdr *ifam = buf;
 
-	return (int)ifam->ifam_index;
+	return ifam->ifam_index;
 }
 
 int
@@ -331,12 +332,12 @@ get_ifm_flags(const void *buf)
 }
 
 #ifdef RTM_IFANNOUNCE
-int
+unsigned int
 get_ifan_ifindex(const void *buf)
 {
 	const struct if_announcemsghdr *ifan = buf;
 
-	return (int)ifan->ifan_index;
+	return ifan->ifan_index;
 }
 
 int

Index: src/usr.sbin/rtadvd/if.h
diff -u src/usr.sbin/rtadvd/if.h:1.12 src/usr.sbin/rtadvd/if.h:1.13
--- src/usr.sbin/rtadvd/if.h:1.12	Mon Mar 22 14:41:11 2021
+++ src/usr.sbin/rtadvd/if.h	Tue Mar 23 14:16:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.12 2021/03/22 18:41:11 christos Exp $	*/
+/*	$NetBSD: if.h,v 1.13 2021/03/23 18:16:21 christos Exp $	*/
 /*	$KAME: if.h,v 1.12 2003/09/21 07:17:03 itojun Exp $	*/
 
 /*
@@ -35,17 +35,17 @@
 struct nd_opt_hdr;
 struct sockaddr_dl *if_nametosdl(const char *);
 int if_getmtu(const char *);
-int if_getflags(int, int);
+int if_getflags(unsigned int, int);
 int lladdropt_length(struct sockaddr_dl *);
 void lladdropt_fill(struct sockaddr_dl *, struct nd_opt_hdr *);
-char *get_next_msg(char *, char *, int, size_t *, int);
+char *get_next_msg(char *, char *, unsigned int, size_t *, int);
 const struct in6_addr *get_addr(const void *);
-int get_rtm_ifindex(const void *);
-int get_ifm_ifindex(const void *);
-int get_ifam_ifindex(const void *);
+unsigned int get_rtm_ifindex(const void *);
+unsigned int get_ifm_ifindex(const void *);
+unsigned int get_ifam_ifindex(const void *);
 int get_ifm_flags(const void *);
 #ifdef RTM_IFANNOUNCE
-int get_ifan_ifindex(const void *);
+unsigned int get_ifan_ifindex(const void *);
 int get_ifan_what(const void *);
 #endif
 int get_prefixlen(const void *);



CVS commit: src/usr.sbin/rtadvd

2021-03-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 23 18:13:07 UTC 2021

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

Log Message:
call tzset() before chroot so we initialize our timezone data


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/usr.sbin/rtadvd/rtadvd.c

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

Modified files:

Index: src/usr.sbin/rtadvd/rtadvd.c
diff -u src/usr.sbin/rtadvd/rtadvd.c:1.81 src/usr.sbin/rtadvd/rtadvd.c:1.82
--- src/usr.sbin/rtadvd/rtadvd.c:1.81	Tue Mar 23 14:06:19 2021
+++ src/usr.sbin/rtadvd/rtadvd.c	Tue Mar 23 14:13:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtadvd.c,v 1.81 2021/03/23 18:06:19 christos Exp $	*/
+/*	$NetBSD: rtadvd.c,v 1.82 2021/03/23 18:13:07 christos Exp $	*/
 /*	$KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -283,6 +283,7 @@ main(int argc, char *argv[])
 		set[1].fd = -1;
 
 	logit(LOG_INFO, "dropping privileges to %s", RTADVD_USER);
+	tzset();
 	if (prog_chroot(pw->pw_dir) == -1) {
 		logit(LOG_ERR, "chroot: %s: %m", pw->pw_dir);
 		return EXIT_FAILURE;



CVS commit: src/usr.sbin/rtadvd

2021-03-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 23 18:06:19 UTC 2021

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

Log Message:
fix misplaced paren, add missing va_end()


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/usr.sbin/rtadvd/rtadvd.c

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

Modified files:

Index: src/usr.sbin/rtadvd/rtadvd.c
diff -u src/usr.sbin/rtadvd/rtadvd.c:1.80 src/usr.sbin/rtadvd/rtadvd.c:1.81
--- src/usr.sbin/rtadvd/rtadvd.c:1.80	Mon Mar 22 14:41:11 2021
+++ src/usr.sbin/rtadvd/rtadvd.c	Tue Mar 23 14:06:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtadvd.c,v 1.80 2021/03/22 18:41:11 christos Exp $	*/
+/*	$NetBSD: rtadvd.c,v 1.81 2021/03/23 18:06:19 christos Exp $	*/
 /*	$KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -1615,7 +1615,7 @@ rtsock_open(void)
 	}
 #ifdef RO_MSGFILTER
 	if (prog_setsockopt(rtsock, PF_ROUTE, RO_MSGFILTER,
-	, sizeof(msgfilter) == -1))
+	, sizeof(msgfilter)) == -1)
 		logit(LOG_ERR, "%s: RO_MSGFILTER: %m", __func__);
 #endif
 }
@@ -1804,13 +1804,14 @@ logit(int level, const char *fmt, ...)
 	va_start(ap, fmt);
 	if (!Dflag && after_daemon) {
 		vsyslog(level, fmt, ap);
-		va_end(ap);
-		return;
+		goto out;
+	}
+	if (level >= LOG_INFO && !dflag) {
+		goto out;
 	}
-	if (level >= LOG_INFO && !dflag)
-		return;
 
 	vwarnx(expandm(fmt, "", ), ap);
 	free(buf);
+out:
 	va_end(ap);
 }



CVS commit: src/usr.sbin/rtadvd

2021-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 22 18:41:11 UTC 2021

Modified Files:
src/usr.sbin/rtadvd: config.c config.h if.c if.h rtadvd.c rtadvd.h

Log Message:
- remove extra \n from stderr logging
- add string message types
- sprinkle const


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/rtadvd/config.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/rtadvd/config.h \
src/usr.sbin/rtadvd/if.h
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/rtadvd/if.c
cvs rdiff -u -r1.79 -r1.80 src/usr.sbin/rtadvd/rtadvd.c
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/rtadvd/rtadvd.h

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/rtadvd/config.c
diff -u src/usr.sbin/rtadvd/config.c:1.44 src/usr.sbin/rtadvd/config.c:1.45
--- src/usr.sbin/rtadvd/config.c:1.44	Tue Apr 21 08:16:47 2020
+++ src/usr.sbin/rtadvd/config.c	Mon Mar 22 14:41:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.c,v 1.44 2020/04/21 12:16:47 roy Exp $	*/
+/*	$NetBSD: config.c,v 1.45 2021/03/22 18:41:11 christos Exp $	*/
 /*	$KAME: config.c,v 1.93 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -965,7 +965,8 @@ update_prefix(struct prefix * prefix)
  * able to be specified.
  */
 void
-add_prefix(struct rainfo *rai, int ifindex, struct in6_addr *addr, int plen)
+add_prefix(struct rainfo *rai, int ifindex, const struct in6_addr *addr,
+int plen)
 {
 	struct prefix *prefix;
 	char ntopbuf[INET6_ADDRSTRLEN];

Index: src/usr.sbin/rtadvd/config.h
diff -u src/usr.sbin/rtadvd/config.h:1.11 src/usr.sbin/rtadvd/config.h:1.12
--- src/usr.sbin/rtadvd/config.h:1.11	Tue Apr 21 08:16:47 2020
+++ src/usr.sbin/rtadvd/config.h	Mon Mar 22 14:41:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.11 2020/04/21 12:16:47 roy Exp $	*/
+/*	$NetBSD: config.h,v 1.12 2021/03/22 18:41:11 christos Exp $	*/
 /*	$KAME: config.h,v 1.9 2003/08/06 04:19:40 ono Exp $	*/
 
 /*
@@ -35,7 +35,7 @@ extern void getconfig(const char *, int)
 extern void delete_prefix(struct prefix *);
 extern void invalidate_prefix(struct prefix *);
 extern void update_prefix(struct prefix *);
-extern void add_prefix(struct rainfo *, int, struct in6_addr *, int);
+extern void add_prefix(struct rainfo *, int, const struct in6_addr *, int);
 extern void make_packet(struct rainfo *);
 extern void get_prefix(struct rainfo *);
 
Index: src/usr.sbin/rtadvd/if.h
diff -u src/usr.sbin/rtadvd/if.h:1.11 src/usr.sbin/rtadvd/if.h:1.12
--- src/usr.sbin/rtadvd/if.h:1.11	Fri Apr 20 06:39:37 2018
+++ src/usr.sbin/rtadvd/if.h	Mon Mar 22 14:41:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.11 2018/04/20 10:39:37 roy Exp $	*/
+/*	$NetBSD: if.h,v 1.12 2021/03/22 18:41:11 christos Exp $	*/
 /*	$KAME: if.h,v 1.12 2003/09/21 07:17:03 itojun Exp $	*/
 
 /*
@@ -39,16 +39,17 @@ int if_getflags(int, int);
 int lladdropt_length(struct sockaddr_dl *);
 void lladdropt_fill(struct sockaddr_dl *, struct nd_opt_hdr *);
 char *get_next_msg(char *, char *, int, size_t *, int);
-struct in6_addr *get_addr(char *);
-int get_rtm_ifindex(char *);
-int get_ifm_ifindex(char *);
-int get_ifam_ifindex(char *);
-int get_ifm_flags(char *);
+const struct in6_addr *get_addr(const void *);
+int get_rtm_ifindex(const void *);
+int get_ifm_ifindex(const void *);
+int get_ifam_ifindex(const void *);
+int get_ifm_flags(const void *);
 #ifdef RTM_IFANNOUNCE
-int get_ifan_ifindex(char *);
-int get_ifan_what(char *);
+int get_ifan_ifindex(const void *);
+int get_ifan_what(const void *);
 #endif
-int get_prefixlen(char *);
+int get_prefixlen(const void *);
 int prefixlen(const unsigned char *, const unsigned char *);
-int rtmsg_type(char *);
-int rtmsg_len(char *);
+const char *rtmsg_typestr(const void *);
+int rtmsg_type(const void *);
+int rtmsg_len(const void *);

Index: src/usr.sbin/rtadvd/if.c
diff -u src/usr.sbin/rtadvd/if.c:1.26 src/usr.sbin/rtadvd/if.c:1.27
--- src/usr.sbin/rtadvd/if.c:1.26	Fri Apr 20 06:39:37 2018
+++ src/usr.sbin/rtadvd/if.c	Mon Mar 22 14:41:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.26 2018/04/20 10:39:37 roy Exp $	*/
+/*	$NetBSD: if.c,v 1.27 2021/03/22 18:41:11 christos Exp $	*/
 /*	$KAME: if.c,v 1.36 2004/11/30 22:32:01 suz Exp $	*/
 
 /*
@@ -30,6 +30,7 @@
  * SUCH DAMAGE.
  */
 
+#define RTM_NAMES
 #include 
 #include 
 #include 
@@ -65,7 +66,8 @@
 #endif
 
 static void
-get_rtaddrs(int addrs, struct sockaddr *sa, struct sockaddr **rti_info)
+get_rtaddrs(int addrs, const struct sockaddr *sa,
+const struct sockaddr **rti_info)
 {
 	int i;
 
@@ -189,14 +191,14 @@ lladdropt_fill(struct sockaddr_dl *sdl, 
 }
 
 #define FILTER_MATCH(type, filter) ((0x1 << type) & filter)
-#define SIN6(s) ((struct sockaddr_in6 *)(s))
-#define SDL(s) ((struct sockaddr_dl *)(s))
+#define SIN6(s) ((const struct sockaddr_in6 *)(s))
+#define SDL(s) ((const struct sockaddr_dl *)(s))
 char *
 get_next_msg(char *buf, char *lim, int ifindex, size_t *lenp, int filter)
 {
 	struct rt_msghdr *rtm;
 	struct ifa_msghdr *ifam;
-	

CVS commit: src/usr.sbin/services_mkdb

2021-03-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 22 03:28:55 UTC 2021

Modified Files:
src/usr.sbin/services_mkdb: uniq.c

Log Message:
Avoid memory leak on empty lines (https://reviews.freebsd.org/D29370)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/services_mkdb/uniq.c

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

Modified files:

Index: src/usr.sbin/services_mkdb/uniq.c
diff -u src/usr.sbin/services_mkdb/uniq.c:1.6 src/usr.sbin/services_mkdb/uniq.c:1.7
--- src/usr.sbin/services_mkdb/uniq.c:1.6	Sat Jun 21 13:48:07 2014
+++ src/usr.sbin/services_mkdb/uniq.c	Sun Mar 21 23:28:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uniq.c,v 1.6 2014/06/21 17:48:07 christos Exp $	*/
+/*	$NetBSD: uniq.c,v 1.7 2021/03/22 03:28:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: uniq.c,v 1.6 2014/06/21 17:48:07 christos Exp $");
+__RCSID("$NetBSD: uniq.c,v 1.7 2021/03/22 03:28:55 christos Exp $");
 
 #include 
 #include 
@@ -126,11 +126,12 @@ comp(const char *origline, char **compli
 	for (p = (const unsigned char *)origline; l && *p && isspace(*p);
 	p++, l--)
 		continue;
+	if (*p == '\0' || l == 0)
+		return 0;
+
 	cline = emalloc(l + 1);
 	(void)memcpy(cline, p, l);
 	cline[l] = '\0';
-	if (*cline == '\0')
-		return 0;
 
 	complen = 0;
 	hasalnum = 0;
@@ -160,6 +161,11 @@ comp(const char *origline, char **compli
 		--complen;
 	}
 	*q = '\0';
+	if (!hasalnum) {
+		free(cline);
+		cline = NULL;
+		complen = 0;
+	}
 	*compline = cline;
 	*len = complen;
 	return hasalnum;



CVS commit: src/usr.sbin/mtree

2021-03-18 Thread Aleksey Cheusov
Module Name:src
Committed By:   cheusov
Date:   Thu Mar 18 20:02:19 UTC 2021

Modified Files:
src/usr.sbin/mtree: compare.c crc.c extern.h verify.c

Log Message:
mtree: use POSIX type uint32_t instead of u_int32_t


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/mtree/compare.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/mtree/crc.c
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/mtree/extern.h
cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/mtree/verify.c

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

Modified files:

Index: src/usr.sbin/mtree/compare.c
diff -u src/usr.sbin/mtree/compare.c:1.58 src/usr.sbin/mtree/compare.c:1.59
--- src/usr.sbin/mtree/compare.c:1.58	Thu Nov 21 18:39:50 2013
+++ src/usr.sbin/mtree/compare.c	Thu Mar 18 20:02:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: compare.c,v 1.58 2013/11/21 18:39:50 christos Exp $	*/
+/*	$NetBSD: compare.c,v 1.59 2021/03/18 20:02:18 cheusov Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)compare.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: compare.c,v 1.58 2013/11/21 18:39:50 christos Exp $");
+__RCSID("$NetBSD: compare.c,v 1.59 2021/03/18 20:02:18 cheusov Exp $");
 #endif
 #endif /* not lint */
 
@@ -135,7 +135,7 @@ do {	\
 int
 compare(NODE *s, FTSENT *p)
 {
-	u_int32_t len, val, flags;
+	uint32_t len, val, flags;
 	int fd, label;
 	const char *cp, *tab;
 #if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2)

Index: src/usr.sbin/mtree/crc.c
diff -u src/usr.sbin/mtree/crc.c:1.9 src/usr.sbin/mtree/crc.c:1.10
--- src/usr.sbin/mtree/crc.c:1.9	Fri Oct  5 00:40:51 2012
+++ src/usr.sbin/mtree/crc.c	Thu Mar 18 20:02:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: crc.c,v 1.9 2012/10/05 00:40:51 christos Exp $	*/
+/*	$NetBSD: crc.c,v 1.10 2021/03/18 20:02:18 cheusov Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)crc.c	8.1 (Berkeley) 6/17/93";
 #else
-__RCSID("$NetBSD: crc.c,v 1.9 2012/10/05 00:40:51 christos Exp $");
+__RCSID("$NetBSD: crc.c,v 1.10 2021/03/18 20:02:18 cheusov Exp $");
 #endif
 #endif /* not lint */
 
@@ -53,7 +53,7 @@ __RCSID("$NetBSD: crc.c,v 1.9 2012/10/05
 
 #include "extern.h"
 
-static const u_int32_t crctab[] = {
+static const uint32_t crctab[] = {
 	0x0,
 	0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
 	0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6,
@@ -114,15 +114,15 @@ static const u_int32_t crctab[] = {
  * locations to store the crc and the number of bytes read.  It returns 0 on
  * success and 1 on failure.  Errno is set on failure.
  */
-u_int32_t crc_total = ~0;		/* The crc over a number of files. */
+uint32_t crc_total = ~0;		/* The crc over a number of files. */
 
 int
-crc(int fd, u_int32_t *cval, u_int32_t *clen)
+crc(int fd, uint32_t *cval, uint32_t *clen)
 {
 	u_char *p;
 	int nr;
-	u_int32_t thecrc, len;
-	u_int32_t crctot;
+	uint32_t thecrc, len;
+	uint32_t crctot;
 	u_char buf[16 * 1024];
 
 #define	COMPUTE(var, ch)	(var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)]

Index: src/usr.sbin/mtree/extern.h
diff -u src/usr.sbin/mtree/extern.h:1.39 src/usr.sbin/mtree/extern.h:1.40
--- src/usr.sbin/mtree/extern.h:1.39	Thu Apr 24 17:22:41 2014
+++ src/usr.sbin/mtree/extern.h	Thu Mar 18 20:02:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.39 2014/04/24 17:22:41 christos Exp $	*/
+/*	$NetBSD: extern.h,v 1.40 2021/03/18 20:02:18 cheusov Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -62,7 +62,7 @@ enum flavor {
 void	 addtag(slist_t *, char *);
 int	 check_excludes(const char *, const char *);
 int	 compare(NODE *, FTSENT *);
-int	 crc(int, u_int32_t *, u_int32_t *);
+int	 crc(int, uint32_t *, uint32_t *);
 void	 cwalk(FILE *);
 void	 dump_nodes(FILE *, const char *, NODE *, int);
 void	 init_excludes(void);
@@ -83,7 +83,7 @@ extern int	bflag, dflag, eflag, iflag, j
 extern int	mtree_Mflag, mtree_Sflag, mtree_Wflag;
 extern size_t	mtree_lineno;
 extern enum flavor	flavor;
-extern u_int32_t crc_total;
+extern uint32_t crc_total;
 extern int	ftsoptions, keys;
 extern char	fullpath[];
 extern slist_t	includetags, excludetags;

Index: src/usr.sbin/mtree/verify.c
diff -u src/usr.sbin/mtree/verify.c:1.46 src/usr.sbin/mtree/verify.c:1.47
--- src/usr.sbin/mtree/verify.c:1.46	Fri Jan 23 20:28:24 2015
+++ src/usr.sbin/mtree/verify.c	Thu Mar 18 20:02:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: verify.c,v 1.46 2015/01/23 20:28:24 christos Exp $	*/
+/*	$NetBSD: verify.c,v 1.47 2021/03/18 20:02:18 cheusov Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)verify.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: verify.c,v 1.46 2015/01/23 20:28:24 christos Exp $");
+__RCSID("$NetBSD: verify.c,v 1.47 2021/03/18 20:02:18 cheusov Exp $");
 #endif
 #endif /* not lint */
 
@@ -178,7 +178,7 @@ miss(NODE *p, char *tail)
 	int create;
 	char *tp;
 	const char 

CVS commit: src/usr.sbin/bta2dpd/bta2dpd

2021-03-07 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Mar  7 13:09:43 UTC 2021

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd: bta2dpd.8 bta2dpd.c

Log Message:
Intoduce "-n" switch.

Running btat2dpd with "-n" especially for use with pad(4) will stop bta2dpd
from exiting upon a read error from pad(4) devices.

This is to compenstate for the behaviour in NetBSD current that pad(4) will
no longer output 0's when its corresponding audio(4) device is not active.

I believe that this new pad(4) behaviour is not present in -9 and -8.

While here I've improved its function as a daemon and it should reconnect to
bluetooth speakers when they are disconnected/reconnected.

Reported and tested by reinoud@ and maya@


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c

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

Modified files:

Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.4 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.5
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.4	Sat Jul 27 20:10:29 2019
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8	Sun Mar  7 13:09:43 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bta2dpd.8,v 1.4 2019/07/27 20:10:29 nakayama Exp $
+.\"	$NetBSD: bta2dpd.8,v 1.5 2021/03/07 13:09:43 nat Exp $
 .\"
 .\" Copyright (c) 2015 - 2016  Nathanial Sloss 
 .\" All rights reserved.
@@ -37,7 +37,7 @@
 .Nd Bluetooth Advanced Audio Distribution Profile daemon
 .Sh SYNOPSIS
 .Nm
-.Op Fl \
+.Op Fl \
 .Op Fl A Ar bitpool_allocation
 .Op Fl B Ar bitpool
 .Op Fl b Ar blocks
@@ -107,6 +107,10 @@ with only the
 option and the maximum bitpool for your device will be printed to stdout.
 .It Fl D
 Run in the background.
+.It Fl n
+Do not close conection on end of file (EOF).
+Useful for
+.Xr pad 4 .
 .It Fl d Ar device
 Local device address.
 May be given as BDADDR or device name.

Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.7 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.8
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.7	Sun May 31 06:17:23 2020
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c	Sun Mar  7 13:09:43 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: bta2dpd.c,v 1.7 2020/05/31 06:17:23 nat Exp $ */
+/* $NetBSD: bta2dpd.c,v 1.8 2021/03/07 13:09:43 nat Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -220,12 +220,14 @@ static struct event ctl_ev;			/* avdtp c
 struct l2cap_info	info;
 static bool		runasDaemon;
 static bool		asSpeaker;
+static bool		dontStop;
 static bool		initDiscover;	/* initiate avdtp discover */
 static bool 		verbose;	/* copy to stdout */
 static bool 		test_mode;	/* copy to stdout */
 static uint8_t		channel_mode = MODE_STEREO;
 static uint8_t		alloc_method = ALLOC_LOUDNESS;
 static uint8_t		frequency = FREQ_44_1K;
+static int		freqnum = 44100;
 static uint8_t		freqs[4];
 static uint8_t		blocks_config[4];
 static uint8_t		channel_config[4];
@@ -252,6 +254,7 @@ int audfile;
 static void do_interrupt(int, short, void *);
 static void do_recv(int, short, void *);
 static void do_ctlreq(int, short, void *);
+static void bt_exit(int fd);
 
 #define log_err(st, fmt, args...)	\
 	do { syslog(LOG_ERR, fmt, ##args); exit(st); } while (0)
@@ -262,12 +265,13 @@ static void do_ctlreq(int, short, void *
 int
 main(int ac, char *av[])
 {
-	int enc, i, n, m, l, j, k, o, ch, freqnum, blocksnum;
+	int enc, i, n, m, l, j, k, o, ch, blocksnum;
 	u_int tmpbitpool;
 	bdaddr_copy(, BDADDR_ANY);
 
 	sc = hc = -1;
 	verbose = asSpeaker = test_mode = initDiscover = runasDaemon = false;
+	dontStop = false;
 	n = m = l = i = j = o = 0;
 	freqs[0] = frequency;
 	channel_config[0] = channel_mode;
@@ -276,7 +280,8 @@ main(int ac, char *av[])
 	alloc_config[0] = alloc_method;
 	channel_config[0] = channel_mode;
 
-	while ((ch = getopt(ac, av, "A:a:B:b:Dd:e:f:IKM:m:p:r:tV:v")) != EOF) {
+	while ((ch = getopt(ac, av, "A:a:B:b:Dd:e:f:IKnM:m:p:r:tV:v")) !=
+	EOF) {
 		switch (ch) {
 		case 'A':
 			for (k = 0; k < (int)strlen(optarg); k++) {
@@ -405,6 +410,9 @@ main(int ac, char *av[])
 errx(EXIT_FAILURE, "%s: unknown mode", optarg);
 
 			break;
+		case 'n':
+			dontStop = true;
+			break;
 		case 'p':
 			l2cap_psm = (uint16_t)atoi(optarg);
 			break;
@@ -556,7 +564,7 @@ again:
 		audfile = -1;
 	}
 
-	if (asSpeaker)
+	if (runasDaemon)
 		goto again;
 
 	return EXIT_SUCCESS;
@@ -566,9 +574,9 @@ static void
 usage(void)
 {
 	fprintf(stderr,
-	"usage:\t%s [-v] [-D] [-d device] [-m mode] [-r rate] [-M mtu]\n"
-	"\t\t[-V volume] [-f mode] [-b blocks] [-e bands] [-A alloc]\n"
-	"\t\t[-B bitpool] -a address files...\n"
+	"usage:\t%s [-v] [-D] [-n] [-d device] [-m mode] [-r rate]\n"
+	"\t\t[-M mtu] [-V volume] [-f mode] [-b blocks] [-e bands]\n"
+	"\t\t[-A alloc] [-B bitpool] -a address files...\n"
 	"\t%s [-v] [-D] [-d device] [-m 

CVS commit: src/usr.sbin/rpcbind

2021-03-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  7 00:23:06 UTC 2021

Modified Files:
src/usr.sbin/rpcbind: Makefile pmap_svc.c rpcb_svc_com.c rpcbind.c
security.c

Log Message:
- Enable WARMSTART
- Pass fd to libwrap
- Add blocklist
>From Greg A. Woods

- Tidy up debugging


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/rpcbind/Makefile
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/rpcbind/pmap_svc.c
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/rpcbind/rpcb_svc_com.c
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/rpcbind/rpcbind.c
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/rpcbind/security.c

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

Modified files:

Index: src/usr.sbin/rpcbind/Makefile
diff -u src/usr.sbin/rpcbind/Makefile:1.16 src/usr.sbin/rpcbind/Makefile:1.17
--- src/usr.sbin/rpcbind/Makefile:1.16	Sun Oct 13 03:28:20 2019
+++ src/usr.sbin/rpcbind/Makefile	Sat Mar  6 19:23:06 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2019/10/13 07:28:20 mrg Exp $
+#	$NetBSD: Makefile,v 1.17 2021/03/07 00:23:06 christos Exp $
 
 .include 
 
@@ -12,7 +12,7 @@ SRCS=	check_bound.c rpcb_stat.c rpcb_svc
 LIBCDIR=${NETBSDSRCDIR}/lib/libc
 LIBCRPCDIR= ${LIBCDIR}/rpc
 
-CPPFLAGS+=	-I${LIBCRPCDIR} -DPORTMAP -DLIBWRAP
+CPPFLAGS+=	-I${LIBCRPCDIR} -DPORTMAP -DLIBWRAP -DWARMSTART
 
 .if (${USE_INET6} != "no")
 CPPFLAGS+=	-DINET6
@@ -24,10 +24,11 @@ CPPFLAGS+=	-DYP
 
 # Uncomment these to get any useful output from 'rpcbind -d'
 # CPPFLAGS+=	-DRPCBIND_DEBUG
+# CPPFLAGS+=	-DDEBUG_RMTCALL
 # CPPFLAGS+=	-DSVC_RUN_DEBUG
 
-LDADD+= -lwrap -lutil
-DPADD+= ${LIBWRAP} ${LIBUTIL}
+LDADD+= -lwrap -lblocklist -lutil
+DPADD+= ${LIBWRAP} ${LIBBLOCKLIST} ${LIBUTIL}
 
 COPTS.rpcb_svc_4.c+=	${GCC_NO_CAST_FUNCTION_TYPE}
 COPTS.pmap_svc.c+=	${GCC_NO_CAST_FUNCTION_TYPE}

Index: src/usr.sbin/rpcbind/pmap_svc.c
diff -u src/usr.sbin/rpcbind/pmap_svc.c:1.9 src/usr.sbin/rpcbind/pmap_svc.c:1.10
--- src/usr.sbin/rpcbind/pmap_svc.c:1.9	Wed Aug 16 04:44:40 2017
+++ src/usr.sbin/rpcbind/pmap_svc.c	Sat Mar  6 19:23:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_svc.c,v 1.9 2017/08/16 08:44:40 christos Exp $	*/
+/*	$NetBSD: pmap_svc.c,v 1.10 2021/03/07 00:23:06 christos Exp $	*/
 /*	$FreeBSD: head/usr.sbin/rpcbind/pmap_svc.c 258564 2013-11-25 16:44:02Z hrs $ */
 
 /*-
@@ -173,6 +173,11 @@ pmapproc_change(struct svc_req *rqstp __
 	struct sockcred *sc;
 	char uidbuf[32];
 
+	if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *))) {
+		svcerr_decode(xprt);
+		return (FALSE);
+	}
+
 #ifdef RPCBIND_DEBUG
 	if (debugging)
 		fprintf(stderr, "%s request for (%lu, %lu) : ",
@@ -180,11 +185,6 @@ pmapproc_change(struct svc_req *rqstp __
 		reg.pm_prog, reg.pm_vers);
 #endif
 
-	if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *))) {
-		svcerr_decode(xprt);
-		return (FALSE);
-	}
-
 	if (!check_access(xprt, op, , PMAPVERS)) {
 		svcerr_weakauth(xprt);
 		return FALSE;

Index: src/usr.sbin/rpcbind/rpcb_svc_com.c
diff -u src/usr.sbin/rpcbind/rpcb_svc_com.c:1.23 src/usr.sbin/rpcbind/rpcb_svc_com.c:1.24
--- src/usr.sbin/rpcbind/rpcb_svc_com.c:1.23	Tue Jun 16 20:16:22 2020
+++ src/usr.sbin/rpcbind/rpcb_svc_com.c	Sat Mar  6 19:23:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcb_svc_com.c,v 1.23 2020/06/17 00:16:22 kamil Exp $	*/
+/*	$NetBSD: rpcb_svc_com.c,v 1.24 2021/03/07 00:23:06 christos Exp $	*/
 /*	$FreeBSD: head/usr.sbin/rpcbind/rpcb_svc_com.c 301770 2016-06-09 22:25:00Z pfg $ */
 
 /*-
@@ -140,9 +140,9 @@ rpcbproc_set_com(void *arg, struct svc_r
 
 #ifdef RPCBIND_DEBUG
 	if (debugging)
-		fprintf(stderr, "RPCB_SET request for (%lu, %lu, %s, %s) : ",
-		(unsigned long)regp->r_prog, (unsigned long)regp->r_vers,
-		regp->r_netid, regp->r_addr);
+		fprintf(stderr, "%s: RPCB_SET request for (%lu, %lu, %s, %s): ",
+		__func__, (unsigned long)regp->r_prog,
+		(unsigned long)regp->r_vers, regp->r_netid, regp->r_addr);
 #endif
 	ans = map_set(regp, getowner(transp, owner, sizeof owner));
 #ifdef RPCBIND_DEBUG
@@ -228,9 +228,9 @@ rpcbproc_unset_com(void *arg, struct svc
 
 #ifdef RPCBIND_DEBUG
 	if (debugging)
-		fprintf(stderr, "RPCB_UNSET request for (%lu, %lu, %s) : ",
-		(unsigned long)regp->r_prog, (unsigned long)regp->r_vers,
-		regp->r_netid);
+		fprintf(stderr, "%s: RPCB_UNSET request for (%lu, %lu, %s): ",
+		__func__, (unsigned long)regp->r_prog,
+		(unsigned long)regp->r_vers, regp->r_netid);
 #endif
 	ans = map_unset(regp, getowner(transp, owner, sizeof owner));
 #ifdef RPCBIND_DEBUG
@@ -350,7 +350,7 @@ rpcbproc_getaddr_com(RPCB *regp, struct 
 	}
 #ifdef RPCBIND_DEBUG
 	if (debugging)
-		fprintf(stderr, "getaddr: %s\n", uaddr);
+		fprintf(stderr, "%s: %s\n", __func__, uaddr);
 #endif
 	/* XXX: should have used some defined constant here */
 	rpcbs_getaddr(rpcbversnum - 2, regp->r_prog, regp->r_vers,
@@ -508,9 +508,8 @@ create_rmtcall_fd(struct netconfig *ncon
 
 	if ((fd = __rpc_nconf2fd(nconf)) == -1) {
 		

CVS commit: src/usr.sbin/installboot

2021-02-24 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Feb 25 03:44:28 UTC 2021

Modified Files:
src/usr.sbin/installboot: installboot.8

Log Message:
Adjust manpage for amiga/boot ver 3.1.

Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/usr.sbin/installboot/installboot.8

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/installboot/installboot.8
diff -u src/usr.sbin/installboot/installboot.8:1.100 src/usr.sbin/installboot/installboot.8:1.101
--- src/usr.sbin/installboot/installboot.8:1.100	Sat Feb  6 12:18:45 2021
+++ src/usr.sbin/installboot/installboot.8	Thu Feb 25 03:44:27 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: installboot.8,v 1.100 2021/02/06 12:18:45 rin Exp $
+.\"	$NetBSD: installboot.8,v 1.101 2021/02/25 03:44:27 rin Exp $
 .\"
 .\" Copyright (c) 2002-2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 6, 2021
+.Dd February 25, 2021
 .Dt INSTALLBOOT 8
 .Os
 .Sh NAME
@@ -741,7 +741,7 @@ Remove the primary bootstrap from disk
 .Ss Nx Ns /amiga
 Modify the command line to change the default from "netbsd -ASn2" to
 "netbsd -S":
-.Dl Ic installboot -m amiga -o command="netbsd -S" /dev/rsd0a /usr/mdec/bootxx_ffs
+.Dl Ic installboot -m amiga -o command="netbsd -S" /dev/rsd0a /usr/mdec/bootxx_ffsv1
 .
 .Ss Nx Ns /evbarm
 Install the



CVS commit: src/usr.sbin/ldpd

2021-02-23 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Feb 23 15:05:09 UTC 2021

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

Log Message:
Make use of packed member addreses non-fatal for clang, too


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/ldpd/Makefile

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

Modified files:

Index: src/usr.sbin/ldpd/Makefile
diff -u src/usr.sbin/ldpd/Makefile:1.6 src/usr.sbin/ldpd/Makefile:1.7
--- src/usr.sbin/ldpd/Makefile:1.6	Wed Feb  3 06:46:27 2021
+++ src/usr.sbin/ldpd/Makefile	Tue Feb 23 15:05:08 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2021/02/03 06:46:27 roy Exp $
+# $NetBSD: Makefile,v 1.7 2021/02/23 15:05:08 joerg Exp $
 
 .include 
 
@@ -26,6 +26,7 @@ LDADD+=	-lcrypt
 CPPFLAGS+=-DINET6
 .endif
 
+CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
 CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER}
 
 .include 



CVS commit: src/usr.sbin/intrctl

2021-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Feb 22 11:38:13 UTC 2021

Modified Files:
src/usr.sbin/intrctl: intrctl.8

Log Message:
Adjust description of compact list view output.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/intrctl/intrctl.8

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/intrctl/intrctl.8
diff -u src/usr.sbin/intrctl/intrctl.8:1.7 src/usr.sbin/intrctl/intrctl.8:1.8
--- src/usr.sbin/intrctl/intrctl.8:1.7	Tue Sep 24 11:31:06 2019
+++ src/usr.sbin/intrctl/intrctl.8	Mon Feb 22 11:38:13 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: intrctl.8,v 1.7 2019/09/24 11:31:06 wiz Exp $
+.\" $NetBSD: intrctl.8,v 1.8 2021/02/22 11:38:13 jmcneill Exp $
 .\"
 .\" Copyright (c) 2015 Internet Initiative Japan Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 23, 2019
+.Dd February 22, 2021
 .Dt INTRCTL 8
 .Os
 .Sh NAME
@@ -63,7 +63,7 @@ The intrid is an interrupt name such as 
 If
 .Fl c
 is specified, display compact list with total counts per interrupt,
-and CPU affinity as comma separated list of CPU indexes.
+and CPU affinity as list of CPU indexes.
 .Pp
 If
 .Fl w



CVS commit: src/usr.sbin/intrctl

2021-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Feb 22 11:33:34 UTC 2021

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

Log Message:
In compact view, show the CPUs as a range (0-n) instead of a list
(0, 1, 2, ...) when the interrupt is assigned to all CPUs in the system.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/intrctl/intrctl.c

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

Modified files:

Index: src/usr.sbin/intrctl/intrctl.c
diff -u src/usr.sbin/intrctl/intrctl.c:1.11 src/usr.sbin/intrctl/intrctl.c:1.12
--- src/usr.sbin/intrctl/intrctl.c:1.11	Tue Sep 24 11:31:06 2019
+++ src/usr.sbin/intrctl/intrctl.c	Mon Feb 22 11:33:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intrctl.c,v 1.11 2019/09/24 11:31:06 wiz Exp $	*/
+/*	$NetBSD: intrctl.c,v 1.12 2021/02/22 11:33:34 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: intrctl.c,v 1.11 2019/09/24 11:31:06 wiz Exp $");
+__RCSID("$NetBSD: intrctl.c,v 1.12 2021/02/22 11:33:34 jmcneill Exp $");
 
 #include 
 #include 
@@ -110,6 +110,22 @@ usage(void)
 
 static int intrctl_io_alloc_retry_count = 4;
 
+static bool
+intrctl_list_line_allcpus(struct intrio_list_line *illine, int ncpus)
+{
+	struct intrio_list_line_cpu *illc;
+	int i;
+
+	for (i = 0; i < ncpus; i++) {
+		illc = >ill_cpu[i];
+		if (illc->illc_assigned == false) {
+			return false;
+		}
+	}
+
+	return true;
+}
+
 static void
 intrctl_list_one(bool compact, bool skipzero)
 {
@@ -187,14 +203,20 @@ intrctl_list_one(bool compact, bool skip
 		printf("%-*s ", (int)intridlen, illine->ill_intrid);
 		if (compact) {
 			uint64_t total = 0;
+			bool allcpus = ncpus > 1 &&
+			intrctl_list_line_allcpus(illine, ncpus);
 			char *affinity = NULL, *oaffinity = NULL;
 			for (i = 0; i < ncpus; i++) {
 illc = >ill_cpu[i];
 total += illc->illc_count;
+if (allcpus && i != 0 && i != ncpus - 1) {
+	continue;
+}
 if (illc->illc_assigned) {
+	const char *sep = allcpus ? "-" : ", ";
 	asprintf(, "%s%s%d",
 	oaffinity ? oaffinity : "",
-	oaffinity ? ", " : "",
+	oaffinity ? sep : "",
 	i);
 	if (oaffinity)
 		free(oaffinity);



CVS commit: src/usr.sbin/mountd

2021-02-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Feb 16 10:01:55 UTC 2021

Modified Files:
src/usr.sbin/mountd: mountd.8

Log Message:
Reword slightly.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/mountd/mountd.8

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/mountd/mountd.8
diff -u src/usr.sbin/mountd/mountd.8:1.39 src/usr.sbin/mountd/mountd.8:1.40
--- src/usr.sbin/mountd/mountd.8:1.39	Tue Feb 16 10:00:27 2021
+++ src/usr.sbin/mountd/mountd.8	Tue Feb 16 10:01:55 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mountd.8,v 1.39 2021/02/16 10:00:27 hannken Exp $
+.\"	$NetBSD: mountd.8,v 1.40 2021/02/16 10:01:55 wiz Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -101,7 +101,7 @@ The
 .Ar exportsfile
 argument specifies an alternative location
 for the exports file.
-There can many exports files.
+Multiple exports files can be defined.
 .El
 .Pp
 When



CVS commit: src/usr.sbin/mountd

2021-02-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Feb 16 10:00:27 UTC 2021

Modified Files:
src/usr.sbin/mountd: mountd.8 mountd.c

Log Message:
Add support for multiple exports files. This will be useful for example for
ZFS, where we have an automatically generated /etc/zfs/exports file, which
should not be edited directly.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/mountd/mountd.8
cvs rdiff -u -r1.133 -r1.134 src/usr.sbin/mountd/mountd.c

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

Modified files:

Index: src/usr.sbin/mountd/mountd.8
diff -u src/usr.sbin/mountd/mountd.8:1.38 src/usr.sbin/mountd/mountd.8:1.39
--- src/usr.sbin/mountd/mountd.8:1.38	Sat Dec 24 08:26:57 2016
+++ src/usr.sbin/mountd/mountd.8	Tue Feb 16 10:00:27 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mountd.8,v 1.38 2016/12/24 08:26:57 abhinav Exp $
+.\"	$NetBSD: mountd.8,v 1.39 2021/02/16 10:00:27 hannken Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)mountd.8	8.4 (Berkeley) 4/28/95
 .\"
-.Dd November 2, 2011
+.Dd February 16, 2021
 .Dt MOUNTD 8
 .Os
 .Sh NAME
@@ -42,7 +42,7 @@ mount requests
 .Op Fl dN
 .Op Fl P Ar policy
 .Op Fl p Ar port
-.Op Ar exportsfile
+.Op Ar exportsfile ...
 .Sh DESCRIPTION
 .Nm
 is the server for
@@ -101,6 +101,7 @@ The
 .Ar exportsfile
 argument specifies an alternative location
 for the exports file.
+There can many exports files.
 .El
 .Pp
 When

Index: src/usr.sbin/mountd/mountd.c
diff -u src/usr.sbin/mountd/mountd.c:1.133 src/usr.sbin/mountd/mountd.c:1.134
--- src/usr.sbin/mountd/mountd.c:1.133	Tue Feb 16 09:58:35 2021
+++ src/usr.sbin/mountd/mountd.c	Tue Feb 16 10:00:27 2021
@@ -1,4 +1,4 @@
-/* 	$NetBSD: mountd.c,v 1.133 2021/02/16 09:58:35 hannken Exp $	 */
+/* 	$NetBSD: mountd.c,v 1.134 2021/02/16 10:00:27 hannken Exp $	 */
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)mountd.c  8.15 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: mountd.c,v 1.133 2021/02/16 09:58:35 hannken Exp $");
+__RCSID("$NetBSD: mountd.c,v 1.134 2021/02/16 10:00:27 hannken Exp $");
 #endif
 #endif/* not lint */
 
@@ -226,7 +226,8 @@ __dead static void no_nfs(int);
 static struct exportlist *exphead;
 static struct mountlist *mlhead;
 static struct grouplist *grphead;
-static const char *exname;
+static char *const exnames_default[] = { __UNCONST(_PATH_EXPORTS), NULL };
+static char *const *exnames;
 static struct uucred def_anon = {
 	1,
 	(uid_t) -2,
@@ -384,15 +385,15 @@ main(int argc, char **argv)
 #ifdef IPSEC
 			" [-P policy]"
 #endif
-			" [-p port] [exportsfile]\n", getprogname());
+			" [-p port] [exportsfile ...]\n", getprogname());
 			exit(1);
 		};
 	argc -= optind;
 	argv += optind;
-	if (argc == 1)
-		exname = *argv;
+	if (argc > 0)
+		exnames = argv;
 	else
-		exname = _PATH_EXPORTS;
+		exnames = exnames_default;
 
 	s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
 	if (s < 0)
@@ -408,7 +409,7 @@ main(int argc, char **argv)
 
 	sem_init(, 0, 0);
 	pthread_create(, NULL, exportlist_thread, NULL);
-	exname = _PATH_EXPORTS;
+	exnames = exnames_default;
 	have_v6 = 0;
 	(void)signal(SIGHUP, signal_get_exportlist);
 #endif
@@ -1261,20 +1262,22 @@ get_exportlist(int n)
 	 * Read in the exports file and build the list, calling
 	 * mount() as we go along to push the export rules into the kernel.
 	 */
-	if ((exp_file = fopen(exname, "r")) == NULL) {
-		/*
-		 * Don't exit here; we can still reload the config
-		 * after a SIGHUP.
-		 */
-		if (mountd_debug)
-			(void)fprintf(stderr, "Can't open %s: %s\n", exname,
-			strerror(errno));
-		return;
-	}
+	for (i = 0; exnames[i] != NULL; i++) {
+		if ((exp_file = fopen(exnames[i], "r")) == NULL) {
+			/*
+			 * Don't exit here; we can still reload the config
+			 * after a SIGHUP.
+			 */
+			if (mountd_debug)
+(void)fprintf(stderr, "Can't open %s: %s\n",
+exnames[i], strerror(errno));
+			continue;
+		}
 
-	get_exportlist_one(exp_file);
+		get_exportlist_one(exp_file);
 
-	(void)fclose(exp_file);
+		(void)fclose(exp_file);
+	}
 }
 
 /*



CVS commit: src/usr.sbin/mountd

2021-02-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Feb 16 09:58:35 UTC 2021

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

Log Message:
Split get_exportlist() into get_exportlist() and get_exportlist_one()
in preparation to support multiple input files.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/usr.sbin/mountd/mountd.c

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

Modified files:

Index: src/usr.sbin/mountd/mountd.c
diff -u src/usr.sbin/mountd/mountd.c:1.132 src/usr.sbin/mountd/mountd.c:1.133
--- src/usr.sbin/mountd/mountd.c:1.132	Wed Jun 17 00:16:21 2020
+++ src/usr.sbin/mountd/mountd.c	Tue Feb 16 09:58:35 2021
@@ -1,4 +1,4 @@
-/* 	$NetBSD: mountd.c,v 1.132 2020/06/17 00:16:21 kamil Exp $	 */
+/* 	$NetBSD: mountd.c,v 1.133 2021/02/16 09:58:35 hannken Exp $	 */
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)mountd.c  8.15 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: mountd.c,v 1.132 2020/06/17 00:16:21 kamil Exp $");
+__RCSID("$NetBSD: mountd.c,v 1.133 2021/02/16 09:58:35 hannken Exp $");
 #endif
 #endif/* not lint */
 
@@ -1009,81 +1009,22 @@ parse_directory(const char *line, size_t
 }
 
 
-/*
- * Get the export list
- */
-/* ARGSUSED */
-void
-get_exportlist(int n)
+static void
+get_exportlist_one(FILE *exp_file)
 {
 	struct exportlist *ep, *ep2;
 	struct grouplist *grp, *tgrp;
 	struct exportlist **epp;
 	struct dirlist *dirhead;
-	struct statvfs fsb, *fsp;
+	struct statvfs fsb;
 	struct addrinfo *ai;
 	struct uucred anon;
 	char *cp, *endcp, *dirp, savedc;
-	int has_host, exflags, got_nondir, dirplen, num, i;
-	FILE *exp_file;
+	int has_host, exflags, got_nondir, dirplen;
 	char *line;
 	size_t lineno = 0, len;
 
-
-	/*
-	 * First, get rid of the old list
-	 */
-	ep = exphead;
-	while (ep) {
-		ep2 = ep;
-		ep = ep->ex_next;
-		free_exp(ep2);
-	}
-	exphead = NULL;
-
 	dirp = NULL;
-	dirplen = 0;
-	grp = grphead;
-	while (grp) {
-		tgrp = grp;
-		grp = grp->gr_next;
-		free_grp(tgrp);
-	}
-	grphead = NULL;
-
-	/*
-	 * And delete exports that are in the kernel for all local
-	 * file systems.
-	 */
-	num = getmntinfo(, MNT_NOWAIT);
-	for (i = 0; i < num; i++) {
-		struct mountd_exports_list mel;
-
-		/* Delete all entries from the export list. */
-		mel.mel_path = fsp->f_mntonname;
-		mel.mel_nexports = 0;
-		if (nfssvc(NFSSVC_SETEXPORTSLIST, ) == -1 &&
-		errno != EOPNOTSUPP)
-			syslog(LOG_ERR, "Can't delete exports for %s (%m)",
-			fsp->f_mntonname);
-
-		fsp++;
-	}
-
-	/*
-	 * Read in the exports file and build the list, calling
-	 * mount() as we go along to push the export rules into the kernel.
-	 */
-	if ((exp_file = fopen(exname, "r")) == NULL) {
-		/*
-		 * Don't exit here; we can still reload the config
-		 * after a SIGHUP.
-		 */
-		if (mountd_debug)
-			(void)fprintf(stderr, "Can't open %s: %s\n", exname,
-			strerror(errno));
-		return;
-	}
 	dirhead = NULL;
 	while ((line = fparseln(exp_file, , , NULL, 0)) != NULL) {
 		if (mountd_debug)
@@ -1262,6 +1203,77 @@ nextline:
 		}
 		free(line);
 	}
+}
+
+/*
+ * Get the export list
+ */
+/* ARGSUSED */
+void
+get_exportlist(int n)
+{
+	struct exportlist *ep, *ep2;
+	struct grouplist *grp, *tgrp;
+	struct statvfs *fsp;
+	int num, i;
+	FILE *exp_file;
+
+
+	/*
+	 * First, get rid of the old list
+	 */
+	ep = exphead;
+	while (ep) {
+		ep2 = ep;
+		ep = ep->ex_next;
+		free_exp(ep2);
+	}
+	exphead = NULL;
+
+	grp = grphead;
+	while (grp) {
+		tgrp = grp;
+		grp = grp->gr_next;
+		free_grp(tgrp);
+	}
+	grphead = NULL;
+
+	/*
+	 * And delete exports that are in the kernel for all local
+	 * file systems.
+	 */
+	num = getmntinfo(, MNT_NOWAIT);
+	for (i = 0; i < num; i++) {
+		struct mountd_exports_list mel;
+
+		/* Delete all entries from the export list. */
+		mel.mel_path = fsp->f_mntonname;
+		mel.mel_nexports = 0;
+		if (nfssvc(NFSSVC_SETEXPORTSLIST, ) == -1 &&
+		errno != EOPNOTSUPP)
+			syslog(LOG_ERR, "Can't delete exports for %s (%m)",
+			fsp->f_mntonname);
+
+		fsp++;
+	}
+
+	/*
+	 * Read in the exports file and build the list, calling
+	 * mount() as we go along to push the export rules into the kernel.
+	 */
+	if ((exp_file = fopen(exname, "r")) == NULL) {
+		/*
+		 * Don't exit here; we can still reload the config
+		 * after a SIGHUP.
+		 */
+		if (mountd_debug)
+			(void)fprintf(stderr, "Can't open %s: %s\n", exname,
+			strerror(errno));
+		return;
+	}
+
+	get_exportlist_one(exp_file);
+
 	(void)fclose(exp_file);
 }
 



CVS commit: src/usr.sbin/sysinst

2021-02-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 13 15:31:36 UTC 2021

Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c

Log Message:
PR 55991: when extending the marked partition (typically: the NetBSD root
partition) round the new size up to current alignment.

This may lead to a slightly smaller than initialy planned last partition
(depending on order added) if the disk size is odd or the partitioning
scheme needs some internal space (like GPT) - but it avoids gaps elsewhere
due to alignement.

Ideally we would pin all other partitions in a first pass and then let
the partitioning backend pick the full available size for the extended
partition, but this should be good enough.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/sysinst/bsddisklabel.c

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

Modified files:

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.57 src/usr.sbin/sysinst/bsddisklabel.c:1.58
--- src/usr.sbin/sysinst/bsddisklabel.c:1.57	Sun Jan 31 22:45:46 2021
+++ src/usr.sbin/sysinst/bsddisklabel.c	Sat Feb 13 15:31:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.57 2021/01/31 22:45:46 rillig Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.58 2021/02/13 15:31:35 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1387,6 +1387,8 @@ apply_settings_to_partitions(struct disk
 	 * Pass one: calculate space available for expanding
 	 * the marked partition.
 	 */
+	if (parts->free_space != parts->disk_size)
+		planned_space = align;	/* align first part */
 	for (i = 0; i < wanted->num; i++) {
 		if ((wanted->infos[i].flags & PUIFLAG_EXTEND) &&
 		exp_ndx == ~0U)
@@ -1403,8 +1405,9 @@ apply_settings_to_partitions(struct disk
 			if (!(wanted->infos[i].flags & PUIFLG_IS_OUTER))
 nsp -= infos[i].size;
 		}
-		if (nsp > 0)
-			planned_space += roundup(nsp, align);
+		if (nsp <= 0)
+			continue;
+		planned_space += roundup(nsp, align);
 	}
 
 	/*
@@ -1412,12 +1415,10 @@ apply_settings_to_partitions(struct disk
 	 * but check size limits.
 	 */
 	if (exp_ndx < wanted->num) {
-		daddr_t free_space =
-		parts->free_space - roundup(wanted->reserved_space, align);
-		free_space -= planned_space;
+		daddr_t free_space = parts->free_space - planned_space;
 		daddr_t new_size = wanted->infos[exp_ndx].size;
 		if (free_space > 0)
-			new_size += free_space;
+			new_size += roundup(free_space,align);
 
 		if (wanted->infos[exp_ndx].limit > 0 &&
 		(new_size + wanted->infos[exp_ndx].cur_start)



CVS commit: src/usr.sbin/installboot

2021-02-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Feb  6 12:18:45 UTC 2021

Modified Files:
src/usr.sbin/installboot: installboot.8

Log Message:
Mention fdisk(8) and x86/mbr(8) in example for x86, for careless
people like me ;).

Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/usr.sbin/installboot/installboot.8

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/installboot/installboot.8
diff -u src/usr.sbin/installboot/installboot.8:1.99 src/usr.sbin/installboot/installboot.8:1.100
--- src/usr.sbin/installboot/installboot.8:1.99	Sat Jun  6 20:30:23 2020
+++ src/usr.sbin/installboot/installboot.8	Sat Feb  6 12:18:45 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: installboot.8,v 1.99 2020/06/06 20:30:23 wiz Exp $
+.\"	$NetBSD: installboot.8,v 1.100 2021/02/06 12:18:45 rin Exp $
 .\"
 .\" Copyright (c) 2002-2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 5, 2019
+.Dd February 6, 2021
 .Dt INSTALLBOOT 8
 .Os
 .Sh NAME
@@ -784,8 +784,17 @@ Install new boot blocks on an existing
 .Sy FFSv2
 mounted root file system on
 .Sq wd0 ,
-setting the timeout to five seconds, after copying a new secondary
-bootstrap:
+setting the timeout to five seconds, after installing an MBR bootcode and
+copying a new secondary bootstrap:
+.Dl Ic fdisk -c /usr/mdec/mbr /dev/rwd0d
+.Bd -ragged -offset indent-two -compact
+.Em Note :
+See
+.Xr fdisk 8
+and
+.Xr x86/mbr 8
+for more details.
+.Ed
 .Dl Ic cp /usr/mdec/boot /boot
 .Dl Ic installboot -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv2
 .Bd -ragged -offset indent-two -compact
@@ -958,6 +967,7 @@ already present:
 .Xr disklabel 8 ,
 .Xr dumpfs 8 ,
 .Xr fdisk 8 ,
+.Xr x86/mbr 8 ,
 .Xr x86/pxeboot 8
 .
 .Sh HISTORY



CVS commit: src/usr.sbin/rtadvd

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:50:08 UTC 2021

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

Log Message:
rtadvd: no longer need packed member warning


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/rtadvd/Makefile

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

Modified files:

Index: src/usr.sbin/rtadvd/Makefile
diff -u src/usr.sbin/rtadvd/Makefile:1.25 src/usr.sbin/rtadvd/Makefile:1.26
--- src/usr.sbin/rtadvd/Makefile:1.25	Sun Sep  6 07:20:32 2020
+++ src/usr.sbin/rtadvd/Makefile	Wed Feb  3 06:50:07 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.25 2020/09/06 07:20:32 mrg Exp $
+# $NetBSD: Makefile,v 1.26 2021/02/03 06:50:07 roy Exp $
 
 WARNS?=	4
 
@@ -31,9 +31,6 @@ LDADD.rump+=	-lrumpres
 DPADD.rump+=	${LIBRUMPRES}
 .endif
 
-CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
-CWARNFLAGS.gcc+=	${GCC_NO_ADDR_OF_PACKED_MEMBER}
-
 COPTS.if.c+=		${GCC_NO_STRINGOP_TRUNCATION}
 COPTS.config.c+=	${GCC_NO_STRINGOP_TRUNCATION}
 



CVS commit: src/usr.sbin/traceroute

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:49:18 UTC 2021

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

Log Message:
traceroute: no longer need gcc packed member warning


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/traceroute/Makefile

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

Modified files:

Index: src/usr.sbin/traceroute/Makefile
diff -u src/usr.sbin/traceroute/Makefile:1.21 src/usr.sbin/traceroute/Makefile:1.22
--- src/usr.sbin/traceroute/Makefile:1.21	Sun Sep  6 07:20:33 2020
+++ src/usr.sbin/traceroute/Makefile	Wed Feb  3 06:49:18 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.21 2020/09/06 07:20:33 mrg Exp $	
+#	$NetBSD: Makefile,v 1.22 2021/02/03 06:49:18 roy Exp $	
 
 USE_FORT?= yes	# network client
 
@@ -30,6 +30,4 @@ SANITIZER_RENAME_SYMBOL.rump+=	getifaddr
 
 AWKS=	median.awk mean.awk 
 
-CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER}
-
 .include 



CVS commit: src/usr.sbin/ldpd

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:46:27 UTC 2021

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

Log Message:
ldpd: Discard warning about accessing packed member

I don't see a good way of fixing this right now.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/ldpd/Makefile

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

Modified files:

Index: src/usr.sbin/ldpd/Makefile
diff -u src/usr.sbin/ldpd/Makefile:1.5 src/usr.sbin/ldpd/Makefile:1.6
--- src/usr.sbin/ldpd/Makefile:1.5	Fri Oct 18 10:49:19 2013
+++ src/usr.sbin/ldpd/Makefile	Wed Feb  3 06:46:27 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2013/10/18 10:49:19 kefren Exp $
+# $NetBSD: Makefile,v 1.6 2021/02/03 06:46:27 roy Exp $
 
 .include 
 
@@ -26,4 +26,6 @@ LDADD+=	-lcrypt
 CPPFLAGS+=-DINET6
 .endif
 
+CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER}
+
 .include 



CVS commit: src/usr.sbin/traceroute6

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:42:50 UTC 2021

Modified Files:
src/usr.sbin/traceroute6: Makefile traceroute6.c

Log Message:
traceroute6: Remove __packed


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/traceroute6/Makefile
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/traceroute6/traceroute6.c

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

Modified files:

Index: src/usr.sbin/traceroute6/Makefile
diff -u src/usr.sbin/traceroute6/Makefile:1.11 src/usr.sbin/traceroute6/Makefile:1.12
--- src/usr.sbin/traceroute6/Makefile:1.11	Sun Sep  6 07:20:33 2020
+++ src/usr.sbin/traceroute6/Makefile	Wed Feb  3 06:42:50 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.11 2020/09/06 07:20:33 mrg Exp $
+# $NetBSD: Makefile,v 1.12 2021/02/03 06:42:50 roy Exp $
 
 USE_FORT?= yes	# network client
 
@@ -20,6 +20,4 @@ CPPFLAGS+=-I${TRACEROUTE}
 
 .PATH: ${TRACEROUTE}
 
-CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER}
-
 .include 

Index: src/usr.sbin/traceroute6/traceroute6.c
diff -u src/usr.sbin/traceroute6/traceroute6.c:1.51 src/usr.sbin/traceroute6/traceroute6.c:1.52
--- src/usr.sbin/traceroute6/traceroute6.c:1.51	Mon Apr 23 18:59:03 2018
+++ src/usr.sbin/traceroute6/traceroute6.c	Wed Feb  3 06:42:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: traceroute6.c,v 1.51 2018/04/23 18:59:03 maxv Exp $	*/
+/*	$NetBSD: traceroute6.c,v 1.52 2021/02/03 06:42:50 roy Exp $	*/
 /*	$KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $	*/
 
 /*
@@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: traceroute6.c,v 1.51 2018/04/23 18:59:03 maxv Exp $");
+__RCSID("$NetBSD: traceroute6.c,v 1.52 2021/02/03 06:42:50 roy Exp $");
 #endif
 #endif
 
@@ -306,7 +306,7 @@ struct opacket {
 	u_char hops;		/* hop limit of the packet */
 	u_char pad[2];
 	struct tv32 tv;		/* time packet left */
-} __packed;
+};
 
 static u_char	packet[512];		/* last inbound (icmp) packet */
 static struct opacket	*outpacket;	/* last output (udp) packet */



CVS commit: src/usr.sbin/fstyp

2021-02-02 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Feb  2 21:31:11 UTC 2021

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

Log Message:
Ignore address of packed-member for clang too


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/fstyp/Makefile

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

Modified files:

Index: src/usr.sbin/fstyp/Makefile
diff -u src/usr.sbin/fstyp/Makefile:1.10 src/usr.sbin/fstyp/Makefile:1.11
--- src/usr.sbin/fstyp/Makefile:1.10	Sun Sep  6 07:20:31 2020
+++ src/usr.sbin/fstyp/Makefile	Tue Feb  2 21:31:11 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2020/09/06 07:20:31 mrg Exp $
+#	$NetBSD: Makefile,v 1.11 2021/02/02 21:31:11 joerg Exp $
 
 .include 
 
@@ -29,7 +29,7 @@ COPTS.zfs.c+=	-I${NETBSDSRCDIR}/external
 LDADD+=	-lnvpair -lzfs
 .endif
 
-CWARNFLAGS.clang+=	-Wno-unknown-pragmas
+CWARNFLAGS.clang+=	-Wno-unknown-pragmas -Wno-error=address-of-packed-member
 CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER}
 
 .include 



CVS commit: src/usr.sbin/sysinst

2021-01-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jan 31 22:45:47 UTC 2021

Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c checkrc.c configmenu.c defs.h
disklabel.c disks.c geom.c gpt.c label.c main.c mbr.c net.c
part_edit.c partitions.h partman.c target.c txtwalk.c util.c
wskbd.c

Log Message:
sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/sysinst/bsddisklabel.c \
src/usr.sbin/sysinst/util.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/sysinst/checkrc.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/sysinst/configmenu.c
cvs rdiff -u -r1.69 -r1.70 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/sysinst/disklabel.c
cvs rdiff -u -r1.71 -r1.72 src/usr.sbin/sysinst/disks.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/geom.c
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/sysinst/gpt.c
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/sysinst/label.c
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/sysinst/main.c
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/sysinst/mbr.c
cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/sysinst/net.c
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/sysinst/part_edit.c
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/sysinst/partitions.h
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/sysinst/partman.c
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/sysinst/target.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/txtwalk.c \
src/usr.sbin/sysinst/wskbd.c

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

Modified files:

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.56 src/usr.sbin/sysinst/bsddisklabel.c:1.57
--- src/usr.sbin/sysinst/bsddisklabel.c:1.56	Tue Oct 13 17:26:28 2020
+++ src/usr.sbin/sysinst/bsddisklabel.c	Sun Jan 31 22:45:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.56 2020/10/13 17:26:28 martin Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.57 2021/01/31 22:45:46 rillig Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -386,7 +386,7 @@ inst_ext_clone(menudesc *menu, void *arg
 	struct part_usage_info *p;
 	menu_ent *men;
 	int num_men, i;
- 
+
 	if (!select_partitions(, pm->parts))
 		return 0;
 
@@ -625,7 +625,7 @@ set_ptn_size(menudesc *m, void *arg)
 
 		if (is_ram_size) {
 			new_size_val = parse_ram_size(answer, _percent);
-			if (is_percent && 
+			if (is_percent &&
 			(new_size_val < 0 || new_size_val > 100))
 continue;
 			if (!is_percent && new_size_val < 0)
@@ -1507,7 +1507,7 @@ apply_settings_to_partitions(struct disk
 			want->cur_part_id = new_part_id;
 
 			want->flags |= PUIFLG_ADD_INNER|PUIFLG_IS_OUTER;
-			from = roundup(infos[i].start + 
+			from = roundup(infos[i].start +
 			infos[i].size, outer_align);
 		}
 	}
@@ -1656,7 +1656,7 @@ apply_settings_to_partitions(struct disk
 new_part_id = wanted->parts->pscheme->
 add_partition(
 wanted->parts, [i], NULL);
-		
+
 			if (new_part_id == NO_PART)
 continue;	/* failed to add, skip */
 		}
@@ -1818,7 +1818,7 @@ make_bsd_partitions(struct install_parti
 		/* calc available disk area for the NetBSD partitions */
 		p_start = pm->ptstart;
 		p_size = pm->ptsize;
-		if (parts->parent != NULL && 
+		if (parts->parent != NULL &&
 		parts->parent->pscheme->guess_install_target != NULL)
 			parts->parent->pscheme->guess_install_target(
 			parts->parent, _start, _size);
@@ -1826,7 +1826,7 @@ make_bsd_partitions(struct install_parti
 	if (layoutkind == LY_OTHERSCHEME) {
 		parts->pscheme->destroy_part_scheme(parts);
 		return -1;
-	} else if (layoutkind == LY_USEDEFAULT) { 
+	} else if (layoutkind == LY_USEDEFAULT) {
 		replace_by_default(parts, p_start, p_size,
 		);
 	} else if (layoutkind == LY_SETSIZES) {
@@ -1861,7 +1861,7 @@ make_bsd_partitions(struct install_parti
 			struct disk_part_info info;
 
 			if (wanted.infos[i].type != PT_root ||
-			strcmp(wanted.infos[i].mount, "/") != 0) 
+			strcmp(wanted.infos[i].mount, "/") != 0)
 continue;
 			wanted.infos[i].cur_flags |= PTI_INSTALL_TARGET;
 
@@ -1900,7 +1900,7 @@ make_bsd_partitions(struct install_parti
 			daddr_t ps = wanted.infos[i].cur_start;
 			daddr_t pe = ps + wanted.infos[i].size;
 			if (target_start >= 0 &&
-			   (ps >= target_start || pe >= target_start)) 
+			   (ps >= target_start || pe >= target_start))
 continue;
 			boot_part = i;
 			break;
Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.56 src/usr.sbin/sysinst/util.c:1.57
--- src/usr.sbin/sysinst/util.c:1.56	Tue Nov 10 09:14:01 2020
+++ src/usr.sbin/sysinst/util.c	Sun Jan 31 22:45:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.56 2020/11/10 09:14:01 gson Exp $	*/
+/*	$NetBSD: util.c,v 1.57 2021/01/31 22:45:47 rillig Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1370,7 +1370,7 @@ 

CVS commit: src/usr.sbin/sysinst

2021-01-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jan 31 22:19:24 UTC 2021

Modified Files:
src/usr.sbin/sysinst: msg.mi.de

Log Message:
sysinst: fix some more typos in the German translation


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/sysinst/msg.mi.de

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.mi.de
diff -u src/usr.sbin/sysinst/msg.mi.de:1.32 src/usr.sbin/sysinst/msg.mi.de:1.33
--- src/usr.sbin/sysinst/msg.mi.de:1.32	Sun Jan 31 21:28:16 2021
+++ src/usr.sbin/sysinst/msg.mi.de	Sun Jan 31 22:19:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.de,v 1.32 2021/01/31 21:28:16 rillig Exp $	*/
+/*	$NetBSD: msg.mi.de,v 1.33 2021/01/31 22:19:24 rillig Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1227,11 +1227,11 @@ message doneconfig {Konfiguration abgesc
 message Install_pkgin {pkgin installieren und Datenbank initialisieren}
 message binpkg_installed
 {Das System kann nun Binärpakete mittels pkgin installieren. Um ein Paket zu
-installieren, führen Sie den folenden Befehl in einer root-Shell aus:
+installieren, führen Sie den folgenden Befehl in einer root-Shell aus:
 
 pkgin install 
 
-Weitere Informationen finden sich in der pkgin(1)-Manpage.}
+Weitere Informationen finden Sie in der pkgin(1)-Manpage.}
 message Install_pkgsrc {pkgsrc herunterladen und entpacken}
 message pkgsrc
 {Welches Protokoll, welcher Host, welches Verzeichnis und welcher User/Passwort



CVS commit: src/usr.sbin/sysinst

2021-01-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jan 31 21:28:16 UTC 2021

Modified Files:
src/usr.sbin/sysinst: msg.mi.de

Log Message:
sysinst: restore the few intentional line breaks in German

Marking a forced line break with a trailing space is a terrible idea.
Most of the lines that previously had trailing whitespace did so
unintentionally, destroying the auto-layout.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/sysinst/msg.mi.de

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.mi.de
diff -u src/usr.sbin/sysinst/msg.mi.de:1.31 src/usr.sbin/sysinst/msg.mi.de:1.32
--- src/usr.sbin/sysinst/msg.mi.de:1.31	Sun Jan 31 21:00:43 2021
+++ src/usr.sbin/sysinst/msg.mi.de	Sun Jan 31 21:28:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.de,v 1.31 2021/01/31 21:00:43 rillig Exp $	*/
+/*	$NetBSD: msg.mi.de,v 1.32 2021/01/31 21:28:16 rillig Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -34,6 +34,8 @@
 
 /* MI Message catalog -- German, machine independent */
 
+/* NB: Lines ending in spaces force line breaks */
+
 /*
  * Use only ASCII characters in this message - it is displayed before the
  * locale is set up!
@@ -601,7 +603,7 @@ Zurück zum vorigen Menü.
 }
 
 message netup
-{Die folgenden Netzwerkadapter sind verfügbar: %s
+{Die folgenden Netzwerkadapter sind verfügbar: %s 
 Hat einer davon Zugriff auf die benötigten Server?}
 
 message asknetdev
@@ -642,28 +644,28 @@ message net_media
 message netok
 {Nachfolgend sehen Sie die aktuellen Netzwerkeinstellungen.
 
-DNS-Domain:		%s
-Hostname:		%s
-Nameserver:		%s
-Netzwerkadapter:	%s
-Verbindungstyp:		%s
-IP-Adresse:		%s
-Netzmaske:		%s
-IPv4-Gateway:		%s
+DNS-Domain:		%s 
+Hostname:		%s 
+Nameserver:		%s 
+Netzwerkadapter:	%s 
+Verbindungstyp:		%s 
+IP-Adresse:		%s 
+Netzmaske:		%s 
+IPv4-Gateway:		%s 
 }
 
 message netok_slip
 {Sie haben die folgenden Daten gewählt. Sind diese Daten OK?
 
-DNS-Domain:		%s
-Hostname:		%s
-Nameserver:		%s
-Netzwerkadapter:	%s
-Verbindungstyp:		%s
-IP-Adresse:		%s
-IP-Adresse des Servers:	%s
-Netzmaske:		%s
-IPv4-Gateway:		%s
+DNS-Domain:		%s 
+Hostname:		%s 
+Nameserver:		%s 
+Netzwerkadapter:	%s 
+Verbindungstyp:		%s 
+IP-Adresse:		%s 
+IP-Adresse des Servers:	%s 
+Netzmaske:		%s 
+IPv4-Gateway:		%s 
 }
 
 message netokv6
@@ -998,8 +1000,8 @@ message choose_timezone
 Drücken Sie die Eingabetaste, um einen Eintrag anzuwählen. Betätigen Sie danach
 die Taste 'x' gefolgt von der Eingabetaste, um das Menü zu verlassen.
 
- Vorgabe:	%s
- Ausgewählt:	%s
+ Vorgabe:	%s 
+ Ausgewählt:	%s 
  Lokale Zeit:	%s %s
 }
 



CVS commit: src/usr.sbin/sysinst

2021-01-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jan 31 21:00:43 UTC 2021

Modified Files:
src/usr.sbin/sysinst: msg.mi.de

Log Message:
sysinst: proofread German translation

It was a mixture of all possible styles, with several typos and
inconsistencies.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/sysinst/msg.mi.de

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.mi.de
diff -u src/usr.sbin/sysinst/msg.mi.de:1.30 src/usr.sbin/sysinst/msg.mi.de:1.31
--- src/usr.sbin/sysinst/msg.mi.de:1.30	Sun Jan 31 18:31:59 2021
+++ src/usr.sbin/sysinst/msg.mi.de	Sun Jan 31 21:00:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.de,v 1.30 2021/01/31 18:31:59 rillig Exp $	*/
+/*	$NetBSD: msg.mi.de,v 1.31 2021/01/31 21:00:43 rillig Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -35,8 +35,8 @@
 /* MI Message catalog -- German, machine independent */
 
 /*
- * We can not use non ascii characters in this message - it is displayed
- * before the locale is set up!
+ * Use only ASCII characters in this message - it is displayed before the
+ * locale is set up!
  */
 message sysinst_message_language
 {Installation auf Deutsch}
@@ -68,13 +68,13 @@ message upgrade
 
 message hello
 {Willkommen bei Sysinst, dem Installationsprogramm von NetBSD-@@VERSION@@.
-Dieses Programm wird Ihnen helfen, NetBSD auf eine Festplatte zu installieren
+Dieses Programm hilft Ihnen, NetBSD auf eine Festplatte zu installieren
 oder aber eine bereits bestehende Installation von NetBSD zu aktualisieren.
 In den folgenden Menüs können Sie mit den Buchstaben (a, b, c, ...)
 die verschiedenen Menüeinträge wählen oder durch Drücken von Strg-N/Strg-P
 die Markierung auf- oder abbewegen. Die Cursor- und Bildlauftasten
 (Seite vor/zurück) sollten ebenfalls funktionieren.
-Durch Betätigen der Eingabetaste aktivieren Sie die gegenwärtige Auswahl.
+Mit der Eingabetaste bestätigen Sie die gegenwärtige Auswahl.
 }
 
 message thanks
@@ -107,8 +107,8 @@ Datensicherung durchgeführt haben! Wolle
 
 message reinstallusure
 {Im folgenden werden die NetBSD Distributionssets (Kernel + Basissystem)
-auf eine vorbereitete Festplatte ausgepackt. Diese Prozedur lädt und entpackt
-die Sets auf eine im Vorfeld partitionierte und bootfähige Festplatte aus.
+auf eine vorbereitete Festplatte ausgepackt. Dieser Vorgang lädt und entpackt
+die Sets auf eine im Vorfeld partitionierte und bootfähige Festplatte.
 Es werden weder Festplatten gelabelt, Bootblöcke aktualisiert noch bestehende
 Konfigurationen gesichert.
 
@@ -116,7 +116,7 @@ Beenden Sie jetzt und wählen Sie dann 'I
 falls Ihre Festplatte nicht entsprechend vorbereitet ist oder Sie das System
 neu installieren oder aber ein bestehendes aktualisieren möchten!
 
-Wollen Sie die NetBSD Distributionssets wirklich erneut installieren?
+Wollen Sie die NetBSD-Distributionssets wirklich erneut installieren?
 (Dies ist die letzte Warnung, bevor die Inhalte Ihres Dateisystems
 überschrieben werden!)
 }
@@ -126,13 +126,13 @@ message mount_failed
 }
 
 message nodisk
-{Ich kann keine für NetBSD nutzbaren Festplatten finden.
+{Keine für NetBSD nutzbaren Festplatten gefunden.
 Zurück zum Hauptmenü...
 }
 
 message onedisk
-{Ich habe nur eine Festplatte, %s, gefunden. Ich gehe somit davon aus, dass
-Sie NetBSD darauf %s möchten.
+{Es wurde nur eine Festplatte, %s, gefunden. Wahrscheinlich möchten Sie
+NetBSD daher darauf %s.
 }
 
 message ask_disk
@@ -183,7 +183,7 @@ aber die Standard-Partitionen verwenden.
  *  $5 = install with X min.		427M
  */
 message layout_prologue_existing
-{Falls Sie nicht die existierende Partitionen weiterverwenden möchten,
+{Falls Sie die bestehenden Partitionen nicht mehr weiterverwenden möchten,
 können Sie die Größe der NetBSD-Partitionen neu definieren oder aber
 alle verwerfen und die Standard-Partitionsgrößen verwenden.}
 
@@ -209,7 +209,7 @@ $5 Megabyte bei Installation der X-Windo
 message Choose_your_size_specifier
 {Wenn Sie Mega- oder Gigabytes wählen, werden effektive
 Partitionsgrößen festgesetzt, die nahe Ihrer Größenangabe liegen.
-Bei modernen Festplatten spielen Zylindergrößen keine Roole.
+Bei modernen Festplatten spielen Zylindergrößen keine Rolle.
 Bei älteren Festplatten dagegen ist es am effizientesten, sich
 Partitionsgrößen auszusuchen, die exakt ein Vielfaches der
 aktuellen Zylindergröße ausmachen.
@@ -221,7 +221,7 @@ Wählen Sie die Einheit}
 message ptnsizes
 {Sie können jetzt die Größen der Systempartitionen verändern. Standardmäßig
 wird der gesamte Speicherplatz der Rootpartition zugeordnet. Wenn Sie
-wollen, können Sie separate Partitionen definieren, z.B. /usr (zusätzliche
+möchten, können Sie separate Partitionen definieren, z.B. /usr (zusätzliche
 Systemdateien), /var (Log- bzw. Protokolldateien und anderes) oder /home
 (Verzeichnis für die persönlichen Dateien der Anwender).
 
@@ -229,10 +229,10 

CVS commit: src/usr.sbin/sysinst

2021-01-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jan 31 20:51:04 UTC 2021

Modified Files:
src/usr.sbin/sysinst: factor.c

Log Message:
sysinst: warp factor.c to the 21st century

That file contained some conditionally defined code that still used
old-style function definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/sysinst/factor.c

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

Modified files:

Index: src/usr.sbin/sysinst/factor.c
diff -u src/usr.sbin/sysinst/factor.c:1.1 src/usr.sbin/sysinst/factor.c:1.2
--- src/usr.sbin/sysinst/factor.c:1.1	Sat Jul 26 19:30:44 2014
+++ src/usr.sbin/sysinst/factor.c	Sun Jan 31 20:51:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: factor.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */
+/*	$NetBSD: factor.c,v 1.2 2021/01/31 20:51:04 rillig Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -32,10 +32,7 @@
  *
  */
 
-/* Prototypes for strict prototyping. */
-
 #include 
-
 #include 
 
 
@@ -55,8 +52,7 @@ static void build_primes (long max);
 void factor (long val, long *fact_list, int fact_size, int *num_fact);
 
 static void
-build_primes(max)
-	long max;
+build_primes(long max)
 {
 	long pc;
 	int j;
@@ -83,15 +79,11 @@ build_primes(max)
 }
 
 /* factor:  prepare a list of prime factors of val.
-   The last number may not be a prime factor is the list is not
+   The last number may not be a prime factor if the list is not
long enough. */
 
 void
-factor(val, fact_list, fact_size, num_fact)
-	long val;
-	long *fact_list;
-	int fact_size;
-	int *num_fact;
+factor(long val, long *fact_list, int fact_size, int *num_fact)
 {
 	int i;
 



CVS commit: src/usr.sbin/sysinst

2021-01-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jan 31 18:31:59 UTC 2021

Modified Files:
src/usr.sbin/sysinst: msg.mi.de

Log Message:
sysinst: fix German translation, remove more trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/sysinst/msg.mi.de

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.mi.de
diff -u src/usr.sbin/sysinst/msg.mi.de:1.29 src/usr.sbin/sysinst/msg.mi.de:1.30
--- src/usr.sbin/sysinst/msg.mi.de:1.29	Sun Jan 31 18:22:11 2021
+++ src/usr.sbin/sysinst/msg.mi.de	Sun Jan 31 18:31:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.de,v 1.29 2021/01/31 18:22:11 rillig Exp $	*/
+/*	$NetBSD: msg.mi.de,v 1.30 2021/01/31 18:31:59 rillig Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1140,7 +1140,7 @@ message Device {Gerät}
 message File_system {Dateisystem}
 message Select_DNS_server {  Auswählen eines DNS Servers}
 message other {andere }
-message Perform_autoconfiguration {Führen Sie die automatische Konfiguration?}
+message Perform_autoconfiguration {Automatische Konfiguration durchführen?}
 message Root_shell {Root-Shell}
 message User_shell {User-Shell}
 message Color_scheme {Farbschema}
@@ -1219,15 +1219,15 @@ message enable_xdm {xdm aktivieren}
 message enable_cgd {cgd aktivieren}
 message enable_lvm {lvm aktivieren}
 message enable_raid {raidframe aktivieren}
-message add_a_user {Add a user}
+message add_a_user {Benutzer hinzufügen}
 message configmenu {Zusätzliche Einstellungen konfigurieren.}
 message doneconfig {Konfiguration abgeschlossen.}
 message Install_pkgin {pkgin installieren und Datenbank initialisieren}
 message binpkg_installed
 {Das System kann nun Binärpakete mittels pkgin installieren. Um ein Paket zu
-installieren, muss man folenden Befehl von einer root-Shell ausführen:
+installieren, führen Sie den folenden Befehl in einer root-Shell aus:
 
-pkgin install 
+pkgin install 
 
 Weitere Informationen finden sich in der pkgin(1)-Manpage.}
 message Install_pkgsrc {pkgsrc herunterladen und entpacken}
@@ -1239,8 +1239,8 @@ gesetzt wird, dann wird kein Passwort be
 }
 message Pkgsrc_dir {pkgsrc-Verzeichnis}
 message get_pkgsrc {pkgsrc herunterladen und extrahieren}
-message retry_pkgsrc_network {Netzwerkkonfiguration fehlgeschlagen. Noch einmal
-versuchen?}
+message retry_pkgsrc_network
+{Netzwerkkonfiguration fehlgeschlagen. Noch einmal versuchen?}
 message quit_pkgsrc {Ohne Installation von pkgsrc beenden.}
 message quit_pkgs_install {Installation von binär-Paketen beenden.}
 message pkgin_failed
@@ -1292,10 +1292,10 @@ message parttype_only_disklabel {disklab
 
 message select_part_scheme
 {Dieses Gerät wurde anscheinend noch nicht partitioniert.
-Bitte wählen Sie ein Partitionierungsverfahren. }
+Bitte wählen Sie ein Partitionierungsverfahren.}
 
 message select_other_partscheme
-{Bitte wählen Sie ein anderes Partitionierungsverfahren. }
+{Bitte wählen Sie ein anderes Partitionierungsverfahren.}
 
 message select_part_limit
 {Einige Verfahren können nur den Anfang einer große Festplatte verwalten,



CVS commit: src/usr.sbin/sysinst

2021-01-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jan 31 18:22:12 UTC 2021

Modified Files:
src/usr.sbin/sysinst: msg.mi.de

Log Message:
sysinst: remove trailing whitespace in German translation


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/sysinst/msg.mi.de

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.mi.de
diff -u src/usr.sbin/sysinst/msg.mi.de:1.28 src/usr.sbin/sysinst/msg.mi.de:1.29
--- src/usr.sbin/sysinst/msg.mi.de:1.28	Thu Nov  5 11:10:11 2020
+++ src/usr.sbin/sysinst/msg.mi.de	Sun Jan 31 18:22:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.de,v 1.28 2020/11/05 11:10:11 martin Exp $	*/
+/*	$NetBSD: msg.mi.de,v 1.29 2021/01/31 18:22:11 rillig Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -73,7 +73,7 @@ oder aber eine bereits bestehende Instal
 In den folgenden Menüs können Sie mit den Buchstaben (a, b, c, ...)
 die verschiedenen Menüeinträge wählen oder durch Drücken von Strg-N/Strg-P
 die Markierung auf- oder abbewegen. Die Cursor- und Bildlauftasten
-(Seite vor/zurück) sollten ebenfalls funktionieren. 
+(Seite vor/zurück) sollten ebenfalls funktionieren.
 Durch Betätigen der Eingabetaste aktivieren Sie die gegenwärtige Auswahl.
 }
 
@@ -100,7 +100,7 @@ Wollen Sie fortfahren?
 
 message upgradeusure
 {Sie möchten das auf der Festplatte befindliche NetBSD-System aktualisieren.
-Zu diesem Zeitpunkt sollten Sie bereits eine vollständige 
+Zu diesem Zeitpunkt sollten Sie bereits eine vollständige
 Datensicherung durchgeführt haben! Wollen Sie NetBSD wirklich aktualisieren?
 (Dies ist die letzte Warnung, bevor Ihre Festplatte(n) modifiziert werden.)
 }
@@ -132,7 +132,7 @@ Zurück zum Hauptmenü...
 
 message onedisk
 {Ich habe nur eine Festplatte, %s, gefunden. Ich gehe somit davon aus, dass
-Sie NetBSD darauf %s möchten. 
+Sie NetBSD darauf %s möchten.
 }
 
 message ask_disk
@@ -220,7 +220,7 @@ Wählen Sie die Einheit}
 
 message ptnsizes
 {Sie können jetzt die Größen der Systempartitionen verändern. Standardmäßig
-wird der gesamte Speicherplatz der Rootpartition zugeordnet. Wenn Sie 
+wird der gesamte Speicherplatz der Rootpartition zugeordnet. Wenn Sie
 wollen, können Sie separate Partitionen definieren, z.B. /usr (zusätzliche
 Systemdateien), /var (Log- bzw. Protokolldateien und anderes) oder /home
 (Verzeichnis für die persönlichen Dateien der Anwender).
@@ -275,12 +275,12 @@ message fssizesbad
 
 message startoutsidedisk
 {Der Startwert, den Sie angegeben haben, liegt jenseits des Endes der
-Festplatte. 
+Festplatte.
 }
 
 message endoutsidedisk
 {Mit diesem Wert liegt das Ende der Partition jenseits des Endes der
-Festplatte. 
+Festplatte.
 Die Größe Ihrer Partition wurde verringert.}
 
 /* Called with:Example
@@ -419,14 +419,14 @@ Möchten Sie fortfahren?
 }
 
 message disksetupdone
-{Der erste Teil der Installation ist nun abgeschlossen. 
+{Der erste Teil der Installation ist nun abgeschlossen.
 Sysinst hat das von Ihnen gewählte Ziellaufwerk partitioniert und
 auf allen von Ihnen gewählten Partitionen ein Dateisystem initialisiert
 und geprüft.
 }
 
 message disksetupdoneupdate
-{Der erste Teil der Prozedur ist nun abgeschlossen. 
+{Der erste Teil der Prozedur ist nun abgeschlossen.
 Sysinst hat das von Ihnen gewählte Ziellaufwerk partitioniert und
 und alle gewählten Dateisysteme auf Fehler überprüft.
 }
@@ -481,15 +481,15 @@ beendet.
 Sie sollten nun die Anweisungen im INSTALL Dokument beachten, um
 Ihr System Ihrer Konfiguration entsprechend einzurichten. Die afterboot(8)
 Manpage kann ebenfalls nützlich sein.
- 
+
 Zumindest müssen Sie die Datei rc.conf editieren, so daß die gewünschten
 Dienste gestartet werden. Vergessen Sie nicht, rc_configured=NO auf
-rc_configured=YES umzustellen. 
+rc_configured=YES umzustellen.
 }
 
 message distmedium
 {Ihre Festplatte ist nun bereit für die Installation der Kernel- und
-Distributionspakete. Wie im INSTALL-Dokument beschrieben, haben Sie nun 
+Distributionspakete. Wie im INSTALL-Dokument beschrieben, haben Sie nun
 mehrere Optionen.
 Für FTP oder NFS müssen Sie mit einem Netzwerk verbunden sein und
 Zugriff auf die entsprechenden Server haben.
@@ -551,9 +551,9 @@ die Distribution zu finden ist.
 }
 
 message No_cd_found
-{Kein CD Laufwerk enthält eine CD mit den Distributions-Dateien!  
+{Kein CD Laufwerk enthält eine CD mit den Distributions-Dateien!
 Geben Sie die korrekten Daten manuel ein, oder legen Sie eine CD
-ein und versuchen Sie es erneut. 
+ein und versuchen Sie es erneut.
 }
 
 message abort_install
@@ -601,7 +601,7 @@ Zurück zum vorigen Menü.
 }
 
 message netup
-{Die folgenden Netzwerkadapter sind verfügbar: %s 
+{Die folgenden Netzwerkadapter sind verfügbar: %s
 Hat einer davon Zugriff auf die benötigten Server?}
 
 message asknetdev
@@ -642,33 +642,33 @@ message net_media
 message netok
 {Nachfolgend sehen Sie die aktuellen 

CVS commit: src/usr.sbin/tprof

2021-01-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 30 11:46:25 UTC 2021

Modified Files:
src/usr.sbin/tprof: tprof_analyze.c

Log Message:
Print the path that we failed to open on error


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/tprof/tprof_analyze.c

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

Modified files:

Index: src/usr.sbin/tprof/tprof_analyze.c
diff -u src/usr.sbin/tprof/tprof_analyze.c:1.3 src/usr.sbin/tprof/tprof_analyze.c:1.4
--- src/usr.sbin/tprof/tprof_analyze.c:1.3	Sat Jul 14 07:54:04 2018
+++ src/usr.sbin/tprof/tprof_analyze.c	Sat Jan 30 11:46:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tprof_analyze.c,v 1.3 2018/07/14 07:54:04 maxv Exp $	*/
+/*	$NetBSD: tprof_analyze.c,v 1.4 2021/01/30 11:46:25 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2010,2011,2012 YAMAMOTO Takashi,
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: tprof_analyze.c,v 1.3 2018/07/14 07:54:04 maxv Exp $");
+__RCSID("$NetBSD: tprof_analyze.c,v 1.4 2021/01/30 11:46:25 jmcneill Exp $");
 #endif /* not lint */
 
 #include 
@@ -112,7 +112,7 @@ ksymload(void)
 
 	fd = open(_PATH_KSYMS, O_RDONLY);
 	if (fd == -1) {
-		err(EXIT_FAILURE, "open");
+		err(EXIT_FAILURE, "open " _PATH_KSYMS);
 	}
 	if (elf_version(EV_CURRENT) == EV_NONE) {
 		goto elffail;



CVS commit: src/usr.sbin/isibootd

2021-01-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 30 11:34:28 UTC 2021

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

Log Message:
Fix "Cannot allocate memory" failure on amd64.

BIOCGBLEN ioctl of bpf(4) requires u_int, not size_t.
The problem is reported by Kenji Aoyama.

Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/isibootd/isibootd.c

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

Modified files:

Index: src/usr.sbin/isibootd/isibootd.c
diff -u src/usr.sbin/isibootd/isibootd.c:1.3 src/usr.sbin/isibootd/isibootd.c:1.4
--- src/usr.sbin/isibootd/isibootd.c:1.3	Mon Apr  2 09:01:30 2012
+++ src/usr.sbin/isibootd/isibootd.c	Sat Jan 30 11:34:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: isibootd.c,v 1.3 2012/04/02 09:01:30 nisimura Exp $	*/
+/*	$NetBSD: isibootd.c,v 1.4 2021/01/30 11:34:28 tsutsui Exp $	*/
 /*	Id: isiboot.c,v 1.2 1999/12/26 14:33:33 nisimura Exp 	*/
 
 /*-
@@ -364,7 +364,7 @@ createbpfport(char *ifname, uint8_t **io
 	struct ifreq ifr;
 	int fd;
 	u_int type;
-	size_t buflen;
+	u_int buflen;
 	uint8_t dladdr[ETHER_ADDR_LEN], *buf;
 #ifdef BIOCIMMEDIATE
 	u_int flag;



CVS commit: src/usr.sbin/fstyp

2021-01-24 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Jan 24 14:37:32 UTC 2021

Modified Files:
src/usr.sbin/fstyp: exfat.c

Log Message:
fstyp: Fix exfat detection

taken-from FreeBSD ddf61156132b610915325769cbb93ea11be0d433


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/fstyp/exfat.c

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

Modified files:

Index: src/usr.sbin/fstyp/exfat.c
diff -u src/usr.sbin/fstyp/exfat.c:1.3 src/usr.sbin/fstyp/exfat.c:1.4
--- src/usr.sbin/fstyp/exfat.c:1.3	Sat Feb  8 12:56:56 2020
+++ src/usr.sbin/fstyp/exfat.c	Sun Jan 24 14:37:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: exfat.c,v 1.3 2020/02/08 12:56:56 fox Exp $	*/
+/*	$NetBSD: exfat.c,v 1.4 2021/01/24 14:37:32 tkusumi Exp $	*/
 
 /*
  * Copyright (c) 2017 Conrad Meyer 
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: exfat.c,v 1.3 2020/02/08 12:56:56 fox Exp $");
+__RCSID("$NetBSD: exfat.c,v 1.4 2021/01/24 14:37:32 tkusumi Exp $");
 
 #include 
 #include 
@@ -327,15 +327,15 @@ fstyp_exfat(FILE *fp, char *label, size_
 	uint32_t chksum;
 	int error;
 
+	error = 1;
 	cksect = NULL;
-
 	ev = (struct exfat_vbr *)read_buf(fp, 0, 512);
 	if (ev == NULL || strncmp(ev->ev_fsname, "EXFAT   ", 8) != 0)
-		goto fail;
+		goto out;
 
 	if (ev->ev_log_bytes_per_sect < 9 || ev->ev_log_bytes_per_sect > 12) {
 		warnx("exfat: Invalid BytesPerSectorShift");
-		goto done;
+		goto out;
 	}
 
 	bytespersec = (1u << ev->ev_log_bytes_per_sect);
@@ -343,7 +343,7 @@ fstyp_exfat(FILE *fp, char *label, size_
 	error = exfat_compute_boot_chksum(fp, MAIN_BOOT_REGION_SECT,
 	bytespersec, );
 	if (error != 0)
-		goto done;
+		goto out;
 
 	cksect = read_sect(fp, MAIN_BOOT_REGION_SECT + SUBREGION_CHKSUM_SECT,
 	bytespersec);
@@ -355,18 +355,15 @@ fstyp_exfat(FILE *fp, char *label, size_
 	if (chksum != le32toh(cksect[0])) {
 		warnx("exfat: Found checksum 0x%08x != computed 0x%08x",
 		le32toh(cksect[0]), chksum);
-		goto done;
+		error = 1;
+		goto out;
 	}
 
 	if (show_label)
 		exfat_find_label(fp, ev, bytespersec, label, size);
 
-done:
+out:
 	free(cksect);
 	free(ev);
-	return (0);
-
-fail:
-	free(ev);
-	return (1);
+	return (error != 0);
 }



CVS commit: src/usr.sbin/acpitools/acpidump

2021-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jan 20 15:27:51 UTC 2021

Modified Files:
src/usr.sbin/acpitools/acpidump: acpi.c

Log Message:
Consistently use ACPI_SIG_SSDT


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/acpitools/acpidump/acpi.c

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

Modified files:

Index: src/usr.sbin/acpitools/acpidump/acpi.c
diff -u src/usr.sbin/acpitools/acpidump/acpi.c:1.49 src/usr.sbin/acpitools/acpidump/acpi.c:1.50
--- src/usr.sbin/acpitools/acpidump/acpi.c:1.49	Mon Dec 14 10:18:28 2020
+++ src/usr.sbin/acpitools/acpidump/acpi.c	Wed Jan 20 15:27:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.49 2020/12/14 10:18:28 jmcneill Exp $ */
+/* $NetBSD: acpi.c,v 1.50 2021/01/20 15:27:51 skrll Exp $ */
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: acpi.c,v 1.49 2020/12/14 10:18:28 jmcneill Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.50 2021/01/20 15:27:51 skrll Exp $");
 
 #include 
 #include 
@@ -4625,11 +4625,11 @@ write_dsdt(int fd, ACPI_TABLE_HEADER *rs
 
 	/* Write out any SSDTs (if present.) */
 	if (rsdt != NULL) {
-		ssdt = sdt_from_rsdt(rsdt, "SSDT", NULL);
+		ssdt = sdt_from_rsdt(rsdt, ACPI_SIG_SSDT, NULL);
 		while (ssdt != NULL) {
 			write(fd, ssdt + 1, ssdt->Length -
 			sizeof(ACPI_TABLE_HEADER));
-			ssdt = sdt_from_rsdt(rsdt, "SSDT", ssdt);
+			ssdt = sdt_from_rsdt(rsdt, ACPI_SIG_SSDT, ssdt);
 		}
 	}
 	return (0);



CVS commit: src/usr.sbin/cpuctl/arch

2021-01-16 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 16 15:35:28 UTC 2021

Modified Files:
src/usr.sbin/cpuctl/arch: arm.c

Log Message:
trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/cpuctl/arch/arm.c

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/arm.c
diff -u src/usr.sbin/cpuctl/arch/arm.c:1.3 src/usr.sbin/cpuctl/arch/arm.c:1.4
--- src/usr.sbin/cpuctl/arch/arm.c:1.3	Sun Feb  3 10:48:47 2019
+++ src/usr.sbin/cpuctl/arch/arm.c	Sat Jan 16 15:35:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm.c,v 1.3 2019/02/03 10:48:47 mrg Exp $	*/
+/*	$NetBSD: arm.c,v 1.4 2021/01/16 15:35:28 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: arm.c,v 1.3 2019/02/03 10:48:47 mrg Exp $");
+__RCSID("$NetBSD: arm.c,v 1.4 2021/01/16 15:35:28 jmcneill Exp $");
 #endif /* not lint */
 
 #include 
@@ -81,32 +81,32 @@ static const char * const id_mmfr_fieldn
 		"FCSE-Support",
 		"Innermost-Shareability"
 	}, {
-		"L1-Harvard-Cache-VA", 
-		"L1-Unified-Cache-VA", 
-		"L1-Harvard-Cache-Set/Way", 
-		"L1-Unified-Cache-Set/Way", 
-		"L1-Harvard-Cache", 
-		"L1-Unified-Cache", 
-		"L1-Cache-Test-and-Clean", 
-		"Branch-Predictor", 
+		"L1-Harvard-Cache-VA",
+		"L1-Unified-Cache-VA",
+		"L1-Harvard-Cache-Set/Way",
+		"L1-Unified-Cache-Set/Way",
+		"L1-Harvard-Cache",
+		"L1-Unified-Cache",
+		"L1-Cache-Test-and-Clean",
+		"Branch-Predictor",
 	}, {
-		"L1-Harvard-Foreground-Fetch", 
-		"L1-Unified-Background-Fetch", 
-		"L1-Harvard-Range", 
+		"L1-Harvard-Foreground-Fetch",
+		"L1-Unified-Background-Fetch",
+		"L1-Harvard-Range",
 		"Harvard-TLB",
-		"Unified-TLB", 
-		"Mem-Barrier", 
-		"WFI-Stall", 
-		"HW-Access", 
+		"Unified-TLB",
+		"Mem-Barrier",
+		"WFI-Stall",
+		"HW-Access",
 	}, {
-		"Cache-Maintenance-MVA", 
-		"Cache-Maintenance-Set/Way", 
-		"BP-Maintenance", 
+		"Cache-Maintenance-MVA",
+		"Cache-Maintenance-Set/Way",
+		"BP-Maintenance",
 		"Maintenance-Broadcast",
 		NULL,
-		"Coherent-Tablewalk", 
-		"Cached-Memory-Size", 
-		"Supersection-Support", 
+		"Coherent-Tablewalk",
+		"Cached-Memory-Size",
+		"Supersection-Support",
 	},
 };
 
@@ -194,7 +194,7 @@ print_features(const char *cpuname, cons
 "=%u", isar & 0x0f);
 			}
 			size_t tmplen = snprintf(tmpbuf, sizeof(tmpbuf),
-			 "%s%s%s", sep, name, value);   
+			 "%s%s%s", sep, name, value);
 			if (len + tmplen > 78) {
 printf("%s\n", buf);
 len = snprintf(buf, sizeof(buf),



CVS commit: src/usr.sbin/cpuctl/arch

2021-01-16 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 16 15:34:37 UTC 2021

Modified Files:
src/usr.sbin/cpuctl/arch: aarch64.c

Log Message:
ID_AA64PFR0_EL1.GIC=0 means that the CPU interface system registers are
not implemented. This does not necessarily mean that there is no GIC in the
system, as GICv2 uses MMIO instead of system registers for the CPU
interface.

While here, add description for GIC=3, which means that the v4.1 system
register interface is supported.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/cpuctl/arch/aarch64.c

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/aarch64.c
diff -u src/usr.sbin/cpuctl/arch/aarch64.c:1.13 src/usr.sbin/cpuctl/arch/aarch64.c:1.14
--- src/usr.sbin/cpuctl/arch/aarch64.c:1.13	Mon Jan  4 05:35:14 2021
+++ src/usr.sbin/cpuctl/arch/aarch64.c	Sat Jan 16 15:34:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarch64.c,v 1.13 2021/01/04 05:35:14 ryo Exp $	*/
+/*	$NetBSD: aarch64.c,v 1.14 2021/01/16 15:34:37 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -29,7 +29,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: aarch64.c,v 1.13 2021/01/04 05:35:14 ryo Exp $");
+__RCSID("$NetBSD: aarch64.c,v 1.14 2021/01/16 15:34:37 jmcneill Exp $");
 #endif /* no lint */
 
 #include 
@@ -164,8 +164,9 @@ struct fieldinfo id_aa64pfr0_fieldinfo[]
 	{
 		.bitpos = 24, .bitwidth = 4, .name = "GIC",
 		.info = (const char *[16]) { /* 16=4bit */
-			[0] = "No GIC",
-			[1] = "GICv3"
+			[0] = "GIC CPU interface sysregs not implemented",
+			[1] = "GIC CPU interface sysregs v3.0/4.0 supported",
+			[3] = "GIC CPU interface sysregs v4.1 supported"
 		}
 	},
 	{ .bitwidth = 0 }	/* end of table */



CVS commit: src/usr.sbin/fstyp

2021-01-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 10 13:44:57 UTC 2021

Modified Files:
src/usr.sbin/fstyp: hammer2.c

Log Message:
Explicitly cast offset calculation, size_t may be smaller than off_t.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/fstyp/hammer2.c

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

Modified files:

Index: src/usr.sbin/fstyp/hammer2.c
diff -u src/usr.sbin/fstyp/hammer2.c:1.7 src/usr.sbin/fstyp/hammer2.c:1.8
--- src/usr.sbin/fstyp/hammer2.c:1.7	Sun Jan 10 12:38:40 2021
+++ src/usr.sbin/fstyp/hammer2.c	Sun Jan 10 13:44:57 2021
@@ -1,4 +1,4 @@
-/*$NetBSD: hammer2.c,v 1.7 2021/01/10 12:38:40 tkusumi Exp $  */
+/*$NetBSD: hammer2.c,v 1.8 2021/01/10 13:44:57 martin Exp $  */
 
 /*-
  * Copyright (c) 2017-2019 The DragonFly Project
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hammer2.c,v 1.7 2021/01/10 12:38:40 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hammer2.c,v 1.8 2021/01/10 13:44:57 martin Exp $");
 
 #include 
 #include 
@@ -145,7 +145,7 @@ read_media(FILE *fp, const hammer2_block
 
 	io_off = bref->data_off & ~HAMMER2_OFF_MASK_RADIX;
 	io_base = io_off & ~(hammer2_off_t)(HAMMER2_LBUFSIZE - 1);
-	boff = io_off - io_base;
+	boff = (size_t)((hammer2_off_t)io_off - io_base);
 
 	io_bytes = HAMMER2_LBUFSIZE;
 	while (io_bytes + boff < bytes)



CVS commit: src/usr.sbin/fstyp

2021-01-10 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Jan 10 12:38:41 UTC 2021

Modified Files:
src/usr.sbin/fstyp: fstyp.h hammer.c hammer2.c hammer2_disk.h

Log Message:
fstyp: Sync HAMMER1/2 with DragonFly BSD

taken-from: DragonFly BSD


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/fstyp/fstyp.h
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/fstyp/hammer.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/fstyp/hammer2.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/fstyp/hammer2_disk.h

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/fstyp/fstyp.h
diff -u src/usr.sbin/fstyp/fstyp.h:1.8 src/usr.sbin/fstyp/fstyp.h:1.9
--- src/usr.sbin/fstyp/fstyp.h:1.8	Wed Jan  1 09:08:52 2020
+++ src/usr.sbin/fstyp/fstyp.h	Sun Jan 10 12:38:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstyp.h,v 1.8 2020/01/01 09:08:52 tkusumi Exp $	*/
+/*	$NetBSD: fstyp.h,v 1.9 2021/01/10 12:38:40 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -74,5 +74,7 @@ int	fstyp_zfs(FILE *, char *, size_t);
 
 int	fsvtyp_hammer(const char *, char *, size_t);
 int	fsvtyp_hammer_partial(const char *, char *, size_t);
+int	fsvtyp_hammer2(const char *, char *, size_t);
+int	fsvtyp_hammer2_partial(const char *, char *, size_t);
 
 #endif /* !FSTYP_H */

Index: src/usr.sbin/fstyp/hammer.c
diff -u src/usr.sbin/fstyp/hammer.c:1.3 src/usr.sbin/fstyp/hammer.c:1.4
--- src/usr.sbin/fstyp/hammer.c:1.3	Wed Jan 15 15:30:46 2020
+++ src/usr.sbin/fstyp/hammer.c	Sun Jan 10 12:38:40 2021
@@ -1,4 +1,4 @@
-/*$NetBSD: hammer.c,v 1.3 2020/01/15 15:30:46 tkusumi Exp $  */
+/*$NetBSD: hammer.c,v 1.4 2021/01/10 12:38:40 tkusumi Exp $  */
 
 /*-
  * Copyright (c) 2016-2019 The DragonFly Project
@@ -27,13 +27,13 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hammer.c,v 1.3 2020/01/15 15:30:46 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hammer.c,v 1.4 2021/01/10 12:38:40 tkusumi Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "fstyp.h"
 #include "hammer_disk.h"
@@ -41,13 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: hammer.c,v 1
 static hammer_volume_ondisk_t
 read_ondisk(FILE *fp)
 {
-	hammer_volume_ondisk_t ondisk;
-
-	ondisk = read_buf(fp, 0, sizeof(*ondisk));
-	if (ondisk == NULL)
-		err(1, "failed to read ondisk");
-
-	return (ondisk);
+	return (read_buf(fp, 0, sizeof(struct hammer_volume_ondisk)));
 }
 
 static int
@@ -61,32 +55,49 @@ test_ondisk(const hammer_volume_ondisk_t
 	ondisk->vol_signature != HAMMER_FSBUF_VOLUME_REV)
 		return (1);
 	if (ondisk->vol_rootvol != HAMMER_ROOT_VOLNO)
-		return (2);
+		return (1);
 	if (ondisk->vol_no < 0 || ondisk->vol_no > HAMMER_MAX_VOLUMES - 1)
-		return (3);
+		return (1);
 	if (ondisk->vol_count < 1 || ondisk->vol_count > HAMMER_MAX_VOLUMES)
-		return (4);
+		return (1);
 
 	if (count == 0) {
 		count = ondisk->vol_count;
-		assert(count != 0);
+		if (count == 0)
+			return (1);
 		memcpy(, >vol_fsid, sizeof(fsid));
 		memcpy(, >vol_fstype, sizeof(fstype));
 		strlcpy(label, ondisk->vol_label, sizeof(label));
 	} else {
 		if (ondisk->vol_count != count)
-			return (5);
-		if (memcmp(>vol_fsid, , sizeof(fsid)))
-			return (6);
-		if (memcmp(>vol_fstype, , sizeof(fstype)))
-			return (7);
+			return (1);
+		if (!uuid_equal(>vol_fsid, , NULL))
+			return (1);
+		if (!uuid_equal(>vol_fstype, , NULL))
+			return (1);
 		if (strcmp(ondisk->vol_label, label))
-			return (8);
+			return (1);
 	}
 
 	return (0);
 }
 
+static const char*
+extract_device_name(const char *devpath)
+{
+	const char *p;
+
+	p = strrchr(devpath, '/');
+	if (p) {
+		p++;
+		if (*p == 0)
+			p = NULL;
+	} else {
+		p = devpath;
+	}
+	return (p);
+}
+
 int
 fstyp_hammer(FILE *fp, char *label, size_t size)
 {
@@ -96,6 +107,8 @@ fstyp_hammer(FILE *fp, char *label, size
 	const char *p;
 #endif
 	ondisk = read_ondisk(fp);
+	if (!ondisk)
+		goto fail;
 	if (ondisk->vol_no != HAMMER_ROOT_VOLNO)
 		goto fail;
 	if (ondisk->vol_count != 1)
@@ -109,15 +122,11 @@ fstyp_hammer(FILE *fp, char *label, size
 	 */
 #ifdef HAS_DEVPATH
 	/* Add device name to help support multiple autofs -media mounts. */
-	p = strrchr(devpath, '/');
-	if (p) {
-		p++;
-		if (*p == 0)
-			strlcpy(label, ondisk->vol_label, size);
-		else
-			snprintf(label, size, "%s_%s", ondisk->vol_label, p);
-	} else
-		snprintf(label, size, "%s_%s", ondisk->vol_label, devpath);
+	p = extract_device_name(devpath);
+	if (p)
+		snprintf(label, size, "%s_%s", ondisk->vol_label, p);
+	else
+		strlcpy(label, ondisk->vol_label, size);
 #else
 	strlcpy(label, ondisk->vol_label, size);
 #endif
@@ -130,20 +139,23 @@ fail:
 static int
 test_volume(const char *volpath)
 {
-	hammer_volume_ondisk_t ondisk;
+	hammer_volume_ondisk_t ondisk = NULL;
 	FILE *fp;
 	int volno = -1;
 
 	if ((fp = fopen(volpath, "r")) == NULL)
-		err(1, "failed to open %s", volpath);
+		goto fail;
 
 	ondisk = read_ondisk(fp);
-	

CVS commit: src/usr.sbin/vnconfig

2021-01-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Jan  9 23:54:26 UTC 2021

Modified Files:
src/usr.sbin/vnconfig: vnconfig.8

Log Message:
Add magic incantation to configure an image for mount_udf(8).


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/vnconfig/vnconfig.8

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/vnconfig/vnconfig.8
diff -u src/usr.sbin/vnconfig/vnconfig.8:1.45 src/usr.sbin/vnconfig/vnconfig.8:1.46
--- src/usr.sbin/vnconfig/vnconfig.8:1.45	Sun Oct  7 20:30:50 2018
+++ src/usr.sbin/vnconfig/vnconfig.8	Sat Jan  9 23:54:26 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: vnconfig.8,v 1.45 2018/10/07 20:30:50 wiz Exp $
+.\"	$NetBSD: vnconfig.8,v 1.46 2021/01/09 23:54:26 wiz Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -61,7 +61,7 @@
 .\"
 .\"	@(#)vnconfig.8	8.1 (Berkeley) 6/5/93
 .\"
-.Dd November 6, 2015
+.Dd January 10, 2021
 .Dt VNDCONFIG 8
 .Os
 .Sh NAME
@@ -240,6 +240,13 @@ Configures the vnode disk
 emulating the geometry of 512 bytes per sector, 18 sectors per track,
 2 tracks per cylinder, and 80 cylinders total.
 .Pp
+.Dl vndconfig vnd0 /tmp/image.udf 2048/1/1/0
+.Pp
+Configures the vnode disk
+.Pa vnd0
+for an UDF image to be used with
+.Xr mount_udf 8 .
+.Pp
 .Dl vndconfig -t floppy vnd0 /tmp/floppy.img
 .Pp
 Configures the vnode disk



CVS commit: src/usr.sbin/cpuctl/arch

2021-01-03 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Jan  4 05:35:15 UTC 2021

Modified Files:
src/usr.sbin/cpuctl/arch: aarch64.c

Log Message:
sync cpuids[] of sys/arch/aarch64/aarch64/cpu.c r1.43


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/cpuctl/arch/aarch64.c

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/aarch64.c
diff -u src/usr.sbin/cpuctl/arch/aarch64.c:1.12 src/usr.sbin/cpuctl/arch/aarch64.c:1.13
--- src/usr.sbin/cpuctl/arch/aarch64.c:1.12	Sat Oct 10 08:27:41 2020
+++ src/usr.sbin/cpuctl/arch/aarch64.c	Mon Jan  4 05:35:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarch64.c,v 1.12 2020/10/10 08:27:41 jmcneill Exp $	*/
+/*	$NetBSD: aarch64.c,v 1.13 2021/01/04 05:35:14 ryo Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -29,7 +29,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: aarch64.c,v 1.12 2020/10/10 08:27:41 jmcneill Exp $");
+__RCSID("$NetBSD: aarch64.c,v 1.13 2021/01/04 05:35:14 ryo Exp $");
 #endif /* no lint */
 
 #include 
@@ -72,17 +72,25 @@ struct fieldinfo {
 
 #define CPU_PARTMASK	(CPU_ID_IMPLEMENTOR_MASK | CPU_ID_PARTNO_MASK)
 const struct cpuidtab cpuids[] = {
-	{ CPU_ID_CORTEXA53R0 & CPU_PARTMASK, "Cortex-A53", "Cortex", "V8-A" },
-	{ CPU_ID_CORTEXA57R0 & CPU_PARTMASK, "Cortex-A57", "Cortex", "V8-A" },
-	{ CPU_ID_CORTEXA72R0 & CPU_PARTMASK, "Cortex-A72", "Cortex", "V8-A" },
-	{ CPU_ID_CORTEXA73R0 & CPU_PARTMASK, "Cortex-A73", "Cortex", "V8-A" },
-	{ CPU_ID_CORTEXA55R1 & CPU_PARTMASK, "Cortex-A55", "Cortex", "V8.2-A" },
-	{ CPU_ID_CORTEXA75R2 & CPU_PARTMASK, "Cortex-A75", "Cortex", "V8.2-A" },
-	{ CPU_ID_CORTEXA76R3 & CPU_PARTMASK, "Cortex-A76", "Cortex", "V8.2-A" },
-	{ CPU_ID_THUNDERXRX, "Cavium ThunderX", "Cavium", "V8-A" },
-	{ CPU_ID_THUNDERX81XXRX, "Cavium ThunderX CN81XX", "Cavium", "V8-A" },
-	{ CPU_ID_THUNDERX83XXRX, "Cavium ThunderX CN83XX", "Cavium", "V8-A" },
-	{ CPU_ID_THUNDERX2RX, "Cavium ThunderX2", "Cavium", "V8.1-A" },
+	{ CPU_ID_CORTEXA35R0 & CPU_PARTMASK, "Cortex-A35", "Arm", "v8-A" },
+	{ CPU_ID_CORTEXA53R0 & CPU_PARTMASK, "Cortex-A53", "Arm", "v8-A" },
+	{ CPU_ID_CORTEXA57R0 & CPU_PARTMASK, "Cortex-A57", "Arm", "v8-A" },
+	{ CPU_ID_CORTEXA55R1 & CPU_PARTMASK, "Cortex-A55", "Arm", "v8.2-A+" },
+	{ CPU_ID_CORTEXA65R0 & CPU_PARTMASK, "Cortex-A65", "Arm", "v8.2-A+" },
+	{ CPU_ID_CORTEXA72R0 & CPU_PARTMASK, "Cortex-A72", "Arm", "v8-A" },
+	{ CPU_ID_CORTEXA73R0 & CPU_PARTMASK, "Cortex-A73", "Arm", "v8-A" },
+	{ CPU_ID_CORTEXA75R2 & CPU_PARTMASK, "Cortex-A75", "Arm", "v8.2-A+" },
+	{ CPU_ID_CORTEXA76R3 & CPU_PARTMASK, "Cortex-A76", "Arm", "v8.2-A+" },
+	{ CPU_ID_CORTEXA76AER1 & CPU_PARTMASK, "Cortex-A76AE", "Arm", "v8.2-A+" },
+	{ CPU_ID_CORTEXA77R0 & CPU_PARTMASK, "Cortex-A77", "Arm", "v8.2-A+" },
+	{ CPU_ID_NVIDIADENVER2 & CPU_PARTMASK, "Denver2", "NVIDIA", "v8-A" },
+	{ CPU_ID_EMAG8180 & CPU_PARTMASK, "eMAG", "Ampere", "v8-A" },
+	{ CPU_ID_NEOVERSEE1R1 & CPU_PARTMASK, "Neoverse E1", "Arm", "v8.2-A+" },
+	{ CPU_ID_NEOVERSEN1R3 & CPU_PARTMASK, "Neoverse N1", "Arm", "v8.2-A+" },
+	{ CPU_ID_THUNDERXRX, "ThunderX", "Cavium", "v8-A" },
+	{ CPU_ID_THUNDERX81XXRX, "ThunderX CN81XX", "Cavium", "v8-A" },
+	{ CPU_ID_THUNDERX83XXRX, "ThunderX CN83XX", "Cavium", "v8-A" },
+	{ CPU_ID_THUNDERX2RX, "ThunderX2", "Marvell", "v8.1-A" },
 };
 
 const struct impltab implids[] = {



CVS commit: src/usr.sbin/npf

2020-12-16 Thread Takahiro Kambe
Module Name:src
Committed By:   taca
Date:   Thu Dec 17 05:33:06 UTC 2020

Modified Files:
src/usr.sbin/npf: npf-params.7

Log Message:
Change second gc.interval_min to gc.interval_max.

Obviously, second gc.interval_min should be gc.interval_max.

Should be pulled up to netbnsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/npf/npf-params.7

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/npf/npf-params.7
diff -u src/usr.sbin/npf/npf-params.7:1.7 src/usr.sbin/npf/npf-params.7:1.8
--- src/usr.sbin/npf/npf-params.7:1.7	Sat Jun  6 20:38:00 2020
+++ src/usr.sbin/npf/npf-params.7	Thu Dec 17 05:33:06 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: npf-params.7,v 1.7 2020/06/06 20:38:00 wiz Exp $
+.\" $NetBSD: npf-params.7,v 1.8 2020/12/17 05:33:06 taca Exp $
 .\"
 .\" Copyright (c) 2019 Mindaugas Rasiukevicius 
 .\" All rights reserved.
@@ -83,7 +83,7 @@ The worker is self-tuning and will wake 
 connections to expire; it will wake up less frequently, diverging towards
 the upper bound, if it does not encounter expired connections.
 Default: 50 (in milliseconds).
-.It Li gc.interval_min
+.It Li gc.interval_max
 The upper bound for the sleep time of the G/C worker.
 Default: 5000 (in milliseconds).
 .El



CVS commit: src/usr.sbin/acpitools/acpidump

2020-12-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 14 10:18:28 UTC 2020

Modified Files:
src/usr.sbin/acpitools/acpidump: acpi.c

Log Message:
MAsk -> Mask, spotted by rillig@


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/acpitools/acpidump/acpi.c

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

Modified files:

Index: src/usr.sbin/acpitools/acpidump/acpi.c
diff -u src/usr.sbin/acpitools/acpidump/acpi.c:1.48 src/usr.sbin/acpitools/acpidump/acpi.c:1.49
--- src/usr.sbin/acpitools/acpidump/acpi.c:1.48	Sat Dec 12 16:08:39 2020
+++ src/usr.sbin/acpitools/acpidump/acpi.c	Mon Dec 14 10:18:28 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.48 2020/12/12 16:08:39 jmcneill Exp $ */
+/* $NetBSD: acpi.c,v 1.49 2020/12/14 10:18:28 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: acpi.c,v 1.48 2020/12/12 16:08:39 jmcneill Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.49 2020/12/14 10:18:28 jmcneill Exp $");
 
 #include 
 #include 
@@ -2648,7 +2648,7 @@ acpi_print_pcct_ext_pcc_master(ACPI_PCCT
 	acpi_print_gas(>CmdUpdateRegister);
 	printf("\n");
 	printf("\tCommand Update Preserve Mask=0x%016jx\n", subspace->CmdUpdatePreserveMask);
-	printf("\tCommand Update Set MAsk=0x%016jx\n", subspace->CmdUpdateSetMask);
+	printf("\tCommand Update Set Mask=0x%016jx\n", subspace->CmdUpdateSetMask);
 	printf("\tError Status Register=");
 	acpi_print_gas(>ErrorStatusRegister);
 	printf("\n");
@@ -2694,7 +2694,7 @@ acpi_print_pcct_ext_pcc_slave(ACPI_PCCT_
 	acpi_print_gas(>CmdUpdateRegister);
 	printf("\n");
 	printf("\tCommand Update Preserve Mask=0x%016jx\n", subspace->CmdUpdatePreserveMask);
-	printf("\tCommand Update Set MAsk=0x%016jx\n", subspace->CmdUpdateSetMask);
+	printf("\tCommand Update Set Mask=0x%016jx\n", subspace->CmdUpdateSetMask);
 	printf("\tError Status Register=");
 	acpi_print_gas(>ErrorStatusRegister);
 	printf("\n");



CVS commit: src/usr.sbin/acpitools/acpidump

2020-12-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Dec 12 16:08:39 UTC 2020

Modified Files:
src/usr.sbin/acpitools/acpidump: acpi.c

Log Message:
Add support for decoding Platform Communications Channel Tables ("PCCT").


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/acpitools/acpidump/acpi.c

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

Modified files:

Index: src/usr.sbin/acpitools/acpidump/acpi.c
diff -u src/usr.sbin/acpitools/acpidump/acpi.c:1.47 src/usr.sbin/acpitools/acpidump/acpi.c:1.48
--- src/usr.sbin/acpitools/acpidump/acpi.c:1.47	Sun Dec  6 18:38:58 2020
+++ src/usr.sbin/acpitools/acpidump/acpi.c	Sat Dec 12 16:08:39 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.47 2020/12/06 18:38:58 jmcneill Exp $ */
+/* $NetBSD: acpi.c,v 1.48 2020/12/12 16:08:39 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: acpi.c,v 1.47 2020/12/06 18:38:58 jmcneill Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.48 2020/12/12 16:08:39 jmcneill Exp $");
 
 #include 
 #include 
@@ -103,6 +103,7 @@ static void	acpi_handle_msct(ACPI_TABLE_
 static void	acpi_handle_ecdt(ACPI_TABLE_HEADER *sdp);
 static void	acpi_handle_hpet(ACPI_TABLE_HEADER *sdp);
 static void	acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp);
+static void	acpi_handle_pcct(ACPI_TABLE_HEADER *sdp);
 static void	acpi_handle_pptt(ACPI_TABLE_HEADER *sdp);
 static void	acpi_handle_sbst(ACPI_TABLE_HEADER *sdp);
 static void	acpi_handle_slit(ACPI_TABLE_HEADER *sdp);
@@ -2532,6 +2533,222 @@ acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp)
 }
 
 static void
+acpi_print_pcct_subspace(ACPI_PCCT_SUBSPACE *subspace)
+{
+	printf("\tType=Generic Subspace\n");
+	printf("\tBase Address=0x%016jx\n", subspace->BaseAddress);
+	printf("\tLength=%jd\n", subspace->Length);
+	printf("\tDoorbell Address=");
+	acpi_print_gas(>DoorbellRegister);
+	printf("\n");
+	printf("\tDoorbell Preserve=0x%016jx\n", subspace->PreserveMask);
+	printf("\tDoorbell Write=0x%016jx\n", subspace->WriteMask);
+	printf("\tLatency=%u us\n", subspace->Latency);
+	printf("\tMax Access Rate=%u\n", subspace->MaxAccessRate);
+	printf("\tMin Turnaround Time=%u us\n", subspace->MinTurnaroundTime);
+}
+
+static void
+acpi_print_pcct_hw_reduced(ACPI_PCCT_HW_REDUCED *subspace)
+{
+	printf("\tType=HW-reduced Subspace\n");
+	printf("\tPlatform Interrupt=%u", subspace->PlatformInterrupt);
+	if (subspace->Flags & ACPI_PCCT_INTERRUPT_POLARITY) {
+		printf(", Edge triggered");
+	} else {
+		printf(", Level triggered");
+	}
+	if (subspace->Flags & ACPI_PCCT_INTERRUPT_MODE) {
+		printf(", Active low");
+	} else {
+		printf(", Active high");
+	}
+	printf("\n");
+	printf("\tBase Address=0x%016jx\n", subspace->BaseAddress);
+	printf("\tLength=%jd\n", subspace->Length);
+	printf("\tDoorbell Register=");
+	acpi_print_gas(>DoorbellRegister);
+	printf("\n");
+	printf("\tDoorbell Preserve=0x%016jx\n", subspace->PreserveMask);
+	printf("\tDoorbell Write=0x%016jx\n", subspace->WriteMask);
+	printf("\tLatency=%u us\n", subspace->Latency);
+	printf("\tMax Access Rate=%u\n", subspace->MaxAccessRate);
+	printf("\tMin Turnaround Time=%u us\n", subspace->MinTurnaroundTime);
+}
+
+static void
+acpi_print_pcct_hw_reduced_type2(ACPI_PCCT_HW_REDUCED_TYPE2 *subspace)
+{
+	printf("\tType=HW-reduced Subspace Type 2\n");
+	printf("\tPlatform Interrupt=%u", subspace->PlatformInterrupt);
+	if (subspace->Flags & ACPI_PCCT_INTERRUPT_POLARITY) {
+		printf(", Edge triggered");
+	} else {
+		printf(", Level triggered");
+	}
+	if (subspace->Flags & ACPI_PCCT_INTERRUPT_MODE) {
+		printf(", Active low");
+	} else {
+		printf(", Active high");
+	}
+	printf("\n");
+	printf("\tBase Address=0x%016jx\n", subspace->BaseAddress);
+	printf("\tLength=%jd\n", subspace->Length);
+	printf("\tDoorbell Register=");
+	acpi_print_gas(>DoorbellRegister);
+	printf("\n");
+	printf("\tDoorbell Preserve=0x%016jx\n", subspace->PreserveMask);
+	printf("\tDoorbell Write=0x%016jx\n", subspace->WriteMask);
+	printf("\tLatency=%u us\n", subspace->Latency);
+	printf("\tMax Access Rate=%u\n", subspace->MaxAccessRate);
+	printf("\tMin Turnaround Time=%u us\n", subspace->MinTurnaroundTime);
+	printf("\tPlatform Interrupt Ack Register=");
+	acpi_print_gas(>PlatformAckRegister);
+	printf("\n");
+	printf("\tPlatform Interrupt Ack Preserve=0x%016jx\n", subspace->AckPreserveMask);
+	printf("\tPlatform Interrupt Ack Write=0x%016jx\n", subspace->AckWriteMask);
+}
+
+static void
+acpi_print_pcct_ext_pcc_master(ACPI_PCCT_EXT_PCC_MASTER *subspace)
+{
+	printf("\tType=Extended PCC Master Subspace\n");
+	printf("\tPlatform Interrupt=%u", subspace->PlatformInterrupt);
+	if (subspace->Flags & ACPI_PCCT_INTERRUPT_POLARITY) {
+		printf(", Edge triggered");
+	} else {
+		printf(", Level triggered");
+	}
+	if (subspace->Flags & ACPI_PCCT_INTERRUPT_MODE) {
+		printf(", Active low");
+	} else {
+		printf(", Active high");
+	}
+	printf("\n");
+	

CVS commit: src/usr.sbin/acpitools/acpidump

2020-12-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Dec  6 18:38:58 UTC 2020

Modified Files:
src/usr.sbin/acpitools/acpidump: acpi.c

Log Message:
acpidump: Do not print FACS if HW_REDUCED flag is set.

According to ACPI 6.3 spec, FACS is optional when HW_REDUCED is set. ACPICA
ignores the FACS completely when HW_REDUCED is set, so we need to follow
suit since it is not available through /dev/acpi as the table is not
installed.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/acpitools/acpidump/acpi.c

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

Modified files:

Index: src/usr.sbin/acpitools/acpidump/acpi.c
diff -u src/usr.sbin/acpitools/acpidump/acpi.c:1.46 src/usr.sbin/acpitools/acpidump/acpi.c:1.47
--- src/usr.sbin/acpitools/acpidump/acpi.c:1.46	Sat Jun 22 12:39:40 2019
+++ src/usr.sbin/acpitools/acpidump/acpi.c	Sun Dec  6 18:38:58 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.46 2019/06/22 12:39:40 maxv Exp $ */
+/* $NetBSD: acpi.c,v 1.47 2020/12/06 18:38:58 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: acpi.c,v 1.46 2019/06/22 12:39:40 maxv Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.47 2020/12/06 18:38:58 jmcneill Exp $");
 
 #include 
 #include 
@@ -836,7 +836,7 @@ acpi_handle_fadt(ACPI_TABLE_HEADER *sdp)
 	if (acpi_select_address(fadt->Facs, fadt->XFacs) == 0) {
 		if ((fadt->Flags & ACPI_FADT_HW_REDUCED) == 0)
 			errx(EXIT_FAILURE, "Missing FACS and HW_REDUCED_ACPI flag not set in FADT");
-	} else {
+	} else if ((fadt->Flags & ACPI_FADT_HW_REDUCED) == 0) {
 		facs = (ACPI_TABLE_FACS *)acpi_map_sdt(
 			acpi_select_address(fadt->Facs, fadt->XFacs));
 		if (memcmp(facs->Signature, ACPI_SIG_FACS, 4) != 0 || facs->Length < 64)



  1   2   3   4   5   6   7   8   9   10   >