CVS commit: src/sbin/gpt

2013-11-21 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Fri Nov 22 04:21:02 UTC 2013

Modified Files:
src/sbin/gpt: add.c label.c remove.c

Log Message:
change the "-b blocknr" parameter to accept a "human number"


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/gpt/add.c
cvs rdiff -u -r1.11 -r1.12 src/sbin/gpt/label.c
cvs rdiff -u -r1.9 -r1.10 src/sbin/gpt/remove.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/add.c
diff -u src/sbin/gpt/add.c:1.18 src/sbin/gpt/add.c:1.19
--- src/sbin/gpt/add.c:1.18	Fri Nov 22 03:50:05 2013
+++ src/sbin/gpt/add.c	Fri Nov 22 04:21:02 2013
@@ -29,7 +29,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: add.c,v 1.18 2013/11/22 03:50:05 jnemeth Exp $");
+__RCSID("$NetBSD: add.c,v 1.19 2013/11/22 04:21:02 jnemeth Exp $");
 #endif
 
 #include 
@@ -212,9 +212,9 @@ cmd_add(int argc, char *argv[])
 		case 'b':
 			if (block > 0)
 usage_add();
-			block = strtoll(optarg, &p, 10);
-			if (*p != 0 || block < 1)
+			if (dehumanize_number(optarg, &human_num) < 0)
 usage_add();
+			block = human_num;
 			break;
 		case 'i':
 			if (entry > 0)

Index: src/sbin/gpt/label.c
diff -u src/sbin/gpt/label.c:1.11 src/sbin/gpt/label.c:1.12
--- src/sbin/gpt/label.c:1.11	Fri Nov 22 03:50:05 2013
+++ src/sbin/gpt/label.c	Fri Nov 22 04:21:02 2013
@@ -29,7 +29,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/label.c,v 1.3 2006/10/04 18:20:25 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: label.c,v 1.11 2013/11/22 03:50:05 jnemeth Exp $");
+__RCSID("$NetBSD: label.c,v 1.12 2013/11/22 04:21:02 jnemeth Exp $");
 #endif
 
 #include 
@@ -186,6 +186,7 @@ cmd_label(int argc, char *argv[])
 {
 	char *p;
 	int ch, fd;
+	int64_t human_num;
 
 	/* Get the label options */
 	while ((ch = getopt(argc, argv, "ab:f:i:l:s:t:")) != -1) {
@@ -198,9 +199,9 @@ cmd_label(int argc, char *argv[])
 		case 'b':
 			if (block > 0)
 usage_label();
-			block = strtoll(optarg, &p, 10);
-			if (*p != 0 || block < 1)
+			if (dehumanize_number(optarg, &human_num) < 0)
 usage_label();
+			block = human_num;
 			break;
 		case 'f':
 			if (name != NULL)

Index: src/sbin/gpt/remove.c
diff -u src/sbin/gpt/remove.c:1.9 src/sbin/gpt/remove.c:1.10
--- src/sbin/gpt/remove.c:1.9	Fri Nov 22 03:50:05 2013
+++ src/sbin/gpt/remove.c	Fri Nov 22 04:21:02 2013
@@ -29,7 +29,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.10 2006/10/04 18:20:25 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: remove.c,v 1.9 2013/11/22 03:50:05 jnemeth Exp $");
+__RCSID("$NetBSD: remove.c,v 1.10 2013/11/22 04:21:02 jnemeth Exp $");
 #endif
 
 #include 
@@ -158,6 +158,7 @@ cmd_remove(int argc, char *argv[])
 {
 	char *p;
 	int ch, fd;
+	int64_t human_num;
 
 	/* Get the remove options */
 	while ((ch = getopt(argc, argv, "ab:i:s:t:")) != -1) {
@@ -170,9 +171,9 @@ cmd_remove(int argc, char *argv[])
 		case 'b':
 			if (block > 0)
 usage_remove();
-			block = strtoll(optarg, &p, 10);
-			if (*p != 0 || block < 1)
+			if (dehumanize_number(optarg, &human_num) < 0)
 usage_remove();
+			block = human_num;
 			break;
 		case 'i':
 			if (entry > 0)



CVS commit: src/sbin/gpt

2013-11-21 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Fri Nov 22 03:51:06 UTC 2013

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

Log Message:
bump date


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 src/sbin/gpt/gpt.8:1.20
--- src/sbin/gpt/gpt.8:1.19	Fri Nov 22 03:50:05 2013
+++ src/sbin/gpt/gpt.8	Fri Nov 22 03:51:06 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.19 2013/11/22 03:50:05 jnemeth Exp $
+.\" $NetBSD: gpt.8,v 1.20 2013/11/22 03:51:06 jnemeth 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 20, 2013
+.Dd November 21, 2013
 .Dt GPT 8
 .Os
 .Sh NAME



CVS commit: src/sbin/gpt

2013-11-21 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Fri Nov 22 03:50:05 UTC 2013

Modified Files:
src/sbin/gpt: add.c gpt.8 label.c remove.c resize.c

Log Message:
In the manpage:
- s/-b number/-b blocknr/
- s/-s count/-s sectors/
- s/-p count/-p partitions/

In the program:
- s/-b lba/-b blocknr/
- s/-s lba/-s sectors/

This makes the documentation in the manpage and the program consistent
and makes it more clear what the parameters are.  Also, "-s lba" was
just plain wrong since LBA stands for Logical Block Address[ing], and
the -s option didn't represent any kind of address, but rather a size.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sbin/gpt/add.c
cvs rdiff -u -r1.18 -r1.19 src/sbin/gpt/gpt.8
cvs rdiff -u -r1.10 -r1.11 src/sbin/gpt/label.c
cvs rdiff -u -r1.8 -r1.9 src/sbin/gpt/remove.c
cvs rdiff -u -r1.1 -r1.2 src/sbin/gpt/resize.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/add.c
diff -u src/sbin/gpt/add.c:1.17 src/sbin/gpt/add.c:1.18
--- src/sbin/gpt/add.c:1.17	Tue Nov 19 22:41:43 2013
+++ src/sbin/gpt/add.c	Fri Nov 22 03:50:05 2013
@@ -29,7 +29,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: add.c,v 1.17 2013/11/19 22:41:43 jnemeth Exp $");
+__RCSID("$NetBSD: add.c,v 1.18 2013/11/22 03:50:05 jnemeth Exp $");
 #endif
 
 #include 
@@ -50,8 +50,8 @@ static off_t alignment, block, size;
 static unsigned int entry;
 static uint8_t *name;
 
-const char addmsg1[] = "add [-a alignment] [-b lba] [-i index] [-l label]";
-const char addmsg2[] = "[-s lba] [-t type] device ...";
+const char addmsg1[] = "add [-a alignment] [-b blocknr] [-i index] [-l label]";
+const char addmsg2[] = "[-s sectors] [-t type] device ...";
 
 __dead static void
 usage_add(void)

Index: src/sbin/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.18 src/sbin/gpt/gpt.8:1.19
--- src/sbin/gpt/gpt.8:1.18	Wed Nov 20 08:11:36 2013
+++ src/sbin/gpt/gpt.8	Fri Nov 22 03:50:05 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.18 2013/11/20 08:11:36 wiz Exp $
+.\" $NetBSD: gpt.8,v 1.19 2013/11/22 03:50:05 jnemeth Exp $
 .\"
 .\" Copyright (c) 2002 Marcel Moolenaar
 .\" All rights reserved.
@@ -68,7 +68,7 @@ Not all commands use all default setting
 have an effect on all commands.
 .Pp
 The
-.Fl p Ar count
+.Fl p Ar partitions
 option allows the user to change the number of partitions the GPT can
 accommodate.
 This is used whenever a new GPT is created.
@@ -94,8 +94,8 @@ There is no formalized definition of the
 .Ss Commands
 .Bl -tag -width indent
 .\"  add 
-.It Nm Ic add Oo Fl a Ar alignment Oc Oo Fl b Ar number Oc \
-Oo Fl i Ar index Oc Oo Fl l Ar label Oc Oo Fl s Ar count Oc \
+.It Nm Ic add Oo Fl a Ar alignment Oc 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 Ar device ...
 The
 .Ic add
@@ -113,7 +113,7 @@ will attempt to align the partition.
 If it can not, then it will attempt to create an unaligned partition.
 .Pp
 The
-.Fl b Ar number
+.Fl b Ar blocknr
 option allows the user to specify the starting (beginning) sector number of
 the partition.
 The minimum sector number is 1, but has to fall inside an unused region of
@@ -130,7 +130,7 @@ The
 option allows the user to specify a label for the partition.
 .Pp
 The
-.Fl s Ar count
+.Fl s Ar sectors
 option allows the user to specify the size of the partition in sectors.
 The minimum size is 1.
 .Pp
@@ -200,8 +200,8 @@ option instructs
 to destroy the table in a way that it can be recovered.
 .\"  label 
 .It Nm Ic label Oo Fl a Oc Ao Fl f Ar file | Fl l Ar label Ac Ar device ...
-.It Nm Ic label Oo Fl b Ar number Oc Oo Fl i Ar index Oc \
-Oo Fl s Ar count Oc Oo Fl t Ar type Oc \
+.It Nm Ic label Oo Fl b Ar blocknr Oc Oo Fl i Ar index Oc \
+Oo Fl s Ar sectors Oc Oo Fl t Ar type Oc \
 Ao Fl f Ar file | Fl l Ar label Ac Ar device ...
 The
 .Ic label
@@ -214,7 +214,7 @@ option specifies that all partitions sho
 It is mutually exclusive with all other selection options.
 .Pp
 The
-.Fl b Ar number
+.Fl b Ar blocknr
 option selects the partition that starts at the given block number.
 .Pp
 The
@@ -222,7 +222,7 @@ The
 option selects the partition with the given partition number.
 .Pp
 The
-.Fl s Ar count
+.Fl s Ar sectors
 option selects all partitions that have the given size.
 This can cause multiple partitions to be labeled.
 .Pp
@@ -304,8 +304,8 @@ near the end of the disk.
 It is very useful in case the primary label was deleted.
 .\"  remove 
 .It Nm Ic remove Oo Fl a Oc Ar device ...
-.It Nm Ic remove Oo Fl b Ar number Oc Oo Fl i Ar index Oc \
-Oo Fl s Ar count Oc Oo Fl t Ar type Oc Ar device ...
+.It Nm Ic remove Oo Fl b Ar blocknr Oc Oo Fl i Ar index Oc \
+Oo Fl s Ar sectors Oc Oo Fl t Ar type Oc Ar device ...
 The
 .Ic remove
 command allows the user to remove any and all partitions

CVS commit: src/sys/ufs/lfs

2013-11-21 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri Nov 22 02:02:35 UTC 2013

Modified Files:
src/sys/ufs/lfs: ulfs_quota.c

Log Message:
fix typo; hi christos


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/ufs/lfs/ulfs_quota.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/ufs/lfs/ulfs_quota.c
diff -u src/sys/ufs/lfs/ulfs_quota.c:1.9 src/sys/ufs/lfs/ulfs_quota.c:1.10
--- src/sys/ufs/lfs/ulfs_quota.c:1.9	Sat Nov 16 17:15:30 2013
+++ src/sys/ufs/lfs/ulfs_quota.c	Fri Nov 22 02:02:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulfs_quota.c,v 1.9 2013/11/16 17:15:30 dholland Exp $	*/
+/*	$NetBSD: ulfs_quota.c,v 1.10 2013/11/22 02:02:35 dholland Exp $	*/
 /*  from NetBSD: ufs_quota.c,v 1.115 2013/11/16 17:04:53 dholland Exp  */
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ulfs_quota.c,v 1.9 2013/11/16 17:15:30 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulfs_quota.c,v 1.10 2013/11/22 02:02:35 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -496,7 +496,7 @@ quota_handle_cmd_cursorget(struct mount 
 		
 #ifdef LFS_QUOTA2
 	if (fs->um_flags & ULFS_QUOTA2) {
-		struct quotacursor *cursor = args->u.cursorget.qc_cursor;
+		struct quotakcursor *cursor = args->u.cursorget.qc_cursor;
 		struct quotakey *keys = args->u.cursorget.qc_keys;
 		struct quotaval *vals = args->u.cursorget.qc_vals;
 		unsigned maxnum = args->u.cursorget.qc_maxnum;



CVS commit: src/sys/net/npf

2013-11-21 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Nov 22 01:48:36 UTC 2013

Modified Files:
src/sys/net/npf: npf_inet.c

Log Message:
Optimise checksum fixup routines:
- npf_fixup16_cksum: 1's complement sum is endian-independent.
- npf_fixup32_cksum: the first 32->16 bit reduction is not needed.

Pointed out by Valery Ushakov.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/net/npf/npf_inet.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/net/npf/npf_inet.c
diff -u src/sys/net/npf/npf_inet.c:1.26 src/sys/net/npf/npf_inet.c:1.27
--- src/sys/net/npf/npf_inet.c:1.26	Fri Nov 22 01:24:21 2013
+++ src/sys/net/npf/npf_inet.c	Fri Nov 22 01:48:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_inet.c,v 1.26 2013/11/22 01:24:21 rmind Exp $	*/
+/*	$NetBSD: npf_inet.c,v 1.27 2013/11/22 01:48:36 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.26 2013/11/22 01:24:21 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.27 2013/11/22 01:48:36 rmind Exp $");
 
 #include 
 #include 
@@ -60,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v
 #include "npf_impl.h"
 
 /*
- * npf_fixup{16,32}_cksum: update IPv4 checksum.
+ * npf_fixup{16,32}_cksum: incremental update of the Internet checksum.
  */
 
 uint16_t
@@ -71,22 +71,33 @@ npf_fixup16_cksum(uint16_t cksum, uint16
 	/*
 	 * RFC 1624:
 	 *	HC' = ~(~HC + ~m + m')
+	 *
+	 * Note: 1's complement sum is endian-independent (RFC 1071, page 2).
 	 */
-	sum = ~ntohs(cksum) & 0x;
-	sum += (~ntohs(odatum) & 0x) + ntohs(ndatum);
+	sum = ~cksum & 0x;
+	sum += (~odatum & 0x) + ndatum;
 	sum = (sum >> 16) + (sum & 0x);
 	sum += (sum >> 16);
 
-	return htons(~sum & 0x);
+	return ~sum & 0x;
 }
 
 uint16_t
 npf_fixup32_cksum(uint16_t cksum, uint32_t odatum, uint32_t ndatum)
 {
+	uint32_t sum;
 
-	cksum = npf_fixup16_cksum(cksum, odatum & 0x, ndatum & 0x);
-	cksum = npf_fixup16_cksum(cksum, odatum >> 16, ndatum >> 16);
-	return cksum;
+	/*
+	 * Checksum 32-bit datum as as two 16-bit.  Note, the first
+	 * 32->16 bit reduction is not necessary.
+	 */
+	sum = ~cksum & 0x;
+	sum += (~odatum & 0x) + (ndatum & 0x);
+
+	sum += (~odatum >> 16) + (ndatum >> 16);
+	sum = (sum >> 16) + (sum & 0x);
+	sum += (sum >> 16);
+	return ~sum & 0x;
 }
 
 /*



CVS commit: src/sys/net/npf

2013-11-21 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Nov 22 01:24:21 UTC 2013

Modified Files:
src/sys/net/npf: npf_impl.h npf_inet.c npf_session.c

Log Message:
npf_addr_mix: use xor rather than sum.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.25 -r1.26 src/sys/net/npf/npf_inet.c
cvs rdiff -u -r1.27 -r1.28 src/sys/net/npf/npf_session.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/net/npf/npf_impl.h
diff -u src/sys/net/npf/npf_impl.h:1.41 src/sys/net/npf/npf_impl.h:1.42
--- src/sys/net/npf/npf_impl.h:1.41	Fri Nov 22 00:25:51 2013
+++ src/sys/net/npf/npf_impl.h	Fri Nov 22 01:24:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_impl.h,v 1.41 2013/11/22 00:25:51 rmind Exp $	*/
+/*	$NetBSD: npf_impl.h,v 1.42 2013/11/22 01:24:21 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -193,7 +193,7 @@ uint16_t	npf_fixup16_cksum(uint16_t, uin
 uint16_t	npf_fixup32_cksum(uint16_t, uint32_t, uint32_t);
 uint16_t	npf_addr_cksum(uint16_t, int, const npf_addr_t *,
 		const npf_addr_t *);
-uint32_t	npf_addr_sum(const int, const npf_addr_t *, const npf_addr_t *);
+uint32_t	npf_addr_mix(const int, const npf_addr_t *, const npf_addr_t *);
 int		npf_addr_cmp(const npf_addr_t *, const npf_netmask_t,
 		const npf_addr_t *, const npf_netmask_t, const int);
 void		npf_addr_mask(const npf_addr_t *, const npf_netmask_t,

Index: src/sys/net/npf/npf_inet.c
diff -u src/sys/net/npf/npf_inet.c:1.25 src/sys/net/npf/npf_inet.c:1.26
--- src/sys/net/npf/npf_inet.c:1.25	Wed Oct 30 08:41:38 2013
+++ src/sys/net/npf/npf_inet.c	Fri Nov 22 01:24:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_inet.c,v 1.25 2013/10/30 08:41:38 mrg Exp $	*/
+/*	$NetBSD: npf_inet.c,v 1.26 2013/11/22 01:24:21 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.25 2013/10/30 08:41:38 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.26 2013/11/22 01:24:21 rmind Exp $");
 
 #include 
 #include 
@@ -109,20 +109,19 @@ npf_addr_cksum(uint16_t cksum, int sz, c
 }
 
 /*
- * npf_addr_sum: provide IP address as a summed (if needed) 32-bit integer.
+ * npf_addr_sum: provide IP addresses as a XORed 32-bit integer.
  * Note: used for hash function.
  */
 uint32_t
-npf_addr_sum(const int sz, const npf_addr_t *a1, const npf_addr_t *a2)
+npf_addr_mix(const int sz, const npf_addr_t *a1, const npf_addr_t *a2)
 {
 	uint32_t mix = 0;
-	int i;
 
 	KASSERT(sz > 0 && a1 != NULL && a2 != NULL);
 
-	for (i = 0; i < (sz >> 2); i++) {
-		mix += a1->s6_addr32[i];
-		mix += a2->s6_addr32[i];
+	for (int i = 0; i < (sz >> 2); i++) {
+		mix ^= a1->s6_addr32[i];
+		mix ^= a2->s6_addr32[i];
 	}
 	return mix;
 }

Index: src/sys/net/npf/npf_session.c
diff -u src/sys/net/npf/npf_session.c:1.27 src/sys/net/npf/npf_session.c:1.28
--- src/sys/net/npf/npf_session.c:1.27	Fri Nov  8 00:38:26 2013
+++ src/sys/net/npf/npf_session.c	Fri Nov 22 01:24:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_session.c,v 1.27 2013/11/08 00:38:26 rmind Exp $	*/
+/*	$NetBSD: npf_session.c,v 1.28 2013/11/22 01:24:21 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2010-2013 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_session.c,v 1.27 2013/11/08 00:38:26 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_session.c,v 1.28 2013/11/22 01:24:21 rmind Exp $");
 
 #include 
 #include 
@@ -314,7 +314,7 @@ sess_hash_bucket(npf_sehash_t *stbl, con
 
 	mix[0] = (scid->proto ^ scid->ifid) << 16;
 	mix[0] |= sen->se_src_id ^ sen->se_dst_id;
-	mix[1] = npf_addr_sum(sz, &sen->se_src_addr, &sen->se_dst_addr);
+	mix[1] = npf_addr_mix(sz, &sen->se_src_addr, &sen->se_dst_addr);
 	hash = murmurhash2(mix, sizeof(mix), sess_hash_seed);
 
 	return &stbl[hash & SESS_HASH_MASK];



CVS commit: src/sys/arch/i386/i386

2013-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Nov 22 01:09:11 UTC 2013

Modified Files:
src/sys/arch/i386/i386: vector.S

Log Message:
Include i386_trap_ipkdb.S so the ALL kernel links.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/i386/i386/vector.S

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

Modified files:

Index: src/sys/arch/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.62 src/sys/arch/i386/i386/vector.S:1.63
--- src/sys/arch/i386/i386/vector.S:1.62	Tue Jun 25 00:27:22 2013
+++ src/sys/arch/i386/i386/vector.S	Fri Nov 22 01:09:11 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.62 2013/06/25 00:27:22 uebayasi Exp $	*/
+/*	$NetBSD: vector.S,v 1.63 2013/11/22 01:09:11 riz Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.62 2013/06/25 00:27:22 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.63 2013/11/22 01:09:11 riz Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -734,6 +734,9 @@ END(xenev_stubs)
 #endif /* XEN */
 
 #include "i386_trap.S"
+#ifdef IPKDB
+#include "i386_trap_ipkdb.S"
+#endif
 
 #ifdef XEN
 



CVS commit: src/sys/arch/i386/i386

2013-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Nov 22 01:07:20 UTC 2013

Modified Files:
src/sys/arch/i386/i386: i386_trap_ipkdb.S

Log Message:
Remove stray #ifdef leftover from file split.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/i386/i386_trap_ipkdb.S

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

Modified files:

Index: src/sys/arch/i386/i386/i386_trap_ipkdb.S
diff -u src/sys/arch/i386/i386/i386_trap_ipkdb.S:1.1 src/sys/arch/i386/i386/i386_trap_ipkdb.S:1.2
--- src/sys/arch/i386/i386/i386_trap_ipkdb.S:1.1	Tue Jun 25 00:27:22 2013
+++ src/sys/arch/i386/i386/i386_trap_ipkdb.S	Fri Nov 22 01:07:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386_trap_ipkdb.S,v 1.1 2013/06/25 00:27:22 uebayasi Exp $	*/
+/*	$NetBSD: i386_trap_ipkdb.S,v 1.2 2013/11/22 01:07:20 riz Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i386_trap_ipkdb.S,v 1.1 2013/06/25 00:27:22 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386_trap_ipkdb.S,v 1.2 2013/11/22 01:07:20 riz Exp $");
 #endif
 
 #ifdef IPKDB
@@ -156,6 +156,3 @@ fault:
 	iret
 END(ipkdbsbyte)
 #endif	/* IPKDB */
-
-#ifdef XEN
-



CVS commit: src

2013-11-21 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Nov 22 00:25:51 UTC 2013

Modified Files:
src/lib/libnpf: npf.c npf.h
src/sys/net/npf: npf_conf.c npf_impl.h npf_tableset.c
src/usr.sbin/npf/npfctl: npf_build.c npf_data.c npf_show.c

Log Message:
Add npf_tableset_syncdict() to sync the table IDs in the proplib dictionary,
as they can change on reload now.  Also, fix table name checking in npfctl.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libnpf/npf.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libnpf/npf.h
cvs rdiff -u -r1.4 -r1.5 src/sys/net/npf/npf_conf.c
cvs rdiff -u -r1.40 -r1.41 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.19 -r1.20 src/sys/net/npf/npf_tableset.c
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/npf/npfctl/npf_build.c
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/npf/npfctl/npf_data.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/npf/npfctl/npf_show.c

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

Modified files:

Index: src/lib/libnpf/npf.c
diff -u src/lib/libnpf/npf.c:1.23 src/lib/libnpf/npf.c:1.24
--- src/lib/libnpf/npf.c:1.23	Tue Nov 12 00:46:34 2013
+++ src/lib/libnpf/npf.c	Fri Nov 22 00:25:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf.c,v 1.23 2013/11/12 00:46:34 rmind Exp $	*/
+/*	$NetBSD: npf.c,v 1.24 2013/11/22 00:25:51 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2010-2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.23 2013/11/12 00:46:34 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.24 2013/11/22 00:25:51 rmind Exp $");
 
 #include 
 #include 
@@ -962,15 +962,17 @@ npf_table_add_entry(nl_table_t *tl, int 
 }
 
 bool
-npf_table_exists_p(nl_config_t *ncf, u_int tid)
+npf_table_exists_p(nl_config_t *ncf, const char *name)
 {
 	prop_dictionary_t tldict;
 	prop_object_iterator_t it;
-	u_int i;
 
 	it = prop_array_iterator(ncf->ncf_table_list);
 	while ((tldict = prop_object_iterator_next(it)) != NULL) {
-		if (prop_dictionary_get_uint32(tldict, "id", &i) && tid == i)
+		const char *tname = NULL;
+
+		if (prop_dictionary_get_cstring_nocopy(tldict, "name", &tname)
+		&& strcmp(tname, name) == 0)
 			break;
 	}
 	prop_object_iterator_release(it);
@@ -981,12 +983,12 @@ int
 npf_table_insert(nl_config_t *ncf, nl_table_t *tl)
 {
 	prop_dictionary_t tldict = tl->ntl_dict;
-	u_int tid;
+	const char *name = NULL;
 
-	if (!prop_dictionary_get_uint32(tldict, "id", &tid)) {
+	if (!prop_dictionary_get_cstring_nocopy(tldict, "name", &name)) {
 		return EINVAL;
 	}
-	if (npf_table_exists_p(ncf, tid)) {
+	if (npf_table_exists_p(ncf, name)) {
 		return EEXIST;
 	}
 	prop_array_add(ncf->ncf_table_list, tldict);

Index: src/lib/libnpf/npf.h
diff -u src/lib/libnpf/npf.h:1.20 src/lib/libnpf/npf.h:1.21
--- src/lib/libnpf/npf.h:1.20	Tue Nov 12 00:46:34 2013
+++ src/lib/libnpf/npf.h	Fri Nov 22 00:25:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf.h,v 1.20 2013/11/12 00:46:34 rmind Exp $	*/
+/*	$NetBSD: npf.h,v 1.21 2013/11/22 00:25:51 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2011-2013 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@ int		npf_nat_insert(nl_config_t *, nl_na
 nl_table_t *	npf_table_create(const char *, u_int, int);
 int		npf_table_add_entry(nl_table_t *, int,
 		const npf_addr_t *, const npf_netmask_t);
-bool		npf_table_exists_p(nl_config_t *, u_int);
+bool		npf_table_exists_p(nl_config_t *, const char *);
 int		npf_table_insert(nl_config_t *, nl_table_t *);
 void		npf_table_destroy(nl_table_t *);
 

Index: src/sys/net/npf/npf_conf.c
diff -u src/sys/net/npf/npf_conf.c:1.4 src/sys/net/npf/npf_conf.c:1.5
--- src/sys/net/npf/npf_conf.c:1.4	Tue Nov 12 00:46:34 2013
+++ src/sys/net/npf/npf_conf.c	Fri Nov 22 00:25:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_conf.c,v 1.4 2013/11/12 00:46:34 rmind Exp $	*/
+/*	$NetBSD: npf_conf.c,v 1.5 2013/11/22 00:25:51 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_conf.c,v 1.4 2013/11/12 00:46:34 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_conf.c,v 1.5 2013/11/22 00:25:51 rmind Exp $");
 
 #include 
 #include 
@@ -166,6 +166,9 @@ npf_config_reload(prop_dictionary_t dict
 	if (flush) {
 		npf_ifmap_flush();
 	}
+
+	/* Sync the config proplib data. */
+	npf_tableset_syncdict(tset, dict);
 	mutex_exit(&npf_config_lock);
 
 	/* Finally, it is safe to destroy the old config. */

Index: src/sys/net/npf/npf_impl.h
diff -u src/sys/net/npf/npf_impl.h:1.40 src/sys/net/npf/npf_impl.h:1.41
--- src/sys/net/npf/npf_impl.h:1.40	Sat Nov 16 01:18:58 2013
+++ src/sys/net/npf/npf_impl.h	Fri Nov 22 00:25:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_impl.h,v 1.40 2013/11/16 01:18:58 rmind Exp $	*/
+/*	$NetBSD: npf_impl.h,v 1.41 2013/11/22 00:25:51 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -224,6 +224,7 @@ int		npf_tableset_insert(npf_tableset_t 
 npf_table_t *	npf_tableset_getbyname(npf_tableset_t *

CVS commit: src/sys/dev/ic

2013-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Nov 22 00:01:09 UTC 2013

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

Log Message:
Put back and properly mark a variable which is used iff ATW_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/dev/ic/atw.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/atw.c
diff -u src/sys/dev/ic/atw.c:1.155 src/sys/dev/ic/atw.c:1.156
--- src/sys/dev/ic/atw.c:1.155	Thu Oct 17 21:24:24 2013
+++ src/sys/dev/ic/atw.c	Fri Nov 22 00:01:09 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atw.c,v 1.155 2013/10/17 21:24:24 christos Exp $  */
+/*	$NetBSD: atw.c,v 1.156 2013/11/22 00:01:09 riz Exp $  */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.155 2013/10/17 21:24:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.156 2013/11/22 00:01:09 riz Exp $");
 
 
 #include 
@@ -167,7 +167,7 @@ static int	atw_rf3000_read(struct atw_so
 static void	atw_si4126_print(struct atw_softc *);
 static int	atw_si4126_read(struct atw_softc *, u_int, u_int *);
 #	endif /* ATW_SYNDEBUG */
-
+#define __atwdebugused	/* empty */
 #else
 #define ATW_DPRINTF(x)
 #define ATW_DPRINTF2(x)
@@ -175,6 +175,7 @@ static int	atw_si4126_read(struct atw_so
 #define	DPRINTF(sc, x)	/* nothing */
 #define	DPRINTF2(sc, x)	/* nothing */
 #define	DPRINTF3(sc, x)	/* nothing */
+#define __atwdebugused	__unused
 #endif
 
 /* ifnet methods */
@@ -902,6 +903,7 @@ void
 atw_reset(struct atw_softc *sc)
 {
 	int i;
+	uint32_t lpc __atwdebugused;
 
 	ATW_WRITE(sc, ATW_NAR, 0x0);
 	DELAY(atw_nar_delay);
@@ -948,7 +950,7 @@ atw_reset(struct atw_softc *sc)
 
 	DELAY(atw_magic_delay4);
 
-	(void)ATW_READ(sc, ATW_LPC);
+	lpc = ATW_READ(sc, ATW_LPC);
 
 	DPRINTF(sc, ("%s: ATW_LPC %#08x\n", __func__, lpc));
 



CVS commit: src/sys/fs/udf

2013-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 21 23:42:09 UTC 2013

Modified Files:
src/sys/fs/udf: udf_subr.c

Log Message:
Don't create a variable just to assert() on it - assert on the
thing the variable got assigned.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/fs/udf/udf_subr.c

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

Modified files:

Index: src/sys/fs/udf/udf_subr.c
diff -u src/sys/fs/udf/udf_subr.c:1.121 src/sys/fs/udf/udf_subr.c:1.122
--- src/sys/fs/udf/udf_subr.c:1.121	Fri Oct 18 19:56:55 2013
+++ src/sys/fs/udf/udf_subr.c	Thu Nov 21 23:42:09 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.121 2013/10/18 19:56:55 christos Exp $ */
+/* $NetBSD: udf_subr.c,v 1.122 2013/11/21 23:42:09 riz Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.121 2013/10/18 19:56:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.122 2013/11/21 23:42:09 riz Exp $");
 #endif /* not lint */
 
 
@@ -4764,7 +4764,6 @@ udf_dir_detach(struct udf_mount *ump, st
 	struct dirhash   *dirh;
 	struct dirhash_entry *dirh_ep;
 	struct file_entry*fe  = dir_node->fe;
-	struct extfile_entry *efe = dir_node->efe;
 	struct fileid_desc *fid;
 	struct dirent *dirent;
 	uint64_t diroffset;
@@ -4785,7 +4784,7 @@ udf_dir_detach(struct udf_mount *ump, st
 
 	/* get directory filesize */
 	if (!fe) {
-		assert(efe);
+		assert(dir_node->efe);
 	}
 
 	/* allocate temporary space for fid */



CVS commit: src/sys/arch/i386/i386

2013-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 21 22:04:41 UTC 2013

Modified Files:
src/sys/arch/i386/i386: pmc.c

Log Message:
CPUID2FAMILY was renamed to CPUID_TO_FAMILY, apparently this usage was
missed.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/i386/pmc.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/i386/i386/pmc.c
diff -u src/sys/arch/i386/i386/pmc.c:1.20 src/sys/arch/i386/i386/pmc.c:1.21
--- src/sys/arch/i386/i386/pmc.c:1.20	Mon Jan 30 21:35:22 2012
+++ src/sys/arch/i386/i386/pmc.c	Thu Nov 21 22:04:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmc.c,v 1.20 2012/01/30 21:35:22 rmind Exp $	*/
+/*	$NetBSD: pmc.c,v 1.21 2013/11/21 22:04:40 riz Exp $	*/
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.20 2012/01/30 21:35:22 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.21 2013/11/21 22:04:40 riz Exp $");
 
 #include 
 #include 
@@ -104,7 +104,7 @@ pmc_init(void)
 			 * we're missing Pentium 4 support.
 			 */
 			if (cpuid_level == -1 ||
-			CPUID2FAMILY(ci->ci_signature) == CPU_FAMILY_P4)
+			CPUID_TO_FAMILY(ci->ci_signature) == CPU_FAMILY_P4)
 break;
 
 			pmc_type = PMC_TYPE_I686;



CVS commit: src/sys/netinet6

2013-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 21 21:55:13 UTC 2013

Modified Files:
src/sys/netinet6: ip6_mroute.c

Log Message:
Revert previous and solve in a different way, using __unused.  Fixes
building with MRT6DEBUG.

ok martin.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/netinet6/ip6_mroute.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/ip6_mroute.c
diff -u src/sys/netinet6/ip6_mroute.c:1.104 src/sys/netinet6/ip6_mroute.c:1.105
--- src/sys/netinet6/ip6_mroute.c:1.104	Sat Sep 14 11:33:59 2013
+++ src/sys/netinet6/ip6_mroute.c	Thu Nov 21 21:55:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_mroute.c,v 1.104 2013/09/14 11:33:59 martin Exp $	*/
+/*	$NetBSD: ip6_mroute.c,v 1.105 2013/11/21 21:55:13 riz Exp $	*/
 /*	$KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $	*/
 
 /*
@@ -117,7 +117,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.104 2013/09/14 11:33:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.105 2013/11/21 21:55:13 riz Exp $");
 
 #include "opt_inet.h"
 #include "opt_mrouting.h"
@@ -188,6 +188,9 @@ u_int		mrt6debug = 0;	  /* debug level 	
 #define DEBUG_XMIT	0x10
 #define DEBUG_REG	0x20
 #define DEBUG_PIM	0x40
+#define __mrt6debugused /* empty */
+#else
+#define __mrt6debugused __unused
 #endif
 
 static void	expire_upcalls(void *);
@@ -1531,9 +1534,7 @@ phyint_send(struct ip6_hdr *ip6, struct 
 {
 	struct mbuf *mb_copy;
 	struct ifnet *ifp = mifp->m6_ifp;
-#ifdef MRT6DEBUG
-	int error = 0;
-#endif
+	int error __mrt6debugused = 0;
 	int s;
 	static struct route ro;
 	struct in6_multi *in6m;
@@ -1571,10 +1572,7 @@ phyint_send(struct ip6_hdr *ip6, struct 
 		/* XXX: ip6_output will override ip6->ip6_hlim */
 		im6o.im6o_multicast_hlim = ip6->ip6_hlim;
 		im6o.im6o_multicast_loop = 1;
-#ifdef MRT6DEBUG
-		error =
-#endif
-			ip6_output(mb_copy, NULL, &ro, IPV6_FORWARDING,
+		error = ip6_output(mb_copy, NULL, &ro, IPV6_FORWARDING,
    &im6o, NULL, NULL);
 
 #ifdef MRT6DEBUG
@@ -1613,10 +1611,7 @@ phyint_send(struct ip6_hdr *ip6, struct 
 		 * nd6_output on purpose to see if IPv6 operation is allowed
 		 * on the interface.
 		 */
-#ifdef MRT6DEBUG
-		error =
-#endif
-			nd6_output(ifp, ifp, mb_copy, &dst6, NULL);
+		error = nd6_output(ifp, ifp, mb_copy, &dst6, NULL);
 #ifdef MRT6DEBUG
 		if (mrt6debug & DEBUG_XMIT)
 			log(LOG_DEBUG, "phyint_send on mif %td err %d\n",
@@ -1720,6 +1715,7 @@ int
 pim6_input(struct mbuf **mp, int *offp, int proto)
 {
 	struct pim *pim; /* pointer to a pim struct */
+	struct ip6_hdr *ip6 __mrt6debugused;
 	int pimlen;
 	struct mbuf *m = *mp;
 	int minlen;
@@ -1727,6 +1723,7 @@ pim6_input(struct mbuf **mp, int *offp, 
 
 	PIM6_STATINC(PIM6_STAT_RCV_TOTAL);
 
+	ip6 = mtod(m, struct ip6_hdr *);
 	pimlen = m->m_pkthdr.len - *offp;
 
 	/*



CVS commit: src/sys/dev/cardbus

2013-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 21 21:17:50 UTC 2013

Modified Files:
src/sys/dev/cardbus: if_rtw_cardbus.c

Log Message:
Expand "#ifdef notyet" section to encompass the use of the variable
declared within.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/cardbus/if_rtw_cardbus.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/cardbus/if_rtw_cardbus.c
diff -u src/sys/dev/cardbus/if_rtw_cardbus.c:1.43 src/sys/dev/cardbus/if_rtw_cardbus.c:1.44
--- src/sys/dev/cardbus/if_rtw_cardbus.c:1.43	Thu Oct 17 21:22:28 2013
+++ src/sys/dev/cardbus/if_rtw_cardbus.c	Thu Nov 21 21:17:50 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: if_rtw_cardbus.c,v 1.43 2013/10/17 21:22:28 christos Exp $ */
+/* $NetBSD: if_rtw_cardbus.c,v 1.44 2013/11/21 21:17:50 riz Exp $ */
 
 /*-
  * Copyright (c) 2004, 2005 David Young.  All rights reserved.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rtw_cardbus.c,v 1.43 2013/10/17 21:22:28 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rtw_cardbus.c,v 1.44 2013/11/21 21:17:50 riz Exp $");
 
 #include "opt_inet.h"
 
@@ -215,17 +215,17 @@ rtw_cardbus_attach(device_t parent, devi
 		panic("rtw_cardbus_attach: impossible");
 	}
 
+	printf(": %s\n", rcp->rcp_product_name);
+
 #ifdef notyet
 	/* Get revision info. */
 	int rev = PCI_REVISION(ca->ca_class);
-#endif
-
-	printf(": %s\n", rcp->rcp_product_name);
 
 	RTW_DPRINTF(RTW_DEBUG_ATTACH,
 	("%s: pass %d.%d signature %08x\n", device_xname(self),
 	 (rev >> 4) & 0xf, rev & 0xf,
 	 Cardbus_conf_read(ct, csc->sc_tag, 0x80)));
+#endif
 
 	/*
 	 * Map the device.



CVS commit: src/sys/dev/pci

2013-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 21 21:14:05 UTC 2013

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

Log Message:
Wrap debug code in {} because "a label can only be part of a statement and
a declaration is not a statement."  I.e., make it a statement by making
it part of a block.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/pci/if_iwi.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/if_iwi.c
diff -u src/sys/dev/pci/if_iwi.c:1.93 src/sys/dev/pci/if_iwi.c:1.94
--- src/sys/dev/pci/if_iwi.c:1.93	Thu Oct 17 21:06:15 2013
+++ src/sys/dev/pci/if_iwi.c	Thu Nov 21 21:14:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwi.c,v 1.93 2013/10/17 21:06:15 christos Exp $  */
+/*	$NetBSD: if_iwi.c,v 1.94 2013/11/21 21:14:05 riz Exp $  */
 /*	$OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $	*/
 
 /*-
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.93 2013/10/17 21:06:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.94 2013/11/21 21:14:05 riz Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -1240,21 +1240,25 @@ iwi_notification_intr(struct iwi_softc *
 	switch (notif->type) {
 	case IWI_NOTIF_TYPE_SCAN_CHANNEL:
 #ifdef IWI_DEBUG
-		struct iwi_notif_scan_channel *chan =
-		(struct iwi_notif_scan_channel *)(notif + 1);
+		{
+			struct iwi_notif_scan_channel *chan =
+			(struct iwi_notif_scan_channel *)(notif + 1);
 
-		DPRINTFN(2, ("Scan of channel %u complete (%u)\n",
-		ic->ic_channels[chan->nchan].ic_freq, chan->nchan));
+			DPRINTFN(2, ("Scan of channel %u complete (%u)\n",
+			ic->ic_channels[chan->nchan].ic_freq, chan->nchan));
+		}
 #endif
 		break;
 
 	case IWI_NOTIF_TYPE_SCAN_COMPLETE:
 #ifdef IWI_DEBUG
-		struct iwi_notif_scan_complete *scan =
-		(struct iwi_notif_scan_complete *)(notif + 1);
+		{
+			struct iwi_notif_scan_complete *scan =
+			(struct iwi_notif_scan_complete *)(notif + 1);
 
-		DPRINTFN(2, ("Scan completed (%u, %u)\n", scan->nchan,
-		scan->status));
+			DPRINTFN(2, ("Scan completed (%u, %u)\n", scan->nchan,
+			scan->status));
+		}
 #endif
 
 		/* monitor mode uses scan to set the channel ... */



CVS commit: src/sys/arch/powerpc

2013-11-21 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Thu Nov 21 13:33:15 UTC 2013

Modified Files:
src/sys/arch/powerpc/conf: files.ibm4xx
src/sys/arch/powerpc/ibm4xx/dev: plb.c plbvar.h
src/sys/arch/powerpc/include/ibm4xx: dcr4xx.h
Added Files:
src/sys/arch/powerpc/ibm4xx/dev: dwctwo_plb.c

Log Message:
Support Synopsys DesigneWave OTG on PowerPC 405EX.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/powerpc/conf/files.ibm4xx
cvs rdiff -u -r0 -r1.1 src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/powerpc/ibm4xx/dev/plb.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/powerpc/ibm4xx/dev/plbvar.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/powerpc/include/ibm4xx/dcr4xx.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/powerpc/conf/files.ibm4xx
diff -u src/sys/arch/powerpc/conf/files.ibm4xx:1.14 src/sys/arch/powerpc/conf/files.ibm4xx:1.15
--- src/sys/arch/powerpc/conf/files.ibm4xx:1.14	Wed Jun 22 18:06:34 2011
+++ src/sys/arch/powerpc/conf/files.ibm4xx	Thu Nov 21 13:33:15 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ibm4xx,v 1.14 2011/06/22 18:06:34 matt Exp $
+#	$NetBSD: files.ibm4xx,v 1.15 2013/11/21 13:33:15 kiyohara Exp $
 #
 # IBM 4xx specific configuration info
 
@@ -12,7 +12,7 @@ file	arch/powerpc/ibm4xx/pic_uic.c
 file	arch/powerpc/ibm4xx/board_prop.c
 
 # Processor Local Bus
-device	plb { [irq = -1] }
+device	plb {[addr = -1], [irq = -1]}
 attach	plb at root
 file	arch/powerpc/ibm4xx/dev/plb.c		plb
 
@@ -77,3 +77,7 @@ file	arch/powerpc/ibm4xx/dev/gpiic_opb.c
 #device exb {[addr = -1]}
 #attach exb at plb
 #file	arch/powerpc/ibm4xx/dev/exb.c		exb
+
+# On-chip USB OTG bridge (Synopsys DesigneWave OTG)
+attach dwctwo at plb with dwctwo_plb
+file	arch/powerpc/ibm4xx/dev/dwctwo_plb.c	dwctwo_plb

Index: src/sys/arch/powerpc/ibm4xx/dev/plb.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/plb.c:1.20 src/sys/arch/powerpc/ibm4xx/dev/plb.c:1.21
--- src/sys/arch/powerpc/ibm4xx/dev/plb.c:1.20	Sat Jun 18 06:41:42 2011
+++ src/sys/arch/powerpc/ibm4xx/dev/plb.c	Thu Nov 21 13:33:15 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: plb.c,v 1.20 2011/06/18 06:41:42 matt Exp $ */
+/* $NetBSD: plb.c,v 1.21 2013/11/21 13:33:15 kiyohara Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plb.c,v 1.20 2011/06/18 06:41:42 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plb.c,v 1.21 2013/11/21 13:33:15 kiyohara Exp $");
 
 #include "locators.h"
 #include "emac.h"
@@ -107,7 +107,7 @@ const struct plb_dev plb_devs [] = {
 	{ AMCC405EX,	"cpu", },
 	{ AMCC405EX,	"ecc", },
 	{ AMCC405EX,	"opb", },
-	{ AMCC405EX,	"pchb", },
+	{ AMCC405EX,	"dwctwo", },
 
 	{ 0,		NULL }
 };
@@ -174,6 +174,7 @@ plb_attach(device_t parent, device_t sel
 			continue;
 
 		paa.plb_name = plb_devs[i].plb_name;
+		paa.plb_addr = PLBCF_ADDR_DEFAULT;
 		paa.plb_dmat = &ibm4xx_default_bus_dma_tag;
 		paa.plb_irq = PLBCF_IRQ_DEFAULT;
 
@@ -185,6 +186,7 @@ plb_attach(device_t parent, device_t sel
 			continue;
 
 		paa.plb_name = local_plb_devs->plb_name;
+		paa.plb_addr = PLBCF_ADDR_DEFAULT;
 		paa.plb_dmat = &ibm4xx_default_bus_dma_tag;
 		paa.plb_irq = PLBCF_IRQ_DEFAULT;
 
@@ -200,6 +202,8 @@ plb_print(void *aux, const char *pnp)
 
 	if (pnp)
 		aprint_normal("%s at %s", paa->plb_name, pnp);
+	if (paa->plb_addr != PLBCF_ADDR_DEFAULT)
+		aprint_normal(" address 0x%08x", paa->plb_addr);
 	if (paa->plb_irq != PLBCF_IRQ_DEFAULT)
 		aprint_normal(" irq %d", paa->plb_irq);
 

Index: src/sys/arch/powerpc/ibm4xx/dev/plbvar.h
diff -u src/sys/arch/powerpc/ibm4xx/dev/plbvar.h:1.6 src/sys/arch/powerpc/ibm4xx/dev/plbvar.h:1.7
--- src/sys/arch/powerpc/ibm4xx/dev/plbvar.h:1.6	Sat Jun 18 06:41:42 2011
+++ src/sys/arch/powerpc/ibm4xx/dev/plbvar.h	Thu Nov 21 13:33:15 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: plbvar.h,v 1.6 2011/06/18 06:41:42 matt Exp $ */
+/* $NetBSD: plbvar.h,v 1.7 2013/11/21 13:33:15 kiyohara Exp $ */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -45,5 +45,6 @@ struct plb_dev {
 struct plb_attach_args {
 	const char *plb_name;
 	bus_dma_tag_t plb_dmat;	/* DMA tag */
+	bus_addr_t plb_addr;
 	int plb_irq;
 };

Index: src/sys/arch/powerpc/include/ibm4xx/dcr4xx.h
diff -u src/sys/arch/powerpc/include/ibm4xx/dcr4xx.h:1.2 src/sys/arch/powerpc/include/ibm4xx/dcr4xx.h:1.3
--- src/sys/arch/powerpc/include/ibm4xx/dcr4xx.h:1.2	Sat Nov  6 16:32:08 2010
+++ src/sys/arch/powerpc/include/ibm4xx/dcr4xx.h	Thu Nov 21 13:33:15 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dcr4xx.h,v 1.2 2010/11/06 16:32:08 uebayasi Exp $	*/
+/*	$NetBSD: dcr4xx.h,v 1.3 2013/11/21 13:33:15 kiyohara Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -239,6 +239,50 @@
 
 /* Indirectly accessed Clocking Controller DCRs */
 
+#define	DCR_SDR0_SRST0		0x0200	/* Soft Reset */
+#define	  SDR0_SRST0_BGO	  (1 << 31)	/* PLB4 to OPB bridge */
+#define	  SDR0_SRST0_PLB4	  (1 << 30)	/* PLB4 arbi

CVS commit: src/lib/libform

2013-11-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 21 15:40:17 UTC 2013

Modified Files:
src/lib/libform: field.c

Log Message:
Simplify previous.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libform/field.c

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

Modified files:

Index: src/lib/libform/field.c
diff -u src/lib/libform/field.c:1.26 src/lib/libform/field.c:1.27
--- src/lib/libform/field.c:1.26	Thu Nov 21 04:40:19 2013
+++ src/lib/libform/field.c	Thu Nov 21 10:40:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: field.c,v 1.26 2013/11/21 09:40:19 blymn Exp $	*/
+/*	$NetBSD: field.c,v 1.27 2013/11/21 15:40:17 christos Exp $	*/
 /*-
  * Copyright (c) 1998-1999 Brett Lymn
  * (bl...@baea.com.au, brett_l...@yahoo.com.au)
@@ -29,8 +29,9 @@
  */
 
 #include 
-__RCSID("$NetBSD: field.c,v 1.26 2013/11/21 09:40:19 blymn Exp $");
+__RCSID("$NetBSD: field.c,v 1.27 2013/11/21 15:40:17 christos Exp $");
 
+#include 
 #include 
 #include 
 #include 
@@ -472,7 +473,7 @@ field_buffer(FIELD *field, int buffer)
 
 	char *reformat, *p;
 	_FORMI_FIELD_LINES *linep;
-	size_t bufsize;
+	size_t bufsize, pos;
 	
 	if (field == NULL)
 		return NULL;
@@ -492,45 +493,35 @@ field_buffer(FIELD *field, int buffer)
 	if (_formi_sync_buffer(field) != E_OK)
 		return NULL;
 	
-	if ((field->opts & O_REFORMAT) != O_REFORMAT) {
+	if ((field->opts & O_REFORMAT) != O_REFORMAT)
 		return field->buffers[buffer].string;
-	} else {
-		if (field->row_count > 1) {
 
-			  /*
-			   * compute reformat buffer size
-			   * each line length plus one line feed
-			   * except for last line without line feed
-			   * but plus one NUL character
-			   */
-			bufsize = 0;
-			for (linep=field->alines; linep; linep=linep->next)
-bufsize += strlen(linep->string)+1;
+	if (field->row_count <= 1)
+		return strdup(field->buffers[buffer].string);
 
-			reformat = (char *)malloc(bufsize);
-			if (reformat == NULL)
+	/*
+	 * create a single string containing each line,
+	 * separated by newline, last line having no
+	 * newline, but NUL terminated.
+	 */
+	bufsize = pos = 0;
+	reformat = NULL;
+	for (linep = field->alines; linep; linep = linep->next) {
+		size_t len = strlen(linep->string);
+		if (len + 1 >= bufsize - pos) {
+			bufsize += MAX(1024, 2 * len);
+			p = realloc(reformat, bufsize);
+			if (p == NULL) {
+free(reformat);
 return NULL;
-
-			  /*
-			   * foreach row copy line, append newline, no
-			   * newline on last row.
-			   */
-			p = reformat;
-			for (linep=field->alines; linep; linep=linep->next) {
-strcpy(p, linep->string);
-p += strlen(linep->string);
-if (linep->next)
-	*p++ = '\n';
 			}
-			*p = '\0';
-
-			return reformat;
-		} else {
-			asprintf(&reformat, "%s",
- field->buffers[buffer].string);
-			return reformat;
+			reformat = p;
 		}
+		memcpy(reformat + pos, linep->string, len);
+		pos += len;
+		reformat[pos++] = linep->next ? '\n' : '\0';
 	}
+	return reformat;
 }
 
 /*



CVS commit: src/external/bsd/libevent/dist/compat/sys

2013-11-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 21 19:12:40 UTC 2013

Removed Files:
src/external/bsd/libevent/dist/compat/sys: queue.h

Log Message:
delete copy of queue.h that we don't use.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/libevent/dist/compat/sys/queue.h

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



CVS commit: src/lib/libexecinfo

2013-11-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 21 16:02:21 UTC 2013

Modified Files:
src/lib/libexecinfo: backtrace.c

Log Message:
>From Ed Maste:

  libexecinfo: Include terminating null in byte count

  Otherwise, a formatted string with a strlen equal to the remaining
  buffer space would have the last character omitted (because vsnprintf
  always null-terminates), and later the assert in backtrace_symbols_fmt
  would fail.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libexecinfo/backtrace.c

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

Modified files:

Index: src/lib/libexecinfo/backtrace.c
diff -u src/lib/libexecinfo/backtrace.c:1.3 src/lib/libexecinfo/backtrace.c:1.4
--- src/lib/libexecinfo/backtrace.c:1.3	Thu Aug 29 10:58:56 2013
+++ src/lib/libexecinfo/backtrace.c	Thu Nov 21 11:02:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: backtrace.c,v 1.3 2013/08/29 14:58:56 christos Exp $	*/
+/*	$NetBSD: backtrace.c,v 1.4 2013/11/21 16:02:21 christos Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: backtrace.c,v 1.3 2013/08/29 14:58:56 christos Exp $");
+__RCSID("$NetBSD: backtrace.c,v 1.4 2013/11/21 16:02:21 christos Exp $");
 
 #include 
 #include 
@@ -88,7 +88,7 @@ rasprintf(char **buf, size_t *bufsiz, si
 			len = vsnprintf(*buf + offs, *bufsiz - offs, fmt, ap);
 			va_end(ap);
 
-			if (len < 0 || (size_t)len < *bufsiz - offs)
+			if (len < 0 || (size_t)len + 1 < *bufsiz - offs)
 return len;
 			nbufsiz = MAX(*bufsiz + 512, (size_t)len + 1);
 		} else



CVS commit: src/sys/fs/tmpfs

2013-11-21 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Thu Nov 21 14:39:09 UTC 2013

Modified Files:
src/sys/fs/tmpfs: tmpfs_subr.c

Log Message:
tmpfs_dir_getdotents: fix the recent regression, set the correct
d_fileno value for dot-dot.  Spotted by Pedro Martelletto, thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/fs/tmpfs/tmpfs_subr.c

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

Modified files:

Index: src/sys/fs/tmpfs/tmpfs_subr.c
diff -u src/sys/fs/tmpfs/tmpfs_subr.c:1.88 src/sys/fs/tmpfs/tmpfs_subr.c:1.89
--- src/sys/fs/tmpfs/tmpfs_subr.c:1.88	Mon Nov 18 01:39:34 2013
+++ src/sys/fs/tmpfs/tmpfs_subr.c	Thu Nov 21 14:39:09 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_subr.c,v 1.88 2013/11/18 01:39:34 rmind Exp $	*/
+/*	$NetBSD: tmpfs_subr.c,v 1.89 2013/11/21 14:39:09 rmind Exp $	*/
 
 /*
  * Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.88 2013/11/18 01:39:34 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.89 2013/11/21 14:39:09 rmind Exp $");
 
 #include 
 #include 
@@ -738,15 +738,14 @@ tmpfs_dir_getdotents(tmpfs_node_t *node,
 	off_t next = 0;
 	int error;
 
-	dp->d_fileno = node->tn_id;
-	dp->d_type = DT_DIR;
-
 	switch (uio->uio_offset) {
 	case TMPFS_DIRSEQ_DOT:
+		dp->d_fileno = node->tn_id;
 		strlcpy(dp->d_name, ".", sizeof(dp->d_name));
 		next = TMPFS_DIRSEQ_DOTDOT;
 		break;
 	case TMPFS_DIRSEQ_DOTDOT:
+		dp->d_fileno = node->tn_spec.tn_dir.tn_parent->tn_id;
 		strlcpy(dp->d_name, "..", sizeof(dp->d_name));
 		de = TAILQ_FIRST(&node->tn_spec.tn_dir.tn_dir);
 		next = de ? tmpfs_dir_getseq(node, de) : TMPFS_DIRSEQ_EOF;
@@ -754,6 +753,7 @@ tmpfs_dir_getdotents(tmpfs_node_t *node,
 	default:
 		KASSERT(false);
 	}
+	dp->d_type = DT_DIR;
 	dp->d_namlen = strlen(dp->d_name);
 	dp->d_reclen = _DIRENT_SIZE(dp);
 



CVS commit: src/sys/sys

2013-11-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 21 19:04:19 UTC 2013

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

Log Message:
provide a const and a non const flavor for CIRCLEQ_END because the kernel
needs a const one. The const one is supposed to be used for comparisons
and the non-const one for assignments.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/sys/queue.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/queue.h
diff -u src/sys/sys/queue.h:1.56 src/sys/sys/queue.h:1.57
--- src/sys/sys/queue.h:1.56	Thu Nov 21 10:54:17 2013
+++ src/sys/sys/queue.h	Thu Nov 21 14:04:19 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: queue.h,v 1.56 2013/11/21 15:54:17 christos Exp $	*/
+/*	$NetBSD: queue.h,v 1.57 2013/11/21 19:04:19 christos Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -604,16 +604,16 @@ struct {\
  */
 #if defined(_KERNEL) && defined(QUEUEDEBUG)
 #define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)\
-	if ((head)->cqh_first != CIRCLEQ_END(head) &&			\
-	(head)->cqh_first->field.cqe_prev != CIRCLEQ_END(head))	\
+	if ((head)->cqh_first != CIRCLEQ_ENDC(head) &&			\
+	(head)->cqh_first->field.cqe_prev != CIRCLEQ_ENDC(head))	\
 		panic("CIRCLEQ head forw %p %s:%d", (head),		\
 		  __FILE__, __LINE__);\
-	if ((head)->cqh_last != CIRCLEQ_END(head) &&			\
-	(head)->cqh_last->field.cqe_next != CIRCLEQ_END(head))		\
+	if ((head)->cqh_last != CIRCLEQ_ENDC(head) &&			\
+	(head)->cqh_last->field.cqe_next != CIRCLEQ_ENDC(head))		\
 		panic("CIRCLEQ head back %p %s:%d", (head),		\
 		  __FILE__, __LINE__);
 #define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)			\
-	if ((elm)->field.cqe_next == CIRCLEQ_END(head)) {			\
+	if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) {			\
 		if ((head)->cqh_last != (elm))\
 			panic("CIRCLEQ elm last %p %s:%d", (elm),	\
 			  __FILE__, __LINE__);			\
@@ -622,7 +622,7 @@ struct {\
 			panic("CIRCLEQ elm forw %p %s:%d", (elm),	\
 			  __FILE__, __LINE__);			\
 	}\
-	if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) {			\
+	if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) {			\
 		if ((head)->cqh_first != (elm))\
 			panic("CIRCLEQ elm first %p %s:%d", (elm),	\
 			  __FILE__, __LINE__);			\
@@ -668,7 +668,7 @@ struct {\
 	QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field)		\
 	(elm)->field.cqe_next = (listelm)->field.cqe_next;		\
 	(elm)->field.cqe_prev = (listelm);\
-	if ((listelm)->field.cqe_next == CIRCLEQ_END(head))		\
+	if ((listelm)->field.cqe_next == CIRCLEQ_ENDC(head))		\
 		(head)->cqh_last = (elm);\
 	else\
 		(listelm)->field.cqe_next->field.cqe_prev = (elm);	\
@@ -680,7 +680,7 @@ struct {\
 	QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field)		\
 	(elm)->field.cqe_next = (listelm);\
 	(elm)->field.cqe_prev = (listelm)->field.cqe_prev;		\
-	if ((listelm)->field.cqe_prev == CIRCLEQ_END(head))		\
+	if ((listelm)->field.cqe_prev == CIRCLEQ_ENDC(head))		\
 		(head)->cqh_first = (elm);\
 	else\
 		(listelm)->field.cqe_prev->field.cqe_next = (elm);	\
@@ -691,7 +691,7 @@ struct {\
 	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)\
 	(elm)->field.cqe_next = (head)->cqh_first;			\
 	(elm)->field.cqe_prev = CIRCLEQ_END(head);			\
-	if ((head)->cqh_last == CIRCLEQ_END(head))			\
+	if ((head)->cqh_last == CIRCLEQ_ENDC(head))			\
 		(head)->cqh_last = (elm);\
 	else\
 		(head)->cqh_first->field.cqe_prev = (elm);		\
@@ -702,7 +702,7 @@ struct {\
 	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)\
 	(elm)->field.cqe_next = CIRCLEQ_END(head);			\
 	(elm)->field.cqe_prev = (head)->cqh_last;			\
-	if ((head)->cqh_first == CIRCLEQ_END(head))			\
+	if ((head)->cqh_first == CIRCLEQ_ENDC(head))			\
 		(head)->cqh_first = (elm);\
 	else\
 		(head)->cqh_last->field.cqe_next = (elm);		\
@@ -712,12 +712,12 @@ struct {\
 #define	CIRCLEQ_REMOVE(head, elm, field) do {\
 	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)\
 	QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field)			\
-	if ((elm)->field.cqe_next == CIRCLEQ_END(head))			\
+	if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head))			\
 		(head)->cqh_last = (elm)->field.cqe_prev;		\
 	else\
 		(elm)->field.cqe_next->field.cqe_prev =			\
 		(elm)->field.cqe_prev;\
-	if ((elm)->field.cqe_prev == CIRCLEQ_END(head))			\
+	if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head))			\
 		(head)->cqh_first = (elm)->field.cqe_next;		\
 	else\
 		(elm)->field.cqe_prev->field.cqe_next =			\
@@ -727,12 +727,12 @@ struct {\
 
 #define	CIRCLEQ_FOREACH(var, head, field)\
 	for ((var) = ((head)->cqh_first);\
-		(var) != CIRCLEQ_END(head);\
+		(var) != CIRCLEQ_ENDC(head);\
 		(var) = ((var)->field.cqe_next))
 
 #define	CIRCLEQ_FOREACH_REVERSE(var, head, field)			\
 	for ((var) = ((head)->cqh_last);\
-		(var) != CIRCLEQ_END(head);\
+		(var) != CIRCLEQ_ENDC(

CVS commit: src/sys/sys

2013-11-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 21 15:54:17 UTC 2013

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

Log Message:
Add a CIRCLEQ_END() macro to reduce diff with other queue.h


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/sys/queue.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/queue.h
diff -u src/sys/sys/queue.h:1.55 src/sys/sys/queue.h:1.56
--- src/sys/sys/queue.h:1.55	Wed Jul 17 11:50:59 2013
+++ src/sys/sys/queue.h	Thu Nov 21 10:54:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: queue.h,v 1.55 2013/07/17 15:50:59 pooka Exp $	*/
+/*	$NetBSD: queue.h,v 1.56 2013/11/21 15:54:17 christos Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -604,16 +604,16 @@ struct {\
  */
 #if defined(_KERNEL) && defined(QUEUEDEBUG)
 #define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)\
-	if ((head)->cqh_first != (void *)(head) &&			\
-	(head)->cqh_first->field.cqe_prev != (void *)(head))	\
+	if ((head)->cqh_first != CIRCLEQ_END(head) &&			\
+	(head)->cqh_first->field.cqe_prev != CIRCLEQ_END(head))	\
 		panic("CIRCLEQ head forw %p %s:%d", (head),		\
 		  __FILE__, __LINE__);\
-	if ((head)->cqh_last != (void *)(head) &&			\
-	(head)->cqh_last->field.cqe_next != (void *)(head))		\
+	if ((head)->cqh_last != CIRCLEQ_END(head) &&			\
+	(head)->cqh_last->field.cqe_next != CIRCLEQ_END(head))		\
 		panic("CIRCLEQ head back %p %s:%d", (head),		\
 		  __FILE__, __LINE__);
 #define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)			\
-	if ((elm)->field.cqe_next == (void *)(head)) {			\
+	if ((elm)->field.cqe_next == CIRCLEQ_END(head)) {			\
 		if ((head)->cqh_last != (elm))\
 			panic("CIRCLEQ elm last %p %s:%d", (elm),	\
 			  __FILE__, __LINE__);			\
@@ -622,7 +622,7 @@ struct {\
 			panic("CIRCLEQ elm forw %p %s:%d", (elm),	\
 			  __FILE__, __LINE__);			\
 	}\
-	if ((elm)->field.cqe_prev == (void *)(head)) {			\
+	if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) {			\
 		if ((head)->cqh_first != (elm))\
 			panic("CIRCLEQ elm first %p %s:%d", (elm),	\
 			  __FILE__, __LINE__);			\
@@ -647,7 +647,7 @@ struct name {\
 }
 
 #define	CIRCLEQ_HEAD_INITIALIZER(head)	\
-	{ (void *)&head, (void *)&head }
+	{ CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
 
 #define	CIRCLEQ_ENTRY(type)		\
 struct {\
@@ -659,8 +659,8 @@ struct {\
  * Circular queue functions.
  */
 #define	CIRCLEQ_INIT(head) do {		\
-	(head)->cqh_first = (void *)(head);\
-	(head)->cqh_last = (void *)(head);\
+	(head)->cqh_first = CIRCLEQ_END(head);\
+	(head)->cqh_last = CIRCLEQ_END(head);\
 } while (/*CONSTCOND*/0)
 
 #define	CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
@@ -668,7 +668,7 @@ struct {\
 	QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field)		\
 	(elm)->field.cqe_next = (listelm)->field.cqe_next;		\
 	(elm)->field.cqe_prev = (listelm);\
-	if ((listelm)->field.cqe_next == (void *)(head))		\
+	if ((listelm)->field.cqe_next == CIRCLEQ_END(head))		\
 		(head)->cqh_last = (elm);\
 	else\
 		(listelm)->field.cqe_next->field.cqe_prev = (elm);	\
@@ -680,7 +680,7 @@ struct {\
 	QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field)		\
 	(elm)->field.cqe_next = (listelm);\
 	(elm)->field.cqe_prev = (listelm)->field.cqe_prev;		\
-	if ((listelm)->field.cqe_prev == (void *)(head))		\
+	if ((listelm)->field.cqe_prev == CIRCLEQ_END(head))		\
 		(head)->cqh_first = (elm);\
 	else\
 		(listelm)->field.cqe_prev->field.cqe_next = (elm);	\
@@ -690,8 +690,8 @@ struct {\
 #define	CIRCLEQ_INSERT_HEAD(head, elm, field) do {			\
 	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)\
 	(elm)->field.cqe_next = (head)->cqh_first;			\
-	(elm)->field.cqe_prev = (void *)(head);\
-	if ((head)->cqh_last == (void *)(head))\
+	(elm)->field.cqe_prev = CIRCLEQ_END(head);			\
+	if ((head)->cqh_last == CIRCLEQ_END(head))			\
 		(head)->cqh_last = (elm);\
 	else\
 		(head)->cqh_first->field.cqe_prev = (elm);		\
@@ -700,9 +700,9 @@ struct {\
 
 #define	CIRCLEQ_INSERT_TAIL(head, elm, field) do {			\
 	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)\
-	(elm)->field.cqe_next = (void *)(head);\
+	(elm)->field.cqe_next = CIRCLEQ_END(head);			\
 	(elm)->field.cqe_prev = (head)->cqh_last;			\
-	if ((head)->cqh_first == (void *)(head))			\
+	if ((head)->cqh_first == CIRCLEQ_END(head))			\
 		(head)->cqh_first = (elm);\
 	else\
 		(head)->cqh_last->field.cqe_next = (elm);		\
@@ -712,12 +712,12 @@ struct {\
 #define	CIRCLEQ_REMOVE(head, elm, field) do {\
 	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)\
 	QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field)			\
-	if ((elm)->field.cqe_next == (void *)(head))			\
+	if ((elm)->field.cqe_next == CIRCLEQ_END(head))			\
 		(head)->cqh_last = (elm)->field.cqe_prev;		\
 	else\
 		(elm)->field.cqe_next->field.cqe_prev =			\
 		 

CVS commit: src/usr.sbin/mtree

2013-11-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 21 18:39:50 UTC 2013

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

Log Message:
>From Brooks Davis:
When comparing a directory to an mtree file NetBSD mtree has output like
this:

xxx:size (4, 5)
md5digest (0x6de9439834c9147569741d3c9c9fc010, 
0xa5d119ab8edcda0ef7f381da8=
f52f92f)
=2E/yyy missing

FreeBSD's historical behavior is this:

xxx changed
size expected 4 found 5
md5digest expected 6de9439834c9147569741d3c9c9fc010 found 
a5d119ab8edcda0e=
f7f381da8f52f92f
=2E/yyy missing

FreeBSD's mergemaster -U command depends on the latter behavior so
the following patch alters the freebsd9 mode of mtree to output
that format.  I don't think programs should rely on this output one way
or another since it's clearly meant for humans, but this seems like the
easiest short term fix.


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

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

Modified files:

Index: src/usr.sbin/mtree/compare.c
diff -u src/usr.sbin/mtree/compare.c:1.57 src/usr.sbin/mtree/compare.c:1.58
--- src/usr.sbin/mtree/compare.c:1.57	Thu Oct 17 13:22:59 2013
+++ src/usr.sbin/mtree/compare.c	Thu Nov 21 13:39:50 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: compare.c,v 1.57 2013/10/17 17:22:59 christos Exp $	*/
+/*	$NetBSD: compare.c,v 1.58 2013/11/21 18:39:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)compare.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: compare.c,v 1.57 2013/10/17 17:22:59 christos Exp $");
+__RCSID("$NetBSD: compare.c,v 1.58 2013/11/21 18:39:50 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,13 +72,18 @@ __RCSID("$NetBSD: compare.c,v 1.57 2013/
 #define	INDENTNAMELEN	8
 #define MARK\
 do {	\
-	len = printf("%s: ", RP(p));	\
-	if (len > INDENTNAMELEN) {	\
+	if (flavor == F_FREEBSD9) {	\
+		len = printf("%s changed\n", RP(p));			\
 		tab = "\t";		\
-		printf("\n");		\
 	} else {			\
-		tab = "";		\
-		printf("%*s", INDENTNAMELEN - (int)len, "");		\
+		len = printf("%s: ", RP(p));\
+		if (len > INDENTNAMELEN) {\
+			tab = "\t";	\
+			printf("\n");	\
+		} else {		\
+			tab = "";	\
+			printf("%*s", INDENTNAMELEN - (int)len, "");	\
+		}			\
 	}\
 } while (0)
 #define	LABEL if (!label++) MARK
@@ -171,7 +176,8 @@ compare(NODE *s, FTSENT *p)
 		break;
 #endif
 typeerr:		LABEL;
-		printf("\ttype (%s, %s)\n",
+		printf(flavor == F_FREEBSD9 ?
+		"\ttype expected %s found %s\n" : "\ttype (%s, %s)\n",
 		nodetype(s->type), inotype(p->fts_statp->st_mode));
 		return (label);
 	}
@@ -193,7 +199,9 @@ typeerr:		LABEL;
 	(s->type == F_BLOCK || s->type == F_CHAR) &&
 	s->st_rdev != p->fts_statp->st_rdev) {
 		LABEL;
-		printf("%sdevice (%#jx, %#jx",
+		printf(flavor == F_FREEBSD9 ?
+		"%sdevice expected %#jx found %#jx" :
+		"%sdevice (%#jx, %#jx",
 		tab, (uintmax_t)s->st_rdev,
 		(uintmax_t)p->fts_statp->st_rdev);
 		if (uflag) {
@@ -203,10 +211,12 @@ typeerr:		LABEL;
 			  s->st_rdev) == -1) ||
 			(lchown(p->fts_accpath, p->fts_statp->st_uid,
 			  p->fts_statp->st_gid) == -1) )
-printf(", not modified: %s)\n",
-strerror(errno));
+printf(", not modified: %s%s\n",
+strerror(errno),
+flavor == F_FREEBSD9 ? "" : ")");
 			 else
-printf(", modified)\n");
+printf(", modified%s\n",
+flavor == F_FREEBSD9 ? "" : ")");
 		} else
 			printf(")\n");
 		tab = "\t";
@@ -214,28 +224,34 @@ typeerr:		LABEL;
 	/* Set the uid/gid first, then set the mode. */
 	if (s->flags & (F_UID | F_UNAME) && s->st_uid != p->fts_statp->st_uid) {
 		LABEL;
-		printf("%suser (%lu, %lu",
+		printf(flavor == F_FREEBSD9 ?
+		"%suser expected %lu found %lu" : "%suser (%lu, %lu",
 		tab, (u_long)s->st_uid, (u_long)p->fts_statp->st_uid);
 		if (uflag) {
 			if (lchown(p->fts_accpath, s->st_uid, -1))
-printf(", not modified: %s)\n",
-strerror(errno));
+printf(", not modified: %s%s\n",
+strerror(errno),
+flavor == F_FREEBSD9 ? "" : ")");
 			else
-printf(", modified)\n");
+printf(", modified%s\n",
+flavor == F_FREEBSD9 ? "" : ")");
 		} else
 			printf(")\n");
 		tab = "\t";
 	}
 	if (s->flags & (F_GID | F_GNAME) && s->st_gid != p->fts_statp->st_gid) {
 		LABEL;
-		printf("%sgid (%lu, %lu",
+		printf(flavor == F_FREEBSD9 ?
+		"%sgid expected %lu found %lu" : "%sgid (%lu, %lu",
 		tab, (u_long)s->st_gid, (u_long)p->fts_statp->st_gid);
 		if (uflag) {
 			if (lchown(p->fts_accpath, -1, s->st_gid))
-printf(", not modified: %s)\n",
-strerror(errno));
+printf(", not modified: %s%s\n",
+strerror(errno),
+flavor == F_FREEBSD9 ? "" : ")");
 			else
-printf(", modified)\n");
+printf(", modified%s\n",
+		

CVS commit: src/sys/arch

2013-11-21 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Thu Nov 21 13:52:27 UTC 2013

Modified Files:
src/sys/arch/evbppc/obs405: obs600_autoconf.c
src/sys/arch/powerpc/ibm4xx/dev: dwctwo_plb.c

Log Message:
Move the parameters for obs600 to obs600_autoconf.c.  This parameters was set 
from u-boot.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbppc/obs405/obs600_autoconf.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.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/evbppc/obs405/obs600_autoconf.c
diff -u src/sys/arch/evbppc/obs405/obs600_autoconf.c:1.6 src/sys/arch/evbppc/obs405/obs600_autoconf.c:1.7
--- src/sys/arch/evbppc/obs405/obs600_autoconf.c:1.6	Tue Jan 10 12:17:20 2012
+++ src/sys/arch/evbppc/obs405/obs600_autoconf.c	Thu Nov 21 13:52:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: obs600_autoconf.c,v 1.6 2012/01/10 12:17:20 kiyohara Exp $	*/
+/*	$NetBSD: obs600_autoconf.c,v 1.7 2013/11/21 13:52:27 kiyohara Exp $	*/
 
 /*
  * Copyright 2004 Shigeyuki Fukushima.
@@ -33,7 +33,9 @@
  * DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: obs600_autoconf.c,v 1.6 2012/01/10 12:17:20 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obs600_autoconf.c,v 1.7 2013/11/21 13:52:27 kiyohara Exp $");
+
+#include "dwctwo.h"
 
 #include 
 #include 
@@ -47,6 +49,44 @@ __KERNEL_RCSID(0, "$NetBSD: obs600_autoc
 
 #include 
 
+#if NDWCTWO > 0
+#include 
+#include 
+#include 
+
+#include 
+#include "dwc2_core.h"
+
+/* This parameters was set from u-boot. */
+static struct dwc2_core_params dwctwo_obs600_params = {
+	.otg_cap			= 0,	/* HNP/SRP capable */
+	.otg_ver			= 0,	/* 1.3 */
+	.dma_enable			= 1,
+	.dma_desc_enable		= 0,
+	.speed= 0,	/* High Speed */
+	.enable_dynamic_fifo		= 1,
+	.en_multiple_tx_fifo		= 0,
+	.host_rx_fifo_size		= 531,	/* 531 DWORDs */
+	.host_nperio_tx_fifo_size	= 256,	/* 256 DWORDs */
+	.host_perio_tx_fifo_size	= 256,	/* 256 DWORDs */
+	.max_transfer_size		= 524287,
+	.max_packet_count		= 1023,
+	.host_channels			= 4,
+	.phy_type			= 2,	/* ULPI */
+	.phy_utmi_width			= 8,	/* 8 bits */
+	.phy_ulpi_ddr			= 0,	/* Single */
+	.phy_ulpi_ext_vbus		= 0,
+	.i2c_enable			= 0,
+	.ulpi_fs_ls			= 0,
+	.host_support_fs_ls_low_power	= 0,
+	.host_ls_low_power_phy_clk	= 0,	/* 48 MHz */
+	.ts_dline			= 0,
+	.reload_ctl			= 0,
+	.ahbcfg= 0x10,
+	.uframe_sched			= 1,
+};
+#endif
+
 
 /*
  * Determine device configuration for a machine.
@@ -80,5 +120,15 @@ void
 device_register(device_t dev, void *aux)
 {
 
+#if NDWCTWO > 0
+	if (device_is_a(dev, "dwctwo")) {
+		prop_dictionary_t dict = device_properties(dev);
+
+		prop_dictionary_set_uint32(dict, "params",
+		(uint32_t)&dwctwo_obs600_params);
+		return;
+	}
+#endif
+
 	obs405_device_register(dev, aux, OBS600_COM_FREQ);
 }

Index: src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c:1.1 src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c:1.2
--- src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c:1.1	Thu Nov 21 13:33:15 2013
+++ src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c	Thu Nov 21 13:52:27 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: dwctwo_plb.c,v 1.1 2013/11/21 13:33:15 kiyohara Exp $ */
+/* $NetBSD: dwctwo_plb.c,v 1.2 2013/11/21 13:52:27 kiyohara Exp $ */
 /*
  * Copyright (c) 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwctwo_plb.c,v 1.1 2013/11/21 13:33:15 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwctwo_plb.c,v 1.2 2013/11/21 13:52:27 kiyohara Exp $");
 
 #include 
 #include 
@@ -67,34 +67,6 @@ static struct powerpc_bus_space dwctwo_t
 static char ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)]
 __attribute__((aligned(8)));
 
-static struct dwc2_core_params dwctwo_405ex_params = {
-	.otg_cap			= 0,	/* HNP/SRP capable */
-	.otg_ver			= 0,	/* 1.3 */
-	.dma_enable			= 1,
-	.dma_desc_enable		= 0,
-	.speed= 0,	/* High Speed */
-	.enable_dynamic_fifo		= 1,
-	.en_multiple_tx_fifo		= 0,
-	.host_rx_fifo_size		= 531,	/* 531 DWORDs */
-	.host_nperio_tx_fifo_size	= 256,	/* 256 DWORDs */
-	.host_perio_tx_fifo_size	= 256,	/* 256 DWORDs */
-	.max_transfer_size		= 524287,
-	.max_packet_count		= 1023,
-	.host_channels			= 4,
-	.phy_type			= 2,	/* ULPI */
-	.phy_utmi_width			= 8,	/* 8 bits */
-	.phy_ulpi_ddr			= 0,	/* Single */
-	.phy_ulpi_ext_vbus		= 0,
-	.i2c_enable			= 0,
-	.ulpi_fs_ls			= 0,
-	.host_support_fs_ls_low_power	= 0,
-	.host_ls_low_power_phy_clk	= 0,	/* 48 MHz */
-	.ts_dline			= 0,
-	.reload_ctl			= 0,
-	.ahbcfg= 0x10,
-	.uframe_sched			= 1,
-};
-
 
 static int
 dwctwo_plb_match(device_t parent, cfdata_t match, void *aux)
@@ -119,10 +91,17 @@ dwctwo_plb_attach(device_t parent, devic
 {
 	struct dwc2_softc *sc = device_private(self);
 	struct plb_attach_args *paa = aux;
+	prop_dictionary_t dict = device_properties(self);
 	uint32_t srst0;
 
 	sc->sc_dev = self;
-	sc->sc_params = &dwctwo_405ex

CVS commit: src/lib/libm/src

2013-11-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 21 13:41:10 UTC 2013

Modified Files:
src/lib/libm/src: w_fmodl.c

Log Message:
Fix copy & pasto (make temp variable long double).
Fixes fmodl() test failure on sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/w_fmodl.c

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

Modified files:

Index: src/lib/libm/src/w_fmodl.c
diff -u src/lib/libm/src/w_fmodl.c:1.3 src/lib/libm/src/w_fmodl.c:1.4
--- src/lib/libm/src/w_fmodl.c:1.3	Tue Nov 19 14:04:24 2013
+++ src/lib/libm/src/w_fmodl.c	Thu Nov 21 13:41:10 2013
@@ -11,7 +11,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: w_fmodl.c,v 1.3 2013/11/19 14:04:24 joerg Exp $");
+__RCSID("$NetBSD: w_fmodl.c,v 1.4 2013/11/21 13:41:10 martin Exp $");
 
 /*
  * wrapper fmodl(x,y)
@@ -33,7 +33,7 @@ fmodl(long double x, long double y)	/* w
 #ifdef _IEEE_LIBM
 	return __ieee754_fmodl(x,y);
 #else
-	double z;
+	long double z;
 	z = __ieee754_fmodl(x,y);
 	if(_LIB_VERSION == _IEEE_ ||isnan(y)||isnan(x)) return z;
 	if(y==0.0) {



CVS commit: src/lib/libc/gen

2013-11-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 21 14:14:13 UTC 2013

Modified Files:
src/lib/libc/gen: fpclassifyl_ieee754.c isinfl_ieee754.c
isnanl_ieee754.c

Log Message:
Make ext_fraclm and ext_frachm parts of the long double mantissa optional
in generic code


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/fpclassifyl_ieee754.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gen/isinfl_ieee754.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/gen/isnanl_ieee754.c

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

Modified files:

Index: src/lib/libc/gen/fpclassifyl_ieee754.c
diff -u src/lib/libc/gen/fpclassifyl_ieee754.c:1.1 src/lib/libc/gen/fpclassifyl_ieee754.c:1.2
--- src/lib/libc/gen/fpclassifyl_ieee754.c:1.1	Mon Jan 17 23:53:03 2011
+++ src/lib/libc/gen/fpclassifyl_ieee754.c	Thu Nov 21 14:14:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpclassifyl_ieee754.c,v 1.1 2011/01/17 23:53:03 matt Exp $	*/
+/*	$NetBSD: fpclassifyl_ieee754.c,v 1.2 2013/11/21 14:14:13 martin Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpclassifyl_ieee754.c,v 1.1 2011/01/17 23:53:03 matt Exp $");
+__RCSID("$NetBSD: fpclassifyl_ieee754.c,v 1.2 2013/11/21 14:14:13 martin Exp $");
 #endif
 
 #include 
@@ -50,14 +50,26 @@ __fpclassifyl(long double x)
 	u.extu_ld = x;
 
 	if (u.extu_ext.ext_exp == 0) {
-		if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_frachm == 0
-		&& u.extu_ext.ext_fraclm == 0 && u.extu_ext.ext_fracl == 0)
+		if (u.extu_ext.ext_frach == 0
+#if EXT_FRACHMBITS
+		&& u.extu_ext.ext_frachm == 0
+#endif
+#if EXT_FRACLMBITS
+		&& u.extu_ext.ext_fraclm == 0
+#endif
+		&& u.extu_ext.ext_fracl == 0)
 			return FP_ZERO;
 		else
 			return FP_SUBNORMAL;
 	} else if (u.extu_ext.ext_exp == EXT_EXP_INFNAN) {
-		if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_frachm == 0
-		&& u.extu_ext.ext_fraclm == 0 && u.extu_ext.ext_fracl == 0)
+		if (u.extu_ext.ext_frach == 0
+#f EXT_FRACHMBITS
+		&& u.extu_ext.ext_frachm == 0
+#endif
+#if EXT_FRACLMBITS
+		&& u.extu_ext.ext_fraclm == 0
+#endif
+		&& u.extu_ext.ext_fracl == 0)
 			return FP_INFINITE;
 		else
 			return FP_NAN;

Index: src/lib/libc/gen/isinfl_ieee754.c
diff -u src/lib/libc/gen/isinfl_ieee754.c:1.4 src/lib/libc/gen/isinfl_ieee754.c:1.5
--- src/lib/libc/gen/isinfl_ieee754.c:1.4	Mon Jan 17 23:53:03 2011
+++ src/lib/libc/gen/isinfl_ieee754.c	Thu Nov 21 14:14:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: isinfl_ieee754.c,v 1.4 2011/01/17 23:53:03 matt Exp $	*/
+/*	$NetBSD: isinfl_ieee754.c,v 1.5 2013/11/21 14:14:13 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)isinf.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: isinfl_ieee754.c,v 1.4 2011/01/17 23:53:03 matt Exp $");
+__RCSID("$NetBSD: isinfl_ieee754.c,v 1.5 2013/11/21 14:14:13 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -60,7 +60,13 @@ __isinfl(long double x)
 	u.extu_ld = x;
 
 	return u.extu_ext.ext_exp == EXT_EXP_INFNAN
-	&& u.extu_ext.ext_frach == 0 && u.extu_ext.ext_frachm == 0
-	&& u.extu_ext.ext_fraclm == 0 && u.extu_ext.ext_fracl == 0;
+	&& u.extu_ext.ext_frach == 0
+#if EXT_FRACHMBITS
+	&& u.extu_ext.ext_frachm == 0
+#endif
+#if EXT_FRACLMBITS
+	&& u.extu_ext.ext_fraclm == 0
+#endif
+	&& u.extu_ext.ext_fracl == 0;
 }
 #endif /* __HAVE_LONG_DOUBLE */

Index: src/lib/libc/gen/isnanl_ieee754.c
diff -u src/lib/libc/gen/isnanl_ieee754.c:1.6 src/lib/libc/gen/isnanl_ieee754.c:1.7
--- src/lib/libc/gen/isnanl_ieee754.c:1.6	Mon Jan 17 23:53:03 2011
+++ src/lib/libc/gen/isnanl_ieee754.c	Thu Nov 21 14:14:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: isnanl_ieee754.c,v 1.6 2011/01/17 23:53:03 matt Exp $	*/
+/*	$NetBSD: isnanl_ieee754.c,v 1.7 2013/11/21 14:14:13 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)isinf.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: isnanl_ieee754.c,v 1.6 2011/01/17 23:53:03 matt Exp $");
+__RCSID("$NetBSD: isnanl_ieee754.c,v 1.7 2013/11/21 14:14:13 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -60,7 +60,13 @@ __isnanl(long double x)
 	u.extu_ld = x;
 
 	return u.extu_ext.ext_exp == EXT_EXP_INFNAN 
-	&& (u.extu_ext.ext_frach != 0 || u.extu_ext.ext_frachm != 0
-	|| u.extu_ext.ext_fraclm != 0 || u.extu_ext.ext_fracl != 0);
+	&& (u.extu_ext.ext_frach != 0
+#if EXT_FRACHMBITS
+	 || u.extu_ext.ext_frachm != 0
+#endif
+#if EXT_FRACLMBITS
+	 || u.extu_ext.ext_fraclm != 0
+#endif
+	 || u.extu_ext.ext_fracl != 0);
 }
 #endif /* __HAVE_LONG_DOUBLE */



CVS commit: src/lib/libm

2013-11-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 21 11:21:54 UTC 2013

Modified Files:
src/lib/libm: Makefile

Log Message:
e_sqrtl.c requires fenv.h, so only build it on platfomrs supporting that


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/lib/libm/Makefile

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

Modified files:

Index: src/lib/libm/Makefile
diff -u src/lib/libm/Makefile:1.150 src/lib/libm/Makefile:1.151
--- src/lib/libm/Makefile:1.150	Tue Nov 19 19:24:33 2013
+++ src/lib/libm/Makefile	Thu Nov 21 11:21:54 2013
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.150 2013/11/19 19:24:33 joerg Exp $
+#  $NetBSD: Makefile,v 1.151 2013/11/21 11:21:54 martin Exp $
 #
 #  @(#)Makefile 5.1beta 93/09/24
 #
@@ -67,7 +67,7 @@ COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
 .elif (${MACHINE_ARCH} == "sparc64")
 .PATH: ${.CURDIR}/arch/sparc64
 COMMON_SRCS+= fenv.c s_nexttowardf.c \
-	s_nearbyint.c s_rintl.c
+	s_nearbyint.c s_rintl.c e_sqrtl.c
 .ifndef _COMPAT_M32_MK_
 COMMON_SRCS+= s_nexttoward.c
 .endif
@@ -80,7 +80,7 @@ COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
 .PATH:	${.CURDIR}/arch/i387
 
 COMMON_SRCS+= fenv.c s_nexttoward.c s_nexttowardf.c \
-	s_nearbyint.c s_rintl.c
+	s_nearbyint.c s_rintl.c e_sqrtl.c
 COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
 
 ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_expf.S e_fmod.S e_log.S \
@@ -156,7 +156,7 @@ COMMON_SRCS+= b_exp.c b_log.c b_tgamma.c
 	e_j1.c e_j1f.c e_jn.c e_jnf.c e_lgamma_r.c e_lgammaf_r.c e_log.c \
 	e_log2.c e_log10.c e_log10f.c e_log2f.c e_logf.c e_pow.c e_powf.c \
 	e_rem_pio2.c e_rem_pio2f.c e_remainder.c e_remainderf.c e_scalb.c \
-	e_scalbf.c e_sinh.c e_sinhf.c e_sqrt.c e_sqrtf.c e_sqrtl.c \
+	e_scalbf.c e_sinh.c e_sinhf.c e_sqrt.c e_sqrtf.c \
 	k_cos.c k_cosf.c k_rem_pio2.c k_rem_pio2f.c k_sin.c k_sinf.c \
 	k_standard.c k_tan.c k_tanf.c \
 	ldbl_dummy.c \



CVS commit: src/tests/lib/libcurses

2013-11-21 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Thu Nov 21 11:08:08 UTC 2013

Modified Files:
src/tests/lib/libcurses: testframe.txt

Log Message:
Add carriage return to list of valid character substitutions.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libcurses/testframe.txt

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

Modified files:

Index: src/tests/lib/libcurses/testframe.txt
diff -u src/tests/lib/libcurses/testframe.txt:1.2 src/tests/lib/libcurses/testframe.txt:1.3
--- src/tests/lib/libcurses/testframe.txt:1.2	Mon Apr 11 09:02:40 2011
+++ src/tests/lib/libcurses/testframe.txt	Thu Nov 21 11:08:08 2013
@@ -193,6 +193,7 @@ are:
 
 	\e	escape
 	\n	new line
+	\r	carriage return
 	\t	tab
 	\\	\ character
 	\nnn	Where nnn is three octal digits, the character



CVS commit: src/tests/lib/libcurses/director

2013-11-21 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Thu Nov 21 11:06:04 UTC 2013

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
Add carriage return to the quoted character list


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libcurses/director/testlang_conf.l

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.6 src/tests/lib/libcurses/director/testlang_conf.l:1.7
--- src/tests/lib/libcurses/director/testlang_conf.l:1.6	Fri Oct  7 13:39:33 2011
+++ src/tests/lib/libcurses/director/testlang_conf.l	Thu Nov 21 11:06:04 2013
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_conf.l,v 1.6 2011/10/07 13:39:33 joerg Exp $ 	*/
+/*	$NetBSD: testlang_conf.l,v 1.7 2013/11/21 11:06:04 blymn Exp $ 	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -103,6 +103,12 @@ dequote(const char *s, size_t *len)
 	p++;
 	break;
 
+case 'r':
+	/* carriage return */
+	*q++ = '\r';
+	p++;
+	break;
+
 case 't':
 	/* tab */
 	*q++ = '\t';



CVS commit: src/lib/libm/noieee_src

2013-11-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 21 10:48:11 UTC 2013

Modified Files:
src/lib/libm/noieee_src: n_fmod.c

Log Message:
Add fmodf and fmodl


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/noieee_src/n_fmod.c

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

Modified files:

Index: src/lib/libm/noieee_src/n_fmod.c
diff -u src/lib/libm/noieee_src/n_fmod.c:1.5 src/lib/libm/noieee_src/n_fmod.c:1.6
--- src/lib/libm/noieee_src/n_fmod.c:1.5	Thu Aug  7 16:44:51 2003
+++ src/lib/libm/noieee_src/n_fmod.c	Thu Nov 21 10:48:11 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: n_fmod.c,v 1.5 2003/08/07 16:44:51 agc Exp $	*/
+/*	$NetBSD: n_fmod.c,v 1.6 2013/11/21 10:48:11 martin Exp $	*/
 /*
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -66,6 +66,13 @@ static char sccsid[] = "@(#)fmod.c	8.1 (
 extern int isnan(),finite();
 #endif	/* !defined(__vax__) && !defined(tahoe) */
 
+#if DBL_MANT_DIG == LDBL_MANT_DIG && DBL_MIN_EXP == LDBL_MIN_EXP \
+	 && DBL_MIN_EXP == LDBL_MIN_EXP
+#ifdef __weak_alias
+__weak_alias(fmodl, fmod);
+#endif
+#endif
+
 #ifdef TEST_FMOD
 static double
 _fmod(double x, double y)
@@ -95,6 +102,12 @@ fmod(double x, double y)
 	return x >= (double)0 ? r : -r;
 }
 
+float
+fmodf(float x)
+{
+	return fmod(x);
+}
+
 #ifdef TEST_FMOD
 extern long random();
 extern double fmod();



CVS commit: src/lib/libform

2013-11-21 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Thu Nov 21 09:40:19 UTC 2013

Modified Files:
src/lib/libform: field.c

Log Message:
Correct the allocation for the reformat buffer, thanks to mlelstv for
the fix.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libform/field.c

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

Modified files:

Index: src/lib/libform/field.c
diff -u src/lib/libform/field.c:1.25 src/lib/libform/field.c:1.26
--- src/lib/libform/field.c:1.25	Wed Feb  3 15:34:43 2010
+++ src/lib/libform/field.c	Thu Nov 21 09:40:19 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: field.c,v 1.25 2010/02/03 15:34:43 roy Exp $	*/
+/*	$NetBSD: field.c,v 1.26 2013/11/21 09:40:19 blymn Exp $	*/
 /*-
  * Copyright (c) 1998-1999 Brett Lymn
  * (bl...@baea.com.au, brett_l...@yahoo.com.au)
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: field.c,v 1.25 2010/02/03 15:34:43 roy Exp $");
+__RCSID("$NetBSD: field.c,v 1.26 2013/11/21 09:40:19 blymn Exp $");
 
 #include 
 #include 
@@ -472,6 +472,7 @@ field_buffer(FIELD *field, int buffer)
 
 	char *reformat, *p;
 	_FORMI_FIELD_LINES *linep;
+	size_t bufsize;
 	
 	if (field == NULL)
 		return NULL;
@@ -495,12 +496,18 @@ field_buffer(FIELD *field, int buffer)
 		return field->buffers[buffer].string;
 	} else {
 		if (field->row_count > 1) {
-			  /* reformat */
-			reformat = (char *)
-malloc(strlen(field->buffers[buffer].string)
-   + ((field->row_count - 1)
-	  * sizeof(char)) + 1);
 
+			  /*
+			   * compute reformat buffer size
+			   * each line length plus one line feed
+			   * except for last line without line feed
+			   * but plus one NUL character
+			   */
+			bufsize = 0;
+			for (linep=field->alines; linep; linep=linep->next)
+bufsize += strlen(linep->string)+1;
+
+			reformat = (char *)malloc(bufsize);
 			if (reformat == NULL)
 return NULL;
 
@@ -509,24 +516,14 @@ field_buffer(FIELD *field, int buffer)
 			   * newline on last row.
 			   */
 			p = reformat;
-			linep = field->alines;
-			
-			do
-			{
-if (linep->length != 0) {
-	strncpy(p, linep->string,
-		(size_t) linep->length);
-	p += linep->length;
-}
-
-linep = linep->next;
-if (linep != NULL)
-	*p = '\n';
-p++;
+			for (linep=field->alines; linep; linep=linep->next) {
+strcpy(p, linep->string);
+p += strlen(linep->string);
+if (linep->next)
+	*p++ = '\n';
 			}
-			while (linep != NULL);
+			*p = '\0';
 
-			p = '\0';
 			return reformat;
 		} else {
 			asprintf(&reformat, "%s",



CVS commit: src/include

2013-11-21 Thread Arnaud Degroote
Module Name:src
Committed By:   degroote
Date:   Thu Nov 21 09:09:53 UTC 2013

Modified Files:
src/include: wchar.h

Log Message:
Expose properly vfwscanf and friends for POSIX_SOURCE >= 200112L


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/include/wchar.h

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

Modified files:

Index: src/include/wchar.h
diff -u src/include/wchar.h:1.39 src/include/wchar.h:1.40
--- src/include/wchar.h:1.39	Mon Aug 19 08:03:33 2013
+++ src/include/wchar.h	Thu Nov 21 09:09:52 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: wchar.h,v 1.39 2013/08/19 08:03:33 joerg Exp $	*/
+/*	$NetBSD: wchar.h,v 1.40 2013/11/21 09:09:52 degroote Exp $	*/
 
 /*-
  * Copyright (c)1999 Citrus Project,
@@ -145,7 +145,8 @@ long int wcstol(const wchar_t * __restri
 double wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
 
 #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
-defined(_NETBSD_SOURCE)
+defined(_NETBSD_SOURCE) || \
+	(_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600
 float wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
 long double wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
 
@@ -181,7 +182,8 @@ int vwprintf(const wchar_t * __restrict,
 int wprintf(const wchar_t * __restrict, ...);
 int wscanf(const wchar_t * __restrict, ...);
 #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
-defined(_NETBSD_SOURCE)
+defined(_NETBSD_SOURCE) || \
+	(_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600
 int vfwscanf(FILE * __restrict, const wchar_t * __restrict, __va_list);
 int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
 __va_list);