CVS commit: othersrc/usr.bin/tnftp

2014-10-31 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Fri Oct 31 07:22:03 UTC 2014

Modified Files:
othersrc/usr.bin/tnftp: configure.ac tnftp.h

Log Message:
Check for sys/uio.h for writev() declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 othersrc/usr.bin/tnftp/configure.ac
cvs rdiff -u -r1.35 -r1.36 othersrc/usr.bin/tnftp/tnftp.h

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

Modified files:

Index: othersrc/usr.bin/tnftp/configure.ac
diff -u othersrc/usr.bin/tnftp/configure.ac:1.26 othersrc/usr.bin/tnftp/configure.ac:1.27
--- othersrc/usr.bin/tnftp/configure.ac:1.26	Fri Oct 31 04:03:54 2014
+++ othersrc/usr.bin/tnftp/configure.ac	Fri Oct 31 07:22:03 2014
@@ -1,4 +1,4 @@
-#   $NetBSD: configure.ac,v 1.26 2014/10/31 04:03:54 lukem Exp $
+#   $NetBSD: configure.ac,v 1.27 2014/10/31 07:22:03 lukem Exp $
 #
 # Process this file with autoconf to produce a configure script.
 
@@ -9,7 +9,7 @@ AC_COPYRIGHT([
 Copyright (c) 1999-2014 The NetBSD Foundation, Inc.
 All rights reserved.
 ])
-AC_REVISION([$Revision: 1.26 $])
+AC_REVISION([$Revision: 1.27 $])
 
 AS_SHELL_SANITIZE()
 
@@ -229,7 +229,8 @@ accheck_includes='
 ' # accheck_includes
 
 AC_CHECK_HEADERS([sys/types.h sys/ioctl.h sys/param.h sys/stat.h \
-  sys/socket.h sys/syslimits.h sys/time.h sys/wait.h],
+  sys/socket.h sys/syslimits.h sys/time.h sys/uio.h \
+  sys/wait.h],
  [], [], [$accheck_includes])
 AC_HEADER_DIRENT()
 AC_HEADER_RESOLV()

Index: othersrc/usr.bin/tnftp/tnftp.h
diff -u othersrc/usr.bin/tnftp/tnftp.h:1.35 othersrc/usr.bin/tnftp/tnftp.h:1.36
--- othersrc/usr.bin/tnftp/tnftp.h:1.35	Sun May  5 13:17:05 2013
+++ othersrc/usr.bin/tnftp/tnftp.h	Fri Oct 31 07:22:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tnftp.h,v 1.35 2013/05/05 13:17:05 lukem Exp $	*/
+/*	$NetBSD: tnftp.h,v 1.36 2014/10/31 07:22:03 lukem Exp $	*/
 
 #define	FTP_PRODUCT	PACKAGE_NAME
 #define	FTP_VERSION	PACKAGE_VERSION
@@ -70,6 +70,9 @@
 #  include ndir.h
 # endif
 #endif
+#if defined(HAVE_SYS_UIO_H)
+# include sys/uio.h
+#endif
 
 #if defined(HAVE_SYS_IOCTL_H)
 # include sys/ioctl.h



CVS commit: othersrc/usr.bin/tnftp

2014-10-31 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Fri Oct 31 07:35:48 UTC 2014

Modified Files:
othersrc/usr.bin/tnftp: configure tnftp_config.h.in

Log Message:
regen for sys/uio.h test


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 othersrc/usr.bin/tnftp/configure
cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/tnftp/tnftp_config.h.in

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

Modified files:

Index: othersrc/usr.bin/tnftp/configure
diff -u othersrc/usr.bin/tnftp/configure:1.41 othersrc/usr.bin/tnftp/configure:1.42
--- othersrc/usr.bin/tnftp/configure:1.41	Fri Oct 31 04:06:15 2014
+++ othersrc/usr.bin/tnftp/configure	Fri Oct 31 07:35:48 2014
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 1.26 .
+# From configure.ac Revision: 1.27 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.69 for tnftp 20141031.
 #
@@ -12383,7 +12383,8 @@ accheck_includes='
 ' # accheck_includes
 
 for ac_header in sys/types.h sys/ioctl.h sys/param.h sys/stat.h \
-  sys/socket.h sys/syslimits.h sys/time.h sys/wait.h
+  sys/socket.h sys/syslimits.h sys/time.h sys/uio.h \
+  sys/wait.h
 do :
   as_ac_Header=`$as_echo ac_cv_header_$ac_header | $as_tr_sh`
 ac_fn_c_check_header_compile $LINENO $ac_header $as_ac_Header $accheck_includes

Index: othersrc/usr.bin/tnftp/tnftp_config.h.in
diff -u othersrc/usr.bin/tnftp/tnftp_config.h.in:1.3 othersrc/usr.bin/tnftp/tnftp_config.h.in:1.4
--- othersrc/usr.bin/tnftp/tnftp_config.h.in:1.3	Sun May  5 13:21:06 2013
+++ othersrc/usr.bin/tnftp/tnftp_config.h.in	Fri Oct 31 07:35:48 2014
@@ -388,6 +388,9 @@
 /* Define to 1 if you have the sys/types.h header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the sys/uio.h header file. */
+#undef HAVE_SYS_UIO_H
+
 /* Define to 1 if you have the sys/wait.h header file. */
 #undef HAVE_SYS_WAIT_H
 



CVS commit: src

2014-10-31 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Fri Oct 31 07:38:36 UTC 2014

Modified Files:
src/sys/conf: files std
src/tests/usr.bin/config: t_config.sh
src/tests/usr.bin/config/support/conf: files
src/usr.bin/config: config.5 defs.h gram.y main.c scan.l sem.c sem.h

Log Message:
config(1), config(5): Introduce select

o Introduce a new selection directive select to select an attribute (as a
  module) and its dependencies.
o Support no select too.
o Stop abusing options to select an attribute.
o Bump config(1) version.


To generate a diff of this commit:
cvs rdiff -u -r1.1120 -r1.1121 src/sys/conf/files
cvs rdiff -u -r1.19 -r1.20 src/sys/conf/std
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/config/t_config.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/config/support/conf/files
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/config/config.5
cvs rdiff -u -r1.59 -r1.60 src/usr.bin/config/defs.h
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/config/gram.y
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/config/main.c
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/config/scan.l
cvs rdiff -u -r1.65 -r1.66 src/usr.bin/config/sem.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/config/sem.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/conf/files
diff -u src/sys/conf/files:1.1120 src/sys/conf/files:1.1121
--- src/sys/conf/files:1.1120	Sun Oct 12 04:30:42 2014
+++ src/sys/conf/files	Fri Oct 31 07:38:36 2014
@@ -1,7 +1,7 @@
-#	$NetBSD: files,v 1.1120 2014/10/12 04:30:42 uebayasi Exp $
+#	$NetBSD: files,v 1.1121 2014/10/31 07:38:36 uebayasi Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
-version 	20141010
+version 	20141030
 
 #
 # device classes

Index: src/sys/conf/std
diff -u src/sys/conf/std:1.19 src/sys/conf/std:1.20
--- src/sys/conf/std:1.19	Fri Oct 10 12:46:32 2014
+++ src/sys/conf/std	Fri Oct 31 07:38:36 2014
@@ -1,4 +1,4 @@
-# $NetBSD: std,v 1.19 2014/10/10 12:46:32 uebayasi Exp $
+# $NetBSD: std,v 1.20 2014/10/31 07:38:36 uebayasi Exp $
 #
 # standard MI 'options'
 #
@@ -9,7 +9,9 @@
 # Always include kern attribute (module).  Other attributes don't need to
 # depend on kern.
 #
-options	KERN
+select	kern
+
+select	net		# XXX Clean up dependency
 
 # the following options are on-by-default to keep
 # kernel config file compatibility.
@@ -22,8 +24,6 @@ options	COREDUMP	# allow processes to co
 options	AIO		# POSIX asynchronous I/O
 options	MQUEUE		# POSIX message queues
 
-options	NET		# XXX Clean up dependency
-
 #
 # Security model.
 #

Index: src/tests/usr.bin/config/t_config.sh
diff -u src/tests/usr.bin/config/t_config.sh:1.3 src/tests/usr.bin/config/t_config.sh:1.4
--- src/tests/usr.bin/config/t_config.sh:1.3	Fri Oct 31 04:54:17 2014
+++ src/tests/usr.bin/config/t_config.sh	Fri Oct 31 07:38:36 2014
@@ -1,4 +1,4 @@
-# $NetBSD: t_config.sh,v 1.3 2014/10/31 04:54:17 uebayasi Exp $
+# $NetBSD: t_config.sh,v 1.4 2014/10/31 07:38:36 uebayasi Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -62,6 +62,22 @@ run_and_check_fail()
 	config -s ${supportdir} -b compile/${name} ${config}
 }
 
+test_output()
+{
+	local name=${1}; shift
+	local res=1
+
+	run_and_check_prep ${name}
+
+	config -s ${supportdir} -b compile/${name} ${config} /dev/null 
+	cd compile/${name} 
+	check_${name} 
+	cd $OLDPWD 
+	res=0
+
+	atf_check test $res -eq 0
+}
+
 # Defines a test case for config(1).
 test_case()
 {
@@ -108,7 +124,50 @@ no options UNDEFINED
 test_case no_undefined_opt pass \
 Checks that config allows a negation for an undefined options
 
+# Attribute selection
+test_case select pass Attribute selection
+select_config_str='
+include ../d_min
+select c
+'
+check_select()
+{
+	local f=Makefile
+
+	grep -q '^a\.o:' $f 
+	grep -q '^b\.o:' $f 
+	grep -q '^c\.o:' $f 
+	:
+}
+select_body() {
+	test_output select
+}
+
+# Attribute negation
+test_case no_select pass Attribute negation
+no_select_config_str='
+include ../d_min
+select c
+no select a
+'
+check_no_select()
+{
+	local f=Makefile
+
+	: tmp
+	grep -q '^a\.o:' $f tmp
+	grep -q '^b\.o:' $f tmp
+	grep -q '^c\.o:' $f tmp
+
+	[ ! -s tmp ] 
+	:
+}
+no_select_body() {
+	test_output no_select
+}
+
 # Check minimal kernel config(1) output
+test_case min pass Minimal config
 check_min_files()
 {
 	test -e Makefile 
@@ -122,7 +181,6 @@ check_min_files()
 	test -h regress 
 	:
 }
-
 check_min_makefile()
 {
 	local f=Makefile
@@ -136,26 +194,14 @@ check_min_makefile()
 	[ ! -s tmp.template ] 
 	:
 }
-
-test_min()
+check_min()
 {
-	local res=1
-
-	run_and_check_prep min
-
-	config -s ${supportdir} -b compile/min ${config} /dev/null 
-	cd compile/min 
 	check_min_files 
 	check_min_makefile 
-	cd $OLDPWD 
-	res=0
-
-	atf_check test $res -eq 0
+	:
 }
-
-test_case min pass Minimal config
 min_body() {
-	test_min
+	test_output min
 }
 
 atf_init_test_cases()
@@ -169,5 +215,7 @@ atf_init_test_cases()
 	atf_add_test_case deffs_redef
 	

CVS commit: othersrc/usr.bin/tnftp

2014-10-31 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Fri Oct 31 07:53:52 UTC 2014

Modified Files:
othersrc/usr.bin/tnftp: ChangeLog

Log Message:
Check for sys/uio.h for writev() declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 othersrc/usr.bin/tnftp/ChangeLog

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

Modified files:

Index: othersrc/usr.bin/tnftp/ChangeLog
diff -u othersrc/usr.bin/tnftp/ChangeLog:1.63 othersrc/usr.bin/tnftp/ChangeLog:1.64
--- othersrc/usr.bin/tnftp/ChangeLog:1.63	Fri Oct 31 04:13:56 2014
+++ othersrc/usr.bin/tnftp/ChangeLog	Fri Oct 31 07:53:52 2014
@@ -1,6 +1,10 @@
-$NetBSD: ChangeLog,v 1.63 2014/10/31 04:13:56 lukem Exp $
+$NetBSD: ChangeLog,v 1.64 2014/10/31 07:53:52 lukem Exp $
 
 
+Fri Oct 31 07:52:37 UTC 2014	lukem
+
+	* Check for sys/uio.h for writev() declaration.
+
 Fri Oct 31 04:07:38 UTC 2014	lukem
 
 	* Release as tnftp 20141031.



CVS commit: [netbsd-7] src/usr.bin/ftp

2014-10-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 31 08:30:06 UTC 2014

Modified Files:
src/usr.bin/ftp [netbsd-7]: version.h

Log Message:
Pull up following revision(s) (requested by lukem in ticket #172):
usr.bin/ftp/version.h: revision 1.85
Version 20141026
Ignore special characters unless they're from the command line.
Fixes CVE-2014-8517


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.84.6.1 src/usr.bin/ftp/version.h

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

Modified files:

Index: src/usr.bin/ftp/version.h
diff -u src/usr.bin/ftp/version.h:1.84 src/usr.bin/ftp/version.h:1.84.6.1
--- src/usr.bin/ftp/version.h:1.84	Sun May  5 10:40:19 2013
+++ src/usr.bin/ftp/version.h	Fri Oct 31 08:30:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: version.h,v 1.84 2013/05/05 10:40:19 lukem Exp $	*/
+/*	$NetBSD: version.h,v 1.84.6.1 2014/10/31 08:30:06 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
@@ -34,5 +34,5 @@
 #endif
 
 #ifndef FTP_VERSION
-#define	FTP_VERSION	20130220
+#define	FTP_VERSION	20141026
 #endif



CVS commit: othersrc/usr.bin/tnftp

2014-10-31 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Fri Oct 31 08:31:52 UTC 2014

Modified Files:
othersrc/usr.bin/tnftp: configure.ac

Log Message:
Use '=' not '==' with test.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 othersrc/usr.bin/tnftp/configure.ac

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

Modified files:

Index: othersrc/usr.bin/tnftp/configure.ac
diff -u othersrc/usr.bin/tnftp/configure.ac:1.27 othersrc/usr.bin/tnftp/configure.ac:1.28
--- othersrc/usr.bin/tnftp/configure.ac:1.27	Fri Oct 31 07:22:03 2014
+++ othersrc/usr.bin/tnftp/configure.ac	Fri Oct 31 08:31:52 2014
@@ -1,4 +1,4 @@
-#   $NetBSD: configure.ac,v 1.27 2014/10/31 07:22:03 lukem Exp $
+#   $NetBSD: configure.ac,v 1.28 2014/10/31 08:31:52 lukem Exp $
 #
 # Process this file with autoconf to produce a configure script.
 
@@ -9,7 +9,7 @@ AC_COPYRIGHT([
 Copyright (c) 1999-2014 The NetBSD Foundation, Inc.
 All rights reserved.
 ])
-AC_REVISION([$Revision: 1.27 $])
+AC_REVISION([$Revision: 1.28 $])
 
 AS_SHELL_SANITIZE()
 
@@ -140,7 +140,7 @@ AX_CHECK_OPENSSL([have_ssl=yes])
 
 AS_IF([test $with_ssl != no],
   [AC_MSG_NOTICE([--with-ssl=$with_ssl; checking for required OpenSSL features])
-   AS_IF([test $have_ssl == yes],
+   AS_IF([test $have_ssl = yes],
  [AC_DEFINE([WITH_SSL], [1])
   AC_MSG_NOTICE([enabling SSL support])
   with_ssl=yes],



CVS commit: [netbsd-7] src/doc

2014-10-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 31 08:31:13 UTC 2014

Modified Files:
src/doc [netbsd-7]: CHANGES-7.0

Log Message:
Ticket #172


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.72 -r1.1.2.73 src/doc/CHANGES-7.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-7.0
diff -u src/doc/CHANGES-7.0:1.1.2.72 src/doc/CHANGES-7.0:1.1.2.73
--- src/doc/CHANGES-7.0:1.1.2.72	Thu Oct 30 19:00:12 2014
+++ src/doc/CHANGES-7.0	Fri Oct 31 08:31:13 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.72 2014/10/30 19:00:12 martin Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.73 2014/10/31 08:31:13 martin Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -1940,3 +1940,10 @@ sys/arch/x86/x86/identcpu.c			1.46-1.47
 	between domains so XEN treats them as privileged.
 	[riz, ticket #171]
 
+usr.bin/ftp/version.h1.85
+
+	Version 20141026
+	Ignore special characters unless they're from the command line.
+	Fixes CVE-2014-8517
+	[lukem, ticket #172]
+



CVS commit: othersrc/usr.bin/tnftp

2014-10-31 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Fri Oct 31 08:32:52 UTC 2014

Modified Files:
othersrc/usr.bin/tnftp: ChangeLog

Log Message:
configure test fix.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 othersrc/usr.bin/tnftp/ChangeLog

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

Modified files:

Index: othersrc/usr.bin/tnftp/ChangeLog
diff -u othersrc/usr.bin/tnftp/ChangeLog:1.64 othersrc/usr.bin/tnftp/ChangeLog:1.65
--- othersrc/usr.bin/tnftp/ChangeLog:1.64	Fri Oct 31 07:53:52 2014
+++ othersrc/usr.bin/tnftp/ChangeLog	Fri Oct 31 08:32:52 2014
@@ -1,7 +1,9 @@
-$NetBSD: ChangeLog,v 1.64 2014/10/31 07:53:52 lukem Exp $
+$NetBSD: ChangeLog,v 1.65 2014/10/31 08:32:52 lukem Exp $
 
 
-Fri Oct 31 07:52:37 UTC 2014	lukem
+Fri Oct 31 08:32:28 UTC 2014	lukem
+
+	* Use '=' not '==' with test in configure.
 
 	* Check for sys/uio.h for writev() declaration.
 



CVS commit: othersrc/usr.bin/tnftp

2014-10-31 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Fri Oct 31 08:39:11 UTC 2014

Modified Files:
othersrc/usr.bin/tnftp: configure

Log Message:
regen for test == - test = fix


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 othersrc/usr.bin/tnftp/configure

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

Modified files:

Index: othersrc/usr.bin/tnftp/configure
diff -u othersrc/usr.bin/tnftp/configure:1.42 othersrc/usr.bin/tnftp/configure:1.43
--- othersrc/usr.bin/tnftp/configure:1.42	Fri Oct 31 07:35:48 2014
+++ othersrc/usr.bin/tnftp/configure	Fri Oct 31 08:39:10 2014
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 1.27 .
+# From configure.ac Revision: 1.28 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.69 for tnftp 20141031.
 #
@@ -12277,7 +12277,7 @@ rm -f core conftest.err conftest.$ac_obj
 if test $with_ssl != no; then :
   { $as_echo $as_me:${as_lineno-$LINENO}: --with-ssl=$with_ssl; checking for required OpenSSL features 5
 $as_echo $as_me: --with-ssl=$with_ssl; checking for required OpenSSL features 6;}
-   if test $have_ssl == yes; then :
+   if test $have_ssl = yes; then :
   $as_echo #define WITH_SSL 1 confdefs.h
 
   { $as_echo $as_me:${as_lineno-$LINENO}: enabling SSL support 5



CVS commit: src/distrib/evbarm/instkernel/sshramdisk

2014-10-31 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Fri Oct 31 08:43:24 UTC 2014

Modified Files:
src/distrib/evbarm/instkernel/sshramdisk: Makefile

Log Message:
Bump image size to compensate new iwn(4) firmwares.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/evbarm/instkernel/sshramdisk/Makefile

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

Modified files:

Index: src/distrib/evbarm/instkernel/sshramdisk/Makefile
diff -u src/distrib/evbarm/instkernel/sshramdisk/Makefile:1.5 src/distrib/evbarm/instkernel/sshramdisk/Makefile:1.6
--- src/distrib/evbarm/instkernel/sshramdisk/Makefile:1.5	Thu Aug 14 18:38:29 2014
+++ src/distrib/evbarm/instkernel/sshramdisk/Makefile	Fri Oct 31 08:43:24 2014
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.5 2014/08/14 18:38:29 joerg Exp $
+#	$NetBSD: Makefile,v 1.6 2014/10/31 08:43:24 uebayasi Exp $
 
 .include bsd.own.mk
 .include ${NETBSDSRCDIR}/distrib/common/Makefile.distrib
 
 IMAGE=		sshramdisk.fs
-IMAGESIZE=	8900k
+IMAGESIZE=	13m
 MAKEFS_FLAGS=	-f 15
 
 WARNS=		1



CVS commit: src/tests/usr.bin/config

2014-10-31 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Fri Oct 31 09:11:42 UTC 2014

Modified Files:
src/tests/usr.bin/config: t_config.sh
src/tests/usr.bin/config/support/conf: files

Log Message:
config(1): Briefly test ioconf.c output


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/config/t_config.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/config/support/conf/files

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

Modified files:

Index: src/tests/usr.bin/config/t_config.sh
diff -u src/tests/usr.bin/config/t_config.sh:1.4 src/tests/usr.bin/config/t_config.sh:1.5
--- src/tests/usr.bin/config/t_config.sh:1.4	Fri Oct 31 07:38:36 2014
+++ src/tests/usr.bin/config/t_config.sh	Fri Oct 31 09:11:42 2014
@@ -1,4 +1,4 @@
-# $NetBSD: t_config.sh,v 1.4 2014/10/31 07:38:36 uebayasi Exp $
+# $NetBSD: t_config.sh,v 1.5 2014/10/31 09:11:42 uebayasi Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -166,6 +166,31 @@ no_select_body() {
 	test_output no_select
 }
 
+# Device instance
+test_case devi pass Device instance
+devi_config_str='
+include ../d_min
+d0 at root
+'
+check_devi()
+{
+	local f=ioconf.c
+
+	sed -ne '/^struct cfdriver \* const cfdriver_list_initial\[\]/,/^};/p' $f tmp.cfdriver
+	sed -ne '/^struct cfdata cfdata\[\]/,/^};/p' $f tmp.cfdata
+
+	grep -q '^CFDRIVER_DECL(d, ' $f 
+	grep -q 'd_cd,' tmp.cfdriver 
+	grep -q '^extern struct cfattach d_ca;$' $f 
+	grep -q '^static const struct cfiattrdata \* const d_attrs\[\]' $f 
+	grep -q '^static const struct cfiattrdata icf_iattrdata' $f 
+	grep -q '{ d,' tmp.cfdata 
+	:
+}
+devi_body() {
+	test_output devi
+}
+
 # Check minimal kernel config(1) output
 test_case min pass Minimal config
 check_min_files()
@@ -217,5 +242,6 @@ atf_init_test_cases()
 	atf_add_test_case no_undefined_opt
 	atf_add_test_case select
 	atf_add_test_case no_select
+	atf_add_test_case devi
 	atf_add_test_case min
 }

Index: src/tests/usr.bin/config/support/conf/files
diff -u src/tests/usr.bin/config/support/conf/files:1.2 src/tests/usr.bin/config/support/conf/files:1.3
--- src/tests/usr.bin/config/support/conf/files:1.2	Fri Oct 31 07:38:36 2014
+++ src/tests/usr.bin/config/support/conf/files	Fri Oct 31 09:11:42 2014
@@ -33,3 +33,9 @@ file	b.c	b
 
 define	c: b
 file	c.c	c
+
+define	i {}
+
+device	d: i
+attach	d at root
+file	d.c	d



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

2014-10-31 Thread Justin Cormack
Module Name:src
Committed By:   justin
Date:   Fri Oct 31 12:22:38 UTC 2014

Modified Files:
src/tests/lib/libc/gen: t_time.c

Log Message:
PR misc/49342 fix issue where time can tick during tests

Note there are still potential issues as the clock being tested is not
monotonic but it should now not fail unless time is being adjusted.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/gen/t_time.c

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/libc/gen/t_time.c
diff -u src/tests/lib/libc/gen/t_time.c:1.2 src/tests/lib/libc/gen/t_time.c:1.3
--- src/tests/lib/libc/gen/t_time.c:1.2	Fri Nov 11 05:03:38 2011
+++ src/tests/lib/libc/gen/t_time.c	Fri Oct 31 12:22:38 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_time.c,v 1.2 2011/11/11 05:03:38 jruoho Exp $ */
+/*	$NetBSD: t_time.c,v 1.3 2014/10/31 12:22:38 justin Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_time.c,v 1.2 2011/11/11 05:03:38 jruoho Exp $);
+__RCSID($NetBSD: t_time.c,v 1.3 2014/10/31 12:22:38 justin Exp $);
 
 #include atf-c.h
 #include errno.h
@@ -91,15 +91,16 @@ ATF_TC_HEAD(time_timeofday, tc)
 ATF_TC_BODY(time_timeofday, tc)
 {
 	struct timeval tv = { 0, 0 };
-	time_t t;
+	time_t t1, t2;
 
-	t = time(NULL);
+	t1 = time(NULL);
 	ATF_REQUIRE(gettimeofday(tv, NULL) == 0);
+	t2 = time(NULL);
 
 	(void)fprintf(stderr, %PRId64 vs. %PRId64\n,
-	(int64_t)t, (int64_t)tv.tv_sec);
+	(int64_t)t1, (int64_t)tv.tv_sec);
 
-	if (t != tv.tv_sec)
+	if (t1  tv.tv_sec || t2  tv.tv_sec)
 		atf_tc_fail(time(3) and gettimeofday(2) differ);
 }
 



CVS commit: src/sys/fs/puffs

2014-10-31 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 31 13:52:41 UTC 2014

Modified Files:
src/sys/fs/puffs: puffs_msgif.h puffs_vnops.c

Log Message:
Add PUFFS support for fallocate and fdiscard operations


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/fs/puffs/puffs_msgif.h
cvs rdiff -u -r1.195 -r1.196 src/sys/fs/puffs/puffs_vnops.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/puffs/puffs_msgif.h
diff -u src/sys/fs/puffs/puffs_msgif.h:1.81 src/sys/fs/puffs/puffs_msgif.h:1.82
--- src/sys/fs/puffs/puffs_msgif.h:1.81	Sat Aug 16 16:19:41 2014
+++ src/sys/fs/puffs/puffs_msgif.h	Fri Oct 31 13:52:41 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_msgif.h,v 1.81 2014/08/16 16:19:41 manu Exp $	*/
+/*	$NetBSD: puffs_msgif.h,v 1.82 2014/10/31 13:52:41 manu Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -86,11 +86,12 @@ enum {
 	PUFFS_VN_ADVLOCK,	PUFFS_VN_LEASE,		PUFFS_VN_WHITEOUT,
 	PUFFS_VN_GETPAGES,	PUFFS_VN_PUTPAGES,	PUFFS_VN_GETEXTATTR,
 	PUFFS_VN_LISTEXTATTR,	PUFFS_VN_OPENEXTATTR,	PUFFS_VN_DELETEEXTATTR,
-	PUFFS_VN_SETEXTATTR,	PUFFS_VN_CLOSEEXTATTR
+	PUFFS_VN_SETEXTATTR,	PUFFS_VN_CLOSEEXTATTR,	PUFFS_VN_FALLOCATE,
+	PUFFS_VN_FDISCARD,
 	/* NOTE: If you add an op, decrement PUFFS_VN_SPARE accordingly */
 };
-#define PUFFS_VN_MAX PUFFS_VN_CLOSEEXTATTR
-#define PUFFS_VN_SPARE 32
+#define PUFFS_VN_MAX PUFFS_VN_FDISCARD
+#define PUFFS_VN_SPARE 30
 
 /*
  * These signal invalid parameters the file system returned.
@@ -666,6 +667,18 @@ struct puffs_vnmsg_deleteextattr {
 	struct puffs_kcred	pvnr_cred;			/* OUT	*/
 };
 
+struct puffs_vnmsg_fallocate {
+	struct puffs_req	pvn_pr;
+	off_t			pvnr_off;			/* OUT*/
+	off_t			pvnr_len;			/* OUT*/
+};
+
+struct puffs_vnmsg_fdiscard {
+	struct puffs_req	pvn_pr;
+	off_t			pvnr_off;			/* OUT*/
+	off_t			pvnr_len;			/* OUT*/
+};
+
 /*
  * For cache reports.  Everything is always out-out-out, no replies
  */

Index: src/sys/fs/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.195 src/sys/fs/puffs/puffs_vnops.c:1.196
--- src/sys/fs/puffs/puffs_vnops.c:1.195	Fri Oct 31 13:51:33 2014
+++ src/sys/fs/puffs/puffs_vnops.c	Fri Oct 31 13:52:41 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_vnops.c,v 1.195 2014/10/31 13:51:33 manu Exp $	*/
+/*	$NetBSD: puffs_vnops.c,v 1.196 2014/10/31 13:52:41 manu Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: puffs_vnops.c,v 1.195 2014/10/31 13:51:33 manu Exp $);
+__KERNEL_RCSID(0, $NetBSD: puffs_vnops.c,v 1.196 2014/10/31 13:52:41 manu Exp $);
 
 #include sys/param.h
 #include sys/buf.h
@@ -73,6 +73,8 @@ int	puffs_vnop_symlink(void *);
 int	puffs_vnop_rename(void *);
 int	puffs_vnop_read(void *);
 int	puffs_vnop_write(void *);
+int	puffs_vnop_fallocate(void *);
+int	puffs_vnop_fdiscard(void *);
 int	puffs_vnop_fcntl(void *);
 int	puffs_vnop_ioctl(void *);
 int	puffs_vnop_inactive(void *);
@@ -113,8 +115,8 @@ const struct vnodeopv_entry_desc puffs_v
 { vop_setattr_desc, puffs_vnop_checkop },	/* setattr */
 { vop_read_desc, puffs_vnop_checkop },		/* read */
 { vop_write_desc, puffs_vnop_checkop },	/* write */
-	{ vop_fallocate_desc, genfs_eopnotsupp },	/* fallocate */
-	{ vop_fdiscard_desc, genfs_eopnotsupp },	/* fdiscard */
+	{ vop_fallocate_desc, puffs_vnop_fallocate },	/* fallocate */
+	{ vop_fdiscard_desc, puffs_vnop_fdiscard },	/* fdiscard */
 { vop_fsync_desc, puffs_vnop_fsync },		/* REAL fsync */
 { vop_seek_desc, puffs_vnop_checkop },		/* seek */
 { vop_remove_desc, puffs_vnop_checkop },	/* remove */
@@ -2499,6 +2501,80 @@ puffs_vnop_write(void *v)
 }
 
 int
+puffs_vnop_fallocate(void *v)
+{
+	struct vop_fallocate_args /* {
+		const struct vnodeop_desc *a_desc;
+		struct vnode *a_vp;
+		off_t a_pos;
+		off_t a_len;
+	} */ *ap = v;
+	struct vnode *vp = ap-a_vp;
+	struct puffs_node *pn = VPTOPP(vp);
+	struct puffs_mount *pmp = MPTOPUFFSMP(vp-v_mount);
+	PUFFS_MSG_VARS(vn, fallocate);
+	int error;
+
+	mutex_enter(pn-pn_sizemtx);
+
+	PUFFS_MSG_ALLOC(vn, fallocate);
+	fallocate_msg-pvnr_off = ap-a_pos;
+	fallocate_msg-pvnr_len = ap-a_len;
+	puffs_msg_setinfo(park_fallocate, PUFFSOP_VN,
+	PUFFS_VN_FALLOCATE, VPTOPNC(vp));
+
+	PUFFS_MSG_ENQUEUEWAIT2(pmp, park_fallocate, vp-v_data, NULL, error);
+	error = checkerr(pmp, error, __func__);
+	PUFFS_MSG_RELEASE(fallocate);
+
+	switch (error) {
+	case 0:
+		break;
+	case EAGAIN:
+		error = EIO;
+		/* FALLTHROUGH */
+	default:
+		goto out;
+	}
+
+	if (ap-a_pos + ap-a_len  vp-v_size) {
+		uvm_vnp_setsize(vp, ap-a_pos + ap-a_len);
+		puffs_updatenode(pn, PUFFS_UPDATESIZE, vp-v_size);
+	}
+out:
+ 	mutex_exit(pn-pn_sizemtx);
+
+ 	return error;
+}
+
+int
+puffs_vnop_fdiscard(void *v)
+{
+	struct vop_fdiscard_args /* {
+		const struct vnodeop_desc *a_desc;

CVS commit: src/lib/libpuffs

2014-10-31 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 31 13:56:04 UTC 2014

Modified Files:
src/lib/libpuffs: dispatcher.c opdump.c puffs.c puffs.h puffs_ops.3

Log Message:
libpuffs support for fallocate and fdiscard operations


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libpuffs/dispatcher.c
cvs rdiff -u -r1.36 -r1.37 src/lib/libpuffs/opdump.c
cvs rdiff -u -r1.117 -r1.118 src/lib/libpuffs/puffs.c
cvs rdiff -u -r1.125 -r1.126 src/lib/libpuffs/puffs.h
cvs rdiff -u -r1.39 -r1.40 src/lib/libpuffs/puffs_ops.3

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

Modified files:

Index: src/lib/libpuffs/dispatcher.c
diff -u src/lib/libpuffs/dispatcher.c:1.47 src/lib/libpuffs/dispatcher.c:1.48
--- src/lib/libpuffs/dispatcher.c:1.47	Sat Aug 16 16:25:44 2014
+++ src/lib/libpuffs/dispatcher.c	Fri Oct 31 13:56:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dispatcher.c,v 1.47 2014/08/16 16:25:44 manu Exp $	*/
+/*	$NetBSD: dispatcher.c,v 1.48 2014/10/31 13:56:04 manu Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007, 2008 Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: dispatcher.c,v 1.47 2014/08/16 16:25:44 manu Exp $);
+__RCSID($NetBSD: dispatcher.c,v 1.48 2014/10/31 13:56:04 manu Exp $);
 #endif /* !lint */
 
 #include sys/types.h
@@ -1140,6 +1140,34 @@ dispatch(struct puffs_cc *pcc)
 			break;
 		}
 
+		case PUFFS_VN_FALLOCATE:
+		{
+			struct puffs_vnmsg_fallocate *auxt = auxbuf;
+
+			if (pops-puffs_node_fallocate == NULL) {
+error = EOPNOTSUPP;
+break;
+			}
+
+			error = pops-puffs_node_fallocate(pu,
+			opcookie, auxt-pvnr_off, auxt-pvnr_len);
+			break;
+		}
+
+		case PUFFS_VN_FDISCARD:
+		{
+			struct puffs_vnmsg_fdiscard *auxt = auxbuf;
+
+			if (pops-puffs_node_fdiscard == NULL) {
+error = EOPNOTSUPP;
+break;
+			}
+
+			error = pops-puffs_node_fdiscard(pu,
+			opcookie, auxt-pvnr_off, auxt-pvnr_len);
+			break;
+		}
+
 		default:
 			printf(inval op %d\n, preq-preq_optype);
 			error = EINVAL;

Index: src/lib/libpuffs/opdump.c
diff -u src/lib/libpuffs/opdump.c:1.36 src/lib/libpuffs/opdump.c:1.37
--- src/lib/libpuffs/opdump.c:1.36	Thu Mar 15 02:02:21 2012
+++ src/lib/libpuffs/opdump.c	Fri Oct 31 13:56:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: opdump.c,v 1.36 2012/03/15 02:02:21 joerg Exp $	*/
+/*	$NetBSD: opdump.c,v 1.37 2014/10/31 13:56:04 manu Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006  Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: opdump.c,v 1.36 2012/03/15 02:02:21 joerg Exp $);
+__RCSID($NetBSD: opdump.c,v 1.37 2014/10/31 13:56:04 manu Exp $);
 #endif /* !lint */
 
 #include sys/types.h
@@ -117,6 +117,8 @@ const char *puffsdump_vnop_revmap[] = {
 	PUFFS_VN_DELETEEXTATTR,
 	PUFFS_VN_SETEXTATTR,
 	PUFFS_VN_CLOSEEXTATTR,
+	PUFFS_VN_FALLOCATE,
+	PUFFS_VN_FDISCARD,
 };
 size_t puffsdump_vnop_count = __arraycount(puffsdump_vnop_revmap);
 

Index: src/lib/libpuffs/puffs.c
diff -u src/lib/libpuffs/puffs.c:1.117 src/lib/libpuffs/puffs.c:1.118
--- src/lib/libpuffs/puffs.c:1.117	Mon Nov 14 01:27:42 2011
+++ src/lib/libpuffs/puffs.c	Fri Oct 31 13:56:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs.c,v 1.117 2011/11/14 01:27:42 chs Exp $	*/
+/*	$NetBSD: puffs.c,v 1.118 2014/10/31 13:56:04 manu Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: puffs.c,v 1.117 2011/11/14 01:27:42 chs Exp $);
+__RCSID($NetBSD: puffs.c,v 1.118 2014/10/31 13:56:04 manu Exp $);
 #endif /* !lint */
 
 #include sys/param.h
@@ -106,6 +106,8 @@ fillvnopmask(struct puffs_ops *pops, str
 	FILLOP(setextattr,  SETEXTATTR);
 	FILLOP(listextattr, LISTEXTATTR);
 	FILLOP(deleteextattr, DELETEEXTATTR);
+	FILLOP(fallocate, FALLOCATE);
+	FILLOP(fdiscard, FDISCARD);
 }
 #undef FILLOP
 

Index: src/lib/libpuffs/puffs.h
diff -u src/lib/libpuffs/puffs.h:1.125 src/lib/libpuffs/puffs.h:1.126
--- src/lib/libpuffs/puffs.h:1.125	Sat Aug 16 16:25:44 2014
+++ src/lib/libpuffs/puffs.h	Fri Oct 31 13:56:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs.h,v 1.125 2014/08/16 16:25:44 manu Exp $	*/
+/*	$NetBSD: puffs.h,v 1.126 2014/10/31 13:56:04 manu Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -252,8 +252,12 @@ struct puffs_ops {
 	puffs_cookie_t, int);
 	int (*puffs_node_open2)(struct puffs_usermount *,
 	puffs_cookie_t, int, const struct puffs_cred *, int *);
+	int (*puffs_node_fallocate)(struct puffs_usermount *,
+	puffs_cookie_t, off_t, off_t);
+	int (*puffs_node_fdiscard)(struct puffs_usermount *,
+	puffs_cookie_t, off_t, off_t);
 
-	void *puffs_ops_spare[28];
+	void *puffs_ops_spare[26];
 };
 
 typedef	int (*pu_pathbuild_fn)(struct puffs_usermount *,
@@ -414,7 +418,11 @@ enum {
 	int fsname##_node_reclaim2(struct puffs_usermount *,		\
 	

CVS commit: src/lib/libpuffs

2014-10-31 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Oct 31 14:01:17 UTC 2014

Modified Files:
src/lib/libpuffs: puffs_ops.3

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


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libpuffs/puffs_ops.3

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

Modified files:

Index: src/lib/libpuffs/puffs_ops.3
diff -u src/lib/libpuffs/puffs_ops.3:1.40 src/lib/libpuffs/puffs_ops.3:1.41
--- src/lib/libpuffs/puffs_ops.3:1.40	Fri Oct 31 13:56:04 2014
+++ src/lib/libpuffs/puffs_ops.3	Fri Oct 31 14:01:16 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: puffs_ops.3,v 1.40 2014/10/31 13:56:04 manu Exp $
+.\	$NetBSD: puffs_ops.3,v 1.41 2014/10/31 14:01:16 wiz Exp $
 .\
 .\ Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\
@@ -23,7 +23,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd August 16, 2014
+.Dd October 31, 2014
 .Dt PUFFS_OPS 3
 .Os
 .Sh NAME
@@ -811,7 +811,7 @@ in which
 .Dv PUFFS_WRITE_FAF
 is set for Fire-And-Forget operations.
 .It Fn puffs_node_fallocate pu opc pos len
-Allocate 
+Allocate
 .Fa len
 bytes of backing store at offset
 .Fa pos



CVS commit: src/sys/fs/puffs

2014-10-31 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 31 14:20:54 UTC 2014

Modified Files:
src/sys/fs/puffs: puffs_msgif.h

Log Message:
Add PUFFS_HAVE_FALLOCATE in puffs_msgif.h so that filesystem can decide
at build time wether fallocate is usable


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/fs/puffs/puffs_msgif.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/fs/puffs/puffs_msgif.h
diff -u src/sys/fs/puffs/puffs_msgif.h:1.82 src/sys/fs/puffs/puffs_msgif.h:1.83
--- src/sys/fs/puffs/puffs_msgif.h:1.82	Fri Oct 31 13:52:41 2014
+++ src/sys/fs/puffs/puffs_msgif.h	Fri Oct 31 14:20:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_msgif.h,v 1.82 2014/10/31 13:52:41 manu Exp $	*/
+/*	$NetBSD: puffs_msgif.h,v 1.83 2014/10/31 14:20:54 manu Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -667,6 +667,7 @@ struct puffs_vnmsg_deleteextattr {
 	struct puffs_kcred	pvnr_cred;			/* OUT	*/
 };
 
+#define PUFFS_HAVE_FALLOCATE 1
 struct puffs_vnmsg_fallocate {
 	struct puffs_req	pvn_pr;
 	off_t			pvnr_off;			/* OUT*/



CVS commit: src/lib/libperfuse

2014-10-31 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 31 15:12:15 UTC 2014

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

Log Message:
FUSE fallocate support
There seems to be no fdiscard FUSE operation at the moment, hence that one
is left unused.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libperfuse/fuse.h
cvs rdiff -u -r1.77 -r1.78 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.34 -r1.35 src/lib/libperfuse/perfuse.c
cvs rdiff -u -r1.35 -r1.36 src/lib/libperfuse/perfuse_priv.h

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

Modified files:

Index: src/lib/libperfuse/fuse.h
diff -u src/lib/libperfuse/fuse.h:1.5 src/lib/libperfuse/fuse.h:1.6
--- src/lib/libperfuse/fuse.h:1.5	Wed Dec 28 17:33:53 2011
+++ src/lib/libperfuse/fuse.h	Fri Oct 31 15:12:15 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: fuse.h,v 1.5 2011/12/28 17:33:53 manu Exp $ */
+/*  $NetBSD: fuse.h,v 1.6 2014/10/31 15:12:15 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -169,6 +169,9 @@ enum fuse_opcode {
 	FUSE_DESTROY   = 38,
 	FUSE_IOCTL = 39,
 	FUSE_POLL  = 40,
+	FUSE_NOTIFY_REPLY  = 41,
+	FUSE_BATCH_FORGET  = 42,
+	FUSE_FALLOCATE = 43,
 	FUSE_OPCODE_MAX,
 
 	FUSE_CUSE_INIT = 4096
@@ -441,6 +444,14 @@ struct fuse_notify_poll_wakeup_out {
 	uint64_t	kh;
 };
 
+struct fuse_fallocate_in {
+	uint64_t	fh;
+	uint64_t	offset;
+	uint64_t	length;
+	uint32_t	mode;
+	uint32_t	padding;
+};
+
 #if 0 /* Duplicated in perfuse.h to avoid making fuse.h public */
 /* Send from kernel to proces */
 struct fuse_in_header {

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.77 src/lib/libperfuse/ops.c:1.78
--- src/lib/libperfuse/ops.c:1.77	Tue Oct 28 16:54:11 2014
+++ src/lib/libperfuse/ops.c	Fri Oct 31 15:12:15 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.77 2014/10/28 16:54:11 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.78 2014/10/31 15:12:15 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -3635,8 +3635,47 @@ perfuse_node_deleteextattr(struct puffs_
 	error = xchg_msg(pu, opc, pm, NO_PAYLOAD_REPLY_LEN, wait_reply);
 	if (error != 0)
 		goto out;
+		
+	ps-ps_destroy_msg(pm);
+
+out:
+	node_rele(opc);
+	return error;
+}
+
+int
+perfuse_node_fallocate(struct puffs_usermount *pu, puffs_cookie_t opc,
+	off_t off, off_t len)
+{
+	struct perfuse_state *ps;
+	perfuse_msg_t *pm;
+	struct fuse_fallocate_in *fai;
+	int error;
 	
+	ps = puffs_getspecific(pu);
+	if (ps-ps_flags  PS_NO_FALLOCATE)
+		return EOPNOTSUPP;
+
+	node_ref(opc);
+
+	pm = ps-ps_new_msg(pu, opc, FUSE_FALLOCATE, sizeof(*fai), NULL);
+
+	fai = GET_INPAYLOAD(ps, pm, fuse_fallocate_in);
+	fai-fh = perfuse_get_fh(opc, FWRITE);
+	fai-offset = off;
+	fai-length = len;
+	fai-mode = 0;
+		
+	error = xchg_msg(pu, opc, pm, NO_PAYLOAD_REPLY_LEN, wait_reply);
+	if (error == EOPNOTSUPP || error == ENOSYS) {
+		ps-ps_flags |= PS_NO_FALLOCATE;
+		error = EOPNOTSUPP;
+	}
+	if (error != 0)
+		goto out;
+		
 	ps-ps_destroy_msg(pm);
+
 out:
 	node_rele(opc);
 	return error;

Index: src/lib/libperfuse/perfuse.c
diff -u src/lib/libperfuse/perfuse.c:1.34 src/lib/libperfuse/perfuse.c:1.35
--- src/lib/libperfuse/perfuse.c:1.34	Wed Sep  3 16:01:45 2014
+++ src/lib/libperfuse/perfuse.c	Fri Oct 31 15:12:15 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse.c,v 1.34 2014/09/03 16:01:45 manu Exp $ */
+/*  $NetBSD: perfuse.c,v 1.35 2014/10/31 15:12:15 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -503,6 +503,9 @@ perfuse_init(struct perfuse_callbacks *p
 #ifdef PUFFS_OPEN_IO_DIRECT 
 	PUFFSOP_SET(pops, perfuse, node, open2);
 #endif /* PUFFS_OPEN_IO_DIRECT */
+#ifdef PUFFS_HAVE_FALLOCATE
+	PUFFSOP_SET(pops, perfuse, node, fallocate);
+#endif /* PUFFS_HAVE_FALLOCATE */
 
 	/*
 	 * PUFFS_KFLAG_NOCACHE_NAME is required so that we can see changes

Index: src/lib/libperfuse/perfuse_priv.h
diff -u src/lib/libperfuse/perfuse_priv.h:1.35 src/lib/libperfuse/perfuse_priv.h:1.36
--- src/lib/libperfuse/perfuse_priv.h:1.35	Wed Sep  3 23:59:58 2014
+++ src/lib/libperfuse/perfuse_priv.h	Fri Oct 31 15:12:15 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse_priv.h,v 1.35 2014/09/03 23:59:58 enami Exp $ */
+/*  $NetBSD: perfuse_priv.h,v 1.36 2014/10/31 15:12:15 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -67,6 +67,7 @@ struct perfuse_state {
 #define PS_NO_ACCESS	0x0001	/* access is unimplemented; */
 #define PS_NO_CREAT	0x0004	/* create is unimplemented */
 #define PS_INLOOP	0x0008	/* puffs mainloop started */
+#define PS_NO_FALLOCATE	0x0010	/* fallocate is unimplemented */
 	uint64_t ps_fsid;
 	uint32_t ps_max_readahead;
 	uint32_t ps_max_write;
@@ -277,6 +278,8 @@ int perfuse_node_getattr_ttl(struct puff
 int perfuse_node_setattr_ttl(struct puffs_usermount *,
 puffs_cookie_t, struct vattr *, const struct puffs_cred *,
   

CVS commit: src/lib/libperfuse

2014-10-31 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 31 15:20:08 UTC 2014

Modified Files:
src/lib/libperfuse: ops.c

Log Message:
Avoid deadlocks on write errors

On write errors, we failed to dequeue some operations, leading to
rare but unpleasant deadlocks


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/lib/libperfuse/ops.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/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.78 src/lib/libperfuse/ops.c:1.79
--- src/lib/libperfuse/ops.c:1.78	Fri Oct 31 15:12:15 2014
+++ src/lib/libperfuse/ops.c	Fri Oct 31 15:20:08 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.78 2014/10/31 15:12:15 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.79 2014/10/31 15:20:08 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -3299,6 +3299,7 @@ perfuse_node_write2(struct puffs_usermou
 	if (*resid != 0)
 		error = EFBIG;
 
+out:
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags  PDF_RESIZE) {
 		if (offset  (off_t)vap-va_size)
@@ -3315,16 +3316,6 @@ perfuse_node_write2(struct puffs_usermou
 	if (offset  (off_t)vap-va_size) 
 		vap-va_size = offset;
 
-	if (inresize) {
-#ifdef PERFUSE_DEBUG
-		if (!(pnd-pnd_flags  PND_INRESIZE))
-			DERRX(EX_SOFTWARE, file write grow without resize);
-#endif
-		pnd-pnd_flags = ~PND_INRESIZE;
-		(void)dequeue_requests(opc, PCQ_RESIZE, DEQUEUE_ALL);
-	}
-
-
 	/*
 	 * Statistics
 	 */
@@ -3344,7 +3335,15 @@ perfuse_node_write2(struct puffs_usermou
 			__func__, (void*)opc, perfuse_node_path(ps, opc));
 #endif
 
-out:
+	if (inresize) {
+#ifdef PERFUSE_DEBUG
+		if (!(pnd-pnd_flags  PND_INRESIZE))
+			DERRX(EX_SOFTWARE, file write grow without resize);
+#endif
+		pnd-pnd_flags = ~PND_INRESIZE;
+		(void)dequeue_requests(opc, PCQ_RESIZE, DEQUEUE_ALL);
+	}
+
 	/*
 	 * VOP_PUTPAGE causes FAF write where kernel does not 
 	 * check operation result. At least warn if it failed.



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

2014-10-31 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Fri Oct 31 16:28:56 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: RPI_INSTALL

Log Message:
Bump ramdisk size to embed 13M sshramdisk.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/RPI_INSTALL

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/conf/RPI_INSTALL
diff -u src/sys/arch/evbarm/conf/RPI_INSTALL:1.5 src/sys/arch/evbarm/conf/RPI_INSTALL:1.6
--- src/sys/arch/evbarm/conf/RPI_INSTALL:1.5	Thu Aug 14 18:38:29 2014
+++ src/sys/arch/evbarm/conf/RPI_INSTALL	Fri Oct 31 16:28:56 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: RPI_INSTALL,v 1.5 2014/08/14 18:38:29 joerg Exp $
+#	$NetBSD: RPI_INSTALL,v 1.6 2014/10/31 16:28:56 uebayasi Exp $
 #
 #	RPI_INSTALL -- RPI kernel with installation-sized
 #	ramdisk
@@ -8,7 +8,7 @@ include arch/evbarm/conf/RPI
 include arch/evbarm/conf/INSTALL
 
 no options	MEMORY_DISK_ROOT_SIZE
-options 	MEMORY_DISK_ROOT_SIZE=17800
+options 	MEMORY_DISK_ROOT_SIZE=26624
 
 makeoptions	RAMDISKNAME=sshramdisk
 no makeoptions	DEBUG



CVS commit: src/usr.bin/config

2014-10-31 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Fri Oct 31 17:43:56 UTC 2014

Modified Files:
src/usr.bin/config: mkioconf.c

Log Message:
config(1): Emit only referenced interface attributes in ioconf.c


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/config/mkioconf.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.bin/config/mkioconf.c
diff -u src/usr.bin/config/mkioconf.c:1.22 src/usr.bin/config/mkioconf.c:1.23
--- src/usr.bin/config/mkioconf.c:1.22	Wed Oct 29 17:14:50 2014
+++ src/usr.bin/config/mkioconf.c	Fri Oct 31 17:43:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkioconf.c,v 1.22 2014/10/29 17:14:50 christos Exp $	*/
+/*	$NetBSD: mkioconf.c,v 1.23 2014/10/31 17:43:55 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: mkioconf.c,v 1.22 2014/10/29 17:14:50 christos Exp $);
+__RCSID($NetBSD: mkioconf.c,v 1.23 2014/10/31 17:43:55 uebayasi Exp $);
 
 #include sys/param.h
 #include err.h
@@ -177,6 +177,8 @@ cf_locators_print(const char *name, void
 	a = value;
 	if (!a-a_iattr)
 		return (0);
+	if (ht_lookup(selecttab, name) == NULL)
+		return (0);
 
 	if (a-a_locs) {
 		fprintf(fp,



CVS commit: src/usr.bin/config

2014-10-31 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Fri Oct 31 17:58:02 UTC 2014

Modified Files:
src/usr.bin/config: mkioconf.c

Log Message:
config(1): KNF generated ioconf.c


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/config/mkioconf.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.bin/config/mkioconf.c
diff -u src/usr.bin/config/mkioconf.c:1.23 src/usr.bin/config/mkioconf.c:1.24
--- src/usr.bin/config/mkioconf.c:1.23	Fri Oct 31 17:43:55 2014
+++ src/usr.bin/config/mkioconf.c	Fri Oct 31 17:58:02 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkioconf.c,v 1.23 2014/10/31 17:43:55 uebayasi Exp $	*/
+/*	$NetBSD: mkioconf.c,v 1.24 2014/10/31 17:58:02 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: mkioconf.c,v 1.23 2014/10/31 17:43:55 uebayasi Exp $);
+__RCSID($NetBSD: mkioconf.c,v 1.24 2014/10/31 17:58:02 uebayasi Exp $);
 
 #include sys/param.h
 #include err.h
@@ -184,7 +184,7 @@ cf_locators_print(const char *name, void
 		fprintf(fp,
 		static const struct cfiattrdata %scf_iattrdata = {\n,
 			name);
-		fprintf(fp, \t\%s\, %d,\n\t{\n, name, a-a_loclen);
+		fprintf(fp, \t\%s\, %d, {\n, name, a-a_loclen);
 		for (ll = a-a_locs; ll; ll = ll-ll_next)
 			fprintf(fp, \t\t{ \%s\, \%s\, %s },\n,
 ll-ll_name,



CVS commit: src/usr.bin/config

2014-10-31 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Fri Oct 31 18:26:06 UTC 2014

Modified Files:
src/usr.bin/config: mkioconf.c

Log Message:
config(1): Better indent of cfdata in ioconf.c


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/config/mkioconf.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.bin/config/mkioconf.c
diff -u src/usr.bin/config/mkioconf.c:1.24 src/usr.bin/config/mkioconf.c:1.25
--- src/usr.bin/config/mkioconf.c:1.24	Fri Oct 31 17:58:02 2014
+++ src/usr.bin/config/mkioconf.c	Fri Oct 31 18:26:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkioconf.c,v 1.24 2014/10/31 17:58:02 uebayasi Exp $	*/
+/*	$NetBSD: mkioconf.c,v 1.25 2014/10/31 18:26:06 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: mkioconf.c,v 1.24 2014/10/31 17:58:02 uebayasi Exp $);
+__RCSID($NetBSD: mkioconf.c,v 1.25 2014/10/31 18:26:06 uebayasi Exp $);
 
 #include sys/param.h
 #include err.h
@@ -380,7 +380,7 @@ emitcfdata(FILE *fp)
 		\n
 		%sstruct cfdata cfdata%s%s[] = {\n
 		/* driver   attachmentunit state 
-		loc   flags pspec */\n,
+		 loc   flags  pspec */\n,
 		ioconfname ? static  : ,
 		ioconfname ? _ioconf_ : ,
 		ioconfname ? ioconfname : );
@@ -435,7 +435,7 @@ emitcfdata(FILE *fp)
 		} else
 			loc = loc;
 		fprintf(fp, { \%s\,%s\%s\,%s%2d, %s, %7s, %#6x, ,
-			basename, strlen(basename)  8 ? \t\t
+			basename, strlen(basename)  7 ? \t\t
 			   : \t,
 			attachment, strlen(attachment)  5 ? \t\t
 			   : \t,
@@ -446,7 +446,7 @@ emitcfdata(FILE *fp)
 			fputs(NULL },\n, fp);
 	}
 	fprintf(fp, { %s,%s%s,%s%2d, %s, %7s, %#6x, %s }\n};\n,
-	NULL, \t\t, NULL, \t\t, 0, 0, NULL, 0, NULL);
+	NULL, \t\t, NULL, \t\t, 0,0, NULL, 0, NULL);
 }
 
 /*



CVS commit: src/usr.bin/config

2014-10-31 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sat Nov  1 04:34:27 UTC 2014

Modified Files:
src/usr.bin/config: sem.c

Log Message:
config(1): KNF


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/config/sem.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.bin/config/sem.c
diff -u src/usr.bin/config/sem.c:1.66 src/usr.bin/config/sem.c:1.67
--- src/usr.bin/config/sem.c:1.66	Fri Oct 31 07:38:36 2014
+++ src/usr.bin/config/sem.c	Sat Nov  1 04:34:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sem.c,v 1.66 2014/10/31 07:38:36 uebayasi Exp $	*/
+/*	$NetBSD: sem.c,v 1.67 2014/11/01 04:34:27 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: sem.c,v 1.66 2014/10/31 07:38:36 uebayasi Exp $);
+__RCSID($NetBSD: sem.c,v 1.67 2014/11/01 04:34:27 uebayasi Exp $);
 
 #include sys/param.h
 #include ctype.h
@@ -1329,7 +1329,8 @@ remove_devi(struct devi *i)
 	 *  list.
 	 */
 	if (i != f) {
-		for (j = f; j-i_alias != i; j = j-i_alias);
+		for (j = f; j-i_alias != i; j = j-i_alias)
+			continue;
 		j-i_alias = i-i_alias;
 	} else {
 		if (i-i_alias == NULL) {
@@ -1352,7 +1353,8 @@ remove_devi(struct devi *i)
 		 */
 		for (ppi = d-d_ihead;
 		*ppi != NULL  *ppi != i  (*ppi)-i_bsame != i;
-		ppi = (*ppi)-i_bsame);
+		ppi = (*ppi)-i_bsame)
+			continue;
 		if (*ppi == NULL)
 			panic(deldev: dev (%s) doesn't list the devi
 			 (%s at %s), d-d_name, i-i_name, i-i_at);
@@ -1378,7 +1380,8 @@ remove_devi(struct devi *i)
 	iba = i-i_atdeva;
 	for (ppi = iba-d_ihead;
 	*ppi != NULL  *ppi != i  (*ppi)-i_asame != i;
-	ppi = (*ppi)-i_asame);
+	ppi = (*ppi)-i_asame)
+		continue;
 	if (*ppi == NULL)
 		panic(deldev: deva (%s) doesn't list the devi (%s),
 		iba-d_name, i-i_name);
@@ -1442,7 +1445,8 @@ remove_devi(struct devi *i)
 			panic(remove_devi(%s) - can't add to deaddevitab,
 			i-i_name);
 	} else {
-		for (j = f; j-i_alias != NULL; j = j-i_alias);
+		for (j = f; j-i_alias != NULL; j = j-i_alias)
+			continue;
 		j-i_alias = i;
 	}
 	/*



CVS commit: src/sys/dev

2014-10-31 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sat Nov  1 05:56:36 UTC 2014

Modified Files:
src/sys/dev: audio.c audio_if.h

Log Message:
audio(4): Fix indirect circular dependency with audio if drivers

Provide audio_attach_mi(4) as inline so that audio if drivers don't need to
call functions in audio.c.  This way audio if drivers (e.g. auich(4)) can be
linked into kernel without audio.c.


To generate a diff of this commit:
cvs rdiff -u -r1.263 -r1.264 src/sys/dev/audio.c
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/audio_if.h

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

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.263 src/sys/dev/audio.c:1.264
--- src/sys/dev/audio.c:1.263	Fri Jul 25 08:10:35 2014
+++ src/sys/dev/audio.c	Sat Nov  1 05:56:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.263 2014/07/25 08:10:35 dholland Exp $	*/
+/*	$NetBSD: audio.c,v 1.264 2014/11/01 05:56:36 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: audio.c,v 1.263 2014/07/25 08:10:35 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: audio.c,v 1.264 2014/11/01 05:56:36 uebayasi Exp $);
 
 #include audio.h
 #if NAUDIO  0
@@ -829,27 +829,6 @@ au_setup_ports(struct audio_softc *sc, s
 	}
 }
 
-/*
- * Called from hardware driver.  This is where the MI audio driver gets
- * probed/attached to the hardware driver.
- */
-device_t
-audio_attach_mi(const struct audio_hw_if *ahwp, void *hdlp, device_t dev)
-{
-	struct audio_attach_args arg;
-
-#ifdef DIAGNOSTIC
-	if (ahwp == NULL) {
-		aprint_error(audio_attach_mi: NULL\n);
-		return 0;
-	}
-#endif
-	arg.type = AUDIODEV_TYPE_AUDIO;
-	arg.hwif = ahwp;
-	arg.hdl = hdlp;
-	return config_found(dev, arg, audioprint);
-}
-
 #ifdef AUDIO_DEBUG
 void	audio_printsc(struct audio_softc *);
 void	audio_print_params(const char *, struct audio_params *);

Index: src/sys/dev/audio_if.h
diff -u src/sys/dev/audio_if.h:1.67 src/sys/dev/audio_if.h:1.68
--- src/sys/dev/audio_if.h:1.67	Wed Nov 23 23:07:31 2011
+++ src/sys/dev/audio_if.h	Sat Nov  1 05:56:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio_if.h,v 1.67 2011/11/23 23:07:31 jmcneill Exp $	*/
+/*	$NetBSD: audio_if.h,v 1.68 2014/11/01 05:56:36 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1994 Havard Eidnes.
@@ -254,10 +254,32 @@ struct audio_attach_args {
 #define AUDIODEV_TYPE_MPU	3
 #define AUDIODEV_TYPE_AUX	4
 
-/* Attach the MI driver(s) to the MD driver. */
-device_t audio_attach_mi(const struct audio_hw_if *, void *, device_t);
 int	audioprint(void *, const char *);
 
+/*
+ * Called from hardware driver.  This is where the MI audio driver gets
+ * probed/attached to the hardware driver.
+ *
+ * This is provided as inline so that hardware drivers don't need to depend
+ * on audio.c.
+ */
+static inline device_t
+audio_attach_mi(const struct audio_hw_if *ahwp, void *hdlp, device_t dev)
+{
+	struct audio_attach_args arg;
+
+#ifdef DIAGNOSTIC
+	if (ahwp == NULL) {
+		aprint_error(audio_attach_mi: NULL\n);
+		return 0;
+	}
+#endif
+	arg.type = AUDIODEV_TYPE_AUDIO;
+	arg.hwif = ahwp;
+	arg.hdl = hdlp;
+	return config_found(dev, arg, audioprint);
+}
+
 /* Device identity flags */
 #define SOUND_DEVICE		0
 #define AUDIO_DEVICE		0x80