CVS commit: src/lib/libc/gen

2012-10-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 10 23:53:43 UTC 2012

Modified Files:
src/lib/libc/gen: syslog.c

Log Message:
add more locking (when we read and write fields)


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/lib/libc/gen/syslog.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/syslog.c
diff -u src/lib/libc/gen/syslog.c:1.51 src/lib/libc/gen/syslog.c:1.52
--- src/lib/libc/gen/syslog.c:1.51	Wed Oct 10 18:50:51 2012
+++ src/lib/libc/gen/syslog.c	Wed Oct 10 19:53:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslog.c,v 1.51 2012/10/10 22:50:51 christos Exp $	*/
+/*	$NetBSD: syslog.c,v 1.52 2012/10/10 23:53:43 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)syslog.c	8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: syslog.c,v 1.51 2012/10/10 22:50:51 christos Exp $");
+__RCSID("$NetBSD: syslog.c,v 1.52 2012/10/10 23:53:43 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -289,13 +289,19 @@ vsyslogp_r(int pri, struct syslog_data *
 		}
 	} else {
 		prlen = snprintf_ss(p, tbuf_left, "-");
-
-		/* if gmtime_r() was signal-safe we could output the UTC-time:
+#if 0
+		/*
+		 * if gmtime_r() was signal-safe we could output
+		 * the UTC-time:
+		 */
 		gmtime_r(&now, &tmnow);
 		prlen = strftime(p, tbuf_left, "%FT%TZ", &tmnow);
-		*/
+#endif
 	}
 
+	if (data == &sdata)
+		mutex_lock(&syslog_mutex);
+
 	if (data->log_hostname[0] == '\0' && gethostname(data->log_hostname,
 	sizeof(data->log_hostname)) == -1) {
 		/* can this really happen? */
@@ -312,6 +318,10 @@ vsyslogp_r(int pri, struct syslog_data *
 	DEC();
 	prlen = snprintf_ss(p, tbuf_left, "%s ",
 	data->log_tag ? data->log_tag : "-");
+
+	if (data == &sdata)
+		mutex_unlock(&syslog_mutex);
+
 	if (data->log_stat & (LOG_PERROR|LOG_CONS)) {
 		iovcnt = 0;
 		iov[iovcnt].iov_base = p;



CVS commit: src/lib/libc/compat/gen

2012-10-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 10 22:52:26 UTC 2012

Modified Files:
src/lib/libc/compat/gen: Makefile.inc
Added Files:
src/lib/libc/compat/gen: compat_syslog.c

Log Message:
Add compat functions for syslog.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/compat/gen/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/compat/gen/compat_syslog.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/compat/gen/Makefile.inc
diff -u src/lib/libc/compat/gen/Makefile.inc:1.14 src/lib/libc/compat/gen/Makefile.inc:1.15
--- src/lib/libc/compat/gen/Makefile.inc:1.14	Sat Mar 12 14:52:47 2011
+++ src/lib/libc/compat/gen/Makefile.inc	Wed Oct 10 18:52:26 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.14 2011/03/12 19:52:47 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.15 2012/10/10 22:52:26 christos Exp $
 
 .PATH: ${COMPATDIR}/gen
 SRCS+=compat_errlist.c compat_fts.c compat___fts13.c compat___fts30.c \
@@ -9,4 +9,4 @@ SRCS+=compat_errlist.c compat_fts.c comp
 compat__sys_errlist.c compat__sys_nerr.c compat__sys_siglist.c \
 compat_time.c compat_utime.c compat_devname.c compat_alphasort.c \
 compat_getpwent.c compat___fts32.c compat_utmp.c compat___fts50.c \
-compat___unvis13.c
+compat___unvis13.c compat_syslog.c

Added files:

Index: src/lib/libc/compat/gen/compat_syslog.c
diff -u /dev/null src/lib/libc/compat/gen/compat_syslog.c:1.1
--- /dev/null	Wed Oct 10 18:52:26 2012
+++ src/lib/libc/compat/gen/compat_syslog.c	Wed Oct 10 18:52:26 2012
@@ -0,0 +1,151 @@
+/*	$NetBSD: compat_syslog.c,v 1.1 2012/10/10 22:52:26 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 "namespace.h"
+#include 
+
+#define	__LIBC12_SOURCE__
+#include 
+
+#include 
+#include 
+#include 
+
+#ifdef __weak_alias
+__weak_alias(closelog_r,_closelog_r)
+__weak_alias(openlog_r,_openlog_r)
+__weak_alias(setlogmask_r,_setlogmask_r)
+__weak_alias(syslog_r,_syslog_r)
+__weak_alias(vsyslog_r,_vsyslog_r)
+__weak_alias(syslogp_r,_syslogp_r)
+__weak_alias(vsyslogp_r,_vsyslogp_r)
+#endif /* __weak_alias */
+
+__warn_references(closelog_r,
+"warning: reference to compatibility closelog_r();"
+" include  for correct reference")
+__warn_references(openlog_r,
+"warning: reference to compatibility openlog_r();"
+" include  for correct reference")
+__warn_references(setlogmask_r,
+"warning: reference to compatibility setlogmask_r();"
+" include  for correct reference")
+__warn_references(syslog_r,
+"warning: reference to compatibility syslog_r();"
+" include  for correct reference")
+__warn_references(vsyslog_r,
+"warning: reference to compatibility vsyslog_r();"
+" include  for correct reference")
+__warn_references(syslogp_r,
+"warning: reference to compatibility syslogp_r();"
+" include  for correct reference")
+__warn_references(vsyslogp_r,
+"warning: reference to compatibility vsyslogp_r();"
+" include  for correct reference")
+
+static void
+syslog_data_convert(struct syslog_data *d, const struct syslog_data60 *s)
+{
+	d->log_file = s->log_file;
+	d->log_connected = s->connected;
+	d->log_opened = s->opened;
+	d->log_stat = s->log_stat;
+	d->log_tag = s->log_tag;
+	d->log_fac = s->log_fac;
+	d->log_mask = s->log_mask;
+}
+
+void
+closelog_r(struct syslog_data60 *data60)
+{
+	struct syslog_data data = SYSLOG_DATA_INIT;
+	syslog_data_convert(&dat

CVS commit: src/sys/sys

2012-10-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 10 22:51:55 UTC 2012

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

Log Message:
PR/47055: David Holland: Add hostname to syslog_data, version number, rename
fields consistently, and version library calls affected.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/sys/syslog.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/syslog.h
diff -u src/sys/sys/syslog.h:1.34 src/sys/sys/syslog.h:1.35
--- src/sys/sys/syslog.h:1.34	Sun Nov 20 23:36:06 2011
+++ src/sys/sys/syslog.h	Wed Oct 10 18:51:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslog.h,v 1.34 2011/11/21 04:36:06 christos Exp $	*/
+/*	$NetBSD: syslog.h,v 1.35 2012/10/10 22:51:55 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
@@ -170,17 +170,25 @@ CODE facilitynames[] = {
 /* Used by reentrant functions */
 
 struct syslog_data {
+	int	log_version;
 	int	log_file;
-	int	connected;
-	int	opened;
+	int	log_connected;
+	int	log_opened;
 	int	log_stat;
 	const char 	*log_tag;
+	char	log_hostname[256];	/* MAXHOSTNAMELEN */
 	int 	log_fac;
 	int 	log_mask;
 };
 
 #define SYSLOG_DATA_INIT { \
+.log_version = 1, \
 .log_file = -1, \
+.log_connected = 0, \
+.log_opened = 0, \
+.log_stat = 0, \
+.log_tag  = 0, \
+.log_hostname = { '\0' }, \
 .log_fac = LOG_USER, \
 .log_mask = 0xff, \
 }
@@ -196,21 +204,24 @@ int	setlogmask(int);
 void	syslog(int, const char *, ...) __printflike(2, 3);
 #if defined(_NETBSD_SOURCE)
 void	vsyslog(int, const char *, __va_list) __printflike(2, 0);
-void	closelog_r(struct syslog_data *);
-void	openlog_r(const char *, int, int, struct syslog_data *);
-int	setlogmask_r(int, struct syslog_data *);
+#ifndef __LIBC12_SOURCE__
+void	closelog_r(struct syslog_data *) __RENAME(__closelog_r60);
+void	openlog_r(const char *, int, int, struct syslog_data *)
+__RENAME(__openlog_r60);
+int	setlogmask_r(int, struct syslog_data *) __RENAME(__setlogmask_r60);
 void	syslog_r(int, struct syslog_data *, const char *, ...)
-__printflike(3, 4);
+__RENAME(__syslog_r60) __printflike(3, 4);
 void	vsyslog_r(int, struct syslog_data *, const char *, __va_list)
-__printflike(3, 0);
-void syslogp(int, const char *, const char *, const char *, ...)
+__RENAME(__vsyslog_r60) __printflike(3, 0);
+void	syslogp_r(int, struct syslog_data *, const char *, const char *,
+const char *, ...) __RENAME(__syslogp_r60) __printflike(5, 6);
+void	vsyslogp_r(int, struct syslog_data *, const char *, const char *,
+const char *, __va_list) __RENAME(__vsyslogp_r60) __printflike(5, 0);
+#endif
+void	syslogp(int, const char *, const char *, const char *, ...)
 __printflike(4, 5);
-void vsyslogp(int, const char *, const char *, const char *, __va_list)
+void	vsyslogp(int, const char *, const char *, const char *, __va_list)
 __printflike(4, 0);
-void syslogp_r(int, struct syslog_data *, const char *, const char *,
-const char *, ...) __printflike(5, 6);
-void vsyslogp_r(int, struct syslog_data *, const char *, const char *,
-const char *, __va_list) __printflike(5, 0);
 #endif
 __END_DECLS
 



CVS commit: src/sys/compat/sys

2012-10-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 10 22:51:12 UTC 2012

Added Files:
src/sys/compat/sys: syslog.h

Log Message:
compat hook.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/compat/sys/syslog.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/compat/sys/syslog.h
diff -u /dev/null src/sys/compat/sys/syslog.h:1.1
--- /dev/null	Wed Oct 10 18:51:12 2012
+++ src/sys/compat/sys/syslog.h	Wed Oct 10 18:51:12 2012
@@ -0,0 +1,73 @@
+/*	$NetBSD: syslog.h,v 1.1 2012/10/10 22:51:12 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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.
+ */
+#ifndef _COMPAT_SYS_SYSLOG_H_
+#define _COMPAT_SYS_SYSLOG_H_
+
+struct syslog_data60 {
+	int	log_file;
+	int	connected;
+	int	opened;
+	int	log_stat;
+	const char 	*log_tag;
+	int 	log_fac;
+	int 	log_mask;
+};
+
+__BEGIN_DECLS
+#ifdef __LIBC12_SOURCE__
+void	closelog_r(struct syslog_data60 *);
+void	openlog_r(const char *, int, int, struct syslog_data60 *);
+int	setlogmask_r(int, struct syslog_data60 *);
+void	syslog_r(int, struct syslog_data60 *, const char *, ...)
+__printflike(3, 4);
+void	vsyslog_r(int, struct syslog_data60 *, const char *, __va_list)
+__printflike(3, 0);
+void	syslogp_r(int, struct syslog_data60 *, const char *, const char *,
+const char *, ...) __printflike(5, 6);
+void	vsyslogp_r(int, struct syslog_data60 *, const char *, const char *,
+const char *, __va_list) __printflike(5, 0);
+
+struct syslog_data;
+void	__closelog_r60(struct syslog_data *);
+void	__openlog_r60(const char *, int, int, struct syslog_data *);
+int	__setlogmask_r60(int, struct syslog_data *);
+void	__syslog_r60(int, struct syslog_data *, const char *, ...)
+__printflike(3, 4);
+void	__vsyslog_r60(int, struct syslog_data *, const char *, __va_list)
+__printflike(3, 0);
+void 	__syslogp_r60(int, struct syslog_data *, const char *, const char *,
+const char *, ...) __printflike(5, 6);
+void	__vsyslogp_r60(int, struct syslog_data *, const char *, const char *,
+const char *, __va_list) __printflike(5, 0);
+#endif
+__END_DECLS
+
+#endif /* !_COMPAT_SYS_SYSLOG_H_ */



CVS commit: src/lib/libc/gen

2012-10-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 10 22:50:51 UTC 2012

Modified Files:
src/lib/libc/gen: syslog.c

Log Message:
PR/47055: David Holland: Remove static hostname and store the hostname in
syslog_data. Initialize hostname before it is used. While here, add a version
to syslog_data.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/lib/libc/gen/syslog.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/syslog.c
diff -u src/lib/libc/gen/syslog.c:1.50 src/lib/libc/gen/syslog.c:1.51
--- src/lib/libc/gen/syslog.c:1.50	Tue Mar 13 17:13:37 2012
+++ src/lib/libc/gen/syslog.c	Wed Oct 10 18:50:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslog.c,v 1.50 2012/03/13 21:13:37 christos Exp $	*/
+/*	$NetBSD: syslog.c,v 1.51 2012/10/10 22:50:51 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)syslog.c	8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: syslog.c,v 1.50 2012/03/13 21:13:37 christos Exp $");
+__RCSID("$NetBSD: syslog.c,v 1.51 2012/10/10 22:50:51 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -68,15 +68,8 @@ __weak_alias(vsyslog,_vsyslog)
 __weak_alias(syslogp,_syslogp)
 __weak_alias(vsyslogp,_vsyslogp)
 
-__weak_alias(closelog_r,_closelog_r)
-__weak_alias(openlog_r,_openlog_r)
-__weak_alias(setlogmask_r,_setlogmask_r)
-__weak_alias(syslog_r,_syslog_r)
-__weak_alias(vsyslog_r,_vsyslog_r)
 __weak_alias(syslog_ss,_syslog_ss)
 __weak_alias(vsyslog_ss,_vsyslog_ss)
-__weak_alias(syslogp_r,_syslogp_r)
-__weak_alias(vsyslogp_r,_vsyslogp_r)
 __weak_alias(syslogp_ss,_syslogp_ss)
 __weak_alias(vsyslogp_ss,_vsyslogp_ss)
 #endif
@@ -95,8 +88,6 @@ static void	connectlog_r(struct syslog_d
 static mutex_t	syslog_mutex = MUTEX_INITIALIZER;
 #endif
 
-static char hostname[MAXHOSTNAMELEN];
-
 /*
  * syslog, vsyslog --
  *	print message on log file; output is intended for syslogd(8).
@@ -304,13 +295,21 @@ vsyslogp_r(int pri, struct syslog_data *
 		prlen = strftime(p, tbuf_left, "%FT%TZ", &tmnow);
 		*/
 	}
+
+	if (data->log_hostname[0] == '\0' && gethostname(data->log_hostname,
+	sizeof(data->log_hostname)) == -1) {
+		/* can this really happen? */
+		data->log_hostname[0] = '-';
+		data->log_hostname[1] = '\0';
+	}
+
 	DEC();
-	prlen = snprintf_ss(p, tbuf_left, " %s ", hostname);
-	DEC();
+	prlen = snprintf_ss(p, tbuf_left, " %s ", data->log_hostname);
 
 	if (data->log_tag == NULL)
 		data->log_tag = getprogname();
 
+	DEC();
 	prlen = snprintf_ss(p, tbuf_left, "%s ",
 	data->log_tag ? data->log_tag : "-");
 	if (data->log_stat & (LOG_PERROR|LOG_CONS)) {
@@ -424,7 +423,7 @@ vsyslogp_r(int pri, struct syslog_data *
 	/* Get connected, output the message to the local logger. */
 	if (data == &sdata)
 		mutex_lock(&syslog_mutex);
-	opened = !data->opened;
+	opened = !data->log_opened;
 	if (opened)
 		openlog_unlocked_r(data->log_tag, data->log_stat, 0, data);
 	connectlog_r(data);
@@ -483,7 +482,7 @@ disconnectlog_r(struct syslog_data *data
 		(void)close(data->log_file);
 		data->log_file = -1;
 	}
-	data->connected = 0;		/* retry connect */
+	data->log_connected = 0;		/* retry connect */
 }
 
 static void
@@ -500,16 +499,16 @@ connectlog_r(struct syslog_data *data)
 		if ((data->log_file = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC,
 		0)) == -1)
 			return;
-		data->connected = 0;
+		data->log_connected = 0;
 	}
-	if (!data->connected) {
+	if (!data->log_connected) {
 		if (connect(data->log_file,
 		(const struct sockaddr *)(const void *)&sun,
 		(socklen_t)sizeof(sun)) == -1) {
 			(void)close(data->log_file);
 			data->log_file = -1;
 		} else
-			data->connected = 1;
+			data->log_connected = 1;
 	}
 }
 
@@ -526,14 +525,7 @@ openlog_unlocked_r(const char *ident, in
 	if (data->log_stat & LOG_NDELAY)	/* open immediately */
 		connectlog_r(data);
 
-	/* We could cache this, but then it might change */
-	if (gethostname(hostname, sizeof(hostname)) == -1
-	|| hostname[0] == '\0') {
-		/* can this really happen? */
-		hostname[0] = '-';
-		hostname[1] = '\0';
-	}
-	data->opened = 1;
+	data->log_opened = 1;
 }
 
 void
@@ -553,7 +545,7 @@ closelog_r(struct syslog_data *data)
 		mutex_lock(&syslog_mutex);
 	(void)close(data->log_file);
 	data->log_file = -1;
-	data->connected = 0;
+	data->log_connected = 0;
 	data->log_tag = NULL;
 	if (data == &sdata)
 		mutex_unlock(&syslog_mutex);



CVS commit: src/sys/dev/ic

2012-10-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct 10 22:40:33 UTC 2012

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

Log Message:
Second part of PR/46998. The following is taken from the PR with a slight
edit from me.

The TX buffer size is not a function of the SEEQ chip, it is an arbitrary
driver threshold, so I've renamed the define accordingly and added a new
one to specify how many buffers are used (in my port I allow multiple
packets to be in flight at once, so have used #ifndef, such that the
makefile can override).

Comment corrected, and make use of the above defines.

Missing delay(1) added, otherwise the 20,000 timeout loop is dependent
on the speed of your processor. Matches ea_stoptx logic now.

The FIFO empty check does nothing if the previous mode was 'read', but is
required before changing the BUFCODE (per 80C04 datasheet page 19,
note [2]). Then the mode is set to write, so a second FIFO empty check is
needed incase the previous mode was read.

Treat m0 as a pointer not an integer.

Remove double write of the NULL packet header. Either do
memset/ea_writebuf or two writes to SEEQ_BUFWIN, but not both.

The calculation of nextpacket (for hdr[]) assumes bufstart = 0, and puts
the packet header pointing in the wrong place when it isn't.

The setting of CFG2_OUTPUT is done in ea_init(), so doing it in ea_rxinit
is duplicated code.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/ic/seeq8005.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/seeq8005.c
diff -u src/sys/dev/ic/seeq8005.c:1.50 src/sys/dev/ic/seeq8005.c:1.51
--- src/sys/dev/ic/seeq8005.c:1.50	Wed Oct 10 22:17:44 2012
+++ src/sys/dev/ic/seeq8005.c	Wed Oct 10 22:40:33 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: seeq8005.c,v 1.50 2012/10/10 22:17:44 skrll Exp $ */
+/* $NetBSD: seeq8005.c,v 1.51 2012/10/10 22:40:33 skrll Exp $ */
 
 /*
  * Copyright (c) 2000, 2001 Ben Harris
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.50 2012/10/10 22:17:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.51 2012/10/10 22:40:33 skrll Exp $");
 
 #include 
 #include 
@@ -106,7 +106,12 @@ int seeq8005_debug = 0;
 #define DPRINTF(f, x)
 #endif
 
-#define	SEEQ_TX_BUFFER_SIZE		0x800		/* (> ETHER_MAX_LEN) */
+#ifndef EA_TX_BUFFER_SIZE
+#define EA_TX_BUFFER_SIZE		0x800		/* (> ETHER_MAX_LEN) */
+#endif
+#ifndef EA_TX_BUFFER_COUNT
+#define EA_TX_BUFFER_COUNT		1		/* (> 0) */
+#endif
 
 #define SEEQ_READ16(sc, iot, ioh, reg)	\
 	((sc)->sc_flags & SF_8BIT ?	\
@@ -225,12 +230,11 @@ seeq8005_attach(struct seeq8005_softc *s
 	/*
 	 * Set up tx and rx buffers.
 	 *
-	 * We use approximately a quarter of the packet memory for TX
+	 * We set aside EA_TX_BUFFER_SIZE * EA_TX_BUFFER_COUNT for TX
 	 * buffers and the rest for RX buffers
 	 */
-	/* sc->sc_tx_bufs = sc->sc_buffersize / SEEQ_TX_BUFFER_SIZE / 4; */
-	sc->sc_tx_bufs = 1;
-	sc->sc_tx_bufsize = sc->sc_tx_bufs * SEEQ_TX_BUFFER_SIZE;
+	sc->sc_tx_bufs = EA_TX_BUFFER_COUNT;
+	sc->sc_tx_bufsize = sc->sc_tx_bufs * EA_TX_BUFFER_SIZE;
 	sc->sc_rx_bufsize = sc->sc_buffersize - sc->sc_tx_bufsize;
 	sc->sc_enabled = 0;
 
@@ -443,6 +447,7 @@ ea_stoprx(struct seeq8005_softc *sc)
 	timeout = 2;
 	do {
 		status = SEEQ_READ16(sc, iot, ioh, SEEQ_STATUS);
+		delay(1);
 	} while ((status & SEEQ_STATUS_RX_ON) && --timeout > 0);
 	if (timeout == 0)
 		log(LOG_ERR, "%s: timeout waiting for rx termination\n",
@@ -604,6 +609,9 @@ ea_writebuf(struct seeq8005_softc *sc, u
 		ea_select_buffer(sc, SEEQ_BUFCODE_LOCAL_MEM);
 		SEEQ_WRITE16(sc, iot, ioh, SEEQ_COMMAND,
 		sc->sc_command | SEEQ_CMD_FIFO_WRITE);
+
+		ea_await_fifo_empty(sc);
+
 		SEEQ_WRITE16(sc, iot, ioh, SEEQ_DMA_ADDR, addr);
 	}
 
@@ -901,7 +909,7 @@ ea_txpacket(struct seeq8005_softc *sc)
 	IFQ_DEQUEUE(&ifp->if_snd, m0);
 
 	/* If there's nothing to send, return. */
-	if (!m0) {
+	if (m0 == NULL) {
 		ifp->if_flags &= ~IFF_OACTIVE;
 		sc->sc_config2 |= SEEQ_CFG2_OUTPUT;
 		SEEQ_WRITE16(sc, iot, ioh, SEEQ_CONFIG2, sc->sc_config2);
@@ -968,20 +976,18 @@ ea_writembuf(struct seeq8005_softc *sc, 
 	/* Follow it with a NULL packet header */
 	memset(hdr, 0, 4);
 	ea_writebuf(sc, hdr, bufstart + 4 + len, 4);
-	SEEQ_WRITE16(sc, sc->sc_iot, sc->sc_ioh, SEEQ_BUFWIN, 0x);
-	SEEQ_WRITE16(sc, sc->sc_iot, sc->sc_ioh, SEEQ_BUFWIN, 0x);
 
 	/* Ok we now have a packet len bytes long in our packet buffer */
 	DPRINTF(SEEQ_DEBUG_TX, ("ea_writembuf: length=%d\n", len));
 
 	/* Write the packet header */
-	nextpacket = len + 4;
+	nextpacket = bufstart + len + 4;
 	hdr[0] = (nextpacket >> 8) & 0xff;
 	hdr[1] = nextpacket & 0xff;
 	hdr[2] = SEEQ_PKTCMD_TX | SEEQ_PKTCMD_DATA_FOLLOWS |
 		SEEQ_TXCMD_XMIT_SUCCESS_INT | SEEQ_TXCMD_COLLISION_INT;
 	hdr[3] = 0; /* Status byte -- will be updated by hardware. */
-	ea_writebuf(sc, hdr, 0x, 4);
+	ea_writebuf(sc, hdr, bufstart, 4);
 
 	return len;

CVS commit: src/sys/dev

2012-10-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct 10 22:17:44 UTC 2012

Modified Files:
src/sys/dev/ic: seeq8005.c seeq8005var.h
src/sys/dev/podulebus: if_ea.c if_eb.c

Log Message:
Split softc/device_t
Use device_xname

>From chuq


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/ic/seeq8005.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/seeq8005var.h
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/podulebus/if_ea.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/podulebus/if_eb.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/seeq8005.c
diff -u src/sys/dev/ic/seeq8005.c:1.49 src/sys/dev/ic/seeq8005.c:1.50
--- src/sys/dev/ic/seeq8005.c:1.49	Wed Oct 10 22:11:31 2012
+++ src/sys/dev/ic/seeq8005.c	Wed Oct 10 22:17:44 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: seeq8005.c,v 1.49 2012/10/10 22:11:31 skrll Exp $ */
+/* $NetBSD: seeq8005.c,v 1.50 2012/10/10 22:17:44 skrll Exp $ */
 
 /*
  * Copyright (c) 2000, 2001 Ben Harris
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.49 2012/10/10 22:11:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.50 2012/10/10 22:17:44 skrll Exp $");
 
 #include 
 #include 
@@ -184,7 +184,7 @@ seeq8005_attach(struct seeq8005_softc *s
 		SEEQ_WRITE16(sc, iot, ioh, SEEQ_RX_PTR, 0x1234);
 		if (SEEQ_READ16(sc, iot, ioh, SEEQ_RX_PTR) != 0x1234) {
 			aprint_normal("\n");
-			aprint_error_dev(&sc->sc_dev, "Cannot determine data bus width\n");
+			aprint_error_dev(sc->sc_dev, "Cannot determine data bus width\n");
 			return;
 		}
 	}
@@ -238,21 +238,21 @@ seeq8005_attach(struct seeq8005_softc *s
 	ea_ramtest(sc);
 
 	printf("%s: %dKB packet memory, txbuf=%dKB (%d buffers), rxbuf=%dKB",
-	device_xname(&sc->sc_dev), sc->sc_buffersize >> 10,
+	device_xname(sc->sc_dev), sc->sc_buffersize >> 10,
 	sc->sc_tx_bufsize >> 10, sc->sc_tx_bufs, sc->sc_rx_bufsize >> 10);
 
 	if (padbuf == NULL) {
 		padbuf = malloc(ETHER_MIN_LEN - ETHER_CRC_LEN, M_DEVBUF,
 		M_ZERO | M_NOWAIT);
 		if (padbuf == NULL) {
-			aprint_error_dev(&sc->sc_dev, "can't allocate pad buffer\n");
+			aprint_error_dev(sc->sc_dev, "can't allocate pad buffer\n");
 			return;
 		}
 	}
 
 	/* Initialise ifnet structure. */
 
-	strlcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 	ifp->if_softc = sc;
 	ifp->if_start = ea_start;
 	ifp->if_ioctl = ea_ioctl;
@@ -288,7 +288,7 @@ seeq8005_attach(struct seeq8005_softc *s
 	printf("\n");
 
 	/* After \n because it can print a line of its own. */
-	rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev),
+	rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
 	RND_TYPE_NET, 0);
 }
 
@@ -369,7 +369,7 @@ do {	\
 	/* Report */
 
 	if (sum > 0)
-		aprint_error_dev(&sc->sc_dev, "buffer RAM failed self test, %d faults\n", sum);
+		aprint_error_dev(sc->sc_dev, "buffer RAM failed self test, %d faults\n", sum);
 }
 
 
@@ -406,7 +406,7 @@ ea_stoptx(struct seeq8005_softc *sc)
 	} while ((status & SEEQ_STATUS_TX_ON) && --timeout > 0);
  	if (timeout == 0)
 		log(LOG_ERR, "%s: timeout waiting for tx termination\n",
-		device_xname(&sc->sc_dev));
+		device_xname(sc->sc_dev));
 
 	/* Clear any pending tx interrupt */
 	SEEQ_WRITE16(sc, iot, ioh, SEEQ_COMMAND,
@@ -446,7 +446,7 @@ ea_stoprx(struct seeq8005_softc *sc)
 	} while ((status & SEEQ_STATUS_RX_ON) && --timeout > 0);
 	if (timeout == 0)
 		log(LOG_ERR, "%s: timeout waiting for rx termination\n",
-		device_xname(&sc->sc_dev));
+		device_xname(sc->sc_dev));
 
 	/* Clear any pending rx interrupt */
 
@@ -551,7 +551,7 @@ ea_await_fifo_empty(struct seeq8005_soft
 		if (SEEQ_READ16(sc, iot, ioh, SEEQ_STATUS) &
 		SEEQ_STATUS_FIFO_EMPTY)
 			return;
-	log(LOG_ERR, "%s: DMA FIFO failed to empty\n", device_xname(&sc->sc_dev));
+	log(LOG_ERR, "%s: DMA FIFO failed to empty\n", device_xname(sc->sc_dev));
 }
 
 /*
@@ -569,7 +569,7 @@ ea_await_fifo_full(struct seeq8005_softc
 		if (SEEQ_READ16(sc, iot, ioh, SEEQ_STATUS) &
 		SEEQ_STATUS_FIFO_FULL)
 			return;
-	log(LOG_ERR, "%s: DMA FIFO failed to fill\n", device_xname(&sc->sc_dev));
+	log(LOG_ERR, "%s: DMA FIFO failed to fill\n", device_xname(sc->sc_dev));
 }
 
 /*
@@ -593,9 +593,9 @@ ea_writebuf(struct seeq8005_softc *sc, u
 
 #ifdef DIAGNOSTIC
 	if (__predict_false(!ALIGNED_POINTER(buf, u_int16_t)))
-		panic("%s: unaligned writebuf", device_xname(&sc->sc_dev));
+		panic("%s: unaligned writebuf", device_xname(sc->sc_dev));
 	if (__predict_false(addr >= SEEQ_MAX_BUFFER_SIZE))
-		panic("%s: writebuf out of range", device_xname(&sc->sc_dev));
+		panic("%s: writebuf out of range", device_xname(sc->sc_dev));
 #endif
 
 	if (addr != -1) {
@@ -646,9 +646,9 @@ ea_readbuf(struct seeq8005_softc *sc, u_
 
 #ifdef DIAGNOSTIC
 	if (__predict_false(!ALIGNED_POINTER(buf, u_int16_t)))
-		panic("%s: unaligned readbuf", device_xn

CVS commit: src/sys/dev/ic

2012-10-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct 10 22:11:31 UTC 2012

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

Log Message:
Rename eatxpacket to ea_txpacket for consistency.

First part of PR/46998


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ic/seeq8005.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/seeq8005.c
diff -u src/sys/dev/ic/seeq8005.c:1.48 src/sys/dev/ic/seeq8005.c:1.49
--- src/sys/dev/ic/seeq8005.c:1.48	Sun Jun 10 15:00:49 2012
+++ src/sys/dev/ic/seeq8005.c	Wed Oct 10 22:11:31 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: seeq8005.c,v 1.48 2012/06/10 15:00:49 christos Exp $ */
+/* $NetBSD: seeq8005.c,v 1.49 2012/10/10 22:11:31 skrll Exp $ */
 
 /*
  * Copyright (c) 2000, 2001 Ben Harris
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.48 2012/06/10 15:00:49 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.49 2012/10/10 22:11:31 skrll Exp $");
 
 #include 
 #include 
@@ -145,7 +145,7 @@ static void ea_read(struct seeq8005_soft
 static struct mbuf *ea_get(struct seeq8005_softc *, int, int, struct ifnet *);
 static void ea_txint(struct seeq8005_softc *);
 static void ea_rxint(struct seeq8005_softc *);
-static void eatxpacket(struct seeq8005_softc *);
+static void ea_txpacket(struct seeq8005_softc *);
 static int ea_writembuf(struct seeq8005_softc *, struct mbuf *, int);
 static void ea_mc_reset(struct seeq8005_softc *);
 static void ea_mc_reset_8004(struct seeq8005_softc *);
@@ -832,7 +832,7 @@ ea_init(struct ifnet *ifp)
 	SEEQ_WRITE16(sc, iot, ioh, SEEQ_COMMAND,
 			  sc->sc_command | SEEQ_CMD_RX_ON);
 
-	/* TX_ON gets set by eatxpacket when there's something to transmit. */
+	/* TX_ON gets set by ea_txpacket when there's something to transmit. */
 
 
 	/* Set flags appropriately. */
@@ -864,7 +864,7 @@ ea_start(struct ifnet *ifp)
 
 	/*
 	 * Don't do anything if output is active.  seeq8005intr() will call
-	 * us (actually eatxpacket()) back when the card's ready for more
+	 * us (actually ea_txpacket()) back when the card's ready for more
 	 * frames.
 	 */
 	if (ifp->if_flags & IFF_OACTIVE)
@@ -876,7 +876,7 @@ ea_start(struct ifnet *ifp)
 
 	/* tx packets */
 
-	eatxpacket(sc);
+	ea_txpacket(sc);
 	splx(s);
 }
 
@@ -888,7 +888,7 @@ ea_start(struct ifnet *ifp)
  */
 
 static void
-eatxpacket(struct seeq8005_softc *sc)
+ea_txpacket(struct seeq8005_softc *sc)
 {
 	bus_space_tag_t iot = sc->sc_iot;
 	bus_space_handle_t ioh = sc->sc_ioh;
@@ -1107,7 +1107,7 @@ ea_txint(struct seeq8005_softc *sc)
 
 		/* Tx next packet */
 
-		eatxpacket(sc);
+		ea_txpacket(sc);
 	}
 }
 



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

2012-10-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct 10 22:00:22 UTC 2012

Modified Files:
src/sys/arch/arm/iomd: iomd.c vidcaudio.c

Log Message:
Use device_xname.

>From chuq.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/iomd/iomd.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/arm/iomd/vidcaudio.c

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

Modified files:

Index: src/sys/arch/arm/iomd/iomd.c
diff -u src/sys/arch/arm/iomd/iomd.c:1.20 src/sys/arch/arm/iomd/iomd.c:1.21
--- src/sys/arch/arm/iomd/iomd.c:1.20	Mon May 14 11:05:29 2012
+++ src/sys/arch/arm/iomd/iomd.c	Wed Oct 10 22:00:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: iomd.c,v 1.20 2012/05/14 11:05:29 skrll Exp $	*/
+/*	$NetBSD: iomd.c,v 1.21 2012/10/10 22:00:22 skrll Exp $	*/
 
 /*
  * Copyright (c) 1996-1997 Mark Brinicombe.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: iomd.c,v 1.20 2012/05/14 11:05:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iomd.c,v 1.21 2012/10/10 22:00:22 skrll Exp $");
 
 #include 
 #include 
@@ -156,7 +156,7 @@ iomdattach(device_t parent, device_t sel
 
 	/* Map the IOMD */
 	if (bus_space_map(iot, (int) iomd_base, IOMD_SIZE, 0, &ioh))
-		panic("%s: Cannot map registers", self->dv_xname);
+		panic("%s: Cannot map registers", device_xname(self));
 
 	sc->sc_ioh = ioh;
 
@@ -191,7 +191,7 @@ iomdattach(device_t parent, device_t sel
 	aprint_normal("version %d\n", bus_space_read_1(iot, ioh, IOMD_VERSION));
 
 	/* Report the DRAM refresh rate */
-	aprint_normal("%s: ", self->dv_xname);
+	aprint_normal("%s: ", device_xname(self));
 	aprint_normal("DRAM refresh=");
 	switch (refresh) {
 	case 0x0:
@@ -221,7 +221,7 @@ iomdattach(device_t parent, device_t sel
 	 * attached
 	 */
 	tmp = bus_space_read_1(iot, ioh, IOMD_IOTCR);
-	aprint_normal("%s: I/O timings: combo %c, NPCCS1/2 %c", self->dv_xname,
+	aprint_normal("%s: I/O timings: combo %c, NPCCS1/2 %c", device_xname(self),
 	'A' + ((tmp >>2) & 3), 'A' + (tmp & 3));
 	tmp = bus_space_read_1(iot, ioh, IOMD_ECTCR);
 	aprint_normal(", EASI ");
@@ -257,7 +257,7 @@ iomdattach(device_t parent, device_t sel
 
 	/* Attach kbd device when configured */
 	if (bus_space_subregion(iot, ioh, IOMD_KBDDAT, 8, &ia.ia_kbd.ka_ioh))
-		panic("%s: Cannot map kbd registers", self->dv_xname);
+		panic("%s: Cannot map kbd registers", device_xname(self));
 	ia.ia_kbd.ka_name = "kbd";
 	ia.ia_kbd.ka_iot = iot;
 	ia.ia_kbd.ka_rxirq = IRQ_KBDRX;
@@ -267,7 +267,7 @@ iomdattach(device_t parent, device_t sel
 	/* Attach iic device */
 
 	if (bus_space_subregion(iot, ioh, IOMD_IOCR, 4, &ia.ia_iic.ia_ioh))
-		panic("%s: Cannot map iic registers", self->dv_xname);
+		panic("%s: Cannot map iic registers", device_xname(self));
 	ia.ia_iic.ia_name = "iic";
 	ia.ia_iic.ia_iot = iot;
 	ia.ia_iic.ia_irq = -1;
@@ -280,7 +280,7 @@ iomdattach(device_t parent, device_t sel
 
 		if (bus_space_subregion(iot, ioh, IOMD_MSDATA, 8,
 			&ia.ia_opms.pa_ioh))
-			panic("%s: Cannot map opms registers", self->dv_xname);
+			panic("%s: Cannot map opms registers", device_xname(self));
 		ia.ia_opms.pa_name = "opms";
 		ia.ia_opms.pa_iot = iot;
 		ia.ia_opms.pa_irq = IRQ_MSDRX;
@@ -291,10 +291,10 @@ iomdattach(device_t parent, device_t sel
 
 		if (bus_space_subregion(iot, ioh, IOMD_MOUSEX, 8,
 			&ia.ia_qms.qa_ioh))
-			panic("%s: Cannot map qms registers", self->dv_xname);
+			panic("%s: Cannot map qms registers", device_xname(self));
 
 		if (bus_space_map(iot, IO_MOUSE_BUTTONS, 4, 0, &ia.ia_qms.qa_ioh_but))
-			panic("%s: Cannot map registers", self->dv_xname);
+			panic("%s: Cannot map registers", device_xname(self));
 		ia.ia_qms.qa_name = "qms";
 		ia.ia_qms.qa_iot = iot;
 		ia.ia_qms.qa_irq = IRQ_VSYNC;

Index: src/sys/arch/arm/iomd/vidcaudio.c
diff -u src/sys/arch/arm/iomd/vidcaudio.c:1.50 src/sys/arch/arm/iomd/vidcaudio.c:1.51
--- src/sys/arch/arm/iomd/vidcaudio.c:1.50	Mon May 14 10:38:08 2012
+++ src/sys/arch/arm/iomd/vidcaudio.c	Wed Oct 10 22:00:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vidcaudio.c,v 1.50 2012/05/14 10:38:08 skrll Exp $	*/
+/*	$NetBSD: vidcaudio.c,v 1.51 2012/10/10 22:00:22 skrll Exp $	*/
 
 /*
  * Copyright (c) 1995 Melvin Tang-Richardson
@@ -65,7 +65,7 @@
 
 #include 	/* proc.h */
 
-__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.50 2012/05/14 10:38:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.51 2012/10/10 22:00:22 skrll Exp $");
 
 #include 
 #include/* autoconfig functions */
@@ -253,11 +253,11 @@ vidcaudio_attach(device_t parent, device
 	sc->sc_ih.ih_func = vidcaudio_intr;
 	sc->sc_ih.ih_arg = sc;
 	sc->sc_ih.ih_level = IPL_AUDIO;
-	sc->sc_ih.ih_name = self->dv_xname;
+	sc->sc_ih.ih_name = device_xname(self);
 
 	if (irq_claim(sc->sc_dma_intr, &sc->sc_ih) != 0) {
 		aprint_error("%s: couldn't claim IRQ %d\n",
-		self->dv_xname, sc->sc_dma_intr);
+		device_xname(self), sc->sc_dma_intr);
 		return;
 	}
 



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

2012-10-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct 10 21:54:14 UTC 2012

Modified Files:
src/sys/arch/evbarm/dev: plcom.c

Log Message:
Fix #if 0'ed code.

>From chuq


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/evbarm/dev/plcom.c

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

Modified files:

Index: src/sys/arch/evbarm/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.42 src/sys/arch/evbarm/dev/plcom.c:1.43
--- src/sys/arch/evbarm/dev/plcom.c:1.42	Fri Aug 17 09:38:51 2012
+++ src/sys/arch/evbarm/dev/plcom.c	Wed Oct 10 21:54:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcom.c,v 1.42 2012/08/17 09:38:51 skrll Exp $	*/
+/*	$NetBSD: plcom.c,v 1.43 2012/10/10 21:54:13 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 ARM Ltd
@@ -94,7 +94,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.42 2012/08/17 09:38:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.43 2012/10/10 21:54:13 skrll Exp $");
 
 #include "opt_plcom.h"
 #include "opt_ddb.h"
@@ -2382,7 +2382,7 @@ plcominit(struct plcom_instance *pi, int
 	/* Ought to do something like this, but we have no sc to
 	   dereference. */
 	/* XXX device_unit() abuse */
-	sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(&sc->sc_dev),
+	sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(sc->sc_dev),
 	PL01X_MCR_DTR | PL01X_MCR_RTS);
 #endif
 



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

2012-10-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct 10 21:53:09 UTC 2012

Modified Files:
src/sys/arch/arm/footbridge: footbridge.c footbridge_com.c

Log Message:
Update comments to reflect the real function prototypes.

>From chuq.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/footbridge/footbridge.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/footbridge/footbridge_com.c

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

Modified files:

Index: src/sys/arch/arm/footbridge/footbridge.c
diff -u src/sys/arch/arm/footbridge/footbridge.c:1.25 src/sys/arch/arm/footbridge/footbridge.c:1.26
--- src/sys/arch/arm/footbridge/footbridge.c:1.25	Fri Jul  1 19:32:28 2011
+++ src/sys/arch/arm/footbridge/footbridge.c	Wed Oct 10 21:53:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: footbridge.c,v 1.25 2011/07/01 19:32:28 dyoung Exp $	*/
+/*	$NetBSD: footbridge.c,v 1.26 2012/10/10 21:53:09 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997,1998 Mark Brinicombe.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: footbridge.c,v 1.25 2011/07/01 19:32:28 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: footbridge.c,v 1.26 2012/10/10 21:53:09 skrll Exp $");
 
 #include 
 #include 
@@ -123,7 +123,7 @@ footbridge_print(void *aux, const char *
 }
 
 /*
- * int footbridge_match(struct device *parent, struct cfdata *cf, void *aux)
+ * int footbridge_match(device_t parent, cfdata_t cf, void *aux)
  *
  * Just return ok for this if it is device 0
  */ 

Index: src/sys/arch/arm/footbridge/footbridge_com.c
diff -u src/sys/arch/arm/footbridge/footbridge_com.c:1.34 src/sys/arch/arm/footbridge/footbridge_com.c:1.35
--- src/sys/arch/arm/footbridge/footbridge_com.c:1.34	Fri Jul  1 19:32:28 2011
+++ src/sys/arch/arm/footbridge/footbridge_com.c	Wed Oct 10 21:53:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: footbridge_com.c,v 1.34 2011/07/01 19:32:28 dyoung Exp $	*/
+/*	$NetBSD: footbridge_com.c,v 1.35 2012/10/10 21:53:09 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1997 Mark Brinicombe
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: footbridge_com.c,v 1.34 2011/07/01 19:32:28 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: footbridge_com.c,v 1.35 2012/10/10 21:53:09 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ddbparam.h"
@@ -154,7 +154,7 @@ extern int comcnspeed;
 extern struct bus_space fcomcons_bs_tag;
 
 /*
- * int fcom_probe(struct device *parent, struct cfdata *cf, void *aux)
+ * int fcom_probe(device_t parent, cfdata_t cf, void *aux)
  *
  * Make sure we are trying to attach a com device and then
  * probe for one.



CVS commit: src/share/man/man4

2012-10-10 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Oct 10 18:20:23 UTC 2012

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

Log Message:
Replace .sp with .Pp macro.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/share/man/man4/tp.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/tp.4
diff -u src/share/man/man4/tp.4:1.19 src/share/man/man4/tp.4:1.20
--- src/share/man/man4/tp.4:1.19	Thu May 19 21:16:45 2011
+++ src/share/man/man4/tp.4	Wed Oct 10 18:20:23 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: tp.4,v 1.19 2011/05/19 21:16:45 riastradh Exp $
+.\"	$NetBSD: tp.4,v 1.20 2012/10/10 18:20:23 njoly Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -553,7 +553,7 @@ various boolean-valued options.
 Its meaning is as follows.
 The bit numbering used is that of the RT PC, which means that bit
 0 is the most significant bit, while bit 8 is the least significant bit.
-.sp 1
+.Pp
 .Em Values for TPOPT_FLAGS :
 .Bl -tag -width Bitsx
 .It Sy Bits



CVS commit: src/share/man/man4

2012-10-10 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Oct 10 18:14:14 UTC 2012

Modified Files:
src/share/man/man4: bt3c.4 btbc.4

Log Message:
Remove empty BUGS section.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/bt3c.4
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/btbc.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/bt3c.4
diff -u src/share/man/man4/bt3c.4:1.4 src/share/man/man4/bt3c.4:1.5
--- src/share/man/man4/bt3c.4:1.4	Fri Apr 10 15:15:10 2009
+++ src/share/man/man4/bt3c.4	Wed Oct 10 18:14:14 2012
@@ -1,4 +1,4 @@
-.\" $NetBSD: bt3c.4,v 1.4 2009/04/10 15:15:10 joerg Exp $
+.\" $NetBSD: bt3c.4,v 1.5 2012/10/10 18:14:14 njoly Exp $
 .\"
 .\" Copyright (c) 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -84,4 +84,3 @@ using
 .Fx
 and BlueZ drivers as a reference.  It first appeared in
 .Nx 4.0 .
-.Sh BUGS

Index: src/share/man/man4/btbc.4
diff -u src/share/man/man4/btbc.4:1.5 src/share/man/man4/btbc.4:1.6
--- src/share/man/man4/btbc.4:1.5	Tue Jan 12 09:26:26 2010
+++ src/share/man/man4/btbc.4	Wed Oct 10 18:14:14 2012
@@ -1,4 +1,4 @@
-.\" $NetBSD: btbc.4,v 1.5 2010/01/12 09:26:26 wiz Exp $
+.\" $NetBSD: btbc.4,v 1.6 2012/10/10 18:14:14 njoly Exp $
 .\"
 .\" Copyright (c) 2007 KIYOHARA Takashi
 .\" All rights reserved.
@@ -49,4 +49,3 @@ using
 Linux bluecard_cs driver as a reference.
 It first appeared in
 .Nx 4.0 .
-.Sh BUGS



CVS commit: src/share/man/man4

2012-10-10 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Oct 10 18:06:41 UTC 2012

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

Log Message:
Adjust column width to match reality.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/smscmon.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/smscmon.4
diff -u src/share/man/man4/smscmon.4:1.3 src/share/man/man4/smscmon.4:1.4
--- src/share/man/man4/smscmon.4:1.3	Fri Jan  7 18:00:12 2011
+++ src/share/man/man4/smscmon.4	Wed Oct 10 18:06:41 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: smscmon.4,v 1.3 2011/01/07 18:00:12 njoly Exp $
+.\"	$NetBSD: smscmon.4,v 1.4 2012/10/10 18:06:41 njoly Exp $
 .\"
 .\" Copyright (c) 2009 Takahiro Hayashi
 .\" All rights reserved.
@@ -43,7 +43,7 @@ LPC47M192 and LPC47M997 Super I/O chips 
 API.
 .Pp
 The chip supports 11 sensor inputs:
-.Bl -column "Sensor" "Units" "Typical" -offset indent
+.Bl -column "Remote Temp1" "Units" "Typical" -offset indent
 .It Sy "Sensor" Ta Sy "Units" Ta Sy "Typical Use"
 .It Li "+2.5V" Ta "uV DC" Ta "2.5V Supply"
 .It Li "Vccp" Ta "uV DC" Ta "CPU Vcore"



CVS commit: src/distrib/notes/common

2012-10-10 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Oct 10 17:55:16 UTC 2012

Modified Files:
src/distrib/notes/common: main

Log Message:
Note the replacement of kame_ipsec by fast_ipsec;  this change was
originally submitted as a patch to the netbsd-6 branch, but should have
been committed on the trunk first.


To generate a diff of this commit:
cvs rdiff -u -r1.490 -r1.491 src/distrib/notes/common/main

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

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.490 src/distrib/notes/common/main:1.491
--- src/distrib/notes/common/main:1.490	Wed Oct 10 16:08:14 2012
+++ src/distrib/notes/common/main	Wed Oct 10 17:55:16 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: main,v 1.490 2012/10/10 16:08:14 apb Exp $
+.\"	$NetBSD: main,v 1.491 2012/10/10 17:55:16 riz Exp $
 .\"
 .\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -504,6 +504,15 @@ and
 .Xr groff 1
 can still be found in pkgsrc as
 .Pa textproc/groff .
+.It
+.Xr kame_ipsec 4
+has been replaced by
+.Xr fast_ipsec 4 .
+The option to use the old implementation (see
+.Xr options 4 )
+will be removed in the next
+.Nx
+release.
 .bullet)
 .
 .Ss "The NetBSD Foundation"
@@ -751,6 +760,12 @@ using either the
 .Xr sysctl 8
 command or through
 .Xr sysctl.conf 5 .
+.Pp
+The implementation of SHA2-HMAC in KAME_IPSEC as used in NetBSD-5
+and before did not comply to current standards.
+FAST_IPSEC does, with the result that old and new systems cannot
+communicate over IPSEC, if one of the affected authentication
+algorithms (hmac_sha256, hmac_sha384, hmac_sha512) is used.
 .
 .Ss2 Issues affecting an upgrade from NetBSD 4.x releases
 .Pp



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

2012-10-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Oct 10 17:49:50 UTC 2012

Modified Files:
src/sys/arch/x68k/dev: ite.c itevar.h

Log Message:
Fix device_t/softc split bothces.  From Chuck Silvers' patch posted on
current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html
and several more fixes by me.

Not sure if these are fatal (at least 6.0_RC2 works without thise fixes),
but needs more investigation.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x68k/dev/ite.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x68k/dev/itevar.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/x68k/dev/ite.c
diff -u src/sys/arch/x68k/dev/ite.c:1.59 src/sys/arch/x68k/dev/ite.c:1.60
--- src/sys/arch/x68k/dev/ite.c:1.59	Sun Apr 24 16:26:58 2011
+++ src/sys/arch/x68k/dev/ite.c	Wed Oct 10 17:49:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.59 2011/04/24 16:26:58 rmind Exp $	*/
+/*	$NetBSD: ite.c,v 1.60 2012/10/10 17:49:50 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.59 2011/04/24 16:26:58 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.60 2012/10/10 17:49:50 tsutsui Exp $");
 
 #include "ite.h"
 #if NITE > 0
@@ -135,6 +135,7 @@ struct itesw itesw[] = {
 struct	tty *ite_tty[NITE];
 struct	ite_softc *kbd_ite = NULL;
 struct  ite_softc con_itesoftc;
+struct	device con_itedev;
 
 struct  tty *kbd_tty = NULL;
 
@@ -170,12 +171,12 @@ const struct cdevsw ite_cdevsw = {
 };
 
 int
-itematch(device_t pdp, cfdata_t cdp, void *auxp)
+itematch(device_t parent, cfdata_t cf, void *aux)
 {
 	struct grf_softc *gp;
 	
-	gp = auxp;
-	if (cdp->cf_loc[GRFCF_GRFADDR] != gp->g_cfaddr)
+	gp = aux;
+	if (cf->cf_loc[GRFCF_GRFADDR] != gp->g_cfaddr)
 		return 0;
 
 	return 1;
@@ -186,13 +187,14 @@ itematch(device_t pdp, cfdata_t cdp, voi
  * an ite device, it is also called from ite_cninit().
  */
 void
-iteattach(device_t pdp, device_t dp, void *auxp)
+iteattach(device_t parent, device_t self, void *aux)
 {
 	struct ite_softc *ip;
 	struct grf_softc *gp;
 
-	gp = (struct grf_softc *)auxp;
-	ip = device_private(dp);
+	gp = aux;
+	ip = device_private(self);
+	ip->device = self;
 	if(con_itesoftc.grf != NULL
 		/*&& con_itesoftc.grf->g_unit == gp->g_unit*/) {
 		/*
@@ -205,7 +207,7 @@ iteattach(device_t pdp, device_t dp, voi
 		kbd_ite = ip;
 	}
 	ip->grf = gp;
-	iteinit(device_unit(&ip->device)); /* XXX */
+	iteinit(device_unit(self)); /* XXX */
 	aprint_normal(": rows %d cols %d", ip->rows, ip->cols);
 	if (kbd_ite == NULL)
 		kbd_ite = ip;
@@ -240,7 +242,7 @@ iteinit(dev_t dev)
 	ip->cursorx = 0;
 	ip->cursory = 0;
 
-	ip->isw = &itesw[device_unit(&ip->device)]; /* XXX */
+	ip->isw = &itesw[device_unit(ip->device)]; /* XXX */
 	SUBR_INIT(ip);
 	SUBR_CURSOR(ip, DRAW_CURSOR);
 	if (!ip->tabs)
@@ -258,6 +260,7 @@ ite_config_console(void)
 		return;
 	con_itesoftc.grf = gp;
 	con_itesoftc.tabs = cons_tabs;
+	con_itesoftc.device = &con_itedev;
 }
 
 /*
@@ -270,7 +273,7 @@ iteon(dev_t dev, int flag)
 	struct ite_softc *ip;
 
 	if (unit < 0 || unit >= ite_cd.cd_ndevs ||
-	(ip = getitesp(unit)) == NULL || (ip->flags&ITE_ALIVE) == 0)
+	(ip = getitesp(dev)) == NULL || (ip->flags&ITE_ALIVE) == 0)
 		return(ENXIO);
 	/* force ite active, overriding graphics mode */
 	if (flag & 1) {
@@ -309,7 +312,7 @@ iteoff(dev_t dev, int flag)
 
 	/* XXX check whether when call from grf.c */
 	if (unit < 0 || unit >= ite_cd.cd_ndevs ||
-	(ip = getitesp(unit)) == NULL || (ip->flags&ITE_ALIVE) == 0)
+	(ip = getitesp(dev)) == NULL || (ip->flags&ITE_ALIVE) == 0)
 		return;
 	if (flag & 2)
 		ip->flags |= ITE_INGRF;
@@ -538,7 +541,7 @@ ite_reinit(dev_t dev)
 
 	/* XXX check whether when call from grf.c */
 	if (unit < 0 || unit >= ite_cd.cd_ndevs ||
-	(ip = getitesp(unit)) == NULL)
+	(ip = getitesp(dev)) == NULL)
 		return;
 
 	ip->flags &= ~ITE_INITED;
@@ -714,7 +717,7 @@ ite_filter(u_char c)
 	struct key key;
 	int s, i;
 
-	if (!kbd_ite || !(kbd_tty = ite_tty[device_unit(&kbd_ite->device)]))
+	if (!kbd_ite || !(kbd_tty = ite_tty[device_unit(kbd_ite->device)]))
 		return;
 
 	/* have to make sure we're at spltty in here */
@@ -2086,7 +2089,7 @@ iteputchar(int c, struct ite_softc *ip)
 
 	case BEL:
 #if NBELL > 0
-		if (kbd_ite && ite_tty[device_unit(&kbd_ite->device)])
+		if (kbd_ite && ite_tty[device_unit(kbd_ite->device)])
 			opm_bell();
 #endif
 		break;

Index: src/sys/arch/x68k/dev/itevar.h
diff -u src/sys/arch/x68k/dev/itevar.h:1.14 src/sys/arch/x68k/dev/itevar.h:1.15
--- src/sys/arch/x68k/dev/itevar.h:1.14	Tue Feb  8 20:20:25 2011
+++ src/sys/arch/x68k/dev/itevar.h	Wed Oct 10 17:49:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: itevar.h,v 1.14 2011/02/08 20:20:25 rmind Exp $	*/
+/*	$NetBSD: itevar.h,v 1.15 2012/10/10 17:49:50 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 Unive

CVS commit: [netbsd-6] src/doc

2012-10-10 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Oct 10 17:08:14 UTC 2012

Modified Files:
src/doc [netbsd-6]: CHANGES-6.0

Log Message:
TIcket 599.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.215 -r1.1.2.216 src/doc/CHANGES-6.0

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

Modified files:

Index: src/doc/CHANGES-6.0
diff -u src/doc/CHANGES-6.0:1.1.2.215 src/doc/CHANGES-6.0:1.1.2.216
--- src/doc/CHANGES-6.0:1.1.2.215	Tue Oct  9 23:59:32 2012
+++ src/doc/CHANGES-6.0	Wed Oct 10 17:08:14 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0,v 1.1.2.215 2012/10/09 23:59:32 riz Exp $
+# $NetBSD: CHANGES-6.0,v 1.1.2.216 2012/10/10 17:08:14 riz Exp $
 
 A complete list of changes from the initial NetBSD 6.0 branch on 15 Feb 2012
 until the 6.0 release:
@@ -8831,3 +8831,9 @@ external/bsd/bind/dist/version			1.4
 	Update to BIND 9.9.1-P4, to address CVE-2012-5166.
 	[christos, ticket #598]
 
+distrib/notes/common/main			1.490
+
+	Refer to the list of mirrors at http://www.NetBSD.org/mirrors
+	in "Quick install notes for the impatient".
+	[apb, ticket #599]
+



CVS commit: [netbsd-6] src/distrib/notes/common

2012-10-10 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Oct 10 17:07:03 UTC 2012

Modified Files:
src/distrib/notes/common [netbsd-6]: main

Log Message:
Pull up following revision(s) (requested by apb in ticket #599):
distrib/notes/common/main: revision 1.490
Refer to the list of mirrors at http://www.NetBSD.org/mirrors
in "Quick install notes for the impatient".  Previously it
said "Check the NetBSD website for details" without giving an URL.


To generate a diff of this commit:
cvs rdiff -u -r1.484.2.2 -r1.484.2.3 src/distrib/notes/common/main

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

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.484.2.2 src/distrib/notes/common/main:1.484.2.3
--- src/distrib/notes/common/main:1.484.2.2	Mon Sep  3 18:45:42 2012
+++ src/distrib/notes/common/main	Wed Oct 10 17:07:03 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: main,v 1.484.2.2 2012/09/03 18:45:42 riz Exp $
+.\"	$NetBSD: main,v 1.484.2.3 2012/10/10 17:07:03 riz Exp $
 .\"
 .\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -121,7 +121,11 @@ These can be found
 on an FTP site near you, usually located in the
 .Pa /pub/NetBSD/iso/
 directory.
-Check the NetBSD website for details.
+Check the list of
+.Nx
+mirrors at
+.Lk http://www.NetBSD.org/mirrors
+for details.
 .Pp
 Option 2: bootable CD-ROM images from
 .Pa \*M/installation/cdrom/ .



CVS commit: src/sys/arch/hp700/gsc

2012-10-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct 10 17:00:37 UTC 2012

Modified Files:
src/sys/arch/hp700/gsc: fdc_gsc.c

Log Message:
Split softc/device_t


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hp700/gsc/fdc_gsc.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/hp700/gsc/fdc_gsc.c
diff -u src/sys/arch/hp700/gsc/fdc_gsc.c:1.10 src/sys/arch/hp700/gsc/fdc_gsc.c:1.11
--- src/sys/arch/hp700/gsc/fdc_gsc.c:1.10	Fri Jul  1 18:33:09 2011
+++ src/sys/arch/hp700/gsc/fdc_gsc.c	Wed Oct 10 17:00:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdc_gsc.c,v 1.10 2011/07/01 18:33:09 dyoung Exp $	*/
+/*	$NetBSD: fdc_gsc.c,v 1.11 2012/10/10 17:00:37 skrll Exp $	*/
 
 /*	$OpenBSD: fdc_gsc.c,v 1.1 1998/09/30 04:45:46 mickey Exp $	*/
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdc_gsc.c,v 1.10 2011/07/01 18:33:09 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdc_gsc.c,v 1.11 2012/10/10 17:00:37 skrll Exp $");
 
 #include 
 #include 
@@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: fdc_gsc.c,v 
 int fdc_gsc_probe(device_t, cfdata_t, void *);
 void fdc_gsc_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(fdc_gsc, sizeof(struct fdc_softc),
+CFATTACH_DECL_NEW(fdc_gsc, sizeof(struct fdc_softc),
 fdc_gsc_probe, fdc_gsc_attach, NULL, NULL);
 
 int



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

2012-10-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Oct 10 16:55:50 UTC 2012

Modified Files:
src/sys/arch/x68k/dev: mha.c

Log Message:
Fix device_t/softc split botches that could be fatal.  From
Chuck Silvers' patch posted current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html

Should be pulled up to netbsd-6.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/x68k/dev/mha.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/x68k/dev/mha.c
diff -u src/sys/arch/x68k/dev/mha.c:1.52 src/sys/arch/x68k/dev/mha.c:1.53
--- src/sys/arch/x68k/dev/mha.c:1.52	Mon Nov 23 00:11:45 2009
+++ src/sys/arch/x68k/dev/mha.c	Wed Oct 10 16:55:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mha.c,v 1.52 2009/11/23 00:11:45 rmind Exp $	*/
+/*	$NetBSD: mha.c,v 1.53 2012/10/10 16:55:50 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996-1999 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mha.c,v 1.52 2009/11/23 00:11:45 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mha.c,v 1.53 2012/10/10 16:55:50 tsutsui Exp $");
 
 #include "opt_ddb.h"
 
@@ -337,7 +337,7 @@ mhaattach(device_t parent, device_t self
 	/*
 	 * Fill in the adapter.
 	 */
-	sc->sc_adapter.adapt_dev = sc->sc_dev;
+	sc->sc_adapter.adapt_dev = self;
 	sc->sc_adapter.adapt_nchannels = 1;
 	sc->sc_adapter.adapt_openings = 7;
 	sc->sc_adapter.adapt_max_periph = 1;
@@ -674,7 +674,7 @@ mha_scsi_request(struct scsipi_channel *
 {
 	struct scsipi_xfer *xs;
 	struct scsipi_periph *periph;
-	struct mha_softc *sc = (void *)chan->chan_adapter->adapt_dev;
+	struct mha_softc *sc = device_private(chan->chan_adapter->adapt_dev);
 	struct acb *acb;
 	int s, flags;
 
@@ -1949,7 +1949,7 @@ mha_timeout(void *arg)
 	struct scsipi_xfer *xs = acb->xs;
 	struct scsipi_periph *periph = xs->xs_periph;
 	struct mha_softc *sc =
-	(void *)periph->periph_channel->chan_adapter->adapt_dev;
+	device_private(periph->periph_channel->chan_adapter->adapt_dev);
 	int s;
 
 	s = splbio();



CVS commit: src/sys/arch/sparc

2012-10-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Oct 10 16:51:51 UTC 2012

Modified Files:
src/sys/arch/sparc/dev: fd.c
src/sys/arch/sparc/sparc: memecc.c

Log Message:
Fix device_t/softc split botches that could be fatal.  From
Chuck Silvers' patch posted current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html

Should be pulled up to netbsd-6.


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/arch/sparc/dev/fd.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc/sparc/memecc.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/sparc/dev/fd.c
diff -u src/sys/arch/sparc/dev/fd.c:1.150 src/sys/arch/sparc/dev/fd.c:1.151
--- src/sys/arch/sparc/dev/fd.c:1.150	Sun Jul 17 23:18:23 2011
+++ src/sys/arch/sparc/dev/fd.c	Wed Oct 10 16:51:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.150 2011/07/17 23:18:23 mrg Exp $	*/
+/*	$NetBSD: fd.c,v 1.151 2012/10/10 16:51:50 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.150 2011/07/17 23:18:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.151 2012/10/10 16:51:50 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
@@ -174,7 +174,7 @@ enum fdc_state {
 
 /* software state, per controller */
 struct fdc_softc {
-	struct device	*sc_dev;
+	device_t	sc_dev;
 	bus_space_tag_t	sc_bustag;
 
 	struct callout sc_timo_ch;	/* timeout callout */
@@ -259,7 +259,7 @@ struct fd_type fd_types[] = {
 
 /* software state, per disk (with up to 4 disks per ctlr) */
 struct fd_softc {
-	struct device	*sc_dv;		/* generic device info */
+	device_t	sc_dv;		/* generic device info */
 	struct disk	sc_dk;		/* generic disk info */
 
 	struct fd_type *sc_deftype;	/* default type descriptor */
@@ -342,7 +342,7 @@ void	fdcretry(struct fdc_softc *);
 void	fdfinish(struct fd_softc *, struct buf *);
 int	fdformat(dev_t, struct ne7_fd_formb *, struct proc *);
 void	fd_do_eject(struct fd_softc *);
-void	fd_mountroot_hook(struct device *);
+void	fd_mountroot_hook(device_t);
 static int fdconf(struct fdc_softc *);
 static void establish_chip_type(
 		struct fdc_softc *,
@@ -547,7 +547,7 @@ fdcattach_mainbus(device_t parent, devic
 			ma->ma_size,
 			BUS_SPACE_MAP_LINEAR,
 			&fdc->sc_handle) != 0) {
-		printf("%s: cannot map registers\n", self->dv_xname);
+		printf("%s: cannot map registers\n", device_xname(self));
 		return;
 	}
 
@@ -580,7 +580,7 @@ fdcattach_obio(device_t parent, device_t
 			 sa->sa_slot, sa->sa_offset, sa->sa_size,
 			 BUS_SPACE_MAP_LINEAR, &fdc->sc_handle) != 0) {
 		printf("%s: cannot map control registers\n",
-			self->dv_xname);
+			device_xname(self));
 		return;
 	}
 
@@ -890,7 +890,7 @@ fdstrategy(struct buf *bp)
 		fdstart(fd);
 #ifdef DIAGNOSTIC
 	else {
-		struct fdc_softc *fdc = (void *)device_parent(fd->sc_dv);
+		struct fdc_softc *fdc = device_private(device_parent(fd->sc_dv));
 		if (fdc->sc_state == DEVIDLE) {
 			printf("fdstrategy: controller inactive\n");
 			fdcstart(fdc);
@@ -1012,7 +1012,7 @@ fd_motor_off(void *arg)
 
 	s = splbio();
 	fd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
-	fd_set_motor((struct fdc_softc *)device_parent(fd->sc_dv));
+	fd_set_motor(device_private(device_parent(fd->sc_dv)));
 	splx(s);
 }
 
@@ -2305,7 +2305,7 @@ fd_do_eject(struct fd_softc *fd)
 
 /* ARGSUSED */
 void
-fd_mountroot_hook(struct device *dev)
+fd_mountroot_hook(device_t dev)
 {
 	int c;
 

Index: src/sys/arch/sparc/sparc/memecc.c
diff -u src/sys/arch/sparc/sparc/memecc.c:1.14 src/sys/arch/sparc/sparc/memecc.c:1.15
--- src/sys/arch/sparc/sparc/memecc.c:1.14	Sun Jul 29 00:04:05 2012
+++ src/sys/arch/sparc/sparc/memecc.c	Wed Oct 10 16:51:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: memecc.c,v 1.14 2012/07/29 00:04:05 matt Exp $	*/
+/*	$NetBSD: memecc.c,v 1.15 2012/10/10 16:51:51 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: memecc.c,v 1.14 2012/07/29 00:04:05 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: memecc.c,v 1.15 2012/10/10 16:51:51 tsutsui Exp $");
 
 #include 
 #include 
@@ -75,7 +75,7 @@ memecc_match(device_t parent, cfdata_t c
 void
 memecc_attach(device_t parent, device_t self, void *aux)
 {
-	struct memecc_softc *sc = (struct memecc_softc *)self;
+	struct memecc_softc *sc = device_private(self);
 	struct mainbus_attach_args *ma = aux;
 	int node;
 	uint32_t reg;



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

2012-10-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct 10 16:51:10 UTC 2012

Modified Files:
src/sys/arch/hp700/dev: ssio.c

Log Message:
Remove the (never used) struct device from ssio_softc.

>From chuq.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hp700/dev/ssio.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/hp700/dev/ssio.c
diff -u src/sys/arch/hp700/dev/ssio.c:1.3 src/sys/arch/hp700/dev/ssio.c:1.4
--- src/sys/arch/hp700/dev/ssio.c:1.3	Sat Apr 14 06:04:34 2012
+++ src/sys/arch/hp700/dev/ssio.c	Wed Oct 10 16:51:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ssio.c,v 1.3 2012/04/14 06:04:34 skrll Exp $	*/
+/*	$NetBSD: ssio.c,v 1.4 2012/10/10 16:51:10 skrll Exp $	*/
 
 /*	$OpenBSD: ssio.c,v 1.7 2009/03/08 22:19:04 miod Exp $	*/
 
@@ -106,8 +106,6 @@ struct ssio_iv {
 struct ssio_iv ssio_intr_table[SSIO_NINTS];
 
 struct ssio_softc {
-	struct device sc_dev;
-
 	bus_space_tag_t sc_iot;
 	bus_space_handle_t sc_ic1h;
 	bus_space_handle_t sc_ic2h;



CVS commit: [tls-maxphys] src/sys/uvm

2012-10-10 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Oct 10 16:31:55 UTC 2012

Modified Files:
src/sys/uvm [tls-maxphys]: uvm_pager.c

Log Message:
The pagedaemon ca emit write as large as the underlying device's maxphys,
so emergva size needs to be MACHINE_MAXPHYS, MAXPHYS is not enough.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.108.6.1 src/sys/uvm/uvm_pager.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_pager.c
diff -u src/sys/uvm/uvm_pager.c:1.108 src/sys/uvm/uvm_pager.c:1.108.6.1
--- src/sys/uvm/uvm_pager.c:1.108	Fri Jan 27 19:48:42 2012
+++ src/sys/uvm/uvm_pager.c	Wed Oct 10 16:31:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pager.c,v 1.108 2012/01/27 19:48:42 para Exp $	*/
+/*	$NetBSD: uvm_pager.c,v 1.108.6.1 2012/10/10 16:31:54 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.108 2012/01/27 19:48:42 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.108.6.1 2012/10/10 16:31:54 bouyer Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_readahead.h"
@@ -95,8 +95,8 @@ uvm_pager_realloc_emerg(void)
 	KASSERT(!emerginuse);
 
 	new_emergva = uvm_km_alloc(kernel_map,
-	round_page(MAXPHYS) + ptoa(uvmexp.ncolors), ptoa(uvmexp.ncolors),
-	UVM_KMF_VAONLY);
+	round_page(MACHINE_MAXPHYS) + ptoa(uvmexp.ncolors),
+	ptoa(uvmexp.ncolors), UVM_KMF_VAONLY);
 
 	KASSERT(new_emergva != 0);
 
@@ -118,7 +118,7 @@ uvm_pager_realloc_emerg(void)
 
 	if (old_emergva)
 		uvm_km_free(kernel_map, old_emergva,
-		round_page(MAXPHYS) + ptoa(old_emerg_ncolors),
+		round_page(MACHINE_MAXPHYS) + ptoa(old_emerg_ncolors),
 		UVM_KMF_VAONLY);
 }
 
@@ -209,7 +209,7 @@ ReStart:
 			mutex_exit(&pager_map_wanted_lock);
 			kva = emergva + ptoa(first_color);
 			/* The shift implicitly truncates to PAGE_SIZE */
-			KASSERT(npages <= (MAXPHYS >> PAGE_SHIFT));
+			KASSERT(npages <= (MACHINE_MAXPHYS >> PAGE_SHIFT));
 			goto enter;
 		}
 		if ((flags & UVMPAGER_MAPIN_WAITOK) == 0) {



CVS commit: [tls-maxphys] src/sys/miscfs/genfs

2012-10-10 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Oct 10 16:30:42 UTC 2012

Modified Files:
src/sys/miscfs/genfs [tls-maxphys]: genfs_io.c

Log Message:
We know vp is not NULL, no need to check


To generate a diff of this commit:
cvs rdiff -u -r1.55.2.1 -r1.55.2.2 src/sys/miscfs/genfs/genfs_io.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/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.55.2.1 src/sys/miscfs/genfs/genfs_io.c:1.55.2.2
--- src/sys/miscfs/genfs/genfs_io.c:1.55.2.1	Wed Sep 12 06:15:35 2012
+++ src/sys/miscfs/genfs/genfs_io.c	Wed Oct 10 16:30:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.55.2.1 2012/09/12 06:15:35 tls Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.55.2.2 2012/10/10 16:30:42 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.55.2.1 2012/09/12 06:15:35 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.55.2.2 2012/10/10 16:30:42 bouyer Exp $");
 
 #include 
 #include 
@@ -830,7 +830,7 @@ genfs_do_putpages(struct vnode *vp, off_
 	bool onworklst;
 	static int printed;
 
-if (vp && vp->v_mount && vp->v_mount->mnt_maxphys) {
+if (vp->v_mount && vp->v_mount->mnt_maxphys) {
 maxpages = vp->v_mount->mnt_maxphys >> PAGE_SHIFT;
 } else {
 maxpages = MAXPHYS >> PAGE_SHIFT;



CVS commit: src/distrib/notes/common

2012-10-10 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Wed Oct 10 16:08:14 UTC 2012

Modified Files:
src/distrib/notes/common: main

Log Message:
Refer to the list of mirrors at http://www.NetBSD.org/mirrors
in "Quick install notes for the impatient".  Previously it
said "Check the NetBSD website for details" without giving an URL.


To generate a diff of this commit:
cvs rdiff -u -r1.489 -r1.490 src/distrib/notes/common/main

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

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.489 src/distrib/notes/common/main:1.490
--- src/distrib/notes/common/main:1.489	Fri Aug 17 18:20:19 2012
+++ src/distrib/notes/common/main	Wed Oct 10 16:08:14 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: main,v 1.489 2012/08/17 18:20:19 riz Exp $
+.\"	$NetBSD: main,v 1.490 2012/10/10 16:08:14 apb Exp $
 .\"
 .\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -121,7 +121,11 @@ These can be found
 on an FTP site near you, usually located in the
 .Pa /pub/NetBSD/iso/
 directory.
-Check the NetBSD website for details.
+Check the list of
+.Nx
+mirrors at
+.Lk http://www.NetBSD.org/mirrors
+for details.
 .Pp
 Option 2: bootable CD-ROM images from
 .Pa \*M/installation/cdrom/ .



CVS commit: src/sys/arch/hp700

2012-10-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct 10 15:46:34 UTC 2012

Modified Files:
src/sys/arch/hp700/dev: asp.c cpu.c elroy.c wax.c
src/sys/arch/hp700/hp700: autoconf.c

Log Message:
Use device_xname.

>From chuq


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/hp700/dev/asp.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/hp700/dev/cpu.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp700/dev/elroy.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/hp700/dev/wax.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/hp700/hp700/autoconf.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/hp700/dev/asp.c
diff -u src/sys/arch/hp700/dev/asp.c:1.21 src/sys/arch/hp700/dev/asp.c:1.22
--- src/sys/arch/hp700/dev/asp.c:1.21	Wed May 23 16:11:37 2012
+++ src/sys/arch/hp700/dev/asp.c	Wed Oct 10 15:46:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: asp.c,v 1.21 2012/05/23 16:11:37 skrll Exp $	*/
+/*	$NetBSD: asp.c,v 1.22 2012/10/10 15:46:33 skrll Exp $	*/
 
 /*	$OpenBSD: asp.c,v 1.5 2000/02/09 05:04:22 mickey Exp $	*/
 
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: asp.c,v 1.21 2012/05/23 16:11:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: asp.c,v 1.22 2012/10/10 15:46:33 skrll Exp $");
 
 #include 
 #include 
@@ -262,7 +262,7 @@ aspattach(device_t parent, device_t self
 
 	/* Attach the GSC bus. */
 	ga.ga_ca = *ca;	/* clone from us */
-	if (strcmp(parent->dv_xname, "mainbus0") == 0) {
+	if (strcmp(device_xname(parent), "mainbus0") == 0) {
 		ga.ga_dp.dp_bc[0] = ga.ga_dp.dp_bc[1];
 		ga.ga_dp.dp_bc[1] = ga.ga_dp.dp_bc[2];
 		ga.ga_dp.dp_bc[2] = ga.ga_dp.dp_bc[3];

Index: src/sys/arch/hp700/dev/cpu.c
diff -u src/sys/arch/hp700/dev/cpu.c:1.28 src/sys/arch/hp700/dev/cpu.c:1.29
--- src/sys/arch/hp700/dev/cpu.c:1.28	Wed May 23 21:11:34 2012
+++ src/sys/arch/hp700/dev/cpu.c	Wed Oct 10 15:46:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.28 2012/05/23 21:11:34 skrll Exp $	*/
+/*	$NetBSD: cpu.c,v 1.29 2012/10/10 15:46:34 skrll Exp $	*/
 
 /*	$OpenBSD: cpu.c,v 1.29 2009/02/08 18:33:28 miod Exp $	*/
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.28 2012/05/23 21:11:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.29 2012/10/10 15:46:34 skrll Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -122,7 +122,7 @@ cpuattach(device_t parent, device_t self
 	}
 
 	/* Print the CPU type, spec, level, category, and speed. */
-	aprint_normal("\n%s: %s, PA-RISC %s", self->dv_xname,
+	aprint_normal("\n%s: %s, PA-RISC %s", device_xname(self),
 	hppa_cpu_info->hci_chip_type,
 	hppa_cpu_info->hci_chip_spec);
 	aprint_normal(", lev %s, cat %c, ",
@@ -132,7 +132,7 @@ cpuattach(device_t parent, device_t self
 	if (mhz % 100 > 9)
 		aprint_normal(".%02d", mhz % 100);
 
-	aprint_normal(" MHz clk\n%s: %s", self->dv_xname,
+	aprint_normal(" MHz clk\n%s: %s", device_xname(self),
 	pdc_model.sh? "shadows, ": "");
 
 	if (pdc_cache.dc_conf.cc_fsel)
@@ -158,7 +158,7 @@ cpuattach(device_t parent, device_t self
 	 * Describe the floating-point support.
 	 */
 	KASSERT(fpu_present);
-	aprint_normal("%s: %s floating point, rev %d\n", self->dv_xname,
+	aprint_normal("%s: %s floating point, rev %d\n", device_xname(self),
 	hppa_mod_info(HPPA_TYPE_FPU, (fpu_version >> 16) & 0x1f),
 	(fpu_version >> 11) & 0x1f);
 

Index: src/sys/arch/hp700/dev/elroy.c
diff -u src/sys/arch/hp700/dev/elroy.c:1.12 src/sys/arch/hp700/dev/elroy.c:1.13
--- src/sys/arch/hp700/dev/elroy.c:1.12	Fri Jan 27 18:52:56 2012
+++ src/sys/arch/hp700/dev/elroy.c	Wed Oct 10 15:46:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: elroy.c,v 1.12 2012/01/27 18:52:56 para Exp $	*/
+/*	$NetBSD: elroy.c,v 1.13 2012/10/10 15:46:34 skrll Exp $	*/
 
 /*	$OpenBSD: elroy.c,v 1.5 2009/03/30 21:24:57 kettenis Exp $	*/
 
@@ -452,7 +452,7 @@ elroy_alloc_parent(device_t self, struct
 return (NULL);
 
 			snprintf(sc->sc_memexname, sizeof(sc->sc_memexname),
-			"%s_mem", sc->sc_dv.dv_xname);
+			"%s_mem", device_xname(sc->sc_dv));
 			if ((sc->sc_memex = extent_create(sc->sc_memexname,
 			mem_start, mem_start + ELROY_MEM_WINDOW,
 			NULL, 0, EX_NOWAIT | EX_MALLOCOK)) == NULL) {

Index: src/sys/arch/hp700/dev/wax.c
diff -u src/sys/arch/hp700/dev/wax.c:1.20 src/sys/arch/hp700/dev/wax.c:1.21
--- src/sys/arch/hp700/dev/wax.c:1.20	Wed May 23 16:11:37 2012
+++ src/sys/arch/hp700/dev/wax.c	Wed Oct 10 15:46:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wax.c,v 1.20 2012/05/23 16:11:37 skrll Exp $	*/
+/*	$NetBSD: wax.c,v 1.21 2012/10/10 15:46:34 skrll Exp $	*/
 
 /*	$OpenBSD: wax.c,v 1.1 1998/11/23 03:04:10 mickey Exp $	*/
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wax.c,v 1.20 2012/05/23 16:11:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wax.c,v 1.21 2012/10/10 15:46:34 skrll Exp $");
 
 #include 
 #include 
@@ -152,7 +152,7 @@ waxattach(device_t parent, device_t self
 
 	/* Attach the GSC bus. */
 	ga.

CVS commit: src/lib/librumpuser

2012-10-10 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Oct 10 11:15:57 UTC 2012

Modified Files:
src/lib/librumpuser: rumpuser.c

Log Message:
Implement the writewatchfile routines for a Linux hypervisor.  As a
result, the shmif network driver now works when hosted on Linux.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/librumpuser/rumpuser.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/librumpuser/rumpuser.c
diff -u src/lib/librumpuser/rumpuser.c:1.20 src/lib/librumpuser/rumpuser.c:1.21
--- src/lib/librumpuser/rumpuser.c:1.20	Fri Sep 14 16:29:22 2012
+++ src/lib/librumpuser/rumpuser.c	Wed Oct 10 11:15:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser.c,v 1.20 2012/09/14 16:29:22 pooka Exp $	*/
+/*	$NetBSD: rumpuser.c,v 1.21 2012/10/10 11:15:57 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser.c,v 1.20 2012/09/14 16:29:22 pooka Exp $");
+__RCSID("$NetBSD: rumpuser.c,v 1.21 2012/10/10 11:15:57 pooka Exp $");
 #endif /* !lint */
 
 #include 
@@ -572,7 +572,13 @@ rumpuser_seterrno(int error)
 	errno = error;
 }
 
-#ifdef __NetBSD__
+/*
+ * On NetBSD we use kqueue, on Linux we use inotify.  The underlying
+ * interface requirements aren't quite the same, but we have a very
+ * good chance of doing the fd->path mapping on Linux thanks to dcache,
+ * so just keep the existing interfaces for now.
+ */
+#if defined(__NetBSD__)
 int
 rumpuser_writewatchfile_setup(int kq, int fd, intptr_t opaque, int *error)
 {
@@ -615,6 +621,62 @@ rumpuser_writewatchfile_wait(int kq, int
 		*opaque = kev.udata;
 	return rv;
 }
+
+#elif defined(__linux__)
+#include 
+
+int
+rumpuser_writewatchfile_setup(int inotify, int fd, intptr_t notused, int *error)
+{
+	char procbuf[PATH_MAX], linkbuf[PATH_MAX];
+	ssize_t nn;
+
+	if (inotify == -1) {
+		inotify = inotify_init();
+		if (inotify == -1) {
+			seterror(errno);
+			return -1;
+		}
+	}
+
+	/* ok, need to map fd into path for inotify */
+	snprintf(procbuf, sizeof(procbuf), "/proc/self/fd/%d", fd);
+	nn = readlink(procbuf, linkbuf, sizeof(linkbuf));
+	if (nn >= (ssize_t)sizeof(linkbuf)) {
+		nn = -1;
+		errno = E2BIG; /* pick something */
+	}
+	if (nn == -1) {
+		seterror(errno);
+		close(inotify);
+		return -1;
+	}
+
+	if (inotify_add_watch(inotify, linkbuf, IN_MODIFY) == -1) {
+		seterror(errno);
+		close(inotify);
+		return -1;
+	}
+
+	return inotify;
+}
+
+int
+rumpuser_writewatchfile_wait(int kq, intptr_t *opaque, int *error)
+{
+	struct inotify_event iev;
+	ssize_t nn;
+
+	do {
+		KLOCK_WRAP(nn = read(kq, &iev, sizeof(iev)));
+	} while (errno == EINTR);
+
+	if (nn == -1) {
+		seterror(errno);
+		return -1;
+	}
+	return (nn/sizeof(iev));
+}
 #endif
 
 /*