CVS commit: src/lib/libperfuse

2018-11-15 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Nov 16 02:39:02 UTC 2018

Modified Files:
src/lib/libperfuse: debug.c ops.c perfuse.c perfuse_priv.h

Log Message:
Use reclaim2 to fix reclaim/lookup race conditions

The PUFFS reclaim operation had a race condition with lookups: we could
be asked to lookup a node, then to reclaim it before lookup completion.
At lookup completion, we would then create a leaked node.

Enter the PUFFS reclaim2 operation, which features a nlookup argument.
That let us count how many lookups are pending and avoid the above
described scenario. It also makes the codes simplier.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libperfuse/debug.c
cvs rdiff -u -r1.84 -r1.85 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.40 -r1.41 src/lib/libperfuse/perfuse.c
cvs rdiff -u -r1.36 -r1.37 src/lib/libperfuse/perfuse_priv.h

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

Modified files:

Index: src/lib/libperfuse/debug.c
diff -u src/lib/libperfuse/debug.c:1.12 src/lib/libperfuse/debug.c:1.13
--- src/lib/libperfuse/debug.c:1.12	Sat Jul 21 05:49:42 2012
+++ src/lib/libperfuse/debug.c	Fri Nov 16 02:39:02 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: debug.c,v 1.12 2012/07/21 05:49:42 manu Exp $ */
+/*  $NetBSD: debug.c,v 1.13 2018/11/16 02:39:02 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -270,7 +270,6 @@ perfuse_trace_dump(struct puffs_usermoun
 	fprintf(fp, "\n\nGlobal statistics\n");
 	fprintf(fp, "Nodes: %d\n", ps->ps_nodecount);
 	fprintf(fp, "Exchanges: %d\n", ps->ps_xchgcount);
-	fprintf(fp, "Nodes possibly leaked: %d\n", ps->ps_nodeleakcount);
 	
 	(void)fflush(fp);
 	return;

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.84 src/lib/libperfuse/ops.c:1.85
--- src/lib/libperfuse/ops.c:1.84	Wed Jun  3 14:07:05 2015
+++ src/lib/libperfuse/ops.c	Fri Nov 16 02:39:02 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.84 2015/06/03 14:07:05 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.85 2018/11/16 02:39:02 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -500,11 +500,6 @@ node_lookup_common(struct puffs_usermoun
 		puffs_newinfo_setrdev(pni, pn->pn_va.va_rdev);
 	}
 
-	if (PERFUSE_NODE_DATA(pn)->pnd_flags & PND_NODELEAK) {
-		PERFUSE_NODE_DATA(pn)->pnd_flags &= ~PND_NODELEAK;
-		ps->ps_nodeleakcount--;
-	}
-
 	ps->ps_destroy_msg(pm);
 
 	return 0;
@@ -672,7 +667,7 @@ fuse_to_dirent(struct puffs_usermount *p
 	   "failed: %d", name, error);
 } else {
 	fd->ino = pn->pn_va.va_fileid;
-	(void)perfuse_node_reclaim(pu, pn);
+	(void)perfuse_node_reclaim2(pu, pn, 1);
 }
 			}
 		}
@@ -1135,7 +1130,7 @@ perfuse_node_lookup(struct puffs_usermou
 	case NAMEI_RENAME:
 		error = sticky_access(opc, pn, pcn->pcn_cred);
 		if (error != 0) {
-			(void)perfuse_node_reclaim(pu, pn);
+			(void)perfuse_node_reclaim2(pu, pn, 1);
 			goto out;
 		}
 		break;
@@ -1182,7 +1177,7 @@ perfuse_node_create(struct puffs_usermou
 		error = node_lookup_common(pu, opc, NULL, pcn->pcn_name,
 	   pcn->pcn_cred, );
 		if (error == 0)	{
-			(void)perfuse_node_reclaim(pu, pn);
+			(void)perfuse_node_reclaim2(pu, pn, 1);
 			error = EEXIST;
 			goto out;
 		}
@@ -2682,17 +2677,22 @@ out:
 }
 
 int 
-perfuse_node_reclaim(struct puffs_usermount *pu, puffs_cookie_t opc)
+perfuse_node_reclaim2(struct puffs_usermount *pu,
+		  puffs_cookie_t opc, int nlookup)
 {
 	struct perfuse_state *ps;
 	perfuse_msg_t *pm;
 	struct perfuse_node_data *pnd;
 	struct fuse_forget_in *ffi;
-	int nlookup;
-	struct timespec now;
 	
-	if (opc == 0)
+#ifdef PERFUSE_DEBUG
+		if (perfuse_diagflags & PDF_RECLAIM)
+			DPRINTF("%s called with opc = %p, nlookup = %d\n",
+__func__, (void *)opc, nlookup);
+#endif
+	if (opc == 0 || nlookup == 0) {
 		return 0;
+	}
 
 	ps = puffs_getspecific(pu);
 	pnd = PERFUSE_NODE_DATA(opc);
@@ -2703,43 +2703,23 @@ perfuse_node_reclaim(struct puffs_usermo
 	if (pnd->pnd_nodeid == FUSE_ROOT_ID)
 		return 0;
 
+#ifdef PERFUSE_DEBUG
+	if (perfuse_diagflags & PDF_RECLAIM)
+		DPRINTF("%s (nodeid %"PRId64") reclaimed, nlookup = %d/%d\n", 
+			perfuse_node_path(ps, opc), pnd->pnd_nodeid,
+			nlookup, pnd->pnd_puffs_nlookup);
+#endif
 	/*
-	 * There is a race condition between reclaim and lookup.
-	 * When looking up an already known node, the kernel cannot
-	 * hold a reference on the result until it gets the PUFFS
-	 * reply. It mayy therefore reclaim the node after the 
-	 * userland looked it up, and before it gets the reply. 
-	 * On rely, the kernel re-creates the node, but at that 
-	 * time the node has been reclaimed in userland.
-	 *
-	 * In order to avoid this, we refuse reclaiming nodes that
-	 * are too young since the last lookup - and that we do 
-	 * not have removed on our own, of course. 
-	 */
-	if (clock_gettime(CLOCK_REALTIME, ) != 0)
-		DERR(EX_OSERR, "clock_gettime failed"); 
-
-	if 

CVS commit: src/sys/dev/usb

2018-11-15 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Nov 16 00:34:51 UTC 2018

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

Log Message:
Build fix

>From David H. Gutteridge


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/dev/usb/usbdi.c

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

Modified files:

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.179 src/sys/dev/usb/usbdi.c:1.180
--- src/sys/dev/usb/usbdi.c:1.179	Thu Nov 15 02:35:23 2018
+++ src/sys/dev/usb/usbdi.c	Fri Nov 16 00:34:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.179 2018/11/15 02:35:23 manu Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.180 2018/11/16 00:34:50 manu Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.179 2018/11/15 02:35:23 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.180 2018/11/16 00:34:50 manu Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -924,7 +924,7 @@ usb_transfer_complete(struct usbd_xfer *
 	!usbd_xfer_isread(xfer)) {
 		USBHIST_LOG(usbdebug, "Possible output ack miss for xfer %#jx: "
 		"hiding write timeout to %d.%s for %d bytes written",
-		xfer, curlwp->l_proc->p_pid, curlwp->l_lid,
+		(uintptr_t)xfer, curlwp->l_proc->p_pid, curlwp->l_lid,
 		xfer->ux_length);
 
 		xfer->ux_status = USBD_NORMAL_COMPLETION;



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

2018-11-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 15 23:53:40 UTC 2018

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c

Log Message:
If the bootloader specifies a boot mac-address, use it to find the root device.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/evbarm/fdt/fdt_machdep.c

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

Modified files:

Index: src/sys/arch/evbarm/fdt/fdt_machdep.c
diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.54 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.55
--- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.54	Sat Nov  3 15:02:32 2018
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c	Thu Nov 15 23:53:40 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.54 2018/11/03 15:02:32 skrll Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.55 2018/11/15 23:53:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.54 2018/11/03 15:02:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.55 2018/11/15 23:53:40 jmcneill Exp $");
 
 #include "opt_machdep.h"
 #include "opt_bootconfig.h"
@@ -63,6 +63,10 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_machdep.
 #include 
 #include 
 #include 
+#include 
+
+#include 
+#include 
 
 #include 
 #include 
@@ -697,6 +701,23 @@ fdt_detect_root_device(device_t dev)
 		if (dv != NULL)
 			booted_device = dv;
 	}
+
+	if (of_hasprop(chosen, "netbsd,booted-mac-address")) {
+		const uint8_t *macaddr = fdtbus_get_prop(chosen, "netbsd,booted-mac-address", );
+		if (macaddr == NULL || len != 6)
+			return;
+		int s = pserialize_read_enter();
+		struct ifnet *ifp;
+		IFNET_READER_FOREACH(ifp) {
+			if (memcmp(macaddr, CLLADDR(ifp->if_sadl), len) == 0) {
+device_t dv = device_find_by_xname(ifp->if_xname);
+if (dv != NULL)
+	booted_device = dv;
+break;
+			}
+		}
+		pserialize_read_exit(s);
+	}
 }
 
 static void



CVS commit: src/sys/stand/efiboot

2018-11-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 15 23:52:33 UTC 2018

Modified Files:
src/sys/stand/efiboot: boot.c conf.c dev_net.c devopen.c efiboot.h
efifdt.c efinet.c efipxe.c version

Log Message:
Add support for loading kernels over NFS.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/stand/efiboot/boot.c \
src/sys/stand/efiboot/efifdt.c
cvs rdiff -u -r1.3 -r1.4 src/sys/stand/efiboot/conf.c \
src/sys/stand/efiboot/devopen.c src/sys/stand/efiboot/efinet.c
cvs rdiff -u -r1.1 -r1.2 src/sys/stand/efiboot/dev_net.c \
src/sys/stand/efiboot/efipxe.c
cvs rdiff -u -r1.8 -r1.9 src/sys/stand/efiboot/efiboot.h
cvs rdiff -u -r1.7 -r1.8 src/sys/stand/efiboot/version

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

Modified files:

Index: src/sys/stand/efiboot/boot.c
diff -u src/sys/stand/efiboot/boot.c:1.13 src/sys/stand/efiboot/boot.c:1.14
--- src/sys/stand/efiboot/boot.c:1.13	Fri Nov  2 01:22:39 2018
+++ src/sys/stand/efiboot/boot.c	Thu Nov 15 23:52:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.13 2018/11/02 01:22:39 jmcneill Exp $	*/
+/*	$NetBSD: boot.c,v 1.14 2018/11/15 23:52:33 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -72,7 +72,7 @@ static const char *efi_memory_type[] = {
 static char default_device[32];
 static char initrd_path[255];
 static char dtb_path[255];
-static char bootfile[255];
+static char netbsd_path[255];
 
 #define	DEFTIMEOUT	5
 #define DEFFILENAME	names[0]
@@ -146,7 +146,6 @@ command_dev(char *arg)
 	} else {
 		efi_block_show();
 		efi_net_show();
-		efi_pxe_show();
 	}
 
 	if (strlen(default_device) > 0) {
@@ -323,9 +322,9 @@ get_dtb_path(void)
 int
 set_bootfile(const char *arg)
 {
-	if (strlen(arg) + 1 > sizeof(bootfile))
+	if (strlen(arg) + 1 > sizeof(netbsd_path))
 		return ERANGE;
-	strcpy(bootfile, arg);
+	strcpy(netbsd_path, arg);
 	return 0;
 }
 
@@ -388,7 +387,7 @@ boot(void)
 	print_banner();
 	printf("Press return to boot now, any other key for boot prompt\n");
 
-	if (bootfile[0] != '\0')
+	if (netbsd_path[0] != '\0')
 		currname = -1;
 	else
 		currname = 0;
@@ -396,13 +395,13 @@ boot(void)
 	for (; currname < (int)NUMNAMES; currname++) {
 		if (currname >= 0)
 			set_bootfile(names[currname]);
-		printf("booting %s - starting in ", bootfile);
+		printf("booting %s - starting in ", netbsd_path);
 
 		c = awaitkey(DEFTIMEOUT, 1);
 		if (c != '\r' && c != '\n' && c != '\0')
 			bootprompt(); /* does not return */
 
-		exec_netbsd(bootfile, "");
+		exec_netbsd(netbsd_path, "");
 	}
 
 	bootprompt();	/* does not return */
Index: src/sys/stand/efiboot/efifdt.c
diff -u src/sys/stand/efiboot/efifdt.c:1.13 src/sys/stand/efiboot/efifdt.c:1.14
--- src/sys/stand/efiboot/efifdt.c:1.13	Fri Nov  2 01:22:39 2018
+++ src/sys/stand/efiboot/efifdt.c	Thu Nov 15 23:52:33 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: efifdt.c,v 1.13 2018/11/02 01:22:39 jmcneill Exp $ */
+/* $NetBSD: efifdt.c,v 1.14 2018/11/15 23:52:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -194,6 +194,7 @@ void
 efi_fdt_bootargs(const char *bootargs)
 {
 	struct efi_block_part *bpart = efi_block_boot_part();
+	uint8_t macaddr[6];
 	int chosen;
 
 	chosen = fdt_path_offset(fdt_data, FDT_CHOSEN_NODE_PATH);
@@ -229,6 +230,8 @@ efi_fdt_bootargs(const char *bootargs)
 		default:
 			break;
 		}
+	} else if (efi_net_get_booted_macaddr(macaddr) == 0) {
+		fdt_setprop(fdt_data, chosen, "netbsd,booted-mac-address", macaddr, sizeof(macaddr));
 	}
 }
 

Index: src/sys/stand/efiboot/conf.c
diff -u src/sys/stand/efiboot/conf.c:1.3 src/sys/stand/efiboot/conf.c:1.4
--- src/sys/stand/efiboot/conf.c:1.3	Mon Sep  3 00:04:02 2018
+++ src/sys/stand/efiboot/conf.c	Thu Nov 15 23:52:33 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.3 2018/09/03 00:04:02 jmcneill Exp $ */
+/* $NetBSD: conf.c,v 1.4 2018/11/15 23:52:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -59,3 +60,4 @@ int nfsys = __arraycount(file_system);
 
 struct fs_ops null_fs_ops = FS_OPS(null);
 struct fs_ops tftp_fs_ops = FS_OPS(tftp);
+struct fs_ops nfs_fs_ops = FS_OPS(nfs);
Index: src/sys/stand/efiboot/devopen.c
diff -u src/sys/stand/efiboot/devopen.c:1.3 src/sys/stand/efiboot/devopen.c:1.4
--- src/sys/stand/efiboot/devopen.c:1.3	Mon Sep  3 00:04:02 2018
+++ src/sys/stand/efiboot/devopen.c	Thu Nov 15 23:52:33 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.3 2018/09/03 00:04:02 jmcneill Exp $ */
+/* $NetBSD: devopen.c,v 1.4 2018/11/15 23:52:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -36,7 +36,12 @@ devopen(struct open_file *f, const char 
 	int error;
 
 	error = efi_net_open(f, fname, file);
-	file_system[0] = error ? null_fs_ops : tftp_fs_ops;
+	if (error)
+		file_system[0] = null_fs_ops;
+	else if (rootpath[0] != '\0')
+		file_system[0] = nfs_fs_ops;
+	else
+		

CVS commit: src/sys/dev

2018-11-15 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Nov 15 23:01:46 UTC 2018

Modified Files:
src/sys/dev/bluetooth: bthidev.c
src/sys/dev/hid: hid.c hid.h
src/sys/dev/i2c: ihidev.c
src/sys/dev/usb: uhidev.c

Log Message:
Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/bluetooth/bthidev.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hid/hid.c src/sys/dev/hid/hid.h
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/ihidev.c
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/usb/uhidev.c

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

Modified files:

Index: src/sys/dev/bluetooth/bthidev.c
diff -u src/sys/dev/bluetooth/bthidev.c:1.30 src/sys/dev/bluetooth/bthidev.c:1.31
--- src/sys/dev/bluetooth/bthidev.c:1.30	Sun Dec 10 17:03:07 2017
+++ src/sys/dev/bluetooth/bthidev.c	Thu Nov 15 23:01:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bthidev.c,v 1.30 2017/12/10 17:03:07 bouyer Exp $	*/
+/*	$NetBSD: bthidev.c,v 1.31 2018/11/15 23:01:45 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.30 2017/12/10 17:03:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.31 2018/11/15 23:01:45 jakllsch Exp $");
 
 #include 
 #include 
@@ -284,7 +284,7 @@ bthidev_attach(device_t parent, device_t
 	h.report_ID = 0;
 	d = hid_start_parse(desc, dlen, hid_none);
 	while (hid_get_item(d, )) {
-		if (h.report_ID > maxid)
+		if ((int)h.report_ID > maxid)
 			maxid = h.report_ID;
 	}
 	hid_end_parse(d);

Index: src/sys/dev/hid/hid.c
diff -u src/sys/dev/hid/hid.c:1.2 src/sys/dev/hid/hid.c:1.3
--- src/sys/dev/hid/hid.c:1.2	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/hid/hid.c	Thu Nov 15 23:01:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hid.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: hid.c,v 1.3 2018/11/15 23:01:45 jakllsch Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.3 2018/11/15 23:01:45 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -122,6 +122,7 @@ hid_get_item(struct hid_data *s, struct 
 	uint32_t oldpos;
 	const u_char *data;
 	int32_t dval;
+	uint32_t uval;
 	const u_char *p;
 	struct hid_item *hi;
 	int i;
@@ -173,13 +174,17 @@ hid_get_item(struct hid_data *s, struct 
 		switch(bSize) {
 		case 0:
 			dval = 0;
+			uval = dval;
 			break;
 		case 1:
-			dval = (int8_t)*data++;
+			dval = *data++;
+			uval = dval;
+			dval = (int8_t)dval;
 			break;
 		case 2:
 			dval = *data++;
 			dval |= *data++ << 8;
+			uval = dval;
 			dval = (int16_t)dval;
 			break;
 		case 4:
@@ -187,6 +192,7 @@ hid_get_item(struct hid_data *s, struct 
 			dval |= *data++ << 8;
 			dval |= *data++ << 16;
 			dval |= *data++ << 24;
+			uval = dval;
 			dval = (int32_t)dval;
 			break;
 		default:
@@ -194,8 +200,8 @@ hid_get_item(struct hid_data *s, struct 
 			continue;
 		}
 
-		DPRINTFN(5,("hid_get_item: bType=%d bTag=%d dval=%d\n",
-			 bType, bTag, dval));
+		DPRINTFN(5,("hid_get_item: bType=%d bTag=%d dval=%d uval=%u\n",
+			 bType, bTag, dval, uval));
 		switch (bType) {
 		case 0:			/* Main */
 			switch (bTag) {
@@ -209,7 +215,7 @@ hid_get_item(struct hid_data *s, struct 
 	continue;
 }
 c->kind = retkind;
-c->flags = dval;
+c->flags = uval;
 if (c->flags & HIO_VARIABLE) {
 	s->multimax = c->loc.count;
 	s->multi = 0;
@@ -242,7 +248,7 @@ hid_get_item(struct hid_data *s, struct 
 goto ret;
 			case 10:	/* Collection */
 c->kind = hid_collection;
-c->collection = dval;
+c->collection = uval;
 c->collevel++;
 *h = *c;
 hid_clear_local(c);
@@ -265,7 +271,7 @@ hid_get_item(struct hid_data *s, struct 
 		case 1:		/* Global */
 			switch (bTag) {
 			case 0:
-c->_usage_page = dval << 16;
+c->_usage_page = uval << 16;
 break;
 			case 1:
 c->logical_minimum = dval;
@@ -280,20 +286,20 @@ hid_get_item(struct hid_data *s, struct 
 c->physical_maximum = dval;
 break;
 			case 5:
-c->unit_exponent = dval;
+c->unit_exponent = uval;
 break;
 			case 6:
-c->unit = dval;
+c->unit = uval;
 break;
 			case 7:
-c->loc.size = dval;
+c->loc.size = uval;
 break;
 			case 8:
-c->report_ID = dval;
+c->report_ID = uval;
 c->loc.pos = 0;
 break;
 			case 9:
-c->loc.count = dval;
+c->loc.count = uval;
 break;
 			case 10: /* Push */
 hi = kmem_alloc(sizeof(*hi), KM_SLEEP);
@@ -317,50 +323,44 @@ hid_get_item(struct hid_data *s, struct 
 		case 2:		/* Local */
 			switch (bTag) {
 			case 0:
-if (bSize == 1)
-	dval = c->_usage_page | (dval&0xff);
-else if (bSize == 2)
-	dval = c->_usage_page | 

CVS commit: src/sys/dev/pci

2018-11-15 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Nov 15 22:15:44 UTC 2018

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

Log Message:
remove #ifdef DEBUG printf, it seems to have outlived it's usefulness


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/xhci_pci.c

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

Modified files:

Index: src/sys/dev/pci/xhci_pci.c
diff -u src/sys/dev/pci/xhci_pci.c:1.15 src/sys/dev/pci/xhci_pci.c:1.16
--- src/sys/dev/pci/xhci_pci.c:1.15	Wed Oct 31 16:11:29 2018
+++ src/sys/dev/pci/xhci_pci.c	Thu Nov 15 22:15:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci_pci.c,v 1.15 2018/10/31 16:11:29 jmcneill Exp $	*/
+/*	$NetBSD: xhci_pci.c,v 1.16 2018/11/15 22:15:43 jdolecek Exp $	*/
 /*	OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.15 2018/10/31 16:11:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.16 2018/11/15 22:15:43 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xhci_pci.h"
@@ -139,9 +139,6 @@ xhci_pci_attach(device_t parent, device_
 
 	/* check if memory space access is enabled */
 	csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
-#ifdef DEBUG
-	printf("%s: csr: %08x\n", __func__, csr);
-#endif
 	if ((csr & PCI_COMMAND_MEM_ENABLE) == 0) {
 		sc->sc_ios = 0;
 		aprint_error_dev(self, "memory access is disabled\n");



CVS commit: src/sys/arch/ia64/ia64

2018-11-15 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Thu Nov 15 20:39:19 UTC 2018

Modified Files:
src/sys/arch/ia64/ia64: machdep.c

Log Message:
enable some incorrectly commented-out code


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/ia64/ia64/machdep.c

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

Modified files:

Index: src/sys/arch/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.39 src/sys/arch/ia64/ia64/machdep.c:1.40
--- src/sys/arch/ia64/ia64/machdep.c:1.39	Wed Nov 14 21:10:59 2018
+++ src/sys/arch/ia64/ia64/machdep.c	Thu Nov 15 20:39:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.39 2018/11/14 21:10:59 scole Exp $	*/
+/*	$NetBSD: machdep.c,v 1.40 2018/11/15 20:39:18 scole Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -667,10 +667,8 @@ ia64_init(void)
 	 * sane) context as the initial context for new threads that are
 	 * forked from us.
 	 */
-#if 0	/* XXX */
 	if (savectx(pcb0))
 		panic("savectx failed");
-#endif
 
 	/*
 	 * Initialize debuggers, and break into them if appropriate.



CVS commit: src/sys/arch/ia64/include

2018-11-15 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Thu Nov 15 20:06:23 UTC 2018

Modified Files:
src/sys/arch/ia64/include: proc.h

Log Message:
change "PCB" to "pcb"


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/include/proc.h

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

Modified files:

Index: src/sys/arch/ia64/include/proc.h
diff -u src/sys/arch/ia64/include/proc.h:1.7 src/sys/arch/ia64/include/proc.h:1.8
--- src/sys/arch/ia64/include/proc.h:1.7	Wed Nov 14 21:10:59 2018
+++ src/sys/arch/ia64/include/proc.h	Thu Nov 15 20:06:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.7 2018/11/14 21:10:59 scole Exp $	*/
+/*	$NetBSD: proc.h,v 1.8 2018/11/15 20:06:23 scole Exp $	*/
 
 #ifndef _IA64_PROC_H_
 #define _IA64_PROC_H_
@@ -44,6 +44,6 @@ struct mdproc {
 #define UAREA_SP_OFFSET		(UAREA_TF_OFFSET -16 -sizeof(uint64_t))
 #define UAREA_BSPSTORE_OFFSET	(0)
 #define UAREA_STACK_SIZE	(USPACE - 16 - sizeof(struct trapframe) - \
- sizeof(struct PCB))
+ sizeof(struct pcb))
 
 #endif /* _IA64_PROC_H_ */



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

2018-11-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 15 17:15:52 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gtmr.c

Log Message:
A64 timer errata can cause the timer to fire too soon, so skip KASSERT here too.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/arm/cortex/gtmr.c

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

Modified files:

Index: src/sys/arch/arm/cortex/gtmr.c
diff -u src/sys/arch/arm/cortex/gtmr.c:1.37 src/sys/arch/arm/cortex/gtmr.c:1.38
--- src/sys/arch/arm/cortex/gtmr.c:1.37	Tue Oct 30 10:38:11 2018
+++ src/sys/arch/arm/cortex/gtmr.c	Thu Nov 15 17:15:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmr.c,v 1.37 2018/10/30 10:38:11 jmcneill Exp $	*/
+/*	$NetBSD: gtmr.c,v 1.38 2018/11/15 17:15:52 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.37 2018/10/30 10:38:11 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.38 2018/11/15 17:15:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -282,9 +282,11 @@ gtmr_intr(void *arg)
 	}
 #endif
 
-	KASSERTMSG(delta > sc->sc_autoinc / 100,
-	"%s: interrupting too quickly (delta=%"PRIu64") autoinc=%lu",
-	ci->ci_data.cpu_name, delta, sc->sc_autoinc);
+	if (!ISSET(sc->sc_flags, GTMR_FLAG_SUN50I_A64_UNSTABLE_TIMER)) {
+		KASSERTMSG(delta > sc->sc_autoinc / 100,
+		"%s: interrupting too quickly (delta=%"PRIu64") autoinc=%lu",
+		ci->ci_data.cpu_name, delta, sc->sc_autoinc);
+	}
 
 	/*
 	 * If we got interrupted too soon (delta < sc->sc_autoinc)



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

2018-11-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov 15 16:58:56 UTC 2018

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

Log Message:
No need to write any initializer here, casted or otherwise.

(Sorry about the build breakage; thanks, kre!)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/x86/efi.c

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

Modified files:

Index: src/sys/arch/x86/x86/efi.c
diff -u src/sys/arch/x86/x86/efi.c:1.17 src/sys/arch/x86/x86/efi.c:1.18
--- src/sys/arch/x86/x86/efi.c:1.17	Thu Nov 15 11:20:59 2018
+++ src/sys/arch/x86/x86/efi.c	Thu Nov 15 16:58:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efi.c,v 1.17 2018/11/15 11:20:59 kre Exp $	*/
+/*	$NetBSD: efi.c,v 1.18 2018/11/15 16:58:56 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.17 2018/11/15 11:20:59 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.18 2018/11/15 16:58:56 riastradh Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ void 		efi_aprintuuid(const struct uuid 
 bool 		efi_uuideq(const struct uuid *, const struct uuid *);
 
 static bool efi_is32x64 = false;
-static paddr_t efi_systbl_pa = (paddr_t)NULL;
+static paddr_t efi_systbl_pa;
 static struct efi_systbl *efi_systbl_va = NULL;
 static struct efi_cfgtbl *efi_cfgtblhead_va = NULL;
 static struct efi_e820memmap {



CVS commit: src/sys/uvm

2018-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Nov 15 14:19:23 UTC 2018

Modified Files:
src/sys/uvm: uvm_swap.c

Log Message:
Woah man, fix enormous leak.

Possible info leak: [len=1056, leaked=931]
#0 0x80bad351 in kleak_copyout
#1 0x80b2cf64 in uvm_swap_stats.part.1
#2 0x80b2d38d in uvm_swap_stats
#3 0x80b2d43c in sys_swapctl
#4 0x80259b82 in syscall


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/uvm/uvm_swap.c

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

Modified files:

Index: src/sys/uvm/uvm_swap.c
diff -u src/sys/uvm/uvm_swap.c:1.177 src/sys/uvm/uvm_swap.c:1.178
--- src/sys/uvm/uvm_swap.c:1.177	Thu Mar 15 03:21:58 2018
+++ src/sys/uvm/uvm_swap.c	Thu Nov 15 14:19:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_swap.c,v 1.177 2018/03/15 03:21:58 christos Exp $	*/
+/*	$NetBSD: uvm_swap.c,v 1.178 2018/11/15 14:19:23 maxv Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.177 2018/03/15 03:21:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.178 2018/11/15 14:19:23 maxv Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_compat_netbsd.h"
@@ -744,6 +744,7 @@ uvm_swap_stats(char *ptr, int misc, 
 			inuse = btodb((uint64_t)sdp->swd_npginuse <<
 			PAGE_SHIFT);
 
+			memset(, 0, sizeof(sep));
 			swapent_cvt(, sdp, inuse);
 			if (f)
 (*f)(, );



CVS commit: src/sys/dev/wscons

2018-11-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 15 13:50:51 UTC 2018

Modified Files:
src/sys/dev/wscons: wsdisplay.c

Log Message:
WSDISPLAYIO_SFONT: Do not attempt to print to the console in the middle of
resizing when DEBUG is defined.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/sys/dev/wscons/wsdisplay.c

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

Modified files:

Index: src/sys/dev/wscons/wsdisplay.c
diff -u src/sys/dev/wscons/wsdisplay.c:1.147 src/sys/dev/wscons/wsdisplay.c:1.148
--- src/sys/dev/wscons/wsdisplay.c:1.147	Wed Sep 26 09:04:12 2018
+++ src/sys/dev/wscons/wsdisplay.c	Thu Nov 15 13:50:51 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.147 2018/09/26 09:04:12 bouyer Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.148 2018/11/15 13:50:51 jmcneill Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.147 2018/09/26 09:04:12 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.148 2018/11/15 13:50:51 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_wsdisplay_compat.h"
@@ -1389,11 +1389,6 @@ wsdisplay_internal_ioctl(struct wsdispla
 		if (!error && WSSCREEN_HAS_EMULATOR(scr)) {
 			(*scr->scr_dconf->wsemul->reset)
 (scr->scr_dconf->wsemulcookie, WSEMUL_SYNCFONT);
-#ifdef DEBUG
-			printf("resize: %d %d\n",
-			scr->scr_dconf->scrdata->nrows,
-			scr->scr_dconf->scrdata->ncols); 
-#endif
 			if (scr->scr_dconf->wsemul->resize) {
 (*scr->scr_dconf->wsemul->resize)
 	(scr->scr_dconf->wsemulcookie,



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

2018-11-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Nov 15 11:20:59 UTC 2018

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

Log Message:
Update signature in prototype of efi_relva() to match
change in definition in previous, and explicitly cast
NULL to paddr_t to avoid gcc noise.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/x86/efi.c

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

Modified files:

Index: src/sys/arch/x86/x86/efi.c
diff -u src/sys/arch/x86/x86/efi.c:1.16 src/sys/arch/x86/x86/efi.c:1.17
--- src/sys/arch/x86/x86/efi.c:1.16	Thu Nov 15 04:59:02 2018
+++ src/sys/arch/x86/x86/efi.c	Thu Nov 15 11:20:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efi.c,v 1.16 2018/11/15 04:59:02 riastradh Exp $	*/
+/*	$NetBSD: efi.c,v 1.17 2018/11/15 11:20:59 kre Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.16 2018/11/15 04:59:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.17 2018/11/15 11:20:59 kre Exp $");
 
 #include 
 #include 
@@ -48,14 +48,14 @@ const struct uuid EFI_UUID_SMBIOS = EFI_
 const struct uuid EFI_UUID_SMBIOS3 = EFI_TABLE_SMBIOS3;
 
 static vaddr_t 	efi_getva(paddr_t);
-static void 	efi_relva(vaddr_t);
+static void 	efi_relva(paddr_t, vaddr_t);
 struct efi_cfgtbl *efi_getcfgtblhead(void);
 void 		efi_aprintcfgtbl(void);
 void 		efi_aprintuuid(const struct uuid *);
 bool 		efi_uuideq(const struct uuid *, const struct uuid *);
 
 static bool efi_is32x64 = false;
-static paddr_t efi_systbl_pa = NULL;
+static paddr_t efi_systbl_pa = (paddr_t)NULL;
 static struct efi_systbl *efi_systbl_va = NULL;
 static struct efi_cfgtbl *efi_cfgtblhead_va = NULL;
 static struct efi_e820memmap {



CVS commit: src/sys/sys

2018-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Nov 15 11:18:33 UTC 2018

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

Log Message:
Reduce indentation level.


To generate a diff of this commit:
cvs rdiff -u -r1.214 -r1.215 src/sys/sys/mbuf.h

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

Modified files:

Index: src/sys/sys/mbuf.h
diff -u src/sys/sys/mbuf.h:1.214 src/sys/sys/mbuf.h:1.215
--- src/sys/sys/mbuf.h:1.214	Thu Nov 15 10:56:30 2018
+++ src/sys/sys/mbuf.h	Thu Nov 15 11:18:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbuf.h,v 1.214 2018/11/15 10:56:30 maxv Exp $	*/
+/*	$NetBSD: mbuf.h,v 1.215 2018/11/15 11:18:33 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -823,19 +823,19 @@ struct	m_tag *m_tag_copy(struct m_tag *)
 int	m_tag_copy_chain(struct mbuf *, struct mbuf *);
 
 /* Packet tag types */
-#define PACKET_TAG_NONE0  /* Nothing */
-#define PACKET_TAG_SO4  /* sending socket pointer */
-#define PACKET_TAG_PF11 /* packet filter */
-#define PACKET_TAG_ALTQ_QID			12 /* ALTQ queue id */
-#define PACKET_TAG_IPSEC_OUT_DONE		18
-#define	PACKET_TAG_IPSEC_NAT_T_PORTS		25 /* two uint16_t */
-#define	PACKET_TAG_INET6			26 /* IPv6 info */
-#define	PACKET_TAG_TUNNEL_INFO			28 /* tunnel identification and
-		* protocol callback, for
-		* loop detection/recovery
-		*/
-#define	PACKET_TAG_MPLS29 /* Indicate it's for MPLS */
-#define	PACKET_TAG_SRCROUTE			30 /* IPv4 source routing */
+#define PACKET_TAG_NONE			0  /* Nothing */
+#define PACKET_TAG_SO			4  /* sending socket pointer */
+#define PACKET_TAG_PF			11 /* packet filter */
+#define PACKET_TAG_ALTQ_QID		12 /* ALTQ queue id */
+#define PACKET_TAG_IPSEC_OUT_DONE	18
+#define PACKET_TAG_IPSEC_NAT_T_PORTS	25 /* two uint16_t */
+#define PACKET_TAG_INET6		26 /* IPv6 info */
+#define PACKET_TAG_TUNNEL_INFO		28 /* tunnel identification and
+	* protocol callback, for loop
+	* detection/recovery
+	*/
+#define PACKET_TAG_MPLS			29 /* Indicate it's for MPLS */
+#define PACKET_TAG_SRCROUTE		30 /* IPv4 source routing */
 
 /*
  * Return the number of bytes in the mbuf chain, m.



CVS commit: src

2018-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Nov 15 10:56:30 UTC 2018

Modified Files:
src/share/man/man9: mbuf.9
src/sys/dev/ic: wi.c
src/sys/dev/pci: if_ale.c if_cas.c if_sk.c
src/sys/dev/pcmcia: if_malo_pcmcia.c
src/sys/dev/ppbus: if_plip.c
src/sys/dev/usb: if_umb.c if_upgt.c
src/sys/kern: uipc_mbuf.c
src/sys/sys: mbuf.h

Log Message:
Remove the 'copy' argument from m_devget(), unused. While here rename
off0->off.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/share/man/man9/mbuf.9
cvs rdiff -u -r1.248 -r1.249 src/sys/dev/ic/wi.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/if_ale.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/if_cas.c
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/pci/if_sk.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pcmcia/if_malo_pcmcia.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ppbus/if_plip.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/usb/if_umb.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/usb/if_upgt.c
cvs rdiff -u -r1.224 -r1.225 src/sys/kern/uipc_mbuf.c
cvs rdiff -u -r1.213 -r1.214 src/sys/sys/mbuf.h

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

Modified files:

Index: src/share/man/man9/mbuf.9
diff -u src/share/man/man9/mbuf.9:1.64 src/share/man/man9/mbuf.9:1.65
--- src/share/man/man9/mbuf.9:1.64	Mon May  7 10:53:45 2018
+++ src/share/man/man9/mbuf.9	Thu Nov 15 10:56:29 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mbuf.9,v 1.64 2018/05/07 10:53:45 maxv Exp $
+.\"	$NetBSD: mbuf.9,v 1.65 2018/11/15 10:56:29 maxv Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -74,7 +74,7 @@
 .Ft struct mbuf *
 .Fn m_gethdr "int how" "int type"
 .Ft struct mbuf *
-.Fn m_devget "char *buf" "int totlen" "int off0" "struct ifnet *ifp" "void (*copy)(const void *, void *, size_t)"
+.Fn m_devget "char *buf" "int totlen" "int off" "struct ifnet *ifp"
 .Ft struct mbuf *
 .Fn m_copym "struct mbuf *m" "int off" "int len" "int wait"
 .Ft struct mbuf *
@@ -254,11 +254,10 @@ from caller.
 The
 .Fa type
 parameter is an mbuf type.
-.It Fn m_devget "char *buf" "int totlen" "int off0" "struct ifnet *ifp" "void (*copy)(const void *, void *, size_t)"
+.It Fn m_devget "char *buf" "int totlen" "int off" "struct ifnet *ifp"
 Copies
 .Fa len
-bytes from device local memory into mbufs using copy routine
-.Fa copy .
+bytes from device local memory into mbufs.
 If parameter
 .Fa off
 is non-zero, the packet is supposed to be trailer-encapsulated and

Index: src/sys/dev/ic/wi.c
diff -u src/sys/dev/ic/wi.c:1.248 src/sys/dev/ic/wi.c:1.249
--- src/sys/dev/ic/wi.c:1.248	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/ic/wi.c	Thu Nov 15 10:56:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wi.c,v 1.248 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: wi.c,v 1.249 2018/11/15 10:56:29 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.248 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.249 2018/11/15 10:56:29 maxv Exp $");
 
 #define WI_HERMES_AUTOINC_WAR	/* Work around data write autoinc bug. */
 #define WI_HERMES_STATS_WAR	/* Work around stats counter bug. */
@@ -2512,7 +2512,7 @@ wi_set_cfg(struct ifnet *ifp, u_long cmd
 			break;
 		}
 		/* XXX wi_len looks in u_int8_t, not in u_int16_t */
-		m = m_devget((char *)_val, wreq.wi_len, 0, ifp, NULL);
+		m = m_devget((char *)_val, wreq.wi_len, 0, ifp);
 		if (m == NULL) {
 			error = ENOMEM;
 			break;

Index: src/sys/dev/pci/if_ale.c
diff -u src/sys/dev/pci/if_ale.c:1.24 src/sys/dev/pci/if_ale.c:1.25
--- src/sys/dev/pci/if_ale.c:1.24	Tue Jun 26 06:48:01 2018
+++ src/sys/dev/pci/if_ale.c	Thu Nov 15 10:56:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ale.c,v 1.24 2018/06/26 06:48:01 msaitoh Exp $	*/
+/*	$NetBSD: if_ale.c,v 1.25 2018/11/15 10:56:29 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, Pyun YongHyeon 
@@ -32,7 +32,7 @@
 /* Driver for Atheros AR8121/AR8113/AR8114 PCIe Ethernet. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.24 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.25 2018/11/15 10:56:29 maxv Exp $");
 
 #include "vlan.h"
 
@@ -1526,7 +1526,7 @@ ale_rxeof(struct ale_softc *sc)
 		 * on these low-end consumer ethernet controller.
 		 */
 		m = m_devget((char *)(rs + 1), length - ETHER_CRC_LEN,
-		0, ifp, NULL);
+		0, ifp);
 		if (m == NULL) {
 			ifp->if_iqdrops++;
 			ale_rx_update_page(sc, _page, length, );

Index: src/sys/dev/pci/if_cas.c
diff -u src/sys/dev/pci/if_cas.c:1.27 src/sys/dev/pci/if_cas.c:1.28
--- src/sys/dev/pci/if_cas.c:1.27	Tue Jun 26 06:48:01 2018
+++ src/sys/dev/pci/if_cas.c	Thu Nov 15 10:56:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cas.c,v 1.27 2018/06/26 06:48:01 msaitoh Exp $	*/
+/*	$NetBSD: if_cas.c,v 1.28 2018/11/15 10:56:29 maxv Exp $	*/
 /*	$OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $	*/
 
 /*
@@ -44,7 

CVS commit: src/sys/kern

2018-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Nov 15 10:37:26 UTC 2018

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

Log Message:
Add KASSERTs.


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/sys/kern/uipc_mbuf.c

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

Modified files:

Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.223 src/sys/kern/uipc_mbuf.c:1.224
--- src/sys/kern/uipc_mbuf.c:1.223	Thu Nov 15 10:23:55 2018
+++ src/sys/kern/uipc_mbuf.c	Thu Nov 15 10:37:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.223 2018/11/15 10:23:55 maxv Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.224 2018/11/15 10:37:26 maxv Exp $	*/
 
 /*
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.223 2018/11/15 10:23:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.224 2018/11/15 10:37:26 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -2242,12 +2242,14 @@ m_tag_free(struct m_tag *t)
 void
 m_tag_prepend(struct mbuf *m, struct m_tag *t)
 {
+	KASSERT((m->m_flags & M_PKTHDR) != 0);
 	SLIST_INSERT_HEAD(>m_pkthdr.tags, t, m_tag_link);
 }
 
 void
 m_tag_unlink(struct mbuf *m, struct m_tag *t)
 {
+	KASSERT((m->m_flags & M_PKTHDR) != 0);
 	SLIST_REMOVE(>m_pkthdr.tags, t, m_tag, m_tag_link);
 }
 
@@ -2263,6 +2265,8 @@ m_tag_delete_chain(struct mbuf *m)
 {
 	struct m_tag *p, *q;
 
+	KASSERT((m->m_flags & M_PKTHDR) != 0);
+
 	p = SLIST_FIRST(>m_pkthdr.tags);
 	if (p == NULL)
 		return;
@@ -2276,6 +2280,8 @@ m_tag_find(const struct mbuf *m, int typ
 {
 	struct m_tag *p;
 
+	KASSERT((m->m_flags & M_PKTHDR) != 0);
+
 	p = SLIST_FIRST(>m_pkthdr.tags);
 	while (p != NULL) {
 		if (p->m_tag_id == type)
@@ -2308,6 +2314,8 @@ m_tag_copy_chain(struct mbuf *to, struct
 {
 	struct m_tag *p, *t, *tprev = NULL;
 
+	KASSERT((from->m_flags & M_PKTHDR) != 0);
+
 	m_tag_delete_chain(to);
 	SLIST_FOREACH(p, >m_pkthdr.tags, m_tag_link) {
 		t = m_tag_copy(p);



CVS commit: src/usr.sbin/sysinst

2018-11-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 15 10:34:21 UTC 2018

Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c mbr.c msg.mbr.de msg.mbr.en
msg.mbr.es msg.mbr.fr msg.mbr.pl msg.mi.de msg.mi.en msg.mi.es
msg.mi.fr msg.mi.pl
Added Files:
src/usr.sbin/sysinst: defsizes.h

Log Message:
Make use of the new positional parameters to better describe the first
partitioning step. Remove size limits/hints encoded in the translations
and replace them by values from the code.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/bsddisklabel.c \
src/usr.sbin/sysinst/msg.mbr.fr
cvs rdiff -u -r0 -r1.1 src/usr.sbin/sysinst/defsizes.h
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/mbr.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/sysinst/msg.mbr.de \
src/usr.sbin/sysinst/msg.mbr.en src/usr.sbin/sysinst/msg.mbr.es \
src/usr.sbin/sysinst/msg.mbr.pl
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/msg.mi.de \
src/usr.sbin/sysinst/msg.mi.es
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/sysinst/msg.mi.en
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/sysinst/msg.mi.fr
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/sysinst/msg.mi.pl

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.4 src/usr.sbin/sysinst/bsddisklabel.c:1.5
--- src/usr.sbin/sysinst/bsddisklabel.c:1.4	Sun Jun  3 13:16:30 2018
+++ src/usr.sbin/sysinst/bsddisklabel.c	Thu Nov 15 10:34:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.4 2018/06/03 13:16:30 martin Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.5 2018/11/15 10:34:21 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -48,6 +48,7 @@
 #include 
 #include "defs.h"
 #include "md.h"
+#include "defsizes.h"
 #include "endian.h"
 #include "msg_defs.h"
 #include "menu_defs.h"
@@ -70,19 +71,6 @@
 #define PART_USR	PART_ANY
 #endif
 
-#ifndef DEFVARSIZE
-#define DEFVARSIZE	32
-#endif
-#ifndef DEFROOTSIZE
-#define DEFROOTSIZE	32
-#endif
-#ifndef DEFUSRSIZE
-#define DEFUSRSIZE	128
-#endif
-#ifndef DEFSWAPSIZE
-#define DEFSWAPSIZE	128
-#endif
-
 int
 save_ptn(int ptn, daddr_t start, daddr_t size, int fstype, const char *mountpt)
 {
Index: src/usr.sbin/sysinst/msg.mbr.fr
diff -u src/usr.sbin/sysinst/msg.mbr.fr:1.4 src/usr.sbin/sysinst/msg.mbr.fr:1.5
--- src/usr.sbin/sysinst/msg.mbr.fr:1.4	Mon Apr 20 14:10:31 2015
+++ src/usr.sbin/sysinst/msg.mbr.fr	Thu Nov 15 10:34:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mbr.fr,v 1.4 2015/04/20 14:10:31 maxv Exp $	*/
+/*	$NetBSD: msg.mbr.fr,v 1.5 2018/11/15 10:34:21 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -34,14 +34,24 @@
 
 /* MD Message catalog -- french, i386 version */
 
+
+/* Called with:Example
+ *  $0 = device name			wd0
+ *  $1 = outer partitioning name	Master Boot Record (MBR)
+ *  $2 = inner partitioning name	BSD disklabel
+ *  $3 = short version of $1		MBR
+ *  $4 = short version of $2		disklabel
+ *  $5 = size needed for NetBSD		250M
+ *  $6 = size needed to build NetBSD	15G
+ */
 message fullpart
-{Nous allons maintenant installer NetBSD sur votre disque %s. Vous devez
+{Nous allons maintenant installer NetBSD sur votre disque $0. Vous devez
 choisir si vous voulez installer NetBSD sur la totalité du disque ou seulement
 sur une partie de celui-ci.
 Une installation sur une partie du disque crée une partition, ou `slice', pour
-NetBSD dans le secteur de démarrage (Master Boot Record, alias MBR) de votre
+NetBSD dans le secteur de démarrage ($1) de votre
 disque. Une installation sur la totalité du disque est `dangereusement
-dédiée' : elle réinitialise complètement le MBR, ce qui efface tout système
+dédiée' : elle réinitialise complètement le $3, ce qui efface tout système
 d'exploitation ou données existants sur le disque. Cela rend également
 impossible l'installation ultérieure d'un deuxième système d'exploitation,
 sauf si vous réinstallez complètement NetBSD en utilisant uniquement une

Index: src/usr.sbin/sysinst/mbr.c
diff -u src/usr.sbin/sysinst/mbr.c:1.6 src/usr.sbin/sysinst/mbr.c:1.7
--- src/usr.sbin/sysinst/mbr.c:1.6	Sun Jun  3 13:16:30 2018
+++ src/usr.sbin/sysinst/mbr.c	Thu Nov 15 10:34:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.6 2018/06/03 13:16:30 martin Exp $ */
+/*	$NetBSD: mbr.c,v 1.7 2018/11/15 10:34:21 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -75,6 +75,7 @@
 #include "md.h"
 #include "msg_defs.h"
 #include "menu_defs.h"
+#include "defsizes.h"
 #include "endian.h"
 
 #define NO_BOOTMENU (-0x100)
@@ -1277,7 +1278,24 @@ edit_mbr(mbr_info_t *mbri)
 	if (partman_go)
 		usefull = 0;
 	else {
-		msg_display(MSG_fullpart, pm->diskdev);
+		uint64_t m_size =
+		DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE + XNEEDMB;
+		char min_size[5], build_size[5];
+
+		humanize_number(min_size, sizeof(min_size),
+		  

CVS commit: src

2018-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Nov 15 10:23:57 UTC 2018

Modified Files:
src/share/man/man9: m_tag.9
src/sys/altq: altq_cbq.c altq_hfsc.c altq_priq.c altq_red.c
src/sys/dev/ieee1394: if_fwip.c
src/sys/dist/pf/net: pf_mtag.c
src/sys/kern: uipc_mbuf.c
src/sys/net: if.c if_ethersubr.c if_ieee1394subr.c
src/sys/net/npf: npf_mbuf.c
src/sys/netcan: can.c
src/sys/netinet: ip_icmp.c ip_input.c
src/sys/netinet6: ip6_input.c
src/sys/netipsec: ipsec.h ipsec_input.c ipsecif.c
src/sys/sys: mbuf.h

Log Message:
Remove the 't' argument from m_tag_find().


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man9/m_tag.9
cvs rdiff -u -r1.31 -r1.32 src/sys/altq/altq_cbq.c
cvs rdiff -u -r1.27 -r1.28 src/sys/altq/altq_hfsc.c
cvs rdiff -u -r1.25 -r1.26 src/sys/altq/altq_priq.c
cvs rdiff -u -r1.30 -r1.31 src/sys/altq/altq_red.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ieee1394/if_fwip.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dist/pf/net/pf_mtag.c
cvs rdiff -u -r1.222 -r1.223 src/sys/kern/uipc_mbuf.c
cvs rdiff -u -r1.440 -r1.441 src/sys/net/if.c
cvs rdiff -u -r1.270 -r1.271 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.63 -r1.64 src/sys/net/if_ieee1394subr.c
cvs rdiff -u -r1.21 -r1.22 src/sys/net/npf/npf_mbuf.c
cvs rdiff -u -r1.5 -r1.6 src/sys/netcan/can.c
cvs rdiff -u -r1.175 -r1.176 src/sys/netinet/ip_icmp.c
cvs rdiff -u -r1.386 -r1.387 src/sys/netinet/ip_input.c
cvs rdiff -u -r1.204 -r1.205 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.84 -r1.85 src/sys/netipsec/ipsec.h
cvs rdiff -u -r1.72 -r1.73 src/sys/netipsec/ipsec_input.c
cvs rdiff -u -r1.10 -r1.11 src/sys/netipsec/ipsecif.c
cvs rdiff -u -r1.212 -r1.213 src/sys/sys/mbuf.h

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

Modified files:

Index: src/share/man/man9/m_tag.9
diff -u src/share/man/man9/m_tag.9:1.7 src/share/man/man9/m_tag.9:1.8
--- src/share/man/man9/m_tag.9:1.7	Thu Nov 15 10:06:06 2018
+++ src/share/man/man9/m_tag.9	Thu Nov 15 10:23:55 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: m_tag.9,v 1.7 2018/11/15 10:06:06 maxv Exp $
+.\" $NetBSD: m_tag.9,v 1.8 2018/11/15 10:23:55 maxv Exp $
 .\"
 .\" Copyright (c)2004 YAMAMOTO Takashi,
 .\" All rights reserved.
@@ -56,7 +56,7 @@
 .Ft void
 .Fn m_tag_delete_chain "struct mbuf *m"
 .Ft struct m_tag *
-.Fn m_tag_find "struct mbuf *m" "int type" "struct m_tag *t"
+.Fn m_tag_find "struct mbuf *m" "int type"
 .Ft struct m_tag *
 .Fn m_tag_copy "struct m_tag *m"
 .Ft int
@@ -121,18 +121,11 @@ followed by
 Unlink and free mbuf tags from the mbuf
 .Fa m .
 .\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-.It Fn m_tag_find "m" "type" "t"
+.It Fn m_tag_find "m" "type"
 Find an mbuf tag with type
 .Fa type
-after the mbuf tag
-.Fa t
 in the tag chain associated with the mbuf
 .Fa m .
-If
-.Fa t
-is
-.Dv NULL ,
-search from the first mbuf tag.
 If an mbuf tag is found, return a pointer to it.
 Otherwise return
 .Dv NULL .

Index: src/sys/altq/altq_cbq.c
diff -u src/sys/altq/altq_cbq.c:1.31 src/sys/altq/altq_cbq.c:1.32
--- src/sys/altq/altq_cbq.c:1.31	Fri Jul 28 13:53:17 2017
+++ src/sys/altq/altq_cbq.c	Thu Nov 15 10:23:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: altq_cbq.c,v 1.31 2017/07/28 13:53:17 riastradh Exp $	*/
+/*	$NetBSD: altq_cbq.c,v 1.32 2018/11/15 10:23:55 maxv Exp $	*/
 /*	$KAME: altq_cbq.c,v 1.21 2005/04/13 03:44:24 suz Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.31 2017/07/28 13:53:17 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.32 2018/11/15 10:23:55 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq.h"
@@ -514,7 +514,7 @@ cbq_enqueue(struct ifaltq *ifq, struct m
 		return (ENOBUFS);
 	}
 	cl = NULL;
-	if ((t = m_tag_find(m, PACKET_TAG_ALTQ_QID, NULL)) != NULL)
+	if ((t = m_tag_find(m, PACKET_TAG_ALTQ_QID)) != NULL)
 		cl = clh_to_clp(cbqp, ((struct altq_tag *)(t+1))->qid);
 #ifdef ALTQ3_COMPAT
 	else if (ifq->altq_flags & ALTQF_CLASSIFY)

Index: src/sys/altq/altq_hfsc.c
diff -u src/sys/altq/altq_hfsc.c:1.27 src/sys/altq/altq_hfsc.c:1.28
--- src/sys/altq/altq_hfsc.c:1.27	Fri Jul 28 13:53:17 2017
+++ src/sys/altq/altq_hfsc.c	Thu Nov 15 10:23:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: altq_hfsc.c,v 1.27 2017/07/28 13:53:17 riastradh Exp $	*/
+/*	$NetBSD: altq_hfsc.c,v 1.28 2018/11/15 10:23:55 maxv Exp $	*/
 /*	$KAME: altq_hfsc.c,v 1.26 2005/04/13 03:44:24 suz Exp $	*/
 
 /*
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: altq_hfsc.c,v 1.27 2017/07/28 13:53:17 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_hfsc.c,v 1.28 2018/11/15 10:23:55 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq.h"
@@ -683,7 +683,7 @@ hfsc_enqueue(struct ifaltq *ifq, struct 
 		return (ENOBUFS);
 	}
 	cl = NULL;
-	if ((t = m_tag_find(m, PACKET_TAG_ALTQ_QID, NULL)) != NULL)
+	if ((t = m_tag_find(m, PACKET_TAG_ALTQ_QID)) != NULL)
 		cl = 

CVS commit: src/usr.sbin/sysinst

2018-11-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 15 10:23:32 UTC 2018

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

Log Message:
Add a new helper function to show messages with positional parameters


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.16 -r1.17 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/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.25 src/usr.sbin/sysinst/defs.h:1.26
--- src/usr.sbin/sysinst/defs.h:1.25	Wed Nov 14 02:30:00 2018
+++ src/usr.sbin/sysinst/defs.h	Thu Nov 15 10:23:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.25 2018/11/14 02:30:00 martin Exp $	*/
+/*	$NetBSD: defs.h,v 1.26 2018/11/15 10:23:32 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -553,6 +553,7 @@ void	do_reinstall_sets(void);
 void	restore_etc(void);
 
 /* from util.c */
+void	msg_display_subst(const char *, size_t, ...);
 int	ask_yesno(const char *);
 int	ask_noyes(const char *);
 int	dir_exists_p(const char *);

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.16 src/usr.sbin/sysinst/util.c:1.17
--- src/usr.sbin/sysinst/util.c:1.16	Sun Nov 11 10:06:09 2018
+++ src/usr.sbin/sysinst/util.c	Thu Nov 15 10:23:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.16 2018/11/11 10:06:09 martin Exp $	*/
+/*	$NetBSD: util.c,v 1.17 2018/11/15 10:23:32 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -34,6 +34,8 @@
 
 /* util.c -- routines that don't really fit anywhere else... */
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1792,3 +1794,79 @@ set_postfix(const char *set_name)
 	return use_tgz_for_set(set_name) ? dist_tgz_postfix : dist_postfix;
 }
 
+/*
+ * Replace positional arguments (encoded as $0 .. $N) in the
+ * message by the strings passed as ...
+ */
+void
+msg_display_subst(const char *master, size_t argc, ...)
+{
+	va_list ap;
+	const char **args, **arg;
+	const char *src, *p, *last;
+	char *out, *t;
+	size_t len;
+
+	args = malloc(sizeof(const char *)*argc);
+	if (args == NULL)
+		return;
+
+	arg = args;
+	va_start(ap, argc);
+	for (size_t i = 0; i < argc; i++)
+		*arg++ = va_arg(ap, const char*);
+	va_end(ap);
+
+	src = msg_string(master);
+	len = strlen(src);
+	for (p = strchr(src, '$'); p; p = strchr(p+1, '$')) {
+		char *endp = NULL;
+		size_t n;
+		int e;
+
+		/* $ followed by a correct numeric position? */
+		n = strtou(p+1, , 10, 0, INT_MAX, );
+		if ((e == 0 || e == ENOTSUP) && n < argc) {
+			len += strlen(args[n]);
+			len -= endp-p;
+			p = endp-1;
+		}
+	}
+
+	out = malloc(len+1);
+	if (out == NULL) {
+		free(args);
+		return;
+	}
+
+	t = out;
+	for (last = src, p = strchr(src, '$'); p; p = strchr(p+1, '$')) {
+		char *endp = NULL;
+		size_t n;
+		int e;
+
+		/* $ followed by a correct numeric position? */
+		n = strtou(p+1, , 10, 0, INT_MAX, );
+		if ((e == 0 || e == ENOTSUP) && n < argc) {
+			size_t l = p-last;
+			memcpy(t, last, l);
+			t += l;
+			strcpy(t, args[n]);
+			t += strlen(args[n]);
+			last = endp;
+		}
+	}
+	if (*last) {
+		strcpy(t, last);
+		t += strlen(last);
+	} else {
+		*t = 0;
+	}
+	assert((size_t)(t-out) == len);
+
+	msg_display(out);
+
+	free(out);
+	free(args);
+}
+



CVS commit: src

2018-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Nov 15 10:06:07 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile m_tag.9
src/sys/kern: uipc_mbuf.c
src/sys/net: if_loop.c
src/sys/netcan: can.c
src/sys/netinet: ip_icmp.c
src/sys/sys: mbuf.h

Log Message:
Simplify the mtag API:

 - Remove m_tag_init(), m_tag_first(), m_tag_next() and
   m_tag_delete_nonpersistent().

 - Remove the 't' argument from m_tag_delete_chain().


To generate a diff of this commit:
cvs rdiff -u -r1.2237 -r1.2238 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.431 -r1.432 src/share/man/man9/Makefile
cvs rdiff -u -r1.6 -r1.7 src/share/man/man9/m_tag.9
cvs rdiff -u -r1.221 -r1.222 src/sys/kern/uipc_mbuf.c
cvs rdiff -u -r1.105 -r1.106 src/sys/net/if_loop.c
cvs rdiff -u -r1.4 -r1.5 src/sys/netcan/can.c
cvs rdiff -u -r1.174 -r1.175 src/sys/netinet/ip_icmp.c
cvs rdiff -u -r1.211 -r1.212 src/sys/sys/mbuf.h

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2237 src/distrib/sets/lists/comp/mi:1.2238
--- src/distrib/sets/lists/comp/mi:1.2237	Sun Oct 28 00:44:37 2018
+++ src/distrib/sets/lists/comp/mi	Thu Nov 15 10:06:06 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2237 2018/10/28 00:44:37 uwe Exp $
+#	$NetBSD: mi,v 1.2238 2018/11/15 10:06:06 maxv Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -11235,13 +11235,13 @@
 ./usr/share/man/cat9/m_tag_copy_chain.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/m_tag_delete.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/m_tag_delete_chain.0	comp-sys-catman		.cat
-./usr/share/man/cat9/m_tag_delete_nonpersistent.0	comp-sys-catman		.cat
+./usr/share/man/cat9/m_tag_delete_nonpersistent.0	comp-obsolete		obsolete
 ./usr/share/man/cat9/m_tag_find.0		comp-sys-catman		.cat
-./usr/share/man/cat9/m_tag_first.0		comp-sys-catman		.cat
+./usr/share/man/cat9/m_tag_first.0		comp-obsolete		obsolete
 ./usr/share/man/cat9/m_tag_free.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/m_tag_get.0		comp-sys-catman		.cat
-./usr/share/man/cat9/m_tag_init.0		comp-sys-catman		.cat
-./usr/share/man/cat9/m_tag_next.0		comp-sys-catman		.cat
+./usr/share/man/cat9/m_tag_init.0		comp-obsolete		obsolete
+./usr/share/man/cat9/m_tag_next.0		comp-obsolete		obsolete
 ./usr/share/man/cat9/m_tag_prepend.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/m_tag_unlink.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/makeiplcookie.0		comp-sys-catman		.cat
@@ -19048,13 +19048,13 @@
 ./usr/share/man/html9/m_tag_copy_chain.html	comp-sys-htmlman	html
 ./usr/share/man/html9/m_tag_delete.html		comp-sys-htmlman	html
 ./usr/share/man/html9/m_tag_delete_chain.html	comp-sys-htmlman	html
-./usr/share/man/html9/m_tag_delete_nonpersistent.html	comp-sys-htmlman	html
+./usr/share/man/html9/m_tag_delete_nonpersistent.html	comp-obsolete	obsolete
 ./usr/share/man/html9/m_tag_find.html		comp-sys-htmlman	html
-./usr/share/man/html9/m_tag_first.html		comp-sys-htmlman	html
+./usr/share/man/html9/m_tag_first.html		comp-obsolete	obsolete
 ./usr/share/man/html9/m_tag_free.html		comp-sys-htmlman	html
 ./usr/share/man/html9/m_tag_get.html		comp-sys-htmlman	html
-./usr/share/man/html9/m_tag_init.html		comp-sys-htmlman	html
-./usr/share/man/html9/m_tag_next.html		comp-sys-htmlman	html
+./usr/share/man/html9/m_tag_init.html		comp-obsolete	obsolete
+./usr/share/man/html9/m_tag_next.html		comp-obsolete	obsolete
 ./usr/share/man/html9/m_tag_prepend.html	comp-sys-htmlman	html
 ./usr/share/man/html9/m_tag_unlink.html		comp-sys-htmlman	html
 ./usr/share/man/html9/makeiplcookie.html	comp-sys-htmlman	html
@@ -27015,13 +27015,13 @@
 ./usr/share/man/man9/m_tag_copy_chain.9		comp-sys-man		.man
 ./usr/share/man/man9/m_tag_delete.9		comp-sys-man		.man
 ./usr/share/man/man9/m_tag_delete_chain.9	comp-sys-man		.man
-./usr/share/man/man9/m_tag_delete_nonpersistent.9	comp-sys-man		.man
+./usr/share/man/man9/m_tag_delete_nonpersistent.9	comp-obsolete		obsolete
 ./usr/share/man/man9/m_tag_find.9		comp-sys-man		.man
-./usr/share/man/man9/m_tag_first.9		comp-sys-man		.man
+./usr/share/man/man9/m_tag_first.9		comp-obsolete		obsolete
 ./usr/share/man/man9/m_tag_free.9		comp-sys-man		.man
 ./usr/share/man/man9/m_tag_get.9		comp-sys-man		.man
-./usr/share/man/man9/m_tag_init.9		comp-sys-man		.man
-./usr/share/man/man9/m_tag_next.9		comp-sys-man		.man
+./usr/share/man/man9/m_tag_init.9		comp-obsolete		obsolete
+./usr/share/man/man9/m_tag_next.9		comp-obsolete		obsolete
 ./usr/share/man/man9/m_tag_prepend.9		comp-sys-man		.man
 ./usr/share/man/man9/m_tag_unlink.9		comp-sys-man		.man
 ./usr/share/man/man9/makeiplcookie.9		comp-sys-man		.man

Index: src/share/man/man9/Makefile
diff -u src/share/man/man9/Makefile:1.431 src/share/man/man9/Makefile:1.432
--- 

CVS commit: src

2018-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Nov 15 09:38:57 UTC 2018

Modified Files:
src/share/man/man9: m_tag.9
src/sys/kern: files.kern uipc_mbuf.c
src/sys/rump/librump/rumpnet: Makefile.rumpnet
Removed Files:
src/sys/kern: uipc_mbuf2.c

Log Message:
Merge uipc_mbuf2.c into uipc_mbuf.c. Reorder the latter a little to gather
similar functions. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man9/m_tag.9
cvs rdiff -u -r1.24 -r1.25 src/sys/kern/files.kern
cvs rdiff -u -r1.220 -r1.221 src/sys/kern/uipc_mbuf.c
cvs rdiff -u -r1.33 -r0 src/sys/kern/uipc_mbuf2.c
cvs rdiff -u -r1.22 -r1.23 src/sys/rump/librump/rumpnet/Makefile.rumpnet

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

Modified files:

Index: src/share/man/man9/m_tag.9
diff -u src/share/man/man9/m_tag.9:1.5 src/share/man/man9/m_tag.9:1.6
--- src/share/man/man9/m_tag.9:1.5	Thu Dec  2 12:54:13 2010
+++ src/share/man/man9/m_tag.9	Thu Nov 15 09:38:57 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: m_tag.9,v 1.5 2010/12/02 12:54:13 wiz Exp $
+.\" $NetBSD: m_tag.9,v 1.6 2018/11/15 09:38:57 maxv Exp $
 .\"
 .\" Copyright (c)2004 YAMAMOTO Takashi,
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" 
-.Dd September 7, 2004
+.Dd November 15, 2018
 .Dt M_TAG 9
 .Os
 .Sh NAME
@@ -206,7 +206,7 @@ is the last tag in the chain.
 .\" 
 .Sh CODE REFERENCES
 The mbuf tagging interfaces are implemented within the file
-.Pa sys/kern/uipc_mbuf2.c .
+.Pa sys/kern/uipc_mbuf.c .
 .Pp
 The
 .Dv PACKET_TAG_

Index: src/sys/kern/files.kern
diff -u src/sys/kern/files.kern:1.24 src/sys/kern/files.kern:1.25
--- src/sys/kern/files.kern:1.24	Wed Oct 31 06:26:26 2018
+++ src/sys/kern/files.kern	Thu Nov 15 09:38:57 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.kern,v 1.24 2018/10/31 06:26:26 maxv Exp $
+#	$NetBSD: files.kern,v 1.25 2018/11/15 09:38:57 maxv Exp $
 
 #
 # kernel sources
@@ -174,7 +174,6 @@ file	kern/tty_tty.c			kern
 file	kern/uipc_accf.c		kern
 file	kern/uipc_domain.c		kern
 file	kern/uipc_mbuf.c		kern
-file	kern/uipc_mbuf2.c		kern
 file	kern/uipc_mbufdebug.c		kern & ether
 file	net/link_proto.c		kern	# XXX
 file	kern/uipc_proto.c		kern

Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.220 src/sys/kern/uipc_mbuf.c:1.221
--- src/sys/kern/uipc_mbuf.c:1.220	Fri Oct  5 05:06:48 2018
+++ src/sys/kern/uipc_mbuf.c	Thu Nov 15 09:38:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.220 2018/10/05 05:06:48 msaitoh Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.221 2018/11/15 09:38:57 maxv Exp $	*/
 
 /*
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.220 2018/10/05 05:06:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.221 2018/11/15 09:38:57 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -596,6 +596,27 @@ m_clget(struct mbuf *m, int how)
 	mowner_ref(m, M_EXT|M_EXT_CLUSTER);
 }
 
+struct mbuf *
+m_getcl(int how, int type, int flags)
+{
+	struct mbuf *mp;
+
+	if ((flags & M_PKTHDR) != 0)
+		mp = m_gethdr(how, type);
+	else
+		mp = m_get(how, type);
+
+	if (mp == NULL)
+		return NULL;
+
+	MCLGET(mp, how);
+	if ((mp->m_flags & M_EXT) != 0)
+		return mp;
+
+	m_free(mp);
+	return NULL;
+}
+
 /*
  * Utility function for M_PREPEND. Do *NOT* use it directly.
  */
@@ -1016,6 +1037,167 @@ m_pullup(struct mbuf *n, int len)
 }
 
 /*
+ * ensure that [off, off + len) is contiguous on the mbuf chain "m".
+ * packet chain before "off" is kept untouched.
+ * if offp == NULL, the target will start at  on resulting chain.
+ * if offp != NULL, the target will start at  on resulting chain.
+ *
+ * on error return (NULL return value), original "m" will be freed.
+ *
+ * XXX M_TRAILINGSPACE/M_LEADINGSPACE on shared cluster (sharedcluster)
+ */
+struct mbuf *
+m_pulldown(struct mbuf *m, int off, int len, int *offp)
+{
+	struct mbuf *n, *o;
+	int hlen, tlen, olen;
+	int sharedcluster;
+
+	/* Check invalid arguments. */
+	if (m == NULL)
+		panic("%s: m == NULL", __func__);
+	if (len > MCLBYTES) {
+		m_freem(m);
+		return NULL;
+	}
+
+	n = m;
+	while (n != NULL && off > 0) {
+		if (n->m_len > off)
+			break;
+		off -= n->m_len;
+		n = n->m_next;
+	}
+	/* Be sure to point non-empty mbuf. */
+	while (n != NULL && n->m_len == 0)
+		n = n->m_next;
+	if (!n) {
+		m_freem(m);
+		return NULL;	/* mbuf chain too short */
+	}
+
+	sharedcluster = M_READONLY(n);
+
+	/*
+	 * The target data is on . If we got enough data on the mbuf
+	 * "n", we're done.
+	 */
+#ifdef __NO_STRICT_ALIGNMENT
+	if ((off == 0 || offp) && len <= n->m_len - off && !sharedcluster)
+#else
+	if ((off == 0 || offp) && len <= n->m_len - off && !sharedcluster &&
+	ALIGNED_POINTER((mtod(n, char *) + off), uint32_t))

CVS commit: src/share/mk

2018-11-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 15 09:23:50 UTC 2018

Modified Files:
src/share/mk: bsd.README bsd.own.mk

Log Message:
Explicitly document the incompatibility between USE_PIGZGZIP
and USE_XZ_SETS. Disable the latter if the former is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.385 -r1.386 src/share/mk/bsd.README
cvs rdiff -u -r1.1082 -r1.1083 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.385 src/share/mk/bsd.README:1.386
--- src/share/mk/bsd.README:1.385	Sat Sep 29 06:48:22 2018
+++ src/share/mk/bsd.README	Thu Nov 15 09:23:50 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.README,v 1.385 2018/09/29 06:48:22 martin Exp $
+#	$NetBSD: bsd.README,v 1.386 2018/11/15 09:23:50 martin Exp $
 #	@(#)bsd.README	8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -586,6 +586,9 @@ USE_XZ_SETS	If "no", use the host "gzip"
 		Otherwise use xz to compress things.
 		Default: "yes" for architectures with "enough" memory to
 		decompress, "no" for older ones.
+		This is currently incompatible with USE_PIGZGZIP, setting
+		USE_PIGZGZIP=yes sets USE_XZ_SETS=no by default for all
+		architectures.
 
 COPTS.lib
 OBJCOPTS.lib

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1082 src/share/mk/bsd.own.mk:1.1083
--- src/share/mk/bsd.own.mk:1.1082	Sun Nov 11 18:02:23 2018
+++ src/share/mk/bsd.own.mk	Thu Nov 15 09:23:50 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1082 2018/11/11 18:02:23 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1083 2018/11/15 09:23:50 martin Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1363,7 +1363,12 @@ ${var}?= no
 
 # Default to USE_XZ_SETS on some 64bit architectures where decompressor
 # memory will likely not be in short supply.
-.if ${MACHINE} == "amd64" || ${MACHINE} == "sparc64" || ${MACHINE} == "alpha"
+# Since pigz can not create .xz format files currently, disable .xz
+# format if USE_PIGZGZIP is enabled.
+.if ${USE_PIGZGZIP} == "no" && \
+		(${MACHINE} == "amd64" || \
+		 ${MACHINE} == "sparc64" || \
+		 ${MACHINE} == "alpha")
 USE_XZ_SETS?= yes
 .else
 USE_XZ_SETS?= no