CVS commit: src/sbin/gpt

2015-12-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec  6 00:39:26 UTC 2015

Modified Files:
src/sbin/gpt: gpt.8 gpt.c gpt.h gpt_uuid.c gpt_uuid.h set.c show.c
type.c unset.c

Log Message:
Add listing commands for type, set and unset.
Add help and formatting for set and unset.
Change show to print all the attribute info in one line.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sbin/gpt/gpt.8
cvs rdiff -u -r1.63 -r1.64 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.30 -r1.31 src/sbin/gpt/gpt.h src/sbin/gpt/show.c
cvs rdiff -u -r1.12 -r1.13 src/sbin/gpt/gpt_uuid.c src/sbin/gpt/type.c
cvs rdiff -u -r1.5 -r1.6 src/sbin/gpt/gpt_uuid.h
cvs rdiff -u -r1.11 -r1.12 src/sbin/gpt/set.c src/sbin/gpt/unset.c

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

Modified files:

Index: src/sbin/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.41 src/sbin/gpt/gpt.8:1.42
--- src/sbin/gpt/gpt.8:1.41	Wed Dec  2 07:36:53 2015
+++ src/sbin/gpt/gpt.8	Sat Dec  5 19:39:26 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.41 2015/12/02 12:36:53 christos Exp $
+.\" $NetBSD: gpt.8,v 1.42 2015/12/06 00:39:26 christos Exp $
 .\"
 .\" Copyright (c) 2002 Marcel Moolenaar
 .\" All rights reserved.
@@ -488,26 +488,33 @@ will automatically adjust.
 However, the new disk must use the same sector size as the old disk.
 .\"  set 
 .It Nm Ic set Fl a Ar attribute Fl i Ar index
+.It Nm Ic set Fl l
 The
 .Ic set
 command sets various partition attributes.
 The
+.Fl l
+flag lists all available attributes.
+The
 .Fl a
-option specifies which attributes to set and may be specified more than once.
+option specifies which attributes to set and may be specified more than once,
+or the attributes can be comma-separated.
 The
 .Fl i
 option specifies which entry to update.
 The possible attributes are
 .Do biosboot Dc ,
 .Do bootme Dc ,
-.Do bootonce Dc , and
-.Do bootfailed Dc .
+.Do bootonce Dc ,
+.Do bootfailed Dc ,
+.Do noblockio Dc , and
+.Do required Dc .
 The biosboot flag is used to indicate which partition should be booted
 by legacy BIOS boot code.
 See the
 .Ic biosboot
 command for more information.
-The other three attributes are for compatibility with
+The other attributes are for compatibility with
 .Fx
 and are not currently used by any
 .Nx
@@ -546,8 +553,10 @@ The order of precedence for the options 
 .\"  type 
 .It Nm Ic type Oo Fl a Oc Fl T Ar newtype
 .It Nm Ic type Oo Fl b Ar blocknr Oc Oo Fl i Ar index Oc \
+.It Nm Ic type Oo Fl b Ar blocknr Oc Oo Fl i Ar index Oc \
 Oo Fl L Ar label Oc Oo Fl s Ar sectors Oc Oo Fl t Ar type Oc \
 Fl T Ar newtype
+.It Nm Ic type Fl l
 The
 .Ic type
 command allows the user to change the type of any and all partitions
@@ -556,12 +565,19 @@ It uses the same selection options as th
 .Ic label
 command.
 See above for a description of these options.
+The
+.Fl l
+flag lists available types.
 .\"  unset 
 .It Nm Ic unset Fl a Ar attribute Fl i Ar index
+.It Nm Ic unset Fl l 
 The
 .Ic unset
 command unsets various partition attributes.
 The
+.Fl l
+flag lists all available attributes.
+The
 .Fl a
 option specifies which attributes to unset and may be specified more than once.
 The
@@ -570,14 +586,16 @@ option specifies which entry to update.
 The possible attributes are
 .Do biosboot Dc ,
 .Do bootme Dc ,
-.Do bootonce Dc , and
-.Do bootfailed Dc .
+.Do bootonce Dc ,
+.Do bootfailed Dc ,
+.Do noblockio Dc , and
+.Do required Dc .
 The biosboot flag is used to indicate which partition should be booted
 by legacy BIOS boot code.
 See the
 .Ic biosboot
 command for more information.
-The other three attributes are for compatibility with
+The other attributes are for compatibility with
 .Fx
 and are not currently used by any
 .Nx

Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.63 src/sbin/gpt/gpt.c:1.64
--- src/sbin/gpt/gpt.c:1.63	Fri Dec  4 11:46:24 2015
+++ src/sbin/gpt/gpt.c	Sat Dec  5 19:39:26 2015
@@ -35,7 +35,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.63 2015/12/04 16:46:24 christos Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.64 2015/12/06 00:39:26 christos Exp $");
 #endif
 
 #include 
@@ -1076,21 +1076,90 @@ gpt_check_ais(gpt_t gpt, off_t alignment
 		return size / gpt->secsz;
 	return 0;
 }
+
+static const struct nvd {
+	const char *name;
+	uint64_t mask;
+	const char *description;
+} gpt_attr[] = {
+	{
+		"biosboot",
+		GPT_ENT_ATTR_LEGACY_BIOS_BOOTABLE,
+		"Legacy BIOS boot partition",
+	},
+	{
+		"bootme",
+		GPT_ENT_ATTR_BOOTME,
+		"Bootable partition",
+	},
+	{
+		"bootfailed",
+		GPT_ENT_ATTR_BOOTFAILED,
+		"Partition that marked bootonce failed to boot",
+	},
+	{
+		"bootonce",
+		GPT_ENT_ATTR_BOOTONCE,
+		"Attempt to boot this partition only once",
+	},
+	{
+		"noblockio",
+		GPT_ENT_ATTR_NO_BLOCK_IO_PROTOCOL,
+		"UEFI won't recognize file system for block I/O",
+	},
+	{
+		"requ

CVS commit: src/sys/uvm

2015-12-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Dec  6 09:38:54 UTC 2015

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

Log Message:
Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/uvm/uvm_vnode.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_vnode.c
diff -u src/sys/uvm/uvm_vnode.c:1.101 src/sys/uvm/uvm_vnode.c:1.102
--- src/sys/uvm/uvm_vnode.c:1.101	Sun Dec  6 08:53:22 2015
+++ src/sys/uvm/uvm_vnode.c	Sun Dec  6 09:38:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_vnode.c,v 1.101 2015/12/06 08:53:22 mlelstv Exp $	*/
+/*	$NetBSD: uvm_vnode.c,v 1.102 2015/12/06 09:38:54 wiz Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.101 2015/12/06 08:53:22 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.102 2015/12/06 09:38:54 wiz Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_uvmhist.h"
@@ -356,7 +356,7 @@ uvm_vnp_setsize(struct vnode *vp, voff_t
 	oldsize = vp->v_writesize;
 
 	/*
-	 * check wether size shrinks
+	 * check whether size shrinks
 	 * if old size hasn't been set, there are no pages to drop
 	 * if there was an integer overflow in pgend, then this is no shrink
 	 */



CVS commit: src/sys/dev/ic

2015-12-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  6 09:44:14 UTC 2015

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

Log Message:
KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/spdmem.c

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

Modified files:

Index: src/sys/dev/ic/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.16 src/sys/dev/ic/spdmem.c:1.17
--- src/sys/dev/ic/spdmem.c:1.16	Sat Dec  5 06:54:22 2015
+++ src/sys/dev/ic/spdmem.c	Sun Dec  6 09:44:13 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.16 2015/12/05 06:54:22 pgoyette Exp $ */
+/* $NetBSD: spdmem.c,v 1.17 2015/12/06 09:44:13 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.16 2015/12/05 06:54:22 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.17 2015/12/06 09:44:13 msaitoh Exp $");
 
 #include 
 #include 
@@ -230,7 +230,7 @@ spdmem_common_probe(struct spdmem_softc 
 		if ((unsigned int)spd_len > __arraycount(spd_rom_sizes))
 			return 0;
 		spd_len = spd_rom_sizes[spd_len];
-		spd_crc_cover=125; /* For byte 0 to 125 */
+		spd_crc_cover = 125; /* For byte 0 to 125 */
 		if (spd_crc_cover > spd_len)
 			return 0;
 		crc_calc = spdcrc16(sc, spd_crc_cover);
@@ -862,7 +862,7 @@ decode_ddr4(const struct sysctlnode *nod
 	default:
 		dimm_size = -1;		/* flag invalid value */
 	}
-	if (dimm_size >=0) {
+	if (dimm_size >= 0) {
 		dimm_size = (1 << dimm_size) *
 		(s->sm_ddr4.ddr4_package_ranks + 1); /* log.ranks/DIMM */
 		if (s->sm_ddr4.ddr4_signal_loading == 2) {



CVS commit: src/doc

2015-12-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Dec  6 10:40:51 UTC 2015

Modified Files:
src/doc: 3RDPARTY

Log Message:
gdb-7.10.1 out.


To generate a diff of this commit:
cvs rdiff -u -r1.1265 -r1.1266 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1265 src/doc/3RDPARTY:1.1266
--- src/doc/3RDPARTY:1.1265	Thu Dec  3 10:42:12 2015
+++ src/doc/3RDPARTY	Sun Dec  6 10:40:51 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1265 2015/12/03 10:42:12 taca Exp $
+#	$NetBSD: 3RDPARTY,v 1.1266 2015/12/06 10:40:51 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -451,7 +451,7 @@ Before importing a new version of extern
 
 Package:	gdb
 Version:	7.9.1
-Current Vers:	7.10
+Current Vers:	7.10.1
 Maintainer:	FSF
 Archive Site:	ftp://ftp.gnu.org/gnu/gdb/
 Home Page:	http://www.gnu.org/software/gdb/



CVS commit: src/sys/dev/ic

2015-12-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  6 09:31:20 UTC 2015

Modified Files:
src/sys/dev/ic: spdmemvar.h

Log Message:
Fix the definition of DDR4's tFAW (offset 0x24).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/spdmemvar.h

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

Modified files:

Index: src/sys/dev/ic/spdmemvar.h
diff -u src/sys/dev/ic/spdmemvar.h:1.7 src/sys/dev/ic/spdmemvar.h:1.8
--- src/sys/dev/ic/spdmemvar.h:1.7	Fri May 15 08:44:24 2015
+++ src/sys/dev/ic/spdmemvar.h	Sun Dec  6 09:31:20 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmemvar.h,v 1.7 2015/05/15 08:44:24 msaitoh Exp $ */
+/* $NetBSD: spdmemvar.h,v 1.8 2015/12/06 09:31:20 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Paul Goyette
@@ -806,8 +806,8 @@ struct spdmem_ddr4 {/* Dual Data Rat
 	uint8_t	ddr4_tRFC4min_lsb;
 	uint8_t	ddr4_tRFC4min_msb;
 	SPD_BITFIELD(\
-		uint8_t	ddr4_tFAW_mtb_msb,	\
-		uint8_t	ddr4_unused14, ,	\
+		uint8_t	ddr4_tFAW_mtb_msb:4,	\
+		uint8_t	ddr4_unused14:4, ,	\
 	);
 	uint8_t	ddr4_tFAWmin_mtb_lsb;
 	uint8_t	ddr4_tRRD_Smin_mtb;



CVS commit: src/usr.sbin/gpioctl

2015-12-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Dec  6 07:31:28 UTC 2015

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

Log Message:
pass new pin configuration flags to driver.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/gpioctl/gpioctl.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/gpioctl/gpioctl.c
diff -u src/usr.sbin/gpioctl/gpioctl.c:1.21 src/usr.sbin/gpioctl/gpioctl.c:1.22
--- src/usr.sbin/gpioctl/gpioctl.c:1.21	Thu Jan 29 03:30:06 2015
+++ src/usr.sbin/gpioctl/gpioctl.c	Sun Dec  6 07:31:28 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: gpioctl.c,v 1.21 2015/01/29 03:30:06 christos Exp $ */
+/* $NetBSD: gpioctl.c,v 1.22 2015/12/06 07:31:28 mlelstv Exp $ */
 
 /*
  * Copyright (c) 2008, 2010, 2011, 2013 Marc Balmer 
@@ -64,6 +64,18 @@ static const struct bitstr {
 	{ GPIO_PIN_INVIN, "iin" },
 	{ GPIO_PIN_INVOUT, "iout" },
 	{ GPIO_PIN_PULSATE, "pulsate" },
+	{ GPIO_PIN_ALT0, "alt0" },
+	{ GPIO_PIN_ALT1, "alt1" },
+	{ GPIO_PIN_ALT2, "alt2" },
+	{ GPIO_PIN_ALT3, "alt3" },
+	{ GPIO_PIN_ALT4, "alt4" },
+	{ GPIO_PIN_ALT5, "alt5" },
+	{ GPIO_PIN_ALT6, "alt6" },
+	{ GPIO_PIN_ALT7, "alt7" },
+	{ GPIO_PIN_ALT7, "events" },
+	{ GPIO_PIN_ALT7, "level" },
+	{ GPIO_PIN_ALT7, "falling" },
+	{ GPIO_PIN_USER, "user" },
 	{ 0, NULL },
 };
 



CVS commit: src/share/man/man4

2015-12-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Dec  6 07:40:04 UTC 2015

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

Log Message:
document new pin configuration flags


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/share/man/man4/gpio.4

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

Modified files:

Index: src/share/man/man4/gpio.4
diff -u src/share/man/man4/gpio.4:1.28 src/share/man/man4/gpio.4:1.29
--- src/share/man/man4/gpio.4:1.28	Tue Mar 18 18:20:39 2014
+++ src/share/man/man4/gpio.4	Sun Dec  6 07:40:04 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpio.4,v 1.28 2014/03/18 18:20:39 riastradh Exp $
+.\" $NetBSD: gpio.4,v 1.29 2015/12/06 07:40:04 mlelstv Exp $
 .\"	$OpenBSD: gpio.4,v 1.5 2004/11/23 09:39:29 reyk Exp $
 .\"
 .\" Copyright (c) 2004 Alexander Yurchenko 
@@ -168,6 +168,15 @@ invert input
 invert output
 .It Dv GPIO_PIN_PULSATE
 pulsate output
+.It Dv GPIO_PIN_ALT0 -
+.It Dv GPIO_PIN_ALT7
+select alternate pin function 0 to 7
+.It Dv GPIO_PIN_EVENTS
+deliver events
+.It Dv GPIO_PIN_LEVEL
+trigger on pin level instead of edge
+.It Dv GPIO_PIN_FALLING
+trigger on falling instead of rising edge
 .El
 .Pp
 Note that the GPIO controller



CVS commit: src/share/man/man4

2015-12-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Dec  6 09:38:21 UTC 2015

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

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/share/man/man4/gpio.4

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

Modified files:

Index: src/share/man/man4/gpio.4
diff -u src/share/man/man4/gpio.4:1.29 src/share/man/man4/gpio.4:1.30
--- src/share/man/man4/gpio.4:1.29	Sun Dec  6 07:40:04 2015
+++ src/share/man/man4/gpio.4	Sun Dec  6 09:38:21 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpio.4,v 1.29 2015/12/06 07:40:04 mlelstv Exp $
+.\" $NetBSD: gpio.4,v 1.30 2015/12/06 09:38:21 wiz Exp $
 .\"	$OpenBSD: gpio.4,v 1.5 2004/11/23 09:39:29 reyk Exp $
 .\"
 .\" Copyright (c) 2004 Alexander Yurchenko 
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd June 10, 2013
+.Dd December 6, 2015
 .Dt GPIO 4
 .Os
 .Sh NAME



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

2015-12-06 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec  6 02:21:55 UTC 2015

Modified Files:
src/sys/arch/sh3/dev: scif.c

Log Message:
Make options SCIFCONSOLE patchable via a variable using gdb(1) etc.

Tested on dreamcast.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/sh3/dev/scif.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/sh3/dev/scif.c
diff -u src/sys/arch/sh3/dev/scif.c:1.65 src/sys/arch/sh3/dev/scif.c:1.66
--- src/sys/arch/sh3/dev/scif.c:1.65	Sat Nov 15 19:20:01 2014
+++ src/sys/arch/sh3/dev/scif.c	Sun Dec  6 02:21:55 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: scif.c,v 1.65 2014/11/15 19:20:01 christos Exp $ */
+/*	$NetBSD: scif.c,v 1.66 2015/12/06 02:21:55 tsutsui Exp $ */
 
 /*-
  * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu.  All rights reserved.
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.65 2014/11/15 19:20:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.66 2015/12/06 02:21:55 tsutsui Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_scif.h"
@@ -223,6 +223,10 @@ const struct cdevsw scif_cdevsw = {
 	.d_flag = D_TTY
 };
 
+#ifndef SCIFCONSOLE
+#define SCIFCONSOLE	0
+#endif
+int scifconsole = SCIFCONSOLE;	/* patchable */
 
 /* struct tty */
 static void scifstart(struct tty *);
@@ -1424,11 +1428,10 @@ scifcnprobe(struct consdev *cp)
 
 	/* Initialize required fields. */
 	cp->cn_dev = makedev(maj, 0);
-#ifdef SCIFCONSOLE
-	cp->cn_pri = CN_REMOTE;
-#else
-	cp->cn_pri = CN_NORMAL;
-#endif
+	if (scifconsole)
+		cp->cn_pri = CN_REMOTE;
+	else
+		cp->cn_pri = CN_NORMAL;
 }
 
 void



CVS commit: src/sbin/gpt

2015-12-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Dec  6 09:36:58 UTC 2015

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

Log Message:
Bump date for previous.
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sbin/gpt/gpt.8

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

Modified files:

Index: src/sbin/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.42 src/sbin/gpt/gpt.8:1.43
--- src/sbin/gpt/gpt.8:1.42	Sun Dec  6 00:39:26 2015
+++ src/sbin/gpt/gpt.8	Sun Dec  6 09:36:57 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.42 2015/12/06 00:39:26 christos Exp $
+.\" $NetBSD: gpt.8,v 1.43 2015/12/06 09:36:57 wiz Exp $
 .\"
 .\" Copyright (c) 2002 Marcel Moolenaar
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD: src/sbin/gpt/gpt.8,v 1.17 2006/06/22 22:22:32 marcel Exp $
 .\"
-.Dd November 30, 2015
+.Dd December 6, 2015
 .Dt GPT 8
 .Os
 .Sh NAME
@@ -570,7 +570,7 @@ The
 flag lists available types.
 .\"  unset 
 .It Nm Ic unset Fl a Ar attribute Fl i Ar index
-.It Nm Ic unset Fl l 
+.It Nm Ic unset Fl l
 The
 .Ic unset
 command unsets various partition attributes.



CVS commit: src/sbin/gpt

2015-12-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec  6 04:27:05 UTC 2015

Modified Files:
src/sbin/gpt: gpt_uuid.h migrate.c

Log Message:
remove more duplicated code.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sbin/gpt/gpt_uuid.h
cvs rdiff -u -r1.28 -r1.29 src/sbin/gpt/migrate.c

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

Modified files:

Index: src/sbin/gpt/gpt_uuid.h
diff -u src/sbin/gpt/gpt_uuid.h:1.6 src/sbin/gpt/gpt_uuid.h:1.7
--- src/sbin/gpt/gpt_uuid.h:1.6	Sat Dec  5 19:39:26 2015
+++ src/sbin/gpt/gpt_uuid.h	Sat Dec  5 23:27:05 2015
@@ -46,6 +46,7 @@
 
 // Must match the array in gpt_uuid.c
 typedef enum {
+	GPT_TYPE_INVALID = -1,
 	GPT_TYPE_APPLE_HFS = 0,
 	GPT_TYPE_APPLE_UFS,
 	GPT_TYPE_BIOS,

Index: src/sbin/gpt/migrate.c
diff -u src/sbin/gpt/migrate.c:1.28 src/sbin/gpt/migrate.c:1.29
--- src/sbin/gpt/migrate.c:1.28	Sat Dec  5 13:46:08 2015
+++ src/sbin/gpt/migrate.c	Sat Dec  5 23:27:05 2015
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/migrate.c,v 1.16 2005/09/01 02:42:52 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: migrate.c,v 1.28 2015/12/05 18:46:08 christos Exp $");
+__RCSID("$NetBSD: migrate.c,v 1.29 2015/12/06 04:27:05 christos Exp $");
 #endif
 
 #include 
@@ -118,86 +118,58 @@ mbrptypename(u_int t)
 	return buf;
 }
 
-static struct gpt_ent *
-migrate_disklabel(gpt_t gpt, off_t start, struct gpt_ent *ent)
+static gpt_type_t
+freebsd_fstype_to_gpt_type(gpt_t gpt, u_int i, u_int fstype)
 {
-	char *buf;
-	struct disklabel *dl;
-	off_t ofs, rawofs;
-	int i;
-
-	buf = gpt_read(gpt, start + LABELSECTOR, 1);
-	if (buf == NULL) {
-		gpt_warn(gpt, "Error reading label");
-		return NULL;
-	}
-	dl = (void*)(buf + LABELOFFSET);
-
-	if (le32toh(dl->d_magic) != DISKMAGIC ||
-	le32toh(dl->d_magic2) != DISKMAGIC) {
-		gpt_warnx(gpt, "FreeBSD slice without disklabel");
-		free(buf);
-		return (ent);
-	}
-
-	rawofs = le32toh(dl->d_partitions[RAW_PART].p_offset) *
-	le32toh(dl->d_secsize);
-	for (i = 0; i < le16toh(dl->d_npartitions); i++) {
-		if (dl->d_partitions[i].p_fstype == FS_UNUSED)
-			continue;
-		ofs = le32toh(dl->d_partitions[i].p_offset) *
-		le32toh(dl->d_secsize);
-		if (ofs < rawofs)
-			rawofs = 0;
+	switch (fstype) {
+	case FS_UNUSED:
+		return GPT_TYPE_INVALID;
+	case FS_SWAP:
+		return GPT_TYPE_FREEBSD_SWAP;
+	case FS_BSDFFS:
+		return GPT_TYPE_FREEBSD_UFS;
+	case FREEBSD_FS_VINUM:
+		return GPT_TYPE_FREEBSD_VINUM;
+	case FREEBSD_FS_ZFS:
+		return GPT_TYPE_FREEBSD_ZFS;
+	default:
+		gpt_warnx(gpt, "Unknown FreeBSD partition (%d)", fstype);
+		return GPT_TYPE_INVALID;
 	}
-	rawofs /= gpt->secsz;
-
-	for (i = 0; i < le16toh(dl->d_npartitions); i++) {
-		switch (dl->d_partitions[i].p_fstype) {
-		case FS_UNUSED:
-			continue;
-		case FS_SWAP: {
-			gpt_uuid_create(GPT_TYPE_FREEBSD_SWAP, ent->ent_type,
-			ent->ent_name, sizeof(ent->ent_name));
-			break;
-		}
-		case FS_BSDFFS: {
-			gpt_uuid_create(GPT_TYPE_FREEBSD_UFS, ent->ent_type,
-			ent->ent_name, sizeof(ent->ent_name));
-			break;
-		}
-		case FREEBSD_FS_VINUM: {
-			gpt_uuid_create(GPT_TYPE_FREEBSD_VINUM, ent->ent_type,
-			ent->ent_name, sizeof(ent->ent_name));
-			break;
-		}
-		case FREEBSD_FS_ZFS: {
-			gpt_uuid_create(GPT_TYPE_FREEBSD_ZFS, ent->ent_type,
-			ent->ent_name, sizeof(ent->ent_name));
-			break;
-		}
-		default:
-			gpt_warnx(gpt, "Unknown FreeBSD partition (%d)",
-			dl->d_partitions[i].p_fstype);
-			continue;
-		}
+}
 
-		ofs = (le32toh(dl->d_partitions[i].p_offset) *
-		le32toh(dl->d_secsize)) / gpt->secsz;
-		ofs = (ofs > 0) ? ofs - rawofs : 0;
-		ent->ent_lba_start = htole64((uint64_t)(start + ofs));
-		ent->ent_lba_end = htole64((uint64_t)(start + ofs +
-		(off_t)le32toh((uint64_t)dl->d_partitions[i].p_size)
-		- 1LL));
-		ent++;
+static gpt_type_t
+netbsd_fstype_to_gpt_type(gpt_t gpt, u_int i, u_int fstype)
+{
+	switch (fstype) {
+	case FS_UNUSED:
+		return GPT_TYPE_INVALID;
+	case FS_HFS:
+		return GPT_TYPE_APPLE_HFS;
+	case FS_EX2FS:
+		return GPT_TYPE_LINUX_DATA;
+	case FS_SWAP:
+		return GPT_TYPE_NETBSD_SWAP;
+	case FS_BSDFFS:
+		return GPT_TYPE_NETBSD_FFS;
+	case FS_BSDLFS:
+		return GPT_TYPE_NETBSD_LFS;
+	case FS_RAID:
+		return GPT_TYPE_NETBSD_RAIDFRAME;
+	case FS_CCD:
+		return GPT_TYPE_NETBSD_CCD;
+	case FS_CGD:
+		return GPT_TYPE_NETBSD_CGD;
+	default:
+		gpt_warnx(gpt, "Partition %u unknown type %s, "
+		"using \"Microsoft Basic Data\"", i, fstypename(fstype));
+		return GPT_TYPE_MS_BASIC_DATA;
 	}
-
-	free(buf);
-	return ent;
 }
 
-static struct gpt_ent*
-migrate_netbsd_disklabel(gpt_t gpt, off_t start, struct gpt_ent *ent)
+static struct gpt_ent *
+migrate_disklabel(gpt_t gpt, off_t start, struct gpt_ent *ent,
+gpt_type_t (*convert)(gpt_t, u_int, u_int))
 {
 	char *buf;
 	struct disklabel *dl;
@@ -214,7 +186,7 @@ migrate_netbsd_disklabel(gpt_t gpt, off_
 
 	if (le32toh(dl->d_magic) != DISKMAGIC ||
 	le32

CVS commit: src/sys/uvm

2015-12-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Dec  6 08:53:22 UTC 2015

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

Log Message:
Clean up assertions and catch integer overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/uvm/uvm_vnode.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_vnode.c
diff -u src/sys/uvm/uvm_vnode.c:1.100 src/sys/uvm/uvm_vnode.c:1.101
--- src/sys/uvm/uvm_vnode.c:1.100	Mon Aug 24 22:50:32 2015
+++ src/sys/uvm/uvm_vnode.c	Sun Dec  6 08:53:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_vnode.c,v 1.100 2015/08/24 22:50:32 pooka Exp $	*/
+/*	$NetBSD: uvm_vnode.c,v 1.101 2015/12/06 08:53:22 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.100 2015/08/24 22:50:32 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.101 2015/12/06 08:53:22 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_uvmhist.h"
@@ -348,15 +348,19 @@ uvm_vnp_setsize(struct vnode *vp, voff_t
 	 * toss some pages...
 	 */
 
-	KASSERT(newsize != VSIZENOTSET);
+	KASSERT(newsize != VSIZENOTSET && newsize >= 0);
 	KASSERT(vp->v_size <= vp->v_writesize);
 	KASSERT(vp->v_size == vp->v_writesize ||
 	newsize == vp->v_writesize || newsize <= vp->v_size);
 
 	oldsize = vp->v_writesize;
-	KASSERT(oldsize != VSIZENOTSET || pgend > oldsize);
 
-	if (oldsize > pgend) {
+	/*
+	 * check wether size shrinks
+	 * if old size hasn't been set, there are no pages to drop
+	 * if there was an integer overflow in pgend, then this is no shrink
+	 */
+	if (oldsize > pgend && oldsize != VSIZENOTSET && pgend >= 0) {
 		(void) uvn_put(uobj, pgend, 0, PGO_FREE | PGO_SYNCIO);
 		mutex_enter(uobj->vmobjlock);
 	}
@@ -369,7 +373,7 @@ uvm_vnp_setwritesize(struct vnode *vp, v
 {
 
 	mutex_enter(vp->v_interlock);
-	KASSERT(newsize != VSIZENOTSET);
+	KASSERT(newsize != VSIZENOTSET && newsize >= 0);
 	KASSERT(vp->v_size != VSIZENOTSET);
 	KASSERT(vp->v_writesize != VSIZENOTSET);
 	KASSERT(vp->v_size <= vp->v_writesize);



CVS commit: src/tests/sbin/gpt

2015-12-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec  6 00:38:30 UTC 2015

Modified Files:
src/tests/sbin/gpt: t_gpt.sh

Log Message:
Add test for type, set, unset


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/sbin/gpt/t_gpt.sh

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

Modified files:

Index: src/tests/sbin/gpt/t_gpt.sh
diff -u src/tests/sbin/gpt/t_gpt.sh:1.10 src/tests/sbin/gpt/t_gpt.sh:1.11
--- src/tests/sbin/gpt/t_gpt.sh:1.10	Sat Dec  5 13:53:29 2015
+++ src/tests/sbin/gpt/t_gpt.sh	Sat Dec  5 19:38:30 2015
@@ -1,4 +1,4 @@
-# $NetBSD: t_gpt.sh,v 1.10 2015/12/05 18:53:29 christos Exp $
+# $NetBSD: t_gpt.sh,v 1.11 2015/12/06 00:38:30 christos Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -41,6 +41,12 @@ silence() {
 	atf_check -s exit:0 -o empty -e empty "$@"
 }
 
+inline() {
+	local inline="$1"
+	shift
+	atf_check -s exit:0 -e empty -o inline:"$inline" "$@"
+}
+
 match() {
 	local match="$1"
 	shift
@@ -105,7 +111,6 @@ partlblmsg() {
 
 partbootmsg() {
 	echo "^$disk: Partition $1 marked as bootable\$"
-
 }
 
 recovermsg() {
@@ -117,6 +122,14 @@ migratemsg() {
 	echo 'using "Microsoft Basic Data"$'
 }
 
+attrmsg() {
+	echo "^$disk: Partition $1 attributes updated\$"
+}
+
+typemsg() {
+	echo "^$disk: Partition $1 type changed\$"
+}
+
 atf_test_case create_empty
 create_empty_head() {
 	atf_set "descr" "Create empty disk"
@@ -138,6 +151,38 @@ create_2part_body() {
 	check_2part
 }
 
+atf_test_case change_attr_2part
+change_attr_2part_head() {
+	atf_set "descr" "Change the attribute of 2 partition disk"
+}
+
+change_attr_2part_body() {
+	prepare_2part
+	match "$(attrmsg 1)" gpt set -i 1 -a biosboot,bootme "$disk"
+	save attr gpt show -i 1 "$disk"
+	match "^Attributes: biosboot,bootme\$" tail -1 attr
+	match "$(attrmsg 1)" gpt unset -i 1 -a biosboot,bootme "$disk"
+	save attr gpt show -i 1 "$disk"
+	match "^Attributes: None\$" tail -1 attr
+}
+
+atf_test_case change_type_2part
+change_type_2part_head() {
+	atf_set "descr" "Change the partition type type of 2 partition disk"
+}
+
+change_type_2part_body() {
+	prepare_2part
+	match "$(typemsg 1)" gpt type -i 1 -T apple "$disk"
+	save type gpt show -i 1 "$disk"
+	inline "Type: apple (48465300--11aa-aa11-00306543ecac)\n" \
+	grep "^Type:" type
+	match "$(typemsg 1)" gpt type -i 1 -T efi "$disk"
+	save type gpt show -i 1 "$disk"
+	inline "Type: efi (c12a7328-f81f-11d2-ba4b-00a0c93ec93b)\n" \
+	grep "^Type:" type
+}
+
 atf_test_case backup_2part
 backup_2part_head() {
 	atf_set "descr" "Backup 2 partition disk"
@@ -238,7 +283,7 @@ bootable_2part_body() {
 	silence dd msgfmt=quiet if="$disk" of=bootblk bs=1 count="$bootsz"
 	silence cmp "$bootblk" bootblk
 	save bootattr gpt show -i 2 "$disk"
-	match "^  legacy BIOS boot partition\$" tail -1 bootattr
+	match "^Attributes: biosboot\$" tail -1 bootattr
 }
 
 atf_test_case migrate_disklabel
@@ -258,6 +303,8 @@ migrate_disklabel_body() {
 atf_init_test_cases() {
 	atf_add_test_case create_empty
 	atf_add_test_case create_2part
+	atf_add_test_case change_attr_2part
+	atf_add_test_case change_type_2part
 	atf_add_test_case backup_2part
 	atf_add_test_case remove_2part
 	atf_add_test_case restore_2part



CVS commit: src/sys/arch/dreamcast/dev/maple

2015-12-06 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec  6 02:04:10 UTC 2015

Modified Files:
src/sys/arch/dreamcast/dev/maple: maple.c maplevar.h

Log Message:
Convert tsleep(9)/wakeup(9) pairs to condvar(9) with mutex(9).

Briefly tested with mkbd(4).


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/dreamcast/dev/maple/maple.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/dreamcast/dev/maple/maplevar.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/dreamcast/dev/maple/maple.c
diff -u src/sys/arch/dreamcast/dev/maple/maple.c:1.51 src/sys/arch/dreamcast/dev/maple/maple.c:1.52
--- src/sys/arch/dreamcast/dev/maple/maple.c:1.51	Fri Jul 25 08:10:32 2014
+++ src/sys/arch/dreamcast/dev/maple/maple.c	Sun Dec  6 02:04:10 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: maple.c,v 1.51 2014/07/25 08:10:32 dholland Exp $	*/
+/*	$NetBSD: maple.c,v 1.52 2015/12/06 02:04:10 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.51 2014/07/25 08:10:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.52 2015/12/06 02:04:10 tsutsui Exp $");
 
 #include 
 #include 
@@ -76,6 +76,8 @@ __KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -247,6 +249,11 @@ mapleattach(device_t parent, device_t se
 	maple_polling = 1;
 	maple_scanbus(sc);
 
+	mutex_init(&sc->sc_dma_lock, MUTEX_DEFAULT, IPL_MAPLE);
+	cv_init(&sc->sc_dma_cv, device_xname(self));
+	mutex_init(&sc->sc_event_lock, MUTEX_DEFAULT, IPL_SOFTCLOCK);
+	cv_init(&sc->sc_event_cv, device_xname(self));
+
 	callout_init(&sc->maple_callout_ch, 0);
 
 	sc->sc_intrhand = sysasic_intr_establish(SYSASIC_EVENT_MAPLE_DMADONE,
@@ -835,13 +842,12 @@ maple_command(device_t dev, struct maple
 {
 	struct maple_softc *sc = device_private(dev);
 	struct maple_func *fn;
-	int s;
 
 	KASSERT(func >= 0 && func < 32);
 	KASSERT(command);
 	KASSERT((flags & ~MAPLE_FLAG_CMD_PERIODIC_TIMING) == 0);
 
-	s = splsoftclock();
+	mutex_enter(&sc->sc_event_lock);
 
 	fn = &u->u_func[func];
 #if 1 /*def DIAGNOSTIC*/
@@ -860,9 +866,9 @@ maple_command(device_t dev, struct maple
 	} else {
 		fn->f_cmdstat = MAPLE_CMDSTAT_ASYNC;
 		TAILQ_INSERT_TAIL(&sc->sc_acmdq, fn, f_cmdq);
-		wakeup(&sc->sc_event);	/* wake for async event */
+		cv_broadcast(&sc->sc_event_cv);	/* wake for async event */
 	}
-	splx(s);
+	mutex_exit(&sc->sc_event_lock);
 }
 
 static void
@@ -1422,7 +1428,6 @@ maple_event_thread(void *arg)
 {
 	struct maple_softc *sc = arg;
 	unsigned cnt = 1;	/* timing counter */
-	int s;
 #if defined(MAPLE_DEBUG) && MAPLE_DEBUG > 1
 	int noreq = 0;
 #endif
@@ -1485,19 +1490,19 @@ maple_event_thread(void *arg)
 			/*
 			 * start DMA
 			 */
-			s = splmaple();
+			mutex_enter(&sc->sc_dma_lock);
 			maple_start(sc);
 
 			/*
 			 * wait until DMA done
 			 */
-			if (tsleep(&sc->sc_dmadone, PWAIT, "mdma", hz)
+			if (cv_timedwait(&sc->sc_dma_cv, &sc->sc_dma_lock, hz)
 			== EWOULDBLOCK) {
 /* was DDB active? */
 printf("%s: timed out\n",
 device_xname(sc->sc_dev));
 			}
-			splx(s);
+			mutex_exit(&sc->sc_dma_lock);
 
 			/*
 			 * call handlers
@@ -1522,17 +1527,17 @@ maple_event_thread(void *arg)
 		/*
 		 * wait for an event
 		 */
-		s = splsoftclock();
+		mutex_enter(&sc->sc_event_lock);
 		if (TAILQ_EMPTY(&sc->sc_acmdq) && sc->sc_event == 0 &&
 		TAILQ_EMPTY(&sc->sc_periodicdeferq)) {
-			if (tsleep(&sc->sc_event, PWAIT, "mslp", hz)
-			== EWOULDBLOCK) {
+			if (cv_timedwait(&sc->sc_event_cv, &sc->sc_event_lock,
+			hz) == EWOULDBLOCK) {
 printf("%s: event timed out\n",
 device_xname(sc->sc_dev));
 			}
 
 		}
-		splx(s);
+		mutex_exit(&sc->sc_event_lock);
 
 	}
 
@@ -1547,7 +1552,9 @@ maple_intr(void *arg)
 {
 	struct maple_softc *sc = arg;
 
-	wakeup(&sc->sc_dmadone);
+	mutex_enter(&sc->sc_dma_lock);
+	cv_broadcast(&sc->sc_dma_cv);
+	mutex_exit(&sc->sc_dma_lock);
 
 	return 1;
 }
@@ -1557,8 +1564,10 @@ maple_callout(void *ctx)
 {
 	struct maple_softc *sc = ctx;
 
+	mutex_enter(&sc->sc_event_lock);
 	sc->sc_event = 1;	/* mark as periodic event */
-	wakeup(&sc->sc_event);
+	cv_broadcast(&sc->sc_event_cv);
+	mutex_exit(&sc->sc_event_lock);
 }
 
 /*

Index: src/sys/arch/dreamcast/dev/maple/maplevar.h
diff -u src/sys/arch/dreamcast/dev/maple/maplevar.h:1.14 src/sys/arch/dreamcast/dev/maple/maplevar.h:1.15
--- src/sys/arch/dreamcast/dev/maple/maplevar.h:1.14	Sat Oct 27 17:17:45 2012
+++ src/sys/arch/dreamcast/dev/maple/maplevar.h	Sun Dec  6 02:04:10 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: maplevar.h,v 1.14 2012/10/27 17:17:45 chs Exp $	*/
+/*	$NetBSD: maplevar.h,v 1.15 2015/12/06 02:04:10 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -184,9 +184,13 @@ struct maple_softc {
 	uint32_t sc_txbuf_phys;	/* 29-bit physical address */
 
 	void	*sc_intr

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

2015-12-06 Thread Marty Fouts
Module Name:src
Committed By:   marty
Date:   Sun Dec  6 00:33:44 UTC 2015

Added Files:
src/sys/arch/evbarm/exynos: exynos_machdep.c exynos_start.S platform.h

Log Message:
try 2


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/exynos/exynos_machdep.c \
src/sys/arch/evbarm/exynos/exynos_start.S \
src/sys/arch/evbarm/exynos/platform.h

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

Added files:

Index: src/sys/arch/evbarm/exynos/exynos_machdep.c
diff -u /dev/null src/sys/arch/evbarm/exynos/exynos_machdep.c:1.1
--- /dev/null	Sun Dec  6 00:33:44 2015
+++ src/sys/arch/evbarm/exynos/exynos_machdep.c	Sun Dec  6 00:33:44 2015
@@ -0,0 +1,484 @@
+/*	$NetBSD: exynos_machdep.c,v 1.1 2015/12/06 00:33:44 marty Exp $ */
+
+/*
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Reinoud Zandijk.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: exynos_machdep.c,v 1.1 2015/12/06 00:33:44 marty Exp $");
+
+#include "opt_evbarm_boardtype.h"
+#include "opt_exynos.h"
+#include "opt_machdep.h"
+#include "opt_ddb.h"
+#include "opt_kgdb.h"
+#include "opt_ipkdb.h"
+#include "opt_md.h"
+#include "opt_sscom.h"
+#include "opt_arm_debug.h"
+
+#include "ukbd.h"
+#include "arml2cc.h"	// RPZ why is it not called opt_l2cc.h?
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#ifdef KGDB
+#include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+/* serial console stuff */
+#include "sscom.h"
+#include "opt_sscom.h"
+
+#include 
+#include 
+
+extern const int num_exynos_uarts_entries;
+extern const struct sscom_uart_info exynos_uarts[];
+
+#ifndef CONSPEED
+#define CONSPEED 115200
+#endif	/* CONSPEED */
+#ifndef CONMODE
+#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB | HUPCL)) | CS8) /* 8N1 */
+#endif	/* CONMODE */
+
+static const int conspeed = CONSPEED;
+static const int conmode = CONMODE;
+
+/*
+ * uboot passes 4 arguments to us.
+ *
+ * arg0 arg1 arg2 arg3 : the `bootargs' environment variable from the uboot
+ * context (in PA!)
+ *
+ * Note that the storage has to be in .data and not in .bss. On kernel start
+ * the .bss is cleared and this information would get lost.
+ */
+uintptr_t uboot_args[4] = { 0 };
+
+/*
+ * argument and boot configure storage
+ */
+BootConfig bootconfig;/* for pmap's sake */
+char bootargs[MAX_BOOT_STRING] = "";		/* copied string from uboot */
+char *boot_args = NULL;/* MI bootargs */
+char *boot_file = NULL;/* MI bootfile */
+uint8_t uboot_enaddr[ETHER_ADDR_LEN] = {};
+
+
+/*
+ * kernel start and end from the linker
+ */
+extern char KERNEL_BASE_phys[];	/* physical start of kernel */
+extern char _end[];		/* physical end of kernel */
+#define KERNEL_BASE_PHYS	((paddr_t)KERNEL_BASE_phys)
+
+#define EXYNOS_IOPHYSTOVIRT(a) \
+((vaddr_t)(((a) - EXYNOS_CORE_PBASE) + EXYNOS_CORE_VBASE))
+
+static void exynos_reset(void);
+static void exynos_powerdown(void);
+/* XXX we have no framebuffer implementation yet so com is console XXX */
+int use_fb_console = false;
+
+
+/* prototypes */
+void consinit(void);
+#ifdef KGDB
+static void kgdb_port_init(void);
+#endif
+static void exynos_extract_mac_adress(void);
+void exynos_device_register(device_t 

CVS commit: src/lib/libutil

2015-12-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec  6 14:43:59 UTC 2015

Modified Files:
src/lib/libutil: parsedate.y

Log Message:
Fix west australia offset, from kre


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libutil/parsedate.y

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

Modified files:

Index: src/lib/libutil/parsedate.y
diff -u src/lib/libutil/parsedate.y:1.21 src/lib/libutil/parsedate.y:1.22
--- src/lib/libutil/parsedate.y:1.21	Wed Nov 25 20:00:02 2015
+++ src/lib/libutil/parsedate.y	Sun Dec  6 09:43:59 2015
@@ -14,7 +14,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$NetBSD: parsedate.y,v 1.21 2015/11/26 01:00:02 christos Exp $");
+__RCSID("$NetBSD: parsedate.y,v 1.22 2015/12/06 14:43:59 christos Exp $");
 #endif
 
 #include 
@@ -531,14 +531,14 @@ static const TABLE TimezoneTable[] = {
 { "nst",	tZONE, -HOUR(6.5) },/* North Sumatra */
 { "sst",	tZONE, -HOUR(7) },	/* South Sumatra, USSR Zone 6 */
 #endif	/* 0 */
-{ "wast",	tZONE, -HOUR(7) },	/* West Australian Standard */
-{ "awst",	tZONE, -HOUR(7) },	/* West Australian Standard */
-{ "wadt",	tDAYZONE,  -HOUR(7) },	/* West Australian Daylight */
-{ "awdt",	tDAYZONE,  -HOUR(7) },	/* West Australian Daylight */
 { "ict",	tZONE, -HOUR(7) },	/* Indo China Time (Thai) */
 #if 0	/* this one looks to be bogus */
 { "jt",	tZONE, -HOUR(7.5) },/* Java (3pm in Cronusland!) */
 #endif
+{ "wast",	tZONE, -HOUR(8) },	/* West Australian Standard */
+{ "awst",	tZONE, -HOUR(8) },	/* West Australian Standard */
+{ "wadt",	tDAYZONE,  -HOUR(8) },	/* West Australian Daylight */
+{ "awdt",	tDAYZONE,  -HOUR(8) },	/* West Australian Daylight */
 { "cct",	tZONE, -HOUR(8) },	/* China Coast, USSR Zone 7 */
 { "sgt",	tZONE, -HOUR(8) },	/* Singapore */
 { "hkt",	tZONE, -HOUR(8) },	/* Hong Kong */



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-12-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec  6 15:39:35 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: ohci.c ohcivar.h

Log Message:
Restructure the xfer methods of ohci(4) so that minimal work in done in
softint context.  Now all memory allocation is done in thread context.

Addresses kern/48308 for ohci(4), might fix some locking bugs around the
*TD free lists, and plugs some memory leaks on error conditions.


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.34 -r1.254.2.35 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.55.6.10 -r1.55.6.11 src/sys/dev/usb/ohcivar.h

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

Modified files:

Index: src/sys/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.34 src/sys/dev/usb/ohci.c:1.254.2.35
--- src/sys/dev/usb/ohci.c:1.254.2.34	Wed Dec  2 20:36:50 2015
+++ src/sys/dev/usb/ohci.c	Sun Dec  6 15:39:35 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.254.2.34 2015/12/02 20:36:50 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.254.2.35 2015/12/06 15:39:35 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.34 2015/12/02 20:36:50 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.35 2015/12/06 15:39:35 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -129,15 +129,19 @@ Static void		ohci_free_sed(ohci_softc_t 
 
 Static ohci_soft_td_t  *ohci_alloc_std(ohci_softc_t *);
 Static void		ohci_free_std(ohci_softc_t *, ohci_soft_td_t *);
+Static void		ohci_free_std_locked(ohci_softc_t *, ohci_soft_td_t *);
 
 Static ohci_soft_itd_t *ohci_alloc_sitd(ohci_softc_t *);
 Static void		ohci_free_sitd(ohci_softc_t *,ohci_soft_itd_t *);
+Static void		ohci_free_sitd_locked(ohci_softc_t *,
+			ohci_soft_itd_t *);
 
-Static void		ohci_free_std_chain(ohci_softc_t *, ohci_soft_td_t *,
-	ohci_soft_td_t *);
-Static usbd_status	ohci_alloc_std_chain(struct ohci_pipe *,
-			ohci_softc_t *, int, int, struct usbd_xfer *,
-			ohci_soft_td_t *, ohci_soft_td_t **);
+Static usbd_status	ohci_alloc_std_chain(ohci_softc_t *, struct usbd_xfer *,
+			int, int);
+Static void		ohci_free_stds(ohci_softc_t *, struct ohci_xfer *);
+
+Static void		ohci_reset_std_chain(ohci_softc_t *, struct usbd_xfer *,
+			int, int, ohci_soft_td_t *, ohci_soft_td_t **);
 
 Static usbd_status	ohci_open(struct usbd_pipe *);
 Static void		ohci_poll(struct usbd_bus *);
@@ -174,24 +178,32 @@ Static void		ohci_root_intr_abort(struct
 Static void		ohci_root_intr_close(struct usbd_pipe *);
 Static void		ohci_root_intr_done(struct usbd_xfer *);
 
+Static int		ohci_device_ctrl_init(struct usbd_xfer *);
+Static void		ohci_device_ctrl_fini(struct usbd_xfer *);
 Static usbd_status	ohci_device_ctrl_transfer(struct usbd_xfer *);
 Static usbd_status	ohci_device_ctrl_start(struct usbd_xfer *);
 Static void		ohci_device_ctrl_abort(struct usbd_xfer *);
 Static void		ohci_device_ctrl_close(struct usbd_pipe *);
 Static void		ohci_device_ctrl_done(struct usbd_xfer *);
 
+Static int		ohci_device_bulk_init(struct usbd_xfer *);
+Static void		ohci_device_bulk_fini(struct usbd_xfer *);
 Static usbd_status	ohci_device_bulk_transfer(struct usbd_xfer *);
 Static usbd_status	ohci_device_bulk_start(struct usbd_xfer *);
 Static void		ohci_device_bulk_abort(struct usbd_xfer *);
 Static void		ohci_device_bulk_close(struct usbd_pipe *);
 Static void		ohci_device_bulk_done(struct usbd_xfer *);
 
+Static int		ohci_device_intr_init(struct usbd_xfer *);
+Static void		ohci_device_intr_fini(struct usbd_xfer *);
 Static usbd_status	ohci_device_intr_transfer(struct usbd_xfer *);
 Static usbd_status	ohci_device_intr_start(struct usbd_xfer *);
 Static void		ohci_device_intr_abort(struct usbd_xfer *);
 Static void		ohci_device_intr_close(struct usbd_pipe *);
 Static void		ohci_device_intr_done(struct usbd_xfer *);
 
+Static int		ohci_device_isoc_init(struct usbd_xfer *);
+Static void		ohci_device_isoc_fini(struct usbd_xfer *);
 Static usbd_status	ohci_device_isoc_transfer(struct usbd_xfer *);
 Static usbd_status	ohci_device_isoc_start(struct usbd_xfer *);
 Static void		ohci_device_isoc_abort(struct usbd_xfer *);
@@ -289,6 +301,8 @@ Static const struct usbd_pipe_methods oh
 };
 
 Static const struct usbd_pipe_methods ohci_device_ctrl_methods = {
+	.upm_init =	ohci_device_ctrl_init,
+	.upm_fini =	ohci_device_ctrl_fini,
 	.upm_transfer =	ohci_device_ctrl_transfer,
 	.upm_start =	ohci_device_ctrl_start,
 	.upm_abort =	ohci_device_ctrl_abort,
@@ -298,6 +312,8 @@ Static const struct usbd_pipe_methods oh
 };
 
 Static const struct usbd_pipe_methods ohci_device_intr_methods = {
+	.upm_init =	ohci_device_intr_init,
+	.upm_fini =	ohci_device_intr_fini,
 	.upm_transfer =	ohci_device_intr_transfer,
 	.upm_start =	ohci_device_intr_start,
 	.upm_abort =	ohci_device_intr_abort,
@@ -307,6 +323,8 @@ Static const struct usbd_pipe_methods oh
 };
 
 

CVS import: src/crypto/external/bsd/openssl/dist

2015-12-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec  6 21:45:59 UTC 2015

Update of /cvsroot/src/crypto/external/bsd/openssl/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv25079

Log Message:
Import openssl-1.0.1q

OpenSSL Security Advisory [3 Dec 2015] - Updated [4 Dec 2015]
=

[Updated 4 Dec 2015]: This advisory has been updated to include the details of
CVE-2015-1794, a Low severity issue affecting OpenSSL 1.0.2 which had a fix
included in the released packages but was missed from the advisory text.

NOTE: WE ANTICIPATE THAT 1.0.0t AND 0.9.8zh WILL BE THE LAST RELEASES FOR THE
0.9.8 AND 1.0.0 VERSIONS AND THAT NO MORE SECURITY FIXES WILL BE PROVIDED (AS
PER PREVIOUS ANNOUNCEMENTS). USERS ARE ADVISED TO UPGRADE TO LATER VERSIONS.

BN_mod_exp may produce incorrect results on x86_64 (CVE-2015-3193)
==

Severity: Moderate

There is a carry propagating bug in the x86_64 Montgomery squaring procedure. No
EC algorithms are affected. Analysis suggests that attacks against RSA and DSA
as a result of this defect would be very difficult to perform and are not
believed likely. Attacks against DH are considered just feasible (although very
difficult) because most of the work necessary to deduce information
about a private key may be performed offline. The amount of resources
required for such an attack would be very significant and likely only
accessible to a limited number of attackers. An attacker would
additionally need online access to an unpatched system using the target
private key in a scenario with persistent DH parameters and a private
key that is shared between multiple clients. For example this can occur by
default in OpenSSL DHE based SSL/TLS ciphersuites.

This issue affects OpenSSL version 1.0.2.

OpenSSL 1.0.2 users should upgrade to 1.0.2e

This issue was reported to OpenSSL on August 13 2015 by Hanno
B�ck. The fix was developed by Andy Polyakov of the OpenSSL
development team.

Certificate verify crash with missing PSS parameter (CVE-2015-3194)
===

Severity: Moderate

The signature verification routines will crash with a NULL pointer dereference
if presented with an ASN.1 signature using the RSA PSS algorithm and absent
mask generation function parameter. Since these routines are used to verify
certificate signature algorithms this can be used to crash any certificate
verification operation and exploited in a DoS attack. Any application which
performs certificate verification is vulnerable including OpenSSL clients and
servers which enable client authentication.

This issue affects OpenSSL versions 1.0.2 and 1.0.1.

OpenSSL 1.0.2 users should upgrade to 1.0.2e
OpenSSL 1.0.1 users should upgrade to 1.0.1q

This issue was reported to OpenSSL on August 27 2015 by Lo�c Jonas Etienne
(Qnective AG). The fix was developed by Dr. Stephen Henson of the OpenSSL
development team.

X509_ATTRIBUTE memory leak (CVE-2015-3195)
==

Severity: Moderate

When presented with a malformed X509_ATTRIBUTE structure OpenSSL will leak
memory. This structure is used by the PKCS#7 and CMS routines so any
application which reads PKCS#7 or CMS data from untrusted sources is affected.
SSL/TLS is not affected.

This issue affects OpenSSL versions 1.0.2 and 1.0.1, 1.0.0 and 0.9.8.

OpenSSL 1.0.2 users should upgrade to 1.0.2e
OpenSSL 1.0.1 users should upgrade to 1.0.1q
OpenSSL 1.0.0 users should upgrade to 1.0.0t
OpenSSL 0.9.8 users should upgrade to 0.9.8zh

This issue was reported to OpenSSL on November 9 2015 by Adam Langley
(Google/BoringSSL) using libFuzzer. The fix was developed by Dr. Stephen
Henson of the OpenSSL development team.

Race condition handling PSK identify hint (CVE-2015-3196)
=

Severity: Low

If PSK identity hints are received by a multi-threaded client then
the values are wrongly updated in the parent SSL_CTX structure. This can
result in a race condition potentially leading to a double free of the
identify hint data.

This issue was fixed in OpenSSL 1.0.2d and 1.0.1p but has not been previously
listed in an OpenSSL security advisory. This issue also affects OpenSSL 1.0.0
and has not been previously fixed in an OpenSSL 1.0.0 release.

OpenSSL 1.0.2 users should upgrade to 1.0.2d
OpenSSL 1.0.1 users should upgrade to 1.0.1p
OpenSSL 1.0.0 users should upgrade to 1.0.0t

The fix for this issue can be identified in the OpenSSL git repository by commit
ids 3c66a669dfc7 (1.0.2), d6be3124f228 (1.0.1) and 1392c238657e (1.0.0).

The fix was developed by Dr. Stephen Henson of the OpenSSL development team.

Anon DH ServerKeyExchange with 0 p parameter (CVE-2015-1794)


Severity: Low

If a client receives a ServerKeyExchange for an anonymous DH ciphersuite with

CVS commit: src/doc

2015-12-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec  6 21:54:26 UTC 2015

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new openssl


To generate a diff of this commit:
cvs rdiff -u -r1.1266 -r1.1267 src/doc/3RDPARTY
cvs rdiff -u -r1.2115 -r1.2116 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1266 src/doc/3RDPARTY:1.1267
--- src/doc/3RDPARTY:1.1266	Sun Dec  6 05:40:51 2015
+++ src/doc/3RDPARTY	Sun Dec  6 16:54:26 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1266 2015/12/06 10:40:51 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1267 2015/12/06 21:54:26 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1038,8 +1038,8 @@ markus is very cooperative about it):
 - make compile with gcc-4.5; const fixes, fileno() checks, shadow fixes.
 
 Package:	OpenSSL
-Version:	1.0.1p
-Current Vers:	1.0.2d
+Version:	1.0.1q
+Current Vers:	1.0.2e
 Maintainer:	The OpenSSL Project
 Archive Site:	ftp://ftp.openssl.org/source/
 Home Page:	http://www.openssl.org/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2115 src/doc/CHANGES:1.2116
--- src/doc/CHANGES:1.2115	Tue Dec  1 05:36:15 2015
+++ src/doc/CHANGES	Sun Dec  6 16:54:26 2015
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2115 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2116 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -223,3 +223,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	cpuctl(8): Most commands can specify more than one CPU now.
 		[mrg 20151115]
 	dhcpcd: Import dhcpcd 6.9.4. [roy 20151130]
+	openssl: Import openssl 1.0.1q [christos 20151206]



CVS commit: src/libexec/httpd

2015-12-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Dec  7 03:11:48 UTC 2015

Modified Files:
src/libexec/httpd: printenv.lua

Log Message:
Improve the httpd(8) printenv.lua Lua example

Stop using Lua builtin print function and replace them with http.* ones.
httpd.print and http.write wraps SSL support when needed.

Print http headers, without them browser may interpret page as raw text.

No need to hardcode prefix path in the form.

Add comments for a user with tips how to use this script.

Patch by Travis Paul

Closes PR misc/50502


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/libexec/httpd/printenv.lua

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

Modified files:

Index: src/libexec/httpd/printenv.lua
diff -u src/libexec/httpd/printenv.lua:1.2 src/libexec/httpd/printenv.lua:1.3
--- src/libexec/httpd/printenv.lua:1.2	Thu Jan  2 08:21:38 2014
+++ src/libexec/httpd/printenv.lua	Mon Dec  7 03:11:48 2015
@@ -1,4 +1,4 @@
--- $NetBSD: printenv.lua,v 1.2 2014/01/02 08:21:38 mrg Exp $
+-- $NetBSD: printenv.lua,v 1.3 2015/12/07 03:11:48 kamil Exp $
 
 -- this small Lua script demonstrates the use of Lua in (bozo)httpd
 -- it will simply output the "environment"
@@ -8,6 +8,10 @@
 -- the same value on each invocation.  You can not keep state between
 -- two calls.
 
+-- You can test this example by running the following command:
+-- /usr/libexec/httpd -b -f -I 8080 -L test printenv.lua .
+-- and then navigate to: http://127.0.0.1:8080/test/printenv
+
 local httpd = require 'httpd'
 
 function printenv(env, headers, query)
@@ -15,12 +19,14 @@ function printenv(env, headers, query)
 	-- we get the "environment" in the env table, the values are more
 	-- or less the same as the variable for a CGI program
 
-	if count == nil then
-		count = 1
-	end
-
-	-- output a header
-	print([[
+	-- output headers using httpd.write()
+	-- httpd.write() will not append newlines
+	httpd.write("HTTP/1.1 200 Ok\r\n")
+	httpd.write("Content-Type: text/html\r\n\r\n")
+
+	-- output html using httpd.print()
+	-- you can also use print() and io.write() but they will not work with SSL
+	httpd.print([[
 		
 			
 Bozotic Lua Environment
@@ -29,54 +35,58 @@ function printenv(env, headers, query)
 Bozotic Lua Environment
 	]])
 
-	print('module version: ' .. httpd._VERSION .. '')
+	httpd.print('module version: ' .. httpd._VERSION .. '')
 
-	print('Server Environment')
+	httpd.print('Server Environment')
 	-- print the list of "environment" variables
 	for k, v in pairs(env) do
-		print(k .. '=' .. v .. '')
+		httpd.print(k .. '=' .. v .. '')
 	end
 
-	print('Request Headers')
+	httpd.print('Request Headers')
 	for k, v in pairs(headers) do
-		print(k .. '=' .. v .. '')
+		httpd.print(k .. '=' .. v .. '')
 	end
 
 	if query ~= nil then
-		print('Query Variables')
+		httpd.print('Query Variables')
 		for k, v in pairs(query) do
-			print(k .. '=' .. v .. '')
+			httpd.print(k .. '=' .. v .. '')
 		end
 	end
 
-	print('Form Test')
+	httpd.print('Form Test')
 
-	print([[
-	
+	httpd.print([[
+	
 	
 	
 	
 	]])
 	-- output a footer
-	print([[
+	httpd.print([[
 		
 	
 	]])
 end
 
 function form(env, header, query)
+
+	httpd.write("HTTP/1.1 200 Ok\r\n")
+	httpd.write("Content-Type: text/html\r\n\r\n")
+
 	if query ~= nil then
-		print('Form Variables')
+		httpd.print('Form Variables')
 
 		if env.CONTENT_TYPE ~= nil then
-			print('Content-type: ' .. env.CONTENT_TYPE .. '')
+			httpd.print('Content-type: ' .. env.CONTENT_TYPE .. '')
 		end
 
 		for k, v in pairs(query) do
-			print(k .. '=' .. v .. '')
+			httpd.print(k .. '=' .. v .. '')
 		end
 	else
-		print('No values')
+		httpd.print('No values')
 	end
 end
 



CVS commit: src

2015-12-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Dec  7 03:25:58 UTC 2015

Modified Files:
src/distrib/sets/lists/modules: mi
src/sys/compat/common: kern_time_50.c
src/sys/dev: clockctl.c
src/sys/modules: Makefile
Added Files:
src/sys/modules/clockctl: Makefile clockctl.ioconf

Log Message:
Modularize the clockctl pseudo-device and link to the build.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r1.29 -r1.30 src/sys/compat/common/kern_time_50.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/clockctl.c
cvs rdiff -u -r1.162 -r1.163 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/clockctl/Makefile \
src/sys/modules/clockctl/clockctl.ioconf

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/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.80 src/distrib/sets/lists/modules/mi:1.81
--- src/distrib/sets/lists/modules/mi:1.80	Thu Dec  3 02:57:47 2015
+++ src/distrib/sets/lists/modules/mi	Mon Dec  7 03:25:57 2015
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.80 2015/12/03 02:57:47 pgoyette Exp $
+# $NetBSD: mi,v 1.81 2015/12/07 03:25:57 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -34,6 +34,8 @@
 ./@MODULEDIR@/cgd/cgd.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/chfsbase-kernel-modules	kmod
 ./@MODULEDIR@/chfs/chfs.kmod			base-kernel-modules	kmod
+./@MODULEDIR@/clockctlbase-kernel-modules	kmod
+./@MODULEDIR@/clockctl/clockctl.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/codabase-kernel-modules	kmod
 ./@MODULEDIR@/coda/coda.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/coda5base-kernel-modules	kmod

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.29 src/sys/compat/common/kern_time_50.c:1.30
--- src/sys/compat/common/kern_time_50.c:1.29	Fri Jul 24 13:02:52 2015
+++ src/sys/compat/common/kern_time_50.c	Mon Dec  7 03:25:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.29 2015/07/24 13:02:52 maxv Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.30 2015/12/07 03:25:57 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.29 2015/07/24 13:02:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.30 2015/12/07 03:25:57 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -542,71 +542,6 @@ compat_50_sys___ntp_gettime30(struct lwp
 	return ENOSYS;
 #endif
 }
-int
-compat50_clockctlioctl(dev_t dev, u_long cmd, void *data, int flags,
-struct lwp *l)
-{
-	int error = 0;
-	const struct cdevsw *cd = cdevsw_lookup(dev);
-
-	if (cd == NULL || cd->d_ioctl == NULL)
-		return ENXIO;
-
-	switch (cmd) {
-	case CLOCKCTL_OSETTIMEOFDAY: {
-		struct timeval50 tv50;
-		struct timeval tv;
-		struct clockctl50_settimeofday *args = data;
-
-		error = copyin(args->tv, &tv50, sizeof(tv50));
-		if (error)
-			return (error);
-		timeval50_to_timeval(&tv50, &tv);
-		error = settimeofday1(&tv, false, args->tzp, l, false);
-		break;
-	}
-	case CLOCKCTL_OADJTIME: {
-		struct timeval atv, oldatv;
-		struct timeval50 atv50;
-		struct clockctl50_adjtime *args = data;
-
-		if (args->delta) {
-			error = copyin(args->delta, &atv50, sizeof(atv50));
-			if (error)
-return (error);
-			timeval50_to_timeval(&atv50, &atv);
-		}
-		adjtime1(args->delta ? &atv : NULL,
-		args->olddelta ? &oldatv : NULL, l->l_proc);
-		if (args->olddelta) {
-			timeval_to_timeval50(&oldatv, &atv50);
-			error = copyout(&atv50, args->olddelta, sizeof(atv50));
-		}
-		break;
-	}
-	case CLOCKCTL_OCLOCK_SETTIME: {
-		struct timespec50 tp50;
-		struct timespec tp;
-		struct clockctl50_clock_settime *args = data;
-
-		error = copyin(args->tp, &tp50, sizeof(tp50));
-		if (error)
-			return (error);
-		timespec50_to_timespec(&tp50, &tp);
-		error = clock_settime1(l->l_proc, args->clock_id, &tp, true);
-		break;
-	}
-	case CLOCKCTL_ONTP_ADJTIME:
-		/* The ioctl number changed but the data did not change. */
-		error = (cd->d_ioctl)(dev, CLOCKCTL_NTP_ADJTIME,
-		data, flags, l);
-		break;
-	default:
-		error = EINVAL;
-	}
-
-	return (error);
-}
 
 void
 compat_sysctl_time(struct sysctllog **clog)

Index: src/sys/dev/clockctl.c
diff -u src/sys/dev/clockctl.c:1.32 src/sys/dev/clockctl.c:1.33
--- src/sys/dev/clockctl.c:1.32	Fri Jul 25 08:10:35 2014
+++ src/sys/dev/clockctl.c	Mon Dec  7 03:25:57 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: clockctl.c,v 1.32 2014/07/25 08:10:35 dholland Exp $ */
+/*  $NetBSD: clockctl.c,v 1.33 2015/12/07 03:25:57 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,10 +31,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.32 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cloc

CVS commit: src/sbin/drvctl

2015-12-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Dec  7 03:34:00 UTC 2015

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

Log Message:
synch usage() with the man page.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sbin/drvctl/drvctl.c

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

Modified files:

Index: src/sbin/drvctl/drvctl.c
diff -u src/sbin/drvctl/drvctl.c:1.17 src/sbin/drvctl/drvctl.c:1.18
--- src/sbin/drvctl/drvctl.c:1.17	Tue Feb 24 18:15:29 2015
+++ src/sbin/drvctl/drvctl.c	Mon Dec  7 03:34:00 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: drvctl.c,v 1.17 2015/02/24 18:15:29 mlelstv Exp $ */
+/* $NetBSD: drvctl.c,v 1.18 2015/12/07 03:34:00 pgoyette Exp $ */
 
 /*
  * Copyright (c) 2004
@@ -55,7 +55,7 @@ usage(void)
 	fprintf(stderr, "Usage: %s -r [-a attribute] busdevice [locator ...]\n"
 	"   %s -d device\n"
 	"   %s [-nt] -l [device]\n"
-	"   %s [-n] -p device [prop]\n"
+	"   %s [-n] -p device [property]\n"
 	"   %s -Q device\n"
 	"   %s -R device\n"
 	"   %s -S device\n",



CVS commit: src/sys/netinet6

2015-12-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Dec  7 06:19:13 UTC 2015

Modified Files:
src/sys/netinet6: nd6.c nd6.h nd6_nbr.c

Log Message:
CID 1341546: Fix integer handling issue (CONSTANT_EXPRESSION_RESULT)

n > INT_MAX where n is a long integer variable never be true on 32bit
architectures. Use time_t(int64_t) instead of long for the variable.


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/sys/netinet6/nd6.c
cvs rdiff -u -r1.68 -r1.69 src/sys/netinet6/nd6.h
cvs rdiff -u -r1.112 -r1.113 src/sys/netinet6/nd6_nbr.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/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.181 src/sys/netinet6/nd6.c:1.182
--- src/sys/netinet6/nd6.c:1.181	Wed Nov 25 06:21:26 2015
+++ src/sys/netinet6/nd6.c	Mon Dec  7 06:19:13 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.181 2015/11/25 06:21:26 ozaki-r Exp $	*/
+/*	$NetBSD: nd6.c,v 1.182 2015/12/07 06:19:13 ozaki-r Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.181 2015/11/25 06:21:26 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.182 2015/12/07 06:19:13 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -391,9 +391,10 @@ skip1:
  * ND6 timer routine to handle ND6 entries
  */
 void
-nd6_llinfo_settimer_locked(struct llentry *ln, long xtick)
+nd6_llinfo_settimer_locked(struct llentry *ln, time_t xtick)
 {
 
+	CTASSERT(sizeof(time_t) > sizeof(int));
 	LLE_WLOCK_ASSERT(ln);
 
 	if (xtick < 0) {
@@ -416,7 +417,7 @@ nd6_llinfo_settimer_locked(struct llentr
 }
 
 void
-nd6_llinfo_settimer(struct llentry *ln, long xtick)
+nd6_llinfo_settimer(struct llentry *ln, time_t xtick)
 {
 
 	LLE_WLOCK(ln);
@@ -535,7 +536,7 @@ nd6_llinfo_timer(void *arg)
 	case ND6_LLINFO_REACHABLE:
 		if (!ND6_LLINFO_PERMANENT(ln)) {
 			ln->ln_state = ND6_LLINFO_STALE;
-			nd6_llinfo_settimer_locked(ln, (long)nd6_gctimer * hz);
+			nd6_llinfo_settimer_locked(ln, nd6_gctimer * hz);
 		}
 		break;
 
@@ -557,7 +558,7 @@ nd6_llinfo_timer(void *arg)
 			send_ns = true;
 		} else {
 			ln->ln_state = ND6_LLINFO_STALE; /* XXX */
-			nd6_llinfo_settimer_locked(ln, (long)nd6_gctimer * hz);
+			nd6_llinfo_settimer_locked(ln, nd6_gctimer * hz);
 		}
 		break;
 	case ND6_LLINFO_PROBE:
@@ -575,7 +576,7 @@ nd6_llinfo_timer(void *arg)
 	if (send_ns) {
 		struct in6_addr src, *psrc;
 
-		nd6_llinfo_settimer_locked(ln, (long)ndi->retrans * hz / 1000);
+		nd6_llinfo_settimer_locked(ln, ndi->retrans * hz / 1000);
 		psrc = nd6_llinfo_get_holdsrc(ln, &src);
 		LLE_FREE_LOCKED(ln);
 		ln = NULL;
@@ -1135,7 +1136,7 @@ nd6_free(struct rtentry *rt, struct llen
 (dr->expire - time_uptime) * hz);
 			else
 nd6_llinfo_settimer_locked(ln,
-(long)nd6_gctimer * hz);
+nd6_gctimer * hz);
 			splx(s);
 			return;
 		}
@@ -1230,7 +1231,7 @@ nd6_nud_hint(struct rtentry *rt)
 	ln->ln_state = ND6_LLINFO_REACHABLE;
 	if (!ND6_LLINFO_PERMANENT(ln)) {
 		nd6_llinfo_settimer(ln,
-		(long)ND_IFINFO(rt->rt_ifp)->reachable * hz);
+		ND_IFINFO(rt->rt_ifp)->reachable * hz);
 	}
 
 	return;
@@ -2140,7 +2141,7 @@ fail:
 			 * we must set the timer now, although it is actually
 			 * meaningless.
 			 */
-			nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz);
+			nd6_llinfo_settimer(ln, nd6_gctimer * hz);
 
 			nd6_llinfo_release_pkts(ln, ifp, rt);
 		} else if (ln->ln_state == ND6_LLINFO_INCOMPLETE) {
@@ -2432,7 +2433,7 @@ nd6_output(struct ifnet *ifp, struct ifn
 	if ((ifp->if_flags & IFF_POINTOPOINT) != 0 &&
 	ln->ln_state < ND6_LLINFO_REACHABLE) {
 		ln->ln_state = ND6_LLINFO_STALE;
-		nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz);
+		nd6_llinfo_settimer(ln, nd6_gctimer * hz);
 	}
 
 	/*
@@ -2445,7 +2446,7 @@ nd6_output(struct ifnet *ifp, struct ifn
 	if (ln->ln_state == ND6_LLINFO_STALE) {
 		ln->ln_asked = 0;
 		ln->ln_state = ND6_LLINFO_DELAY;
-		nd6_llinfo_settimer(ln, (long)nd6_delay * hz);
+		nd6_llinfo_settimer(ln, nd6_delay * hz);
 	}
 
 	/*
@@ -2496,7 +2497,7 @@ nd6_output(struct ifnet *ifp, struct ifn
 
 		ln->ln_asked++;
 		nd6_llinfo_settimer(ln,
-		(long)ND_IFINFO(ifp)->retrans * hz / 1000);
+		ND_IFINFO(ifp)->retrans * hz / 1000);
 		psrc = nd6_llinfo_get_holdsrc(ln, &src);
 		nd6_ns_output(ifp, NULL, &dst->sin6_addr, psrc, 0);
 	}

Index: src/sys/netinet6/nd6.h
diff -u src/sys/netinet6/nd6.h:1.68 src/sys/netinet6/nd6.h:1.69
--- src/sys/netinet6/nd6.h:1.68	Wed Nov 25 06:21:26 2015
+++ src/sys/netinet6/nd6.h	Mon Dec  7 06:19:13 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.h,v 1.68 2015/11/25 06:21:26 ozaki-r Exp $	*/
+/*	$NetBSD: nd6.h,v 1.69 2015/12/07 06:19:13 ozaki-r Exp $	*/
 /*	$KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $	*/
 
 /*
@@ -400,8 +400,8 @@ struct nd_opt_hdr *nd6_option(union nd_o
 int nd6_options(union nd_opts *);
 struct	rtentry *nd6_lookup(const struct in6_addr 

CVS commit: src/sys/sys

2015-12-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Dec  7 06:28:22 UTC 2015

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

Log Message:
Forgot this file in previous commit (modularization of clockctl(4))


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/sys/clockctl.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/clockctl.h
diff -u src/sys/sys/clockctl.h:1.16 src/sys/sys/clockctl.h:1.17
--- src/sys/sys/clockctl.h:1.16	Sun Sep  6 06:01:02 2015
+++ src/sys/sys/clockctl.h	Mon Dec  7 06:28:22 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: clockctl.h,v 1.16 2015/09/06 06:01:02 dholland Exp $ */
+/*  $NetBSD: clockctl.h,v 1.17 2015/12/07 06:28:22 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -72,6 +72,7 @@ voidclockctlattach(int);
 int clockctlopen(dev_t, int, int, struct lwp *);
 int clockctlclose(dev_t, int, int, struct lwp *);
 int clockctlioctl(dev_t, u_long, void *, int, struct lwp *);
+int	clockctl_init(void);
 #endif
 
 #endif /* _SYS_CLOCKCTL_H_ */