From owner-svn-src-stable@FreeBSD.ORG Sun Mar 18 09:19:40 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A173D1065670; Sun, 18 Mar 2012 09:19:40 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9001E8FC08; Sun, 18 Mar 2012 09:19:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2I9Jenn010663; Sun, 18 Mar 2012 09:19:40 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2I9Je7I010661; Sun, 18 Mar 2012 09:19:40 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201203180919.q2I9Je7I010661@svn.freebsd.org> From: Ed Schouten Date: Sun, 18 Mar 2012 09:19:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233108 - stable/9/sys/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 09:19:40 -0000 Author: ed Date: Sun Mar 18 09:19:40 2012 New Revision: 233108 URL: http://svn.freebsd.org/changeset/base/233108 Log: MFC r228322,228330,228477,228495,228562,228564,228859,228897,229574,230277: Bring in sync with FreeBSD HEAD: - Add an __alignof() for non-GCC and GCC < 2.95. - Attempt to implement the following C11 keywords: _Alignas(), _Alignof(), _Noreturn, _Static_assert() and _Thread_local. - Add __generic(), which allows us to do _Generic() in a portable fashion. - Improve __offsetof(), __DECONST(), __DEVOLATILE() and __DEQUALIFY() to use __uintptr_t and __size_t to make them work with less header prerequisites. - Add __has_feature(), __has_include() and __has_builtin() to make it easier to test against Clang features. Tested by: linimon@'s exp-run (thanks!) Modified: stable/9/sys/sys/cdefs.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sys/cdefs.h ============================================================================== --- stable/9/sys/sys/cdefs.h Sun Mar 18 08:08:06 2012 (r233107) +++ stable/9/sys/sys/cdefs.h Sun Mar 18 09:19:40 2012 (r233108) @@ -218,6 +218,54 @@ #endif #endif +#if !__GNUC_PREREQ__(2, 95) +#define __alignof(x) __offsetof(struct { char __a; x __b; }, __b) +#endif + +/* + * Keywords added in C11. + */ +#if defined(__cplusplus) && __cplusplus >= 201103L +#define _Alignas(e) alignas(e) +#define _Alignof(e) alignof(e) +#define _Noreturn [[noreturn]] +#define _Static_assert(e, s) static_assert(e, s) +#define _Thread_local thread_local +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +/* Do nothing. They are language keywords. */ +#else +/* Not supported. Implement them using our versions. */ +#define _Alignas(x) __aligned(x) +#define _Alignof(x) __alignof(x) +#define _Noreturn __dead2 +#define _Thread_local __thread +#ifdef __COUNTER__ +#define _Static_assert(x, y) __Static_assert(x, __COUNTER__) +#define __Static_assert(x, y) ___Static_assert(x, y) +#define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] +#else +#define _Static_assert(x, y) struct __hack +#endif +#endif + +/* + * Emulation of C11 _Generic(). Unlike the previously defined C11 + * keywords, it is not possible to implement this using exactly the same + * syntax. Therefore implement something similar under the name + * __generic(). Unlike _Generic(), this macro can only distinguish + * between a single type, so it requires nested invocations to + * distinguish multiple cases. + */ + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#define __generic(expr, t, yes, no) \ + _Generic(expr, t: yes, default: no) +#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) +#define __generic(expr, t, yes, no) \ + __builtin_choose_expr( \ + __builtin_types_compatible_p(__typeof(expr), t), yes, no) +#endif + #if __GNUC_PREREQ__(2, 96) #define __malloc_like __attribute__((__malloc__)) #define __pure __attribute__((__pure__)) @@ -319,10 +367,11 @@ #define __offsetof(type, field) __builtin_offsetof(type, field) #else #ifndef __cplusplus -#define __offsetof(type, field) ((size_t)(&((type *)0)->field)) +#define __offsetof(type, field) \ + ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field)) #else #define __offsetof(type, field) \ - (__offsetof__ (reinterpret_cast \ + (__offsetof__ (reinterpret_cast <__size_t> \ (&reinterpret_cast \ (static_cast (0)->field)))) #endif @@ -450,15 +499,15 @@ #endif #ifndef __DECONST -#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) +#define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var)) #endif #ifndef __DEVOLATILE -#define __DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var)) +#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var)) #endif #ifndef __DEQUALIFY -#define __DEQUALIFY(type, var) ((type)(uintptr_t)(const volatile void *)(var)) +#define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var)) #endif /*- @@ -574,4 +623,14 @@ #endif #endif +#ifndef __has_feature +#define __has_feature(x) 0 +#endif +#ifndef __has_include +#define __has_include(x) 0 +#endif +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif + #endif /* !_SYS_CDEFS_H_ */ From owner-svn-src-stable@FreeBSD.ORG Sun Mar 18 10:45:37 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 011101065674; Sun, 18 Mar 2012 10:45:37 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E44EE8FC14; Sun, 18 Mar 2012 10:45:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2IAjaL9015715; Sun, 18 Mar 2012 10:45:36 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2IAjapU015713; Sun, 18 Mar 2012 10:45:36 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201203181045.q2IAjapU015713@svn.freebsd.org> From: Hiroki Sato Date: Sun, 18 Mar 2012 10:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233112 - stable/8/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 10:45:37 -0000 Author: hrs Date: Sun Mar 18 10:45:36 2012 New Revision: 233112 URL: http://svn.freebsd.org/changeset/base/233112 Log: MFC r216650: Add IFT_L2VLAN to the list that is capable of supplying the ingredients of the EUI64 part of an IPv6 address. Otherwise vlans will all use the MAC address of the first ethernet interface of the system. Modified: stable/8/sys/netinet6/in6_ifattach.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet6/in6_ifattach.c ============================================================================== --- stable/8/sys/netinet6/in6_ifattach.c Sun Mar 18 09:52:54 2012 (r233111) +++ stable/8/sys/netinet6/in6_ifattach.c Sun Mar 18 10:45:36 2012 (r233112) @@ -267,6 +267,7 @@ found: /* get EUI64 */ switch (ifp->if_type) { case IFT_ETHER: + case IFT_L2VLAN: case IFT_FDDI: case IFT_ISO88025: case IFT_ATM: From owner-svn-src-stable@FreeBSD.ORG Sun Mar 18 13:02:57 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 610EA1065673; Sun, 18 Mar 2012 13:02:57 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E35D8FC18; Sun, 18 Mar 2012 13:02:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2ID2vDD020204; Sun, 18 Mar 2012 13:02:57 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2ID2vsD020197; Sun, 18 Mar 2012 13:02:57 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201203181302.q2ID2vsD020197@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 18 Mar 2012 13:02:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233116 - in stable/9/tools/regression/bin/sh: builtins expansion parameters X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 13:02:57 -0000 Author: jilles Date: Sun Mar 18 13:02:56 2012 New Revision: 233116 URL: http://svn.freebsd.org/changeset/base/233116 Log: MFC r226892,r228007,r228873,r230121,r232839: sh: Various testcases that already work. Added: stable/9/tools/regression/bin/sh/builtins/case11.0 - copied unchanged from r228007, head/tools/regression/bin/sh/builtins/case11.0 stable/9/tools/regression/bin/sh/builtins/case12.0 - copied unchanged from r228007, head/tools/regression/bin/sh/builtins/case12.0 stable/9/tools/regression/bin/sh/builtins/for1.0 - copied unchanged from r226892, head/tools/regression/bin/sh/builtins/for1.0 stable/9/tools/regression/bin/sh/expansion/arith12.0 - copied unchanged from r232839, head/tools/regression/bin/sh/expansion/arith12.0 stable/9/tools/regression/bin/sh/expansion/cmdsubst12.0 - copied unchanged from r230121, head/tools/regression/bin/sh/expansion/cmdsubst12.0 stable/9/tools/regression/bin/sh/expansion/cmdsubst13.0 - copied unchanged from r230121, head/tools/regression/bin/sh/expansion/cmdsubst13.0 stable/9/tools/regression/bin/sh/parameters/positional2.0 - copied unchanged from r228873, head/tools/regression/bin/sh/parameters/positional2.0 Modified: Directory Properties: stable/9/tools/regression/bin/sh/ (props changed) Copied: stable/9/tools/regression/bin/sh/builtins/case11.0 (from r228007, head/tools/regression/bin/sh/builtins/case11.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/case11.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r228007, head/tools/regression/bin/sh/builtins/case11.0) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +false +case x in +*) +esac Copied: stable/9/tools/regression/bin/sh/builtins/case12.0 (from r228007, head/tools/regression/bin/sh/builtins/case12.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/case12.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r228007, head/tools/regression/bin/sh/builtins/case12.0) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +false +case x in +y) +esac Copied: stable/9/tools/regression/bin/sh/builtins/for1.0 (from r226892, head/tools/regression/bin/sh/builtins/for1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/for1.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r226892, head/tools/regression/bin/sh/builtins/for1.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +false +for i in `false`; do exit 3; done Copied: stable/9/tools/regression/bin/sh/expansion/arith12.0 (from r232839, head/tools/regression/bin/sh/expansion/arith12.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/expansion/arith12.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r232839, head/tools/regression/bin/sh/expansion/arith12.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +_x=4 y_=5 z_z=6 +[ "$((_x*100+y_*10+z_z))" = 456 ] Copied: stable/9/tools/regression/bin/sh/expansion/cmdsubst12.0 (from r230121, head/tools/regression/bin/sh/expansion/cmdsubst12.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/expansion/cmdsubst12.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r230121, head/tools/regression/bin/sh/expansion/cmdsubst12.0) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +f() { + echo x$(printf foo >&2)y +} +[ "$(f 2>&1)" = "fooxy" ] Copied: stable/9/tools/regression/bin/sh/expansion/cmdsubst13.0 (from r230121, head/tools/regression/bin/sh/expansion/cmdsubst13.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/expansion/cmdsubst13.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r230121, head/tools/regression/bin/sh/expansion/cmdsubst13.0) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +x=1 y=2 +[ "$( + case $((x+=1)) in + ($((y+=1))) echo bad1 ;; + ($((y-1))) echo $x.$y ;; + ($((y=2))) echo bad2 ;; + (*) echo bad3 ;; + esac +)" = "2.3" ] || echo "Error at $LINENO" +[ "$x.$y" = "1.2" ] || echo "Error at $LINENO" Copied: stable/9/tools/regression/bin/sh/parameters/positional2.0 (from r228873, head/tools/regression/bin/sh/parameters/positional2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/parameters/positional2.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r228873, head/tools/regression/bin/sh/parameters/positional2.0) @@ -0,0 +1,65 @@ +# $FreeBSD$ + +failures='' +ok='' + +testcase() { + code="$1" + expected="$2" + oIFS="$IFS" + eval "$code" + IFS='|' + result="$#|$*" + IFS="$oIFS" + if [ "x$result" = "x$expected" ]; then + ok=x$ok + else + failures=x$failures + echo "For $code, expected $expected actual $result" + fi +} + +testcase 'set -- a b; set -- p$@q' '2|pa|bq' +testcase 'set -- a b; set -- $@q' '2|a|bq' +testcase 'set -- a b; set -- p$@' '2|pa|b' +testcase 'set -- a b; set -- p$@q' '2|pa|bq' +testcase 'set -- a b; set -- $@q' '2|a|bq' +testcase 'set -- a b; set -- p$@' '2|pa|b' +testcase 'set -- a b; set -- p$*q' '2|pa|bq' +testcase 'set -- a b; set -- $*q' '2|a|bq' +testcase 'set -- a b; set -- p$*' '2|pa|b' +testcase 'set -- a b; set -- p$*q' '2|pa|bq' +testcase 'set -- a b; set -- $*q' '2|a|bq' +testcase 'set -- a b; set -- p$*' '2|pa|b' +testcase 'set -- a b; set -- "p$@q"' '2|pa|bq' +testcase 'set -- a b; set -- "$@q"' '2|a|bq' +testcase 'set -- a b; set -- "p$@"' '2|pa|b' +testcase 'set -- a b; set -- p"$@"q' '2|pa|bq' +testcase 'set -- a b; set -- "$@"q' '2|a|bq' +testcase 'set -- a b; set -- p"$@"' '2|pa|b' +testcase 'set -- "" a b; set -- "p$@q"' '3|p|a|bq' +testcase 'set -- "" a b; set -- "$@q"' '3||a|bq' +testcase 'set -- "" a b; set -- "p$@"' '3|p|a|b' +testcase 'set -- "" a b; set -- p"$@"q' '3|p|a|bq' +testcase 'set -- "" a b; set -- "$@"q' '3||a|bq' +testcase 'set -- "" a b; set -- p"$@"' '3|p|a|b' +testcase 'set -- a; set -- p$@q' '1|paq' +testcase 'set -- a; set -- $@q' '1|aq' +testcase 'set -- a; set -- p$@' '1|pa' +testcase 'set -- a; set -- p$@q' '1|paq' +testcase 'set -- a; set -- $@q' '1|aq' +testcase 'set -- a; set -- p$@' '1|pa' +testcase 'set -- a; set -- p$*q' '1|paq' +testcase 'set -- a; set -- $*q' '1|aq' +testcase 'set -- a; set -- p$*' '1|pa' +testcase 'set -- a; set -- p$*q' '1|paq' +testcase 'set -- a; set -- $*q' '1|aq' +testcase 'set -- a; set -- p$*' '1|pa' +testcase 'set -- a; set -- "p$@q"' '1|paq' +testcase 'set -- a; set -- "$@q"' '1|aq' +testcase 'set -- a; set -- "p$@"' '1|pa' +testcase 'set -- a; set -- p"$@"q' '1|paq' +testcase 'set -- a; set -- "$@"q' '1|aq' +testcase 'set -- a; set -- p"$@"' '1|pa' + +test "x$failures" = x From owner-svn-src-stable@FreeBSD.ORG Sun Mar 18 14:49:37 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 57C1E106566C; Sun, 18 Mar 2012 14:49:37 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 371768FC16; Sun, 18 Mar 2012 14:49:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2IEnbDb023682; Sun, 18 Mar 2012 14:49:37 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2IEnanM023678; Sun, 18 Mar 2012 14:49:36 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201203181449.q2IEnanM023678@svn.freebsd.org> From: Kevin Lo Date: Sun, 18 Mar 2012 14:49:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233119 - in stable/9/usr.bin: bc dc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 14:49:37 -0000 Author: kevlo Date: Sun Mar 18 14:49:36 2012 New Revision: 233119 URL: http://svn.freebsd.org/changeset/base/233119 Log: MFC r232994: - Fix an erroneous invocation of the editline. - Fix wrong scaling in the bc.library. - Let length(0.000) conform to what gnu bc does. PR: bin/159227 Submitted by: AIDA Shinra Modified: stable/9/usr.bin/bc/bc.library stable/9/usr.bin/bc/bc.y stable/9/usr.bin/dc/bcode.c Directory Properties: stable/9/usr.bin/ (props changed) Modified: stable/9/usr.bin/bc/bc.library ============================================================================== --- stable/9/usr.bin/bc/bc.library Sun Mar 18 13:54:57 2012 (r233118) +++ stable/9/usr.bin/bc/bc.library Sun Mar 18 14:49:36 2012 (r233119) @@ -46,7 +46,9 @@ define e(x) { r = ibase ibase = A t = scale - scale = t + .434*x + 1 + scale = 0 + if (x > 0) scale = (0.435*x)/1 + scale = scale + t + 1 w = 0 if (x < 0) { @@ -95,26 +97,33 @@ define l(x) { t = scale f = 1 - scale = scale + scale(x) - length(x) + 1 - s = scale + if (x < 1) { + s = scale(x) + } else { + s = length(x) - scale(x) + } + scale = 0 + a = (2.31*s)/1 /* estimated integer part of the answer */ + s = t + length(a) + 2 /* estimated length of the answer */ while (x > 2) { - s = s + (length(x) - scale(x))/2 + 1 - if (s > 0) scale = s + scale=0 + scale = (length(x) + scale(x))/2 + 1 + if (scale < s) scale = s x = sqrt(x) f = f*2 } while (x < .5) { - s = s + (length(x) - scale(x))/2 + 1 - if (s > 0) scale = s + scale = 0 + scale = scale(x)/2 + 1 + if (scale < s) scale = s x = sqrt(x) f = f*2 } - scale = t + length(f) - scale(f) + 1 + scale = t + length(f) + length(t + length(f)) + 1 u = (x - 1)/(x + 1) - - scale = scale + 1.1*length(t) - 1.1*scale(t) s = u*u + scale = t + 2 b = 2*f c = b d = 1 @@ -261,3 +270,4 @@ define j(n,x) { e = g } } +/* vim: set filetype=bc shiftwidth=8 noexpandtab: */ Modified: stable/9/usr.bin/bc/bc.y ============================================================================== --- stable/9/usr.bin/bc/bc.y Sun Mar 18 13:54:57 2012 (r233118) +++ stable/9/usr.bin/bc/bc.y Sun Mar 18 14:49:36 2012 (r233119) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "extern.h" #include "pathnames.h" @@ -1093,7 +1094,7 @@ sigchld(int signo) switch (signo) { default: for (;;) { - pid = waitpid(dc, &status, WCONTINUED); + pid = waitpid(dc, &status, WUNTRACED); if (pid == -1) { if (errno == EINTR) continue; @@ -1181,16 +1182,6 @@ main(int argc, char *argv[]) dup(p[1]); close(p[0]); close(p[1]); - if (interactive) { - el = el_init("bc", stdin, stderr, stderr); - hist = history_init(); - history(hist, &he, H_SETSIZE, 100); - el_set(el, EL_HIST, history, hist); - el_set(el, EL_EDITOR, "emacs"); - el_set(el, EL_SIGNAL, 1); - el_set(el, EL_PROMPT, dummy_prompt); - el_source(el, NULL); - } } else { close(STDIN_FILENO); dup(p[0]); @@ -1200,6 +1191,16 @@ main(int argc, char *argv[]) err(1, "cannot find dc"); } } + if (interactive) { + el = el_init("bc", stdin, stderr, stderr); + hist = history_init(); + history(hist, &he, H_SETSIZE, 100); + el_set(el, EL_HIST, history, hist); + el_set(el, EL_EDITOR, "emacs"); + el_set(el, EL_SIGNAL, 1); + el_set(el, EL_PROMPT, dummy_prompt); + el_source(el, NULL); + } yywrap(); return (yyparse()); } Modified: stable/9/usr.bin/dc/bcode.c ============================================================================== --- stable/9/usr.bin/dc/bcode.c Sun Mar 18 13:54:57 2012 (r233118) +++ stable/9/usr.bin/dc/bcode.c Sun Mar 18 14:49:36 2012 (r233119) @@ -693,7 +693,7 @@ count_digits(const struct number *n) u_int i; if (BN_is_zero(n->number)) - return (1); + return (n->scale ? n->scale : 1); int_part = new_number(); fract_part = new_number(); From owner-svn-src-stable@FreeBSD.ORG Sun Mar 18 15:03:02 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BE6EF106566C; Sun, 18 Mar 2012 15:03:02 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A36E08FC14; Sun, 18 Mar 2012 15:03:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2IF328p024190; Sun, 18 Mar 2012 15:03:02 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2IF32k2024186; Sun, 18 Mar 2012 15:03:02 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201203181503.q2IF32k2024186@svn.freebsd.org> From: Kevin Lo Date: Sun, 18 Mar 2012 15:03:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233120 - in stable/9/sys/fs: hpfs msdosfs ntfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 15:03:02 -0000 Author: kevlo Date: Sun Mar 18 15:03:02 2012 New Revision: 233120 URL: http://svn.freebsd.org/changeset/base/233120 Log: MFC r232483: Clean up style(9) nits Modified: stable/9/sys/fs/hpfs/hpfs_vfsops.c stable/9/sys/fs/msdosfs/msdosfs_vfsops.c stable/9/sys/fs/ntfs/ntfs_vfsops.c Directory Properties: stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) Modified: stable/9/sys/fs/hpfs/hpfs_vfsops.c ============================================================================== --- stable/9/sys/fs/hpfs/hpfs_vfsops.c Sun Mar 18 14:49:36 2012 (r233119) +++ stable/9/sys/fs/hpfs/hpfs_vfsops.c Sun Mar 18 15:03:02 2012 (r233120) @@ -283,11 +283,11 @@ hpfs_mountfs(devvp, mp, td) hpmp->hpm_devvp = devvp; hpmp->hpm_dev = devvp->v_rdev; hpmp->hpm_mp = mp; - if (1 == vfs_scanopt(mp->mnt_optnew, "uid", "%d", &v)) + if (vfs_scanopt(mp->mnt_optnew, "uid", "%d", &v) == 1) hpmp->hpm_uid = v; - if (1 == vfs_scanopt(mp->mnt_optnew, "gid", "%d", &v)) + if (vfs_scanopt(mp->mnt_optnew, "gid", "%d", &v) == 1) hpmp->hpm_gid = v; - if (1 == vfs_scanopt(mp->mnt_optnew, "mode", "%d", &v)) + if (vfs_scanopt(mp->mnt_optnew, "mode", "%d", &v) == 1) hpmp->hpm_mode = v; error = hpfs_bminit(hpmp); Modified: stable/9/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_vfsops.c Sun Mar 18 14:49:36 2012 (r233119) +++ stable/9/sys/fs/msdosfs/msdosfs_vfsops.c Sun Mar 18 15:03:02 2012 (r233120) @@ -149,13 +149,13 @@ update_mp(struct mount *mp, struct threa } } - if (1 == vfs_scanopt(mp->mnt_optnew, "gid", "%d", &v)) + if (vfs_scanopt(mp->mnt_optnew, "gid", "%d", &v) == 1) pmp->pm_gid = v; - if (1 == vfs_scanopt(mp->mnt_optnew, "uid", "%d", &v)) + if (vfs_scanopt(mp->mnt_optnew, "uid", "%d", &v) == 1) pmp->pm_uid = v; - if (1 == vfs_scanopt(mp->mnt_optnew, "mask", "%d", &v)) + if (vfs_scanopt(mp->mnt_optnew, "mask", "%d", &v) == 1) pmp->pm_mask = v & ALLPERMS; - if (1 == vfs_scanopt(mp->mnt_optnew, "dirmask", "%d", &v)) + if (vfs_scanopt(mp->mnt_optnew, "dirmask", "%d", &v) == 1) pmp->pm_dirmask = v & ALLPERMS; vfs_flagopt(mp->mnt_optnew, "shortname", &pmp->pm_flags, MSDOSFSMNT_SHORTNAME); Modified: stable/9/sys/fs/ntfs/ntfs_vfsops.c ============================================================================== --- stable/9/sys/fs/ntfs/ntfs_vfsops.c Sun Mar 18 14:49:36 2012 (r233119) +++ stable/9/sys/fs/ntfs/ntfs_vfsops.c Sun Mar 18 15:03:02 2012 (r233120) @@ -345,11 +345,11 @@ ntfs_mountfs(devvp, mp, td) ntmp->ntm_mountp = mp; ntmp->ntm_devvp = devvp; - if (1 == vfs_scanopt(mp->mnt_optnew, "uid", "%d", &v)) + if (vfs_scanopt(mp->mnt_optnew, "uid", "%d", &v) == 1) ntmp->ntm_uid = v; - if (1 == vfs_scanopt(mp->mnt_optnew, "gid", "%d", &v)) + if (vfs_scanopt(mp->mnt_optnew, "gid", "%d", &v) == 1) ntmp->ntm_gid = v; - if (1 == vfs_scanopt(mp->mnt_optnew, "mode", "%d", &v)) + if (vfs_scanopt(mp->mnt_optnew, "mode", "%d", &v) == 1) ntmp->ntm_mode = v & ACCESSPERMS; vfs_flagopt(mp->mnt_optnew, "caseins", &ntmp->ntm_flag, NTFS_MFLAG_CASEINS); From owner-svn-src-stable@FreeBSD.ORG Sun Mar 18 19:24:12 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ACE08106564A; Sun, 18 Mar 2012 19:24:12 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi [195.197.172.115]) by mx1.freebsd.org (Postfix) with ESMTP id 576F38FC17; Sun, 18 Mar 2012 19:24:12 +0000 (UTC) Received: from a91-153-116-96.elisa-laajakaista.fi (a91-153-116-96.elisa-laajakaista.fi [91.153.116.96]) by gw01.mail.saunalahti.fi (Postfix) with SMTP id 1017A151C3F; Sun, 18 Mar 2012 21:23:59 +0200 (EET) Date: Sun, 18 Mar 2012 21:23:58 +0200 From: Jaakko Heinonen To: Kevin Lo Message-ID: <20120318192358.GA2279@a91-153-116-96.elisa-laajakaista.fi> References: <201203181503.q2IF32k2024186@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201203181503.q2IF32k2024186@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r233120 - in stable/9/sys/fs: hpfs msdosfs ntfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 19:24:12 -0000 On 2012-03-18, Kevin Lo wrote: > MFC r232483: > > Clean up style(9) nits > Directory Properties: > stable/9/sys/fs/ (props changed) > stable/9/sys/fs/ntfs/ (props changed) This should have been merged to stable/9/sys/. Also, r232995 incorrectly recorded mergeinfo to stable/9/sys/fs/ntfs/. -- Jaakko From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:04:26 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E714E1065670; Mon, 19 Mar 2012 01:04:26 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1CFF8FC08; Mon, 19 Mar 2012 01:04:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J14Qx9043569; Mon, 19 Mar 2012 01:04:26 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J14Qq7043567; Mon, 19 Mar 2012 01:04:26 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190104.q2J14Qq7043567@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:04:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233139 - stable/9/bin/df X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:04:27 -0000 Author: eadler Date: Mon Mar 19 01:04:26 2012 New Revision: 233139 URL: http://svn.freebsd.org/changeset/base/233139 Log: MFC r232466, r232469: Direct users to swapinfo and pstat from df PR: bin/165321 Approved by: cperciva Modified: stable/9/bin/df/df.1 Directory Properties: stable/9/bin/df/ (props changed) Modified: stable/9/bin/df/df.1 ============================================================================== --- stable/9/bin/df/df.1 Mon Mar 19 00:47:01 2012 (r233138) +++ stable/9/bin/df/df.1 Mon Mar 19 01:04:26 2012 (r233139) @@ -29,7 +29,7 @@ .\" @(#)df.1 8.3 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd October 18, 2011 +.Dd March 3, 2012 .Dt DF 1 .Os .Sh NAME @@ -158,7 +158,9 @@ is set, the block counts will be display .El .Sh SEE ALSO .Xr lsvfs 1 , +.Xr pstat 1 , .Xr quota 1 , +.Xr swapinfo 1 , .Xr fstatfs 2 , .Xr getfsstat 2 , .Xr statfs 2 , From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:04:47 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 769321065675; Mon, 19 Mar 2012 01:04:47 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6215C8FC0A; Mon, 19 Mar 2012 01:04:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J14lDJ043611; Mon, 19 Mar 2012 01:04:47 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J14l8h043609; Mon, 19 Mar 2012 01:04:47 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190104.q2J14l8h043609@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233140 - stable/8/bin/df X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:04:47 -0000 Author: eadler Date: Mon Mar 19 01:04:46 2012 New Revision: 233140 URL: http://svn.freebsd.org/changeset/base/233140 Log: MFC r232466, r232469: Direct users to swapinfo and pstat from df PR: bin/165321 Approved by: cperciva Modified: stable/8/bin/df/df.1 Directory Properties: stable/8/bin/df/ (props changed) Modified: stable/8/bin/df/df.1 ============================================================================== --- stable/8/bin/df/df.1 Mon Mar 19 01:04:26 2012 (r233139) +++ stable/8/bin/df/df.1 Mon Mar 19 01:04:46 2012 (r233140) @@ -29,7 +29,7 @@ .\" @(#)df.1 8.3 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd October 18, 2011 +.Dd March 3, 2012 .Dt DF 1 .Os .Sh NAME @@ -158,7 +158,9 @@ is set, the block counts will be display .El .Sh SEE ALSO .Xr lsvfs 1 , +.Xr pstat 1 , .Xr quota 1 , +.Xr swapinfo 1 , .Xr fstatfs 2 , .Xr getfsstat 2 , .Xr statfs 2 , From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:15:37 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BD47106564A; Mon, 19 Mar 2012 01:15:37 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2646A8FC08; Mon, 19 Mar 2012 01:15:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1Fbnf043980; Mon, 19 Mar 2012 01:15:37 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1FaEZ043978; Mon, 19 Mar 2012 01:15:36 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190115.q2J1FaEZ043978@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:15:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233141 - stable/9/share/man/man4 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:15:37 -0000 Author: eadler Date: Mon Mar 19 01:15:36 2012 New Revision: 233141 URL: http://svn.freebsd.org/changeset/base/233141 Log: MFC r232501: ehci tunables are only available when kernel is compiled with USB_DEBUG PR: docs/163646 Approved by: cperciva Modified: stable/9/share/man/man4/ehci.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/ehci.4 ============================================================================== --- stable/9/share/man/man4/ehci.4 Mon Mar 19 01:04:46 2012 (r233140) +++ stable/9/share/man/man4/ehci.4 Mon Mar 19 01:15:36 2012 (r233141) @@ -80,7 +80,11 @@ The device driver first appeared in .Fx 5.1 . .Sh LOADER TUNABLES -Tunables can be set at the +When the kernel has been compiled with +.Cd options USB_DEBUG , +some tunables become available that affect the behavior of +.Nm . +These tunables can be set at the .Xr loader 8 prompt before booting the kernel or stored in .Xr loader.conf 5 . From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:16:12 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5559E106564A; Mon, 19 Mar 2012 01:16:12 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 409098FC0A; Mon, 19 Mar 2012 01:16:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1GCKI044032; Mon, 19 Mar 2012 01:16:12 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1GC2w044030; Mon, 19 Mar 2012 01:16:12 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190116.q2J1GC2w044030@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233142 - stable/8/share/man/man4 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:16:12 -0000 Author: eadler Date: Mon Mar 19 01:16:11 2012 New Revision: 233142 URL: http://svn.freebsd.org/changeset/base/233142 Log: MFC r232501: ehci tunables are only available when kernel is compiled with USB_DEBUG PR: docs/163646 Approved by: cperciva Modified: stable/8/share/man/man4/ehci.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ehci.4 ============================================================================== --- stable/8/share/man/man4/ehci.4 Mon Mar 19 01:15:36 2012 (r233141) +++ stable/8/share/man/man4/ehci.4 Mon Mar 19 01:16:11 2012 (r233142) @@ -87,7 +87,11 @@ The device driver first appeared in .Fx 5.1 . .Sh LOADER TUNABLES -Tunables can be set at the +When the kernel has been compiled with +.Cd options USB_DEBUG , +some tunables become available that affect the behavior of +.Nm . +These tunables can be set at the .Xr loader 8 prompt before booting the kernel or stored in .Xr loader.conf 5 . From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:18:23 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 25493106566B; Mon, 19 Mar 2012 01:18:23 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10CDC8FC0A; Mon, 19 Mar 2012 01:18:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1IMav044134; Mon, 19 Mar 2012 01:18:22 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1IMPP044133; Mon, 19 Mar 2012 01:18:22 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190118.q2J1IMPP044133@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233143 - stable/9/sys/modules/dtrace/dtrace X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:18:23 -0000 Author: eadler Date: Mon Mar 19 01:18:22 2012 New Revision: 233143 URL: http://svn.freebsd.org/changeset/base/233143 Log: MFC r232506: Explicitly list dependency PR: misc/160463 Approved by: cperciva Modified: stable/9/sys/modules/dtrace/dtrace/Makefile Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/modules/dtrace/dtrace/Makefile ============================================================================== --- stable/9/sys/modules/dtrace/dtrace/Makefile Mon Mar 19 01:16:11 2012 (r233142) +++ stable/9/sys/modules/dtrace/dtrace/Makefile Mon Mar 19 01:18:22 2012 (r233143) @@ -42,4 +42,6 @@ EXPORT_SYMS= dtrace_register \ dtrace_unregister \ dtrace_probe_lookup +dtrace_asm.o: assym.s + .include From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:18:47 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6655C1065670; Mon, 19 Mar 2012 01:18:47 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 513E88FC14; Mon, 19 Mar 2012 01:18:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1IlZp044181; Mon, 19 Mar 2012 01:18:47 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1IltA044179; Mon, 19 Mar 2012 01:18:47 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190118.q2J1IltA044179@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:18:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233144 - stable/8/sys/modules/dtrace/dtrace X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:18:47 -0000 Author: eadler Date: Mon Mar 19 01:18:46 2012 New Revision: 233144 URL: http://svn.freebsd.org/changeset/base/233144 Log: MFC r232506: Explicitly list dependency PR: misc/160463 Approved by: cperciva Modified: stable/8/sys/modules/dtrace/dtrace/Makefile Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/modules/dtrace/dtrace/Makefile ============================================================================== --- stable/8/sys/modules/dtrace/dtrace/Makefile Mon Mar 19 01:18:22 2012 (r233143) +++ stable/8/sys/modules/dtrace/dtrace/Makefile Mon Mar 19 01:18:46 2012 (r233144) @@ -42,4 +42,6 @@ EXPORT_SYMS= dtrace_register \ dtrace_unregister \ dtrace_probe_lookup +dtrace_asm.o: assym.s + .include From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:19:04 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DED5110656D0; Mon, 19 Mar 2012 01:19:04 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C94AB8FC22; Mon, 19 Mar 2012 01:19:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1J4cr044221; Mon, 19 Mar 2012 01:19:04 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1J4U5044219; Mon, 19 Mar 2012 01:19:04 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190119.q2J1J4U5044219@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:19:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233145 - stable/7/sys/modules/dtrace/dtrace X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:19:05 -0000 Author: eadler Date: Mon Mar 19 01:19:04 2012 New Revision: 233145 URL: http://svn.freebsd.org/changeset/base/233145 Log: MFC r232506: Explicitly list dependency PR: misc/160463 Approved by: cperciva Modified: stable/7/sys/modules/dtrace/dtrace/Makefile Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/modules/dtrace/dtrace/Makefile ============================================================================== --- stable/7/sys/modules/dtrace/dtrace/Makefile Mon Mar 19 01:18:46 2012 (r233144) +++ stable/7/sys/modules/dtrace/dtrace/Makefile Mon Mar 19 01:19:04 2012 (r233145) @@ -41,4 +41,6 @@ EXPORT_SYMS= dtrace_register \ dtrace_unregister \ dtrace_probe_lookup +dtrace_asm.o: assym.s + .include From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:27:31 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 871B6106566C; Mon, 19 Mar 2012 01:27:31 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 717278FC0C; Mon, 19 Mar 2012 01:27:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1RVa2044512; Mon, 19 Mar 2012 01:27:31 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1RVQa044509; Mon, 19 Mar 2012 01:27:31 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190127.q2J1RVQa044509@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:27:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233146 - stable/9/lib/libc/string X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:27:31 -0000 Author: eadler Date: Mon Mar 19 01:27:30 2012 New Revision: 233146 URL: http://svn.freebsd.org/changeset/base/233146 Log: MFC r232503: POSIX mandates that swab do nothing when len < 0 PR: 140690 Approved by: cperciva Modified: stable/9/lib/libc/string/swab.3 stable/9/lib/libc/string/swab.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/string/swab.3 ============================================================================== --- stable/9/lib/libc/string/swab.3 Mon Mar 19 01:19:04 2012 (r233145) +++ stable/9/lib/libc/string/swab.3 Mon Mar 19 01:27:30 2012 (r233146) @@ -28,7 +28,7 @@ .\" @(#)swab.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 10, 2004 +.Dd March 4, 2012 .Dt SWAB 3 .Os .Sh NAME @@ -54,6 +54,9 @@ swapping adjacent bytes. The argument .Fa len must be an even number. +If +.Fa len +is less than zero, nothing will be done. .Sh SEE ALSO .Xr bzero 3 , .Xr memset 3 Modified: stable/9/lib/libc/string/swab.c ============================================================================== --- stable/9/lib/libc/string/swab.c Mon Mar 19 01:19:04 2012 (r233145) +++ stable/9/lib/libc/string/swab.c Mon Mar 19 01:27:30 2012 (r233146) @@ -45,6 +45,8 @@ swab(const void * __restrict from, void int n; char *fp, *tp; + if (len <= 0) + return; n = len >> 1; fp = (char *)from; tp = (char *)to; From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:27:55 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3760106564A; Mon, 19 Mar 2012 01:27:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9472A8FC08; Mon, 19 Mar 2012 01:27:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1RtwY044561; Mon, 19 Mar 2012 01:27:55 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1RtgB044557; Mon, 19 Mar 2012 01:27:55 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190127.q2J1RtgB044557@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:27:56 -0000 Author: eadler Date: Mon Mar 19 01:27:55 2012 New Revision: 233147 URL: http://svn.freebsd.org/changeset/base/233147 Log: MFC r232503: POSIX mandates that swab do nothing when len < 0 PR: 140690 Approved by: cperciva Modified: stable/8/lib/libc/string/swab.3 stable/8/lib/libc/string/swab.c Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/string/swab.3 ============================================================================== --- stable/8/lib/libc/string/swab.3 Mon Mar 19 01:27:30 2012 (r233146) +++ stable/8/lib/libc/string/swab.3 Mon Mar 19 01:27:55 2012 (r233147) @@ -28,7 +28,7 @@ .\" @(#)swab.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 10, 2004 +.Dd March 4, 2012 .Dt SWAB 3 .Os .Sh NAME @@ -54,6 +54,9 @@ swapping adjacent bytes. The argument .Fa len must be an even number. +If +.Fa len +is less than zero, nothing will be done. .Sh SEE ALSO .Xr bzero 3 , .Xr memset 3 Modified: stable/8/lib/libc/string/swab.c ============================================================================== --- stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:30 2012 (r233146) +++ stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:55 2012 (r233147) @@ -45,6 +45,8 @@ swab(const void * __restrict from, void int n; char *fp, *tp; + if (len <= 0) + return; n = len >> 1; fp = (char *)from; tp = (char *)to; From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:28:11 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4F55106564A; Mon, 19 Mar 2012 01:28:11 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFC988FC12; Mon, 19 Mar 2012 01:28:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1SBPR044608; Mon, 19 Mar 2012 01:28:11 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1SBuC044605; Mon, 19 Mar 2012 01:28:11 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190128.q2J1SBuC044605@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233148 - stable/7/lib/libc/string X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:28:12 -0000 Author: eadler Date: Mon Mar 19 01:28:11 2012 New Revision: 233148 URL: http://svn.freebsd.org/changeset/base/233148 Log: MFC r232503: POSIX mandates that swab do nothing when len < 0 PR: 140690 Approved by: cperciva Modified: stable/7/lib/libc/string/swab.3 stable/7/lib/libc/string/swab.c Directory Properties: stable/7/lib/libc/ (props changed) Modified: stable/7/lib/libc/string/swab.3 ============================================================================== --- stable/7/lib/libc/string/swab.3 Mon Mar 19 01:27:55 2012 (r233147) +++ stable/7/lib/libc/string/swab.3 Mon Mar 19 01:28:11 2012 (r233148) @@ -28,7 +28,7 @@ .\" @(#)swab.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 10, 2004 +.Dd March 4, 2012 .Dt SWAB 3 .Os .Sh NAME @@ -54,6 +54,9 @@ swapping adjacent bytes. The argument .Fa len must be an even number. +If +.Fa len +is less than zero, nothing will be done. .Sh SEE ALSO .Xr bzero 3 , .Xr memset 3 Modified: stable/7/lib/libc/string/swab.c ============================================================================== --- stable/7/lib/libc/string/swab.c Mon Mar 19 01:27:55 2012 (r233147) +++ stable/7/lib/libc/string/swab.c Mon Mar 19 01:28:11 2012 (r233148) @@ -45,6 +45,8 @@ swab(const void * __restrict from, void int n; char *fp, *tp; + if (len <= 0) + return; n = len >> 1; fp = (char *)from; tp = (char *)to; From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:32:28 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA903106564A; Mon, 19 Mar 2012 01:32:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D54CB8FC15; Mon, 19 Mar 2012 01:32:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1WSne044782; Mon, 19 Mar 2012 01:32:28 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1WSKY044780; Mon, 19 Mar 2012 01:32:28 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190132.q2J1WSKY044780@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:32:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233149 - stable/9/lib/libc/stdio X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:32:29 -0000 Author: eadler Date: Mon Mar 19 01:32:28 2012 New Revision: 233149 URL: http://svn.freebsd.org/changeset/base/233149 Log: MFC r232504: Remove reference to gcc's non-standard -fwritable-strings, which doesn't exist in recent releases (and is bad advice anyway) PR: docs/163119 Approved by: cperciva Modified: stable/9/lib/libc/stdio/mktemp.3 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/stdio/mktemp.3 ============================================================================== --- stable/9/lib/libc/stdio/mktemp.3 Mon Mar 19 01:28:11 2012 (r233148) +++ stable/9/lib/libc/stdio/mktemp.3 Mon Mar 19 01:32:28 2012 (r233149) @@ -28,7 +28,7 @@ .\" @(#)mktemp.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd February 11, 1998 +.Dd March 4, 2012 .Dt MKTEMP 3 .Os .Sh NAME @@ -180,12 +180,6 @@ with an argument of will result in a core dump due to .Fn mkstemp attempting to modify the string constant that was given. -If the program in question makes heavy use of that type -of function call, you do have the option of compiling the program -so that it will store string constants in a writable segment of memory. -See -.Xr gcc 1 -for more information. .Sh SEE ALSO .Xr chmod 2 , .Xr getpid 2 , From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:32:54 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 01E83106566C; Mon, 19 Mar 2012 01:32:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E03FE8FC0C; Mon, 19 Mar 2012 01:32:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1Wr7Q044826; Mon, 19 Mar 2012 01:32:53 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1Wrj0044824; Mon, 19 Mar 2012 01:32:53 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190132.q2J1Wrj0044824@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:32:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233150 - stable/8/lib/libc/stdio X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:32:54 -0000 Author: eadler Date: Mon Mar 19 01:32:53 2012 New Revision: 233150 URL: http://svn.freebsd.org/changeset/base/233150 Log: MFC r232504: Remove reference to gcc's non-standard -fwritable-strings, which doesn't exist in recent releases (and is bad advice anyway) PR: docs/163119 Approved by: cperciva Modified: stable/8/lib/libc/stdio/mktemp.3 Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/stdio/mktemp.3 ============================================================================== --- stable/8/lib/libc/stdio/mktemp.3 Mon Mar 19 01:32:28 2012 (r233149) +++ stable/8/lib/libc/stdio/mktemp.3 Mon Mar 19 01:32:53 2012 (r233150) @@ -28,7 +28,7 @@ .\" @(#)mktemp.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd February 11, 1998 +.Dd March 4, 2012 .Dt MKTEMP 3 .Os .Sh NAME @@ -180,12 +180,6 @@ with an argument of will result in a core dump due to .Fn mkstemp attempting to modify the string constant that was given. -If the program in question makes heavy use of that type -of function call, you do have the option of compiling the program -so that it will store string constants in a writable segment of memory. -See -.Xr gcc 1 -for more information. .Sh SEE ALSO .Xr chmod 2 , .Xr getpid 2 , From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:33:24 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B8953106566B; Mon, 19 Mar 2012 01:33:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B56F8FC15; Mon, 19 Mar 2012 01:33:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1XO0C044882; Mon, 19 Mar 2012 01:33:24 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1XOrQ044880; Mon, 19 Mar 2012 01:33:24 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190133.q2J1XOrQ044880@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:33:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233151 - stable/7/lib/libc/stdio X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:33:24 -0000 Author: eadler Date: Mon Mar 19 01:33:24 2012 New Revision: 233151 URL: http://svn.freebsd.org/changeset/base/233151 Log: MFC r232504: Remove reference to gcc's non-standard -fwritable-strings, which doesn't exist in recent releases (and is bad advice anyway) PR: docs/163119 Approved by: cperciva Modified: stable/7/lib/libc/stdio/mktemp.3 Directory Properties: stable/7/lib/libc/ (props changed) Modified: stable/7/lib/libc/stdio/mktemp.3 ============================================================================== --- stable/7/lib/libc/stdio/mktemp.3 Mon Mar 19 01:32:53 2012 (r233150) +++ stable/7/lib/libc/stdio/mktemp.3 Mon Mar 19 01:33:24 2012 (r233151) @@ -28,7 +28,7 @@ .\" @(#)mktemp.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd February 11, 1998 +.Dd March 4, 2012 .Dt MKTEMP 3 .Os .Sh NAME @@ -180,12 +180,6 @@ with an argument of will result in a core dump due to .Fn mkstemp attempting to modify the string constant that was given. -If the program in question makes heavy use of that type -of function call, you do have the option of compiling the program -so that it will store string constants in a writable segment of memory. -See -.Xr gcc 1 -for more information. .Sh SEE ALSO .Xr chmod 2 , .Xr getpid 2 , From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:51:09 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 14479106566B; Mon, 19 Mar 2012 01:51:08 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8ED88FC12; Mon, 19 Mar 2012 01:51:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1p80f045433; Mon, 19 Mar 2012 01:51:08 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1p8PF045431; Mon, 19 Mar 2012 01:51:08 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190151.q2J1p8PF045431@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:51:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233152 - stable/9/lib/libutil X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:51:09 -0000 Author: eadler Date: Mon Mar 19 01:51:08 2012 New Revision: 233152 URL: http://svn.freebsd.org/changeset/base/233152 Log: MFC r231306: Fix NULL ptr dereference in setusercontext if pwd is null, LOGIN_SETPRIORITY is set, and setting the priority (rtprio or setpriority) fails. PR: kern/164238 Approved by: cperciva Modified: stable/9/lib/libutil/login_class.c Directory Properties: stable/9/lib/libutil/ (props changed) Modified: stable/9/lib/libutil/login_class.c ============================================================================== --- stable/9/lib/libutil/login_class.c Mon Mar 19 01:33:24 2012 (r233151) +++ stable/9/lib/libutil/login_class.c Mon Mar 19 01:51:08 2012 (r233152) @@ -452,18 +452,21 @@ setusercontext(login_cap_t *lc, const st p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", - pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS); + pwd ? pwd->pw_name : "-", + lc ? lc->lc_class : LOGIN_DEFCLASS); } else if (p < PRIO_MIN) { rtp.type = RTP_PRIO_REALTIME; rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX); p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", - pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS); + pwd ? pwd->pw_name : "-", + lc ? lc->lc_class : LOGIN_DEFCLASS); } else { if (setpriority(PRIO_PROCESS, 0, (int)p) != 0) syslog(LOG_WARNING, "setpriority '%s' (%s): %m", - pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS); + pwd ? pwd->pw_name : "-", + lc ? lc->lc_class : LOGIN_DEFCLASS); } } From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:51:53 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F7FF1065673; Mon, 19 Mar 2012 01:51:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AAAD8FC1B; Mon, 19 Mar 2012 01:51:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1prYh045483; Mon, 19 Mar 2012 01:51:53 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1pr3s045481; Mon, 19 Mar 2012 01:51:53 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190151.q2J1pr3s045481@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:51:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233153 - stable/8/lib/libutil X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:51:53 -0000 Author: eadler Date: Mon Mar 19 01:51:53 2012 New Revision: 233153 URL: http://svn.freebsd.org/changeset/base/233153 Log: MFC r231306: Fix NULL ptr dereference in setusercontext if pwd is null, LOGIN_SETPRIORITY is set, and setting the priority (rtprio or setpriority) fails. PR: kern/164238 Approved by: cperciva Modified: stable/8/lib/libutil/login_class.c Directory Properties: stable/8/lib/libutil/ (props changed) Modified: stable/8/lib/libutil/login_class.c ============================================================================== --- stable/8/lib/libutil/login_class.c Mon Mar 19 01:51:08 2012 (r233152) +++ stable/8/lib/libutil/login_class.c Mon Mar 19 01:51:53 2012 (r233153) @@ -450,18 +450,21 @@ setusercontext(login_cap_t *lc, const st p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", - pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS); + pwd ? pwd->pw_name : "-", + lc ? lc->lc_class : LOGIN_DEFCLASS); } else if (p < PRIO_MIN) { rtp.type = RTP_PRIO_REALTIME; rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX); p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", - pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS); + pwd ? pwd->pw_name : "-", + lc ? lc->lc_class : LOGIN_DEFCLASS); } else { if (setpriority(PRIO_PROCESS, 0, (int)p) != 0) syslog(LOG_WARNING, "setpriority '%s' (%s): %m", - pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS); + pwd ? pwd->pw_name : "-", + lc ? lc->lc_class : LOGIN_DEFCLASS); } } From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:52:08 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 688BC1065677 for ; Mon, 19 Mar 2012 01:52:08 +0000 (UTC) (envelope-from jhellenthal@dataix.net) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id ED5F88FC1A for ; Mon, 19 Mar 2012 01:52:07 +0000 (UTC) Received: by iahk25 with SMTP id k25so12189837iah.13 for ; Sun, 18 Mar 2012 18:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dataix.net; s=rsa; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to; bh=xG6hlcWyhxQLTPxUfA9nTmQzEO3spsOmgd4YXYWJV7o=; b=JSeJE+P93+DKttHbq+q4opIAFoa1Vc4GZ8ws297hTRC5jE1/uVRTyfCNrGaLb+Nb2w T0z2qv8PrOyB3URyXXCGJ5ocf9nbkDY+s0f4R4+yZvkyd6IHRlSR9/XM8s3i2jJLSSdg IeTU64h7enPNg/Wuwl4GkVYg4yrqXA7Vj1xrE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:x-gm-message-state; bh=xG6hlcWyhxQLTPxUfA9nTmQzEO3spsOmgd4YXYWJV7o=; b=N4ZTE4iLEfbjxQFVnwszmxIM4mO4QoJeenPsdkM4/4XSGZXmGP/fO9dpxmQgfX5MS4 1T+V+XwPyNlGhU5xB7cH8DNa5nHsu4vK+frInhEpFUwjZlR/V8+kBSt9bEaQPEb8C/Zc tW4B2rwcTk2ft130z5Z4a3UtBAHTNK5DkaNwUzsazj2SDNKT1pYQI58ya8Eug/fNOpm0 lGk6/hDWd+gobQ1f9zX0pSXFfPPA6gNojd3InAtZ28AGdoAgFkNyfXh08Zbz0nl03ns1 +NKY6yLipcfZWFbEyEXo56lMC+O0paSmMaQwz1VI69XEWjj+4+l2KoxlokQ0SAAXNQwa aLAg== Received: by 10.50.161.232 with SMTP id xv8mr4943476igb.9.1332121927191; Sun, 18 Mar 2012 18:52:07 -0700 (PDT) Received: from DataIX.net (adsl-99-112-214-41.dsl.klmzmi.sbcglobal.net. [99.112.214.41]) by mx.google.com with ESMTPS id i7sm4962031igq.11.2012.03.18.18.52.05 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Mar 2012 18:52:06 -0700 (PDT) Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.5/8.14.5) with ESMTP id q2J1q3eR059729 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 18 Mar 2012 21:52:03 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Received: (from jhellenthal@localhost) by DataIX.net (8.14.5/8.14.5/Submit) id q2J1q3wF059660; Sun, 18 Mar 2012 21:52:03 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Date: Sun, 18 Mar 2012 21:52:03 -0400 From: Jason Hellenthal To: Eitan Adler Message-ID: <20120319015203.GB13456@DataIX.net> References: <201203190127.q2J1RtgB044557@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uQr8t48UFsdbeI+V" Content-Disposition: inline In-Reply-To: <201203190127.q2J1RtgB044557@svn.freebsd.org> X-Gm-Message-State: ALoCoQlHaeDnEj6Eh1/GTZDbUYQd1MKCAa/YkQDJLbyr82krSNjYSnr5irGGmBXd5SbCdBhTwWVF Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:52:08 -0000 --uQr8t48UFsdbeI+V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 19, 2012 at 01:27:55AM +0000, Eitan Adler wrote: > Author: eadler > Date: Mon Mar 19 01:27:55 2012 > New Revision: 233147 > URL: http://svn.freebsd.org/changeset/base/233147 >=20 > Log: > MFC r232503: > POSIX mandates that swab do nothing when len < 0 > =20 > PR: 140690 > Approved by: cperciva >=20 > Modified: stable/8/lib/libc/string/swab.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:30 2012 (r233146) > +++ stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:55 2012 (r233147) > @@ -45,6 +45,8 @@ swab(const void * __restrict from, void=20 > int n; > char *fp, *tp; > =20 > + if (len <=3D 0) > + return; Does this not test to see if it is also equal to 0(zero) ? If I understand the above statement "POSIX mandates that swab do nothing when len < 0" then the above code should be exactly that ... and not testing whether it is equal to zero... > n =3D len >> 1; > fp =3D (char *)from; > tp =3D (char *)to; > _______________________________________________ > svn-src-stable-8@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 > To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.or= g" --=20 ;s =3D; --uQr8t48UFsdbeI+V Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJPZpFCAAoJEJBXh4mJ2FR+yNUH/j7hn/2z1yoIcP0Tbux7lQaT Y/z3W+dXCGGFuDkyIsoAQBF7zDAXqjUxjj0g/qJWakdq+SaRJA65v2AV8d1CYDbf fFlv5JY9UsDpjyHD4Z2r33Xk2hgTB8lDyJLEgFrPhbS3x9AY9euQ6oE1TS0R3J3/ 8I3Zde+MlU0c2g7ST3lZA4cKsKB8asl+fBd9NdpR7T7emryrLx2pjO+9ff9jeqpZ Sol1QnVWzgTbHkJVrM2GM3Y/1mWdpkCLa4yYNAW20u0y7/KX/Z5fNeBUZVHYFoDV wM8oioLDHhVc9d2fuWd6QaEwM5YYyh9BMC3SGALPNAAgIKwd1iOuDixKeufkmDg= =4Hc8 -----END PGP SIGNATURE----- --uQr8t48UFsdbeI+V-- From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:52:10 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CEB6106564A; Mon, 19 Mar 2012 01:52:10 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37B618FC1B; Mon, 19 Mar 2012 01:52:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1qAOq045532; Mon, 19 Mar 2012 01:52:10 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1qAKX045530; Mon, 19 Mar 2012 01:52:10 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190152.q2J1qAKX045530@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:52:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233154 - stable/7/lib/libutil X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:52:10 -0000 Author: eadler Date: Mon Mar 19 01:52:09 2012 New Revision: 233154 URL: http://svn.freebsd.org/changeset/base/233154 Log: MFC r231306: Fix NULL ptr dereference in setusercontext if pwd is null, LOGIN_SETPRIORITY is set, and setting the priority (rtprio or setpriority) fails. PR: kern/164238 Approved by: cperciva Modified: stable/7/lib/libutil/login_class.c Directory Properties: stable/7/lib/libutil/ (props changed) Modified: stable/7/lib/libutil/login_class.c ============================================================================== --- stable/7/lib/libutil/login_class.c Mon Mar 19 01:51:53 2012 (r233153) +++ stable/7/lib/libutil/login_class.c Mon Mar 19 01:52:09 2012 (r233154) @@ -448,18 +448,21 @@ setusercontext(login_cap_t *lc, const st p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", - pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS); + pwd ? pwd->pw_name : "-", + lc ? lc->lc_class : LOGIN_DEFCLASS); } else if (p < PRIO_MIN) { rtp.type = RTP_PRIO_REALTIME; rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX); p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", - pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS); + pwd ? pwd->pw_name : "-", + lc ? lc->lc_class : LOGIN_DEFCLASS); } else { if (setpriority(PRIO_PROCESS, 0, (int)p) != 0) syslog(LOG_WARNING, "setpriority '%s' (%s): %m", - pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS); + pwd ? pwd->pw_name : "-", + lc ? lc->lc_class : LOGIN_DEFCLASS); } } From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:56:26 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92E4E106564A; Mon, 19 Mar 2012 01:56:26 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7DE448FC17; Mon, 19 Mar 2012 01:56:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1uQvW045714; Mon, 19 Mar 2012 01:56:26 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1uQvX045712; Mon, 19 Mar 2012 01:56:26 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190156.q2J1uQvX045712@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:56:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233155 - stable/9/lib/libc/stdio X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:56:26 -0000 Author: eadler Date: Mon Mar 19 01:56:26 2012 New Revision: 233155 URL: http://svn.freebsd.org/changeset/base/233155 Log: MFC r232505: Remove outdated comment of seven years PR: docs/116116 Approved by: cperciva Modified: stable/9/lib/libc/stdio/mktemp.3 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/stdio/mktemp.3 ============================================================================== --- stable/9/lib/libc/stdio/mktemp.3 Mon Mar 19 01:52:09 2012 (r233154) +++ stable/9/lib/libc/stdio/mktemp.3 Mon Mar 19 01:56:26 2012 (r233155) @@ -236,10 +236,3 @@ and the return status of the call should This will ensure that the program does not continue blindly in the event that an attacker has already created the file with the intention of manipulating or reading its contents. -.Pp -The implementation of these functions calls -.Xr arc4random 3 , -which is not reentrant. -You must provide your own locking around this and other consumers of the -.Xr arc4random 3 -API. From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:56:53 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 593FE106566C; Mon, 19 Mar 2012 01:56:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4158E8FC15; Mon, 19 Mar 2012 01:56:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1urGn045758; Mon, 19 Mar 2012 01:56:53 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1ursF045756; Mon, 19 Mar 2012 01:56:53 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190156.q2J1ursF045756@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:56:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233156 - stable/8/lib/libc/stdio X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:56:53 -0000 Author: eadler Date: Mon Mar 19 01:56:52 2012 New Revision: 233156 URL: http://svn.freebsd.org/changeset/base/233156 Log: MFC r232505: Remove outdated comment of seven years PR: docs/116116 Approved by: cperciva Modified: stable/8/lib/libc/stdio/mktemp.3 Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/stdio/mktemp.3 ============================================================================== --- stable/8/lib/libc/stdio/mktemp.3 Mon Mar 19 01:56:26 2012 (r233155) +++ stable/8/lib/libc/stdio/mktemp.3 Mon Mar 19 01:56:52 2012 (r233156) @@ -236,10 +236,3 @@ and the return status of the call should This will ensure that the program does not continue blindly in the event that an attacker has already created the file with the intention of manipulating or reading its contents. -.Pp -The implementation of these functions calls -.Xr arc4random 3 , -which is not reentrant. -You must provide your own locking around this and other consumers of the -.Xr arc4random 3 -API. From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:57:15 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 261B7106566B; Mon, 19 Mar 2012 01:57:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F23B8FC1D; Mon, 19 Mar 2012 01:57:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1vE4O045802; Mon, 19 Mar 2012 01:57:14 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1vEwr045799; Mon, 19 Mar 2012 01:57:14 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190157.q2J1vEwr045799@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233157 - stable/7/lib/libc/stdio X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:57:15 -0000 Author: eadler Date: Mon Mar 19 01:57:14 2012 New Revision: 233157 URL: http://svn.freebsd.org/changeset/base/233157 Log: MFC r232505: Remove outdated comment of seven years PR: docs/116116 Approved by: cperciva Modified: stable/7/lib/libc/stdio/mktemp.3 Directory Properties: stable/7/lib/libc/ (props changed) Modified: stable/7/lib/libc/stdio/mktemp.3 ============================================================================== --- stable/7/lib/libc/stdio/mktemp.3 Mon Mar 19 01:56:52 2012 (r233156) +++ stable/7/lib/libc/stdio/mktemp.3 Mon Mar 19 01:57:14 2012 (r233157) @@ -236,10 +236,3 @@ and the return status of the call should This will ensure that the program does not continue blindly in the event that an attacker has already created the file with the intention of manipulating or reading its contents. -.Pp -The implementation of these functions calls -.Xr arc4random 3 , -which is not reentrant. -You must provide your own locking around this and other consumers of the -.Xr arc4random 3 -API. From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 01:58:44 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D13EA1065677 for ; Mon, 19 Mar 2012 01:58:44 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 3FC028FC1C for ; Mon, 19 Mar 2012 01:58:43 +0000 (UTC) Received: by lagv3 with SMTP id v3so6124295lag.13 for ; Sun, 18 Mar 2012 18:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=HHQlaUytgYY1OLpEvtP7+RCBrkZA4UKx9QC5nkvGkb0=; b=gijIJSO+uhvbSE6azwNrYvcyYeKr+co/qL8DRkBmMYwHyK4ulSLidZq8Q9aTD0NrKu dmafGGQG/mtdrsDCDvk5kbSZCmwITE6nC4jayxmLkbecwavLoxHb8tVbHWcWM9aVSaEl MTkzWexQWZkexxEUHwLKsNXO/LldyellIRinc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=HHQlaUytgYY1OLpEvtP7+RCBrkZA4UKx9QC5nkvGkb0=; b=S+NbSTTFwJhJXvtc7A/IN3KyIoygdNm0i755H/n3S1dBEaNuS13kIo/hBGOuqpirjg a/axDHJKzfBA8/sPBIQviUNJ9lTChNRo22NOF/3c9f23qly94IY6TQdcki3Jkx6lSEy3 d+GI02AATNzd/vhNqYXyEsbQH0Xq7TYuRtK5InX1gMCU0s42EoWL1bVq49dnD/xGHEVu J2VbnNG15U7ptCSit5qLKZJfK9mR+Xr7g6C+nmGx/T0LooRNN5iXrzJc0NGrNfRXcnTG 9kUx8fZ4lV9ZJ/yLJ2Yb6C+0KacFQu9GyQ5w2rdjLEYol+7m9YGGpFdoYnunNqCDA1gu bZDg== Received: by 10.112.24.161 with SMTP id v1mr4174285lbf.12.1332122322899; Sun, 18 Mar 2012 18:58:42 -0700 (PDT) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.112.106.105 with HTTP; Sun, 18 Mar 2012 18:58:12 -0700 (PDT) In-Reply-To: <20120319015203.GB13456@DataIX.net> References: <201203190127.q2J1RtgB044557@svn.freebsd.org> <20120319015203.GB13456@DataIX.net> From: Eitan Adler Date: Sun, 18 Mar 2012 21:58:12 -0400 X-Google-Sender-Auth: cg-UeLuRKxLBoJasBzs0K9hRZEs Message-ID: To: Jason Hellenthal Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQnu7zwuiC9k5t8owe2PkEmn6T05aXA0BarQQqBH65l4uCm2Rgb8z0KB5JrBXdCm6rJ7IX/E Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:58:44 -0000 On Sun, Mar 18, 2012 at 9:52 PM, Jason Hellenthal wrote: > > > On Mon, Mar 19, 2012 at 01:27:55AM +0000, Eitan Adler wrote: >> Author: eadler >> Date: Mon Mar 19 01:27:55 2012 >> New Revision: 233147 >> URL: http://svn.freebsd.org/changeset/base/233147 >> >> Log: >> =C2=A0 MFC r232503: >> =C2=A0 =C2=A0 =C2=A0 POSIX mandates that swab do nothing when len < 0 >> >> =C2=A0 PR: =C2=A0 =C2=A0 =C2=A0 =C2=A0 140690 >> =C2=A0 Approved by: =C2=A0 =C2=A0 =C2=A0 =C2=A0cperciva >> >> Modified: stable/8/lib/libc/string/swab.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- stable/8/lib/libc/string/swab.c =C2=A0 Mon Mar 19 01:27:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233146) >> +++ stable/8/lib/libc/string/swab.c =C2=A0 Mon Mar 19 01:27:55 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233147) >> @@ -45,6 +45,8 @@ swab(const void * __restrict from, void >> =C2=A0 =C2=A0 =C2=A0 int n; >> =C2=A0 =C2=A0 =C2=A0 char *fp, *tp; >> >> + =C2=A0 =C2=A0 if (len <=3D 0) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return; > > Does this not test to see if it is also equal to 0(zero) ? > > If I understand the above statement "POSIX mandates that swab do nothing > when len < 0" then the above code should be exactly that ... and not > testing whether it is equal to zero... If the code doesn't check for len <=3D 0 then it will do something. --=20 Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 02:17:30 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76A851065676 for ; Mon, 19 Mar 2012 02:17:30 +0000 (UTC) (envelope-from jhellenthal@dataix.net) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 24E7F8FC0C for ; Mon, 19 Mar 2012 02:17:29 +0000 (UTC) Received: by iahk25 with SMTP id k25so12226952iah.13 for ; Sun, 18 Mar 2012 19:17:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dataix.net; s=rsa; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to; bh=KDtC/0ktxJp3vDQXpYtToV/w65BZ79QDpxSAqPsGKDo=; b=X0OhXvNoxcbHK//VoSAWFL4w/mQnff4Rkc4fHDHLoaLF1T/GfQNuGnZhaGWDnktxi7 w5Ekwsd1WoKun2oO4ibCTI1ducZDYnRn+uqgU3r3trIfNmp3lb2mUw5RUbHv/4/1LZu3 D/fxU9jlCuC+vzgcCeqhu/c1bSaqFl6w40hQg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:x-gm-message-state; bh=KDtC/0ktxJp3vDQXpYtToV/w65BZ79QDpxSAqPsGKDo=; b=IQsSp6Sw3SeqN0NhBVxASmBuXurVvL/9y2dW0fl20UR9JxWAN6ZZ+6WlFFFha25AHx qNvTj9E/ioNQ1Zj2aFq+bLg11hf/S2/alnA3J04zM/9cbXO/fUsB2j8uHyqEiJqHKYuB shHsphoC51DdSp8GOUyMcwGfnjVpoKx+3jFSz0v4Rr2AfjGV8MflIZmLdUuV6E89VKwg alZDXEuPFzlY79buK/YAGDcm1MclLYqa5MXqg4f+DWybYVkdfrffE9MDB+vNkt+3aVjK XUBcJ7Mu2VDeOqheX8goci7yZfcYMSt1K/8jfD26UZvnsyC9Gjovd7nsBKWo9E1oxLm7 PhxA== Received: by 10.43.52.10 with SMTP id vk10mr5781188icb.25.1332123449452; Sun, 18 Mar 2012 19:17:29 -0700 (PDT) Received: from DataIX.net (adsl-99-112-214-41.dsl.klmzmi.sbcglobal.net. [99.112.214.41]) by mx.google.com with ESMTPS id gh8sm4997814igb.16.2012.03.18.19.17.27 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Mar 2012 19:17:28 -0700 (PDT) Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.5/8.14.5) with ESMTP id q2J2HPJA002608 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 18 Mar 2012 22:17:25 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Received: (from jhellenthal@localhost) by DataIX.net (8.14.5/8.14.5/Submit) id q2J2HOUS002134; Sun, 18 Mar 2012 22:17:24 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Date: Sun, 18 Mar 2012 22:17:24 -0400 From: Jason Hellenthal To: Eitan Adler Message-ID: <20120319021724.GC13456@DataIX.net> References: <201203190127.q2J1RtgB044557@svn.freebsd.org> <20120319015203.GB13456@DataIX.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Gm-Message-State: ALoCoQk40wJtfu09yFlRJilSMLwGS3C4UCbybbfYevn80328PQSV0WXoMtErd8ehJJgwO++JW6GA Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 02:17:30 -0000 On Sun, Mar 18, 2012 at 09:58:12PM -0400, Eitan Adler wrote: > On Sun, Mar 18, 2012 at 9:52 PM, Jason Hellenthal > wrote: > > > > > > On Mon, Mar 19, 2012 at 01:27:55AM +0000, Eitan Adler wrote: > >> Author: eadler > >> Date: Mon Mar 19 01:27:55 2012 > >> New Revision: 233147 > >> URL: http://svn.freebsd.org/changeset/base/233147 > >> > >> Log: > >>   MFC r232503: > >>       POSIX mandates that swab do nothing when len < 0 > >> > >>   PR:         140690 > >>   Approved by:        cperciva > >> > >> Modified: stable/8/lib/libc/string/swab.c > >> ============================================================================== > >> --- stable/8/lib/libc/string/swab.c   Mon Mar 19 01:27:30 2012        (r233146) > >> +++ stable/8/lib/libc/string/swab.c   Mon Mar 19 01:27:55 2012        (r233147) > >> @@ -45,6 +45,8 @@ swab(const void * __restrict from, void > >>       int n; > >>       char *fp, *tp; > >> > >> +     if (len <= 0) > >> +             return; > > > > Does this not test to see if it is also equal to 0(zero) ? > > > > If I understand the above statement "POSIX mandates that swab do nothing > > when len < 0" then the above code should be exactly that ... and not > > testing whether it is equal to zero... > > If the code doesn't check for len <= 0 then it will do something. > To my understanding of the specification it should only return if len is negative... 0 is not a negative number. -- ;s =; From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 02:32:18 2012 Return-Path: Delivered-To: svn-src-stable@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6402E106564A; Mon, 19 Mar 2012 02:32:18 +0000 (UTC) (envelope-from tim@kientzle.com) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id 19FF48FC14; Mon, 19 Mar 2012 02:32:14 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id q2J2W7XV089805; Mon, 19 Mar 2012 02:32:07 GMT (envelope-from tim@kientzle.com) Received: from [192.168.2.119] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id 74sitbxu8cehhdt79hbbq52guw; Mon, 19 Mar 2012 02:32:06 +0000 (UTC) (envelope-from tim@kientzle.com) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=windows-1252 From: Tim Kientzle In-Reply-To: <20120319021724.GC13456@DataIX.net> Date: Sun, 18 Mar 2012 19:32:04 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <264991E4-B083-4E61-9337-E5882DED66C3@kientzle.com> References: <201203190127.q2J1RtgB044557@svn.freebsd.org> <20120319015203.GB13456@DataIX.net> <20120319021724.GC13456@DataIX.net> To: Jason Hellenthal X-Mailer: Apple Mail (2.1257) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Eitan Adler , svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 02:32:18 -0000 On Mar 18, 2012, at 7:17 PM, Jason Hellenthal wrote: >=20 >=20 > On Sun, Mar 18, 2012 at 09:58:12PM -0400, Eitan Adler wrote: >> On Sun, Mar 18, 2012 at 9:52 PM, Jason Hellenthal >> wrote: >>>=20 >>>=20 >>> On Mon, Mar 19, 2012 at 01:27:55AM +0000, Eitan Adler wrote: >>>> Author: eadler >>>> Date: Mon Mar 19 01:27:55 2012 >>>> New Revision: 233147 >>>> URL: http://svn.freebsd.org/changeset/base/233147 >>>>=20 >>>> Log: >>>> MFC r232503: >>>> POSIX mandates that swab do nothing when len < 0 >>>>=20 >>>> PR: 140690 >>>> Approved by: cperciva >>>>=20 >>>> Modified: stable/8/lib/libc/string/swab.c >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:30 2012 = (r233146) >>>> +++ stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:55 2012 = (r233147) >>>> @@ -45,6 +45,8 @@ swab(const void * __restrict from, void >>>> int n; >>>> char *fp, *tp; >>>>=20 >>>> + if (len <=3D 0) >>>> + return; >>>=20 >>> Does this not test to see if it is also equal to 0(zero) ? >>>=20 >>> If I understand the above statement "POSIX mandates that swab do = nothing >>> when len < 0" then the above code should be exactly that ... and not >>> testing whether it is equal to zero... >>=20 >> If the code doesn't check for len <=3D 0 then it will do something. >>=20 >=20 > To my understanding of the specification it should only return if len = is > negative... 0 is not a negative number. =46rom POSIX: > The swab() function shall copy nbytes bytes=85 This implies that it does nothing when the argument is zero. The check for <=3D 0 is a performance optimization; otherwise the code will do nothing in a more expensive fashion. > If nbytes is negative, swab() does nothing. This states that it does nothing when the argument is less than zero. So the change is correct; it covers both cases. Tim From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 02:59:18 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59D771065679 for ; Mon, 19 Mar 2012 02:59:18 +0000 (UTC) (envelope-from jhellenthal@dataix.net) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id B89CB8FC1A for ; Mon, 19 Mar 2012 02:59:17 +0000 (UTC) Received: by iahk25 with SMTP id k25so12287722iah.13 for ; Sun, 18 Mar 2012 19:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dataix.net; s=rsa; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to; bh=dfFFFyIlffruE/gLmNJmiSGkmnLlf456JEu319OSom8=; b=eTLdhvQvjY0G6GW/AI0AoLV+H0fKcQmGRkuFGVyGEPvy8OjNyumM1NLxl4x0ZuPpS+ qktXArG/zwdThdmiH+xmqjSx+qJ+zsQ0NHdWGxs09yRU+sRKruaJcSqf8zJulsK6ZRUK U0p1JsE0CLiFxl9Bv6VrJO/+U2UH3qW6j8Edo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:x-gm-message-state; bh=dfFFFyIlffruE/gLmNJmiSGkmnLlf456JEu319OSom8=; b=V2UO7wHItvg6t98ihMTDI0dScD8cATG+b92flUN1s0+bIlMtE28MJeNsqkACfik2fN N3iiK2/0ScUsmQgbTiMjLTSjSRXT6EqL8AiAkfeRVo/zVLmiTXIT7l7u5gWZgkP4TeJX +uvaQhPwkZXA+dVUWAIxRtBf4smsZtpiLBBm7p4E1qBASqrZGUbMtY/rZFI2ik+8LXgN 0BhHxY4P51d14aXTXCDNZoYAG9KJnE+57bN6B36Pbbyei2ihEHnCOwhVlCNu1S7WVBCT NkEq+okPZmlFNPeZyio3mUvxUpKB/8klyyYxIlz+bb1VT1Q/PQrl5TeFpoOf9dah19MT qRag== Received: by 10.50.106.132 with SMTP id gu4mr4904409igb.59.1332125957139; Sun, 18 Mar 2012 19:59:17 -0700 (PDT) Received: from DataIX.net (adsl-99-112-214-41.dsl.klmzmi.sbcglobal.net. [99.112.214.41]) by mx.google.com with ESMTPS id ba4sm7458438igb.14.2012.03.18.19.59.15 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Mar 2012 19:59:16 -0700 (PDT) Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.5/8.14.5) with ESMTP id q2J2xDvV079731 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 18 Mar 2012 22:59:14 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Received: (from jhellenthal@localhost) by DataIX.net (8.14.5/8.14.5/Submit) id q2J2xD13079708; Sun, 18 Mar 2012 22:59:13 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Date: Sun, 18 Mar 2012 22:59:13 -0400 From: Jason Hellenthal To: Tim Kientzle Message-ID: <20120319025913.GA29610@DataIX.net> References: <201203190127.q2J1RtgB044557@svn.freebsd.org> <20120319015203.GB13456@DataIX.net> <20120319021724.GC13456@DataIX.net> <264991E4-B083-4E61-9337-E5882DED66C3@kientzle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <264991E4-B083-4E61-9337-E5882DED66C3@kientzle.com> X-Gm-Message-State: ALoCoQkpVDfjFxF/9swnoA3iw6Ri+Vwy4WYCLl78OhTvfYBsqY6pCFRr87B3xvHCaY7OHdAaaC3O Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Eitan Adler , svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 02:59:18 -0000 On Sun, Mar 18, 2012 at 07:32:04PM -0700, Tim Kientzle wrote: > > On Mar 18, 2012, at 7:17 PM, Jason Hellenthal wrote: > > > > > > > On Sun, Mar 18, 2012 at 09:58:12PM -0400, Eitan Adler wrote: > >> On Sun, Mar 18, 2012 at 9:52 PM, Jason Hellenthal > >> wrote: > >>> > >>> > >>> On Mon, Mar 19, 2012 at 01:27:55AM +0000, Eitan Adler wrote: > >>>> Author: eadler > >>>> Date: Mon Mar 19 01:27:55 2012 > >>>> New Revision: 233147 > >>>> URL: http://svn.freebsd.org/changeset/base/233147 > >>>> > >>>> Log: > >>>> MFC r232503: > >>>> POSIX mandates that swab do nothing when len < 0 > >>>> > >>>> PR: 140690 > >>>> Approved by: cperciva > >>>> > >>>> Modified: stable/8/lib/libc/string/swab.c > >>>> ============================================================================== > >>>> --- stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:30 2012 (r233146) > >>>> +++ stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:55 2012 (r233147) > >>>> @@ -45,6 +45,8 @@ swab(const void * __restrict from, void > >>>> int n; > >>>> char *fp, *tp; > >>>> > >>>> + if (len <= 0) > >>>> + return; > >>> > >>> Does this not test to see if it is also equal to 0(zero) ? > >>> > >>> If I understand the above statement "POSIX mandates that swab do nothing > >>> when len < 0" then the above code should be exactly that ... and not > >>> testing whether it is equal to zero... > >> > >> If the code doesn't check for len <= 0 then it will do something. > >> > > > > To my understanding of the specification it should only return if len is > > negative... 0 is not a negative number. > > >From POSIX: > > The swab() function shall copy nbytes bytes… > > This implies that it does nothing when the argument is zero. > The check for <= 0 is a performance optimization; > otherwise the code will do nothing in a more expensive > fashion. > > > If nbytes is negative, swab() does nothing. > > This states that it does nothing when the argument is less than zero. > > So the change is correct; it covers both cases. > Yes. My point being though the description of this change does not adequately describe both cases. It just simply points to POSIX and saying it should return if negative. IMHO calling things what they are and making that very same change causes less grief. Also the man page specifies len "must be an even number" and by the posix spec it can be an odd number and copies and exchanges nbytes-1 and the disposition of the last byte is unspecified. Sorry but irregular documentation is a pet peeve of mine. -- ;s =; From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 07:13:31 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A540106564A; Mon, 19 Mar 2012 07:13:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15EE68FC17; Mon, 19 Mar 2012 07:13:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J7DUMo056321; Mon, 19 Mar 2012 07:13:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J7DUwJ056319; Mon, 19 Mar 2012 07:13:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201203190713.q2J7DUwJ056319@svn.freebsd.org> From: Alexander Motin Date: Mon, 19 Mar 2012 07:13:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233162 - stable/9/sys/dev/acpica X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 07:13:31 -0000 Author: mav Date: Mon Mar 19 07:13:30 2012 New Revision: 233162 URL: http://svn.freebsd.org/changeset/base/233162 Log: MFC r232797: ServerWorks HT1000 HPET reported to have problems with IRQs >= 16. Lower (ISA) IRQs are working, but allowed mask is not set correctly. Block both by default to allow HP BL465c G6 blade system to boot. Modified: stable/9/sys/dev/acpica/acpi_hpet.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_hpet.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_hpet.c Mon Mar 19 05:08:09 2012 (r233161) +++ stable/9/sys/dev/acpica/acpi_hpet.c Mon Mar 19 07:13:30 2012 (r233162) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #define HPET_VENDID_AMD 0x4353 #define HPET_VENDID_INTEL 0x8086 #define HPET_VENDID_NVIDIA 0x10de +#define HPET_VENDID_SW 0x1166 ACPI_SERIAL_DECL(hpet, "ACPI HPET support"); @@ -513,6 +514,13 @@ hpet_attach(device_t dev) if (vendor == HPET_VENDID_NVIDIA && rev <= 0x01) sc->allowed_irqs = 0x00000000; /* + * ServerWorks HT1000 reported to have problems with IRQs >= 16. + * Lower IRQs are working, but allowed mask is not set correctly. + * Legacy_route mode works fine. + */ + if (vendor == HPET_VENDID_SW && rev <= 0x01) + sc->allowed_irqs = 0x00000000; + /* * Neither QEMU nor VirtualBox report supported IRQs correctly. * The only way to use HPET there is to specify IRQs manually * and/or use legacy_route. Legacy_route mode works on both. From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 07:15:43 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2B057106566B; Mon, 19 Mar 2012 07:15:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B7908FC0A; Mon, 19 Mar 2012 07:15:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J7Fg77056443; Mon, 19 Mar 2012 07:15:42 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J7Fgun056439; Mon, 19 Mar 2012 07:15:42 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201203190715.q2J7Fgun056439@svn.freebsd.org> From: Alexander Motin Date: Mon, 19 Mar 2012 07:15:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233163 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 07:15:43 -0000 Author: mav Date: Mon Mar 19 07:15:42 2012 New Revision: 233163 URL: http://svn.freebsd.org/changeset/base/233163 Log: MFC r232783: Idle ticks optimization: - Pass number of events to the statclock() and profclock() functions same as to hardclock() before to not call them many times in a loop. - Rename them into statclock_cnt() and profclock_cnt(). - Turn statclock() and profclock() into compatibility wrappers, still needed for arm. - Rename hardclock_anycpu() into hardclock_cnt() for unification. Modified: stable/9/sys/kern/kern_clock.c stable/9/sys/kern/kern_clocksource.c stable/9/sys/sys/systm.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_clock.c ============================================================================== --- stable/9/sys/kern/kern_clock.c Mon Mar 19 07:13:30 2012 (r233162) +++ stable/9/sys/kern/kern_clock.c Mon Mar 19 07:15:42 2012 (r233163) @@ -482,7 +482,7 @@ hardclock(int usermode, uintfptr_t pc) } void -hardclock_anycpu(int cnt, int usermode) +hardclock_cnt(int cnt, int usermode) { struct pstats *pstats; struct thread *td = curthread; @@ -687,6 +687,13 @@ stopprofclock(p) void statclock(int usermode) { + + statclock_cnt(1, usermode); +} + +void +statclock_cnt(int cnt, int usermode) +{ struct rusage *ru; struct vmspace *vm; struct thread *td; @@ -702,11 +709,11 @@ statclock(int usermode) /* * Charge the time as appropriate. */ - td->td_uticks++; + td->td_uticks += cnt; if (p->p_nice > NZERO) - cp_time[CP_NICE]++; + cp_time[CP_NICE] += cnt; else - cp_time[CP_USER]++; + cp_time[CP_USER] += cnt; } else { /* * Came from kernel mode, so we were: @@ -722,15 +729,15 @@ statclock(int usermode) */ if ((td->td_pflags & TDP_ITHREAD) || td->td_intr_nesting_level >= 2) { - td->td_iticks++; - cp_time[CP_INTR]++; + td->td_iticks += cnt; + cp_time[CP_INTR] += cnt; } else { - td->td_pticks++; - td->td_sticks++; + td->td_pticks += cnt; + td->td_sticks += cnt; if (!TD_IS_IDLETHREAD(td)) - cp_time[CP_SYS]++; + cp_time[CP_SYS] += cnt; else - cp_time[CP_IDLE]++; + cp_time[CP_IDLE] += cnt; } } @@ -738,22 +745,30 @@ statclock(int usermode) MPASS(p->p_vmspace != NULL); vm = p->p_vmspace; ru = &td->td_ru; - ru->ru_ixrss += pgtok(vm->vm_tsize); - ru->ru_idrss += pgtok(vm->vm_dsize); - ru->ru_isrss += pgtok(vm->vm_ssize); + ru->ru_ixrss += pgtok(vm->vm_tsize) * cnt; + ru->ru_idrss += pgtok(vm->vm_dsize) * cnt; + ru->ru_isrss += pgtok(vm->vm_ssize) * cnt; rss = pgtok(vmspace_resident_count(vm)); if (ru->ru_maxrss < rss) ru->ru_maxrss = rss; KTR_POINT2(KTR_SCHED, "thread", sched_tdname(td), "statclock", "prio:%d", td->td_priority, "stathz:%d", (stathz)?stathz:hz); thread_lock_flags(td, MTX_QUIET); - sched_clock(td); + for ( ; cnt > 0; cnt--) + sched_clock(td); thread_unlock(td); } void profclock(int usermode, uintfptr_t pc) { + + profclock_cnt(1, usermode, pc); +} + +void +profclock_cnt(int cnt, int usermode, uintfptr_t pc) +{ struct thread *td; #ifdef GPROF struct gmonparam *g; @@ -769,7 +784,7 @@ profclock(int usermode, uintfptr_t pc) * bother trying to count it. */ if (td->td_proc->p_flag & P_PROFIL) - addupc_intr(td, pc, 1); + addupc_intr(td, pc, cnt); } #ifdef GPROF else { @@ -780,7 +795,7 @@ profclock(int usermode, uintfptr_t pc) if (g->state == GMON_PROF_ON && pc >= g->lowpc) { i = PC_TO_I(g, pc); if (i < g->textsize) { - KCOUNT(g, i)++; + KCOUNT(g, i) += cnt; } } } Modified: stable/9/sys/kern/kern_clocksource.c ============================================================================== --- stable/9/sys/kern/kern_clocksource.c Mon Mar 19 07:13:30 2012 (r233162) +++ stable/9/sys/kern/kern_clocksource.c Mon Mar 19 07:15:42 2012 (r233163) @@ -195,28 +195,34 @@ handleevents(struct bintime *now, int fa pc = TRAPF_PC(frame); } - runs = 0; state = DPCPU_PTR(timerstate); + runs = 0; while (bintime_cmp(now, &state->nexthard, >=)) { bintime_add(&state->nexthard, &hardperiod); runs++; } if (runs && fake < 2) { - hardclock_anycpu(runs, usermode); + hardclock_cnt(runs, usermode); done = 1; } + runs = 0; while (bintime_cmp(now, &state->nextstat, >=)) { - if (fake < 2) - statclock(usermode); bintime_add(&state->nextstat, &statperiod); + runs++; + } + if (runs && fake < 2) { + statclock_cnt(runs, usermode); done = 1; } if (profiling) { + runs = 0; while (bintime_cmp(now, &state->nextprof, >=)) { - if (!fake) - profclock(usermode, pc); bintime_add(&state->nextprof, &profperiod); + runs++; + } + if (runs && !fake) { + profclock_cnt(runs, usermode, pc); done = 1; } } else Modified: stable/9/sys/sys/systm.h ============================================================================== --- stable/9/sys/sys/systm.h Mon Mar 19 07:13:30 2012 (r233162) +++ stable/9/sys/sys/systm.h Mon Mar 19 07:15:42 2012 (r233163) @@ -238,12 +238,14 @@ void realitexpire(void *); int sysbeep(int hertz, int period); void hardclock(int usermode, uintfptr_t pc); -void hardclock_anycpu(int cnt, int usermode); +void hardclock_cnt(int cnt, int usermode); void hardclock_cpu(int usermode); void hardclock_sync(int cpu); void softclock(void *); void statclock(int usermode); +void statclock_cnt(int cnt, int usermode); void profclock(int usermode, uintfptr_t pc); +void profclock_cnt(int cnt, int usermode, uintfptr_t pc); int hardclockintr(void); From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 07:24:27 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 63E11106566B; Mon, 19 Mar 2012 07:24:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1111A8FC12; Mon, 19 Mar 2012 07:24:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J7OQuD056799; Mon, 19 Mar 2012 07:24:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J7OQ3i056795; Mon, 19 Mar 2012 07:24:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201203190724.q2J7OQ3i056795@svn.freebsd.org> From: Alexander Motin Date: Mon, 19 Mar 2012 07:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233164 - stable/9/sys/dev/sound/pcm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 07:24:28 -0000 Author: mav Date: Mon Mar 19 07:24:26 2012 New Revision: 233164 URL: http://svn.freebsd.org/changeset/base/233164 Log: MFC r230845: Make sound(4) more flexible in setting soft buffer and block sizes when hardware imposes strict limitations on hard buffer and block sizes. Previous code set soft buffer to be no smaller then hard buffer. On some cards with fixed 64K physical buffer that caused up to 800ms play latency. New code allows to set soft buffer size down to just two blocks of the hard buffer and to not write more then that size ahead to the hardware buffer. As result of that change I was able to reduce full practically measured record-playback loop delay in those conditions down to only about 115ms with theoretical playback latency of only about 50ms. New code works fine for both vchans and direct cases. In both cases sound(4) tries to follow hw.snd.latency_profile and hw.snd.latency values and application-requested buffer and block sizes as much as limitation of two hardware blocks allows. Modified: stable/9/sys/dev/sound/pcm/buffer.c stable/9/sys/dev/sound/pcm/buffer.h stable/9/sys/dev/sound/pcm/channel.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/sound/pcm/buffer.c ============================================================================== --- stable/9/sys/dev/sound/pcm/buffer.c Mon Mar 19 07:15:42 2012 (r233163) +++ stable/9/sys/dev/sound/pcm/buffer.c Mon Mar 19 07:24:26 2012 (r233164) @@ -301,6 +301,15 @@ sndbuf_fillsilence(struct snd_dbuf *b) b->rl = b->bufsize; } +void +sndbuf_fillsilence_rl(struct snd_dbuf *b, u_int rl) +{ + if (b->bufsize > 0) + memset(sndbuf_getbuf(b), sndbuf_zerodata(b->fmt), b->bufsize); + b->rp = 0; + b->rl = min(b->bufsize, rl); +} + /** * @brief Reset buffer w/o flushing statistics * Modified: stable/9/sys/dev/sound/pcm/buffer.h ============================================================================== --- stable/9/sys/dev/sound/pcm/buffer.h Mon Mar 19 07:15:42 2012 (r233163) +++ stable/9/sys/dev/sound/pcm/buffer.h Mon Mar 19 07:24:26 2012 (r233164) @@ -74,6 +74,7 @@ int sndbuf_remalloc(struct snd_dbuf *b, void sndbuf_reset(struct snd_dbuf *b); void sndbuf_clear(struct snd_dbuf *b, unsigned int length); void sndbuf_fillsilence(struct snd_dbuf *b); +void sndbuf_fillsilence_rl(struct snd_dbuf *b, u_int rl); void sndbuf_softreset(struct snd_dbuf *b); void sndbuf_clearshadow(struct snd_dbuf *b); Modified: stable/9/sys/dev/sound/pcm/channel.c ============================================================================== --- stable/9/sys/dev/sound/pcm/channel.c Mon Mar 19 07:15:42 2012 (r233163) +++ stable/9/sys/dev/sound/pcm/channel.c Mon Mar 19 07:24:26 2012 (r233164) @@ -395,24 +395,28 @@ chn_wrfeed(struct pcm_channel *c) { struct snd_dbuf *b = c->bufhard; struct snd_dbuf *bs = c->bufsoft; - unsigned int amt; + unsigned int amt, want, wasfree; CHN_LOCKASSERT(c); if ((c->flags & CHN_F_MMAP) && !(c->flags & CHN_F_CLOSING)) sndbuf_acquire(bs, NULL, sndbuf_getfree(bs)); - amt = sndbuf_getfree(b); + wasfree = sndbuf_getfree(b); + want = min(sndbuf_getsize(b), + imax(0, sndbuf_xbytes(sndbuf_getsize(bs), bs, b) - + sndbuf_getready(b))); + amt = min(wasfree, want); if (amt > 0) sndbuf_feed(bs, b, c, c->feeder, amt); /* * Possible xruns. There should be no empty space left in buffer. */ - if (sndbuf_getfree(b) > 0) + if (sndbuf_getready(b) < want) c->xruns++; - if (sndbuf_getfree(b) < amt) + if (sndbuf_getfree(b) < wasfree) chn_wakeup(c); } @@ -721,7 +725,8 @@ chn_start(struct pcm_channel *c, int for } if (c->parentchannel == NULL) { if (c->direction == PCMDIR_PLAY) - sndbuf_fillsilence(b); + sndbuf_fillsilence_rl(b, + sndbuf_xbytes(sndbuf_getsize(bs), bs, b)); if (snd_verbose > 3) device_printf(c->dev, "%s(): %s starting! (%s/%s) " @@ -1728,7 +1733,7 @@ chn_resizebuf(struct pcm_channel *c, int int blkcnt, int blksz) { struct snd_dbuf *b, *bs, *pb; - int sblksz, sblkcnt, hblksz, hblkcnt, limit = 1; + int sblksz, sblkcnt, hblksz, hblkcnt, limit = 0, nsblksz, nsblkcnt; int ret; CHN_LOCKASSERT(c); @@ -1748,7 +1753,6 @@ chn_resizebuf(struct pcm_channel *c, int return EINVAL; else { c->latency = latency; - limit = 0; } bs = c->bufsoft; @@ -1783,19 +1787,22 @@ chn_resizebuf(struct pcm_channel *c, int */ sblksz = round_blksz(blksz, sndbuf_getalign(bs)); sblkcnt = round_pow2(blkcnt); - limit = 0; } if (c->parentchannel != NULL) { - pb = CHN_BUF_PARENT(c, NULL); + pb = c->parentchannel->bufsoft; CHN_UNLOCK(c); CHN_LOCK(c->parentchannel); chn_notify(c->parentchannel, CHN_N_BLOCKSIZE); CHN_UNLOCK(c->parentchannel); CHN_LOCK(c); - limit = (limit != 0 && pb != NULL) ? - sndbuf_xbytes(sndbuf_getsize(pb), pb, bs) : 0; - c->timeout = c->parentchannel->timeout; + if (c->direction == PCMDIR_PLAY) { + limit = (pb != NULL) ? + sndbuf_xbytes(sndbuf_getsize(pb), pb, bs) : 0; + } else { + limit = (pb != NULL) ? + sndbuf_xbytes(sndbuf_getblksz(pb), pb, bs) * 2 : 0; + } } else { hblkcnt = 2; if (c->flags & CHN_F_HAS_SIZE) { @@ -1836,21 +1843,22 @@ chn_resizebuf(struct pcm_channel *c, int CHN_LOCK(c); if (!CHN_EMPTY(c, children)) { - sblksz = round_blksz( - sndbuf_xbytes(sndbuf_getsize(b) >> 1, b, bs), + nsblksz = round_blksz( + sndbuf_xbytes(sndbuf_getblksz(b), b, bs), sndbuf_getalign(bs)); - sblkcnt = 2; + nsblkcnt = sndbuf_getblkcnt(b); + if (c->direction == PCMDIR_PLAY) { + do { + nsblkcnt--; + } while (nsblkcnt >= 2 && + nsblksz * nsblkcnt >= sblksz * sblkcnt); + nsblkcnt++; + } + sblksz = nsblksz; + sblkcnt = nsblkcnt; limit = 0; - } else if (limit != 0) - limit = sndbuf_xbytes(sndbuf_getsize(b), b, bs); - - /* - * Interrupt timeout - */ - c->timeout = ((u_int64_t)hz * sndbuf_getsize(b)) / - ((u_int64_t)sndbuf_getspd(b) * sndbuf_getalign(b)); - if (c->timeout < 1) - c->timeout = 1; + } else + limit = sndbuf_xbytes(sndbuf_getblksz(b), b, bs) * 2; } if (limit > CHN_2NDBUFMAXSIZE) @@ -1887,6 +1895,16 @@ chn_resizebuf(struct pcm_channel *c, int } /* + * Interrupt timeout + */ + c->timeout = ((u_int64_t)hz * sndbuf_getsize(bs)) / + ((u_int64_t)sndbuf_getspd(bs) * sndbuf_getalign(bs)); + if (c->parentchannel != NULL) + c->timeout = min(c->timeout, c->parentchannel->timeout); + if (c->timeout < 1) + c->timeout = 1; + + /* * OSSv4 docs: "By default OSS will set the low water level equal * to the fragment size which is optimal in most cases." */ From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 07:34:10 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 245CA106564A; Mon, 19 Mar 2012 07:34:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BBCC8FC0A; Mon, 19 Mar 2012 07:34:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J7Y9jk057174; Mon, 19 Mar 2012 07:34:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J7Y91n057165; Mon, 19 Mar 2012 07:34:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201203190734.q2J7Y91n057165@svn.freebsd.org> From: Alexander Motin Date: Mon, 19 Mar 2012 07:34:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233165 - in stable/9: share/man/man4 sys/conf sys/dev/sound/pci sys/modules/sound/driver sys/modules/sound/driver/hdspe X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 07:34:10 -0000 Author: mav Date: Mon Mar 19 07:34:09 2012 New Revision: 233165 URL: http://svn.freebsd.org/changeset/base/233165 Log: MFC r232337: Add driver for the RME HDSPe AIO/RayDAT sound cards -- snd_hdspe(4). Cards are expensive and so rare, so leave the driver as module. Submitted by: Ruslan Bukin Added: stable/9/share/man/man4/snd_hdspe.4 - copied unchanged from r232337, head/share/man/man4/snd_hdspe.4 stable/9/sys/dev/sound/pci/hdspe-pcm.c - copied unchanged from r232337, head/sys/dev/sound/pci/hdspe-pcm.c stable/9/sys/dev/sound/pci/hdspe.c - copied unchanged from r232337, head/sys/dev/sound/pci/hdspe.c stable/9/sys/dev/sound/pci/hdspe.h - copied unchanged from r232337, head/sys/dev/sound/pci/hdspe.h stable/9/sys/modules/sound/driver/hdspe/ - copied from r232337, head/sys/modules/sound/driver/hdspe/ Modified: stable/9/share/man/man4/Makefile stable/9/share/man/man4/pcm.4 stable/9/sys/conf/NOTES stable/9/sys/conf/files stable/9/sys/modules/sound/driver/Makefile Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Mon Mar 19 07:24:26 2012 (r233164) +++ stable/9/share/man/man4/Makefile Mon Mar 19 07:34:09 2012 (r233165) @@ -414,6 +414,7 @@ MAN= aac.4 \ snd_fm801.4 \ snd_gusc.4 \ snd_hda.4 \ + snd_hdspe.4 \ snd_ich.4 \ snd_maestro3.4 \ snd_maestro.4 \ Modified: stable/9/share/man/man4/pcm.4 ============================================================================== --- stable/9/share/man/man4/pcm.4 Mon Mar 19 07:24:26 2012 (r233164) +++ stable/9/share/man/man4/pcm.4 Mon Mar 19 07:34:09 2012 (r233165) @@ -113,6 +113,8 @@ The following bridge device drivers are .It .Xr snd_hda 4 (enabled by default on amd64, i386) .It +.Xr snd_hdspe 4 +.It .Xr snd_ich 4 (enabled by default on amd64, i386) .It .Xr snd_maestro 4 @@ -714,6 +716,7 @@ A device node is not created properly. .Xr snd_fm801 4 , .Xr snd_gusc 4 , .Xr snd_hda 4 , +.Xr snd_hdspe 4 , .Xr snd_ich 4 , .Xr snd_maestro 4 , .Xr snd_maestro3 4 , Copied: stable/9/share/man/man4/snd_hdspe.4 (from r232337, head/share/man/man4/snd_hdspe.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/man/man4/snd_hdspe.4 Mon Mar 19 07:34:09 2012 (r233165, copy of r232337, head/share/man/man4/snd_hdspe.4) @@ -0,0 +1,76 @@ +.\" Copyright (c) 2012 Ruslan Bukin +.\" All rights reserved. +.\" +.\" 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 AUTHOR 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 AUTHOR 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. +.\" +.\" $FreeBSD$ +.\" +.Dd February 13, 2012 +.Dt SND_HDSPE 4 +.Os +.Sh NAME +.Nm snd_hdspe +.Nd "RME HDSPe brigde device driver" +.Sh SYNOPSIS +To compile this driver into the kernel, place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device sound" +.Cd "device snd_hdspe" +.Ed +.Pp +Alternatively, to load the driver as a module at boot time, place the +following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +snd_hdspe_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +bridge driver allows the generic audio driver +.Xr sound 4 +to attach to RME HDSPe audio devices. +.Sh HARDWARE +The +.Nm +driver supports the following audio devices: +.Pp +.Bl -bullet -compact +.It +RME HDSPe AIO +.It +RME HDSPe RayDAT +.El +.Sh SEE ALSO +.Xr sound 4 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 10.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Ruslan Bukin . Modified: stable/9/sys/conf/NOTES ============================================================================== --- stable/9/sys/conf/NOTES Mon Mar 19 07:24:26 2012 (r233164) +++ stable/9/sys/conf/NOTES Mon Mar 19 07:34:09 2012 (r233165) @@ -2246,6 +2246,7 @@ device sound # snd_gusc: Gravis UltraSound ISA PnP/non-PnP. # snd_hda: Intel High Definition Audio (Controller) and # compatible. +# snd_hdspe: RME HDSPe AIO and RayDAT. # snd_ich: Intel ICH AC'97 and some more audio controllers # embedded in a chipset, for example nVidia # nForce controllers. @@ -2285,6 +2286,7 @@ device snd_ess device snd_fm801 device snd_gusc device snd_hda +device snd_hdspe device snd_ich device snd_maestro device snd_maestro3 Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Mon Mar 19 07:24:26 2012 (r233164) +++ stable/9/sys/conf/files Mon Mar 19 07:34:09 2012 (r233165) @@ -1754,6 +1754,8 @@ dev/sound/pci/hda/hdaa_patches.c optiona dev/sound/pci/hda/hdac.c optional snd_hda pci dev/sound/pci/hda/hdac_if.m optional snd_hda pci dev/sound/pci/hda/hdacc.c optional snd_hda pci +dev/sound/pci/hdspe.c optional snd_hdspe pci +dev/sound/pci/hdspe-pcm.c optional snd_hdspe pci dev/sound/pcm/ac97.c optional sound dev/sound/pcm/ac97_if.m optional sound dev/sound/pcm/ac97_patch.c optional sound Copied: stable/9/sys/dev/sound/pci/hdspe-pcm.c (from r232337, head/sys/dev/sound/pci/hdspe-pcm.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/sound/pci/hdspe-pcm.c Mon Mar 19 07:34:09 2012 (r233165, copy of r232337, head/sys/dev/sound/pci/hdspe-pcm.c) @@ -0,0 +1,709 @@ +/*- + * Copyright (c) 2012 Ruslan Bukin + * All rights reserved. + * + * 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 AUTHOR 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 AUTHOR 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. + */ + +/* + * RME HDSPe driver for FreeBSD (pcm-part). + * Supported cards: AIO, RayDAT. + */ + +#include +#include +#include + +#include +#include + +#include + +SND_DECLARE_FILE("$FreeBSD$"); + +struct hdspe_latency { + uint32_t n; + uint32_t period; + float ms; +}; + +static struct hdspe_latency latency_map[] = { + { 7, 32, 0.7 }, + { 0, 64, 1.5 }, + { 1, 128, 3 }, + { 2, 256, 6 }, + { 3, 512, 12 }, + { 4, 1024, 23 }, + { 5, 2048, 46 }, + { 6, 4096, 93 }, + + { 0, 0, 0 }, +}; + +struct hdspe_rate { + uint32_t speed; + uint32_t reg; +}; + +static struct hdspe_rate rate_map[] = { + { 32000, (HDSPE_FREQ_32000) }, + { 44100, (HDSPE_FREQ_44100) }, + { 48000, (HDSPE_FREQ_48000) }, + { 64000, (HDSPE_FREQ_32000 | HDSPE_FREQ_DOUBLE) }, + { 88200, (HDSPE_FREQ_44100 | HDSPE_FREQ_DOUBLE) }, + { 96000, (HDSPE_FREQ_48000 | HDSPE_FREQ_DOUBLE) }, + { 128000, (HDSPE_FREQ_32000 | HDSPE_FREQ_QUAD) }, + { 176400, (HDSPE_FREQ_44100 | HDSPE_FREQ_QUAD) }, + { 192000, (HDSPE_FREQ_48000 | HDSPE_FREQ_QUAD) }, + + { 0, 0 }, +}; + + +static int +hdspe_hw_mixer(struct sc_chinfo *ch, unsigned int dst, + unsigned int src, unsigned short data) +{ + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + int offs = 0; + + if (ch->dir == PCMDIR_PLAY) + offs = 64; + + hdspe_write_4(sc, HDSPE_MIXER_BASE + + ((offs + src + 128 * dst) * sizeof(uint32_t)), + data & 0xFFFF); + + return 0; +}; + +static int +hdspechan_setgain(struct sc_chinfo *ch) +{ + + hdspe_hw_mixer(ch, ch->lslot, ch->lslot, + ch->lvol * HDSPE_MAX_GAIN / 100); + hdspe_hw_mixer(ch, ch->rslot, ch->rslot, + ch->rvol * HDSPE_MAX_GAIN / 100); + + return 0; +} + +static int +hdspemixer_init(struct snd_mixer *m) +{ + struct sc_pcminfo *scp = mix_getdevinfo(m); + struct sc_info *sc = scp->sc; + int mask; + + if (sc == NULL) + return -1; + + mask = SOUND_MASK_PCM; + + if (scp->hc->play) + mask |= SOUND_MASK_VOLUME; + + if (scp->hc->rec) + mask |= SOUND_MASK_RECLEV; + + snd_mtxlock(sc->lock); + pcm_setflags(scp->dev, pcm_getflags(scp->dev) | SD_F_SOFTPCMVOL); + mix_setdevs(m, mask); + snd_mtxunlock(sc->lock); + + return 0; +} + +static int +hdspemixer_set(struct snd_mixer *m, unsigned dev, + unsigned left, unsigned right) +{ + struct sc_pcminfo *scp = mix_getdevinfo(m); + struct sc_chinfo *ch; + int i; + +#if 0 + device_printf(scp->dev, "hdspemixer_set() %d %d\n", + left,right); +#endif + + for (i = 0; i < scp->chnum; i++) { + ch = &scp->chan[i]; + if ((dev == SOUND_MIXER_VOLUME && ch->dir == PCMDIR_PLAY) || + (dev == SOUND_MIXER_RECLEV && ch->dir == PCMDIR_REC)) { + ch->lvol = left; + ch->rvol = right; + if (ch->run) + hdspechan_setgain(ch); + } + } + + return 0; +} + +static kobj_method_t hdspemixer_methods[] = { + KOBJMETHOD(mixer_init, hdspemixer_init), + KOBJMETHOD(mixer_set, hdspemixer_set), + KOBJMETHOD_END +}; +MIXER_DECLARE(hdspemixer); + +static void +hdspechan_enable(struct sc_chinfo *ch, int value) +{ + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + int reg; + + if (ch->dir == PCMDIR_PLAY) + reg = HDSPE_OUT_ENABLE_BASE; + else + reg = HDSPE_IN_ENABLE_BASE; + + ch->run = value; + + hdspe_write_1(sc, reg + (4 * ch->lslot), value); + hdspe_write_1(sc, reg + (4 * ch->rslot), value); +} + +static int +hdspe_running(struct sc_info *sc) +{ + struct sc_pcminfo *scp; + struct sc_chinfo *ch; + int i, j, devcount, err; + device_t *devlist; + + if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) + goto bad; + + for (i = 0; i < devcount; i++) { + scp = device_get_ivars(devlist[i]); + for (j = 0; j < scp->chnum; j++) { + ch = &scp->chan[j]; + if (ch->run) + goto bad; + } + } + + return 0; +bad: + +#if 0 + device_printf(sc->dev,"hdspe is running\n"); +#endif + + return 1; +} + +static void +hdspe_start_audio(struct sc_info *sc) +{ + + sc->ctrl_register |= (HDSPE_AUDIO_INT_ENABLE | HDSPE_ENABLE); + hdspe_write_4(sc, HDSPE_CONTROL_REG, sc->ctrl_register); +} + +static void +hdspe_stop_audio(struct sc_info *sc) +{ + + if (hdspe_running(sc) == 1) + return; + + sc->ctrl_register &= ~(HDSPE_AUDIO_INT_ENABLE | HDSPE_ENABLE); + hdspe_write_4(sc, HDSPE_CONTROL_REG, sc->ctrl_register); +} + +/* Multiplex / demultiplex: 2.0 <-> 2 x 1.0. */ +static void +buffer_copy(struct sc_chinfo *ch) +{ + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + int length,src,dst; + int ssize, dsize; + int i; + + length = sndbuf_getready(ch->buffer) / + (4 /* Bytes per sample. */ * 2 /* channels */); + + if (ch->dir == PCMDIR_PLAY) { + src = sndbuf_getreadyptr(ch->buffer); + } else { + src = sndbuf_getfreeptr(ch->buffer); + } + + src /= 4; /* Bytes per sample. */ + dst = src / 2; /* Destination buffer twice smaller. */ + + ssize = ch->size / 4; + dsize = ch->size / 8; + + /* + * Use two fragment buffer to avoid sound clipping. + */ + + for (i = 0; i < sc->period * 2 /* fragments */; i++) { + if (ch->dir == PCMDIR_PLAY) { + sc->pbuf[dst + HDSPE_CHANBUF_SAMPLES * ch->lslot] = + ch->data[src]; + sc->pbuf[dst + HDSPE_CHANBUF_SAMPLES * ch->rslot] = + ch->data[src + 1]; + + } else { + ch->data[src] = + sc->rbuf[dst + HDSPE_CHANBUF_SAMPLES * ch->lslot]; + ch->data[src+1] = + sc->rbuf[dst + HDSPE_CHANBUF_SAMPLES * ch->rslot]; + } + + dst+=1; + dst %= dsize; + src+=2; + src %= ssize; + } +} + +static int +clean(struct sc_chinfo *ch){ + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + uint32_t *buf = sc->rbuf; + + if (ch->dir == PCMDIR_PLAY) { + buf = sc->pbuf; + } + + bzero(buf + HDSPE_CHANBUF_SAMPLES * ch->lslot, HDSPE_CHANBUF_SIZE); + bzero(buf + HDSPE_CHANBUF_SAMPLES * ch->rslot, HDSPE_CHANBUF_SIZE); + + return 0; +} + + +/* Channel interface. */ +static void * +hdspechan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, + struct pcm_channel *c, int dir) +{ + struct sc_pcminfo *scp = devinfo; + struct sc_info *sc = scp->sc; + struct sc_chinfo *ch; + int num; + + snd_mtxlock(sc->lock); + num = scp->chnum; + + ch = &scp->chan[num]; + ch->lslot = scp->hc->left; + ch->rslot = scp->hc->right; + ch->run = 0; + ch->lvol = 0; + ch->rvol = 0; + + ch->size = HDSPE_CHANBUF_SIZE * 2 /* slots */; + ch->data = malloc(ch->size, M_HDSPE, M_NOWAIT); + + ch->buffer = b; + ch->channel = c; + ch->parent = scp; + + ch->dir = dir; + + snd_mtxunlock(sc->lock); + + if (sndbuf_setup(ch->buffer, ch->data, ch->size) != 0) { + device_printf(scp->dev, "Can't setup sndbuf.\n"); + return NULL; + } + + return ch; +} + +static int +hdspechan_trigger(kobj_t obj, void *data, int go) +{ + struct sc_chinfo *ch = data; + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + + snd_mtxlock(sc->lock); + switch (go) { + case PCMTRIG_START: +#if 0 + device_printf(scp->dev, "hdspechan_trigger(): start\n"); +#endif + hdspechan_enable(ch, 1); + hdspechan_setgain(ch); + hdspe_start_audio(sc); + break; + + case PCMTRIG_STOP: + case PCMTRIG_ABORT: +#if 0 + device_printf(scp->dev, "hdspechan_trigger(): stop or abort\n"); +#endif + clean(ch); + hdspechan_enable(ch, 0); + hdspe_stop_audio(sc); + break; + + case PCMTRIG_EMLDMAWR: + case PCMTRIG_EMLDMARD: + if(ch->run) + buffer_copy(ch); + break; + } + + snd_mtxunlock(sc->lock); + + return 0; +} + +static uint32_t +hdspechan_getptr(kobj_t obj, void *data) +{ + struct sc_chinfo *ch = data; + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + uint32_t ret, pos; + + snd_mtxlock(sc->lock); + ret = hdspe_read_2(sc, HDSPE_STATUS_REG); + snd_mtxunlock(sc->lock); + + pos = ret & HDSPE_BUF_POSITION_MASK; + pos *= 2; /* Hardbuf twice bigger. */ + + return pos; +} + +static int +hdspechan_free(kobj_t obj, void *data) +{ + struct sc_chinfo *ch = data; + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + +#if 0 + device_printf(scp->dev, "hdspechan_free()\n"); +#endif + snd_mtxlock(sc->lock); + if (ch->data != NULL) { + free(ch->data, M_HDSPE); + ch->data = NULL; + } + snd_mtxunlock(sc->lock); + + return 0; +} + +static int +hdspechan_setformat(kobj_t obj, void *data, uint32_t format) +{ + struct sc_chinfo *ch = data; + +#if 0 + struct sc_pcminfo *scp = ch->parent; + device_printf(scp->dev, "hdspechan_setformat(%d)\n", format); +#endif + + ch->format = format; + + return 0; +} + +static uint32_t +hdspechan_setspeed(kobj_t obj, void *data, uint32_t speed) +{ + struct sc_chinfo *ch = data; + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + struct hdspe_rate *hr = NULL; + long long period; + int threshold; + int i; + +#if 0 + device_printf(scp->dev, "hdspechan_setspeed(%d)\n", speed); +#endif + + if (hdspe_running(sc) == 1) + goto end; + + /* First look for equal frequency. */ + for (i = 0; rate_map[i].speed != 0; i++) { + if (rate_map[i].speed == speed) + hr = &rate_map[i]; + } + + /* If no match, just find nearest. */ + if (hr == NULL) { + for (i = 0; rate_map[i].speed != 0; i++) { + hr = &rate_map[i]; + threshold = hr->speed + ((rate_map[i + 1].speed != 0) ? + ((rate_map[i + 1].speed - hr->speed) >> 1) : 0); + if (speed < threshold) + break; + } + } + + switch (sc->type) { + case RAYDAT: + case AIO: + period = HDSPE_FREQ_AIO; + break; + default: + /* Unsupported card. */ + goto end; + } + + /* Write frequency on the device. */ + sc->ctrl_register &= ~HDSPE_FREQ_MASK; + sc->ctrl_register |= hr->reg; + hdspe_write_4(sc, HDSPE_CONTROL_REG, sc->ctrl_register); + + speed = hr->speed; + if (speed > 96000) + speed /= 4; + else if (speed > 48000) + speed /= 2; + + /* Set DDS value. */ + period /= speed; + hdspe_write_4(sc, HDSPE_FREQ_REG, period); + + sc->speed = hr->speed; +end: + return sc->speed; +} + +static uint32_t +hdspechan_setblocksize(kobj_t obj, void *data, uint32_t blocksize) +{ + struct sc_chinfo *ch = data; + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + struct hdspe_latency *hl = NULL; + int threshold; + int i; + +#if 0 + device_printf(scp->dev, "hdspechan_setblocksize(%d)\n", blocksize); +#endif + + if (hdspe_running(sc) == 1) + goto end; + + if (blocksize > HDSPE_LAT_BYTES_MAX) + blocksize = HDSPE_LAT_BYTES_MAX; + else if (blocksize < HDSPE_LAT_BYTES_MIN) + blocksize = HDSPE_LAT_BYTES_MIN; + + blocksize /= 4 /* samples */; + + /* First look for equal latency. */ + for (i = 0; latency_map[i].period != 0; i++) { + if (latency_map[i].period == blocksize) { + hl = &latency_map[i]; + } + } + + /* If no match, just find nearest. */ + if (hl == NULL) { + for (i = 0; latency_map[i].period != 0; i++) { + hl = &latency_map[i]; + threshold = hl->period + ((latency_map[i + 1].period != 0) ? + ((latency_map[i + 1].period - hl->period) >> 1) : 0); + if (blocksize < threshold) + break; + } + } + + snd_mtxlock(sc->lock); + sc->ctrl_register &= ~HDSPE_LAT_MASK; + sc->ctrl_register |= hdspe_encode_latency(hl->n); + hdspe_write_4(sc, HDSPE_CONTROL_REG, sc->ctrl_register); + sc->period = hl->period; + snd_mtxunlock(sc->lock); + +#if 0 + device_printf(scp->dev, "New period=%d\n", sc->period); +#endif + + sndbuf_resize(ch->buffer, (HDSPE_CHANBUF_SIZE * 2) / (sc->period * 4), + (sc->period * 4)); +end: + return sndbuf_getblksz(ch->buffer); +} + +static uint32_t hdspe_rfmt[] = { + SND_FORMAT(AFMT_S32_LE, 2, 0), + 0 +}; + +static struct pcmchan_caps hdspe_rcaps = {32000, 192000, hdspe_rfmt, 0}; + +static uint32_t hdspe_pfmt[] = { + SND_FORMAT(AFMT_S32_LE, 2, 0), + 0 +}; + +static struct pcmchan_caps hdspe_pcaps = {32000, 192000, hdspe_pfmt, 0}; + +static struct pcmchan_caps * +hdspechan_getcaps(kobj_t obj, void *data) +{ + struct sc_chinfo *ch = data; + +#if 0 + struct sc_pcminfo *scl = ch->parent; + device_printf(scp->dev, "hdspechan_getcaps()\n"); +#endif + + return (ch->dir == PCMDIR_PLAY) ? + &hdspe_pcaps : &hdspe_rcaps; +} + +static kobj_method_t hdspechan_methods[] = { + KOBJMETHOD(channel_init, hdspechan_init), + KOBJMETHOD(channel_free, hdspechan_free), + KOBJMETHOD(channel_setformat, hdspechan_setformat), + KOBJMETHOD(channel_setspeed, hdspechan_setspeed), + KOBJMETHOD(channel_setblocksize, hdspechan_setblocksize), + KOBJMETHOD(channel_trigger, hdspechan_trigger), + KOBJMETHOD(channel_getptr, hdspechan_getptr), + KOBJMETHOD(channel_getcaps, hdspechan_getcaps), + KOBJMETHOD_END +}; +CHANNEL_DECLARE(hdspechan); + + +static int +hdspe_pcm_probe(device_t dev) +{ + +#if 0 + device_printf(dev,"hdspe_pcm_probe()\n"); +#endif + + return 0; +} + +static uint32_t +hdspe_pcm_intr(struct sc_pcminfo *scp) { + struct sc_chinfo *ch; + struct sc_info *sc = scp->sc; + int i; + + for (i = 0; i < scp->chnum; i++) { + ch = &scp->chan[i]; + snd_mtxunlock(sc->lock); + chn_intr(ch->channel); + snd_mtxlock(sc->lock); + } + + return 0; +} + +static int +hdspe_pcm_attach(device_t dev) +{ + struct sc_pcminfo *scp; + char status[SND_STATUSLEN]; + char desc[64]; + int i, err; + + scp = device_get_ivars(dev); + scp->ih = &hdspe_pcm_intr; + + bzero(desc, sizeof(desc)); + snprintf(desc, sizeof(desc), "HDSPe AIO [%s]", scp->hc->descr); + device_set_desc_copy(dev, desc); + + /* + * We don't register interrupt handler with snd_setup_intr + * in pcm device. Mark pcm device as MPSAFE manually. + */ + pcm_setflags(dev, pcm_getflags(dev) | SD_F_MPSAFE); + + err = pcm_register(dev, scp, scp->hc->play, scp->hc->rec); + if (err) { + device_printf(dev, "Can't register pcm.\n"); + return ENXIO; + } + + scp->chnum = 0; + for (i = 0; i < scp->hc->play; i++) { + pcm_addchan(dev, PCMDIR_PLAY, &hdspechan_class, scp); + scp->chnum++; + } + + for (i = 0; i < scp->hc->rec; i++) { + pcm_addchan(dev, PCMDIR_REC, &hdspechan_class, scp); + scp->chnum++; + } + + snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld %s", + rman_get_start(scp->sc->cs), + rman_get_start(scp->sc->irq), + PCM_KLDSTRING(snd_hdspe)); + pcm_setstatus(dev, status); + + mixer_init(dev, &hdspemixer_class, scp); + + return 0; +} + +static int +hdspe_pcm_detach(device_t dev) +{ + int err; + + err = pcm_unregister(dev); + if (err) { + device_printf(dev, "Can't unregister device.\n"); + return err; + } + + return 0; +} + +static device_method_t hdspe_pcm_methods[] = { + DEVMETHOD(device_probe, hdspe_pcm_probe), + DEVMETHOD(device_attach, hdspe_pcm_attach), + DEVMETHOD(device_detach, hdspe_pcm_detach), + { 0, 0 } +}; + +static driver_t hdspe_pcm_driver = { + "pcm", + hdspe_pcm_methods, + PCM_SOFTC_SIZE, +}; + +DRIVER_MODULE(snd_hdspe_pcm, hdspe, hdspe_pcm_driver, pcm_devclass, 0, 0); +MODULE_DEPEND(snd_hdspe, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); +MODULE_VERSION(snd_hdspe, 1); Copied: stable/9/sys/dev/sound/pci/hdspe.c (from r232337, head/sys/dev/sound/pci/hdspe.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/sound/pci/hdspe.c Mon Mar 19 07:34:09 2012 (r233165, copy of r232337, head/sys/dev/sound/pci/hdspe.c) @@ -0,0 +1,410 @@ +/*- + * Copyright (c) 2012 Ruslan Bukin + * All rights reserved. + * + * 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 AUTHOR 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 AUTHOR 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. + */ + +/* + * RME HDSPe driver for FreeBSD. + * Supported cards: AIO, RayDAT. + */ + +#include +#include +#include + +#include +#include + +#include + +SND_DECLARE_FILE("$FreeBSD$"); + +static struct hdspe_channel chan_map_aio[] = { + { 0, 1, "line", 1, 1 }, + { 6, 7, "phone", 1, 0 }, + { 8, 9, "aes", 1, 1 }, + { 10, 11, "s/pdif", 1, 1 }, + { 12, 16, "adat", 1, 1 }, + + /* Single or double speed. */ + { 14, 18, "adat", 1, 1 }, + + /* Single speed only. */ + { 13, 15, "adat", 1, 1 }, + { 17, 19, "adat", 1, 1 }, + + { 0, 0, NULL, 0, 0 }, +}; + +static struct hdspe_channel chan_map_rd[] = { + { 0, 1, "aes", 1, 1 }, + { 2, 3, "s/pdif", 1, 1 }, + { 4, 5, "adat", 1, 1 }, + { 6, 7, "adat", 1, 1 }, + { 8, 9, "adat", 1, 1 }, + { 10, 11, "adat", 1, 1 }, + + /* Single or double speed. */ + { 12, 13, "adat", 1, 1 }, + { 14, 15, "adat", 1, 1 }, + { 16, 17, "adat", 1, 1 }, + { 18, 19, "adat", 1, 1 }, + + /* Single speed only. */ + { 20, 21, "adat", 1, 1 }, + { 22, 23, "adat", 1, 1 }, + { 24, 25, "adat", 1, 1 }, + { 26, 27, "adat", 1, 1 }, + { 28, 29, "adat", 1, 1 }, + { 30, 31, "adat", 1, 1 }, + { 32, 33, "adat", 1, 1 }, + { 34, 35, "adat", 1, 1 }, + + { 0, 0, NULL, 0, 0 }, +}; + +static void +hdspe_intr(void *p) +{ + struct sc_info *sc = (struct sc_info *)p; + struct sc_pcminfo *scp; + device_t *devlist; + int devcount, status; + int i, err; + + snd_mtxlock(sc->lock); + + status = hdspe_read_1(sc, HDSPE_STATUS_REG); + if (status & HDSPE_AUDIO_IRQ_PENDING) { + if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) + return; + + for (i = 0; i < devcount; i++) { + scp = device_get_ivars(devlist[i]); + if (scp->ih != NULL) + scp->ih(scp); + } + + hdspe_write_1(sc, HDSPE_INTERRUPT_ACK, 0); + } + + snd_mtxunlock(sc->lock); +} + +static void +hdspe_dmapsetmap(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ +#if 0 + struct sc_info *sc = (struct sc_info *)arg; + device_printf(sc->dev, "hdspe_dmapsetmap()\n"); +#endif +} + +static int +hdspe_alloc_resources(struct sc_info *sc) +{ + + /* Allocate resource. */ + sc->csid = PCIR_BAR(0); + sc->cs = bus_alloc_resource(sc->dev, SYS_RES_MEMORY, + &sc->csid, 0, ~0, 1, RF_ACTIVE); + + if (!sc->cs) { + device_printf(sc->dev, "Unable to map SYS_RES_MEMORY.\n"); + return (ENXIO); + } + sc->cst = rman_get_bustag(sc->cs); + sc->csh = rman_get_bushandle(sc->cs); + + + /* Allocate interrupt resource. */ + sc->irqid = 0; + sc->irq = bus_alloc_resource(sc->dev, SYS_RES_IRQ, &sc->irqid, + 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE); + + if (!sc->irq || + bus_setup_intr(sc->dev, sc->irq, INTR_MPSAFE | INTR_TYPE_AV, + NULL, hdspe_intr, sc, &sc->ih)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 08:10:24 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A808106564A; Mon, 19 Mar 2012 08:10:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73CFF8FC16; Mon, 19 Mar 2012 08:10:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J8AO2e058320; Mon, 19 Mar 2012 08:10:24 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J8AON4058317; Mon, 19 Mar 2012 08:10:24 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201203190810.q2J8AON4058317@svn.freebsd.org> From: Dimitry Andric Date: Mon, 19 Mar 2012 08:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233166 - in stable/9: contrib/llvm/tools/clang/lib/Basic sys/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 08:10:24 -0000 Author: dim Date: Mon Mar 19 08:10:23 2012 New Revision: 233166 URL: http://svn.freebsd.org/changeset/base/233166 Log: MFC r232894: Pull in r145194 from upstream clang trunk: Make our handling of MMX x SSE closer to what gcc does: * Enabling sse enables mmx. * Disabling (-mno-mmx) mmx, doesn't disable sse (we got this right already). * The order in not important. -msse -mno-mmx is the same as -mno-mmx -msse. Some configure scripts depend on this. PR: i386/165968 MFC r232933: Update comments and CFLAGS in sys/conf/kern.mk, introduced in r221879, to match reality: clang does _not_ disable SSE automatically when -mno-mmx is used, you have to specify -mno-sse explicitly. Note this was the case even before r232894, which only makes a change in the 'positive' flag case; e.g. when you specify -msse, MMX gets enabled too. Modified: stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp stable/9/sys/conf/kern.mk Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Mon Mar 19 07:34:09 2012 (r233165) +++ stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Mon Mar 19 08:10:23 2012 (r233166) @@ -1583,23 +1583,26 @@ bool X86TargetInfo::setFeatureEnabled(ll (Name != "sse4" && Name != "sse4.2" && Name != "sse4.1")) return false; + // FIXME: this should probably use a switch with fall through. + if (Enabled) { if (Name == "mmx") Features["mmx"] = true; else if (Name == "sse") - Features["sse"] = true; + Features["mmx"] = Features["sse"] = true; else if (Name == "sse2") - Features["sse"] = Features["sse2"] = true; + Features["mmx"] = Features["sse"] = Features["sse2"] = true; else if (Name == "sse3") - Features["sse"] = Features["sse2"] = Features["sse3"] = true; + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = + true; else if (Name == "ssse3") - Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = Features["ssse3"] = true; else if (Name == "sse4" || Name == "sse4.2") - Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = Features["ssse3"] = Features["sse41"] = Features["sse42"] = true; else if (Name == "sse4.1") - Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = Features["ssse3"] = Features["sse41"] = true; else if (Name == "3dnow") Features["mmx"] = Features["3dnow"] = true; @@ -1608,10 +1611,11 @@ bool X86TargetInfo::setFeatureEnabled(ll else if (Name == "aes") Features["aes"] = true; else if (Name == "avx") - Features["avx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = - Features["ssse3"] = Features["sse41"] = Features["sse42"] = true; + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["ssse3"] = Features["sse41"] = Features["sse42"] = + Features["avx"] = true; else if (Name == "sse4a") - Features["sse4a"] = true; + Features["mmx"] = Features["sse4a"] = true; } else { if (Name == "mmx") Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = false; @@ -3779,13 +3783,32 @@ TargetInfo *TargetInfo::CreateTargetInfo Target->getDefaultFeatures(Features); // Apply the user specified deltas. + // First the enables. for (std::vector::const_iterator it = Opts.Features.begin(), ie = Opts.Features.end(); it != ie; ++it) { const char *Name = it->c_str(); + if (Name[0] != '+') + continue; + + // Apply the feature via the target. + if (!Target->setFeatureEnabled(Features, Name + 1, true)) { + Diags.Report(diag::err_target_invalid_feature) << Name; + return 0; + } + } + + // Then the disables. + for (std::vector::const_iterator it = Opts.Features.begin(), + ie = Opts.Features.end(); it != ie; ++it) { + const char *Name = it->c_str(); + + if (Name[0] == '+') + continue; + // Apply the feature via the target. - if ((Name[0] != '-' && Name[0] != '+') || - !Target->setFeatureEnabled(Features, Name + 1, (Name[0] == '+'))) { + if (Name[0] != '-' || + !Target->setFeatureEnabled(Features, Name + 1, false)) { Diags.Report(diag::err_target_invalid_feature) << Name; return 0; } Modified: stable/9/sys/conf/kern.mk ============================================================================== --- stable/9/sys/conf/kern.mk Mon Mar 19 07:34:09 2012 (r233165) +++ stable/9/sys/conf/kern.mk Mon Mar 19 08:10:23 2012 (r233166) @@ -46,16 +46,16 @@ CWARNEXTRA?= -Wno-error-tautological-com # Setting -mno-sse implies -mno-sse2, -mno-sse3 and -mno-ssse3 # # clang: -# Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2, -# -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 +# Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa +# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 # .if ${MACHINE_CPUARCH} == "i386" .if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" -CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse +CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 .else CFLAGS+= -mno-aes -mno-avx .endif -CFLAGS+= -mno-mmx -msoft-float +CFLAGS+= -mno-mmx -mno-sse -msoft-float INLINE_LIMIT?= 8000 .endif @@ -93,17 +93,15 @@ INLINE_LIMIT?= 15000 # Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387 # # clang: -# Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2, -# -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 +# Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa +# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 # (-mfpmath= is not supported) # .if ${MACHINE_CPUARCH} == "amd64" -.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" -CFLAGS+= -mno-sse -.else +.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" CFLAGS+= -mno-aes -mno-avx .endif -CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float \ +CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float \ -fno-asynchronous-unwind-tables INLINE_LIMIT?= 8000 .endif From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 10:04:45 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA3721065673; Mon, 19 Mar 2012 10:04:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 974618FC1A; Mon, 19 Mar 2012 10:04:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JA4j1p062019; Mon, 19 Mar 2012 10:04:45 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JA4jKe062017; Mon, 19 Mar 2012 10:04:45 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203191004.q2JA4jKe062017@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 19 Mar 2012 10:04:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233169 - stable/9/sys/fs/pseudofs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 10:04:45 -0000 Author: kib Date: Mon Mar 19 10:04:45 2012 New Revision: 233169 URL: http://svn.freebsd.org/changeset/base/233169 Log: MFC r232541: Apply inlined vn_vget_ino() algorithm for ".." lookup in pseudofs. Modified: stable/9/sys/fs/pseudofs/pseudofs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- stable/9/sys/fs/pseudofs/pseudofs_vnops.c Mon Mar 19 09:34:22 2012 (r233168) +++ stable/9/sys/fs/pseudofs/pseudofs_vnops.c Mon Mar 19 10:04:45 2012 (r233169) @@ -432,6 +432,7 @@ pfs_lookup(struct vop_cachedlookup_args struct pfs_vdata *pvd = vn->v_data; struct pfs_node *pd = pvd->pvd_pn; struct pfs_node *pn, *pdn = NULL; + struct mount *mp; pid_t pid = pvd->pvd_pid; char *pname; int error, i, namelen, visible; @@ -474,10 +475,26 @@ pfs_lookup(struct vop_cachedlookup_args PFS_RETURN (0); } + mp = vn->v_mount; + /* parent */ if (cnp->cn_flags & ISDOTDOT) { if (pd->pn_type == pfstype_root) PFS_RETURN (EIO); + error = vfs_busy(mp, MBF_NOWAIT); + if (error != 0) { + vfs_ref(mp); + VOP_UNLOCK(vn, 0); + error = vfs_busy(mp, 0); + vn_lock(vn, LK_EXCLUSIVE | LK_RETRY); + vfs_rel(mp); + if (error != 0) + PFS_RETURN(ENOENT); + if (vn->v_iflag & VI_DOOMED) { + vfs_unbusy(mp); + PFS_RETURN(ENOENT); + } + } VOP_UNLOCK(vn, 0); KASSERT(pd->pn_parent != NULL, ("%s(): non-root directory has no parent", __func__)); @@ -535,18 +552,28 @@ pfs_lookup(struct vop_cachedlookup_args goto failed; } - error = pfs_vncache_alloc(vn->v_mount, vpp, pn, pid); + error = pfs_vncache_alloc(mp, vpp, pn, pid); if (error) goto failed; - if (cnp->cn_flags & ISDOTDOT) - vn_lock(vn, LK_EXCLUSIVE|LK_RETRY); + if (cnp->cn_flags & ISDOTDOT) { + vfs_unbusy(mp); + vn_lock(vn, LK_EXCLUSIVE | LK_RETRY); + if (vn->v_iflag & VI_DOOMED) { + vput(*vpp); + *vpp = NULL; + PFS_RETURN(ENOENT); + } + } if (cnp->cn_flags & MAKEENTRY && !(vn->v_iflag & VI_DOOMED)) cache_enter(vn, *vpp, cnp); PFS_RETURN (0); failed: - if (cnp->cn_flags & ISDOTDOT) - vn_lock(vn, LK_EXCLUSIVE|LK_RETRY); + if (cnp->cn_flags & ISDOTDOT) { + vfs_unbusy(mp); + vn_lock(vn, LK_EXCLUSIVE | LK_RETRY); + *vpp = NULL; + } PFS_RETURN(error); } From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 10:06:23 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 462AD106566B; Mon, 19 Mar 2012 10:06:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 310808FC12; Mon, 19 Mar 2012 10:06:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JA6Nff062126; Mon, 19 Mar 2012 10:06:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JA6M10062124; Mon, 19 Mar 2012 10:06:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203191006.q2JA6M10062124@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 19 Mar 2012 10:06:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233170 - stable/9/libexec/rtld-elf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 10:06:23 -0000 Author: kib Date: Mon Mar 19 10:06:22 2012 New Revision: 233170 URL: http://svn.freebsd.org/changeset/base/233170 Log: MFC r233041: Remove write-only variable. Modified: stable/9/libexec/rtld-elf/map_object.c Directory Properties: stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/libexec/rtld-elf/map_object.c ============================================================================== --- stable/9/libexec/rtld-elf/map_object.c Mon Mar 19 10:04:45 2012 (r233169) +++ stable/9/libexec/rtld-elf/map_object.c Mon Mar 19 10:06:22 2012 (r233170) @@ -65,7 +65,6 @@ map_object(int fd, const char *path, con Elf_Phdr *phtls; caddr_t mapbase; size_t mapsize; - Elf_Off base_offset; Elf_Addr base_vaddr; Elf_Addr base_vlimit; caddr_t base_addr; @@ -161,7 +160,6 @@ map_object(int fd, const char *path, con * Map the entire address space of the object, to stake out our * contiguous region, and to establish the base address for relocation. */ - base_offset = trunc_page(segs[0]->p_offset); base_vaddr = trunc_page(segs[0]->p_vaddr); base_vlimit = round_page(segs[nsegs]->p_vaddr + segs[nsegs]->p_memsz); mapsize = base_vlimit - base_vaddr; From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 11:27:55 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 43304106566C; Mon, 19 Mar 2012 11:27:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13BBF8FC16; Mon, 19 Mar 2012 11:27:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JBRsOf066349; Mon, 19 Mar 2012 11:27:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JBRsDP066347; Mon, 19 Mar 2012 11:27:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203191127.q2JBRsDP066347@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 19 Mar 2012 11:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233171 - stable/8/sys/fs/pseudofs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 11:27:55 -0000 Author: kib Date: Mon Mar 19 11:27:54 2012 New Revision: 233171 URL: http://svn.freebsd.org/changeset/base/233171 Log: MFC r232541: Apply inlined vn_vget_ino() algorithm for ".." lookup in pseudofs. Modified: stable/8/sys/fs/pseudofs/pseudofs_vnops.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- stable/8/sys/fs/pseudofs/pseudofs_vnops.c Mon Mar 19 10:06:22 2012 (r233170) +++ stable/8/sys/fs/pseudofs/pseudofs_vnops.c Mon Mar 19 11:27:54 2012 (r233171) @@ -433,6 +433,7 @@ pfs_lookup(struct vop_cachedlookup_args struct pfs_vdata *pvd = vn->v_data; struct pfs_node *pd = pvd->pvd_pn; struct pfs_node *pn, *pdn = NULL; + struct mount *mp; pid_t pid = pvd->pvd_pid; char *pname; int error, i, namelen, visible; @@ -475,10 +476,26 @@ pfs_lookup(struct vop_cachedlookup_args PFS_RETURN (0); } + mp = vn->v_mount; + /* parent */ if (cnp->cn_flags & ISDOTDOT) { if (pd->pn_type == pfstype_root) PFS_RETURN (EIO); + error = vfs_busy(mp, MBF_NOWAIT); + if (error != 0) { + vfs_ref(mp); + VOP_UNLOCK(vn, 0); + error = vfs_busy(mp, 0); + vn_lock(vn, LK_EXCLUSIVE | LK_RETRY); + vfs_rel(mp); + if (error != 0) + PFS_RETURN(ENOENT); + if (vn->v_iflag & VI_DOOMED) { + vfs_unbusy(mp); + PFS_RETURN(ENOENT); + } + } VOP_UNLOCK(vn, 0); KASSERT(pd->pn_parent != NULL, ("%s(): non-root directory has no parent", __func__)); @@ -536,18 +553,28 @@ pfs_lookup(struct vop_cachedlookup_args goto failed; } - error = pfs_vncache_alloc(vn->v_mount, vpp, pn, pid); + error = pfs_vncache_alloc(mp, vpp, pn, pid); if (error) goto failed; - if (cnp->cn_flags & ISDOTDOT) - vn_lock(vn, LK_EXCLUSIVE|LK_RETRY); + if (cnp->cn_flags & ISDOTDOT) { + vfs_unbusy(mp); + vn_lock(vn, LK_EXCLUSIVE | LK_RETRY); + if (vn->v_iflag & VI_DOOMED) { + vput(*vpp); + *vpp = NULL; + PFS_RETURN(ENOENT); + } + } if (cnp->cn_flags & MAKEENTRY && !(vn->v_iflag & VI_DOOMED)) cache_enter(vn, *vpp, cnp); PFS_RETURN (0); failed: - if (cnp->cn_flags & ISDOTDOT) - vn_lock(vn, LK_EXCLUSIVE|LK_RETRY); + if (cnp->cn_flags & ISDOTDOT) { + vfs_unbusy(mp); + vn_lock(vn, LK_EXCLUSIVE | LK_RETRY); + *vpp = NULL; + } PFS_RETURN(error); } From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 11:32:43 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06A34106564A; Mon, 19 Mar 2012 11:32:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E53C38FC18; Mon, 19 Mar 2012 11:32:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JBWg3P066552; Mon, 19 Mar 2012 11:32:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JBWgR8066550; Mon, 19 Mar 2012 11:32:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203191132.q2JBWgR8066550@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 19 Mar 2012 11:32:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233172 - stable/8/libexec/rtld-elf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 11:32:43 -0000 Author: kib Date: Mon Mar 19 11:32:42 2012 New Revision: 233172 URL: http://svn.freebsd.org/changeset/base/233172 Log: MFC r233041: Remove write-only variable. Modified: stable/8/libexec/rtld-elf/map_object.c Directory Properties: stable/8/libexec/rtld-elf/ (props changed) Modified: stable/8/libexec/rtld-elf/map_object.c ============================================================================== --- stable/8/libexec/rtld-elf/map_object.c Mon Mar 19 11:27:54 2012 (r233171) +++ stable/8/libexec/rtld-elf/map_object.c Mon Mar 19 11:32:42 2012 (r233172) @@ -65,7 +65,6 @@ map_object(int fd, const char *path, con Elf_Phdr *phtls; caddr_t mapbase; size_t mapsize; - Elf_Off base_offset; Elf_Addr base_vaddr; Elf_Addr base_vlimit; caddr_t base_addr; @@ -146,7 +145,6 @@ map_object(int fd, const char *path, con * Map the entire address space of the object, to stake out our * contiguous region, and to establish the base address for relocation. */ - base_offset = trunc_page(segs[0]->p_offset); base_vaddr = trunc_page(segs[0]->p_vaddr); base_vlimit = round_page(segs[nsegs]->p_vaddr + segs[nsegs]->p_memsz); mapsize = base_vlimit - base_vaddr; From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 13:19:02 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F194D1065673; Mon, 19 Mar 2012 13:19:02 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC0958FC1E; Mon, 19 Mar 2012 13:19:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JDJ2av070198; Mon, 19 Mar 2012 13:19:02 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JDJ22p070195; Mon, 19 Mar 2012 13:19:02 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203191319.q2JDJ22p070195@svn.freebsd.org> From: Ken Smith Date: Mon, 19 Mar 2012 13:19:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233180 - stable/8/release X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 13:19:03 -0000 Author: kensmith Date: Mon Mar 19 13:19:02 2012 New Revision: 233180 URL: http://svn.freebsd.org/changeset/base/233180 Log: Bump the version of perl used as part of the release build from 5.10 to 5.12. Modified: stable/8/release/Makefile stable/8/release/Makefile.inc.docports Modified: stable/8/release/Makefile ============================================================================== --- stable/8/release/Makefile Mon Mar 19 13:17:47 2012 (r233179) +++ stable/8/release/Makefile Mon Mar 19 13:19:02 2012 (r233180) @@ -171,7 +171,7 @@ NOPORTSATALL= YES # # Doing 'make index' in /usr/ports requires Perl. -MAKEINDEXPORTS= lang/perl5.10 +MAKEINDEXPORTS= lang/perl5.12 DOCPORTS= textproc/docproj # Set this to wherever the distfiles required by release procedures. .if defined(DOCDISTFILES) Modified: stable/8/release/Makefile.inc.docports ============================================================================== --- stable/8/release/Makefile.inc.docports Mon Mar 19 13:17:47 2012 (r233179) +++ stable/8/release/Makefile.inc.docports Mon Mar 19 13:19:02 2012 (r233180) @@ -81,5 +81,5 @@ MINIMALDOCPORTS+= \ ports/textproc/p5-PodParser .else MINIMALDOCPORTS+= \ - ports/lang/perl5.10 + ports/lang/perl5.12 .endif From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 20:15:19 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1699410656FE; Mon, 19 Mar 2012 20:15:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBDCA8FC0A; Mon, 19 Mar 2012 20:15:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JKFI53084482; Mon, 19 Mar 2012 20:15:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JKFItl084480; Mon, 19 Mar 2012 20:15:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203192015.q2JKFItl084480@svn.freebsd.org> From: John Baldwin Date: Mon, 19 Mar 2012 20:15:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233199 - in stable/8/sys: i386/conf netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 20:15:19 -0000 Author: jhb Date: Mon Mar 19 20:15:18 2012 New Revision: 233199 URL: http://svn.freebsd.org/changeset/base/233199 Log: MFC 225096: Fix if_addr_mtx recursion in mld6. mld_set_version() is called only from mld_v1_input_query() and mld_v2_input_query() both holding the if_addr_mtx lock, and then calling into mld_v2_cancel_link_timers() acquires it the second time, which results in mtx recursion. To avoid that, delay if_addr_mtx acquisition until after mld_set_version() is called; while here, further reduce locking scope to protect only the needed pieces: if_multiaddrs, in6m_lookup_locked(). Modified: stable/8/sys/netinet6/mld6.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/netinet6/mld6.c ============================================================================== --- stable/8/sys/netinet6/mld6.c Mon Mar 19 19:53:53 2012 (r233198) +++ stable/8/sys/netinet6/mld6.c Mon Mar 19 20:15:18 2012 (r233199) @@ -681,7 +681,6 @@ mld_v1_input_query(struct ifnet *ifp, co IN6_MULTI_LOCK(); MLD_LOCK(); - IF_ADDR_LOCK(ifp); /* * Switch to MLDv1 host compatibility mode. @@ -694,6 +693,7 @@ mld_v1_input_query(struct ifnet *ifp, co if (timer == 0) timer = 1; + IF_ADDR_LOCK(ifp); if (is_general_query) { /* * For each reporting group joined on this @@ -889,7 +889,6 @@ mld_v2_input_query(struct ifnet *ifp, co IN6_MULTI_LOCK(); MLD_LOCK(); - IF_ADDR_LOCK(ifp); mli = MLD_IFINFO(ifp); KASSERT(mli != NULL, ("%s: no mld_ifinfo for ifp %p", __func__, ifp)); @@ -937,14 +936,18 @@ mld_v2_input_query(struct ifnet *ifp, co * Queries for groups we are not a member of on this * link are simply ignored. */ + IF_ADDR_LOCK(ifp); inm = in6m_lookup_locked(ifp, &mld->mld_addr); - if (inm == NULL) + if (inm == NULL) { + IF_ADDR_UNLOCK(ifp); goto out_locked; + } if (nsrc > 0) { if (!ratecheck(&inm->in6m_lastgsrtv, &V_mld_gsrdelay)) { CTR1(KTR_MLD, "%s: GS query throttled.", __func__); + IF_ADDR_UNLOCK(ifp); goto out_locked; } } @@ -962,10 +965,10 @@ mld_v2_input_query(struct ifnet *ifp, co /* XXX Clear embedded scope ID as userland won't expect it. */ in6_clearscope(&mld->mld_addr); + IF_ADDR_UNLOCK(ifp); } out_locked: - IF_ADDR_UNLOCK(ifp); MLD_UNLOCK(); IN6_MULTI_UNLOCK(); From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 20:49:17 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8389D106566B; Mon, 19 Mar 2012 20:49:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C44C8FC0C; Mon, 19 Mar 2012 20:49:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JKnHPH085610; Mon, 19 Mar 2012 20:49:17 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JKnHK5085596; Mon, 19 Mar 2012 20:49:17 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203192049.q2JKnHK5085596@svn.freebsd.org> From: John Baldwin Date: Mon, 19 Mar 2012 20:49:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233200 - in stable/9/sys: i386/conf kern net netatalk netinet netinet6 netipx X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 20:49:17 -0000 Author: jhb Date: Mon Mar 19 20:49:16 2012 New Revision: 233200 URL: http://svn.freebsd.org/changeset/base/233200 Log: MFC 229621: Convert all users of IF_ADDR_LOCK to use new locking macros that specify either a read lock or write lock. Modified: stable/9/sys/kern/kern_uuid.c stable/9/sys/net/if.c stable/9/sys/net/rtsock.c stable/9/sys/netatalk/aarp.c stable/9/sys/netatalk/at_control.c stable/9/sys/netinet/if_ether.c stable/9/sys/netinet/igmp.c stable/9/sys/netinet/in.c stable/9/sys/netinet/in_mcast.c stable/9/sys/netinet/in_pcb.c stable/9/sys/netinet/in_var.h stable/9/sys/netinet/ip_carp.c stable/9/sys/netinet/ip_icmp.c stable/9/sys/netinet/ip_input.c stable/9/sys/netinet/sctp_bsd_addr.c stable/9/sys/netinet6/icmp6.c stable/9/sys/netinet6/in6.c stable/9/sys/netinet6/in6_ifattach.c stable/9/sys/netinet6/in6_mcast.c stable/9/sys/netinet6/in6_var.h stable/9/sys/netinet6/ip6_input.c stable/9/sys/netinet6/mld6.c stable/9/sys/netinet6/nd6.c stable/9/sys/netinet6/nd6_rtr.c stable/9/sys/netipx/ipx.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/kern/kern_uuid.c ============================================================================== --- stable/9/sys/kern/kern_uuid.c Mon Mar 19 20:15:18 2012 (r233199) +++ stable/9/sys/kern/kern_uuid.c Mon Mar 19 20:49:16 2012 (r233200) @@ -98,20 +98,20 @@ uuid_node(uint16_t *node) IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* Walk the address list */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sdl = (struct sockaddr_dl*)ifa->ifa_addr; if (sdl != NULL && sdl->sdl_family == AF_LINK && sdl->sdl_type == IFT_ETHER) { /* Got a MAC address. */ bcopy(LLADDR(sdl), node, UUID_NODE_LEN); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); IFNET_RUNLOCK_NOSLEEP(); CURVNET_RESTORE(); return; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } IFNET_RUNLOCK_NOSLEEP(); Modified: stable/9/sys/net/if.c ============================================================================== --- stable/9/sys/net/if.c Mon Mar 19 20:15:18 2012 (r233199) +++ stable/9/sys/net/if.c Mon Mar 19 20:49:16 2012 (r233200) @@ -802,10 +802,10 @@ if_purgemaddrs(struct ifnet *ifp) struct ifmultiaddr *ifma; struct ifmultiaddr *next; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) if_delmulti_locked(ifp, ifma, 1); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } /* @@ -1149,10 +1149,10 @@ if_addgroup(struct ifnet *ifp, const cha ifgl->ifgl_group = ifg; ifgm->ifgm_ifp = ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifg->ifg_members, ifgm, ifgm_next); TAILQ_INSERT_TAIL(&ifp->if_groups, ifgl, ifgl_next); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); IFNET_WUNLOCK(); @@ -1179,9 +1179,9 @@ if_delgroup(struct ifnet *ifp, const cha return (ENOENT); } - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_groups, ifgl, ifgl_next); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); TAILQ_FOREACH(ifgm, &ifgl->ifgl_group->ifg_members, ifgm_next) if (ifgm->ifgm_ifp == ifp) @@ -1222,9 +1222,9 @@ if_delgroups(struct ifnet *ifp) strlcpy(groupname, ifgl->ifgl_group->ifg_group, IFNAMSIZ); - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_groups, ifgl, ifgl_next); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); TAILQ_FOREACH(ifgm, &ifgl->ifgl_group->ifg_members, ifgm_next) if (ifgm->ifgm_ifp == ifp) @@ -1266,33 +1266,33 @@ if_getgroup(struct ifgroupreq *data, str struct ifgroupreq *ifgr = data; if (ifgr->ifgr_len == 0) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next) ifgr->ifgr_len += sizeof(struct ifg_req); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (0); } len = ifgr->ifgr_len; ifgp = ifgr->ifgr_groups; /* XXX: wire */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next) { if (len < sizeof(ifgrq)) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (EINVAL); } bzero(&ifgrq, sizeof ifgrq); strlcpy(ifgrq.ifgrq_group, ifgl->ifgl_group->ifg_group, sizeof(ifgrq.ifgrq_group)); if ((error = copyout(&ifgrq, ifgp, sizeof(struct ifg_req)))) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (error); } len -= sizeof(ifgrq); ifgp++; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (0); } @@ -1399,28 +1399,28 @@ void if_addr_rlock(struct ifnet *ifp) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); } void if_addr_runlock(struct ifnet *ifp) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } void if_maddr_rlock(struct ifnet *ifp) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); } void if_maddr_runlock(struct ifnet *ifp) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } /* @@ -1532,14 +1532,14 @@ ifa_ifwithaddr_internal(struct sockaddr IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (sa_equal(addr, ifa->ifa_addr)) { if (getref) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } /* IP6 doesn't have broadcast */ @@ -1549,11 +1549,11 @@ ifa_ifwithaddr_internal(struct sockaddr sa_equal(ifa->ifa_broadaddr, addr)) { if (getref) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = NULL; done: @@ -1587,7 +1587,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; @@ -1596,11 +1596,11 @@ ifa_ifwithbroadaddr(struct sockaddr *add ifa->ifa_broadaddr->sa_len != 0 && sa_equal(ifa->ifa_broadaddr, addr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = NULL; done: @@ -1622,18 +1622,18 @@ ifa_ifwithdstaddr(struct sockaddr *addr) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if ((ifp->if_flags & IFF_POINTOPOINT) == 0) continue; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (ifa->ifa_dstaddr != NULL && sa_equal(addr, ifa->ifa_dstaddr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = NULL; done: @@ -1667,12 +1667,12 @@ ifa_ifwithnet(struct sockaddr *addr, int /* * Scan though each interface, looking for ones that have addresses * in this address family. Maintain a reference on ifa_maybe once - * we find one, as we release the IF_ADDR_LOCK() that kept it stable + * we find one, as we release the IF_ADDR_RLOCK() that kept it stable * when we move onto the next interface. */ IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { char *cp, *cp2, *cp3; @@ -1691,7 +1691,7 @@ next: continue; if (ifa->ifa_dstaddr != NULL && sa_equal(addr, ifa->ifa_dstaddr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } else { @@ -1702,7 +1702,7 @@ next: continue; if (ifa->ifa_claim_addr) { if ((*ifa->ifa_claim_addr)(ifa, addr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } continue; @@ -1742,7 +1742,7 @@ next: continue; } } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = ifa_maybe; ifa_maybe = NULL; @@ -1768,7 +1768,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, if (af >= AF_MAX) return (NULL); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != af) continue; @@ -1800,7 +1800,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, done: if (ifa != NULL) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (ifa); } @@ -2350,9 +2350,9 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, * lose a race while we check if the membership * already exists. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); ifma = if_findmulti(ifp, &ifr->ifr_addr); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (ifma != NULL) error = EADDRINUSE; else @@ -2768,7 +2768,7 @@ again: } addrs = 0; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa = ifa->ifa_addr; @@ -2800,7 +2800,7 @@ again: if (sbuf_error(sb) == 0) valid_len = sbuf_len(sb); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (addrs == 0) { bzero((caddr_t)&ifr.ifr_addr, sizeof(ifr.ifr_addr)); sbuf_bcat(sb, &ifr, sizeof(ifr)); @@ -2958,13 +2958,13 @@ if_addmulti(struct ifnet *ifp, struct so * If the address is already present, return a new reference to it; * otherwise, allocate storage and set up a new address. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); ifma = if_findmulti(ifp, sa); if (ifma != NULL) { ifma->ifma_refcount++; if (retifma != NULL) *retifma = ifma; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (0); } @@ -3030,7 +3030,7 @@ if_addmulti(struct ifnet *ifp, struct so * pointer is still valid. */ rt_newmaddrmsg(RTM_NEWMADDR, ifma); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); /* * We are certain we have added something, so call down to the @@ -3050,7 +3050,7 @@ free_llsa_out: free(llsa, M_IFMADDR); unlock_out: - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (error); } @@ -3084,12 +3084,12 @@ if_delmulti(struct ifnet *ifp, struct so if (ifp == NULL) return (ENOENT); - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); lastref = 0; ifma = if_findmulti(ifp, sa); if (ifma != NULL) lastref = if_delmulti_locked(ifp, ifma, 0); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); if (ifma == NULL) return (ENOENT); @@ -3111,10 +3111,10 @@ if_delallmulti(struct ifnet *ifp) struct ifmultiaddr *ifma; struct ifmultiaddr *next; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) if_delmulti_locked(ifp, ifma, 0); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } /* @@ -3151,7 +3151,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm * If and only if the ifnet instance exists: Acquire the address lock. */ if (ifp != NULL) - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); lastref = if_delmulti_locked(ifp, ifma, 0); @@ -3161,7 +3161,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm * Release the address lock. * If the group was left: update the hardware hash filter. */ - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); if (lastref && ifp->if_ioctl != NULL) { (void)(*ifp->if_ioctl)(ifp, SIOCDELMULTI, 0); } @@ -3183,7 +3183,7 @@ if_delmulti_locked(struct ifnet *ifp, st if (ifp != NULL && ifma->ifma_ifp != NULL) { KASSERT(ifma->ifma_ifp == ifp, ("%s: inconsistent ifp %p", __func__, ifp)); - IF_ADDR_LOCK_ASSERT(ifp); + IF_ADDR_WLOCK_ASSERT(ifp); } ifp = ifma->ifma_ifp; @@ -3256,14 +3256,14 @@ if_setlladdr(struct ifnet *ifp, const u_ struct ifaddr *ifa; struct ifreq ifr; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); ifa = ifp->if_addr; if (ifa == NULL) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (EINVAL); } ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); sdl = (struct sockaddr_dl *)ifa->ifa_addr; if (sdl == NULL) { ifa_free(ifa); Modified: stable/9/sys/net/rtsock.c ============================================================================== --- stable/9/sys/net/rtsock.c Mon Mar 19 20:15:18 2012 (r233199) +++ stable/9/sys/net/rtsock.c Mon Mar 19 20:49:16 2012 (r233200) @@ -479,7 +479,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * Try to find an address on the given outgoing interface * that belongs to the jail. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa; sa = ifa->ifa_addr; @@ -491,7 +491,7 @@ rtm_get_jailed(struct rt_addrinfo *info, break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (!found) { /* * As a last resort return the 'default' jail address. @@ -521,7 +521,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * Try to find an address on the given outgoing interface * that belongs to the jail. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa; sa = ifa->ifa_addr; @@ -534,7 +534,7 @@ rtm_get_jailed(struct rt_addrinfo *info, break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (!found) { /* * As a last resort return the 'default' jail address. @@ -1710,7 +1710,7 @@ sysctl_iflist(int af, struct walkarg *w) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (w->w_arg && w->w_arg != ifp->if_index) continue; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa->ifa_addr; len = rt_msg2(RTM_IFINFO, &info, NULL, w); @@ -1744,13 +1744,13 @@ sysctl_iflist(int af, struct walkarg *w) goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); info.rti_info[RTAX_IFA] = info.rti_info[RTAX_NETMASK] = info.rti_info[RTAX_BRD] = NULL; } done: if (ifp != NULL) - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); IFNET_RUNLOCK(); return (error); } @@ -1771,7 +1771,7 @@ sysctl_ifmalist(int af, struct walkarg * continue; ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa ? ifa->ifa_addr : NULL; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (af && af != ifma->ifma_addr->sa_family) continue; @@ -1792,12 +1792,12 @@ sysctl_ifmalist(int af, struct walkarg * ifmam->ifmam_addrs = info.rti_addrs; error = SYSCTL_OUT(w->w_req, w->w_tmem, len); if (error) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } done: IFNET_RUNLOCK(); Modified: stable/9/sys/netatalk/aarp.c ============================================================================== --- stable/9/sys/netatalk/aarp.c Mon Mar 19 20:15:18 2012 (r233199) +++ stable/9/sys/netatalk/aarp.c Mon Mar 19 20:49:16 2012 (r233200) @@ -406,7 +406,7 @@ at_aarpinput(struct ifnet *ifp, struct m * Since we don't know the net, we just look for the first * phase 1 address on the interface. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); for (aa = (struct at_ifaddr *)TAILQ_FIRST(&ifp->if_addrhead); aa; aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) { @@ -416,12 +416,12 @@ at_aarpinput(struct ifnet *ifp, struct m } } if (aa == NULL) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); m_freem(m); return; } ifa_ref(&aa->aa_ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); tpa.s_net = spa.s_net = AA_SAT(aa)->sat_addr.s_net; } Modified: stable/9/sys/netatalk/at_control.c ============================================================================== --- stable/9/sys/netatalk/at_control.c Mon Mar 19 20:15:18 2012 (r233199) +++ stable/9/sys/netatalk/at_control.c Mon Mar 19 20:49:16 2012 (r233200) @@ -254,9 +254,9 @@ at_control(struct socket *so, u_long cmd */ aa->aa_ifp = ifp; ifa_ref(&aa->aa_ifa); /* if_addrhead */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } else { /* * If we DID find one then we clobber any routes @@ -357,9 +357,9 @@ at_control(struct socket *so, u_long cmd * remove the ifaddr from the interface */ ifa = (struct ifaddr *)aa; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_free(ifa); /* if_addrhead */ /* Modified: stable/9/sys/netinet/if_ether.c ============================================================================== --- stable/9/sys/netinet/if_ether.c Mon Mar 19 20:15:18 2012 (r233199) +++ stable/9/sys/netinet/if_ether.c Mon Mar 19 20:49:16 2012 (r233200) @@ -617,15 +617,15 @@ in_arpinput(struct mbuf *m) * No match, use the first inet address on the receive interface * as a dummy address for the rest of the function. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET) { ia = ifatoia(ifa); ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto match; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* * If bridging, fall back to using any inet address. Modified: stable/9/sys/netinet/igmp.c ============================================================================== --- stable/9/sys/netinet/igmp.c Mon Mar 19 20:15:18 2012 (r233199) +++ stable/9/sys/netinet/igmp.c Mon Mar 19 20:49:16 2012 (r233200) @@ -617,7 +617,7 @@ igmp_ifdetach(struct ifnet *ifp) igi = ((struct in_ifinfo *)ifp->if_afdata[AF_INET])->ii_igmp; if (igi->igi_version == IGMP_VERSION_3) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -633,7 +633,7 @@ igmp_ifdetach(struct ifnet *ifp) } inm_clear_recorded(inm); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* * Free the in_multi reference(s) for this IGMP lifecycle. */ @@ -750,7 +750,7 @@ igmp_input_v1_query(struct ifnet *ifp, c * for the interface on which the query arrived, * except those which are already running. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -778,7 +778,7 @@ igmp_input_v1_query(struct ifnet *ifp, c break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); out_locked: IGMP_UNLOCK(); @@ -851,7 +851,7 @@ igmp_input_v2_query(struct ifnet *ifp, c */ CTR2(KTR_IGMPV3, "process v2 general query on ifp %p(%s)", ifp, ifp->if_xname); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -859,7 +859,7 @@ igmp_input_v2_query(struct ifnet *ifp, c inm = (struct in_multi *)ifma->ifma_protospec; igmp_v2_update_group(inm, timer); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } else { /* * Group-specific IGMPv2 query, we need only @@ -1707,7 +1707,7 @@ igmp_fasttimo_vnet(void) IFQ_SET_MAXLEN(&scq, IGMP_MAX_STATE_CHANGE_PACKETS); } - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -1725,7 +1725,7 @@ igmp_fasttimo_vnet(void) break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (igi->igi_version == IGMP_VERSION_3) { struct in_multi *tinm; @@ -2022,7 +2022,7 @@ igmp_v3_cancel_link_timers(struct igmp_i * for all memberships scoped to this link. */ ifp = igi->igi_ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -2067,7 +2067,7 @@ igmp_v3_cancel_link_timers(struct igmp_i inm->inm_timer = 0; _IF_DRAIN(&inm->inm_scq); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); SLIST_FOREACH_SAFE(inm, &igi->igi_relinmhead, inm_nrele, tinm) { SLIST_REMOVE_HEAD(&igi->igi_relinmhead, inm_nrele); inm_release_locked(inm); @@ -3330,7 +3330,7 @@ igmp_v3_dispatch_general_query(struct ig ifp = igi->igi_ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -3361,7 +3361,7 @@ igmp_v3_dispatch_general_query(struct ig break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); loop = (igi->igi_flags & IGIF_LOOPBACK) ? 1 : 0; igmp_dispatch_queue(&igi->igi_gq, IGMP_MAX_RESPONSE_BURST, loop); Modified: stable/9/sys/netinet/in.c ============================================================================== --- stable/9/sys/netinet/in.c Mon Mar 19 20:15:18 2012 (r233199) +++ stable/9/sys/netinet/in.c Mon Mar 19 20:49:16 2012 (r233200) @@ -326,7 +326,7 @@ in_control(struct socket *so, u_long cmd ifa_ref(&ia->ia_ifa); IN_IFADDR_RUNLOCK(); if (ia == NULL) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { iap = ifatoia(ifa); if (iap->ia_addr.sin_family == AF_INET) { @@ -340,7 +340,7 @@ in_control(struct socket *so, u_long cmd } if (ia != NULL) ifa_ref(&ia->ia_ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } if (ia == NULL) iaIsFirst = 1; @@ -404,9 +404,9 @@ in_control(struct socket *so, u_long cmd ia->ia_ifp = ifp; ifa_ref(ifa); /* if_addrhead */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_ref(ifa); /* in_ifaddrhead */ IN_IFADDR_WLOCK(); TAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); @@ -586,7 +586,7 @@ in_control(struct socket *so, u_long cmd panic("in_control: unsupported ioctl"); } - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); /* Re-check that ia is still part of the list. */ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa == &ia->ia_ifa) @@ -598,12 +598,12 @@ in_control(struct socket *so, u_long cmd * try it again for the next loop as there is no other exit * path between here and out. */ - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); error = EADDRNOTAVAIL; goto out; } TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ IN_IFADDR_WLOCK(); @@ -753,7 +753,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo } } - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; @@ -766,7 +766,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo } if (ifa != NULL) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (ifa == NULL) return (EADDRNOTAVAIL); ia = (struct in_ifaddr *)ifa; @@ -1292,7 +1292,7 @@ in_purgemaddrs(struct ifnet *ifp) * We need to do this as IF_ADDR_LOCK() may be re-acquired * by code further down. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -1304,7 +1304,7 @@ in_purgemaddrs(struct ifnet *ifp) inm = (struct in_multi *)ifma->ifma_protospec; LIST_INSERT_HEAD(&purgeinms, inm, inm_link); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); LIST_FOREACH_SAFE(inm, &purgeinms, inm_link, tinm) { LIST_REMOVE(inm, inm_link); Modified: stable/9/sys/netinet/in_mcast.c ============================================================================== --- stable/9/sys/netinet/in_mcast.c Mon Mar 19 20:15:18 2012 (r233199) +++ stable/9/sys/netinet/in_mcast.c Mon Mar 19 20:49:16 2012 (r233200) @@ -421,7 +421,7 @@ in_getmulti(struct ifnet *ifp, const str return (error); /* XXX ifma_protospec must be covered by IF_ADDR_LOCK */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); /* * If something other than netinet is occupying the link-layer @@ -445,11 +445,11 @@ in_getmulti(struct ifnet *ifp, const str #endif ++inm->inm_refcount; *pinm = inm; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (0); } - IF_ADDR_LOCK_ASSERT(ifp); + IF_ADDR_WLOCK_ASSERT(ifp); /* * A new in_multi record is needed; allocate and initialize it. @@ -461,7 +461,7 @@ in_getmulti(struct ifnet *ifp, const str inm = malloc(sizeof(*inm), M_IPMADDR, M_NOWAIT | M_ZERO); if (inm == NULL) { if_delmulti_ifma(ifma); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (ENOMEM); } inm->inm_addr = *group; @@ -484,7 +484,7 @@ in_getmulti(struct ifnet *ifp, const str *pinm = inm; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (0); } @@ -2796,7 +2796,7 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_A IN_MULTI_LOCK(); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -2829,7 +2829,7 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_A break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); IN_MULTI_UNLOCK(); Modified: stable/9/sys/netinet/in_pcb.c ============================================================================== --- stable/9/sys/netinet/in_pcb.c Mon Mar 19 20:15:18 2012 (r233199) +++ stable/9/sys/netinet/in_pcb.c Mon Mar 19 20:49:16 2012 (r233200) @@ -744,7 +744,7 @@ in_pcbladdr(struct inpcb *inp, struct in ifp = ia->ia_ifp; ifa_free(&ia->ia_ifa); ia = NULL; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; @@ -758,10 +758,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* 3. As a last resort return the 'default' jail address. */ error = prison_get_ip4(cred, laddr); @@ -803,7 +803,7 @@ in_pcbladdr(struct inpcb *inp, struct in */ ia = NULL; ifp = sro.ro_rt->rt_ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; if (sa->sa_family != AF_INET) @@ -816,10 +816,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* 3. As a last resort return the 'default' jail address. */ error = prison_get_ip4(cred, laddr); @@ -867,7 +867,7 @@ in_pcbladdr(struct inpcb *inp, struct in ifp = ia->ia_ifp; ifa_free(&ia->ia_ifa); ia = NULL; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; @@ -882,10 +882,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } /* 3. As a last resort return the 'default' jail address. */ Modified: stable/9/sys/netinet/in_var.h ============================================================================== --- stable/9/sys/netinet/in_var.h Mon Mar 19 20:15:18 2012 (r233199) +++ stable/9/sys/netinet/in_var.h Mon Mar 19 20:49:16 2012 (r233200) @@ -393,9 +393,9 @@ inm_lookup(struct ifnet *ifp, const stru struct in_multi *inm; IN_MULTI_LOCK_ASSERT(); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); inm = inm_lookup_locked(ifp, ina); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (inm); } Modified: stable/9/sys/netinet/ip_carp.c ============================================================================== --- stable/9/sys/netinet/ip_carp.c Mon Mar 19 20:15:18 2012 (r233199) +++ stable/9/sys/netinet/ip_carp.c Mon Mar 19 20:49:16 2012 (r233200) @@ -292,7 +292,7 @@ carp_hmac_prepare(struct carp_softc *sc) found = 0; last = cur; cur.s_addr = 0xffffffff; - IF_ADDR_LOCK(SC2IFP(sc)); + IF_ADDR_RLOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { in.s_addr = ifatoia(ifa)->ia_addr.sin_addr.s_addr; if (ifa->ifa_addr->sa_family == AF_INET && @@ -302,7 +302,7 @@ carp_hmac_prepare(struct carp_softc *sc) found++; } } - IF_ADDR_UNLOCK(SC2IFP(sc)); + IF_ADDR_RUNLOCK(SC2IFP(sc)); if (found) SHA1Update(&sc->sc_sha1, (void *)&cur, sizeof(cur)); } while (found); @@ -313,7 +313,7 @@ carp_hmac_prepare(struct carp_softc *sc) found = 0; last6 = cur6; memset(&cur6, 0xff, sizeof(cur6)); - IF_ADDR_LOCK(SC2IFP(sc)); + IF_ADDR_RLOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { in6 = ifatoia6(ifa)->ia_addr.sin6_addr; if (IN6_IS_SCOPE_EMBED(&in6)) @@ -325,7 +325,7 @@ carp_hmac_prepare(struct carp_softc *sc) found++; } } - IF_ADDR_UNLOCK(SC2IFP(sc)); + IF_ADDR_RUNLOCK(SC2IFP(sc)); if (found) SHA1Update(&sc->sc_sha1, (void *)&cur6, sizeof(cur6)); } while (found); @@ -1168,7 +1168,7 @@ carp_addrcount(struct carp_if *cif, stru (SC2IFP(vh)->if_flags & IFF_UP) && (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING)) || (type == CARP_COUNT_MASTER && vh->sc_state == MASTER)) { - IF_ADDR_LOCK(SC2IFP(vh)); + IF_ADDR_RLOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family == AF_INET && @@ -1176,7 +1176,7 @@ carp_addrcount(struct carp_if *cif, stru ifatoia(ifa)->ia_addr.sin_addr.s_addr) count++; } - IF_ADDR_UNLOCK(SC2IFP(vh)); + IF_ADDR_RUNLOCK(SC2IFP(vh)); } } return (count); @@ -1216,7 +1216,7 @@ carp_iamatch(struct ifnet *ifp, struct i TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) { if ((SC2IFP(vh)->if_flags & IFF_UP) && (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING)) { - IF_ADDR_LOCK(SC2IFP(vh)); + IF_ADDR_RLOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family == @@ -1227,11 +1227,11 @@ carp_iamatch(struct ifnet *ifp, struct i if (vh->sc_state == MASTER) { *enaddr = IF_LLADDR(vh->sc_ifp); - IF_ADDR_UNLOCK(SC2IFP(vh)); + IF_ADDR_RUNLOCK(SC2IFP(vh)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 20:49:42 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E9719106566B; Mon, 19 Mar 2012 20:49:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D198C8FC0C; Mon, 19 Mar 2012 20:49:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JKngKA085668; Mon, 19 Mar 2012 20:49:42 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JKnghc085653; Mon, 19 Mar 2012 20:49:42 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203192049.q2JKnghc085653@svn.freebsd.org> From: John Baldwin Date: Mon, 19 Mar 2012 20:49:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233201 - in stable/8/sys: i386/conf kern net netatalk netinet netinet6 netipx X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 20:49:43 -0000 Author: jhb Date: Mon Mar 19 20:49:42 2012 New Revision: 233201 URL: http://svn.freebsd.org/changeset/base/233201 Log: MFC 229621: Convert all users of IF_ADDR_LOCK to use new locking macros that specify either a read lock or write lock. Modified: stable/8/sys/kern/kern_uuid.c stable/8/sys/net/if.c stable/8/sys/net/rtsock.c stable/8/sys/netatalk/aarp.c stable/8/sys/netatalk/at_control.c stable/8/sys/netinet/if_ether.c stable/8/sys/netinet/igmp.c stable/8/sys/netinet/in.c stable/8/sys/netinet/in_mcast.c stable/8/sys/netinet/in_pcb.c stable/8/sys/netinet/in_var.h stable/8/sys/netinet/ip_carp.c stable/8/sys/netinet/ip_icmp.c stable/8/sys/netinet/ip_input.c stable/8/sys/netinet/sctp_bsd_addr.c stable/8/sys/netinet6/icmp6.c stable/8/sys/netinet6/in6.c stable/8/sys/netinet6/in6_ifattach.c stable/8/sys/netinet6/in6_mcast.c stable/8/sys/netinet6/in6_var.h stable/8/sys/netinet6/ip6_input.c stable/8/sys/netinet6/mld6.c stable/8/sys/netinet6/nd6.c stable/8/sys/netinet6/nd6_rtr.c stable/8/sys/netipx/ipx.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/kern/kern_uuid.c ============================================================================== --- stable/8/sys/kern/kern_uuid.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/kern/kern_uuid.c Mon Mar 19 20:49:42 2012 (r233201) @@ -98,20 +98,20 @@ uuid_node(uint16_t *node) IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* Walk the address list */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sdl = (struct sockaddr_dl*)ifa->ifa_addr; if (sdl != NULL && sdl->sdl_family == AF_LINK && sdl->sdl_type == IFT_ETHER) { /* Got a MAC address. */ bcopy(LLADDR(sdl), node, UUID_NODE_LEN); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); IFNET_RUNLOCK_NOSLEEP(); CURVNET_RESTORE(); return; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } IFNET_RUNLOCK_NOSLEEP(); Modified: stable/8/sys/net/if.c ============================================================================== --- stable/8/sys/net/if.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/net/if.c Mon Mar 19 20:49:42 2012 (r233201) @@ -835,10 +835,10 @@ if_purgemaddrs(struct ifnet *ifp) struct ifmultiaddr *ifma; struct ifmultiaddr *next; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) if_delmulti_locked(ifp, ifma, 1); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } /* @@ -1182,10 +1182,10 @@ if_addgroup(struct ifnet *ifp, const cha ifgl->ifgl_group = ifg; ifgm->ifgm_ifp = ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifg->ifg_members, ifgm, ifgm_next); TAILQ_INSERT_TAIL(&ifp->if_groups, ifgl, ifgl_next); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); IFNET_WUNLOCK(); @@ -1212,9 +1212,9 @@ if_delgroup(struct ifnet *ifp, const cha return (ENOENT); } - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_groups, ifgl, ifgl_next); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); TAILQ_FOREACH(ifgm, &ifgl->ifgl_group->ifg_members, ifgm_next) if (ifgm->ifgm_ifp == ifp) @@ -1255,9 +1255,9 @@ if_delgroups(struct ifnet *ifp) strlcpy(groupname, ifgl->ifgl_group->ifg_group, IFNAMSIZ); - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_groups, ifgl, ifgl_next); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); TAILQ_FOREACH(ifgm, &ifgl->ifgl_group->ifg_members, ifgm_next) if (ifgm->ifgm_ifp == ifp) @@ -1299,33 +1299,33 @@ if_getgroup(struct ifgroupreq *data, str struct ifgroupreq *ifgr = data; if (ifgr->ifgr_len == 0) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next) ifgr->ifgr_len += sizeof(struct ifg_req); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (0); } len = ifgr->ifgr_len; ifgp = ifgr->ifgr_groups; /* XXX: wire */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next) { if (len < sizeof(ifgrq)) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (EINVAL); } bzero(&ifgrq, sizeof ifgrq); strlcpy(ifgrq.ifgrq_group, ifgl->ifgl_group->ifg_group, sizeof(ifgrq.ifgrq_group)); if ((error = copyout(&ifgrq, ifgp, sizeof(struct ifg_req)))) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (error); } len -= sizeof(ifgrq); ifgp++; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (0); } @@ -1432,28 +1432,28 @@ void if_addr_rlock(struct ifnet *ifp) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); } void if_addr_runlock(struct ifnet *ifp) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } void if_maddr_rlock(struct ifnet *ifp) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); } void if_maddr_runlock(struct ifnet *ifp) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } /* @@ -1565,14 +1565,14 @@ ifa_ifwithaddr_internal(struct sockaddr IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (sa_equal(addr, ifa->ifa_addr)) { if (getref) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } /* IP6 doesn't have broadcast */ @@ -1582,11 +1582,11 @@ ifa_ifwithaddr_internal(struct sockaddr sa_equal(ifa->ifa_broadaddr, addr)) { if (getref) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = NULL; done: @@ -1620,7 +1620,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; @@ -1629,11 +1629,11 @@ ifa_ifwithbroadaddr(struct sockaddr *add ifa->ifa_broadaddr->sa_len != 0 && sa_equal(ifa->ifa_broadaddr, addr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = NULL; done: @@ -1655,18 +1655,18 @@ ifa_ifwithdstaddr(struct sockaddr *addr) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if ((ifp->if_flags & IFF_POINTOPOINT) == 0) continue; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (ifa->ifa_dstaddr != NULL && sa_equal(addr, ifa->ifa_dstaddr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = NULL; done: @@ -1700,12 +1700,12 @@ ifa_ifwithnet(struct sockaddr *addr, int /* * Scan though each interface, looking for ones that have addresses * in this address family. Maintain a reference on ifa_maybe once - * we find one, as we release the IF_ADDR_LOCK() that kept it stable + * we find one, as we release the IF_ADDR_RLOCK() that kept it stable * when we move onto the next interface. */ IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { char *cp, *cp2, *cp3; @@ -1724,7 +1724,7 @@ next: continue; if (ifa->ifa_dstaddr != NULL && sa_equal(addr, ifa->ifa_dstaddr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } else { @@ -1735,7 +1735,7 @@ next: continue; if (ifa->ifa_claim_addr) { if ((*ifa->ifa_claim_addr)(ifa, addr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } continue; @@ -1775,7 +1775,7 @@ next: continue; } } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = ifa_maybe; ifa_maybe = NULL; @@ -1801,7 +1801,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, if (af >= AF_MAX) return (NULL); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != af) continue; @@ -1833,7 +1833,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, done: if (ifa != NULL) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (ifa); } @@ -2410,9 +2410,9 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, * lose a race while we check if the membership * already exists. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); ifma = if_findmulti(ifp, &ifr->ifr_addr); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (ifma != NULL) error = EADDRINUSE; else @@ -2828,7 +2828,7 @@ again: } addrs = 0; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa = ifa->ifa_addr; @@ -2860,7 +2860,7 @@ again: if (!sbuf_overflowed(sb)) valid_len = sbuf_len(sb); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (addrs == 0) { bzero((caddr_t)&ifr.ifr_addr, sizeof(ifr.ifr_addr)); sbuf_bcat(sb, &ifr, sizeof(ifr)); @@ -3018,13 +3018,13 @@ if_addmulti(struct ifnet *ifp, struct so * If the address is already present, return a new reference to it; * otherwise, allocate storage and set up a new address. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); ifma = if_findmulti(ifp, sa); if (ifma != NULL) { ifma->ifma_refcount++; if (retifma != NULL) *retifma = ifma; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (0); } @@ -3090,7 +3090,7 @@ if_addmulti(struct ifnet *ifp, struct so * pointer is still valid. */ rt_newmaddrmsg(RTM_NEWMADDR, ifma); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); /* * We are certain we have added something, so call down to the @@ -3110,7 +3110,7 @@ free_llsa_out: free(llsa, M_IFMADDR); unlock_out: - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (error); } @@ -3144,12 +3144,12 @@ if_delmulti(struct ifnet *ifp, struct so if (ifp == NULL) return (ENOENT); - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); lastref = 0; ifma = if_findmulti(ifp, sa); if (ifma != NULL) lastref = if_delmulti_locked(ifp, ifma, 0); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); if (ifma == NULL) return (ENOENT); @@ -3171,10 +3171,10 @@ if_delallmulti(struct ifnet *ifp) struct ifmultiaddr *ifma; struct ifmultiaddr *next; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) if_delmulti_locked(ifp, ifma, 0); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } /* @@ -3211,7 +3211,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm * If and only if the ifnet instance exists: Acquire the address lock. */ if (ifp != NULL) - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); lastref = if_delmulti_locked(ifp, ifma, 0); @@ -3221,7 +3221,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm * Release the address lock. * If the group was left: update the hardware hash filter. */ - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); if (lastref && ifp->if_ioctl != NULL) { (void)(*ifp->if_ioctl)(ifp, SIOCDELMULTI, 0); } @@ -3243,7 +3243,7 @@ if_delmulti_locked(struct ifnet *ifp, st if (ifp != NULL && ifma->ifma_ifp != NULL) { KASSERT(ifma->ifma_ifp == ifp, ("%s: inconsistent ifp %p", __func__, ifp)); - IF_ADDR_LOCK_ASSERT(ifp); + IF_ADDR_WLOCK_ASSERT(ifp); } ifp = ifma->ifma_ifp; @@ -3316,14 +3316,14 @@ if_setlladdr(struct ifnet *ifp, const u_ struct ifaddr *ifa; struct ifreq ifr; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); ifa = ifp->if_addr; if (ifa == NULL) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (EINVAL); } ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); sdl = (struct sockaddr_dl *)ifa->ifa_addr; if (sdl == NULL) { ifa_free(ifa); Modified: stable/8/sys/net/rtsock.c ============================================================================== --- stable/8/sys/net/rtsock.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/net/rtsock.c Mon Mar 19 20:49:42 2012 (r233201) @@ -479,7 +479,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * Try to find an address on the given outgoing interface * that belongs to the jail. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa; sa = ifa->ifa_addr; @@ -491,7 +491,7 @@ rtm_get_jailed(struct rt_addrinfo *info, break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (!found) { /* * As a last resort return the 'default' jail address. @@ -521,7 +521,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * Try to find an address on the given outgoing interface * that belongs to the jail. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa; sa = ifa->ifa_addr; @@ -534,7 +534,7 @@ rtm_get_jailed(struct rt_addrinfo *info, break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (!found) { /* * As a last resort return the 'default' jail address. @@ -1708,7 +1708,7 @@ sysctl_iflist(int af, struct walkarg *w) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (w->w_arg && w->w_arg != ifp->if_index) continue; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa->ifa_addr; len = rt_msg2(RTM_IFINFO, &info, NULL, w); @@ -1742,13 +1742,13 @@ sysctl_iflist(int af, struct walkarg *w) goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); info.rti_info[RTAX_IFA] = info.rti_info[RTAX_NETMASK] = info.rti_info[RTAX_BRD] = NULL; } done: if (ifp != NULL) - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); IFNET_RUNLOCK(); return (error); } @@ -1769,7 +1769,7 @@ sysctl_ifmalist(int af, struct walkarg * continue; ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa ? ifa->ifa_addr : NULL; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (af && af != ifma->ifma_addr->sa_family) continue; @@ -1790,12 +1790,12 @@ sysctl_ifmalist(int af, struct walkarg * ifmam->ifmam_addrs = info.rti_addrs; error = SYSCTL_OUT(w->w_req, w->w_tmem, len); if (error) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } done: IFNET_RUNLOCK(); Modified: stable/8/sys/netatalk/aarp.c ============================================================================== --- stable/8/sys/netatalk/aarp.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netatalk/aarp.c Mon Mar 19 20:49:42 2012 (r233201) @@ -406,7 +406,7 @@ at_aarpinput(struct ifnet *ifp, struct m * Since we don't know the net, we just look for the first * phase 1 address on the interface. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); for (aa = (struct at_ifaddr *)TAILQ_FIRST(&ifp->if_addrhead); aa; aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) { @@ -416,12 +416,12 @@ at_aarpinput(struct ifnet *ifp, struct m } } if (aa == NULL) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); m_freem(m); return; } ifa_ref(&aa->aa_ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); tpa.s_net = spa.s_net = AA_SAT(aa)->sat_addr.s_net; } Modified: stable/8/sys/netatalk/at_control.c ============================================================================== --- stable/8/sys/netatalk/at_control.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netatalk/at_control.c Mon Mar 19 20:49:42 2012 (r233201) @@ -254,9 +254,9 @@ at_control(struct socket *so, u_long cmd */ aa->aa_ifp = ifp; ifa_ref(&aa->aa_ifa); /* if_addrhead */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } else { /* * If we DID find one then we clobber any routes @@ -357,9 +357,9 @@ at_control(struct socket *so, u_long cmd * remove the ifaddr from the interface */ ifa = (struct ifaddr *)aa; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_free(ifa); /* if_addrhead */ /* Modified: stable/8/sys/netinet/if_ether.c ============================================================================== --- stable/8/sys/netinet/if_ether.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/if_ether.c Mon Mar 19 20:49:42 2012 (r233201) @@ -603,15 +603,15 @@ in_arpinput(struct mbuf *m) * No match, use the first inet address on the receive interface * as a dummy address for the rest of the function. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET) { ia = ifatoia(ifa); ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto match; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* * If bridging, fall back to using any inet address. Modified: stable/8/sys/netinet/igmp.c ============================================================================== --- stable/8/sys/netinet/igmp.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/igmp.c Mon Mar 19 20:49:42 2012 (r233201) @@ -617,7 +617,7 @@ igmp_ifdetach(struct ifnet *ifp) igi = ((struct in_ifinfo *)ifp->if_afdata[AF_INET])->ii_igmp; if (igi->igi_version == IGMP_VERSION_3) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -633,7 +633,7 @@ igmp_ifdetach(struct ifnet *ifp) } inm_clear_recorded(inm); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* * Free the in_multi reference(s) for this IGMP lifecycle. */ @@ -750,7 +750,7 @@ igmp_input_v1_query(struct ifnet *ifp, c * for the interface on which the query arrived, * except those which are already running. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -778,7 +778,7 @@ igmp_input_v1_query(struct ifnet *ifp, c break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); out_locked: IGMP_UNLOCK(); @@ -851,7 +851,7 @@ igmp_input_v2_query(struct ifnet *ifp, c */ CTR2(KTR_IGMPV3, "process v2 general query on ifp %p(%s)", ifp, ifp->if_xname); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -859,7 +859,7 @@ igmp_input_v2_query(struct ifnet *ifp, c inm = (struct in_multi *)ifma->ifma_protospec; igmp_v2_update_group(inm, timer); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } else { /* * Group-specific IGMPv2 query, we need only @@ -1707,7 +1707,7 @@ igmp_fasttimo_vnet(void) IFQ_SET_MAXLEN(&scq, IGMP_MAX_STATE_CHANGE_PACKETS); } - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -1725,7 +1725,7 @@ igmp_fasttimo_vnet(void) break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (igi->igi_version == IGMP_VERSION_3) { struct in_multi *tinm; @@ -2022,7 +2022,7 @@ igmp_v3_cancel_link_timers(struct igmp_i * for all memberships scoped to this link. */ ifp = igi->igi_ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -2067,7 +2067,7 @@ igmp_v3_cancel_link_timers(struct igmp_i inm->inm_timer = 0; _IF_DRAIN(&inm->inm_scq); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); SLIST_FOREACH_SAFE(inm, &igi->igi_relinmhead, inm_nrele, tinm) { SLIST_REMOVE_HEAD(&igi->igi_relinmhead, inm_nrele); inm_release_locked(inm); @@ -3330,7 +3330,7 @@ igmp_v3_dispatch_general_query(struct ig ifp = igi->igi_ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -3361,7 +3361,7 @@ igmp_v3_dispatch_general_query(struct ig break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); loop = (igi->igi_flags & IGIF_LOOPBACK) ? 1 : 0; igmp_dispatch_queue(&igi->igi_gq, IGMP_MAX_RESPONSE_BURST, loop); Modified: stable/8/sys/netinet/in.c ============================================================================== --- stable/8/sys/netinet/in.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/in.c Mon Mar 19 20:49:42 2012 (r233201) @@ -342,7 +342,7 @@ in_control(struct socket *so, u_long cmd ifa_ref(&ia->ia_ifa); IN_IFADDR_RUNLOCK(); if (ia == NULL) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { iap = ifatoia(ifa); if (iap->ia_addr.sin_family == AF_INET) { @@ -356,7 +356,7 @@ in_control(struct socket *so, u_long cmd } if (ia != NULL) ifa_ref(&ia->ia_ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } if (ia == NULL) iaIsFirst = 1; @@ -420,9 +420,9 @@ in_control(struct socket *so, u_long cmd ia->ia_ifp = ifp; ifa_ref(ifa); /* if_addrhead */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_ref(ifa); /* in_ifaddrhead */ IN_IFADDR_WLOCK(); TAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); @@ -602,7 +602,7 @@ in_control(struct socket *so, u_long cmd panic("in_control: unsupported ioctl"); } - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); /* Re-check that ia is still part of the list. */ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa == &ia->ia_ifa) @@ -614,12 +614,12 @@ in_control(struct socket *so, u_long cmd * try it again for the next loop as there is no other exit * path between here and out. */ - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); error = EADDRNOTAVAIL; goto out; } TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ IN_IFADDR_WLOCK(); @@ -769,7 +769,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo } } - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; @@ -782,7 +782,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo } if (ifa != NULL) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (ifa == NULL) return (EADDRNOTAVAIL); ia = (struct in_ifaddr *)ifa; @@ -1310,7 +1310,7 @@ in_purgemaddrs(struct ifnet *ifp) * We need to do this as IF_ADDR_LOCK() may be re-acquired * by code further down. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -1322,7 +1322,7 @@ in_purgemaddrs(struct ifnet *ifp) inm = (struct in_multi *)ifma->ifma_protospec; LIST_INSERT_HEAD(&purgeinms, inm, inm_link); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); LIST_FOREACH_SAFE(inm, &purgeinms, inm_link, tinm) { LIST_REMOVE(inm, inm_link); Modified: stable/8/sys/netinet/in_mcast.c ============================================================================== --- stable/8/sys/netinet/in_mcast.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/in_mcast.c Mon Mar 19 20:49:42 2012 (r233201) @@ -421,7 +421,7 @@ in_getmulti(struct ifnet *ifp, const str return (error); /* XXX ifma_protospec must be covered by IF_ADDR_LOCK */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); /* * If something other than netinet is occupying the link-layer @@ -445,11 +445,11 @@ in_getmulti(struct ifnet *ifp, const str #endif ++inm->inm_refcount; *pinm = inm; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (0); } - IF_ADDR_LOCK_ASSERT(ifp); + IF_ADDR_WLOCK_ASSERT(ifp); /* * A new in_multi record is needed; allocate and initialize it. @@ -461,7 +461,7 @@ in_getmulti(struct ifnet *ifp, const str inm = malloc(sizeof(*inm), M_IPMADDR, M_NOWAIT | M_ZERO); if (inm == NULL) { if_delmulti_ifma(ifma); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (ENOMEM); } inm->inm_addr = *group; @@ -484,7 +484,7 @@ in_getmulti(struct ifnet *ifp, const str *pinm = inm; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (0); } @@ -2775,7 +2775,7 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_A IN_MULTI_LOCK(); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -2808,7 +2808,7 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_A break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); IN_MULTI_UNLOCK(); Modified: stable/8/sys/netinet/in_pcb.c ============================================================================== --- stable/8/sys/netinet/in_pcb.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/in_pcb.c Mon Mar 19 20:49:42 2012 (r233201) @@ -661,7 +661,7 @@ in_pcbladdr(struct inpcb *inp, struct in ifp = ia->ia_ifp; ifa_free(&ia->ia_ifa); ia = NULL; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; @@ -675,10 +675,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* 3. As a last resort return the 'default' jail address. */ error = prison_get_ip4(cred, laddr); @@ -720,7 +720,7 @@ in_pcbladdr(struct inpcb *inp, struct in */ ia = NULL; ifp = sro.ro_rt->rt_ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; if (sa->sa_family != AF_INET) @@ -733,10 +733,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* 3. As a last resort return the 'default' jail address. */ error = prison_get_ip4(cred, laddr); @@ -784,7 +784,7 @@ in_pcbladdr(struct inpcb *inp, struct in ifp = ia->ia_ifp; ifa_free(&ia->ia_ifa); ia = NULL; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; @@ -799,10 +799,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } /* 3. As a last resort return the 'default' jail address. */ Modified: stable/8/sys/netinet/in_var.h ============================================================================== --- stable/8/sys/netinet/in_var.h Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/in_var.h Mon Mar 19 20:49:42 2012 (r233201) @@ -396,9 +396,9 @@ inm_lookup(struct ifnet *ifp, const stru struct in_multi *inm; IN_MULTI_LOCK_ASSERT(); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); inm = inm_lookup_locked(ifp, ina); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (inm); } Modified: stable/8/sys/netinet/ip_carp.c ============================================================================== --- stable/8/sys/netinet/ip_carp.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/ip_carp.c Mon Mar 19 20:49:42 2012 (r233201) @@ -279,7 +279,7 @@ carp_hmac_prepare(struct carp_softc *sc) found = 0; last = cur; cur.s_addr = 0xffffffff; - IF_ADDR_LOCK(SC2IFP(sc)); + IF_ADDR_RLOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { in.s_addr = ifatoia(ifa)->ia_addr.sin_addr.s_addr; if (ifa->ifa_addr->sa_family == AF_INET && @@ -289,7 +289,7 @@ carp_hmac_prepare(struct carp_softc *sc) found++; } } - IF_ADDR_UNLOCK(SC2IFP(sc)); + IF_ADDR_RUNLOCK(SC2IFP(sc)); if (found) SHA1Update(&sc->sc_sha1, (void *)&cur, sizeof(cur)); } while (found); @@ -300,7 +300,7 @@ carp_hmac_prepare(struct carp_softc *sc) found = 0; last6 = cur6; memset(&cur6, 0xff, sizeof(cur6)); - IF_ADDR_LOCK(SC2IFP(sc)); + IF_ADDR_RLOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { in6 = ifatoia6(ifa)->ia_addr.sin6_addr; if (IN6_IS_SCOPE_EMBED(&in6)) @@ -312,7 +312,7 @@ carp_hmac_prepare(struct carp_softc *sc) found++; } } - IF_ADDR_UNLOCK(SC2IFP(sc)); + IF_ADDR_RUNLOCK(SC2IFP(sc)); if (found) SHA1Update(&sc->sc_sha1, (void *)&cur6, sizeof(cur6)); } while (found); @@ -1138,7 +1138,7 @@ carp_addrcount(struct carp_if *cif, stru (SC2IFP(vh)->if_flags & IFF_UP) && (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING)) || (type == CARP_COUNT_MASTER && vh->sc_state == MASTER)) { - IF_ADDR_LOCK(SC2IFP(vh)); + IF_ADDR_RLOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family == AF_INET && @@ -1146,7 +1146,7 @@ carp_addrcount(struct carp_if *cif, stru ifatoia(ifa)->ia_addr.sin_addr.s_addr) count++; } - IF_ADDR_UNLOCK(SC2IFP(vh)); + IF_ADDR_RUNLOCK(SC2IFP(vh)); } } return (count); @@ -1186,7 +1186,7 @@ carp_iamatch(struct ifnet *ifp, struct i TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) { if ((SC2IFP(vh)->if_flags & IFF_UP) && (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING)) { - IF_ADDR_LOCK(SC2IFP(vh)); + IF_ADDR_RLOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family == @@ -1197,11 +1197,11 @@ carp_iamatch(struct ifnet *ifp, struct i if (vh->sc_state == MASTER) { *enaddr = IF_LLADDR(vh->sc_ifp); - IF_ADDR_UNLOCK(SC2IFP(vh)); + IF_ADDR_RUNLOCK(SC2IFP(vh)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 21:33:24 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8E5101065674; Mon, 19 Mar 2012 21:33:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F5378FC27; Mon, 19 Mar 2012 21:33:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JLXOGK087223; Mon, 19 Mar 2012 21:33:24 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JLXOnl087219; Mon, 19 Mar 2012 21:33:24 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203192133.q2JLXOnl087219@svn.freebsd.org> From: John Baldwin Date: Mon, 19 Mar 2012 21:33:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233205 - stable/9/usr.bin/kdump X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 21:33:24 -0000 Author: jhb Date: Mon Mar 19 21:33:23 2012 New Revision: 233205 URL: http://svn.freebsd.org/changeset/base/233205 Log: MFC 232072: Pretty-print the advice constants passed to posix_fadvise(2). Modified: stable/9/usr.bin/kdump/kdump.c stable/9/usr.bin/kdump/kdump_subr.h stable/9/usr.bin/kdump/mksubr Directory Properties: stable/9/usr.bin/kdump/ (props changed) Modified: stable/9/usr.bin/kdump/kdump.c ============================================================================== --- stable/9/usr.bin/kdump/kdump.c Mon Mar 19 21:29:57 2012 (r233204) +++ stable/9/usr.bin/kdump/kdump.c Mon Mar 19 21:33:23 2012 (r233205) @@ -935,6 +935,14 @@ ktrsyscall(struct ktr_syscall *ktr, u_in kldunloadfflagsname ((int)*ip); ip++; narg--; + } else if (ktr->ktr_code == SYS_posix_fadvise) { + print_number(ip,narg,c); + print_number(ip,narg,c); + print_number(ip,narg,c); + (void)putchar(','); + fadvisebehavname((int)*ip); + ip++; + narg--; } } while (narg > 0) { Modified: stable/9/usr.bin/kdump/kdump_subr.h ============================================================================== --- stable/9/usr.bin/kdump/kdump_subr.h Mon Mar 19 21:29:57 2012 (r233204) +++ stable/9/usr.bin/kdump/kdump_subr.h Mon Mar 19 21:33:23 2012 (r233205) @@ -32,6 +32,7 @@ void whencename (int); void rlimitname (int); void shutdownhowname (int); void prioname (int); +void fadvisebehavname (int); void madvisebehavname (int); void msyncflagsname (int); void schedpolicyname (int); Modified: stable/9/usr.bin/kdump/mksubr ============================================================================== --- stable/9/usr.bin/kdump/mksubr Mon Mar 19 21:29:57 2012 (r233204) +++ stable/9/usr.bin/kdump/mksubr Mon Mar 19 21:33:23 2012 (r233205) @@ -351,6 +351,7 @@ auto_switch_type "whencename" "SEEK_[A-Z auto_switch_type "rlimitname" "RLIMIT_[A-Z]+[[:space:]]+[0-9]+" "sys/resource.h" auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h" auto_switch_type "prioname" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h" +auto_switch_type "fadvisebehavname" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h" auto_switch_type "madvisebehavname" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h" auto_switch_type "msyncflagsname" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h" auto_switch_type "schedpolicyname" "SCHED_[A-Z]+[[:space:]]+[0-9]+" "sched.h" From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 21:33:36 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94722106577F; Mon, 19 Mar 2012 21:33:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65F9B8FC1E; Mon, 19 Mar 2012 21:33:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JLXa2P087268; Mon, 19 Mar 2012 21:33:36 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JLXa1H087264; Mon, 19 Mar 2012 21:33:36 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203192133.q2JLXa1H087264@svn.freebsd.org> From: John Baldwin Date: Mon, 19 Mar 2012 21:33:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233206 - stable/8/usr.bin/kdump X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 21:33:36 -0000 Author: jhb Date: Mon Mar 19 21:33:35 2012 New Revision: 233206 URL: http://svn.freebsd.org/changeset/base/233206 Log: MFC 232072: Pretty-print the advice constants passed to posix_fadvise(2). Modified: stable/8/usr.bin/kdump/kdump.c stable/8/usr.bin/kdump/kdump_subr.h stable/8/usr.bin/kdump/mksubr Directory Properties: stable/8/usr.bin/kdump/ (props changed) Modified: stable/8/usr.bin/kdump/kdump.c ============================================================================== --- stable/8/usr.bin/kdump/kdump.c Mon Mar 19 21:33:23 2012 (r233205) +++ stable/8/usr.bin/kdump/kdump.c Mon Mar 19 21:33:35 2012 (r233206) @@ -939,6 +939,14 @@ ktrsyscall(struct ktr_syscall *ktr, u_in kldunloadfflagsname ((int)*ip); ip++; narg--; + } else if (ktr->ktr_code == SYS_posix_fadvise) { + print_number(ip,narg,c); + print_number(ip,narg,c); + print_number(ip,narg,c); + (void)putchar(','); + fadvisebehavname((int)*ip); + ip++; + narg--; } } while (narg > 0) { Modified: stable/8/usr.bin/kdump/kdump_subr.h ============================================================================== --- stable/8/usr.bin/kdump/kdump_subr.h Mon Mar 19 21:33:23 2012 (r233205) +++ stable/8/usr.bin/kdump/kdump_subr.h Mon Mar 19 21:33:35 2012 (r233206) @@ -32,6 +32,7 @@ void whencename (int); void rlimitname (int); void shutdownhowname (int); void prioname (int); +void fadvisebehavname (int); void madvisebehavname (int); void msyncflagsname (int); void schedpolicyname (int); Modified: stable/8/usr.bin/kdump/mksubr ============================================================================== --- stable/8/usr.bin/kdump/mksubr Mon Mar 19 21:33:23 2012 (r233205) +++ stable/8/usr.bin/kdump/mksubr Mon Mar 19 21:33:35 2012 (r233206) @@ -349,6 +349,7 @@ auto_switch_type "whencename" "SEEK_[A-Z auto_switch_type "rlimitname" "RLIMIT_[A-Z]+[[:space:]]+[0-9]+" "sys/resource.h" auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" auto_switch_type "prioname" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h" +auto_switch_type "fadvisebehavname" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h" auto_switch_type "madvisebehavname" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h" auto_switch_type "msyncflagsname" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h" auto_switch_type "schedpolicyname" "SCHED_[A-Z]+[[:space:]]+[0-9]+" "sched.h" From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 22:08:13 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFDB4106564A; Mon, 19 Mar 2012 22:08:13 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FDC18FC0C; Mon, 19 Mar 2012 22:08:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JM8DUa088489; Mon, 19 Mar 2012 22:08:13 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JM8Dl0088487; Mon, 19 Mar 2012 22:08:13 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201203192208.q2JM8Dl0088487@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 19 Mar 2012 22:08:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233210 - stable/9/sys/dev/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:08:14 -0000 Author: jkim Date: Mon Mar 19 22:08:13 2012 New Revision: 233210 URL: http://svn.freebsd.org/changeset/base/233210 Log: MFC: r232991 Add a PCI quirk to ignore PCI map registers from configuration space. This works around a resource conflict, e. g., MSI K9AGM2 motherboard. Modified: stable/9/sys/dev/pci/pci.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/pci/pci.c ============================================================================== --- stable/9/sys/dev/pci/pci.c Mon Mar 19 21:57:31 2012 (r233209) +++ stable/9/sys/dev/pci/pci.c Mon Mar 19 22:08:13 2012 (r233210) @@ -188,6 +188,7 @@ struct pci_quirk { #define PCI_QUIRK_MAP_REG 1 /* PCI map register in weird place */ #define PCI_QUIRK_DISABLE_MSI 2 /* MSI/MSI-X doesn't work */ #define PCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI works */ +#define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ int arg1; int arg2; }; @@ -236,6 +237,16 @@ static const struct pci_quirk const pci_ */ { 0x12378086, PCI_QUIRK_ENABLE_MSI_VM, 0, 0 }, + /* + * HPET MMIO base address may appear in Bar1 for AMD SB600 SMBus + * controller depending on SoftPciRst register (PM_IO 0x55 [7]). + * It prevents us from attaching hpet(4) when the bit is unset. + * Note this quirk only affects SB600 revision A13 and earlier. + * For SB600 A21 and later, firmware must set the bit to hide it. + * For SB700 and later, it is unused and hardcoded to zero. + */ + { 0x43851002, PCI_QUIRK_UNMAP_REG, 0x14, 0 }, + { 0 } }; @@ -3023,12 +3034,18 @@ xhci_early_takeover(device_t self) void pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask) { - struct pci_devinfo *dinfo = device_get_ivars(dev); - pcicfgregs *cfg = &dinfo->cfg; - struct resource_list *rl = &dinfo->resources; + struct pci_devinfo *dinfo; + pcicfgregs *cfg; + struct resource_list *rl; const struct pci_quirk *q; + uint32_t devid; int i; + dinfo = device_get_ivars(dev); + cfg = &dinfo->cfg; + rl = &dinfo->resources; + devid = (cfg->device << 16) | cfg->vendor; + /* ATA devices needs special map treatment */ if ((pci_get_class(dev) == PCIC_STORAGE) && (pci_get_subclass(dev) == PCIS_STORAGE_IDE) && @@ -3037,18 +3054,29 @@ pci_add_resources(device_t bus, device_t !pci_read_config(dev, PCIR_BAR(2), 4))) ) pci_ata_maps(bus, dev, rl, force, prefetchmask); else - for (i = 0; i < cfg->nummaps;) + for (i = 0; i < cfg->nummaps;) { + /* + * Skip quirked resources. + */ + for (q = &pci_quirks[0]; q->devid != 0; q++) + if (q->devid == devid && + q->type == PCI_QUIRK_UNMAP_REG && + q->arg1 == PCIR_BAR(i)) + break; + if (q->devid != 0) { + i++; + continue; + } i += pci_add_map(bus, dev, PCIR_BAR(i), rl, force, prefetchmask & (1 << i)); + } /* * Add additional, quirked resources. */ - for (q = &pci_quirks[0]; q->devid; q++) { - if (q->devid == ((cfg->device << 16) | cfg->vendor) - && q->type == PCI_QUIRK_MAP_REG) + for (q = &pci_quirks[0]; q->devid != 0; q++) + if (q->devid == devid && q->type == PCI_QUIRK_MAP_REG) pci_add_map(bus, dev, q->arg1, rl, force, 0); - } if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline)) { #ifdef __PCI_REROUTE_INTERRUPT From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 22:20:48 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8FBDE106564A; Mon, 19 Mar 2012 22:20:48 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A3248FC0C; Mon, 19 Mar 2012 22:20:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JMKmFO088965; Mon, 19 Mar 2012 22:20:48 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JMKmuk088963; Mon, 19 Mar 2012 22:20:48 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203192220.q2JMKmuk088963@svn.freebsd.org> From: Ken Smith Date: Mon, 19 Mar 2012 22:20:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233211 - stable/8/sys/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:20:48 -0000 Author: kensmith Date: Mon Mar 19 22:20:47 2012 New Revision: 233211 URL: http://svn.freebsd.org/changeset/base/233211 Log: We seem to be having issues with a bug in the loader that causes it to estimate the program header size for the kernel wrong. It can result in the kernel build failing with the message: ld: kernel.debug: Not enough room for program headers (allocated 5, need 6) ld: final link failed: Bad value Tinderbox builds were failing with this message a short time ago, and I encountered it while preparing the i386 build machine for the 8.3-RC2 builds. Konstantin has looked at it and believes the issue was fixed in recent versions of binutils. It is a bit too late in the release process to be messing around with the loader and/or binutils. This workaround seems to take care of the problem for now. Reviewed by: kib Modified: stable/8/sys/conf/ldscript.i386 Modified: stable/8/sys/conf/ldscript.i386 ============================================================================== --- stable/8/sys/conf/ldscript.i386 Mon Mar 19 22:08:13 2012 (r233210) +++ stable/8/sys/conf/ldscript.i386 Mon Mar 19 22:20:47 2012 (r233211) @@ -6,7 +6,7 @@ SEARCH_DIR(/usr/lib); SECTIONS { /* Read-only sections, merged into text segment: */ - . = kernbase + kernload + SIZEOF_HEADERS; + . = kernbase + kernload + 256; .interp : { *(.interp) } .hash : { *(.hash) } .dynsym : { *(.dynsym) } From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 22:26:03 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 527F61065675; Mon, 19 Mar 2012 22:26:03 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 337A28FC18; Mon, 19 Mar 2012 22:26:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JMQ3Zk089273; Mon, 19 Mar 2012 22:26:03 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JMQ2oi089271; Mon, 19 Mar 2012 22:26:02 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201203192226.q2JMQ2oi089271@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 19 Mar 2012 22:26:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233214 - stable/8/sys/dev/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:26:03 -0000 Author: jkim Date: Mon Mar 19 22:26:02 2012 New Revision: 233214 URL: http://svn.freebsd.org/changeset/base/233214 Log: MFC: r232991 Add a PCI quirk to ignore PCI map registers from configuration space. This works around a resource conflict, e. g., MSI K9AGM2 motherboard. Modified: stable/8/sys/dev/pci/pci.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Mon Mar 19 22:23:52 2012 (r233213) +++ stable/8/sys/dev/pci/pci.c Mon Mar 19 22:26:02 2012 (r233214) @@ -188,6 +188,7 @@ struct pci_quirk { #define PCI_QUIRK_MAP_REG 1 /* PCI map register in weird place */ #define PCI_QUIRK_DISABLE_MSI 2 /* MSI/MSI-X doesn't work */ #define PCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI works */ +#define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ int arg1; int arg2; }; @@ -236,6 +237,16 @@ static const struct pci_quirk const pci_ */ { 0x12378086, PCI_QUIRK_ENABLE_MSI_VM, 0, 0 }, + /* + * HPET MMIO base address may appear in Bar1 for AMD SB600 SMBus + * controller depending on SoftPciRst register (PM_IO 0x55 [7]). + * It prevents us from attaching hpet(4) when the bit is unset. + * Note this quirk only affects SB600 revision A13 and earlier. + * For SB600 A21 and later, firmware must set the bit to hide it. + * For SB700 and later, it is unused and hardcoded to zero. + */ + { 0x43851002, PCI_QUIRK_UNMAP_REG, 0x14, 0 }, + { 0 } }; @@ -2790,12 +2801,18 @@ ehci_early_takeover(device_t self) void pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask) { - struct pci_devinfo *dinfo = device_get_ivars(dev); - pcicfgregs *cfg = &dinfo->cfg; - struct resource_list *rl = &dinfo->resources; + struct pci_devinfo *dinfo; + pcicfgregs *cfg; + struct resource_list *rl; const struct pci_quirk *q; + uint32_t devid; int i; + dinfo = device_get_ivars(dev); + cfg = &dinfo->cfg; + rl = &dinfo->resources; + devid = (cfg->device << 16) | cfg->vendor; + /* ATA devices needs special map treatment */ if ((pci_get_class(dev) == PCIC_STORAGE) && (pci_get_subclass(dev) == PCIS_STORAGE_IDE) && @@ -2804,18 +2821,29 @@ pci_add_resources(device_t bus, device_t !pci_read_config(dev, PCIR_BAR(2), 4))) ) pci_ata_maps(bus, dev, rl, force, prefetchmask); else - for (i = 0; i < cfg->nummaps;) + for (i = 0; i < cfg->nummaps;) { + /* + * Skip quirked resources. + */ + for (q = &pci_quirks[0]; q->devid != 0; q++) + if (q->devid == devid && + q->type == PCI_QUIRK_UNMAP_REG && + q->arg1 == PCIR_BAR(i)) + break; + if (q->devid != 0) { + i++; + continue; + } i += pci_add_map(bus, dev, PCIR_BAR(i), rl, force, prefetchmask & (1 << i)); + } /* * Add additional, quirked resources. */ - for (q = &pci_quirks[0]; q->devid; q++) { - if (q->devid == ((cfg->device << 16) | cfg->vendor) - && q->type == PCI_QUIRK_MAP_REG) + for (q = &pci_quirks[0]; q->devid != 0; q++) + if (q->devid == devid && q->type == PCI_QUIRK_MAP_REG) pci_add_map(bus, dev, q->arg1, rl, force, 0); - } if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline)) { #ifdef __PCI_REROUTE_INTERRUPT From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 22:41:53 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A0AC1065693; Mon, 19 Mar 2012 22:41:53 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73A538FC18; Mon, 19 Mar 2012 22:41:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JMfrBu089927; Mon, 19 Mar 2012 22:41:53 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JMfrY6089925; Mon, 19 Mar 2012 22:41:53 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201203192241.q2JMfrY6089925@svn.freebsd.org> From: Josh Paetzel Date: Mon, 19 Mar 2012 22:41:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233217 - stable/9/usr.sbin/pc-sysinstall/backend-query X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:41:53 -0000 Author: jpaetzel Date: Mon Mar 19 22:41:53 2012 New Revision: 233217 URL: http://svn.freebsd.org/changeset/base/233217 Log: MFC 227470: Report the amount of memory from smbios data if provided. This should get the correct memory size even if a 32-bit image is running on a machine with > 4GB of memory. This can be useful is using a 32-bit installer on a machine which will eventually run a 64-bit image. Reviewed by: kmoore Modified: stable/9/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh Mon Mar 19 22:34:24 2012 (r233216) +++ stable/9/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh Mon Mar 19 22:41:53 2012 (r233217) @@ -25,4 +25,8 @@ # # $FreeBSD$ -expr $(sysctl -n hw.realmem) / 1048576 +if smbios_mem=$(kenv -q smbios.memory.enabled); then + expr $smbios_mem / 1024 +else + expr $(sysctl -n hw.realmem) / 1048576 +fi From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 22:52:19 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD6AC1065670; Mon, 19 Mar 2012 22:52:19 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C7EA28FC14; Mon, 19 Mar 2012 22:52:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JMqJcI090303; Mon, 19 Mar 2012 22:52:19 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JMqJ30090301; Mon, 19 Mar 2012 22:52:19 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201203192252.q2JMqJ30090301@svn.freebsd.org> From: Josh Paetzel Date: Mon, 19 Mar 2012 22:52:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233218 - stable/9/usr.sbin/pc-sysinstall/backend-query X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:52:20 -0000 Author: jpaetzel Date: Mon Mar 19 22:52:19 2012 New Revision: 233218 URL: http://svn.freebsd.org/changeset/base/233218 Log: MFC: 232681 Work around broken BIOS memory reporting Andrzej has a machine with 32GB of RAM, but only 16GB is reported by the smbios.memory.enabled. Thus, use the greater of hw.realmem and the smbios value. Reported by: Andrzej Tobola Modified: stable/9/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh Mon Mar 19 22:41:53 2012 (r233217) +++ stable/9/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh Mon Mar 19 22:52:19 2012 (r233218) @@ -26,7 +26,14 @@ # $FreeBSD$ if smbios_mem=$(kenv -q smbios.memory.enabled); then - expr $smbios_mem / 1024 + smbios_mem=$(expr $smbios_mem / 1024) else - expr $(sysctl -n hw.realmem) / 1048576 + smbios_mem=0 +fi +realmem=$(expr $(sysctl -n hw.realmem) / 1048576) + +if [ $smbios_mem -gt $realmem ]; then + echo $smbios_mem +else + echo $realmem fi From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 22:59:20 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 861BD1065673; Mon, 19 Mar 2012 22:59:20 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D3178FC12; Mon, 19 Mar 2012 22:59:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JMxK3o090557; Mon, 19 Mar 2012 22:59:20 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JMxKoc090555; Mon, 19 Mar 2012 22:59:20 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201203192259.q2JMxKoc090555@svn.freebsd.org> From: Josh Paetzel Date: Mon, 19 Mar 2012 22:59:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233219 - stable/9/usr.sbin/pc-sysinstall/backend X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:59:20 -0000 Author: jpaetzel Date: Mon Mar 19 22:59:19 2012 New Revision: 233219 URL: http://svn.freebsd.org/changeset/base/233219 Log: MFC: 232880 Fix a bug running the autoinstall functionality. Submitted by: kmoore Obtained from: PC-BSD Modified: stable/9/usr.sbin/pc-sysinstall/backend/startautoinstall.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend/startautoinstall.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/startautoinstall.sh Mon Mar 19 22:52:19 2012 (r233218) +++ stable/9/usr.sbin/pc-sysinstall/backend/startautoinstall.sh Mon Mar 19 22:59:19 2012 (r233219) @@ -114,7 +114,7 @@ then esac fi - ${PROGDIR}/pc-sysinstall -c ${INSTALL_CFG} + pc-sysinstall -c ${INSTALL_CFG} if [ $? -eq 0 ] then if [ -n "$SHUTDOWN_CMD" ] From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 23:04:21 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D149E106566B; Mon, 19 Mar 2012 23:04:21 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBA858FC17; Mon, 19 Mar 2012 23:04:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JN4Lhx090789; Mon, 19 Mar 2012 23:04:21 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JN4L7C090786; Mon, 19 Mar 2012 23:04:21 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201203192304.q2JN4L7C090786@svn.freebsd.org> From: Josh Paetzel Date: Mon, 19 Mar 2012 23:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233220 - in stable/9/usr.sbin/pc-sysinstall: backend backend-partmanager X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 23:04:21 -0000 Author: jpaetzel Date: Mon Mar 19 23:04:21 2012 New Revision: 233220 URL: http://svn.freebsd.org/changeset/base/233220 Log: MFC: 232889 Make sure when creating new MBR partition it is set to active by default. Submitted by: kmoore Obtained from: PC-BSD Modified: stable/9/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh Mon Mar 19 22:59:19 2012 (r233219) +++ stable/9/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh Mon Mar 19 23:04:21 2012 (r233220) @@ -86,7 +86,12 @@ fi # If this is an empty disk, see if we need to create a new scheme for it gpart show ${DISK} >/dev/null 2>/dev/null if [ $? -eq 0 -a "${SLICENUM}" = "1" ] ; then - gpart create -s ${TYPE} ${DISK} + if [ "${TYPE}" = "mbr" -o "${TYPE}" = "MBR" ] ; then + flags="-s ${TYPE} -f active" + else + flags="-s ${TYPE}" + fi + gpart create ${flags} ${DISK} fi # If we have a starting block, use it Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Mar 19 22:59:19 2012 (r233219) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Mar 19 23:04:21 2012 (r233220) @@ -641,7 +641,7 @@ init_mbr_full_disk() sleep 2 echo_log "Running gpart on ${_intDISK}" - rc_halt "gpart create -s mbr ${_intDISK}" + rc_halt "gpart create -s mbr -f active ${_intDISK}" # Lets figure out disk size in blocks # Get the cyl of this disk From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 23:09:30 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E232A1065680; Mon, 19 Mar 2012 23:09:30 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B3AA58FC1A; Mon, 19 Mar 2012 23:09:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JN9Uxw090982; Mon, 19 Mar 2012 23:09:30 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JN9UVN090980; Mon, 19 Mar 2012 23:09:30 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201203192309.q2JN9UVN090980@svn.freebsd.org> From: Josh Paetzel Date: Mon, 19 Mar 2012 23:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233221 - stable/9/usr.sbin/pc-sysinstall/backend X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 23:09:31 -0000 Author: jpaetzel Date: Mon Mar 19 23:09:30 2012 New Revision: 233221 URL: http://svn.freebsd.org/changeset/base/233221 Log: MFC: 232890 Fix a couple of bugs saving network config. Don't duplicate wlans_ lines. Enable ipv6 on wireless devices correctly. Submitted by: kmoore Obtained from: PC-BSD Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-networking.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-networking.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-networking.sh Mon Mar 19 23:04:21 2012 (r233220) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-networking.sh Mon Mar 19 23:09:30 2012 (r233221) @@ -104,7 +104,10 @@ enable_dhcp_all() then # We have a wifi device, setup a wlan* entry for it WLAN="wlan${WLANCOUNT}" - echo "wlans_${NIC}=\"${WLAN}\"" >>${FSMNT}/etc/rc.conf + cat ${FSMNT}/etc/rc.conf | grep -q "wlans_${NIC}=" + if [ $? -ne 0 ] ; then + echo "wlans_${NIC}=\"${WLAN}\"" >>${FSMNT}/etc/rc.conf + fi echo "ifconfig_${WLAN}=\"DHCP\"" >>${FSMNT}/etc/rc.conf CNIC="${WLAN}" WLANCOUNT=$((WLANCOUNT+1)) @@ -138,7 +141,7 @@ enable_slaac_all() do NIC="`echo $line | cut -d ':' -f 1`" DESC="`echo $line | cut -d ':' -f 2`" - echo_log "Setting $NIC to acceptign RAs on the system." + echo_log "Setting $NIC to accepting RAs on the system." check_is_wifi ${NIC} if [ $? -eq 0 ] then @@ -146,9 +149,12 @@ enable_slaac_all() # Given we cannot have DHCP and SLAAC the same time currently # it's save to just duplicate. WLAN="wlan${WLANCOUNT}" - echo "wlans_${NIC}=\"${WLAN}\"" >>${FSMNT}/etc/rc.conf + cat ${FSMNT}/etc/rc.conf | grep -q "wlans_${NIC}=" + if [ $? -ne 0 ] ; then + echo "wlans_${NIC}=\"${WLAN}\"" >>${FSMNT}/etc/rc.conf + fi #echo "ifconfig_${NIC}=\"up\"" >>${FSMNT}/etc/rc.conf - echo "ifconfig_${WLAN}=\"inet6 accept_rtadv\"" >>${FSMNT}/etc/rc.conf + echo "ifconfig_${WLAN}_ipv6=\"inet6 accept_rtadv\"" >>${FSMNT}/etc/rc.conf CNIC="${WLAN}" WLANCOUNT=$((WLANCOUNT+1)) else From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 23:14:48 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4C94B106564A; Mon, 19 Mar 2012 23:14:48 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 364768FC14; Mon, 19 Mar 2012 23:14:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JNEmDL091194; Mon, 19 Mar 2012 23:14:48 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JNEm5F091192; Mon, 19 Mar 2012 23:14:48 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201203192314.q2JNEm5F091192@svn.freebsd.org> From: Josh Paetzel Date: Mon, 19 Mar 2012 23:14:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233222 - stable/9/usr.sbin/pc-sysinstall/backend-query X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 23:14:48 -0000 Author: jpaetzel Date: Mon Mar 19 23:14:47 2012 New Revision: 233222 URL: http://svn.freebsd.org/changeset/base/233222 Log: MFC: 232895 Check for intel RAID devices Submitted by: kmoore Obtained from: PC-BSD Modified: stable/9/usr.sbin/pc-sysinstall/backend-query/disk-list.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend-query/disk-list.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend-query/disk-list.sh Mon Mar 19 23:09:30 2012 (r233221) +++ stable/9/usr.sbin/pc-sysinstall/backend-query/disk-list.sh Mon Mar 19 23:14:47 2012 (r233222) @@ -58,6 +58,18 @@ then fi fi +# Add any RAID devices +if [ -d "/dev/raid" ] ; then + cd /dev/raid + for i in `ls` + do + case ${i} in + r0|r1|r2|r3|r4|r5) SYSDISK="${SYSDISK} ${i}" ;; + *) ;; + esac + done +fi + # Now loop through these devices, and list the disk drives for i in ${SYSDISK} do @@ -77,7 +89,7 @@ do NEWLINE=$(camcontrol identify $DEV | sed -ne 's/^device model *//p') if [ -z "$NEWLINE" ]; then # Now try atacontrol - NEWLINE=$(atacontrol list | sed -n "s|^.*$DEV <\(.*\)>.*|\1|p") + NEWLINE=$(atacontrol list 2>/dev/null | sed -n "s|^.*$DEV <\(.*\)>.*|\1|p") if [ -z "$NEWLINE" ]; then NEWLINE=" " From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 23:17:27 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DC21106564A; Mon, 19 Mar 2012 23:17:27 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0EA518FC12; Mon, 19 Mar 2012 23:17:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JNHQOi091405; Mon, 19 Mar 2012 23:17:26 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JNHQgl091402; Mon, 19 Mar 2012 23:17:26 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201203192317.q2JNHQgl091402@svn.freebsd.org> From: Josh Paetzel Date: Mon, 19 Mar 2012 23:17:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233223 - stable/9/usr.sbin/pc-sysinstall/backend X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 23:17:27 -0000 Author: jpaetzel Date: Mon Mar 19 23:17:26 2012 New Revision: 233223 URL: http://svn.freebsd.org/changeset/base/233223 Log: MFC: 232898 Improve ZFS exporting functionality, only export pools which are on a specific device we happen to be writing to. This fixes an issue when running pc-sysinstall on a running system which needs ZFS and the main disk gets exported. Submitted by: kmoore Obtained from: PC-BSD Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Mar 19 23:14:47 2012 (r233222) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Mar 19 23:17:26 2012 (r233223) @@ -224,16 +224,6 @@ get_disk_mediasize() export VAL="${mediasize}" }; -# Function which exports all zpools, making them safe to overwrite potentially -export_all_zpools() -{ - # Export any zpools - for i in `zpool list -H -o name` - do - zpool export -f ${i} - done -}; - # Function to delete all gparts before starting an install delete_all_gpart() { @@ -268,10 +258,15 @@ delete_all_gpart() # Function to export all zpools before starting an install stop_all_zfs() { - # Export all zpools again, so that we can overwrite these partitions potentially + local DISK="`echo ${1} | sed 's|/dev/||g'`" + + # Export any zpools using this device so we can overwrite for i in `zpool list -H -o name` do - zpool export -f ${i} + ztst=`zpool status ${i} | grep "ONLINE" | awk '{print $1}' | grep -q ${DISK}` + if [ "$ztst" = "$DISK" ] ; then + zpool export -f ${i} + fi done }; @@ -324,9 +319,6 @@ setup_disk_slice() disknum="0" gmnum="0" - # Make sure all zpools are exported - export_all_zpools - # We are ready to start setting up the disks, lets read the config and do the actions while read line do @@ -354,7 +346,7 @@ setup_disk_slice() stop_all_geli ${DISK} # Make sure we don't have any zpools loaded - stop_all_zfs + stop_all_zfs ${DISK} fi @@ -375,6 +367,16 @@ setup_disk_slice() then exit_err "ERROR: The mirror disk ${MIRRORDISK} does not exist!" fi + + # Make sure we stop any gmirrors on this mirror disk + stop_all_gmirror ${MIRRORDISK} + + # Make sure we stop any geli stuff on this mirror disk + stop_all_geli ${MIRRORDISK} + + # Make sure we don't have any zpools mirror loaded + stop_all_zfs ${MIRRORDISK} + fi # Lets see if we have been given a mirror balance choice From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 23:20:52 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AE5E1106564A; Mon, 19 Mar 2012 23:20:52 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97E538FC12; Mon, 19 Mar 2012 23:20:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JNKqEc091580; Mon, 19 Mar 2012 23:20:52 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JNKqeh091574; Mon, 19 Mar 2012 23:20:52 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201203192320.q2JNKqeh091574@svn.freebsd.org> From: Josh Paetzel Date: Mon, 19 Mar 2012 23:20:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233224 - stable/9/usr.sbin/pc-sysinstall/backend X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 23:20:52 -0000 Author: jpaetzel Date: Mon Mar 19 23:20:52 2012 New Revision: 233224 URL: http://svn.freebsd.org/changeset/base/233224 Log: MFC: 232899 Add the ability to use a varity of ZFS dataset options. While here fix a bug causing zpools with /tmp mount-points to fail Submitted by: kmoore Obtained from: PC-BSD Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh stable/9/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh stable/9/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh stable/9/usr.sbin/pc-sysinstall/backend/functions-newfs.sh stable/9/usr.sbin/pc-sysinstall/backend/functions-unmount.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon Mar 19 23:17:26 2012 (r233223) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon Mar 19 23:20:52 2012 (r233224) @@ -50,14 +50,14 @@ get_fs_line_xvars() ACTIVEDEV="${1}" LINE="${2}" - echo $LINE | grep -q ' (' 2>/dev/null + echo $LINE | cut -d ' ' -f 4 | grep -q ' (' 2>/dev/null if [ $? -eq 0 ] ; then # See if we are looking for ZFS specific options echo $LINE | grep -q '^ZFS' 2>/dev/null if [ $? -eq 0 ] ; then ZTYPE="NONE" - ZFSVARS="`echo $LINE | cut -d '(' -f 2- | cut -d ')' -f 1 | xargs`" + ZFSVARS="`echo $LINE | cut -d ' ' -f 4 |cut -d '(' -f 2- | cut -d ')' -f 1 | xargs`" echo $ZFSVARS | grep -qE "^(disk|file|mirror|raidz(1|2)?|spare|log|cache):" 2>/dev/null if [ $? -eq 0 ] ; then @@ -126,9 +126,9 @@ gen_glabel_name() NUM="0" MAXNUM="20" - # Check if we are doing /, and rename it - if [ "$MOUNT" = "/" ] - then + if [ "$TYPE" = "ZFS" ] ; then + NAME="zpool" + elif [ "$MOUNT" = "/" ] ; then NAME="rootfs" else # If doing a swap partition, also rename it @@ -341,7 +341,7 @@ setup_gpart_partitions() # Save this data to our partition config dir if [ "${_pType}" = "gpt" ] ; then _dFile="`echo $_pDisk | sed 's|/|-|g'`" - echo "${FS}:${MNT}:${ENC}:${PLABEL}:GPT:${XTRAOPTS}" >${PARTDIR}/${_dFile}p${CURPART} + echo "${FS}#${MNT}#${ENC}#${PLABEL}#GPT#${XTRAOPTS}" >${PARTDIR}/${_dFile}p${CURPART} # Clear out any headers sleep 2 @@ -354,7 +354,7 @@ setup_gpart_partitions() else # MBR Partition or GPT slice _dFile="`echo $_wSlice | sed 's|/|-|g'`" - echo "${FS}:${MNT}:${ENC}:${PLABEL}:MBR:${XTRAOPTS}:${IMAGE}" >${PARTDIR}/${_dFile}${PARTLETTER} + echo "${FS}#${MNT}#${ENC}#${PLABEL}#MBR#${XTRAOPTS}#${IMAGE}" >${PARTDIR}/${_dFile}${PARTLETTER} # Clear out any headers sleep 2 dd if=/dev/zero of=${_wSlice}${PARTLETTER} count=2048 2>/dev/null @@ -409,7 +409,7 @@ setup_gpart_partitions() fi # Found our flag to commit this label setup, check that we found at least 1 partition - if [ "${CURPART}" = "2" ] ; then + if [ "${CURPART}" = "1" ] ; then exit_err "ERROR: commitDiskLabel was called without any partition entries for it!" fi Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh Mon Mar 19 23:17:26 2012 (r233223) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh Mon Mar 19 23:20:52 2012 (r233224) @@ -34,8 +34,8 @@ zfs_cleanup_unmount() for PART in `ls ${PARTDIR}` do PARTDEV=`echo $PART | sed 's|-|/|g'` - PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" + PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" + PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" ZPOOLNAME=$(get_zpool_name "${PARTDEV}") if [ "$PARTFS" = "ZFS" ] @@ -84,9 +84,9 @@ zfs_cleanup_unmount() for PART in `ls ${PARTDIR}` do PARTDEV=`echo $PART | sed 's|-|/|g'` - PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`" + PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" + PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" + PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" ZPOOLNAME=$(get_zpool_name "${PARTDEV}") if [ "$PARTFS" = "ZFS" ] @@ -101,17 +101,20 @@ zfs_cleanup_unmount() # Check if we have multiple zfs mounts specified for ZMNT in `echo ${PARTMNT} | sed 's|,| |g'` do + ZMNT="`echo $ZMNT | cut -d '(' -f 1`" PARTMNTREV="${ZMNT} ${PARTMNTREV}" done for ZMNT in ${PARTMNTREV} do - if [ "${ZMNT}" != "/" ] - then - rc_halt "zfs set mountpoint=${ZMNT} ${ZPOOLNAME}${ZMNT}" + if [ "${ZMNT}" = "/" ] ; then continue ; fi + # Some ZFS like /swap aren't mounted, and dont need unmounting + mount | grep -q "${FSMNT}${ZMNT}" + if [ $? -eq 0 ] ; then rc_halt "zfs unmount ${ZPOOLNAME}${ZMNT}" - sleep 2 + rc_halt "zfs set mountpoint=${ZMNT} ${ZPOOLNAME}${ZMNT}" fi + sleep 2 done fi done @@ -154,10 +157,10 @@ setup_fstab() for PART in `ls ${PARTDIR}` do PARTDEV=`echo $PART | sed 's|-|/|g'` - PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`" - PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`" + PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" + PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" + PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" + PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d '#' -f 4`" # Unset EXT EXT="" Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh Mon Mar 19 23:17:26 2012 (r233223) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh Mon Mar 19 23:20:52 2012 (r233224) @@ -57,24 +57,52 @@ mount_partition() # Check if we have multiple zfs mounts specified for ZMNT in `echo ${MNTPOINT} | sed 's|,| |g'` do + # Check for any ZFS specific mount options + ZMNTOPTS="`echo $ZMNT | cut -d '(' -f 2 | cut -d ')' -f 1`" + if [ "$ZMNTOPTS" = "$ZMNT" ] ; then ZMNTOPTS="" ; fi + + # Reset ZMNT with options removed + ZMNT="`echo $ZMNT | cut -d '(' -f 1`" + # First make sure we create the mount point if [ ! -d "${FSMNT}${ZMNT}" ] ; then mkdir -p ${FSMNT}${ZMNT} >>${LOGOUT} 2>>${LOGOUT} fi + # Check for any volsize args + zcopt="" + for ZOPT in `echo $ZMNTOPTS | sed 's/|/ /g'` + do + echo "$ZOPT" | grep -q volsize + if [ $? -eq 0 ] ; then + volsize=`echo $ZOPT | cut -d '=' -f 2` + zcopt="-V $volsize" + fi + done + if [ "${ZMNT}" = "/" ] ; then ZNAME="" else ZNAME="${ZMNT}" - echo_log "zfs create -p ${ZPOOLNAME}${ZNAME}" - rc_halt "zfs create -p ${ZPOOLNAME}${ZNAME}" + echo_log "zfs create $zcopt -p ${ZPOOLNAME}${ZNAME}" + rc_halt "zfs create $zcopt -p ${ZPOOLNAME}${ZNAME}" fi sleep 2 - rc_halt "zfs set mountpoint=${FSMNT}${ZNAME} ${ZPOOLNAME}${ZNAME}" + if [ -z "$zcopt" ] ; then + rc_halt "zfs set mountpoint=${FSMNT}${ZNAME} ${ZPOOLNAME}${ZNAME}" + fi + + # If no ZFS options, we can skip + if [ -z "$ZMNTOPTS" ] ; then continue ; fi - # Disable atime for this zfs partition, speed increase - rc_nohalt "zfs set atime=off ${ZPOOLNAME}${ZNAME}" - done + # Parse any ZFS options now + for ZOPT in `echo $ZMNTOPTS | sed 's/|/ /g'` + do + echo "$ZOPT" | grep -q volsize + if [ $? -eq 0 ] ; then continue ; fi + rc_halt "zfs set $ZOPT ${ZPOOLNAME}${ZNAME}" + done + done # End of adding ZFS mounts else # If we are not on ZFS, lets do the mount now @@ -107,9 +135,9 @@ mount_all_filesystems() exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" fi - PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`" + PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" + PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" + PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" if [ "${PARTENC}" = "ON" ] then @@ -144,9 +172,9 @@ mount_all_filesystems() exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" fi - PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`" + PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" + PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" + PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" if [ "${PARTENC}" = "ON" ] then Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-newfs.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-newfs.sh Mon Mar 19 23:17:26 2012 (r233223) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-newfs.sh Mon Mar 19 23:20:52 2012 (r233224) @@ -95,13 +95,13 @@ setup_filesystems() exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" fi - PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`" - PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`" - PARTGEOM="`cat ${PARTDIR}/${PART} | cut -d ':' -f 5`" - PARTXTRAOPTS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 6`" - PARTIMAGE="`cat ${PARTDIR}/${PART} | cut -d ':' -f 7`" + PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" + PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" + PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" + PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d '#' -f 4`" + PARTGEOM="`cat ${PARTDIR}/${PART} | cut -d '#' -f 5`" + PARTXTRAOPTS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 6`" + PARTIMAGE="`cat ${PARTDIR}/${PART} | cut -d '#' -f 7`" # Make sure journaling isn't enabled on this device if [ -e "${PARTDEV}.journal" ] Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-unmount.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-unmount.sh Mon Mar 19 23:17:26 2012 (r233223) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-unmount.sh Mon Mar 19 23:20:52 2012 (r233224) @@ -72,10 +72,10 @@ unmount_all_filesystems() for PART in `ls ${PARTDIR}` do PARTDEV=`echo $PART | sed 's|-|/|g'` - PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`" - PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`" + PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" + PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" + PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" + PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d '#' -f 4`" if [ "${PARTENC}" = "ON" ] then @@ -168,9 +168,9 @@ unmount_all_filesystems_failure() for PART in `ls ${PARTDIR}` do PARTDEV=`echo $PART | sed 's|-|/|g'` - PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`" + PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" + PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" + PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" if [ "${PARTFS}" = "SWAP" ] then From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 23:25:11 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61C201065688; Mon, 19 Mar 2012 23:25:11 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4CE528FC1A; Mon, 19 Mar 2012 23:25:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JNPBJ4091791; Mon, 19 Mar 2012 23:25:11 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JNPBnw091789; Mon, 19 Mar 2012 23:25:11 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203192325.q2JNPBnw091789@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 23:25:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233225 - stable/9/usr.sbin/pc-sysinstall/backend X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 23:25:11 -0000 Author: eadler Date: Mon Mar 19 23:25:10 2012 New Revision: 233225 URL: http://svn.freebsd.org/changeset/base/233225 Log: MFC 232510: Permit the use of raidz3 in pc-sysinstall PR: conf/164709 Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon Mar 19 23:20:52 2012 (r233224) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon Mar 19 23:25:10 2012 (r233225) @@ -59,7 +59,7 @@ get_fs_line_xvars() ZTYPE="NONE" ZFSVARS="`echo $LINE | cut -d ' ' -f 4 |cut -d '(' -f 2- | cut -d ')' -f 1 | xargs`" - echo $ZFSVARS | grep -qE "^(disk|file|mirror|raidz(1|2)?|spare|log|cache):" 2>/dev/null + echo $ZFSVARS | grep -qE "^(disk|file|mirror|raidz(1|2|3)?|spare|log|cache):" 2>/dev/null if [ $? -eq 0 ] ; then ZTYPE=`echo $ZFSVARS | cut -f1 -d:` ZFSVARS=`echo $ZFSVARS | sed "s|$ZTYPE: ||g" | sed "s|$ZTYPE:||g"` From owner-svn-src-stable@FreeBSD.ORG Mon Mar 19 23:28:14 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0A5651065673; Mon, 19 Mar 2012 23:28:14 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8E608FC19; Mon, 19 Mar 2012 23:28:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JNSDb7091926; Mon, 19 Mar 2012 23:28:13 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JNSDj7091923; Mon, 19 Mar 2012 23:28:13 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201203192328.q2JNSDj7091923@svn.freebsd.org> From: Josh Paetzel Date: Mon, 19 Mar 2012 23:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233226 - stable/9/usr.sbin/pc-sysinstall/backend X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 23:28:14 -0000 Author: jpaetzel Date: Mon Mar 19 23:28:13 2012 New Revision: 233226 URL: http://svn.freebsd.org/changeset/base/233226 Log: MFC: 232901 Use gpart "-a" flag to 4k alignment. Submitted by: kmoore Obtained from: PC-BSD Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon Mar 19 23:25:10 2012 (r233225) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon Mar 19 23:28:13 2012 (r233226) @@ -314,7 +314,7 @@ setup_gpart_partitions() if [ "$CURPART" = "2" ] ; then # If this is GPT, make sure first partition is aligned to 4k sleep 2 - rc_halt "gpart add -b 2016 ${SOUT} -t ${PARTYPE} ${_pDisk}" + rc_halt "gpart add -a 4k ${SOUT} -t ${PARTYPE} ${_pDisk}" else sleep 2 rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${_pDisk}" Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Mar 19 23:25:10 2012 (r233225) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Mar 19 23:28:13 2012 (r233226) @@ -645,33 +645,9 @@ init_mbr_full_disk() echo_log "Running gpart on ${_intDISK}" rc_halt "gpart create -s mbr -f active ${_intDISK}" - # Lets figure out disk size in blocks - # Get the cyl of this disk - get_disk_cyl "${_intDISK}" - cyl="${VAL}" - - # Get the heads of this disk - get_disk_heads "${_intDISK}" - head="${VAL}" - - # Get the tracks/sectors of this disk - get_disk_sectors "${_intDISK}" - sec="${VAL}" - - # Multiply them all together to get our total blocks - totalblocks="`expr ${cyl} \* ${head} 2>/dev/null`" - totalblocks="`expr ${totalblocks} \* ${sec} 2>/dev/null`" - if [ -z "${totalblocks}" ] - then - totalblocks=`gpart show "${_intDISK}"|tail -2|head -1|awk '{ print $2 }'` - fi - - # Now set the ending block to the total disk block size - sizeblock="`expr ${totalblocks} - ${startblock}`" - # Install new partition setup echo_log "Running gpart add on ${_intDISK}" - rc_halt "gpart add -b ${startblock} -s ${sizeblock} -t freebsd -i 1 ${_intDISK}" + rc_halt "gpart add -a 4k -t freebsd -i 1 ${_intDISK}" sleep 2 echo_log "Cleaning up ${_intDISK}s1" @@ -847,44 +823,9 @@ run_gpart_free() rc_halt "gpart create -s mbr ${DISK}" fi - # Lets get the starting block first - if [ "${slicenum}" = "1" ] - then - startblock="63" - else - # Lets figure out where the prior slice ends - checkslice=$((slicenum-1)) - - # Get starting block of this slice - sblk=`gpart show ${DISK} | grep -v ${DISK} | tr -s '\t' ' ' | sed '/^$/d' | grep " ${checkslice} " | cut -d ' ' -f 2` - blksize=`gpart show ${DISK} | grep -v ${DISK} | tr -s '\t' ' ' | sed '/^$/d' | grep " ${checkslice} " | cut -d ' ' -f 3` - startblock=$((sblk+blksiz)) - fi - - # No slice after the new slice, lets figure out the free space remaining and use it - # Get the cyl of this disk - get_disk_cyl "${DISK}" - cyl="${VAL}" - - # Get the heads of this disk - get_disk_heads "${DISK}" - head="${VAL}" - - # Get the tracks/sectors of this disk - get_disk_sectors "${DISK}" - sec="${VAL}" - - # Multiply them all together to get our total blocks - totalblocks=$((cyl*head)) - totalblocks=$((totalblocks*sec)) - - - # Now set the ending block to the total disk block size - sizeblock=$((totalblocks-startblock)) - # Install new partition setup echo_log "Running gpart on ${DISK}" - rc_halt "gpart add -b ${startblock} -s ${sizeblock} -t freebsd -i ${slicenum} ${DISK}" + rc_halt "gpart add -a 4k -t freebsd -i ${slicenum} ${DISK}" sleep 2 echo_log "Cleaning up $slice" From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 09:03:02 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A14A1065674; Tue, 20 Mar 2012 09:03:02 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 43ECC8FC14; Tue, 20 Mar 2012 09:02:55 +0000 (UTC) Received: by lagv3 with SMTP id v3so7414600lag.13 for ; Tue, 20 Mar 2012 02:02:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=6VEmmNeG4h04vcQZMG8P6SPbruUS78Otzq3pPvV6yD4=; b=MPqOmz9pPA3ee4esLPVXWExJcGNfN0k6K4lQeZ/Xd9CEwySaakh35YnGn5pumAOuJX k0vRk/w/XNxe3tR4S8z+EJ+RjvKmkBVV2xA9pasZ2VozhgmrMoAka7qGN8XWqiQPvI/0 cfdGr95gX6m+3qCgPPy9gWsa4tSNqt/Da6ziLFImaAkwjeLS5Y2XdtEUHSIR3m1VkQsI lIGe0Sgp+4cxxCjBbZi1sfYrbjl9EFha4jo+ODe2MbOTeSfaLU1nRkq109oucTc650tg M6owJHa8jRdpXHMSUzEq3b4NVclWDPe5UYgoPJ5eO5CN0dbH1G+a9BsEJl1KsWApjkAY Awbg== MIME-Version: 1.0 Received: by 10.112.100.232 with SMTP id fb8mr5836069lbb.86.1332234168976; Tue, 20 Mar 2012 02:02:48 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.152.21.73 with HTTP; Tue, 20 Mar 2012 02:02:48 -0700 (PDT) In-Reply-To: <201203192015.q2JKFItl084480@svn.freebsd.org> References: <201203192015.q2JKFItl084480@svn.freebsd.org> Date: Tue, 20 Mar 2012 12:02:48 +0300 X-Google-Sender-Auth: E1rrIRId25OKy2YfqfLteiTCroQ Message-ID: From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233199 - in stable/8/sys: i386/conf netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 09:03:02 -0000 On 20 March 2012 00:15, John Baldwin wrote: > Author: jhb > Date: Mon Mar 19 20:15:18 2012 > New Revision: 233199 > URL: http://svn.freebsd.org/changeset/base/233199 > > Log: > =A0MFC 225096: > =A0Fix if_addr_mtx recursion in mld6. Ehh.. Thank you for doing this. As I mentioned earlier I could not reproduce this problem myself in RELENG_8, that's why it was not MFCed so far... > > =A0mld_set_version() is called only from mld_v1_input_query() and > =A0mld_v2_input_query() both holding the if_addr_mtx lock, and then calli= ng > =A0into mld_v2_cancel_link_timers() acquires it the second time, which re= sults > =A0in mtx recursion. To avoid that, delay if_addr_mtx acquisition until a= fter > =A0mld_set_version() is called; while here, further reduce locking scope > =A0to protect only the needed pieces: if_multiaddrs, in6m_lookup_locked()= . [...] --=20 wbr, pluknet From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 09:11:16 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6A483106564A; Tue, 20 Mar 2012 09:11:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id CFDDA8FC0A; Tue, 20 Mar 2012 09:11:15 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q2K9B8X8065483; Tue, 20 Mar 2012 11:11:08 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q2K9B8WS034137; Tue, 20 Mar 2012 11:11:08 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q2K9B87r034136; Tue, 20 Mar 2012 11:11:08 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 20 Mar 2012 11:11:07 +0200 From: Konstantin Belousov To: Ken Smith Message-ID: <20120320091107.GG2358@deviant.kiev.zoral.com.ua> References: <201203192220.q2JMKmuk088963@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sLx0z+5FKKtIVDwd" Content-Disposition: inline In-Reply-To: <201203192220.q2JMKmuk088963@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233211 - stable/8/sys/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 09:11:16 -0000 --sLx0z+5FKKtIVDwd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 19, 2012 at 10:20:48PM +0000, Ken Smith wrote: > Author: kensmith > Date: Mon Mar 19 22:20:47 2012 > New Revision: 233211 > URL: http://svn.freebsd.org/changeset/base/233211 >=20 > Log: > We seem to be having issues with a bug in the loader that causes it to s/loader/linker/ > estimate the program header size for the kernel wrong. It can result > in the kernel build failing with the message: > =20 > ld: kernel.debug: Not enough room for program headers (allocated 5, nee= d 6) > ld: final link failed: Bad value > =20 > Tinderbox builds were failing with this message a short time ago, and > I encountered it while preparing the i386 build machine for the 8.3-RC2 > builds. > =20 > Konstantin has looked at it and believes the issue was fixed in recent > versions of binutils. It is a bit too late in the release process to > be messing around with the loader and/or binutils. This workaround > seems to take care of the problem for now. > =20 > Reviewed by: kib >=20 > Modified: > stable/8/sys/conf/ldscript.i386 >=20 > Modified: stable/8/sys/conf/ldscript.i386 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/sys/conf/ldscript.i386 Mon Mar 19 22:08:13 2012 (r233210) > +++ stable/8/sys/conf/ldscript.i386 Mon Mar 19 22:20:47 2012 (r233211) > @@ -6,7 +6,7 @@ SEARCH_DIR(/usr/lib); > SECTIONS > { > /* Read-only sections, merged into text segment: */ > - . =3D kernbase + kernload + SIZEOF_HEADERS; > + . =3D kernbase + kernload + 256; > .interp : { *(.interp) } > .hash : { *(.hash) } > .dynsym : { *(.dynsym) } --sLx0z+5FKKtIVDwd Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEUEARECAAYFAk9oSasACgkQC3+MBN1Mb4hFMQCYh0a2QesJJcRbyheL07GIizAs YwCggeGklaNJb6IyI6XCGOLJV61hTgM= =IyqL -----END PGP SIGNATURE----- --sLx0z+5FKKtIVDwd-- From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 15:20:54 2012 Return-Path: Delivered-To: svn-src-stable@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 85D7C1065670; Tue, 20 Mar 2012 15:20:54 +0000 (UTC) (envelope-from theraven@theravensnest.org) Received: from theravensnest.org (theravensnest.org [109.169.23.128]) by mx1.freebsd.org (Postfix) with ESMTP id 1F6028FC0C; Tue, 20 Mar 2012 15:20:53 +0000 (UTC) Received: from [192.168.0.2] (cpc1-cwma8-2-0-cust257.7-3.cable.virginmedia.com [82.20.153.2]) (authenticated bits=0) by theravensnest.org (8.14.4/8.14.4) with ESMTP id q2KFKk4l022576 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Tue, 20 Mar 2012 15:20:46 GMT (envelope-from theraven@theravensnest.org) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=us-ascii From: David Chisnall In-Reply-To: <201201050148.q051mQl5008914@svn.freebsd.org> Date: Tue, 20 Mar 2012 15:20:41 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <0272CDA5-A574-436D-8FCA-6E9427924D6F@theravensnest.org> References: <201201050148.q051mQl5008914@svn.freebsd.org> To: "Pedro F. Giffuni" X-Mailer: Apple Mail (2.1257) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-9@FreeBSD.org Subject: Re: svn commit: r229551 - in stable/9/contrib/libstdc++: . config/os/aix include/bits include/ext include/tr1 libsupc++ src X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 15:20:54 -0000 This part of the change gratuitously alters the vtable layout of a core = ABI class and will break things. Please revert it. David On 5 Jan 2012, at 01:48, Pedro F. Giffuni wrote: > Modified: stable/9/contrib/libstdc++/libsupc++/typeinfo > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/9/contrib/libstdc++/libsupc++/typeinfo Thu Jan 5 = 01:40:42 2012 (r229550) > +++ stable/9/contrib/libstdc++/libsupc++/typeinfo Thu Jan 5 = 01:48:25 2012 (r229551) > @@ -99,7 +99,13 @@ namespace std=20 > #endif > bool operator!=3D(const type_info& __arg) const > { return !operator=3D=3D(__arg); } > - =20 > + > + // Return true if this is a pointer type of some kind > + virtual bool __is_pointer_p() const; > + > + // Return true if this is a function type > + virtual bool __is_function_p() const; > + > // Try and catch a thrown type. Store an adjusted pointer to the > // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then > // THR_OBJ points to the thrown object. If THR_TYPE is a pointer > @@ -113,12 +119,6 @@ namespace std=20 > virtual bool __do_upcast(const __cxxabiv1::__class_type_info = *__target, > void **__obj_ptr) const; >=20 > - // Return true if this is a pointer type of some kind > - virtual bool __is_pointer_p() const; > - > - // Return true if this is a function type > - virtual bool __is_function_p() const; > - > protected: > const char *__name; >=20 >=20 From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 19:04:00 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E7B5D1065679; Tue, 20 Mar 2012 19:04:00 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B89998FC15; Tue, 20 Mar 2012 19:04:00 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 6B1D046B43; Tue, 20 Mar 2012 15:04:00 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id DA4A0B960; Tue, 20 Mar 2012 15:03:59 -0400 (EDT) From: John Baldwin To: Sergey Kandaurov Date: Tue, 20 Mar 2012 14:53:52 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201203192015.q2JKFItl084480@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201203201453.52982.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 20 Mar 2012 15:03:59 -0400 (EDT) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233199 - in stable/8/sys: i386/conf netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:04:01 -0000 On Tuesday, March 20, 2012 5:02:48 am Sergey Kandaurov wrote: > On 20 March 2012 00:15, John Baldwin wrote: > > Author: jhb > > Date: Mon Mar 19 20:15:18 2012 > > New Revision: 233199 > > URL: http://svn.freebsd.org/changeset/base/233199 > > > > Log: > > MFC 225096: > > Fix if_addr_mtx recursion in mld6. > > Ehh.. Thank you for doing this. > As I mentioned earlier I could not reproduce this problem myself > in RELENG_8, that's why it was not MFCed so far... To be honest, my main movitation was to remove a merge conflict in my subsequent MFC of the IF_ADDR locking changes. I could have patched the locking in the old mld6.c, but when I reviewed your diff, I figured it would be better to merge it first instead. > > > > mld_set_version() is called only from mld_v1_input_query() and > > mld_v2_input_query() both holding the if_addr_mtx lock, and then calling > > into mld_v2_cancel_link_timers() acquires it the second time, which results > > in mtx recursion. To avoid that, delay if_addr_mtx acquisition until after > > mld_set_version() is called; while here, further reduce locking scope > > to protect only the needed pieces: if_multiaddrs, in6m_lookup_locked(). > > [...] > > -- > wbr, > pluknet > -- John Baldwin From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 19:16:55 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15F0D106566B; Tue, 20 Mar 2012 19:16:55 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F41378FC08; Tue, 20 Mar 2012 19:16:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJGs2o033731; Tue, 20 Mar 2012 19:16:54 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJGsmx033728; Tue, 20 Mar 2012 19:16:54 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201916.q2KJGsmx033728@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233239 - in stable/9/sys: netinet netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:16:55 -0000 Author: tuexen Date: Tue Mar 20 19:16:54 2012 New Revision: 233239 URL: http://svn.freebsd.org/changeset/base/233239 Log: MFC r231895: Remove two clang warnings. Modified: stable/9/sys/netinet/sctp_usrreq.c stable/9/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/9/sys/netinet/sctp_usrreq.c Tue Mar 20 18:18:12 2012 (r233238) +++ stable/9/sys/netinet/sctp_usrreq.c Tue Mar 20 19:16:54 2012 (r233239) @@ -6357,7 +6357,7 @@ sctp_ingetaddr(struct socket *so, struct int sctp_peeraddr(struct socket *so, struct sockaddr **addr) { - struct sockaddr_in *sin = (struct sockaddr_in *)*addr; + struct sockaddr_in *sin; int fnd; struct sockaddr_in *sin_a; struct sctp_inpcb *inp; Modified: stable/9/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/9/sys/netinet6/sctp6_usrreq.c Tue Mar 20 18:18:12 2012 (r233238) +++ stable/9/sys/netinet6/sctp6_usrreq.c Tue Mar 20 19:16:54 2012 (r233239) @@ -1199,7 +1199,7 @@ sctp6_getaddr(struct socket *so, struct static int sctp6_peeraddr(struct socket *so, struct sockaddr **addr) { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)*addr; + struct sockaddr_in6 *sin6; int fnd; struct sockaddr_in6 *sin_a6; struct sctp_inpcb *inp; From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 19:19:51 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 450BB1065673; Tue, 20 Mar 2012 19:19:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 301758FC12; Tue, 20 Mar 2012 19:19:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJJpjZ033879; Tue, 20 Mar 2012 19:19:51 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJJonb033877; Tue, 20 Mar 2012 19:19:50 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201919.q2KJJonb033877@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:19:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233240 - stable/9/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:19:51 -0000 Author: tuexen Date: Tue Mar 20 19:19:50 2012 New Revision: 233240 URL: http://svn.freebsd.org/changeset/base/233240 Log: MFC r232724: Add support for stf interfaces. Modified: stable/9/sys/netinet/sctp_bsd_addr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/9/sys/netinet/sctp_bsd_addr.c Tue Mar 20 19:16:54 2012 (r233239) +++ stable/9/sys/netinet/sctp_bsd_addr.c Tue Mar 20 19:19:50 2012 (r233240) @@ -180,6 +180,7 @@ sctp_is_desired_interface_type(struct if case IFT_SLIP: case IFT_GIF: case IFT_L2VLAN: + case IFT_STF: case IFT_IP: case IFT_IPOVERCDLC: case IFT_IPOVERCLAW: From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 19:22:45 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7BC7E1065675; Tue, 20 Mar 2012 19:22:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 666128FC0A; Tue, 20 Mar 2012 19:22:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJMjUl034041; Tue, 20 Mar 2012 19:22:45 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJMjeW034039; Tue, 20 Mar 2012 19:22:45 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201922.q2KJMjeW034039@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:22:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233241 - stable/9/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:22:45 -0000 Author: tuexen Date: Tue Mar 20 19:22:44 2012 New Revision: 233241 URL: http://svn.freebsd.org/changeset/base/233241 Log: MFC r232866: This fixes PR 165210. Basically we just add in the netgraph interface to the list of acceptable interfaces. A todo at the next IETF code blitz, though is we need to review why we screen interfaces, there was a reason ;-). From rrs@. Modified: stable/9/sys/netinet/sctp_bsd_addr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/9/sys/netinet/sctp_bsd_addr.c Tue Mar 20 19:19:50 2012 (r233240) +++ stable/9/sys/netinet/sctp_bsd_addr.c Tue Mar 20 19:22:44 2012 (r233241) @@ -184,6 +184,7 @@ sctp_is_desired_interface_type(struct if case IFT_IP: case IFT_IPOVERCDLC: case IFT_IPOVERCLAW: + case IFT_PROPVIRTUAL: /* NetGraph Virtual too */ case IFT_VIRTUALIPADDRESS: result = 1; break; From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 19:24:56 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E2C72106566B; Tue, 20 Mar 2012 19:24:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B47128FC12; Tue, 20 Mar 2012 19:24:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJOuca034162; Tue, 20 Mar 2012 19:24:56 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJOuPQ034159; Tue, 20 Mar 2012 19:24:56 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201924.q2KJOuPQ034159@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:24:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233242 - in stable/9/sys: kern netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:24:57 -0000 Author: tuexen Date: Tue Mar 20 19:24:56 2012 New Revision: 233242 URL: http://svn.freebsd.org/changeset/base/233242 Log: MFC r233004: Fix bugs which can result in a panic when an non-SCTP socket it used with an sctp_ system-call which expects an SCTP socket. Modified: stable/9/sys/kern/uipc_syscalls.c stable/9/sys/netinet/sctp_peeloff.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/uipc_syscalls.c ============================================================================== --- stable/9/sys/kern/uipc_syscalls.c Tue Mar 20 19:22:44 2012 (r233241) +++ stable/9/sys/kern/uipc_syscalls.c Tue Mar 20 19:24:56 2012 (r233242) @@ -2320,6 +2320,10 @@ sys_sctp_peeloff(td, uap) error = fgetsock(td, uap->sd, CAP_PEELOFF, &head, &fflag); if (error) goto done2; + if (head->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto done2; + } error = sctp_can_peel_off(head, (sctp_assoc_t)uap->name); if (error) goto done2; @@ -2442,6 +2446,10 @@ sys_sctp_generic_sendmsg (td, uap) iov[0].iov_len = uap->mlen; so = (struct socket *)fp->f_data; + if (so->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto sctp_bad; + } #ifdef MAC error = mac_socket_check_send(td->td_ucred, so); if (error) @@ -2555,6 +2563,10 @@ sys_sctp_generic_sendmsg_iov(td, uap) #endif so = (struct socket *)fp->f_data; + if (so->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto sctp_bad; + } #ifdef MAC error = mac_socket_check_send(td->td_ucred, so); if (error) @@ -2659,6 +2671,10 @@ sys_sctp_generic_recvmsg(td, uap) goto out1; so = fp->f_data; + if (so->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto out; + } #ifdef MAC error = mac_socket_check_receive(td->td_ucred, so); if (error) { Modified: stable/9/sys/netinet/sctp_peeloff.c ============================================================================== --- stable/9/sys/netinet/sctp_peeloff.c Tue Mar 20 19:22:44 2012 (r233241) +++ stable/9/sys/netinet/sctp_peeloff.c Tue Mar 20 19:24:56 2012 (r233242) @@ -59,16 +59,16 @@ sctp_can_peel_off(struct socket *head, s SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EBADF); return (EBADF); } - if ((head->so_proto->pr_protocol != IPPROTO_SCTP) || - (head->so_type != SOCK_SEQPACKET)) { - SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EOPNOTSUPP); - return (EOPNOTSUPP); - } inp = (struct sctp_inpcb *)head->so_pcb; if (inp == NULL) { SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EFAULT); return (EFAULT); } + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EOPNOTSUPP); + return (EOPNOTSUPP); + } stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); if (stcb == NULL) { SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_PEELOFF, ENOENT); From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 19:27:27 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 992EB106566B; Tue, 20 Mar 2012 19:27:27 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 762848FC08; Tue, 20 Mar 2012 19:27:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJRRnU034293; Tue, 20 Mar 2012 19:27:27 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJRRj3034290; Tue, 20 Mar 2012 19:27:27 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201927.q2KJRRj3034290@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233243 - in stable/9/sys: netinet netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:27:27 -0000 Author: tuexen Date: Tue Mar 20 19:27:27 2012 New Revision: 233243 URL: http://svn.freebsd.org/changeset/base/233243 Log: MFC r233005: Clean up, no functional change. Modified: stable/9/sys/netinet/sctp_usrreq.c stable/9/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/9/sys/netinet/sctp_usrreq.c Tue Mar 20 19:24:56 2012 (r233242) +++ stable/9/sys/netinet/sctp_usrreq.c Tue Mar 20 19:27:27 2012 (r233243) @@ -451,7 +451,7 @@ sctp_abort(struct socket *so) uint32_t flags; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { return; } sctp_must_try_again: @@ -569,7 +569,7 @@ sctp_bind(struct socket *so, struct sock return (EINVAL); } inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); } @@ -585,7 +585,7 @@ sctp_close(struct socket *so) uint32_t flags; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) + if (inp == NULL) return; /* @@ -650,7 +650,7 @@ sctp_sendm(struct socket *so, int flags, int error; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { if (control) { sctp_m_freem(control); control = NULL; @@ -979,7 +979,7 @@ sctp_shutdown(struct socket *so) struct sctp_inpcb *inp; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); } @@ -1639,7 +1639,7 @@ sctp_getopt(struct socket *so, int optna return (EINVAL); } inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return EINVAL; } @@ -3317,7 +3317,7 @@ sctp_setopt(struct socket *so, int optna return (EINVAL); } inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_PRINTF("inp is NULL?\n"); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); @@ -5765,12 +5765,6 @@ sctp_ctloutput(struct socket *so, struct void *p; int error = 0; - inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { - /* I made the same as TCP since we are not setup? */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); - return (ECONNRESET); - } if (sopt->sopt_level != IPPROTO_SCTP) { /* wrong proto level... send back up to IP */ #ifdef INET6 @@ -5785,6 +5779,7 @@ sctp_ctloutput(struct socket *so, struct #endif return (error); } + inp = (struct sctp_inpcb *)so->so_pcb; optsize = sopt->sopt_valsize; if (optsize) { SCTP_MALLOC(optval, void *, optsize, SCTP_M_SOCKOPT); @@ -5828,7 +5823,7 @@ sctp_connect(struct socket *so, struct s struct sctp_tcb *stcb = NULL; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { /* I made the same as TCP since we are not setup? */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (ECONNRESET); @@ -5988,7 +5983,7 @@ sctp_listen(struct socket *so, int backl struct sctp_inpcb *inp; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { /* I made the same as TCP since we are not setup? */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (ECONNRESET); @@ -6152,7 +6147,7 @@ sctp_accept(struct socket *so, struct so #endif inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (ECONNRESET); } Modified: stable/9/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/9/sys/netinet6/sctp6_usrreq.c Tue Mar 20 19:24:56 2012 (r233242) +++ stable/9/sys/netinet6/sctp6_usrreq.c Tue Mar 20 19:27:27 2012 (r233243) @@ -632,7 +632,7 @@ sctp6_abort(struct socket *so) uint32_t flags; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return; } @@ -720,7 +720,7 @@ sctp6_bind(struct socket *so, struct soc int error; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return (EINVAL); } @@ -960,7 +960,7 @@ sctp6_connect(struct socket *so, struct inp6 = (struct in6pcb *)so->so_pcb; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, ECONNRESET); return (ECONNRESET); /* I made the same as TCP since we are * not setup? */ From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 19:37:06 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3C3DE106566C; Tue, 20 Mar 2012 19:37:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 260108FC19; Tue, 20 Mar 2012 19:37:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJb6M1034671; Tue, 20 Mar 2012 19:37:06 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJb594034668; Tue, 20 Mar 2012 19:37:05 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201937.q2KJb594034668@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233244 - in stable/8/sys: i386/conf netinet netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:37:06 -0000 Author: tuexen Date: Tue Mar 20 19:37:05 2012 New Revision: 233244 URL: http://svn.freebsd.org/changeset/base/233244 Log: MFC r231895: Remove two clang warnings. Modified: stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Tue Mar 20 19:27:27 2012 (r233243) +++ stable/8/sys/netinet/sctp_usrreq.c Tue Mar 20 19:37:05 2012 (r233244) @@ -6325,7 +6325,7 @@ sctp_ingetaddr(struct socket *so, struct int sctp_peeraddr(struct socket *so, struct sockaddr **addr) { - struct sockaddr_in *sin = (struct sockaddr_in *)*addr; + struct sockaddr_in *sin; int fnd; struct sockaddr_in *sin_a; struct sctp_inpcb *inp; Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Tue Mar 20 19:27:27 2012 (r233243) +++ stable/8/sys/netinet6/sctp6_usrreq.c Tue Mar 20 19:37:05 2012 (r233244) @@ -1199,7 +1199,7 @@ sctp6_getaddr(struct socket *so, struct static int sctp6_peeraddr(struct socket *so, struct sockaddr **addr) { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)*addr; + struct sockaddr_in6 *sin6; int fnd; struct sockaddr_in6 *sin_a6; struct sctp_inpcb *inp; From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 19:39:44 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C2C3D106566B; Tue, 20 Mar 2012 19:39:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC2B18FC14; Tue, 20 Mar 2012 19:39:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJdiaO034797; Tue, 20 Mar 2012 19:39:44 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJdiNH034795; Tue, 20 Mar 2012 19:39:44 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201939.q2KJdiNH034795@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:39:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233245 - in stable/8/sys: i386/conf netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:39:44 -0000 Author: tuexen Date: Tue Mar 20 19:39:44 2012 New Revision: 233245 URL: http://svn.freebsd.org/changeset/base/233245 Log: MFC r232724: Add support for stf interfaces. Modified: stable/8/sys/netinet/sctp_bsd_addr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/8/sys/netinet/sctp_bsd_addr.c Tue Mar 20 19:37:05 2012 (r233244) +++ stable/8/sys/netinet/sctp_bsd_addr.c Tue Mar 20 19:39:44 2012 (r233245) @@ -180,6 +180,7 @@ sctp_is_desired_interface_type(struct if case IFT_SLIP: case IFT_GIF: case IFT_L2VLAN: + case IFT_STF: case IFT_IP: case IFT_IPOVERCDLC: case IFT_IPOVERCLAW: From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 19:42:41 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 25102106566C; Tue, 20 Mar 2012 19:42:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F3B48FC0C; Tue, 20 Mar 2012 19:42:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJgeDe034956; Tue, 20 Mar 2012 19:42:40 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJgefN034954; Tue, 20 Mar 2012 19:42:40 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201942.q2KJgefN034954@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:42:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233246 - in stable/8/sys: i386/conf netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:42:41 -0000 Author: tuexen Date: Tue Mar 20 19:42:40 2012 New Revision: 233246 URL: http://svn.freebsd.org/changeset/base/233246 Log: MFC r232866: This fixes PR 165210. Basically we just add in the netgraph interface to the list of acceptable interfaces. A todo at the next IETF code blitz, though is we need to review why we screen interfaces, there was a reason ;-). From rrs@. Modified: stable/8/sys/netinet/sctp_bsd_addr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/8/sys/netinet/sctp_bsd_addr.c Tue Mar 20 19:39:44 2012 (r233245) +++ stable/8/sys/netinet/sctp_bsd_addr.c Tue Mar 20 19:42:40 2012 (r233246) @@ -184,6 +184,7 @@ sctp_is_desired_interface_type(struct if case IFT_IP: case IFT_IPOVERCDLC: case IFT_IPOVERCLAW: + case IFT_PROPVIRTUAL: /* NetGraph Virtual too */ case IFT_VIRTUALIPADDRESS: result = 1; break; From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 19:45:26 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4593F106566C; Tue, 20 Mar 2012 19:45:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27A198FC17; Tue, 20 Mar 2012 19:45:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJjQBi035116; Tue, 20 Mar 2012 19:45:26 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJjPi9035113; Tue, 20 Mar 2012 19:45:25 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201945.q2KJjPi9035113@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:45:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233247 - in stable/8/sys: i386/conf kern netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:45:26 -0000 Author: tuexen Date: Tue Mar 20 19:45:25 2012 New Revision: 233247 URL: http://svn.freebsd.org/changeset/base/233247 Log: MFC r233004: Fix bugs which can result in a panic when an non-SCTP socket it used with an sctp_ system-call which expects an SCTP socket. Modified: stable/8/sys/kern/uipc_syscalls.c stable/8/sys/netinet/sctp_peeloff.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/kern/uipc_syscalls.c ============================================================================== --- stable/8/sys/kern/uipc_syscalls.c Tue Mar 20 19:42:40 2012 (r233246) +++ stable/8/sys/kern/uipc_syscalls.c Tue Mar 20 19:45:25 2012 (r233247) @@ -2300,6 +2300,10 @@ sctp_peeloff(td, uap) error = fgetsock(td, uap->sd, &head, &fflag); if (error) goto done2; + if (head->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto done2; + } error = sctp_can_peel_off(head, (sctp_assoc_t)uap->name); if (error) goto done2; @@ -2418,6 +2422,10 @@ sctp_generic_sendmsg (td, uap) iov[0].iov_len = uap->mlen; so = (struct socket *)fp->f_data; + if (so->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto sctp_bad; + } #ifdef MAC error = mac_socket_check_send(td->td_ucred, so); if (error) @@ -2528,6 +2536,10 @@ sctp_generic_sendmsg_iov(td, uap) #endif so = (struct socket *)fp->f_data; + if (so->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto sctp_bad; + } #ifdef MAC error = mac_socket_check_send(td->td_ucred, so); if (error) @@ -2632,6 +2644,10 @@ sctp_generic_recvmsg(td, uap) goto out1; so = fp->f_data; + if (so->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto out; + } #ifdef MAC error = mac_socket_check_receive(td->td_ucred, so); if (error) { Modified: stable/8/sys/netinet/sctp_peeloff.c ============================================================================== --- stable/8/sys/netinet/sctp_peeloff.c Tue Mar 20 19:42:40 2012 (r233246) +++ stable/8/sys/netinet/sctp_peeloff.c Tue Mar 20 19:45:25 2012 (r233247) @@ -59,16 +59,16 @@ sctp_can_peel_off(struct socket *head, s SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EBADF); return (EBADF); } - if ((head->so_proto->pr_protocol != IPPROTO_SCTP) || - (head->so_type != SOCK_SEQPACKET)) { - SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EOPNOTSUPP); - return (EOPNOTSUPP); - } inp = (struct sctp_inpcb *)head->so_pcb; if (inp == NULL) { SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EFAULT); return (EFAULT); } + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EOPNOTSUPP); + return (EOPNOTSUPP); + } stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); if (stcb == NULL) { SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_PEELOFF, ENOENT); From owner-svn-src-stable@FreeBSD.ORG Tue Mar 20 19:48:00 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F92A106564A; Tue, 20 Mar 2012 19:48:00 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FFDD8FC0A; Tue, 20 Mar 2012 19:48:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJm0KN035240; Tue, 20 Mar 2012 19:48:00 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJm0B8035237; Tue, 20 Mar 2012 19:48:00 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201948.q2KJm0B8035237@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:48:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233248 - in stable/8/sys: i386/conf netinet netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:48:00 -0000 Author: tuexen Date: Tue Mar 20 19:47:59 2012 New Revision: 233248 URL: http://svn.freebsd.org/changeset/base/233248 Log: MFC r233005: Clean up, no functional change. Modified: stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Tue Mar 20 19:45:25 2012 (r233247) +++ stable/8/sys/netinet/sctp_usrreq.c Tue Mar 20 19:47:59 2012 (r233248) @@ -451,7 +451,7 @@ sctp_abort(struct socket *so) uint32_t flags; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { return; } sctp_must_try_again: @@ -569,7 +569,7 @@ sctp_bind(struct socket *so, struct sock return (EINVAL); } inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); } @@ -585,7 +585,7 @@ sctp_close(struct socket *so) uint32_t flags; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) + if (inp == NULL) return; /* @@ -650,7 +650,7 @@ sctp_sendm(struct socket *so, int flags, int error; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { if (control) { sctp_m_freem(control); control = NULL; @@ -979,7 +979,7 @@ sctp_shutdown(struct socket *so) struct sctp_inpcb *inp; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); } @@ -1639,7 +1639,7 @@ sctp_getopt(struct socket *so, int optna return (EINVAL); } inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return EINVAL; } @@ -3306,7 +3306,7 @@ sctp_setopt(struct socket *so, int optna return (EINVAL); } inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_PRINTF("inp is NULL?\n"); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); @@ -5733,12 +5733,6 @@ sctp_ctloutput(struct socket *so, struct void *p; int error = 0; - inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { - /* I made the same as TCP since we are not setup? */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); - return (ECONNRESET); - } if (sopt->sopt_level != IPPROTO_SCTP) { /* wrong proto level... send back up to IP */ #ifdef INET6 @@ -5753,6 +5747,7 @@ sctp_ctloutput(struct socket *so, struct #endif return (error); } + inp = (struct sctp_inpcb *)so->so_pcb; optsize = sopt->sopt_valsize; if (optsize) { SCTP_MALLOC(optval, void *, optsize, SCTP_M_SOCKOPT); @@ -5796,7 +5791,7 @@ sctp_connect(struct socket *so, struct s struct sctp_tcb *stcb = NULL; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { /* I made the same as TCP since we are not setup? */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (ECONNRESET); @@ -5956,7 +5951,7 @@ sctp_listen(struct socket *so, int backl struct sctp_inpcb *inp; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { /* I made the same as TCP since we are not setup? */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (ECONNRESET); @@ -6120,7 +6115,7 @@ sctp_accept(struct socket *so, struct so #endif inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (ECONNRESET); } Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Tue Mar 20 19:45:25 2012 (r233247) +++ stable/8/sys/netinet6/sctp6_usrreq.c Tue Mar 20 19:47:59 2012 (r233248) @@ -632,7 +632,7 @@ sctp6_abort(struct socket *so) uint32_t flags; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return; } @@ -720,7 +720,7 @@ sctp6_bind(struct socket *so, struct soc int error; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return (EINVAL); } @@ -960,7 +960,7 @@ sctp6_connect(struct socket *so, struct inp6 = (struct in6pcb *)so->so_pcb; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, ECONNRESET); return (ECONNRESET); /* I made the same as TCP since we are * not setup? */ From owner-svn-src-stable@FreeBSD.ORG Wed Mar 21 07:05:30 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCB5A106564A; Wed, 21 Mar 2012 07:05:30 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D8938FC17; Wed, 21 Mar 2012 07:05:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2L75UXM058805; Wed, 21 Mar 2012 07:05:30 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2L75UbS058802; Wed, 21 Mar 2012 07:05:30 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201203210705.q2L75UbS058802@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 21 Mar 2012 07:05:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233259 - in stable/9/usr.sbin: ypbind ypserv X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 07:05:30 -0000 Author: glebius Date: Wed Mar 21 07:05:29 2012 New Revision: 233259 URL: http://svn.freebsd.org/changeset/base/233259 Log: Merge 226690 and 226725 from head: Protect NIS client with madvise(2) since this daemon is required for succesful authentication of users. Protect NIS server with madvise(2) since this daemon is required for succesful authentication of users. Modified: stable/9/usr.sbin/ypbind/ypbind.c stable/9/usr.sbin/ypserv/yp_main.c Directory Properties: stable/9/usr.sbin/ypbind/ (props changed) stable/9/usr.sbin/ypserv/ (props changed) Modified: stable/9/usr.sbin/ypbind/ypbind.c ============================================================================== --- stable/9/usr.sbin/ypbind/ypbind.c Wed Mar 21 07:02:17 2012 (r233258) +++ stable/9/usr.sbin/ypbind/ypbind.c Wed Mar 21 07:05:29 2012 (r233259) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -465,6 +466,9 @@ main(int argc, char *argv[]) openlog(argv[0], LOG_PID, LOG_DAEMON); + if (madvise(NULL, 0, MADV_PROTECT) != 0) + syslog(LOG_WARNING, "madvise(): %m"); + /* Kick off the default domain */ broadcast(ypbindlist); Modified: stable/9/usr.sbin/ypserv/yp_main.c ============================================================================== --- stable/9/usr.sbin/ypserv/yp_main.c Wed Mar 21 07:02:17 2012 (r233258) +++ stable/9/usr.sbin/ypserv/yp_main.c Wed Mar 21 07:05:29 2012 (r233259) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); */ #include +#include #include #include #include @@ -526,6 +527,9 @@ main(int argc, char *argv[]) unregister(); } + if (madvise(NULL, 0, MADV_PROTECT) != 0) + _msgout("madvise(): %s", strerror(errno)); + /* * Create RPC service for each transport. */ From owner-svn-src-stable@FreeBSD.ORG Wed Mar 21 07:07:44 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4D582106564A; Wed, 21 Mar 2012 07:07:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DE6A8FC08; Wed, 21 Mar 2012 07:07:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2L77hv9058947; Wed, 21 Mar 2012 07:07:43 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2L77hZp058945; Wed, 21 Mar 2012 07:07:43 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201203210707.q2L77hZp058945@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 21 Mar 2012 07:07:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233261 - in stable/9/sys: i386/conf netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 07:07:44 -0000 Author: glebius Date: Wed Mar 21 07:07:43 2012 New Revision: 233261 URL: http://svn.freebsd.org/changeset/base/233261 Log: Merge 227308 from head/: In icmp6_redirect_input: - Assert that we got a valid mbuf with rcvif pointer. [1] - Use __func__ in logging. Submitted by: prabhakar lakhera [1] Submitted by: Kristof Provost [1] Modified: stable/9/sys/netinet6/icmp6.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/netinet6/icmp6.c ============================================================================== --- stable/9/sys/netinet6/icmp6.c Wed Mar 21 07:07:00 2012 (r233260) +++ stable/9/sys/netinet6/icmp6.c Wed Mar 21 07:07:43 2012 (r233261) @@ -2361,14 +2361,11 @@ icmp6_redirect_input(struct mbuf *m, int union nd_opts ndopts; char ip6buf[INET6_ADDRSTRLEN]; - if (!m) - return; + M_ASSERTPKTHDR(m); + KASSERT(m->m_pkthdr.rcvif != NULL, ("%s: no rcvif", __func__)); ifp = m->m_pkthdr.rcvif; - if (!ifp) - return; - /* XXX if we are router, we don't update route by icmp6 redirect */ if (V_ip6_forwarding) goto freeit; @@ -2475,9 +2472,8 @@ icmp6_redirect_input(struct mbuf *m, int icmp6len -= sizeof(*nd_rd); nd6_option_init(nd_rd + 1, icmp6len, &ndopts); if (nd6_options(&ndopts) < 0) { - nd6log((LOG_INFO, "icmp6_redirect_input: " - "invalid ND option, rejected: %s\n", - icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); + nd6log((LOG_INFO, "%s: invalid ND option, rejected: %s\n", + __func__, icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); /* nd6_options have incremented stats */ goto freeit; } @@ -2488,10 +2484,9 @@ icmp6_redirect_input(struct mbuf *m, int } if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { - nd6log((LOG_INFO, - "icmp6_redirect_input: lladdrlen mismatch for %s " + nd6log((LOG_INFO, "%s: lladdrlen mismatch for %s " "(if %d, icmp6 packet %d): %s\n", - ip6_sprintf(ip6buf, &redtgt6), + __func__, ip6_sprintf(ip6buf, &redtgt6), ifp->if_addrlen, lladdrlen - 2, icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); goto bad; From owner-svn-src-stable@FreeBSD.ORG Wed Mar 21 07:22:28 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 82EBB106566B; Wed, 21 Mar 2012 07:22:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63D218FC17; Wed, 21 Mar 2012 07:22:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2L7MSFc059637; Wed, 21 Mar 2012 07:22:28 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2L7MS3s059635; Wed, 21 Mar 2012 07:22:28 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201203210722.q2L7MS3s059635@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 21 Mar 2012 07:22:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233265 - in stable/9/sys: i386/conf netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 07:22:28 -0000 Author: glebius Date: Wed Mar 21 07:22:27 2012 New Revision: 233265 URL: http://svn.freebsd.org/changeset/base/233265 Log: Merge from head: r227785: - Reduce severity for all ARP events, that can be triggered from remote machine to LOG_NOTICE. Exception left to "using my IP address". - Fix multicast ARP warning: add newline and also log the bad MAC address. Tested by: Alexander Wittig r227790: Be more informative for "unknown hardware address format" message. Submitted by: Andrzej Tobola Modified: stable/9/sys/netinet/if_ether.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/netinet/if_ether.c ============================================================================== --- stable/9/sys/netinet/if_ether.c Wed Mar 21 07:21:05 2012 (r233264) +++ stable/9/sys/netinet/if_ether.c Wed Mar 21 07:22:27 2012 (r233265) @@ -433,7 +433,7 @@ arpintr(struct mbuf *m) if (m->m_len < sizeof(struct arphdr) && ((m = m_pullup(m, sizeof(struct arphdr))) == NULL)) { - log(LOG_ERR, "arp: runt packet -- m_pullup failed\n"); + log(LOG_NOTICE, "arp: runt packet -- m_pullup failed\n"); return; } ar = mtod(m, struct arphdr *); @@ -443,15 +443,17 @@ arpintr(struct mbuf *m) ntohs(ar->ar_hrd) != ARPHRD_ARCNET && ntohs(ar->ar_hrd) != ARPHRD_IEEE1394 && ntohs(ar->ar_hrd) != ARPHRD_INFINIBAND) { - log(LOG_ERR, "arp: unknown hardware address format (0x%2D)\n", - (unsigned char *)&ar->ar_hrd, ""); + log(LOG_NOTICE, "arp: unknown hardware address format (0x%2D)" + " (from %*D to %*D)\n", (unsigned char *)&ar->ar_hrd, "", + ETHER_ADDR_LEN, (u_char *)ar_sha(ar), ":", + ETHER_ADDR_LEN, (u_char *)ar_tha(ar), ":"); m_freem(m); return; } if (m->m_len < arphdr_len(ar)) { if ((m = m_pullup(m, arphdr_len(ar))) == NULL) { - log(LOG_ERR, "arp: runt packet\n"); + log(LOG_NOTICE, "arp: runt packet\n"); m_freem(m); return; } @@ -527,7 +529,7 @@ in_arpinput(struct mbuf *m) req_len = arphdr_len2(ifp->if_addrlen, sizeof(struct in_addr)); if (m->m_len < req_len && (m = m_pullup(m, req_len)) == NULL) { - log(LOG_ERR, "in_arp: runt packet -- m_pullup failed\n"); + log(LOG_NOTICE, "in_arp: runt packet -- m_pullup failed\n"); return; } @@ -537,13 +539,14 @@ in_arpinput(struct mbuf *m) * a protocol length not equal to an IPv4 address. */ if (ah->ar_pln != sizeof(struct in_addr)) { - log(LOG_ERR, "in_arp: requested protocol length != %zu\n", + log(LOG_NOTICE, "in_arp: requested protocol length != %zu\n", sizeof(struct in_addr)); return; } if (ETHER_IS_MULTICAST(ar_sha(ah))) { - log(LOG_ERR, "in_arp: source hardware address is multicast."); + log(LOG_NOTICE, "in_arp: %*D is multicast\n", + ifp->if_addrlen, (u_char *)ar_sha(ah), ":"); return; } @@ -645,7 +648,7 @@ match: if (!bcmp(ar_sha(ah), enaddr, ifp->if_addrlen)) goto drop; /* it's from me, ignore it. */ if (!bcmp(ar_sha(ah), ifp->if_broadcastaddr, ifp->if_addrlen)) { - log(LOG_ERR, + log(LOG_NOTICE, "arp: link address is broadcast for IP address %s!\n", inet_ntoa(isaddr)); goto drop; @@ -681,7 +684,7 @@ match: /* the following is not an error when doing bridging */ if (!bridged && la->lle_tbl->llt_ifp != ifp && !carp_match) { if (log_arp_wrong_iface) - log(LOG_ERR, "arp: %s is on %s " + log(LOG_WARNING, "arp: %s is on %s " "but got reply from %*D on %s\n", inet_ntoa(isaddr), la->lle_tbl->llt_ifp->if_xname, @@ -716,10 +719,10 @@ match: if (ifp->if_addrlen != ah->ar_hln) { LLE_WUNLOCK(la); - log(LOG_WARNING, - "arp from %*D: addr len: new %d, i/f %d (ignored)", - ifp->if_addrlen, (u_char *) ar_sha(ah), ":", - ah->ar_hln, ifp->if_addrlen); + log(LOG_WARNING, "arp from %*D: addr len: new %d, " + "i/f %d (ignored)\n", ifp->if_addrlen, + (u_char *) ar_sha(ah), ":", ah->ar_hln, + ifp->if_addrlen); goto drop; } (void)memcpy(&la->ll_addr, ar_sha(ah), ifp->if_addrlen); From owner-svn-src-stable@FreeBSD.ORG Wed Mar 21 07:29:48 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1EB791065675; Wed, 21 Mar 2012 07:29:48 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08F068FC0C; Wed, 21 Mar 2012 07:29:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2L7TlnP059907; Wed, 21 Mar 2012 07:29:47 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2L7Tlj5059905; Wed, 21 Mar 2012 07:29:47 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201203210729.q2L7Tlj5059905@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 21 Mar 2012 07:29:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233266 - in stable/9/sys: i386/conf netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 07:29:48 -0000 Author: glebius Date: Wed Mar 21 07:29:47 2012 New Revision: 233266 URL: http://svn.freebsd.org/changeset/base/233266 Log: Merge 228321 from head: Fix double free. PR: kern/163089 Submitted by: Herbie Robinson Modified: stable/9/sys/netinet6/mld6.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/netinet6/mld6.c ============================================================================== --- stable/9/sys/netinet6/mld6.c Wed Mar 21 07:22:27 2012 (r233265) +++ stable/9/sys/netinet6/mld6.c Wed Mar 21 07:29:47 2012 (r233266) @@ -3096,7 +3096,6 @@ mld_dispatch_packet(struct mbuf *m) m0 = mld_v2_encap_report(ifp, m); if (m0 == NULL) { CTR2(KTR_MLD, "%s: dropped %p", __func__, m); - m_freem(m); IP6STAT_INC(ip6s_odropped); goto out; } From owner-svn-src-stable@FreeBSD.ORG Wed Mar 21 09:19:24 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 857581065674; Wed, 21 Mar 2012 09:19:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5607F8FC0C; Wed, 21 Mar 2012 09:19:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2L9JOO3063683; Wed, 21 Mar 2012 09:19:24 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2L9JOhx063681; Wed, 21 Mar 2012 09:19:24 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201203210919.q2L9JOhx063681@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 21 Mar 2012 09:19:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233275 - in stable/9/sys: contrib/pf/net i386/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 09:19:24 -0000 Author: glebius Date: Wed Mar 21 09:19:23 2012 New Revision: 233275 URL: http://svn.freebsd.org/changeset/base/233275 Log: Merge 232685 from head: Merge from OpenBSD: revision 1.146 date: 2010/05/12 08:11:11; author: claudio; state: Exp; lines: +2 -3 bzero() the full compressed update struct before setting the values. This is needed because pf_state_peer_hton() skips some fields in certain situations which could result in garbage beeing sent to the other peer. This seems to fix the pfsync storms seen by stephan@ and so dlg owes me a whiskey. I didn't see any storms, but this definitely fixes a useless memory allocation on the receiving side, due to non zero scrub_flags field in a pfsync_state_peer structure. Modified: stable/9/sys/contrib/pf/net/if_pfsync.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- stable/9/sys/contrib/pf/net/if_pfsync.c Wed Mar 21 08:57:15 2012 (r233274) +++ stable/9/sys/contrib/pf/net/if_pfsync.c Wed Mar 21 09:19:23 2012 (r233275) @@ -48,6 +48,7 @@ * 1.120, 1.175 - use monotonic time_uptime * 1.122 - reduce number of updates for non-TCP sessions * 1.128 - cleanups + * 1.146 - bzero() mbuf before sparsely filling it with data * 1.170 - SIOCSIFMTU checks */ @@ -2020,6 +2021,7 @@ pfsync_out_upd_c(struct pf_state *st, st { struct pfsync_upd_c *up = (struct pfsync_upd_c *)(m->m_data + offset); + bzero(up, sizeof(*up)); up->id = st->id; pf_state_peer_hton(&st->src, &up->src); pf_state_peer_hton(&st->dst, &up->dst); @@ -2032,8 +2034,6 @@ pfsync_out_upd_c(struct pf_state *st, st up->expire = htonl(up->expire - time_second); up->timeout = st->timeout; - bzero(up->_pad, sizeof(up->_pad)); /* XXX */ - return (sizeof(*up)); } From owner-svn-src-stable@FreeBSD.ORG Wed Mar 21 10:03:53 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 624E11065674; Wed, 21 Mar 2012 10:03:53 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D1D78FC15; Wed, 21 Mar 2012 10:03:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2LA3rBR065930; Wed, 21 Mar 2012 10:03:53 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2LA3qsQ065928; Wed, 21 Mar 2012 10:03:52 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201203211003.q2LA3qsQ065928@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 21 Mar 2012 10:03:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233277 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 10:03:53 -0000 Author: ae Date: Wed Mar 21 10:03:52 2012 New Revision: 233277 URL: http://svn.freebsd.org/changeset/base/233277 Log: MFC r224546 (by glebius): Don't leak kld_sx lock in kldunloadf(). Modified: stable/8/sys/kern/kern_linker.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_linker.c ============================================================================== --- stable/8/sys/kern/kern_linker.c Wed Mar 21 09:48:32 2012 (r233276) +++ stable/8/sys/kern/kern_linker.c Wed Mar 21 10:03:52 2012 (r233277) @@ -1111,8 +1111,9 @@ kern_kldunload(struct thread *td, int fi PMC_CALL_HOOK(td, PMC_FN_KLD_UNLOAD, (void *) &pkm); KLD_UNLOCK_READ(); } else -#else KLD_UNLOCK(); +#else + KLD_UNLOCK(); #endif CURVNET_RESTORE(); return (error); From owner-svn-src-stable@FreeBSD.ORG Wed Mar 21 16:17:00 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1DAE01065674; Wed, 21 Mar 2012 16:17:00 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08C848FC18; Wed, 21 Mar 2012 16:17:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2LGGxDm084101; Wed, 21 Mar 2012 16:16:59 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2LGGxKf084099; Wed, 21 Mar 2012 16:16:59 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201203211616.q2LGGxKf084099@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 21 Mar 2012 16:16:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233281 - in stable/9/sys: i386/conf kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 16:17:00 -0000 Author: jh Date: Wed Mar 21 16:16:59 2012 New Revision: 233281 URL: http://svn.freebsd.org/changeset/base/233281 Log: MFC r232975: Add an assert for proctree_lock to proc_to_reap(). Modified: stable/9/sys/kern/kern_exit.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/kern/kern_exit.c ============================================================================== --- stable/9/sys/kern/kern_exit.c Wed Mar 21 16:01:15 2012 (r233280) +++ stable/9/sys/kern/kern_exit.c Wed Mar 21 16:16:59 2012 (r233281) @@ -814,6 +814,8 @@ proc_to_reap(struct thread *td, struct p { struct proc *q; + sx_assert(&proctree_lock, SA_XLOCKED); + q = td->td_proc; PROC_LOCK(p); if (pid != WAIT_ANY && p->p_pid != pid && p->p_pgid != -pid) { From owner-svn-src-stable@FreeBSD.ORG Wed Mar 21 20:50:16 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3953C106566B; Wed, 21 Mar 2012 20:50:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 21CE78FC14; Wed, 21 Mar 2012 20:50:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2LKoG4o092882; Wed, 21 Mar 2012 20:50:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2LKoFYF092873; Wed, 21 Mar 2012 20:50:15 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203212050.q2LKoFYF092873@svn.freebsd.org> From: John Baldwin Date: Wed, 21 Mar 2012 20:50:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233285 - in stable/9/sys: fs/nfsclient i386/conf kern nfsclient sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 20:50:16 -0000 Author: jhb Date: Wed Mar 21 20:50:15 2012 New Revision: 233285 URL: http://svn.freebsd.org/changeset/base/233285 Log: MFC 230394,230441,230489,230552,232420: Close a race in NFS lookup processing that could result in stale name cache entries on one client when a directory was renamed on another client. The root cause for the stale entry being trusted is that each per-vnode nfsnode structure has a single 'n_ctime' timestamp used to validate positive name cache entries. However, if there are multiple entries for a single vnode, they all share a single timestamp. To fix this, extend the name cache to allow filesystems to optionally store a timestamp value in each name cache entry. The NFS clients now fetch the timestamp associated with each name cache entry and use that to validate cache hits instead of the timestamps previously stored in the nfsnode. Another part of the fix is that the NFS clients now use timestamps from the post-op attributes of RPCs when adding name cache entries rather than pulling the timestamps out of the file's attribute cache. The latter is subject to races with other lookups updating the attribute cache concurrently. Modified: stable/9/sys/fs/nfsclient/nfs_clrpcops.c stable/9/sys/fs/nfsclient/nfs_clvnops.c stable/9/sys/fs/nfsclient/nfsnode.h stable/9/sys/kern/vfs_cache.c stable/9/sys/nfsclient/nfs_subs.c stable/9/sys/nfsclient/nfs_vnops.c stable/9/sys/nfsclient/nfsm_subs.h stable/9/sys/nfsclient/nfsnode.h stable/9/sys/sys/vnode.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clrpcops.c Wed Mar 21 19:09:52 2012 (r233284) +++ stable/9/sys/fs/nfsclient/nfs_clrpcops.c Wed Mar 21 20:50:15 2012 (r233285) @@ -2951,10 +2951,12 @@ nfsrpc_readdirplus(vnode_t vp, struct ui nfsattrbit_t attrbits, dattrbits; size_t tresid; u_int32_t *tl2 = NULL, fakefileno = 0xffffffff, rderr; + struct timespec dctime; KASSERT(uiop->uio_iovcnt == 1 && (uio_uio_resid(uiop) & (DIRBLKSIZ - 1)) == 0, ("nfs readdirplusrpc bad uio")); + timespecclear(&dctime); *attrflagp = 0; if (eofp != NULL) *eofp = 0; @@ -2997,6 +2999,7 @@ nfsrpc_readdirplus(vnode_t vp, struct ui #endif if (error) return (error); + dctime = nfsva.na_ctime; dotfileid = nfsva.na_fileid; NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, vp); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); @@ -3134,6 +3137,8 @@ nfsrpc_readdirplus(vnode_t vp, struct ui error = nd->nd_repstat; goto nfsmout; } + if ((nd->nd_flag & ND_NFSV3) != 0 && *attrflagp != 0) + dctime = nap->na_ctime; NFSM_DISSECT(tl, u_int32_t *, 3 * NFSX_UNSIGNED); NFSLOCKNODE(dnp); dnp->n_cookieverf.nfsuquad[0] = *tl++; @@ -3316,9 +3321,14 @@ nfsrpc_readdirplus(vnode_t vp, struct ui vtonfs_dtype(np->n_vattr.na_type); ndp->ni_vp = newvp; NFSCNHASH(cnp, HASHINIT); - if (cnp->cn_namelen <= NCHNAMLEN) { - np->n_ctime = np->n_vattr.na_ctime; - cache_enter(ndp->ni_dvp,ndp->ni_vp,cnp); + if (cnp->cn_namelen <= NCHNAMLEN && + (newvp->v_type != VDIR || + dctime.tv_sec != 0)) { + cache_enter_time(ndp->ni_dvp, + ndp->ni_vp, cnp, + &nfsva.na_ctime, + newvp->v_type != VDIR ? NULL : + &dctime); } if (unlocknewvp) vput(newvp); Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvnops.c Wed Mar 21 19:09:52 2012 (r233284) +++ stable/9/sys/fs/nfsclient/nfs_clvnops.c Wed Mar 21 20:50:15 2012 (r233285) @@ -1016,12 +1016,12 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode *newvp; struct nfsmount *nmp; struct nfsnode *np, *newnp; - int error = 0, attrflag, dattrflag, ltype; + int error = 0, attrflag, dattrflag, ltype, ncticks; struct thread *td = cnp->cn_thread; struct nfsfh *nfhp; struct nfsvattr dnfsva, nfsva; struct vattr vattr; - struct timespec dmtime; + struct timespec nctime; *vpp = NULLVP; if ((flags & ISLASTCN) && (mp->mnt_flag & MNT_RDONLY) && @@ -1042,11 +1042,24 @@ nfs_lookup(struct vop_lookup_args *ap) if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) return (error); - error = cache_lookup(dvp, vpp, cnp); + error = cache_lookup_times(dvp, vpp, cnp, &nctime, &ncticks); if (error > 0 && error != ENOENT) return (error); if (error == -1) { /* + * Lookups of "." are special and always return the + * current directory. cache_lookup() already handles + * associated locking bookkeeping, etc. + */ + if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') { + /* XXX: Is this really correct? */ + if (cnp->cn_nameiop != LOOKUP && + (flags & ISLASTCN)) + cnp->cn_flags |= SAVENAME; + return (0); + } + + /* * We only accept a positive hit in the cache if the * change time of the file matches our cached copy. * Otherwise, we discard the cache entry and fallback @@ -1073,7 +1086,7 @@ nfs_lookup(struct vop_lookup_args *ap) } if (nfscl_nodeleg(newvp, 0) == 0 || (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && - timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==))) { + timespeccmp(&vattr.va_ctime, &nctime, ==))) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -1092,36 +1105,21 @@ nfs_lookup(struct vop_lookup_args *ap) /* * We only accept a negative hit in the cache if the * modification time of the parent directory matches - * our cached copy. Otherwise, we discard all of the - * negative cache entries for this directory. We also - * only trust -ve cache entries for less than - * nm_negative_namecache_timeout seconds. + * the cached copy in the name cache entry. + * Otherwise, we discard all of the negative cache + * entries for this directory. We also only trust + * negative cache entries for up to nm_negnametimeo + * seconds. */ - if ((u_int)(ticks - np->n_dmtime_ticks) < - (nmp->nm_negnametimeo * hz) && + if ((u_int)(ticks - ncticks) < (nmp->nm_negnametimeo * hz) && VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && - timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) { + timespeccmp(&vattr.va_mtime, &nctime, ==)) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); return (ENOENT); } cache_purge_negative(dvp); - mtx_lock(&np->n_mtx); - timespecclear(&np->n_dmtime); - mtx_unlock(&np->n_mtx); } - /* - * Cache the modification time of the parent directory in case - * the lookup fails and results in adding the first negative - * name cache entry for the directory. Since this is reading - * a single time_t, don't bother with locking. The - * modification time may be a bit stale, but it must be read - * before performing the lookup RPC to prevent a race where - * another lookup updates the timestamp on the directory after - * the lookup RPC has been performed on the server but before - * n_dmtime is set at the end of this function. - */ - dmtime = np->n_vattr.na_mtime; error = 0; newvp = NULLVP; NFSINCRGLOBAL(newnfsstats.lookupcache_misses); @@ -1157,30 +1155,22 @@ nfs_lookup(struct vop_lookup_args *ap) return (EJUSTRETURN); } - if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE) { + if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE && + dattrflag) { /* - * Maintain n_dmtime as the modification time - * of the parent directory when the oldest -ve - * name cache entry for this directory was - * added. If a -ve cache entry has already - * been added with a newer modification time - * by a concurrent lookup, then don't bother - * adding a cache entry. The modification - * time of the directory might have changed - * due to the file this lookup failed to find - * being created. In that case a subsequent - * lookup would incorrectly use the entry - * added here instead of doing an extra - * lookup. + * Cache the modification time of the parent + * directory from the post-op attributes in + * the name cache entry. The negative cache + * entry will be ignored once the directory + * has changed. Don't bother adding the entry + * if the directory has already changed. */ mtx_lock(&np->n_mtx); - if (timespeccmp(&np->n_dmtime, &dmtime, <=)) { - if (!timespecisset(&np->n_dmtime)) { - np->n_dmtime = dmtime; - np->n_dmtime_ticks = ticks; - } + if (timespeccmp(&np->n_vattr.na_mtime, + &dnfsva.na_mtime, ==)) { mtx_unlock(&np->n_mtx); - cache_enter(dvp, NULL, cnp); + cache_enter_time(dvp, NULL, cnp, + &dnfsva.na_mtime, NULL); } else mtx_unlock(&np->n_mtx); } @@ -1279,10 +1269,10 @@ nfs_lookup(struct vop_lookup_args *ap) if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && - (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.na_vattr.va_ctime; - cache_enter(dvp, newvp, cnp); - } + (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && + attrflag != 0 && (newvp->v_type != VDIR || dattrflag != 0)) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + newvp->v_type != VDIR ? NULL : &dnfsva.na_ctime); *vpp = newvp; return (0); } @@ -1442,8 +1432,6 @@ nfs_mknodrpc(struct vnode *dvp, struct v } } if (!error) { - if ((cnp->cn_flags & MAKEENTRY)) - cache_enter(dvp, newvp, cnp); *vpp = newvp; } else if (NFS_ISV4(dvp)) { error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, @@ -1601,8 +1589,9 @@ again: } } if (!error) { - if (cnp->cn_flags & MAKEENTRY) - cache_enter(dvp, newvp, cnp); + if ((cnp->cn_flags & MAKEENTRY) && attrflag) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + NULL); *ap->a_vpp = newvp; } else if (NFS_ISV4(dvp)) { error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, @@ -1977,8 +1966,9 @@ nfs_link(struct vop_link_args *ap) * must care about lookup caching hit rate, so... */ if (VFSTONFS(vp->v_mount)->nm_negnametimeo != 0 && - (cnp->cn_flags & MAKEENTRY)) - cache_enter(tdvp, vp, cnp); + (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) { + cache_enter_time(tdvp, vp, cnp, &nfsva.na_ctime, NULL); + } if (error && NFS_ISV4(vp)) error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0, (gid_t)0); @@ -2034,15 +2024,6 @@ nfs_symlink(struct vop_symlink_args *ap) error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, vap->va_gid); } else { - /* - * If negative lookup caching is enabled, I might as well - * add an entry for this node. Not necessary for correctness, - * but if negative caching is enabled, then the system - * must care about lookup caching hit rate, so... - */ - if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && - (cnp->cn_flags & MAKEENTRY)) - cache_enter(dvp, newvp, cnp); *ap->a_vpp = newvp; } @@ -2057,6 +2038,16 @@ nfs_symlink(struct vop_symlink_args *ap) mtx_unlock(&dnp->n_mtx); KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp); } + /* + * If negative lookup caching is enabled, I might as well + * add an entry for this node. Not necessary for correctness, + * but if negative caching is enabled, then the system + * must care about lookup caching hit rate, so... + */ + if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && + (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) { + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, NULL); + } return (error); } @@ -2127,8 +2118,10 @@ nfs_mkdir(struct vop_mkdir_args *ap) * must care about lookup caching hit rate, so... */ if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && - (cnp->cn_flags & MAKEENTRY)) - cache_enter(dvp, newvp, cnp); + (cnp->cn_flags & MAKEENTRY) && + attrflag != 0 && dattrflag != 0) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + &dnfsva.na_ctime); *ap->a_vpp = newvp; } return (error); Modified: stable/9/sys/fs/nfsclient/nfsnode.h ============================================================================== --- stable/9/sys/fs/nfsclient/nfsnode.h Wed Mar 21 19:09:52 2012 (r233284) +++ stable/9/sys/fs/nfsclient/nfsnode.h Wed Mar 21 20:50:15 2012 (r233285) @@ -99,9 +99,9 @@ struct nfsnode { time_t n_attrstamp; /* Attr. cache timestamp */ struct nfs_accesscache n_accesscache[NFS_ACCESSCACHESIZE]; struct timespec n_mtime; /* Prev modify time. */ - struct timespec n_ctime; /* Prev create time. */ - struct timespec n_dmtime; /* Prev dir modify time. */ - int n_dmtime_ticks; /* Tick of -ve cache entry */ + struct timespec n_unused0; + struct timespec n_unused1; + int n_unused2; struct nfsfh *n_fhp; /* NFS File Handle */ struct vnode *n_vnode; /* associated vnode */ struct vnode *n_dvp; /* parent vnode */ Modified: stable/9/sys/kern/vfs_cache.c ============================================================================== --- stable/9/sys/kern/vfs_cache.c Wed Mar 21 19:09:52 2012 (r233284) +++ stable/9/sys/kern/vfs_cache.c Wed Mar 21 20:50:15 2012 (r233285) @@ -103,6 +103,36 @@ struct namecache { }; /* + * struct namecache_ts repeats struct namecache layout up to the + * nc_nlen member. + * struct namecache_ts is used in place of struct namecache when time(s) need + * to be stored. The nc_dotdottime field is used when a cache entry is mapping + * both a non-dotdot directory name plus dotdot for the directory's + * parent. + */ +struct namecache_ts { + LIST_ENTRY(namecache) nc_hash; /* hash chain */ + LIST_ENTRY(namecache) nc_src; /* source vnode list */ + TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ + struct vnode *nc_dvp; /* vnode of parent of name */ + struct vnode *nc_vp; /* vnode the name refers to */ + u_char nc_flag; /* flag bits */ + u_char nc_nlen; /* length of name */ + struct timespec nc_time; /* timespec provided by fs */ + struct timespec nc_dotdottime; /* dotdot timespec provided by fs */ + int nc_ticks; /* ticks value when entry was added */ + char nc_name[0]; /* segment name + nul */ +}; + +/* + * Flags in namecache.nc_flag + */ +#define NCF_WHITE 0x01 +#define NCF_ISDOTDOT 0x02 +#define NCF_TS 0x04 +#define NCF_DTS 0x08 + +/* * Name caching works as follows: * * Names found by directory scans are retained in a cache @@ -164,20 +194,71 @@ RW_SYSINIT(vfscache, &cache_lock, "Name * fit in the small cache. */ static uma_zone_t cache_zone_small; +static uma_zone_t cache_zone_small_ts; static uma_zone_t cache_zone_large; +static uma_zone_t cache_zone_large_ts; #define CACHE_PATH_CUTOFF 35 -#define CACHE_ZONE_SMALL (sizeof(struct namecache) + CACHE_PATH_CUTOFF \ - + 1) -#define CACHE_ZONE_LARGE (sizeof(struct namecache) + NAME_MAX + 1) - -#define cache_alloc(len) uma_zalloc(((len) <= CACHE_PATH_CUTOFF) ? \ - cache_zone_small : cache_zone_large, M_WAITOK) -#define cache_free(ncp) do { \ - if (ncp != NULL) \ - uma_zfree(((ncp)->nc_nlen <= CACHE_PATH_CUTOFF) ? \ - cache_zone_small : cache_zone_large, (ncp)); \ -} while (0) + +static struct namecache * +cache_alloc(int len, int ts) +{ + + if (len > CACHE_PATH_CUTOFF) { + if (ts) + return (uma_zalloc(cache_zone_large_ts, M_WAITOK)); + else + return (uma_zalloc(cache_zone_large, M_WAITOK)); + } + if (ts) + return (uma_zalloc(cache_zone_small_ts, M_WAITOK)); + else + return (uma_zalloc(cache_zone_small, M_WAITOK)); +} + +static void +cache_free(struct namecache *ncp) +{ + int ts; + + if (ncp == NULL) + return; + ts = ncp->nc_flag & NCF_TS; + if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) { + if (ts) + uma_zfree(cache_zone_small_ts, ncp); + else + uma_zfree(cache_zone_small, ncp); + } else if (ts) + uma_zfree(cache_zone_large_ts, ncp); + else + uma_zfree(cache_zone_large, ncp); +} + +static char * +nc_get_name(struct namecache *ncp) +{ + struct namecache_ts *ncp_ts; + + if ((ncp->nc_flag & NCF_TS) == 0) + return (ncp->nc_name); + ncp_ts = (struct namecache_ts *)ncp; + return (ncp_ts->nc_name); +} + +static void +cache_out_ts(struct namecache *ncp, struct timespec *tsp, int *ticksp) +{ + + KASSERT((ncp->nc_flag & NCF_TS) != 0 || + (tsp == NULL && ticksp == NULL), + ("No NCF_TS")); + + if (tsp != NULL) + *tsp = ((struct namecache_ts *)ncp)->nc_time; + if (ticksp != NULL) + *ticksp = ((struct namecache_ts *)ncp)->nc_ticks; +} static int doingcache = 1; /* 1 => enable the cache */ SYSCTL_INT(_debug, OID_AUTO, vfscache, CTLFLAG_RW, &doingcache, 0, @@ -233,12 +314,6 @@ static int vn_fullpath1(struct thread *t static MALLOC_DEFINE(M_VFSCACHE, "vfscache", "VFS name cache entries"); -/* - * Flags in namecache.nc_flag - */ -#define NCF_WHITE 0x01 -#define NCF_ISDOTDOT 0x02 - #ifdef DIAGNOSTIC /* * Grab an atomic snapshot of the name cache hash chain lengths @@ -343,10 +418,10 @@ cache_zap(ncp) #ifdef KDTRACE_HOOKS if (ncp->nc_vp != NULL) { SDT_PROBE(vfs, namecache, zap, done, ncp->nc_dvp, - ncp->nc_name, ncp->nc_vp, 0, 0); + nc_get_name(ncp), ncp->nc_vp, 0, 0); } else { SDT_PROBE(vfs, namecache, zap_negative, done, ncp->nc_dvp, - ncp->nc_name, 0, 0, 0); + nc_get_name(ncp), 0, 0, 0); } #endif vp = NULL; @@ -393,10 +468,12 @@ cache_zap(ncp) */ int -cache_lookup(dvp, vpp, cnp) +cache_lookup_times(dvp, vpp, cnp, tsp, ticksp) struct vnode *dvp; struct vnode **vpp; struct componentname *cnp; + struct timespec *tsp; + int *ticksp; { struct namecache *ncp; uint32_t hash; @@ -421,6 +498,10 @@ retry_wlocked: dothits++; SDT_PROBE(vfs, namecache, lookup, hit, dvp, ".", *vpp, 0, 0); + if (tsp != NULL) + timespecclear(tsp); + if (ticksp != NULL) + *ticksp = ticks; goto success; } if (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.') { @@ -439,19 +520,23 @@ retry_wlocked: CACHE_WUNLOCK(); return (0); } - if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT) - *vpp = dvp->v_cache_dd->nc_vp; + ncp = dvp->v_cache_dd; + if (ncp->nc_flag & NCF_ISDOTDOT) + *vpp = ncp->nc_vp; else - *vpp = dvp->v_cache_dd->nc_dvp; + *vpp = ncp->nc_dvp; /* Return failure if negative entry was found. */ - if (*vpp == NULL) { - ncp = dvp->v_cache_dd; + if (*vpp == NULL) goto negative_success; - } CTR3(KTR_VFS, "cache_lookup(%p, %s) found %p via ..", dvp, cnp->cn_nameptr, *vpp); SDT_PROBE(vfs, namecache, lookup, hit, dvp, "..", *vpp, 0, 0); + cache_out_ts(ncp, tsp, ticksp); + if ((ncp->nc_flag & (NCF_ISDOTDOT | NCF_DTS)) == + NCF_DTS && tsp != NULL) + *tsp = ((struct namecache_ts *)ncp)-> + nc_dotdottime; goto success; } } @@ -461,7 +546,7 @@ retry_wlocked: LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { numchecks++; if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen && - !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen)) + !bcmp(nc_get_name(ncp), cnp->cn_nameptr, ncp->nc_nlen)) break; } @@ -496,8 +581,9 @@ retry_wlocked: *vpp = ncp->nc_vp; CTR4(KTR_VFS, "cache_lookup(%p, %s) found %p via ncp %p", dvp, cnp->cn_nameptr, *vpp, ncp); - SDT_PROBE(vfs, namecache, lookup, hit, dvp, ncp->nc_name, + SDT_PROBE(vfs, namecache, lookup, hit, dvp, nc_get_name(ncp), *vpp, 0, 0); + cache_out_ts(ncp, tsp, ticksp); goto success; } @@ -527,8 +613,9 @@ negative_success: nchstats.ncs_neghits++; if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; - SDT_PROBE(vfs, namecache, lookup, hit_negative, dvp, ncp->nc_name, + SDT_PROBE(vfs, namecache, lookup, hit_negative, dvp, nc_get_name(ncp), 0, 0, 0); + cache_out_ts(ncp, tsp, ticksp); CACHE_WUNLOCK(); return (ENOENT); @@ -615,12 +702,15 @@ unlock: * Add an entry to the cache. */ void -cache_enter(dvp, vp, cnp) +cache_enter_time(dvp, vp, cnp, tsp, dtsp) struct vnode *dvp; struct vnode *vp; struct componentname *cnp; + struct timespec *tsp; + struct timespec *dtsp; { struct namecache *ncp, *n2; + struct namecache_ts *n3; struct nchashhead *ncpp; uint32_t hash; int flag; @@ -687,13 +777,23 @@ cache_enter(dvp, vp, cnp) * Calculate the hash key and setup as much of the new * namecache entry as possible before acquiring the lock. */ - ncp = cache_alloc(cnp->cn_namelen); + ncp = cache_alloc(cnp->cn_namelen, tsp != NULL); ncp->nc_vp = vp; ncp->nc_dvp = dvp; ncp->nc_flag = flag; + if (tsp != NULL) { + n3 = (struct namecache_ts *)ncp; + n3->nc_time = *tsp; + n3->nc_ticks = ticks; + n3->nc_flag |= NCF_TS; + if (dtsp != NULL) { + n3->nc_dotdottime = *dtsp; + n3->nc_flag |= NCF_DTS; + } + } len = ncp->nc_nlen = cnp->cn_namelen; hash = fnv_32_buf(cnp->cn_nameptr, len, FNV1_32_INIT); - strlcpy(ncp->nc_name, cnp->cn_nameptr, len + 1); + strlcpy(nc_get_name(ncp), cnp->cn_nameptr, len + 1); hash = fnv_32_buf(&dvp, sizeof(dvp), hash); CACHE_WLOCK(); @@ -706,7 +806,22 @@ cache_enter(dvp, vp, cnp) LIST_FOREACH(n2, ncpp, nc_hash) { if (n2->nc_dvp == dvp && n2->nc_nlen == cnp->cn_namelen && - !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) { + !bcmp(nc_get_name(n2), cnp->cn_nameptr, n2->nc_nlen)) { + if (tsp != NULL) { + KASSERT((n2->nc_flag & NCF_TS) != 0, + ("no NCF_TS")); + n3 = (struct namecache_ts *)n2; + n3->nc_time = + ((struct namecache_ts *)ncp)->nc_time; + n3->nc_ticks = + ((struct namecache_ts *)ncp)->nc_ticks; + if (dtsp != NULL) { + n3->nc_dotdottime = + ((struct namecache_ts *)ncp)-> + nc_dotdottime; + n3->nc_flag |= NCF_DTS; + } + } CACHE_WUNLOCK(); cache_free(ncp); return; @@ -735,6 +850,11 @@ cache_enter(dvp, vp, cnp) ncp->nc_flag |= NCF_WHITE; } else if (vp->v_type == VDIR) { if (flag != NCF_ISDOTDOT) { + /* + * For this case, the cache entry maps both the + * directory name in it and the name ".." for the + * directory's parent. + */ if ((n2 = vp->v_cache_dd) != NULL && (n2->nc_flag & NCF_ISDOTDOT) != 0) cache_zap(n2); @@ -764,12 +884,12 @@ cache_enter(dvp, vp, cnp) */ if (vp) { TAILQ_INSERT_HEAD(&vp->v_cache_dst, ncp, nc_dst); - SDT_PROBE(vfs, namecache, enter, done, dvp, ncp->nc_name, vp, - 0, 0); + SDT_PROBE(vfs, namecache, enter, done, dvp, nc_get_name(ncp), + vp, 0, 0); } else { TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); SDT_PROBE(vfs, namecache, enter_negative, done, dvp, - ncp->nc_name, 0, 0, 0); + nc_get_name(ncp), 0, 0, 0); } if (numneg * ncnegfactor > numcache) { ncp = TAILQ_FIRST(&ncneg); @@ -791,10 +911,18 @@ nchinit(void *dummy __unused) TAILQ_INIT(&ncneg); - cache_zone_small = uma_zcreate("S VFS Cache", CACHE_ZONE_SMALL, NULL, - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); - cache_zone_large = uma_zcreate("L VFS Cache", CACHE_ZONE_LARGE, NULL, - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_small = uma_zcreate("S VFS Cache", + sizeof(struct namecache) + CACHE_PATH_CUTOFF + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_small_ts = uma_zcreate("STS VFS Cache", + sizeof(struct namecache_ts) + CACHE_PATH_CUTOFF + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_large = uma_zcreate("L VFS Cache", + sizeof(struct namecache) + NAME_MAX + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_large_ts = uma_zcreate("LTS VFS Cache", + sizeof(struct namecache_ts) + NAME_MAX + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); nchashtbl = hashinit(desiredvnodes * 2, M_VFSCACHE, &nchash); } @@ -1098,9 +1226,9 @@ vn_vptocnp_locked(struct vnode **vp, str return (error); } *buflen -= ncp->nc_nlen; - memcpy(buf + *buflen, ncp->nc_name, ncp->nc_nlen); + memcpy(buf + *buflen, nc_get_name(ncp), ncp->nc_nlen); SDT_PROBE(vfs, namecache, fullpath, hit, ncp->nc_dvp, - ncp->nc_name, vp, 0, 0); + nc_get_name(ncp), vp, 0, 0); dvp = *vp; *vp = ncp->nc_dvp; vref(*vp); @@ -1273,12 +1401,35 @@ vn_commname(struct vnode *vp, char *buf, return (ENOENT); } l = min(ncp->nc_nlen, buflen - 1); - memcpy(buf, ncp->nc_name, l); + memcpy(buf, nc_get_name(ncp), l); CACHE_RUNLOCK(); buf[l] = '\0'; return (0); } +/* ABI compat shims for old kernel modules. */ +#undef cache_enter +#undef cache_lookup + +void cache_enter(struct vnode *dvp, struct vnode *vp, + struct componentname *cnp); +int cache_lookup(struct vnode *dvp, struct vnode **vpp, + struct componentname *cnp); + +void +cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) +{ + + cache_enter_time(dvp, vp, cnp, NULL, NULL); +} + +int +cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) +{ + + return (cache_lookup_times(dvp, vpp, cnp, NULL, NULL)); +} + /* * This function updates path string to vnode's full global path * and checks the size of the new path string against the pathlen argument. Modified: stable/9/sys/nfsclient/nfs_subs.c ============================================================================== --- stable/9/sys/nfsclient/nfs_subs.c Wed Mar 21 19:09:52 2012 (r233284) +++ stable/9/sys/nfsclient/nfs_subs.c Wed Mar 21 20:50:15 2012 (r233285) @@ -978,8 +978,8 @@ nfsm_loadattr_xx(struct vnode **v, struc } int -nfsm_postop_attr_xx(struct vnode **v, int *f, struct mbuf **md, - caddr_t *dpos) +nfsm_postop_attr_xx(struct vnode **v, int *f, struct vattr *va, + struct mbuf **md, caddr_t *dpos) { u_int32_t *tl; int t1; @@ -990,7 +990,7 @@ nfsm_postop_attr_xx(struct vnode **v, in return EBADRPC; *f = fxdr_unsigned(int, *tl); if (*f != 0) { - t1 = nfs_loadattrcache(&ttvp, md, dpos, NULL, 1); + t1 = nfs_loadattrcache(&ttvp, md, dpos, va, 1); if (t1 != 0) { *f = 0; return t1; @@ -1020,7 +1020,7 @@ nfsm_wcc_data_xx(struct vnode **v, int * VTONFS(*v)->n_mtime.tv_nsec == fxdr_unsigned(u_int32_t, *(tl + 3))); mtx_unlock(&(VTONFS(*v))->n_mtx); } - t1 = nfsm_postop_attr_xx(v, &ttattrf, md, dpos); + t1 = nfsm_postop_attr_xx(v, &ttattrf, NULL, md, dpos); if (t1) return t1; if (*f) Modified: stable/9/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/9/sys/nfsclient/nfs_vnops.c Wed Mar 21 19:09:52 2012 (r233284) +++ stable/9/sys/nfsclient/nfs_vnops.c Wed Mar 21 20:50:15 2012 (r233285) @@ -912,8 +912,8 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode *dvp = ap->a_dvp; struct vnode **vpp = ap->a_vpp; struct mount *mp = dvp->v_mount; - struct vattr vattr; - struct timespec dmtime; + struct vattr dvattr, vattr; + struct timespec nctime; int flags = cnp->cn_flags; struct vnode *newvp; struct nfsmount *nmp; @@ -922,7 +922,7 @@ nfs_lookup(struct vop_lookup_args *ap) long len; nfsfh_t *fhp; struct nfsnode *np, *newnp; - int error = 0, attrflag, fhsize, ltype; + int error = 0, attrflag, dattrflag, fhsize, ltype, ncticks; int v3 = NFS_ISV3(dvp); struct thread *td = cnp->cn_thread; @@ -938,11 +938,24 @@ nfs_lookup(struct vop_lookup_args *ap) *vpp = NULLVP; return (error); } - error = cache_lookup(dvp, vpp, cnp); + error = cache_lookup_times(dvp, vpp, cnp, &nctime, &ncticks); if (error > 0 && error != ENOENT) return (error); if (error == -1) { /* + * Lookups of "." are special and always return the + * current directory. cache_lookup() already handles + * associated locking bookkeeping, etc. + */ + if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') { + /* XXX: Is this really correct? */ + if (cnp->cn_nameiop != LOOKUP && + (flags & ISLASTCN)) + cnp->cn_flags |= SAVENAME; + return (0); + } + + /* * We only accept a positive hit in the cache if the * change time of the file matches our cached copy. * Otherwise, we discard the cache entry and fallback @@ -968,7 +981,7 @@ nfs_lookup(struct vop_lookup_args *ap) mtx_unlock(&newnp->n_mtx); } if (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && - timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==)) { + timespeccmp(&vattr.va_ctime, &nctime, ==)) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -987,36 +1000,22 @@ nfs_lookup(struct vop_lookup_args *ap) /* * We only accept a negative hit in the cache if the * modification time of the parent directory matches - * our cached copy. Otherwise, we discard all of the - * negative cache entries for this directory. We also - * only trust -ve cache entries for less than - * nm_negative_namecache_timeout seconds. + * the cached copy in the name cache entry. + * Otherwise, we discard all of the negative cache + * entries for this directory. We also only trust + * negative cache entries for up to nm_negnametimeo + * seconds. */ - if ((u_int)(ticks - np->n_dmtime_ticks) < - (nmp->nm_negnametimeo * hz) && + if ((u_int)(ticks - ncticks) < (nmp->nm_negnametimeo * hz) && VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && - timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) { + timespeccmp(&vattr.va_mtime, &nctime, ==)) { nfsstats.lookupcache_hits++; return (ENOENT); } cache_purge_negative(dvp); - mtx_lock(&np->n_mtx); - timespecclear(&np->n_dmtime); - mtx_unlock(&np->n_mtx); } - /* - * Cache the modification time of the parent directory in case - * the lookup fails and results in adding the first negative - * name cache entry for the directory. Since this is reading - * a single time_t, don't bother with locking. The - * modification time may be a bit stale, but it must be read - * before performing the lookup RPC to prevent a race where - * another lookup updates the timestamp on the directory after - * the lookup RPC has been performed on the server but before - * n_dmtime is set at the end of this function. - */ - dmtime = np->n_vattr.va_mtime; + attrflag = dattrflag = 0; error = 0; newvp = NULLVP; nfsstats.lookupcache_misses++; @@ -1031,7 +1030,7 @@ nfs_lookup(struct vop_lookup_args *ap) nfsm_request(dvp, NFSPROC_LOOKUP, cnp->cn_thread, cnp->cn_cred); if (error) { if (v3) { - nfsm_postop_attr(dvp, attrflag); + nfsm_postop_attr_va(dvp, dattrflag, &vattr); m_freem(mrep); } goto nfsmout; @@ -1127,17 +1126,19 @@ nfs_lookup(struct vop_lookup_args *ap) } } if (v3) { - nfsm_postop_attr(newvp, attrflag); - nfsm_postop_attr(dvp, attrflag); - } else - nfsm_loadattr(newvp, NULL); + nfsm_postop_attr_va(newvp, attrflag, &vattr); + nfsm_postop_attr_va(dvp, dattrflag, &dvattr); + } else { + nfsm_loadattr(newvp, &vattr); + attrflag = 1; + } if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && - (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.va_ctime; - cache_enter(dvp, newvp, cnp); - } + (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && + attrflag != 0 && (newvp->v_type != VDIR || dattrflag != 0)) + cache_enter_time(dvp, newvp, cnp, &vattr.va_ctime, + newvp->v_type != VDIR ? NULL : &dvattr.va_ctime); *vpp = newvp; m_freem(mrep); nfsmout: @@ -1164,30 +1165,22 @@ nfsmout: return (EJUSTRETURN); } - if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE) { + if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE && + dattrflag) { /* - * Maintain n_dmtime as the modification time - * of the parent directory when the oldest -ve - * name cache entry for this directory was - * added. If a -ve cache entry has already - * been added with a newer modification time - * by a concurrent lookup, then don't bother - * adding a cache entry. The modification - * time of the directory might have changed - * due to the file this lookup failed to find - * being created. In that case a subsequent - * lookup would incorrectly use the entry - * added here instead of doing an extra - * lookup. + * Cache the modification time of the parent + * directory from the post-op attributes in + * the name cache entry. The negative cache + * entry will be ignored once the directory + * has changed. Don't bother adding the entry + * if the directory has already changed. */ mtx_lock(&np->n_mtx); - if (timespeccmp(&np->n_dmtime, &dmtime, <=)) { - if (!timespecisset(&np->n_dmtime)) { - np->n_dmtime = dmtime; - np->n_dmtime_ticks = ticks; - } + if (timespeccmp(&np->n_vattr.va_mtime, + &vattr.va_mtime, ==)) { mtx_unlock(&np->n_mtx); - cache_enter(dvp, NULL, cnp); + cache_enter_time(dvp, NULL, cnp, + &vattr.va_mtime, NULL); } else mtx_unlock(&np->n_mtx); } @@ -1538,8 +1531,6 @@ nfsmout: if (newvp) vput(newvp); } else { - if (cnp->cn_flags & MAKEENTRY) - cache_enter(dvp, newvp, cnp); *vpp = newvp; } mtx_lock(&(VTONFS(dvp))->n_mtx); @@ -1678,8 +1669,6 @@ nfsmout: vput(newvp); } if (!error) { - if (cnp->cn_flags & MAKEENTRY) - cache_enter(dvp, newvp, cnp); *ap->a_vpp = newvp; } mtx_lock(&(VTONFS(dvp))->n_mtx); @@ -2473,10 +2462,11 @@ nfs_readdirplusrpc(struct vnode *vp, str nfsuint64 cookie; struct nfsmount *nmp = VFSTONFS(vp->v_mount); struct nfsnode *dnp = VTONFS(vp), *np; + struct vattr vattr, dvattr; nfsfh_t *fhp; u_quad_t fileno; int error = 0, tlen, more_dirs = 1, blksiz = 0, doit, bigenough = 1, i; - int attrflag, fhsize; + int attrflag, dattrflag, fhsize; #ifndef nolint dp = NULL; @@ -2522,7 +2512,7 @@ nfs_readdirplusrpc(struct vnode *vp, str *tl++ = txdr_unsigned(nmp->nm_readdirsize); *tl = txdr_unsigned(nmp->nm_rsize); nfsm_request(vp, NFSPROC_READDIRPLUS, uiop->uio_td, cred); - nfsm_postop_attr(vp, attrflag); + nfsm_postop_attr_va(vp, dattrflag, &dvattr); if (error) { m_freem(mrep); goto nfsmout; @@ -2653,18 +2643,16 @@ nfs_readdirplusrpc(struct vnode *vp, str dpos = dpossav1; mdsav2 = md; md = mdsav1; - nfsm_loadattr(newvp, NULL); + nfsm_loadattr(newvp, &vattr); dpos = dpossav2; md = mdsav2; - dp->d_type = - IFTODT(VTTOIF(np->n_vattr.va_type)); + dp->d_type = IFTODT(VTTOIF(vattr.va_type)); ndp->ni_vp = newvp; - /* - * Update n_ctime so subsequent lookup - * doesn't purge entry. - */ - np->n_ctime = np->n_vattr.va_ctime; - cache_enter(ndp->ni_dvp, ndp->ni_vp, cnp); + if (newvp->v_type != VDIR || dattrflag != 0) + cache_enter_time(ndp->ni_dvp, ndp->ni_vp, + cnp, &vattr.va_ctime, + newvp->v_type != VDIR ? NULL : + &dvattr.va_ctime); } } else { /* Just skip over the file handle */ Modified: stable/9/sys/nfsclient/nfsm_subs.h ============================================================================== --- stable/9/sys/nfsclient/nfsm_subs.h Wed Mar 21 19:09:52 2012 (r233284) +++ stable/9/sys/nfsclient/nfsm_subs.h Wed Mar 21 20:50:15 2012 (r233285) @@ -152,8 +152,8 @@ int nfsm_getfh_xx(nfsfh_t **f, int *s, i caddr_t *dpos); int nfsm_loadattr_xx(struct vnode **v, struct vattr *va, struct mbuf **md, caddr_t *dpos); -int nfsm_postop_attr_xx(struct vnode **v, int *f, struct mbuf **md, - caddr_t *dpos); +int nfsm_postop_attr_xx(struct vnode **v, int *f, struct vattr *va, + struct mbuf **md, caddr_t *dpos); int nfsm_wcc_data_xx(struct vnode **v, int *f, struct mbuf **md, caddr_t *dpos); @@ -181,7 +181,14 @@ do { \ #define nfsm_postop_attr(v, f) \ do { \ int32_t t1; \ - t1 = nfsm_postop_attr_xx(&v, &f, &md, &dpos); \ + t1 = nfsm_postop_attr_xx(&v, &f, NULL, &md, &dpos); \ + nfsm_dcheck(t1, mrep); \ +} while (0) + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Wed Mar 21 20:50:48 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD949106568B; Wed, 21 Mar 2012 20:50:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 962E78FC0A; Wed, 21 Mar 2012 20:50:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2LKomaJ092940; Wed, 21 Mar 2012 20:50:48 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2LKomrA092931; Wed, 21 Mar 2012 20:50:48 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203212050.q2LKomrA092931@svn.freebsd.org> From: John Baldwin Date: Wed, 21 Mar 2012 20:50:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233286 - in stable/8/sys: fs/nfsclient i386/conf kern nfsclient sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 20:50:48 -0000 Author: jhb Date: Wed Mar 21 20:50:47 2012 New Revision: 233286 URL: http://svn.freebsd.org/changeset/base/233286 Log: MFC 230394,230441,230489,230552,232420: Close a race in NFS lookup processing that could result in stale name cache entries on one client when a directory was renamed on another client. The root cause for the stale entry being trusted is that each per-vnode nfsnode structure has a single 'n_ctime' timestamp used to validate positive name cache entries. However, if there are multiple entries for a single vnode, they all share a single timestamp. To fix this, extend the name cache to allow filesystems to optionally store a timestamp value in each name cache entry. The NFS clients now fetch the timestamp associated with each name cache entry and use that to validate cache hits instead of the timestamps previously stored in the nfsnode. Another part of the fix is that the NFS clients now use timestamps from the post-op attributes of RPCs when adding name cache entries rather than pulling the timestamps out of the file's attribute cache. The latter is subject to races with other lookups updating the attribute cache concurrently. Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c stable/8/sys/fs/nfsclient/nfs_clvnops.c stable/8/sys/fs/nfsclient/nfsnode.h stable/8/sys/kern/vfs_cache.c stable/8/sys/nfsclient/nfs_subs.c stable/8/sys/nfsclient/nfs_vnops.c stable/8/sys/nfsclient/nfsm_subs.h stable/8/sys/nfsclient/nfsnode.h stable/8/sys/sys/vnode.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clrpcops.c Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c Wed Mar 21 20:50:47 2012 (r233286) @@ -2951,10 +2951,12 @@ nfsrpc_readdirplus(vnode_t vp, struct ui nfsattrbit_t attrbits, dattrbits; size_t tresid; u_int32_t *tl2 = NULL, fakefileno = 0xffffffff, rderr; + struct timespec dctime; KASSERT(uiop->uio_iovcnt == 1 && (uio_uio_resid(uiop) & (DIRBLKSIZ - 1)) == 0, ("nfs readdirplusrpc bad uio")); + timespecclear(&dctime); *attrflagp = 0; if (eofp != NULL) *eofp = 0; @@ -2997,6 +2999,7 @@ nfsrpc_readdirplus(vnode_t vp, struct ui #endif if (error) return (error); + dctime = nfsva.na_ctime; dotfileid = nfsva.na_fileid; NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, vp); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); @@ -3134,6 +3137,8 @@ nfsrpc_readdirplus(vnode_t vp, struct ui error = nd->nd_repstat; goto nfsmout; } + if ((nd->nd_flag & ND_NFSV3) != 0 && *attrflagp != 0) + dctime = nap->na_ctime; NFSM_DISSECT(tl, u_int32_t *, 3 * NFSX_UNSIGNED); NFSLOCKNODE(dnp); dnp->n_cookieverf.nfsuquad[0] = *tl++; @@ -3316,9 +3321,14 @@ nfsrpc_readdirplus(vnode_t vp, struct ui vtonfs_dtype(np->n_vattr.na_type); ndp->ni_vp = newvp; NFSCNHASH(cnp, HASHINIT); - if (cnp->cn_namelen <= NCHNAMLEN) { - np->n_ctime = np->n_vattr.na_ctime; - cache_enter(ndp->ni_dvp,ndp->ni_vp,cnp); + if (cnp->cn_namelen <= NCHNAMLEN && + (newvp->v_type != VDIR || + dctime.tv_sec != 0)) { + cache_enter_time(ndp->ni_dvp, + ndp->ni_vp, cnp, + &nfsva.na_ctime, + newvp->v_type != VDIR ? NULL : + &dctime); } if (unlocknewvp) vput(newvp); Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Wed Mar 21 20:50:47 2012 (r233286) @@ -979,12 +979,12 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode *newvp; struct nfsmount *nmp; struct nfsnode *np, *newnp; - int error = 0, attrflag, dattrflag, ltype; + int error = 0, attrflag, dattrflag, ltype, ncticks; struct thread *td = cnp->cn_thread; struct nfsfh *nfhp; struct nfsvattr dnfsva, nfsva; struct vattr vattr; - struct timespec dmtime; + struct timespec nctime; *vpp = NULLVP; if ((flags & ISLASTCN) && (mp->mnt_flag & MNT_RDONLY) && @@ -1005,11 +1005,24 @@ nfs_lookup(struct vop_lookup_args *ap) if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) return (error); - error = cache_lookup(dvp, vpp, cnp); + error = cache_lookup_times(dvp, vpp, cnp, &nctime, &ncticks); if (error > 0 && error != ENOENT) return (error); if (error == -1) { /* + * Lookups of "." are special and always return the + * current directory. cache_lookup() already handles + * associated locking bookkeeping, etc. + */ + if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') { + /* XXX: Is this really correct? */ + if (cnp->cn_nameiop != LOOKUP && + (flags & ISLASTCN)) + cnp->cn_flags |= SAVENAME; + return (0); + } + + /* * We only accept a positive hit in the cache if the * change time of the file matches our cached copy. * Otherwise, we discard the cache entry and fallback @@ -1035,7 +1048,7 @@ nfs_lookup(struct vop_lookup_args *ap) } if (nfscl_nodeleg(newvp, 0) == 0 || (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && - timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==))) { + timespeccmp(&vattr.va_ctime, &nctime, ==))) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -1054,36 +1067,21 @@ nfs_lookup(struct vop_lookup_args *ap) /* * We only accept a negative hit in the cache if the * modification time of the parent directory matches - * our cached copy. Otherwise, we discard all of the - * negative cache entries for this directory. We also - * only trust -ve cache entries for less than - * nm_negative_namecache_timeout seconds. + * the cached copy in the name cache entry. + * Otherwise, we discard all of the negative cache + * entries for this directory. We also only trust + * negative cache entries for up to nm_negnametimeo + * seconds. */ - if ((u_int)(ticks - np->n_dmtime_ticks) < - (nmp->nm_negnametimeo * hz) && + if ((u_int)(ticks - ncticks) < (nmp->nm_negnametimeo * hz) && VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && - timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) { + timespeccmp(&vattr.va_mtime, &nctime, ==)) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); return (ENOENT); } cache_purge_negative(dvp); - mtx_lock(&np->n_mtx); - timespecclear(&np->n_dmtime); - mtx_unlock(&np->n_mtx); } - /* - * Cache the modification time of the parent directory in case - * the lookup fails and results in adding the first negative - * name cache entry for the directory. Since this is reading - * a single time_t, don't bother with locking. The - * modification time may be a bit stale, but it must be read - * before performing the lookup RPC to prevent a race where - * another lookup updates the timestamp on the directory after - * the lookup RPC has been performed on the server but before - * n_dmtime is set at the end of this function. - */ - dmtime = np->n_vattr.na_mtime; error = 0; newvp = NULLVP; NFSINCRGLOBAL(newnfsstats.lookupcache_misses); @@ -1119,30 +1117,22 @@ nfs_lookup(struct vop_lookup_args *ap) return (EJUSTRETURN); } - if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE) { + if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE && + dattrflag) { /* - * Maintain n_dmtime as the modification time - * of the parent directory when the oldest -ve - * name cache entry for this directory was - * added. If a -ve cache entry has already - * been added with a newer modification time - * by a concurrent lookup, then don't bother - * adding a cache entry. The modification - * time of the directory might have changed - * due to the file this lookup failed to find - * being created. In that case a subsequent - * lookup would incorrectly use the entry - * added here instead of doing an extra - * lookup. + * Cache the modification time of the parent + * directory from the post-op attributes in + * the name cache entry. The negative cache + * entry will be ignored once the directory + * has changed. Don't bother adding the entry + * if the directory has already changed. */ mtx_lock(&np->n_mtx); - if (timespeccmp(&np->n_dmtime, &dmtime, <=)) { - if (!timespecisset(&np->n_dmtime)) { - np->n_dmtime = dmtime; - np->n_dmtime_ticks = ticks; - } + if (timespeccmp(&np->n_vattr.na_mtime, + &dnfsva.na_mtime, ==)) { mtx_unlock(&np->n_mtx); - cache_enter(dvp, NULL, cnp); + cache_enter_time(dvp, NULL, cnp, + &dnfsva.na_mtime, NULL); } else mtx_unlock(&np->n_mtx); } @@ -1240,10 +1230,10 @@ nfs_lookup(struct vop_lookup_args *ap) if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && - (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.na_vattr.va_ctime; - cache_enter(dvp, newvp, cnp); - } + (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && + attrflag != 0 && (newvp->v_type != VDIR || dattrflag != 0)) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + newvp->v_type != VDIR ? NULL : &dnfsva.na_ctime); *vpp = newvp; return (0); } @@ -1403,8 +1393,6 @@ nfs_mknodrpc(struct vnode *dvp, struct v } } if (!error) { - if ((cnp->cn_flags & MAKEENTRY)) - cache_enter(dvp, newvp, cnp); *vpp = newvp; } else if (NFS_ISV4(dvp)) { error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, @@ -1549,8 +1537,9 @@ again: } } if (!error) { - if (cnp->cn_flags & MAKEENTRY) - cache_enter(dvp, newvp, cnp); + if ((cnp->cn_flags & MAKEENTRY) && attrflag) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + NULL); *ap->a_vpp = newvp; } else if (NFS_ISV4(dvp)) { error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, @@ -1916,8 +1905,9 @@ nfs_link(struct vop_link_args *ap) * must care about lookup caching hit rate, so... */ if (VFSTONFS(vp->v_mount)->nm_negnametimeo != 0 && - (cnp->cn_flags & MAKEENTRY)) - cache_enter(tdvp, vp, cnp); + (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) { + cache_enter_time(tdvp, vp, cnp, &nfsva.na_ctime, NULL); + } if (error && NFS_ISV4(vp)) error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0, (gid_t)0); @@ -1973,15 +1963,6 @@ nfs_symlink(struct vop_symlink_args *ap) error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, vap->va_gid); } else { - /* - * If negative lookup caching is enabled, I might as well - * add an entry for this node. Not necessary for correctness, - * but if negative caching is enabled, then the system - * must care about lookup caching hit rate, so... - */ - if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && - (cnp->cn_flags & MAKEENTRY)) - cache_enter(dvp, newvp, cnp); *ap->a_vpp = newvp; } @@ -1995,6 +1976,16 @@ nfs_symlink(struct vop_symlink_args *ap) dnp->n_attrstamp = 0; mtx_unlock(&dnp->n_mtx); } + /* + * If negative lookup caching is enabled, I might as well + * add an entry for this node. Not necessary for correctness, + * but if negative caching is enabled, then the system + * must care about lookup caching hit rate, so... + */ + if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && + (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) { + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, NULL); + } return (error); } @@ -2064,8 +2055,10 @@ nfs_mkdir(struct vop_mkdir_args *ap) * must care about lookup caching hit rate, so... */ if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && - (cnp->cn_flags & MAKEENTRY)) - cache_enter(dvp, newvp, cnp); + (cnp->cn_flags & MAKEENTRY) && + attrflag != 0 && dattrflag != 0) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + &dnfsva.na_ctime); *ap->a_vpp = newvp; } return (error); Modified: stable/8/sys/fs/nfsclient/nfsnode.h ============================================================================== --- stable/8/sys/fs/nfsclient/nfsnode.h Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/fs/nfsclient/nfsnode.h Wed Mar 21 20:50:47 2012 (r233286) @@ -107,7 +107,7 @@ struct nfsnode { struct timespec n_mtime; /* Prev modify time. */ time_t n_unused0; time_t n_unused1; - int n_dmtime_ticks; /* Tick of -ve cache entry */ + int n_unused3; time_t n_unused2; struct nfsfh *n_fhp; /* NFS File Handle */ struct vnode *n_vnode; /* associated vnode */ @@ -134,8 +134,8 @@ struct nfsnode { struct nfs_attrcache_timestamp n_unused; u_int64_t n_change; /* old Change attribute */ struct nfsv4node *n_v4; /* extra V4 stuff */ - struct timespec n_ctime; /* Prev create time. */ - struct timespec n_dmtime; /* Prev dir modify time. */ + struct timespec n_unused4; + struct timespec n_unused5; }; #define n_atim n_un1.nf_atim Modified: stable/8/sys/kern/vfs_cache.c ============================================================================== --- stable/8/sys/kern/vfs_cache.c Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/kern/vfs_cache.c Wed Mar 21 20:50:47 2012 (r233286) @@ -102,6 +102,36 @@ struct namecache { }; /* + * struct namecache_ts repeats struct namecache layout up to the + * nc_nlen member. + * struct namecache_ts is used in place of struct namecache when time(s) need + * to be stored. The nc_dotdottime field is used when a cache entry is mapping + * both a non-dotdot directory name plus dotdot for the directory's + * parent. + */ +struct namecache_ts { + LIST_ENTRY(namecache) nc_hash; /* hash chain */ + LIST_ENTRY(namecache) nc_src; /* source vnode list */ + TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ + struct vnode *nc_dvp; /* vnode of parent of name */ + struct vnode *nc_vp; /* vnode the name refers to */ + u_char nc_flag; /* flag bits */ + u_char nc_nlen; /* length of name */ + struct timespec nc_time; /* timespec provided by fs */ + struct timespec nc_dotdottime; /* dotdot timespec provided by fs */ + int nc_ticks; /* ticks value when entry was added */ + char nc_name[0]; /* segment name + nul */ +}; + +/* + * Flags in namecache.nc_flag + */ +#define NCF_WHITE 0x01 +#define NCF_ISDOTDOT 0x02 +#define NCF_TS 0x04 +#define NCF_DTS 0x08 + +/* * Name caching works as follows: * * Names found by directory scans are retained in a cache @@ -165,20 +195,71 @@ RW_SYSINIT(vfscache, &cache_lock, "Name * fit in the small cache. */ static uma_zone_t cache_zone_small; +static uma_zone_t cache_zone_small_ts; static uma_zone_t cache_zone_large; +static uma_zone_t cache_zone_large_ts; #define CACHE_PATH_CUTOFF 35 -#define CACHE_ZONE_SMALL (sizeof(struct namecache) + CACHE_PATH_CUTOFF \ - + 1) -#define CACHE_ZONE_LARGE (sizeof(struct namecache) + NAME_MAX + 1) - -#define cache_alloc(len) uma_zalloc(((len) <= CACHE_PATH_CUTOFF) ? \ - cache_zone_small : cache_zone_large, M_WAITOK) -#define cache_free(ncp) do { \ - if (ncp != NULL) \ - uma_zfree(((ncp)->nc_nlen <= CACHE_PATH_CUTOFF) ? \ - cache_zone_small : cache_zone_large, (ncp)); \ -} while (0) + +static struct namecache * +cache_alloc(int len, int ts) +{ + + if (len > CACHE_PATH_CUTOFF) { + if (ts) + return (uma_zalloc(cache_zone_large_ts, M_WAITOK)); + else + return (uma_zalloc(cache_zone_large, M_WAITOK)); + } + if (ts) + return (uma_zalloc(cache_zone_small_ts, M_WAITOK)); + else + return (uma_zalloc(cache_zone_small, M_WAITOK)); +} + +static void +cache_free(struct namecache *ncp) +{ + int ts; + + if (ncp == NULL) + return; + ts = ncp->nc_flag & NCF_TS; + if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) { + if (ts) + uma_zfree(cache_zone_small_ts, ncp); + else + uma_zfree(cache_zone_small, ncp); + } else if (ts) + uma_zfree(cache_zone_large_ts, ncp); + else + uma_zfree(cache_zone_large, ncp); +} + +static char * +nc_get_name(struct namecache *ncp) +{ + struct namecache_ts *ncp_ts; + + if ((ncp->nc_flag & NCF_TS) == 0) + return (ncp->nc_name); + ncp_ts = (struct namecache_ts *)ncp; + return (ncp_ts->nc_name); +} + +static void +cache_out_ts(struct namecache *ncp, struct timespec *tsp, int *ticksp) +{ + + KASSERT((ncp->nc_flag & NCF_TS) != 0 || + (tsp == NULL && ticksp == NULL), + ("No NCF_TS")); + + if (tsp != NULL) + *tsp = ((struct namecache_ts *)ncp)->nc_time; + if (ticksp != NULL) + *ticksp = ((struct namecache_ts *)ncp)->nc_ticks; +} static int doingcache = 1; /* 1 => enable the cache */ SYSCTL_INT(_debug, OID_AUTO, vfscache, CTLFLAG_RW, &doingcache, 0, @@ -234,12 +315,6 @@ static int vn_fullpath1(struct thread *t static MALLOC_DEFINE(M_VFSCACHE, "vfscache", "VFS name cache entries"); -/* - * Flags in namecache.nc_flag - */ -#define NCF_WHITE 0x01 -#define NCF_ISDOTDOT 0x02 - #ifdef DIAGNOSTIC /* * Grab an atomic snapshot of the name cache hash chain lengths @@ -344,10 +419,10 @@ cache_zap(ncp) #ifdef KDTRACE_HOOKS if (ncp->nc_vp != NULL) { SDT_PROBE(vfs, namecache, zap, done, ncp->nc_dvp, - ncp->nc_name, ncp->nc_vp, 0, 0); + nc_get_name(ncp), ncp->nc_vp, 0, 0); } else { SDT_PROBE(vfs, namecache, zap_negative, done, ncp->nc_dvp, - ncp->nc_name, 0, 0, 0); + nc_get_name(ncp), 0, 0, 0); } #endif vp = NULL; @@ -394,10 +469,12 @@ cache_zap(ncp) */ int -cache_lookup(dvp, vpp, cnp) +cache_lookup_times(dvp, vpp, cnp, tsp, ticksp) struct vnode *dvp; struct vnode **vpp; struct componentname *cnp; + struct timespec *tsp; + int *ticksp; { struct namecache *ncp; u_int32_t hash; @@ -422,6 +499,10 @@ retry_wlocked: dothits++; SDT_PROBE(vfs, namecache, lookup, hit, dvp, ".", *vpp, 0, 0); + if (tsp != NULL) + timespecclear(tsp); + if (ticksp != NULL) + *ticksp = ticks; goto success; } if (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.') { @@ -440,19 +521,23 @@ retry_wlocked: CACHE_WUNLOCK(); return (0); } - if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT) - *vpp = dvp->v_cache_dd->nc_vp; + ncp = dvp->v_cache_dd; + if (ncp->nc_flag & NCF_ISDOTDOT) + *vpp = ncp->nc_vp; else - *vpp = dvp->v_cache_dd->nc_dvp; + *vpp = ncp->nc_dvp; /* Return failure if negative entry was found. */ - if (*vpp == NULL) { - ncp = dvp->v_cache_dd; + if (*vpp == NULL) goto negative_success; - } CTR3(KTR_VFS, "cache_lookup(%p, %s) found %p via ..", dvp, cnp->cn_nameptr, *vpp); SDT_PROBE(vfs, namecache, lookup, hit, dvp, "..", *vpp, 0, 0); + cache_out_ts(ncp, tsp, ticksp); + if ((ncp->nc_flag & (NCF_ISDOTDOT | NCF_DTS)) == + NCF_DTS && tsp != NULL) + *tsp = ((struct namecache_ts *)ncp)-> + nc_dotdottime; goto success; } } @@ -462,7 +547,7 @@ retry_wlocked: LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { numchecks++; if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen && - !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen)) + !bcmp(nc_get_name(ncp), cnp->cn_nameptr, ncp->nc_nlen)) break; } @@ -497,8 +582,9 @@ retry_wlocked: *vpp = ncp->nc_vp; CTR4(KTR_VFS, "cache_lookup(%p, %s) found %p via ncp %p", dvp, cnp->cn_nameptr, *vpp, ncp); - SDT_PROBE(vfs, namecache, lookup, hit, dvp, ncp->nc_name, + SDT_PROBE(vfs, namecache, lookup, hit, dvp, nc_get_name(ncp), *vpp, 0, 0); + cache_out_ts(ncp, tsp, ticksp); goto success; } @@ -528,8 +614,9 @@ negative_success: nchstats.ncs_neghits++; if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; - SDT_PROBE(vfs, namecache, lookup, hit_negative, dvp, ncp->nc_name, + SDT_PROBE(vfs, namecache, lookup, hit_negative, dvp, nc_get_name(ncp), 0, 0, 0); + cache_out_ts(ncp, tsp, ticksp); CACHE_WUNLOCK(); return (ENOENT); @@ -616,12 +703,15 @@ unlock: * Add an entry to the cache. */ void -cache_enter(dvp, vp, cnp) +cache_enter_time(dvp, vp, cnp, tsp, dtsp) struct vnode *dvp; struct vnode *vp; struct componentname *cnp; + struct timespec *tsp; + struct timespec *dtsp; { struct namecache *ncp, *n2; + struct namecache_ts *n3; struct nchashhead *ncpp; u_int32_t hash; int flag; @@ -688,13 +778,23 @@ cache_enter(dvp, vp, cnp) * Calculate the hash key and setup as much of the new * namecache entry as possible before acquiring the lock. */ - ncp = cache_alloc(cnp->cn_namelen); + ncp = cache_alloc(cnp->cn_namelen, tsp != NULL); ncp->nc_vp = vp; ncp->nc_dvp = dvp; ncp->nc_flag = flag; + if (tsp != NULL) { + n3 = (struct namecache_ts *)ncp; + n3->nc_time = *tsp; + n3->nc_ticks = ticks; + n3->nc_flag |= NCF_TS; + if (dtsp != NULL) { + n3->nc_dotdottime = *dtsp; + n3->nc_flag |= NCF_DTS; + } + } len = ncp->nc_nlen = cnp->cn_namelen; hash = fnv_32_buf(cnp->cn_nameptr, len, FNV1_32_INIT); - strlcpy(ncp->nc_name, cnp->cn_nameptr, len + 1); + strlcpy(nc_get_name(ncp), cnp->cn_nameptr, len + 1); hash = fnv_32_buf(&dvp, sizeof(dvp), hash); CACHE_WLOCK(); @@ -707,7 +807,22 @@ cache_enter(dvp, vp, cnp) LIST_FOREACH(n2, ncpp, nc_hash) { if (n2->nc_dvp == dvp && n2->nc_nlen == cnp->cn_namelen && - !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) { + !bcmp(nc_get_name(n2), cnp->cn_nameptr, n2->nc_nlen)) { + if (tsp != NULL) { + KASSERT((n2->nc_flag & NCF_TS) != 0, + ("no NCF_TS")); + n3 = (struct namecache_ts *)n2; + n3->nc_time = + ((struct namecache_ts *)ncp)->nc_time; + n3->nc_ticks = + ((struct namecache_ts *)ncp)->nc_ticks; + if (dtsp != NULL) { + n3->nc_dotdottime = + ((struct namecache_ts *)ncp)-> + nc_dotdottime; + n3->nc_flag |= NCF_DTS; + } + } CACHE_WUNLOCK(); cache_free(ncp); return; @@ -736,6 +851,11 @@ cache_enter(dvp, vp, cnp) ncp->nc_flag |= NCF_WHITE; } else if (vp->v_type == VDIR) { if (flag != NCF_ISDOTDOT) { + /* + * For this case, the cache entry maps both the + * directory name in it and the name ".." for the + * directory's parent. + */ if ((n2 = vp->v_cache_dd) != NULL && (n2->nc_flag & NCF_ISDOTDOT) != 0) cache_zap(n2); @@ -765,12 +885,12 @@ cache_enter(dvp, vp, cnp) */ if (vp) { TAILQ_INSERT_HEAD(&vp->v_cache_dst, ncp, nc_dst); - SDT_PROBE(vfs, namecache, enter, done, dvp, ncp->nc_name, vp, - 0, 0); + SDT_PROBE(vfs, namecache, enter, done, dvp, nc_get_name(ncp), + vp, 0, 0); } else { TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); SDT_PROBE(vfs, namecache, enter_negative, done, dvp, - ncp->nc_name, 0, 0, 0); + nc_get_name(ncp), 0, 0, 0); } if (numneg * ncnegfactor > numcache) { ncp = TAILQ_FIRST(&ncneg); @@ -792,10 +912,18 @@ nchinit(void *dummy __unused) TAILQ_INIT(&ncneg); - cache_zone_small = uma_zcreate("S VFS Cache", CACHE_ZONE_SMALL, NULL, - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); - cache_zone_large = uma_zcreate("L VFS Cache", CACHE_ZONE_LARGE, NULL, - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_small = uma_zcreate("S VFS Cache", + sizeof(struct namecache) + CACHE_PATH_CUTOFF + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_small_ts = uma_zcreate("STS VFS Cache", + sizeof(struct namecache_ts) + CACHE_PATH_CUTOFF + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_large = uma_zcreate("L VFS Cache", + sizeof(struct namecache) + NAME_MAX + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_large_ts = uma_zcreate("LTS VFS Cache", + sizeof(struct namecache_ts) + NAME_MAX + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); nchashtbl = hashinit(desiredvnodes * 2, M_VFSCACHE, &nchash); } @@ -1104,9 +1232,9 @@ vn_vptocnp_locked(struct vnode **vp, str return (error); } *buflen -= ncp->nc_nlen; - memcpy(buf + *buflen, ncp->nc_name, ncp->nc_nlen); + memcpy(buf + *buflen, nc_get_name(ncp), ncp->nc_nlen); SDT_PROBE(vfs, namecache, fullpath, hit, ncp->nc_dvp, - ncp->nc_name, vp, 0, 0); + nc_get_name(ncp), vp, 0, 0); *vp = ncp->nc_dvp; return (0); } @@ -1243,8 +1371,31 @@ vn_commname(struct vnode *vp, char *buf, return (ENOENT); } l = min(ncp->nc_nlen, buflen - 1); - memcpy(buf, ncp->nc_name, l); + memcpy(buf, nc_get_name(ncp), l); CACHE_RUNLOCK(); buf[l] = '\0'; return (0); } + +/* ABI compat shims for old kernel modules. */ +#undef cache_enter +#undef cache_lookup + +void cache_enter(struct vnode *dvp, struct vnode *vp, + struct componentname *cnp); +int cache_lookup(struct vnode *dvp, struct vnode **vpp, + struct componentname *cnp); + +void +cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) +{ + + cache_enter_time(dvp, vp, cnp, NULL, NULL); +} + +int +cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) +{ + + return (cache_lookup_times(dvp, vpp, cnp, NULL, NULL)); +} Modified: stable/8/sys/nfsclient/nfs_subs.c ============================================================================== --- stable/8/sys/nfsclient/nfs_subs.c Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/nfsclient/nfs_subs.c Wed Mar 21 20:50:47 2012 (r233286) @@ -978,8 +978,8 @@ nfsm_loadattr_xx(struct vnode **v, struc } int -nfsm_postop_attr_xx(struct vnode **v, int *f, struct mbuf **md, - caddr_t *dpos) +nfsm_postop_attr_xx(struct vnode **v, int *f, struct vattr *va, + struct mbuf **md, caddr_t *dpos) { u_int32_t *tl; int t1; @@ -990,7 +990,7 @@ nfsm_postop_attr_xx(struct vnode **v, in return EBADRPC; *f = fxdr_unsigned(int, *tl); if (*f != 0) { - t1 = nfs_loadattrcache(&ttvp, md, dpos, NULL, 1); + t1 = nfs_loadattrcache(&ttvp, md, dpos, va, 1); if (t1 != 0) { *f = 0; return t1; @@ -1020,7 +1020,7 @@ nfsm_wcc_data_xx(struct vnode **v, int * VTONFS(*v)->n_mtime.tv_nsec == fxdr_unsigned(u_int32_t, *(tl + 3))); mtx_unlock(&(VTONFS(*v))->n_mtx); } - t1 = nfsm_postop_attr_xx(v, &ttattrf, md, dpos); + t1 = nfsm_postop_attr_xx(v, &ttattrf, NULL, md, dpos); if (t1) return t1; if (*f) Modified: stable/8/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vnops.c Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/nfsclient/nfs_vnops.c Wed Mar 21 20:50:47 2012 (r233286) @@ -913,8 +913,8 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode *dvp = ap->a_dvp; struct vnode **vpp = ap->a_vpp; struct mount *mp = dvp->v_mount; - struct vattr vattr; - struct timespec dmtime; + struct vattr dvattr, vattr; + struct timespec nctime; int flags = cnp->cn_flags; struct vnode *newvp; struct nfsmount *nmp; @@ -923,7 +923,7 @@ nfs_lookup(struct vop_lookup_args *ap) long len; nfsfh_t *fhp; struct nfsnode *np, *newnp; - int error = 0, attrflag, fhsize, ltype; + int error = 0, attrflag, dattrflag, fhsize, ltype, ncticks; int v3 = NFS_ISV3(dvp); struct thread *td = cnp->cn_thread; @@ -939,11 +939,24 @@ nfs_lookup(struct vop_lookup_args *ap) *vpp = NULLVP; return (error); } - error = cache_lookup(dvp, vpp, cnp); + error = cache_lookup_times(dvp, vpp, cnp, &nctime, &ncticks); if (error > 0 && error != ENOENT) return (error); if (error == -1) { /* + * Lookups of "." are special and always return the + * current directory. cache_lookup() already handles + * associated locking bookkeeping, etc. + */ + if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') { + /* XXX: Is this really correct? */ + if (cnp->cn_nameiop != LOOKUP && + (flags & ISLASTCN)) + cnp->cn_flags |= SAVENAME; + return (0); + } + + /* * We only accept a positive hit in the cache if the * change time of the file matches our cached copy. * Otherwise, we discard the cache entry and fallback @@ -969,7 +982,7 @@ nfs_lookup(struct vop_lookup_args *ap) mtx_unlock(&newnp->n_mtx); } if (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && - timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==)) { + timespeccmp(&vattr.va_ctime, &nctime, ==)) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -988,36 +1001,22 @@ nfs_lookup(struct vop_lookup_args *ap) /* * We only accept a negative hit in the cache if the * modification time of the parent directory matches - * our cached copy. Otherwise, we discard all of the - * negative cache entries for this directory. We also - * only trust -ve cache entries for less than - * nm_negative_namecache_timeout seconds. + * the cached copy in the name cache entry. + * Otherwise, we discard all of the negative cache + * entries for this directory. We also only trust + * negative cache entries for up to nm_negnametimeo + * seconds. */ - if ((u_int)(ticks - np->n_dmtime_ticks) < - (nmp->nm_negnametimeo * hz) && + if ((u_int)(ticks - ncticks) < (nmp->nm_negnametimeo * hz) && VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && - timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) { + timespeccmp(&vattr.va_mtime, &nctime, ==)) { nfsstats.lookupcache_hits++; return (ENOENT); } cache_purge_negative(dvp); - mtx_lock(&np->n_mtx); - timespecclear(&np->n_dmtime); - mtx_unlock(&np->n_mtx); } - /* - * Cache the modification time of the parent directory in case - * the lookup fails and results in adding the first negative - * name cache entry for the directory. Since this is reading - * a single time_t, don't bother with locking. The - * modification time may be a bit stale, but it must be read - * before performing the lookup RPC to prevent a race where - * another lookup updates the timestamp on the directory after - * the lookup RPC has been performed on the server but before - * n_dmtime is set at the end of this function. - */ - dmtime = np->n_vattr.va_mtime; + attrflag = dattrflag = 0; error = 0; newvp = NULLVP; nfsstats.lookupcache_misses++; @@ -1032,7 +1031,7 @@ nfs_lookup(struct vop_lookup_args *ap) nfsm_request(dvp, NFSPROC_LOOKUP, cnp->cn_thread, cnp->cn_cred); if (error) { if (v3) { - nfsm_postop_attr(dvp, attrflag); + nfsm_postop_attr_va(dvp, dattrflag, &vattr); m_freem(mrep); } goto nfsmout; @@ -1128,17 +1127,19 @@ nfs_lookup(struct vop_lookup_args *ap) } } if (v3) { - nfsm_postop_attr(newvp, attrflag); - nfsm_postop_attr(dvp, attrflag); - } else - nfsm_loadattr(newvp, NULL); + nfsm_postop_attr_va(newvp, attrflag, &vattr); + nfsm_postop_attr_va(dvp, dattrflag, &dvattr); + } else { + nfsm_loadattr(newvp, &vattr); + attrflag = 1; + } if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && - (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.va_ctime; - cache_enter(dvp, newvp, cnp); - } + (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && + attrflag != 0 && (newvp->v_type != VDIR || dattrflag != 0)) + cache_enter_time(dvp, newvp, cnp, &vattr.va_ctime, + newvp->v_type != VDIR ? NULL : &dvattr.va_ctime); *vpp = newvp; m_freem(mrep); nfsmout: @@ -1165,30 +1166,22 @@ nfsmout: return (EJUSTRETURN); } - if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE) { + if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE && + dattrflag) { /* - * Maintain n_dmtime as the modification time - * of the parent directory when the oldest -ve - * name cache entry for this directory was - * added. If a -ve cache entry has already - * been added with a newer modification time - * by a concurrent lookup, then don't bother - * adding a cache entry. The modification - * time of the directory might have changed - * due to the file this lookup failed to find - * being created. In that case a subsequent - * lookup would incorrectly use the entry - * added here instead of doing an extra - * lookup. + * Cache the modification time of the parent + * directory from the post-op attributes in + * the name cache entry. The negative cache + * entry will be ignored once the directory + * has changed. Don't bother adding the entry + * if the directory has already changed. */ mtx_lock(&np->n_mtx); - if (timespeccmp(&np->n_dmtime, &dmtime, <=)) { - if (!timespecisset(&np->n_dmtime)) { - np->n_dmtime = dmtime; - np->n_dmtime_ticks = ticks; - } + if (timespeccmp(&np->n_vattr.va_mtime, + &vattr.va_mtime, ==)) { mtx_unlock(&np->n_mtx); - cache_enter(dvp, NULL, cnp); + cache_enter_time(dvp, NULL, cnp, + &vattr.va_mtime, NULL); } else mtx_unlock(&np->n_mtx); } @@ -1539,8 +1532,6 @@ nfsmout: if (newvp) vput(newvp); } else { - if (cnp->cn_flags & MAKEENTRY) - cache_enter(dvp, newvp, cnp); *vpp = newvp; } mtx_lock(&(VTONFS(dvp))->n_mtx); @@ -1679,8 +1670,6 @@ nfsmout: vput(newvp); } if (!error) { - if (cnp->cn_flags & MAKEENTRY) - cache_enter(dvp, newvp, cnp); *ap->a_vpp = newvp; } mtx_lock(&(VTONFS(dvp))->n_mtx); @@ -2474,10 +2463,11 @@ nfs_readdirplusrpc(struct vnode *vp, str nfsuint64 cookie; struct nfsmount *nmp = VFSTONFS(vp->v_mount); struct nfsnode *dnp = VTONFS(vp), *np; + struct vattr vattr, dvattr; nfsfh_t *fhp; u_quad_t fileno; int error = 0, tlen, more_dirs = 1, blksiz = 0, doit, bigenough = 1, i; - int attrflag, fhsize; + int attrflag, dattrflag, fhsize; #ifndef nolint dp = NULL; @@ -2523,7 +2513,7 @@ nfs_readdirplusrpc(struct vnode *vp, str *tl++ = txdr_unsigned(nmp->nm_readdirsize); *tl = txdr_unsigned(nmp->nm_rsize); nfsm_request(vp, NFSPROC_READDIRPLUS, uiop->uio_td, cred); - nfsm_postop_attr(vp, attrflag); + nfsm_postop_attr_va(vp, dattrflag, &dvattr); if (error) { m_freem(mrep); goto nfsmout; @@ -2654,18 +2644,16 @@ nfs_readdirplusrpc(struct vnode *vp, str dpos = dpossav1; mdsav2 = md; md = mdsav1; - nfsm_loadattr(newvp, NULL); + nfsm_loadattr(newvp, &vattr); dpos = dpossav2; md = mdsav2; - dp->d_type = - IFTODT(VTTOIF(np->n_vattr.va_type)); + dp->d_type = IFTODT(VTTOIF(vattr.va_type)); ndp->ni_vp = newvp; - /* - * Update n_ctime so subsequent lookup - * doesn't purge entry. - */ - np->n_ctime = np->n_vattr.va_ctime; - cache_enter(ndp->ni_dvp, ndp->ni_vp, cnp); + if (newvp->v_type != VDIR || dattrflag != 0) + cache_enter_time(ndp->ni_dvp, ndp->ni_vp, + cnp, &vattr.va_ctime, + newvp->v_type != VDIR ? NULL : + &dvattr.va_ctime); } } else { /* Just skip over the file handle */ Modified: stable/8/sys/nfsclient/nfsm_subs.h ============================================================================== --- stable/8/sys/nfsclient/nfsm_subs.h Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/nfsclient/nfsm_subs.h Wed Mar 21 20:50:47 2012 (r233286) @@ -152,8 +152,8 @@ int nfsm_getfh_xx(nfsfh_t **f, int *s, i caddr_t *dpos); int nfsm_loadattr_xx(struct vnode **v, struct vattr *va, struct mbuf **md, caddr_t *dpos); -int nfsm_postop_attr_xx(struct vnode **v, int *f, struct mbuf **md, - caddr_t *dpos); +int nfsm_postop_attr_xx(struct vnode **v, int *f, struct vattr *va, + struct mbuf **md, caddr_t *dpos); int nfsm_wcc_data_xx(struct vnode **v, int *f, struct mbuf **md, caddr_t *dpos); @@ -181,7 +181,14 @@ do { \ #define nfsm_postop_attr(v, f) \ do { \ int32_t t1; \ - t1 = nfsm_postop_attr_xx(&v, &f, &md, &dpos); \ + t1 = nfsm_postop_attr_xx(&v, &f, NULL, &md, &dpos); \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Wed Mar 21 23:10:17 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B4E11065673; Wed, 21 Mar 2012 23:10:17 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 856468FC17; Wed, 21 Mar 2012 23:10:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2LNAHtX097391; Wed, 21 Mar 2012 23:10:17 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2LNAHLd097389; Wed, 21 Mar 2012 23:10:17 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201203212310.q2LNAHLd097389@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 21 Mar 2012 23:10:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233289 - stable/9/bin/sh X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 23:10:17 -0000 Author: jilles Date: Wed Mar 21 23:10:16 2012 New Revision: 233289 URL: http://svn.freebsd.org/changeset/base/233289 Log: MFC r229201: sh: Make patmatch() non-recursive. Modified: stable/9/bin/sh/expand.c Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/expand.c ============================================================================== --- stable/9/bin/sh/expand.c Wed Mar 21 20:55:21 2012 (r233288) +++ stable/9/bin/sh/expand.c Wed Mar 21 23:10:16 2012 (r233289) @@ -1440,57 +1440,63 @@ static int patmatch(const char *pattern, const char *string, int squoted) { const char *p, *q, *end; + const char *bt_p, *bt_q; char c; wchar_t wc, wc2; p = pattern; q = string; + bt_p = NULL; + bt_q = NULL; for (;;) { switch (c = *p++) { case '\0': - goto breakloop; + if (*q != '\0') + goto backtrack; + return 1; case CTLESC: if (squoted && *q == CTLESC) q++; if (*q++ != *p++) - return 0; + goto backtrack; break; case CTLQUOTEMARK: continue; case '?': if (squoted && *q == CTLESC) q++; - if (localeisutf8) + if (*q == '\0') + return 0; + if (localeisutf8) { wc = get_wc(&q); - else + /* + * A '?' does not match invalid UTF-8 but a + * '*' does, so backtrack. + */ + if (wc == 0) + goto backtrack; + } else wc = (unsigned char)*q++; - if (wc == '\0') - return 0; break; case '*': c = *p; while (c == CTLQUOTEMARK || c == '*') c = *++p; - if (c != CTLESC && c != CTLQUOTEMARK && - c != '?' && c != '*' && c != '[') { - while (*q != c) { - if (squoted && *q == CTLESC && - q[1] == c) - break; - if (*q == '\0') - return 0; - if (squoted && *q == CTLESC) - q++; - q++; - } - } - do { - if (patmatch(p, q, squoted)) - return 1; - if (squoted && *q == CTLESC) - q++; - } while (*q++ != '\0'); - return 0; + /* + * If the pattern ends here, we know the string + * matches without needing to look at the rest of it. + */ + if (c == '\0') + return 1; + /* + * First try the shortest match for the '*' that + * could work. We can forget any earlier '*' since + * there is no way having it match more characters + * can help us, given that we are already here. + */ + bt_p = p; + bt_q = q; + break; case '[': { const char *endp; int invert, found; @@ -1502,7 +1508,7 @@ patmatch(const char *pattern, const char for (;;) { while (*endp == CTLQUOTEMARK) endp++; - if (*endp == '\0') + if (*endp == 0) goto dft; /* no matching ] */ if (*endp == CTLESC) endp++; @@ -1517,12 +1523,14 @@ patmatch(const char *pattern, const char found = 0; if (squoted && *q == CTLESC) q++; - if (localeisutf8) + if (*q == '\0') + return 0; + if (localeisutf8) { chr = get_wc(&q); - else + if (chr == 0) + goto backtrack; + } else chr = (unsigned char)*q++; - if (chr == '\0') - return 0; c = *p++; do { if (c == CTLQUOTEMARK) @@ -1563,21 +1571,34 @@ patmatch(const char *pattern, const char } } while ((c = *p++) != ']'); if (found == invert) - return 0; + goto backtrack; break; } dft: default: if (squoted && *q == CTLESC) q++; - if (*q++ != c) + if (*q == '\0') + return 0; + if (*q++ == c) + break; +backtrack: + /* + * If we have a mismatch (other than hitting the end + * of the string), go back to the last '*' seen and + * have it match one additional character. + */ + if (bt_p == NULL) + return 0; + if (squoted && *bt_q == CTLESC) + bt_q++; + if (*bt_q == '\0') return 0; + bt_q++; + p = bt_p; + q = bt_q; break; } } -breakloop: - if (*q != '\0') - return 0; - return 1; } From owner-svn-src-stable@FreeBSD.ORG Thu Mar 22 08:38:14 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EABF7106564A; Thu, 22 Mar 2012 08:38:13 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D24398FC15; Thu, 22 Mar 2012 08:38:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2M8cDPG015207; Thu, 22 Mar 2012 08:38:13 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2M8cDN7015205; Thu, 22 Mar 2012 08:38:13 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201203220838.q2M8cDN7015205@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 22 Mar 2012 08:38:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233293 - stable/9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 08:38:14 -0000 Author: pluknet Date: Thu Mar 22 08:38:13 2012 New Revision: 233293 URL: http://svn.freebsd.org/changeset/base/233293 Log: MFC r233010: Remove TARGET_ARCH conditionals for COMPAT_FREEBSD32. Modified: stable/9/ObsoleteFiles.inc (contents, props changed) Modified: stable/9/ObsoleteFiles.inc ============================================================================== --- stable/9/ObsoleteFiles.inc Thu Mar 22 07:34:15 2012 (r233292) +++ stable/9/ObsoleteFiles.inc Thu Mar 22 08:38:13 2012 (r233293) @@ -54,7 +54,6 @@ OLD_LIBS+=usr/lib/libdwarf.so.2 OLD_LIBS+=usr/lib/libopie.so.6 OLD_LIBS+=usr/lib/librtld_db.so.1 OLD_LIBS+=usr/lib/libtacplus.so.4 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libcam.so.5 OLD_LIBS+=usr/lib32/libpcap.so.7 OLD_LIBS+=usr/lib32/libufs.so.5 @@ -63,7 +62,6 @@ OLD_LIBS+=usr/lib32/libdwarf.so.2 OLD_LIBS+=usr/lib32/libopie.so.6 OLD_LIBS+=usr/lib32/librtld_db.so.1 OLD_LIBS+=usr/lib32/libtacplus.so.4 -.endif # 20110718: no longer useful in the age of rc.d OLD_FILES+=usr/sbin/named.reconfig OLD_FILES+=usr/sbin/named.reload @@ -92,17 +90,13 @@ OLD_FILES+=usr/lib/libpkg.a OLD_FILES+=usr/lib/libpkg.so OLD_LIBS+=usr/lib/libpkg.so.0 OLD_FILES+=usr/lib/libpkg_p.a -.if ${TARGET_ARCH} == "amd64" OLD_FILES+=usr/lib32/libpkg.a OLD_FILES+=usr/lib32/libpkg.so OLD_LIBS+=usr/lib32/libpkg.so.0 OLD_FILES+=usr/lib32/libpkg_p.a -.endif # 20110517: libsbuf version bump OLD_LIBS+=lib/libsbuf.so.5 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libsbuf.so.5 -.endif # 20110502: new clang import which bumps version from 2.9 to 3.0 OLD_FILES+=usr/include/clang/2.9/emmintrin.h OLD_FILES+=usr/include/clang/2.9/mm_malloc.h @@ -131,12 +125,10 @@ OLD_FILES+=usr/lib/libobjc_p.a OLD_FILES+=usr/libexec/cc1obj OLD_LIBS+=usr/lib/libobjc.so.4 OLD_DIRS+=usr/include/objc -.if ${TARGET_ARCH} == "amd64" OLD_FILES+=usr/lib32/libobjc.a OLD_FILES+=usr/lib32/libobjc.so OLD_FILES+=usr/lib32/libobjc_p.a OLD_LIBS+=usr/lib32/libobjc.so.4 -.endif # 20110331: firmware.img created at build time OLD_FILES+=usr/share/examples/kld/firmware/fwimage/firmware.img # 20110224: sticky.8 -> sticky.7 @@ -258,9 +250,7 @@ OLD_FILES+=usr/include/machine/intr.h .endif # 20100514: library version bump for versioned symbols for liblzma OLD_LIBS+=usr/lib/liblzma.so.0 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/liblzma.so.0 -.endif # 20100511: move GCC-specific headers to /usr/include/gcc .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/emmintrin.h @@ -301,9 +291,7 @@ OLD_FILES+=usr/share/info/cpio.info.gz OLD_FILES+=usr/share/man/man1/gcpio.1.gz # 20100322: libz update OLD_LIBS+=lib/libz.so.5 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libz.so.5 -.endif # 20100314: removal of regexp.h OLD_FILES+=usr/include/regexp.h OLD_FILES+=usr/share/man/man3/regexp.3.gz @@ -352,9 +340,7 @@ OLD_FILES+=usr/share/man/man5/lastlog.5. OLD_FILES+=usr/share/man/man5/utmp.5.gz OLD_FILES+=usr/share/man/man5/wtmp.5.gz OLD_LIBS+=lib/libutil.so.8 -.if ${TARGET_ARCH} == "amd64" OLB_LIBS+=usr/lib32/libutil.so.8 -.endif # 20100105: new userland semaphore implementation OLD_FILES+=usr/include/sys/semaphore.h # 20100103: ntptrace(8) removed @@ -562,7 +548,6 @@ OLD_LIBS+=usr/lib/snmp_hostres.so.5 OLD_LIBS+=usr/lib/snmp_mibII.so.5 OLD_LIBS+=usr/lib/snmp_netgraph.so.5 OLD_LIBS+=usr/lib/snmp_pf.so.5 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libalias.so.6 OLD_LIBS+=usr/lib32/libarchive.so.4 OLD_LIBS+=usr/lib32/libauditd.so.4 @@ -663,7 +648,6 @@ OLD_LIBS+=usr/lib32/pam_self.so.4 OLD_LIBS+=usr/lib32/pam_ssh.so.4 OLD_LIBS+=usr/lib32/pam_tacplus.so.4 OLD_LIBS+=usr/lib32/pam_unix.so.4 -.endif # 20090718: the gdm pam.d file is no longer required. OLD_FILES+=etc/pam.d/gdm # 20090713: vimage container structs removed. @@ -848,9 +832,7 @@ OLD_FILES+=usr/share/man/man8/sliplogin. OLD_FILES+=usr/share/man/man8/slstat.8.gz # 20090321: libpcap upgraded to 1.0.0 OLD_LIBS+=lib/libpcap.so.5 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libpcap.so.5 -.endif # 20090319: uscanner(4) has been removed OLD_FILES+=usr/share/man/man4/uscanner.4.gz # 20090313: k8temp(4) renamed to amdtemp(4) @@ -862,17 +844,13 @@ OLD_FILES+=usr/lib/libusb20.so OLD_FILES+=usr/lib/libusb20_p.a OLD_FILES+=usr/include/libusb20_compat01.h OLD_FILES+=usr/include/libusb20_compat10.h -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libusb20.so.1 OLD_FILES+=usr/lib32/libusb20.a OLD_FILES+=usr/lib32/libusb20.so OLD_FILES+=usr/lib32/libusb20_p.a -.endif # 20090226: libmp(3) functions renamed OLD_LIBS+=usr/lib/libmp.so.6 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libmp.so.6 -.endif # 20090223: changeover of USB stacks OLD_FILES+=usr/include/dev/usb2/include/ufm2_ioctl.h OLD_FILES+=usr/include/dev/usb2/include/urio2_ioctl.h @@ -1175,9 +1153,7 @@ OLD_LIBS+=usr/lib/libkadm5srv.so.9 OLD_LIBS+=usr/lib/libkafs5.so.9 OLD_LIBS+=usr/lib/libkrb5.so.9 OLD_LIBS+=usr/lib/libroken.so.9 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libgssapi.so.9 -.endif # 20080420: Symbol card support dropped OLD_FILES+=usr/include/dev/wi/spectrum24t_cf.h # 20080420: awi removal @@ -1204,10 +1180,8 @@ OLD_FILES+=usr/share/man/man2/kse_releas OLD_FILES+=usr/share/man/man2/kse_switchin.2.gz OLD_FILES+=usr/share/man/man2/kse_thr_interrupt.2.gz OLD_FILES+=usr/share/man/man2/kse_wakeup.2.gz -.if ${TARGET_ARCH} == "amd64" OLD_FILES+=usr/lib32/libkse.so OLD_LIBS+=usr/lib32/libkse.so.3 -.endif # 20080220: geom_lvm rename to geom_linux_lvm OLD_FILES+=usr/share/man/man4/geom_lvm.4.gz # 20080126: oldcard.4 removal @@ -1227,11 +1201,9 @@ OLD_FILES+=usr/include/sys/xrpuio.h OLD_FILES+=usr/lib/libkse.a OLD_FILES+=usr/lib/libkse_p.a OLD_FILES+=usr/lib/libkse_pic.a -.if ${TARGET_ARCH} == "amd64" OLD_FILES+=usr/lib32/libkse.a OLD_FILES+=usr/lib32/libkse_p.a OLD_FILES+=usr/lib32/libkse_pic.a -.endif # 20071129: Removed a Solaris compatibility header OLD_FILES+=usr/include/sys/_elf_solaris.h # 20071125: Renamed to pmc_get_msr() @@ -1331,12 +1303,10 @@ OLD_DIRS+=usr/include/netatm/ipatm OLD_DIRS+=usr/include/netatm/uni OLD_DIRS+=usr/include/netatm OLD_DIRS+=usr/share/examples/atm -.if ${TARGET_ARCH} == "amd64" OLD_FILES+=usr/lib32/libatm.a OLD_FILES+=usr/lib32/libatm.so OLD_LIBS+=usr/lib32/libatm.so.5 OLD_FILES+=usr/lib32/libatm_p.a -.endif # 20070705: I4B headers repo-copied to include/i4b/ .if ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/machine/i4b_cause.h @@ -1421,7 +1391,6 @@ OLD_LIBS+=usr/lib/snmp_hostres.so.4 OLD_LIBS+=usr/lib/snmp_mibII.so.4 OLD_LIBS+=usr/lib/snmp_netgraph.so.4 OLD_LIBS+=usr/lib/snmp_pf.so.4 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libalias.so.5 OLD_LIBS+=usr/lib32/libbsnmp.so.3 OLD_LIBS+=usr/lib32/libdialog.so.5 @@ -1456,7 +1425,6 @@ OLD_LIBS+=usr/lib32/pam_self.so.3 OLD_LIBS+=usr/lib32/pam_ssh.so.3 OLD_LIBS+=usr/lib32/pam_tacplus.so.3 OLD_LIBS+=usr/lib32/pam_unix.so.3 -.endif # 20070613: IPX over IP tunnel removal OLD_FILES+=usr/include/netipx/ipx_ip.h # 20070605: sched_core removal @@ -1526,7 +1494,6 @@ OLD_LIBS+=usr/lib/libwrap.so.4 OLD_LIBS+=usr/lib/libypclnt.so.2 OLD_LIBS+=usr/lib/snmp_bridge.so.3 OLD_LIBS+=usr/lib/snmp_hostres.so.3 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libatm.so.4 OLD_LIBS+=usr/lib32/libbegemot.so.2 OLD_LIBS+=usr/lib32/libbluetooth.so.2 @@ -1585,7 +1552,6 @@ OLD_LIBS+=usr/lib32/libvgl.so.4 OLD_LIBS+=usr/lib32/libwrap.so.4 OLD_LIBS+=usr/lib32/libypclnt.so.2 OLD_LIBS+=usr/lib32/libz.so.3 -.endif # 20070519: GCC 4.2 OLD_FILES+=usr/bin/f77 OLD_FILES+=usr/bin/protoize @@ -1832,9 +1798,7 @@ OLD_FILES+=usr/bin/uuidgen OLD_FILES+=usr/share/info/bzip2.info.gz # 20070303: libarchive 2.0 OLD_LIBS+=usr/lib/libarchive.so.3 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libarchive.so.3 -.endif # 20070301: remove addr2ascii and ascii2addr OLD_FILES+=usr/share/man/man3/addr2ascii.3.gz OLD_FILES+=usr/share/man/man3/ascii2addr.3.gz @@ -1851,14 +1815,12 @@ OLD_FILES+=usr/lib/libmytinfo_p.a OLD_FILES+=usr/lib/libmytinfow.a OLD_FILES+=usr/lib/libmytinfow.so OLD_FILES+=usr/lib/libmytinfow_p.a -.if ${TARGET_ARCH} == "amd64" OLD_FILES+=usr/lib32/libmytinfo.a OLD_FILES+=usr/lib32/libmytinfo.so OLD_FILES+=usr/lib32/libmytinfo_p.a OLD_FILES+=usr/lib32/libmytinfow.a OLD_FILES+=usr/lib32/libmytinfow.so OLD_FILES+=usr/lib32/libmytinfow_p.a -.endif # 20070128: remove vnconfig OLD_FILES+=usr/sbin/vnconfig # 20070127: remove bpf_compat.h @@ -5202,40 +5164,32 @@ OLD_LIBS+=usr/lib/libkadm5srv.so.8 OLD_LIBS+=usr/lib/libkafs5.so.8 OLD_LIBS+=usr/lib/libkrb5.so.8 OLD_LIBS+=usr/lib/libobjc.so.2 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libgssapi.so.8 OLD_LIBS+=usr/lib32/libobjc.so.2 -.endif # 20070519: GCC 4.2 OLD_LIBS+=usr/lib/libg2c.a OLD_LIBS+=usr/lib/libg2c.so OLD_LIBS+=usr/lib/libg2c.so.2 OLD_LIBS+=usr/lib/libg2c_p.a OLD_LIBS+=usr/lib/libgcc_pic.a -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libg2c.a OLD_LIBS+=usr/lib32/libg2c.so OLD_LIBS+=usr/lib32/libg2c.so.2 OLD_LIBS+=usr/lib32/libg2c_p.a OLD_LIBS+=usr/lib32/libgcc_pic.a -.endif # 20060729: OpenSSL 0.9.7e -> 0.9.8b upgrade OLD_LIBS+=lib/libcrypto.so.4 OLD_LIBS+=usr/lib/libssl.so.4 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libcrypto.so.4 OLD_LIBS+=usr/lib32/libssl.so.4 -.endif # 20060521: gethostbyaddr(3) ABI change OLD_LIBS+=usr/lib/libroken.so.8 OLD_LIBS+=lib/libatm.so.3 OLD_LIBS+=lib/libc.so.6 OLD_LIBS+=lib/libutil.so.5 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libatm.so.3 OLD_LIBS+=usr/lib32/libc.so.6 OLD_LIBS+=usr/lib32/libutil.so.5 -.endif # 20060413: shared library moved to /usr/lib OLD_LIBS+=lib/libgpib.so.1 # 20060413: libpcap.so.4 moved to /lib/ @@ -5249,12 +5203,10 @@ OLD_LIBS+=usr/lib/libc_r.a OLD_LIBS+=usr/lib/libc_r.so OLD_LIBS+=usr/lib/libc_r.so.7 OLD_LIBS+=usr/lib/libc_r_p.a -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libc_r.a OLD_LIBS+=usr/lib32/libc_r.so OLD_LIBS+=usr/lib32/libc_r.so.7 OLD_LIBS+=usr/lib32/libc_r_p.a -.endif # 20050722: bump for 6.0-RELEASE OLD_LIBS+=lib/libalias.so.4 OLD_LIBS+=lib/libatm.so.2 @@ -5466,10 +5418,8 @@ OLD_LIBS+=usr/lib/libc_r.so.3 OLD_LIBS+=usr/lib/libarchive.so.2 OLD_LIBS+=usr/lib/libbsnmp.so.1 OLD_LIBS+=usr/lib/libc_r.so.6 -.if ${TARGET_ARCH} == "amd64" OLD_LIBS+=usr/lib32/libarchive.so.2 OLD_LIBS+=usr/lib32/libc_r.so.6 -.endif OLD_LIBS+=usr/lib/libcipher.so.2 OLD_LIBS+=usr/lib/libgssapi.so.6 OLD_LIBS+=usr/lib/libkse.so.1 From owner-svn-src-stable@FreeBSD.ORG Thu Mar 22 09:47:10 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B15BB1065675; Thu, 22 Mar 2012 09:47:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C12B8FC14; Thu, 22 Mar 2012 09:47:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2M9lAMY017541; Thu, 22 Mar 2012 09:47:10 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2M9lARK017539; Thu, 22 Mar 2012 09:47:10 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201203220947.q2M9lARK017539@svn.freebsd.org> From: Dimitry Andric Date: Thu, 22 Mar 2012 09:47:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233297 - stable/9/contrib/libstdc++/include/bits X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 09:47:10 -0000 Author: dim Date: Thu Mar 22 09:47:10 2012 New Revision: 233297 URL: http://svn.freebsd.org/changeset/base/233297 Log: MFC r233193: Add explicit braces to avoid dangling else in stl_tree.h. This silences the following warning produced by clang trunk: In file included from /usr/src/sbin/devd/devd.cc:91: In file included from /usr/obj/usr/src/tmp/usr/include/c++/4.2/map:64: /usr/obj/usr/src/tmp/usr/include/c++/4.2/bits/stl_tree.h:987:2: error: add explicit braces to avoid dangling else [-Werror,-Wdangling-else] else ^ Modified: stable/9/contrib/libstdc++/include/bits/stl_tree.h Directory Properties: stable/9/contrib/libstdc++/ (props changed) Modified: stable/9/contrib/libstdc++/include/bits/stl_tree.h ============================================================================== --- stable/9/contrib/libstdc++/include/bits/stl_tree.h Thu Mar 22 09:42:27 2012 (r233296) +++ stable/9/contrib/libstdc++/include/bits/stl_tree.h Thu Mar 22 09:47:10 2012 (r233297) @@ -982,10 +982,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } iterator __j = iterator(__y); if (__comp) - if (__j == begin()) - return pair(_M_insert(__x, __y, __v), true); - else - --__j; + { + if (__j == begin()) + return pair(_M_insert(__x, __y, __v), true); + else + --__j; + } if (_M_impl._M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v))) return pair(_M_insert(__x, __y, __v), true); return pair(__j, false); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 22 09:50:16 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7DB0106564A; Thu, 22 Mar 2012 09:50:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1C8C8FC17; Thu, 22 Mar 2012 09:50:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2M9oGiG017717; Thu, 22 Mar 2012 09:50:16 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2M9oGRL017715; Thu, 22 Mar 2012 09:50:16 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201203220950.q2M9oGRL017715@svn.freebsd.org> From: Dimitry Andric Date: Thu, 22 Mar 2012 09:50:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233299 - stable/9/usr.sbin/dconschat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 09:50:17 -0000 Author: dim Date: Thu Mar 22 09:50:16 2012 New Revision: 233299 URL: http://svn.freebsd.org/changeset/base/233299 Log: MFC r233195: Fix the following warning from clang trunk: usr.sbin/dconschat/dconschat.c:163:65: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'off_t' (aka 'long long') [-Werror,-Wformat] snprintf(buf, PAGE_SIZE, "\r\n[dconschat reset target(addr=0x%zx)...]\r\n", dc->reset); ~~^ ~~~~~~~~~ %llx Silence this by casting dc->reset to intmax_t, and using the appropriate length modifier. While here, wrap the line to a 80 character margin. Modified: stable/9/usr.sbin/dconschat/dconschat.c Modified: stable/9/usr.sbin/dconschat/dconschat.c ============================================================================== --- stable/9/usr.sbin/dconschat/dconschat.c Thu Mar 22 09:47:14 2012 (r233298) +++ stable/9/usr.sbin/dconschat/dconschat.c Thu Mar 22 09:50:16 2012 (r233299) @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -160,7 +161,9 @@ dconschat_reset_target(struct dcons_stat if (dc->reset == 0) return; - snprintf(buf, PAGE_SIZE, "\r\n[dconschat reset target(addr=0x%zx)...]\r\n", dc->reset); + snprintf(buf, PAGE_SIZE, + "\r\n[dconschat reset target(addr=0x%jx)...]\r\n", + (intmax_t)dc->reset); write(p->outfd, buf, strlen(buf)); bzero(&buf[0], PAGE_SIZE); dwrite(dc, (void *)buf, PAGE_SIZE, dc->reset); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 22 11:43:55 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BCFCC1065673; Thu, 22 Mar 2012 11:43:54 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A81138FC08; Thu, 22 Mar 2012 11:43:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2MBhsKn022805; Thu, 22 Mar 2012 11:43:54 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2MBhswa022803; Thu, 22 Mar 2012 11:43:54 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201203221143.q2MBhswa022803@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 22 Mar 2012 11:43:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233303 - stable/8/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 11:43:57 -0000 Author: pluknet Date: Thu Mar 22 11:43:54 2012 New Revision: 233303 URL: http://svn.freebsd.org/changeset/base/233303 Log: MFC r210525: Missing IFCAP_* macro descriptions in ifnet(9). PR: docs/148952 Submitted by: Lars Hartmann Modified: stable/8/share/man/man9/ifnet.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/ifnet.9 ============================================================================== --- stable/8/share/man/man9/ifnet.9 Thu Mar 22 11:18:14 2012 (r233302) +++ stable/8/share/man/man9/ifnet.9 Thu Mar 22 11:43:54 2012 (r233303) @@ -600,6 +600,31 @@ longer than permitted by the Ethernet sp .It Dv IFCAP_JUMBO_MTU This Ethernet interface can transmit and receive frames up to 9000 bytes long. +.It Dv IFCAP_TSO4 +This Ethernet interface supports TCP Segmentation offloading. +.It Dv IFCAP_TSO6 +This Ethernet interface supports TCP6 Segmentation offloading. +.It Dv IFCAP_TSO +A shorthand for +.Pq Dv IFCAP_TSO4 | IFCAP_TSO6 . +.It Dv IFCAP_TOE4 +This Ethernet interface supports TCP offloading. +.It Dv IFCAP_TOE6 +This Ethernet interface supports TCP6 offloading. +.It Dv ICAP_TOE +A Shorthand for +.Pq Dv IFCAP_TOE4 | IFCAP_TOE6 . +.It Dv IFCAP_WOL_UCAST +This Ethernet interface supports waking up on any Unicast packet. +.It Dv IFCAP_WOL_MCAST +This Ethernet interface supports waking up on any Multicast packet. +.It Dv IFCAP_WOL_MAGIC +This Ethernet interface supports waking up on any Magic packet such +as those sent by +.Xr wake 8 . +.It Dv IFCAP_WOL +A shorthand for +.Pq Dv IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC . .El .Pp The ability of advanced network interfaces to offload certain From owner-svn-src-stable@FreeBSD.ORG Thu Mar 22 11:47:07 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E5EB1065673; Thu, 22 Mar 2012 11:47:07 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 583998FC15; Thu, 22 Mar 2012 11:47:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2MBl7Wd022970; Thu, 22 Mar 2012 11:47:07 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2MBl7Ne022968; Thu, 22 Mar 2012 11:47:07 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201203221147.q2MBl7Ne022968@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 22 Mar 2012 11:47:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233304 - stable/7/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 11:47:07 -0000 Author: pluknet Date: Thu Mar 22 11:47:06 2012 New Revision: 233304 URL: http://svn.freebsd.org/changeset/base/233304 Log: MFC r210525: Missing IFCAP_* macro descriptions in ifnet(9). PR: docs/148952 Submitted by: Lars Hartmann Modified: stable/7/share/man/man9/ifnet.9 Directory Properties: stable/7/share/man/man9/ (props changed) Modified: stable/7/share/man/man9/ifnet.9 ============================================================================== --- stable/7/share/man/man9/ifnet.9 Thu Mar 22 11:43:54 2012 (r233303) +++ stable/7/share/man/man9/ifnet.9 Thu Mar 22 11:47:06 2012 (r233304) @@ -572,6 +572,31 @@ longer than permitted by the Ethernet sp .It Dv IFCAP_JUMBO_MTU This Ethernet interface can transmit and receive frames up to 9000 bytes long. +.It Dv IFCAP_TSO4 +This Ethernet interface supports TCP Segmentation offloading. +.It Dv IFCAP_TSO6 +This Ethernet interface supports TCP6 Segmentation offloading. +.It Dv IFCAP_TSO +A shorthand for +.Pq Dv IFCAP_TSO4 | IFCAP_TSO6 . +.It Dv IFCAP_TOE4 +This Ethernet interface supports TCP offloading. +.It Dv IFCAP_TOE6 +This Ethernet interface supports TCP6 offloading. +.It Dv ICAP_TOE +A Shorthand for +.Pq Dv IFCAP_TOE4 | IFCAP_TOE6 . +.It Dv IFCAP_WOL_UCAST +This Ethernet interface supports waking up on any Unicast packet. +.It Dv IFCAP_WOL_MCAST +This Ethernet interface supports waking up on any Multicast packet. +.It Dv IFCAP_WOL_MAGIC +This Ethernet interface supports waking up on any Magic packet such +as those sent by +.Xr wake 8 . +.It Dv IFCAP_WOL +A shorthand for +.Pq Dv IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC . .El .Pp The ability of advanced network interfaces to offload certain From owner-svn-src-stable@FreeBSD.ORG Thu Mar 22 17:02:06 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A22F11065673; Thu, 22 Mar 2012 17:02:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82FDC8FC18; Thu, 22 Mar 2012 17:02:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2MH26JW033222; Thu, 22 Mar 2012 17:02:06 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2MH260m033220; Thu, 22 Mar 2012 17:02:06 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201203221702.q2MH260m033220@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 22 Mar 2012 17:02:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233314 - stable/8/usr.sbin/usbdump X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 17:02:06 -0000 Author: hselasky Date: Thu Mar 22 17:02:05 2012 New Revision: 233314 URL: http://svn.freebsd.org/changeset/base/233314 Log: MFC r233037 and r233039: Fix cross-platform issue about the file-format in which usbdump stores data. Modified: stable/8/usr.sbin/usbdump/usbdump.c (contents, props changed) Directory Properties: stable/8/usr.sbin/usbdump/ (props changed) Modified: stable/8/usr.sbin/usbdump/usbdump.c ============================================================================== --- stable/8/usr.sbin/usbdump/usbdump.c Thu Mar 22 17:01:25 2012 (r233313) +++ stable/8/usr.sbin/usbdump/usbdump.c Thu Mar 22 17:02:05 2012 (r233314) @@ -70,9 +70,23 @@ struct usbcap_filehdr { uint8_t reserved[26]; } __packed; +#define HEADER_ALIGN(x,a) (((x) + (a) - 1) & ~((a) - 1)) + +struct header_32 { + /* capture timestamp */ + uint32_t ts_sec; + uint32_t ts_usec; + /* data length and alignment information */ + uint32_t caplen; + uint32_t datalen; + uint8_t hdrlen; + uint8_t align; +} __packed; + static int doexit = 0; static int pkt_captured = 0; static int verbose = 0; +static int uf_minor; static const char *i_arg = "usbus0"; static const char *r_arg = NULL; static const char *w_arg = NULL; @@ -283,7 +297,7 @@ hexdump(const uint8_t *region, uint32_t } static void -print_apacket(const struct bpf_hdr *hdr, const uint8_t *ptr, int ptr_len) +print_apacket(const struct header_32 *hdr, const uint8_t *ptr, int ptr_len) { struct tm *tm; struct usbpf_pkthdr up_temp; @@ -318,8 +332,8 @@ print_apacket(const struct bpf_hdr *hdr, up->up_packet_count = le32toh(up->up_packet_count); up->up_endpoint = le32toh(up->up_endpoint); - tv.tv_sec = hdr->bh_tstamp.tv_sec; - tv.tv_usec = hdr->bh_tstamp.tv_usec; + tv.tv_sec = hdr->ts_sec; + tv.tv_usec = hdr->ts_usec; tm = localtime(&tv.tv_sec); len = strftime(buf, sizeof(buf), "%H:%M:%S", tm); @@ -384,19 +398,73 @@ print_apacket(const struct bpf_hdr *hdr, } static void -print_packets(uint8_t *data, const int datalen) +fix_packets(uint8_t *data, const int datalen) { - const struct bpf_hdr *hdr; + struct header_32 temp; uint8_t *ptr; uint8_t *next; + uint32_t hdrlen; + uint32_t caplen; for (ptr = data; ptr < (data + datalen); ptr = next) { + + const struct bpf_hdr *hdr; + hdr = (const struct bpf_hdr *)ptr; - next = ptr + BPF_WORDALIGN(hdr->bh_hdrlen + hdr->bh_caplen); - if (w_arg == NULL) { - print_apacket(hdr, ptr + - hdr->bh_hdrlen, hdr->bh_caplen); + temp.ts_sec = htole32(hdr->bh_tstamp.tv_sec); + temp.ts_usec = htole32(hdr->bh_tstamp.tv_usec); + temp.caplen = htole32(hdr->bh_caplen); + temp.datalen = htole32(hdr->bh_datalen); + temp.hdrlen = hdr->bh_hdrlen; + temp.align = BPF_WORDALIGN(1); + + hdrlen = hdr->bh_hdrlen; + caplen = hdr->bh_caplen; + + if ((hdrlen >= sizeof(temp)) && (hdrlen <= 255) && + ((ptr + hdrlen) <= (data + datalen))) { + memcpy(ptr, &temp, sizeof(temp)); + memset(ptr + sizeof(temp), 0, hdrlen - sizeof(temp)); + } else { + err(EXIT_FAILURE, "Invalid header length %d", hdrlen); + } + + next = ptr + BPF_WORDALIGN(hdrlen + caplen); + + if (next <= ptr) + err(EXIT_FAILURE, "Invalid length"); + } +} + +static void +print_packets(uint8_t *data, const int datalen) +{ + struct header_32 temp; + uint8_t *ptr; + uint8_t *next; + + for (ptr = data; ptr < (data + datalen); ptr = next) { + + const struct header_32 *hdr32; + + hdr32 = (const struct header_32 *)ptr; + + temp.ts_sec = le32toh(hdr32->ts_sec); + temp.ts_usec = le32toh(hdr32->ts_usec); + temp.caplen = le32toh(hdr32->caplen); + temp.datalen = le32toh(hdr32->datalen); + temp.hdrlen = hdr32->hdrlen; + temp.align = hdr32->align; + + next = ptr + HEADER_ALIGN(temp.hdrlen + temp.caplen, temp.align); + + if (next <= ptr) + err(EXIT_FAILURE, "Invalid length"); + + if (w_arg == NULL || r_arg != NULL) { + print_apacket(&temp, ptr + + temp.hdrlen, temp.caplen); } pkt_captured++; } @@ -437,6 +505,9 @@ read_file(struct usbcap *p) err(EXIT_FAILURE, "Could not read complete " "USB data payload"); } + if (uf_minor == 2) + fix_packets(data, datalen); + print_packets(data, datalen); free(data); } @@ -461,6 +532,9 @@ do_loop(struct usbcap *p) } if (cc == 0) continue; + + fix_packets(p->buffer, cc); + if (w_arg != NULL) write_packets(p, p->buffer, cc); print_packets(p->buffer, cc); @@ -492,7 +566,10 @@ init_rfile(struct usbcap *p) errx(EX_SOFTWARE, "Invalid major version(%d) " "field in USB capture file header.", (int)uf.major); } - if (uf.minor != 2) { + + uf_minor = uf.minor; + + if (uf.minor != 3 && uf.minor != 2) { errx(EX_SOFTWARE, "Invalid minor version(%d) " "field in USB capture file header.", (int)uf.minor); } @@ -507,12 +584,12 @@ init_wfile(struct usbcap *p) p->wfd = open(w_arg, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR); if (p->wfd < 0) { err(EXIT_FAILURE, "Could not open " - "'%s' for write", r_arg); + "'%s' for write", w_arg); } memset(&uf, 0, sizeof(uf)); uf.magic = htole32(USBCAP_FILEHDR_MAGIC); uf.major = 0; - uf.minor = 2; + uf.minor = 3; ret = write(p->wfd, (const void *)&uf, sizeof(uf)); if (ret != sizeof(uf)) { err(EXIT_FAILURE, "Could not write " From owner-svn-src-stable@FreeBSD.ORG Thu Mar 22 17:04:49 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7A6F106566C; Thu, 22 Mar 2012 17:04:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C88ED8FC14; Thu, 22 Mar 2012 17:04:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2MH4nD7033343; Thu, 22 Mar 2012 17:04:49 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2MH4n11033341; Thu, 22 Mar 2012 17:04:49 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201203221704.q2MH4n11033341@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 22 Mar 2012 17:04:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233315 - stable/9/usr.sbin/usbdump X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 17:04:50 -0000 Author: hselasky Date: Thu Mar 22 17:04:49 2012 New Revision: 233315 URL: http://svn.freebsd.org/changeset/base/233315 Log: MFC r233037 and r233039: Fix cross-platform issue about the file-format in which usbdump stores data. Modified: stable/9/usr.sbin/usbdump/usbdump.c Directory Properties: stable/9/usr.sbin/usbdump/ (props changed) Modified: stable/9/usr.sbin/usbdump/usbdump.c ============================================================================== --- stable/9/usr.sbin/usbdump/usbdump.c Thu Mar 22 17:02:05 2012 (r233314) +++ stable/9/usr.sbin/usbdump/usbdump.c Thu Mar 22 17:04:49 2012 (r233315) @@ -92,9 +92,23 @@ struct usbcap_filehdr { uint8_t reserved[26]; } __packed; +#define HEADER_ALIGN(x,a) (((x) + (a) - 1) & ~((a) - 1)) + +struct header_32 { + /* capture timestamp */ + uint32_t ts_sec; + uint32_t ts_usec; + /* data length and alignment information */ + uint32_t caplen; + uint32_t datalen; + uint8_t hdrlen; + uint8_t align; +} __packed; + static int doexit = 0; static int pkt_captured = 0; static int verbose = 0; +static int uf_minor; static const char *i_arg = "usbus0"; static const char *r_arg = NULL; static const char *w_arg = NULL; @@ -413,7 +427,7 @@ hexdump(const uint8_t *region, uint32_t } static void -print_apacket(const struct bpf_hdr *hdr, const uint8_t *ptr, int ptr_len) +print_apacket(const struct header_32 *hdr, const uint8_t *ptr, int ptr_len) { struct tm *tm; struct usbpf_pkthdr up_temp; @@ -448,8 +462,8 @@ print_apacket(const struct bpf_hdr *hdr, up->up_packet_count = le32toh(up->up_packet_count); up->up_endpoint = le32toh(up->up_endpoint); - tv.tv_sec = hdr->bh_tstamp.tv_sec; - tv.tv_usec = hdr->bh_tstamp.tv_usec; + tv.tv_sec = hdr->ts_sec; + tv.tv_usec = hdr->ts_usec; tm = localtime(&tv.tv_sec); len = strftime(buf, sizeof(buf), "%H:%M:%S", tm); @@ -514,19 +528,73 @@ print_apacket(const struct bpf_hdr *hdr, } static void -print_packets(uint8_t *data, const int datalen) +fix_packets(uint8_t *data, const int datalen) { - const struct bpf_hdr *hdr; + struct header_32 temp; uint8_t *ptr; uint8_t *next; + uint32_t hdrlen; + uint32_t caplen; for (ptr = data; ptr < (data + datalen); ptr = next) { + + const struct bpf_hdr *hdr; + hdr = (const struct bpf_hdr *)ptr; - next = ptr + BPF_WORDALIGN(hdr->bh_hdrlen + hdr->bh_caplen); - if (w_arg == NULL) { - print_apacket(hdr, ptr + - hdr->bh_hdrlen, hdr->bh_caplen); + temp.ts_sec = htole32(hdr->bh_tstamp.tv_sec); + temp.ts_usec = htole32(hdr->bh_tstamp.tv_usec); + temp.caplen = htole32(hdr->bh_caplen); + temp.datalen = htole32(hdr->bh_datalen); + temp.hdrlen = hdr->bh_hdrlen; + temp.align = BPF_WORDALIGN(1); + + hdrlen = hdr->bh_hdrlen; + caplen = hdr->bh_caplen; + + if ((hdrlen >= sizeof(temp)) && (hdrlen <= 255) && + ((ptr + hdrlen) <= (data + datalen))) { + memcpy(ptr, &temp, sizeof(temp)); + memset(ptr + sizeof(temp), 0, hdrlen - sizeof(temp)); + } else { + err(EXIT_FAILURE, "Invalid header length %d", hdrlen); + } + + next = ptr + BPF_WORDALIGN(hdrlen + caplen); + + if (next <= ptr) + err(EXIT_FAILURE, "Invalid length"); + } +} + +static void +print_packets(uint8_t *data, const int datalen) +{ + struct header_32 temp; + uint8_t *ptr; + uint8_t *next; + + for (ptr = data; ptr < (data + datalen); ptr = next) { + + const struct header_32 *hdr32; + + hdr32 = (const struct header_32 *)ptr; + + temp.ts_sec = le32toh(hdr32->ts_sec); + temp.ts_usec = le32toh(hdr32->ts_usec); + temp.caplen = le32toh(hdr32->caplen); + temp.datalen = le32toh(hdr32->datalen); + temp.hdrlen = hdr32->hdrlen; + temp.align = hdr32->align; + + next = ptr + HEADER_ALIGN(temp.hdrlen + temp.caplen, temp.align); + + if (next <= ptr) + err(EXIT_FAILURE, "Invalid length"); + + if (w_arg == NULL || r_arg != NULL) { + print_apacket(&temp, ptr + + temp.hdrlen, temp.caplen); } pkt_captured++; } @@ -567,6 +635,9 @@ read_file(struct usbcap *p) err(EXIT_FAILURE, "Could not read complete " "USB data payload"); } + if (uf_minor == 2) + fix_packets(data, datalen); + print_packets(data, datalen); free(data); } @@ -591,6 +662,9 @@ do_loop(struct usbcap *p) } if (cc == 0) continue; + + fix_packets(p->buffer, cc); + if (w_arg != NULL) write_packets(p, p->buffer, cc); print_packets(p->buffer, cc); @@ -622,7 +696,10 @@ init_rfile(struct usbcap *p) errx(EX_SOFTWARE, "Invalid major version(%d) " "field in USB capture file header.", (int)uf.major); } - if (uf.minor != 2) { + + uf_minor = uf.minor; + + if (uf.minor != 3 && uf.minor != 2) { errx(EX_SOFTWARE, "Invalid minor version(%d) " "field in USB capture file header.", (int)uf.minor); } @@ -637,12 +714,12 @@ init_wfile(struct usbcap *p) p->wfd = open(w_arg, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR); if (p->wfd < 0) { err(EXIT_FAILURE, "Could not open " - "'%s' for write", r_arg); + "'%s' for write", w_arg); } memset(&uf, 0, sizeof(uf)); uf.magic = htole32(USBCAP_FILEHDR_MAGIC); uf.major = 0; - uf.minor = 2; + uf.minor = 3; ret = write(p->wfd, (const void *)&uf, sizeof(uf)); if (ret != sizeof(uf)) { err(EXIT_FAILURE, "Could not write " From owner-svn-src-stable@FreeBSD.ORG Thu Mar 22 20:31:53 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74825106566B; Thu, 22 Mar 2012 20:31:53 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E2C18FC16; Thu, 22 Mar 2012 20:31:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2MKVrRP040156; Thu, 22 Mar 2012 20:31:53 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2MKVrn7040148; Thu, 22 Mar 2012 20:31:53 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201203222031.q2MKVrn7040148@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 22 Mar 2012 20:31:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233322 - stable/9/sys/fs/ext2fs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 20:31:53 -0000 Author: pfg Date: Thu Mar 22 20:31:52 2012 New Revision: 233322 URL: http://svn.freebsd.org/changeset/base/233322 Log: MFC: 232703 Add support for ns timestamps and birthtime to the ext2/3 driver. When using big inodes there is sufficient space in ext3 to keep extra resolution and birthtime (creation) timestamps. We now support the extra timestamps silently when the inode is big enough. Reviewed by: bde Approved by: jhb (mentor) Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c stable/9/sys/fs/ext2fs/ext2_dinode.h stable/9/sys/fs/ext2fs/ext2_inode_cnv.c stable/9/sys/fs/ext2fs/ext2_vfsops.c stable/9/sys/fs/ext2fs/ext2_vnops.c stable/9/sys/fs/ext2fs/ext2fs.h stable/9/sys/fs/ext2fs/inode.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_alloc.c Thu Mar 22 19:04:22 2012 (r233321) +++ stable/9/sys/fs/ext2fs/ext2_alloc.c Thu Mar 22 20:31:52 2012 (r233322) @@ -344,6 +344,7 @@ ext2_valloc(pvp, mode, cred, vpp) struct ucred *cred; struct vnode **vpp; { + struct timespec ts; struct inode *pip; struct m_ext2fs *fs; struct inode *ip; @@ -385,14 +386,14 @@ ext2_valloc(pvp, mode, cred, vpp) } ip = VTOI(*vpp); - /* - the question is whether using VGET was such good idea at all - - Linux doesn't read the old inode in when it's allocating a - new one. I will set at least i_size & i_blocks the zero. - */ - ip->i_mode = 0; + /* + * The question is whether using VGET was such good idea at all: + * Linux doesn't read the old inode in when it is allocating a + * new one. I will set at least i_size and i_blocks to zero. + */ ip->i_size = 0; ip->i_blocks = 0; + ip->i_mode = 0; ip->i_flags = 0; /* now we want to make sure that the block pointers are zeroed out */ for (i = 0; i < NDADDR; i++) @@ -406,6 +407,11 @@ ext2_valloc(pvp, mode, cred, vpp) */ if (ip->i_gen == 0 || ++ip->i_gen == 0) ip->i_gen = random() / 2 + 1; + + vfs_timestamp(&ts); + ip->i_birthtime = ts.tv_sec; + ip->i_birthnsec = ts.tv_nsec; + /* printf("ext2_valloc: allocated inode %d\n", ino); */ Modified: stable/9/sys/fs/ext2fs/ext2_dinode.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_dinode.h Thu Mar 22 19:04:22 2012 (r233321) +++ stable/9/sys/fs/ext2fs/ext2_dinode.h Thu Mar 22 20:31:52 2012 (r233322) @@ -61,6 +61,16 @@ #define EXT2_NODUMP 0x00000040 /* do not dump file */ #define EXT2_NOATIME 0x00000080 /* do not update atime */ +/* + * Definitions for nanosecond timestamps. + * Ext3 inode versioning, 2006-12-13. + */ +#define EXT3_EPOCH_BITS 2 +#define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1) +#define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS) + +#define E2DI_HAS_XTIME(ip) (EXT2_INODE_SIZE((ip)->i_e2fs) > \ + E2FS_REV0_INODE_SIZE) /* * Structure of an inode on the disk @@ -77,7 +87,7 @@ struct ext2fs_dinode { uint16_t e2di_nlink; /* 26: File link count */ uint32_t e2di_nblock; /* 28: Blocks count */ uint32_t e2di_flags; /* 32: Status flags (chflags) */ - uint32_t e2di_linux_reserved1; /* 36 */ + uint32_t e2di_version; /* 36: Low 32 bits inode version */ uint32_t e2di_blocks[EXT2_N_BLOCKS]; /* 40: disk blocks */ uint32_t e2di_gen; /* 100: generation number */ uint32_t e2di_facl; /* 104: file ACL (not implemented) */ @@ -91,6 +101,12 @@ struct ext2fs_dinode { uint32_t e2di_linux_reserved3; /* 124 */ uint16_t e2di_extra_isize; uint16_t e2di_pad1; + uint32_t e2di_ctime_extra; /* Extra change time */ + uint32_t e2di_mtime_extra; /* Extra modification time */ + uint32_t e2di_atime_extra; /* Extra access time */ + uint32_t e2di_crtime; /* Creation (birth)time */ + uint32_t e2di_crtime_extra; /* Extra creation (birth)time */ + uint32_t e2di_version_hi; /* High 30 bits of inode version */ }; #endif /* !_FS_EXT2FS_EXT2_DINODE_H_ */ Modified: stable/9/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Thu Mar 22 19:04:22 2012 (r233321) +++ stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Thu Mar 22 20:31:52 2012 (r233322) @@ -36,6 +36,9 @@ #include #include +#define XTIME_TO_NSEC(x) ((x & EXT3_NSEC_MASK) >> 2) +#define NSEC_TO_XTIME(t) ((t << 2) & EXT3_NSEC_MASK) + void ext2_print_inode( in ) struct inode *in; @@ -83,6 +86,13 @@ ext2_ei2i(ei, ip) ip->i_atime = ei->e2di_atime; ip->i_mtime = ei->e2di_mtime; ip->i_ctime = ei->e2di_ctime; + if (E2DI_HAS_XTIME(ip)) { + ip->i_atimensec = XTIME_TO_NSEC(ei->e2di_atime_extra); + ip->i_mtimensec = XTIME_TO_NSEC(ei->e2di_mtime_extra); + ip->i_ctimensec = XTIME_TO_NSEC(ei->e2di_ctime_extra); + ip->i_birthtime = ei->e2di_crtime; + ip->i_birthnsec = XTIME_TO_NSEC(ei->e2di_crtime_extra); + } ip->i_flags = 0; ip->i_flags |= (ei->e2di_flags & EXT2_APPEND) ? SF_APPEND : 0; ip->i_flags |= (ei->e2di_flags & EXT2_IMMUTABLE) ? SF_IMMUTABLE : 0; @@ -121,6 +131,13 @@ ext2_i2ei(ip, ei) ei->e2di_atime = ip->i_atime; ei->e2di_mtime = ip->i_mtime; ei->e2di_ctime = ip->i_ctime; + if (E2DI_HAS_XTIME(ip)) { + ei->e2di_ctime_extra = NSEC_TO_XTIME(ip->i_ctimensec); + ei->e2di_mtime_extra = NSEC_TO_XTIME(ip->i_mtimensec); + ei->e2di_atime_extra = NSEC_TO_XTIME(ip->i_atimensec); + ei->e2di_crtime = ip->i_birthtime; + ei->e2di_crtime_extra = NSEC_TO_XTIME(ip->i_birthnsec); + } ei->e2di_flags = ip->i_flags; ei->e2di_flags = 0; ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0; Modified: stable/9/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vfsops.c Thu Mar 22 19:04:22 2012 (r233321) +++ stable/9/sys/fs/ext2fs/ext2_vfsops.c Thu Mar 22 20:31:52 2012 (r233322) @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -339,14 +340,21 @@ compute_sb_data(struct vnode *devvp, str /* * Simple sanity check for superblock inode size value. */ - if (fs->e2fs_isize < E2FS_REV0_INODE_SIZE || - fs->e2fs_isize > fs->e2fs_bsize || + if (EXT2_INODE_SIZE(fs) < E2FS_REV0_INODE_SIZE || + EXT2_INODE_SIZE(fs) > fs->e2fs_bsize || (fs->e2fs_isize & (fs->e2fs_isize - 1)) != 0) { - printf("EXT2-fs: invalid inode size %d\n", + printf("ext2fs: invalid inode size %d\n", fs->e2fs_isize); return (EIO); } } + /* Check for extra isize in big inodes. */ + if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT4F_ROCOMPAT_EXTRA_ISIZE) && + EXT2_INODE_SIZE(fs) < sizeof(struct ext2fs_dinode)) { + printf("ext2fs: no space for extra inode timestamps\n"); + return (EINVAL); + } + fs->e2fs_ipb = fs->e2fs_bsize / EXT2_INODE_SIZE(fs); fs->e2fs_itpg = fs->e2fs_ipg /fs->e2fs_ipb; fs->e2fs_descpb = fs->e2fs_bsize / sizeof(struct ext2_gd); @@ -358,8 +366,8 @@ compute_sb_data(struct vnode *devvp, str fs->e2fs_gdbcount = db_count; fs->e2fs_gd = malloc(db_count * fs->e2fs_bsize, M_EXT2MNT, M_WAITOK); - fs->e2fs_contigdirs = malloc(fs->e2fs_gcount * sizeof(*fs->e2fs_contigdirs), - M_EXT2MNT, M_WAITOK); + fs->e2fs_contigdirs = malloc(fs->e2fs_gcount * + sizeof(*fs->e2fs_contigdirs), M_EXT2MNT, M_WAITOK); /* * Adjust logic_sb_block. @@ -390,7 +398,7 @@ compute_sb_data(struct vnode *devvp, str fs->e2fs_contigdirs[i] = 0; } if (es->e2fs_rev == E2FS_REV0 || - (es->e2fs_features_rocompat & EXT2F_ROCOMPAT_LARGEFILE) == 0) + !EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_LARGEFILE)) fs->e2fs_maxfilesize = 0x7fffffff; else fs->e2fs_maxfilesize = 0x7fffffffffffffff; @@ -967,8 +975,6 @@ ext2_vget(struct mount *mp, ino_t ino, i ip->i_block_group = ino_to_cg(fs, ino); ip->i_next_alloc_block = 0; ip->i_next_alloc_goal = 0; - ip->i_prealloc_count = 0; - ip->i_prealloc_block = 0; /* * Now we want to make sure that block pointers for unused Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vnops.c Thu Mar 22 19:04:22 2012 (r233321) +++ stable/9/sys/fs/ext2fs/ext2_vnops.c Thu Mar 22 20:31:52 2012 (r233322) @@ -360,11 +360,15 @@ ext2_getattr(ap) vap->va_rdev = ip->i_rdev; vap->va_size = ip->i_size; vap->va_atime.tv_sec = ip->i_atime; - vap->va_atime.tv_nsec = ip->i_atimensec; + vap->va_atime.tv_nsec = E2DI_HAS_XTIME(ip) ? ip->i_atimensec : 0; vap->va_mtime.tv_sec = ip->i_mtime; - vap->va_mtime.tv_nsec = ip->i_mtimensec; + vap->va_mtime.tv_nsec = E2DI_HAS_XTIME(ip) ? ip->i_mtimensec : 0; vap->va_ctime.tv_sec = ip->i_ctime; - vap->va_ctime.tv_nsec = ip->i_ctimensec; + vap->va_ctime.tv_nsec = E2DI_HAS_XTIME(ip) ? ip->i_ctimensec : 0; + if E2DI_HAS_XTIME(ip) { + vap->va_birthtime.tv_sec = ip->i_birthtime; + vap->va_birthtime.tv_nsec = ip->i_birthnsec; + } vap->va_flags = ip->i_flags; vap->va_gen = ip->i_gen; vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize; @@ -501,6 +505,8 @@ ext2_setattr(ap) ip->i_mtime = vap->va_mtime.tv_sec; ip->i_mtimensec = vap->va_mtime.tv_nsec; } + ip->i_birthtime = vap->va_birthtime.tv_sec; + ip->i_birthnsec = vap->va_birthtime.tv_nsec; error = ext2_update(vp, 0); if (error) return (error); Modified: stable/9/sys/fs/ext2fs/ext2fs.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2fs.h Thu Mar 22 19:04:22 2012 (r233321) +++ stable/9/sys/fs/ext2fs/ext2fs.h Thu Mar 22 20:31:52 2012 (r233322) @@ -129,7 +129,7 @@ struct ext2fs { uint32_t e4fs_rbcount_hi; /* reserved blocks count */ uint32_t e4fs_fbcount_hi; /* free blocks count */ uint16_t e4fs_min_extra_isize;/* all inodes have at least some bytes */ - uint16_t e4fs_want_extra_isize; /* new inodes should reserve some bytes */ + uint16_t e4fs_want_extra_isize; /* inodes must reserve some bytes */ uint32_t e4fs_flags; /* miscellaneous flags */ uint16_t e4fs_raid_stride; /* RAID stride */ uint16_t e4fs_mmpintv; /* number of seconds to wait in MMP checking */ @@ -214,6 +214,7 @@ struct m_ext2fs { #define EXT2F_ROCOMPAT_SPARSESUPER 0x0001 #define EXT2F_ROCOMPAT_LARGEFILE 0x0002 #define EXT2F_ROCOMPAT_BTREE_DIR 0x0004 +#define EXT4F_ROCOMPAT_EXTRA_ISIZE 0x0040 #define EXT2F_INCOMPAT_COMP 0x0001 #define EXT2F_INCOMPAT_FTYPE 0x0002 @@ -227,8 +228,9 @@ struct m_ext2fs { * - EXT2F_INCOMPAT_FTYPE */ #define EXT2F_COMPAT_SUPP 0x0000 -#define EXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER \ - | EXT2F_ROCOMPAT_LARGEFILE) +#define EXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER | \ + EXT2F_ROCOMPAT_LARGEFILE | \ + EXT4F_ROCOMPAT_EXTRA_ISIZE) #define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE /* Assume that user mode programs are passing in an ext2fs superblock, not Modified: stable/9/sys/fs/ext2fs/inode.h ============================================================================== --- stable/9/sys/fs/ext2fs/inode.h Thu Mar 22 19:04:22 2012 (r233321) +++ stable/9/sys/fs/ext2fs/inode.h Thu Mar 22 20:31:52 2012 (r233322) @@ -77,8 +77,6 @@ struct inode { uint32_t i_block_group; uint32_t i_next_alloc_block; uint32_t i_next_alloc_goal; - uint32_t i_prealloc_block; - uint32_t i_prealloc_count; /* Fields from struct dinode in UFS. */ uint16_t i_mode; /* IFMT, permissions; see below. */ From owner-svn-src-stable@FreeBSD.ORG Thu Mar 22 20:51:36 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 530C01065676; Thu, 22 Mar 2012 20:51:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23CD38FC1C; Thu, 22 Mar 2012 20:51:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2MKpZa3040840; Thu, 22 Mar 2012 20:51:35 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2MKpZPO040838; Thu, 22 Mar 2012 20:51:35 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203222051.q2MKpZPO040838@svn.freebsd.org> From: John Baldwin Date: Thu, 22 Mar 2012 20:51:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233324 - in stable/9/sys: i386/conf nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 20:51:36 -0000 Author: jhb Date: Thu Mar 22 20:51:35 2012 New Revision: 233324 URL: http://svn.freebsd.org/changeset/base/233324 Log: MFC 232116: Adjust the nfs_skip_wcc_data_onerr setting so that it does not block post-op attributes for ENOENT errors now that the name caching logic depends on working post-op attributes. Modified: stable/9/sys/nfsclient/nfs_krpc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/nfsclient/nfs_krpc.c ============================================================================== --- stable/9/sys/nfsclient/nfs_krpc.c Thu Mar 22 20:34:26 2012 (r233323) +++ stable/9/sys/nfsclient/nfs_krpc.c Thu Mar 22 20:51:35 2012 (r233324) @@ -603,13 +603,15 @@ tryagain: if (error == ESTALE) nfs_purgecache(vp); /* - * Skip wcc data on NFS errors for now. NetApp filers - * return corrupt postop attrs in the wcc data for NFS - * err EROFS. Not sure if they could return corrupt - * postop attrs for others errors. + * Skip wcc data on non-ENOENT NFS errors for now. + * NetApp filers return corrupt postop attrs in the + * wcc data for NFS err EROFS. Not sure if they could + * return corrupt postop attrs for others errors. + * Blocking ENOENT post-op attributes breaks negative + * name caching, so always allow it through. */ if ((nmp->nm_flag & NFSMNT_NFSV3) && - !nfs_skip_wcc_data_onerr) { + (!nfs_skip_wcc_data_onerr || error == ENOENT)) { *mrp = mrep; *mdp = md; *dposp = dpos; From owner-svn-src-stable@FreeBSD.ORG Thu Mar 22 20:52:00 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFE73106564A; Thu, 22 Mar 2012 20:52:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA0D58FC08; Thu, 22 Mar 2012 20:52:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2MKq0tE040892; Thu, 22 Mar 2012 20:52:00 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2MKq0iM040889; Thu, 22 Mar 2012 20:52:00 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203222052.q2MKq0iM040889@svn.freebsd.org> From: John Baldwin Date: Thu, 22 Mar 2012 20:52:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233325 - in stable/8/sys: i386/conf nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 20:52:01 -0000 Author: jhb Date: Thu Mar 22 20:52:00 2012 New Revision: 233325 URL: http://svn.freebsd.org/changeset/base/233325 Log: MFC 232116: Adjust the nfs_skip_wcc_data_onerr setting so that it does not block post-op attributes for ENOENT errors now that the name caching logic depends on working post-op attributes. Modified: stable/8/sys/nfsclient/nfs_krpc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/nfsclient/nfs_krpc.c ============================================================================== --- stable/8/sys/nfsclient/nfs_krpc.c Thu Mar 22 20:51:35 2012 (r233324) +++ stable/8/sys/nfsclient/nfs_krpc.c Thu Mar 22 20:52:00 2012 (r233325) @@ -603,13 +603,15 @@ tryagain: if (error == ESTALE) nfs_purgecache(vp); /* - * Skip wcc data on NFS errors for now. NetApp filers - * return corrupt postop attrs in the wcc data for NFS - * err EROFS. Not sure if they could return corrupt - * postop attrs for others errors. + * Skip wcc data on non-ENOENT NFS errors for now. + * NetApp filers return corrupt postop attrs in the + * wcc data for NFS err EROFS. Not sure if they could + * return corrupt postop attrs for others errors. + * Blocking ENOENT post-op attributes breaks negative + * name caching, so always allow it through. */ if ((nmp->nm_flag & NFSMNT_NFSV3) && - !nfs_skip_wcc_data_onerr) { + (!nfs_skip_wcc_data_onerr || error == ENOENT)) { *mrp = mrep; *mdp = md; *dposp = dpos; From owner-svn-src-stable@FreeBSD.ORG Thu Mar 22 21:07:55 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2EFE106566C; Thu, 22 Mar 2012 21:07:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8412C8FC15; Thu, 22 Mar 2012 21:07:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2ML7tpK041473; Thu, 22 Mar 2012 21:07:55 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2ML7tET041465; Thu, 22 Mar 2012 21:07:55 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203222107.q2ML7tET041465@svn.freebsd.org> From: John Baldwin Date: Thu, 22 Mar 2012 21:07:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233326 - in stable/9: sbin/mount_nfs sys/fs/nfsclient sys/i386/conf sys/nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 21:07:55 -0000 Author: jhb Date: Thu Mar 22 21:07:54 2012 New Revision: 233326 URL: http://svn.freebsd.org/changeset/base/233326 Log: MFC 230547: Add a timeout on positive name cache entries in the NFS client. That is, we will only trust a positive name cache entry for a specified amount of time before falling back to a LOOKUP RPC, even if the ctime for the file handle matches the cached copy in the name cache entry. The timeout is configured via a new 'nametimeo' mount option and defaults to 60 seconds. It may be set to zero to disable positive name caching entirely. Modified: stable/9/sbin/mount_nfs/mount_nfs.8 stable/9/sys/fs/nfsclient/nfs_clvfsops.c stable/9/sys/fs/nfsclient/nfs_clvnops.c stable/9/sys/fs/nfsclient/nfsmount.h stable/9/sys/nfsclient/nfs_vfsops.c stable/9/sys/nfsclient/nfs_vnops.c stable/9/sys/nfsclient/nfsmount.h Directory Properties: stable/9/sbin/mount_nfs/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- stable/9/sbin/mount_nfs/mount_nfs.8 Thu Mar 22 20:52:00 2012 (r233325) +++ stable/9/sbin/mount_nfs/mount_nfs.8 Thu Mar 22 21:07:54 2012 (r233326) @@ -157,6 +157,10 @@ Force the mount protocol to use UDP tran (Necessary for some old .Bx servers.) +.It Cm nametimeo Ns = Ns Aq Ar value +Override the default of NFS_DEFAULT_NAMETIMEO for the timeout (in seconds) +for positive name cache entries. +If this is set to 0 it disables positive name caching for the mount point. .It Cm negnametimeo Ns = Ns Aq Ar value Override the default of NFS_DEFAULT_NEGNAMETIMEO for the timeout (in seconds) for negative name cache entries. If this is set to 0 it disables negative Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvfsops.c Thu Mar 22 20:52:00 2012 (r233325) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c Thu Mar 22 21:07:54 2012 (r233326) @@ -104,7 +104,7 @@ static void nfs_decode_args(struct mount static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, u_char *, int, u_char *, int, u_char *, int, struct vnode **, struct ucred *, - struct thread *, int); + struct thread *, int, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *, struct timeval *); @@ -520,7 +520,8 @@ nfs_mountdiskless(char *path, dirlen = 0; nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK); if ((error = mountnfs(args, mp, nam, path, NULL, 0, dirpath, dirlen, - NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { + NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NAMETIMEO, + NFS_DEFAULT_NEGNAMETIMEO)) != 0) { printf("nfs_mountroot: mount %s on /: %d\n", path, error); return (error); } @@ -715,7 +716,7 @@ static const char *nfs_opts[] = { "from" "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "resvport", "readahead", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", - "negnametimeo", "nocto", "wcommitsize", + "nametimeo", "negnametimeo", "nocto", "wcommitsize", NULL }; /* @@ -760,6 +761,7 @@ nfs_mount(struct mount *mp) char hst[MNAMELEN]; u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100]; char *opt, *name, *secname; + int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; int dirlen, has_nfs_args_opt, krbnamelen, srvkrbnamelen; size_t hstlen; @@ -968,6 +970,14 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_TIMEO; } + if (vfs_getopt(mp->mnt_optnew, "nametimeo", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &nametimeo); + if (ret != 1 || nametimeo < 0) { + vfs_mount_error(mp, "illegal nametimeo: %s", opt); + error = EINVAL; + goto out; + } + } if (vfs_getopt(mp->mnt_optnew, "negnametimeo", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &negnametimeo); @@ -1122,7 +1132,7 @@ nfs_mount(struct mount *mp) args.fh = nfh; error = mountnfs(&args, mp, nam, hst, krbname, krbnamelen, dirpath, dirlen, srvkrbname, srvkrbnamelen, &vp, td->td_ucred, td, - negnametimeo); + nametimeo, negnametimeo); out: if (!error) { MNT_ILOCK(mp); @@ -1166,7 +1176,7 @@ static int mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, char *hst, u_char *krbname, int krbnamelen, u_char *dirpath, int dirlen, u_char *srvkrbname, int srvkrbnamelen, struct vnode **vpp, - struct ucred *cred, struct thread *td, int negnametimeo) + struct ucred *cred, struct thread *td, int nametimeo, int negnametimeo) { struct nfsmount *nmp; struct nfsnode *np; @@ -1233,13 +1243,14 @@ mountnfs(struct nfs_args *argp, struct m } vfs_getnewfsid(mp); nmp->nm_mountp = mp; - mtx_init(&nmp->nm_mtx, "NFSmount lock", NULL, MTX_DEF | MTX_DUPOK); + mtx_init(&nmp->nm_mtx, "NFSmount lock", NULL, MTX_DEF | MTX_DUPOK); /* - * Since nfs_decode_args() might optionally set them, these need to - * set to defaults before the call, so that the optional settings - * aren't overwritten. + * Since nfs_decode_args() might optionally set them, these + * need to be set to defaults before the call, so that the + * optional settings aren't overwritten. */ + nmp->nm_nametimeo = nametimeo; nmp->nm_negnametimeo = negnametimeo; nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvnops.c Thu Mar 22 20:52:00 2012 (r233325) +++ stable/9/sys/fs/nfsclient/nfs_clvnops.c Thu Mar 22 21:07:54 2012 (r233326) @@ -1063,7 +1063,8 @@ nfs_lookup(struct vop_lookup_args *ap) * We only accept a positive hit in the cache if the * change time of the file matches our cached copy. * Otherwise, we discard the cache entry and fallback - * to doing a lookup RPC. + * to doing a lookup RPC. We also only trust cache + * entries for less than nm_nametimeo seconds. * * To better handle stale file handles and attributes, * clear the attribute cache of this node if it is a @@ -1085,7 +1086,8 @@ nfs_lookup(struct vop_lookup_args *ap) mtx_unlock(&newnp->n_mtx); } if (nfscl_nodeleg(newvp, 0) == 0 || - (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && + ((u_int)(ticks - ncticks) < (nmp->nm_nametimeo * hz) && + VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && timespeccmp(&vattr.va_ctime, &nctime, ==))) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); if (cnp->cn_nameiop != LOOKUP && Modified: stable/9/sys/fs/nfsclient/nfsmount.h ============================================================================== --- stable/9/sys/fs/nfsclient/nfsmount.h Thu Mar 22 20:52:00 2012 (r233325) +++ stable/9/sys/fs/nfsclient/nfsmount.h Thu Mar 22 21:07:54 2012 (r233326) @@ -66,6 +66,7 @@ struct nfsmount { u_int64_t nm_maxfilesize; /* maximum file size */ int nm_tprintf_initial_delay; /* initial delay */ int nm_tprintf_delay; /* interval for messages */ + int nm_nametimeo; /* timeout for +ve entries (sec) */ int nm_negnametimeo; /* timeout for -ve entries (sec) */ /* Newnfs additions */ @@ -106,6 +107,10 @@ struct nfsmount { */ #define VFSTONFS(mp) ((struct nfsmount *)((mp)->mnt_data)) +#ifndef NFS_DEFAULT_NAMETIMEO +#define NFS_DEFAULT_NAMETIMEO 60 +#endif + #ifndef NFS_DEFAULT_NEGNAMETIMEO #define NFS_DEFAULT_NEGNAMETIMEO 60 #endif Modified: stable/9/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/9/sys/nfsclient/nfs_vfsops.c Thu Mar 22 20:52:00 2012 (r233325) +++ stable/9/sys/nfsclient/nfs_vfsops.c Thu Mar 22 21:07:54 2012 (r233326) @@ -118,7 +118,7 @@ static void nfs_decode_args(struct mount struct nfs_args *argp, const char *hostname); static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, struct vnode **, - struct ucred *cred, int); + struct ucred *cred, int, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *, struct timeval *); @@ -560,8 +560,8 @@ nfs_mountdiskless(char *path, int error; nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK); - if ((error = mountnfs(args, mp, nam, path, vpp, - td->td_ucred, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { + if ((error = mountnfs(args, mp, nam, path, vpp, td->td_ucred, + NFS_DEFAULT_NAMETIMEO, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { printf("nfs_mountroot: mount %s on /: %d\n", path, error); return (error); } @@ -789,6 +789,7 @@ static const char *nfs_opts[] = { "from" "wsize", "rsize", "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "deadthresh", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", "maxgroups", "principal", "negnametimeo", "nocto", "wcommitsize", + "nametimeo", NULL }; /* @@ -837,6 +838,7 @@ nfs_mount(struct mount *mp) size_t len; u_char nfh[NFSX_V3FHMAX]; char *opt; + int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; has_nfs_args_opt = 0; @@ -1059,6 +1061,14 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_MAXGRPS; } + if (vfs_getopt(mp->mnt_optnew, "nametimeo", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &nametimeo); + if (ret != 1 || nametimeo < 0) { + vfs_mount_error(mp, "illegal nametimeo: %s", opt); + error = EINVAL; + goto out; + } + } if (vfs_getopt(mp->mnt_optnew, "negnametimeo", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &negnametimeo); @@ -1179,7 +1189,7 @@ nfs_mount(struct mount *mp) goto out; } error = mountnfs(&args, mp, nam, args.hostname, &vp, - curthread->td_ucred, negnametimeo); + curthread->td_ucred, nametimeo, negnametimeo); out: if (!error) { MNT_ILOCK(mp); @@ -1221,7 +1231,8 @@ nfs_cmount(struct mntarg *ma, void *data */ static int mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, - char *hst, struct vnode **vpp, struct ucred *cred, int negnametimeo) + char *hst, struct vnode **vpp, struct ucred *cred, int nametimeo, + int negnametimeo) { struct nfsmount *nmp; struct nfsnode *np; @@ -1271,6 +1282,7 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_numgrps = NFS_MAXGRPS; nmp->nm_readahead = NFS_DEFRAHEAD; nmp->nm_deadthresh = NFS_MAXDEADTHRESH; + nmp->nm_nametimeo = nametimeo; nmp->nm_negnametimeo = negnametimeo; nmp->nm_tprintf_delay = nfs_tprintf_delay; if (nmp->nm_tprintf_delay < 0) Modified: stable/9/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/9/sys/nfsclient/nfs_vnops.c Thu Mar 22 20:52:00 2012 (r233325) +++ stable/9/sys/nfsclient/nfs_vnops.c Thu Mar 22 21:07:54 2012 (r233326) @@ -959,7 +959,8 @@ nfs_lookup(struct vop_lookup_args *ap) * We only accept a positive hit in the cache if the * change time of the file matches our cached copy. * Otherwise, we discard the cache entry and fallback - * to doing a lookup RPC. + * to doing a lookup RPC. We also only trust cache + * entries for less than nm_nametimeo seconds. * * To better handle stale file handles and attributes, * clear the attribute cache of this node if it is a @@ -980,7 +981,8 @@ nfs_lookup(struct vop_lookup_args *ap) KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(newvp); mtx_unlock(&newnp->n_mtx); } - if (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && + if ((u_int)(ticks - ncticks) < (nmp->nm_nametimeo * hz) && + VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && timespeccmp(&vattr.va_ctime, &nctime, ==)) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && Modified: stable/9/sys/nfsclient/nfsmount.h ============================================================================== --- stable/9/sys/nfsclient/nfsmount.h Thu Mar 22 20:52:00 2012 (r233325) +++ stable/9/sys/nfsclient/nfsmount.h Thu Mar 22 21:07:54 2012 (r233326) @@ -83,6 +83,7 @@ struct nfsmount { struct rpc_timers nm_timers[NFS_MAX_TIMER]; /* RTT Timers for rpcs */ char nm_principal[MNAMELEN]; /* GSS-API principal of server */ gss_OID nm_mech_oid; /* OID of selected GSS-API mechanism */ + int nm_nametimeo; /* timeout for +ve entries (sec) */ int nm_negnametimeo; /* timeout for -ve entries (sec) */ /* NFSv4 */ @@ -116,6 +117,10 @@ struct nfsmount { #define NFS_TPRINTF_DELAY 30 #endif +#ifndef NFS_DEFAULT_NAMETIMEO +#define NFS_DEFAULT_NAMETIMEO 60 +#endif + #ifndef NFS_DEFAULT_NEGNAMETIMEO #define NFS_DEFAULT_NEGNAMETIMEO 60 #endif From owner-svn-src-stable@FreeBSD.ORG Thu Mar 22 21:08:15 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 211BA1065675; Thu, 22 Mar 2012 21:08:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 018E88FC15; Thu, 22 Mar 2012 21:08:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2ML8Ewb041528; Thu, 22 Mar 2012 21:08:14 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2ML8EDG041520; Thu, 22 Mar 2012 21:08:14 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203222108.q2ML8EDG041520@svn.freebsd.org> From: John Baldwin Date: Thu, 22 Mar 2012 21:08:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233327 - in stable/8: sbin/mount_nfs sys/fs/nfsclient sys/i386/conf sys/nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 21:08:15 -0000 Author: jhb Date: Thu Mar 22 21:08:14 2012 New Revision: 233327 URL: http://svn.freebsd.org/changeset/base/233327 Log: MFC 230547: Add a timeout on positive name cache entries in the NFS client. That is, we will only trust a positive name cache entry for a specified amount of time before falling back to a LOOKUP RPC, even if the ctime for the file handle matches the cached copy in the name cache entry. The timeout is configured via a new 'nametimeo' mount option and defaults to 60 seconds. It may be set to zero to disable positive name caching entirely. Modified: stable/8/sbin/mount_nfs/mount_nfs.8 stable/8/sys/fs/nfsclient/nfs_clvfsops.c stable/8/sys/fs/nfsclient/nfs_clvnops.c stable/8/sys/fs/nfsclient/nfsmount.h stable/8/sys/nfsclient/nfs_vfsops.c stable/8/sys/nfsclient/nfs_vnops.c stable/8/sys/nfsclient/nfsmount.h Directory Properties: stable/8/sbin/mount_nfs/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- stable/8/sbin/mount_nfs/mount_nfs.8 Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sbin/mount_nfs/mount_nfs.8 Thu Mar 22 21:08:14 2012 (r233327) @@ -151,6 +151,10 @@ Force the mount protocol to use UDP tran (Necessary for some old .Bx servers.) +.It Cm nametimeo Ns = Ns Aq Ar value +Override the default of NFS_DEFAULT_NAMETIMEO for the timeout (in seconds) +for positive name cache entries. +If this is set to 0 it disables positive name caching for the mount point. .It Cm negnametimeo Ns = Ns Aq Ar value Override the default of NFS_DEFAULT_NEGNAMETIMEO for the timeout (in seconds) for negative name cache entries. If this is set to 0 it disables negative Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Thu Mar 22 21:08:14 2012 (r233327) @@ -104,7 +104,7 @@ static void nfs_decode_args(struct mount static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, u_char *, int, u_char *, int, u_char *, int, struct vnode **, struct ucred *, - struct thread *, int); + struct thread *, int, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *, struct timeval *); @@ -516,7 +516,8 @@ nfs_mountdiskless(char *path, dirlen = 0; nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK); if ((error = mountnfs(args, mp, nam, path, NULL, 0, dirpath, dirlen, - NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { + NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NAMETIMEO, + NFS_DEFAULT_NEGNAMETIMEO)) != 0) { printf("nfs_mountroot: mount %s on /: %d\n", path, error); return (error); } @@ -711,7 +712,7 @@ static const char *nfs_opts[] = { "from" "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "resvport", "readahead", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", - "negnametimeo", "nocto", "wcommitsize", + "nametimeo", "negnametimeo", "nocto", "wcommitsize", NULL }; /* @@ -756,6 +757,7 @@ nfs_mount(struct mount *mp) char hst[MNAMELEN]; u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100]; char *opt, *name, *secname; + int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; int dirlen, has_nfs_args_opt, krbnamelen, srvkrbnamelen; size_t hstlen; @@ -964,6 +966,14 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_TIMEO; } + if (vfs_getopt(mp->mnt_optnew, "nametimeo", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &nametimeo); + if (ret != 1 || nametimeo < 0) { + vfs_mount_error(mp, "illegal nametimeo: %s", opt); + error = EINVAL; + goto out; + } + } if (vfs_getopt(mp->mnt_optnew, "negnametimeo", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &negnametimeo); @@ -1118,7 +1128,7 @@ nfs_mount(struct mount *mp) args.fh = nfh; error = mountnfs(&args, mp, nam, hst, krbname, krbnamelen, dirpath, dirlen, srvkrbname, srvkrbnamelen, &vp, td->td_ucred, td, - negnametimeo); + nametimeo, negnametimeo); out: if (!error) { MNT_ILOCK(mp); @@ -1162,7 +1172,7 @@ static int mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, char *hst, u_char *krbname, int krbnamelen, u_char *dirpath, int dirlen, u_char *srvkrbname, int srvkrbnamelen, struct vnode **vpp, - struct ucred *cred, struct thread *td, int negnametimeo) + struct ucred *cred, struct thread *td, int nametimeo, int negnametimeo) { struct nfsmount *nmp; struct nfsnode *np; @@ -1229,13 +1239,14 @@ mountnfs(struct nfs_args *argp, struct m } vfs_getnewfsid(mp); nmp->nm_mountp = mp; - mtx_init(&nmp->nm_mtx, "NFSmount lock", NULL, MTX_DEF | MTX_DUPOK); + mtx_init(&nmp->nm_mtx, "NFSmount lock", NULL, MTX_DEF | MTX_DUPOK); /* - * Since nfs_decode_args() might optionally set them, these need to - * set to defaults before the call, so that the optional settings - * aren't overwritten. + * Since nfs_decode_args() might optionally set them, these + * need to be set to defaults before the call, so that the + * optional settings aren't overwritten. */ + nmp->nm_nametimeo = nametimeo; nmp->nm_negnametimeo = negnametimeo; nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Thu Mar 22 21:08:14 2012 (r233327) @@ -1026,7 +1026,8 @@ nfs_lookup(struct vop_lookup_args *ap) * We only accept a positive hit in the cache if the * change time of the file matches our cached copy. * Otherwise, we discard the cache entry and fallback - * to doing a lookup RPC. + * to doing a lookup RPC. We also only trust cache + * entries for less than nm_nametimeo seconds. * * To better handle stale file handles and attributes, * clear the attribute cache of this node if it is a @@ -1047,7 +1048,8 @@ nfs_lookup(struct vop_lookup_args *ap) mtx_unlock(&newnp->n_mtx); } if (nfscl_nodeleg(newvp, 0) == 0 || - (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && + ((u_int)(ticks - ncticks) < (nmp->nm_nametimeo * hz) && + VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && timespeccmp(&vattr.va_ctime, &nctime, ==))) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); if (cnp->cn_nameiop != LOOKUP && Modified: stable/8/sys/fs/nfsclient/nfsmount.h ============================================================================== --- stable/8/sys/fs/nfsclient/nfsmount.h Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sys/fs/nfsclient/nfsmount.h Thu Mar 22 21:08:14 2012 (r233327) @@ -66,6 +66,7 @@ struct nfsmount { u_int64_t nm_maxfilesize; /* maximum file size */ int nm_tprintf_initial_delay; /* initial delay */ int nm_tprintf_delay; /* interval for messages */ + int nm_nametimeo; /* timeout for +ve entries (sec) */ int nm_negnametimeo; /* timeout for -ve entries (sec) */ /* Newnfs additions */ @@ -106,6 +107,10 @@ struct nfsmount { */ #define VFSTONFS(mp) ((struct nfsmount *)((mp)->mnt_data)) +#ifndef NFS_DEFAULT_NAMETIMEO +#define NFS_DEFAULT_NAMETIMEO 60 +#endif + #ifndef NFS_DEFAULT_NEGNAMETIMEO #define NFS_DEFAULT_NEGNAMETIMEO 60 #endif Modified: stable/8/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vfsops.c Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sys/nfsclient/nfs_vfsops.c Thu Mar 22 21:08:14 2012 (r233327) @@ -116,7 +116,7 @@ static void nfs_decode_args(struct mount struct nfs_args *argp, const char *hostname); static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, struct vnode **, - struct ucred *cred, int); + struct ucred *cred, int, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *, struct timeval *); @@ -558,8 +558,8 @@ nfs_mountdiskless(char *path, int error; nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK); - if ((error = mountnfs(args, mp, nam, path, vpp, - td->td_ucred, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { + if ((error = mountnfs(args, mp, nam, path, vpp, td->td_ucred, + NFS_DEFAULT_NAMETIMEO, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { printf("nfs_mountroot: mount %s on /: %d\n", path, error); return (error); } @@ -787,6 +787,7 @@ static const char *nfs_opts[] = { "from" "wsize", "rsize", "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "deadthresh", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", "maxgroups", "principal", "negnametimeo", "nocto", "wcommitsize", + "nametimeo", NULL }; /* @@ -835,6 +836,7 @@ nfs_mount(struct mount *mp) size_t len; u_char nfh[NFSX_V3FHMAX]; char *opt; + int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; has_nfs_args_opt = 0; @@ -1057,6 +1059,14 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_MAXGRPS; } + if (vfs_getopt(mp->mnt_optnew, "nametimeo", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &nametimeo); + if (ret != 1 || nametimeo < 0) { + vfs_mount_error(mp, "illegal nametimeo: %s", opt); + error = EINVAL; + goto out; + } + } if (vfs_getopt(mp->mnt_optnew, "negnametimeo", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &negnametimeo); @@ -1177,7 +1187,7 @@ nfs_mount(struct mount *mp) goto out; } error = mountnfs(&args, mp, nam, args.hostname, &vp, - curthread->td_ucred, negnametimeo); + curthread->td_ucred, nametimeo, negnametimeo); out: if (!error) { MNT_ILOCK(mp); @@ -1219,7 +1229,8 @@ nfs_cmount(struct mntarg *ma, void *data */ static int mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, - char *hst, struct vnode **vpp, struct ucred *cred, int negnametimeo) + char *hst, struct vnode **vpp, struct ucred *cred, int nametimeo, + int negnametimeo) { struct nfsmount *nmp; struct nfsnode *np; @@ -1269,6 +1280,7 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_numgrps = NFS_MAXGRPS; nmp->nm_readahead = NFS_DEFRAHEAD; nmp->nm_deadthresh = NFS_MAXDEADTHRESH; + nmp->nm_nametimeo = nametimeo; nmp->nm_negnametimeo = negnametimeo; nmp->nm_tprintf_delay = nfs_tprintf_delay; if (nmp->nm_tprintf_delay < 0) Modified: stable/8/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vnops.c Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sys/nfsclient/nfs_vnops.c Thu Mar 22 21:08:14 2012 (r233327) @@ -960,7 +960,8 @@ nfs_lookup(struct vop_lookup_args *ap) * We only accept a positive hit in the cache if the * change time of the file matches our cached copy. * Otherwise, we discard the cache entry and fallback - * to doing a lookup RPC. + * to doing a lookup RPC. We also only trust cache + * entries for less than nm_nametimeo seconds. * * To better handle stale file handles and attributes, * clear the attribute cache of this node if it is a @@ -981,7 +982,8 @@ nfs_lookup(struct vop_lookup_args *ap) KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(newvp); mtx_unlock(&newnp->n_mtx); } - if (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && + if ((u_int)(ticks - ncticks) < (nmp->nm_nametimeo * hz) && + VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && timespeccmp(&vattr.va_ctime, &nctime, ==)) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && Modified: stable/8/sys/nfsclient/nfsmount.h ============================================================================== --- stable/8/sys/nfsclient/nfsmount.h Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sys/nfsclient/nfsmount.h Thu Mar 22 21:08:14 2012 (r233327) @@ -83,6 +83,7 @@ struct nfsmount { struct rpc_timers nm_timers[NFS_MAX_TIMER]; /* RTT Timers for rpcs */ char nm_principal[MNAMELEN]; /* GSS-API principal of server */ gss_OID nm_mech_oid; /* OID of selected GSS-API mechanism */ + int nm_nametimeo; /* timeout for +ve entries (sec) */ int nm_negnametimeo; /* timeout for -ve entries (sec) */ /* NFSv4 */ @@ -116,6 +117,10 @@ struct nfsmount { #define NFS_TPRINTF_DELAY 30 #endif +#ifndef NFS_DEFAULT_NAMETIMEO +#define NFS_DEFAULT_NAMETIMEO 60 +#endif + #ifndef NFS_DEFAULT_NEGNAMETIMEO #define NFS_DEFAULT_NEGNAMETIMEO 60 #endif From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 10:55:19 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D8BC11065673; Fri, 23 Mar 2012 10:55:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B271B8FC12; Fri, 23 Mar 2012 10:55:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NAtJvm070984; Fri, 23 Mar 2012 10:55:19 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NAtJ9p070979; Fri, 23 Mar 2012 10:55:19 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201203231055.q2NAtJ9p070979@svn.freebsd.org> From: Dimitry Andric Date: Fri, 23 Mar 2012 10:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233349 - in stable/9/sys: amd64/include i386/include powerpc/include sparc64/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 10:55:20 -0000 Author: dim Date: Fri Mar 23 10:55:19 2012 New Revision: 233349 URL: http://svn.freebsd.org/changeset/base/233349 Log: MFC r232745: Add casts to __uint16_t to the __bswap16() macros on all arches which didn't already have them. This is because the ternary expression will return int, due to the Usual Arithmetic Conversions. Such casts are not needed for the 32 and 64 bit variants. While here, add additional parentheses around the x86 variant, to protect against unintended consequences. Modified: stable/9/sys/amd64/include/endian.h stable/9/sys/i386/include/endian.h stable/9/sys/powerpc/include/endian.h stable/9/sys/sparc64/include/endian.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/include/endian.h ============================================================================== --- stable/9/sys/amd64/include/endian.h Fri Mar 23 10:39:50 2012 (r233348) +++ stable/9/sys/amd64/include/endian.h Fri Mar 23 10:55:19 2012 (r233349) @@ -119,8 +119,8 @@ __bswap16_var(__uint16_t _x) __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) #define __bswap16(_x) \ - (__builtin_constant_p(_x) ? \ - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) + ((__uint16_t)(__builtin_constant_p(_x) ? \ + __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x))) #define __htonl(x) __bswap32(x) #define __htons(x) __bswap16(x) Modified: stable/9/sys/i386/include/endian.h ============================================================================== --- stable/9/sys/i386/include/endian.h Fri Mar 23 10:39:50 2012 (r233348) +++ stable/9/sys/i386/include/endian.h Fri Mar 23 10:55:19 2012 (r233349) @@ -119,8 +119,8 @@ __bswap16_var(__uint16_t _x) __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) #define __bswap16(_x) \ - (__builtin_constant_p(_x) ? \ - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) + ((__uint16_t)(__builtin_constant_p(_x) ? \ + __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x))) #define __htonl(x) __bswap32(x) #define __htons(x) __bswap16(x) Modified: stable/9/sys/powerpc/include/endian.h ============================================================================== --- stable/9/sys/powerpc/include/endian.h Fri Mar 23 10:39:50 2012 (r233348) +++ stable/9/sys/powerpc/include/endian.h Fri Mar 23 10:55:19 2012 (r233349) @@ -124,8 +124,8 @@ __bswap64_var(__uint64_t _x) ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))); } -#define __bswap16(x) (__is_constant(x) ? __bswap16_const(x) : \ - __bswap16_var(x)) +#define __bswap16(x) ((__uint16_t)(__is_constant(x) ? __bswap16_const(x) : \ + __bswap16_var(x))) #define __bswap32(x) (__is_constant(x) ? __bswap32_const(x) : \ __bswap32_var(x)) #define __bswap64(x) (__is_constant(x) ? __bswap64_const(x) : \ Modified: stable/9/sys/sparc64/include/endian.h ============================================================================== --- stable/9/sys/sparc64/include/endian.h Fri Mar 23 10:39:50 2012 (r233348) +++ stable/9/sys/sparc64/include/endian.h Fri Mar 23 10:55:19 2012 (r233349) @@ -109,8 +109,8 @@ __bswap64_var(__uint64_t _x) ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))); } -#define __bswap16(x) (__is_constant(x) ? __bswap16_const(x) : \ - __bswap16_var(x)) +#define __bswap16(x) ((__uint16_t)(__is_constant(x) ? __bswap16_const(x) : \ + __bswap16_var(x))) #define __bswap32(x) (__is_constant(x) ? __bswap32_const(x) : \ __bswap32_var(x)) #define __bswap64(x) (__is_constant(x) ? __bswap64_const(x) : \ From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 10:58:36 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 17D131065674; Fri, 23 Mar 2012 10:58:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 028C88FC14; Fri, 23 Mar 2012 10:58:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NAwZwm071135; Fri, 23 Mar 2012 10:58:35 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NAwZwt071133; Fri, 23 Mar 2012 10:58:35 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201203231058.q2NAwZwt071133@svn.freebsd.org> From: Dimitry Andric Date: Fri, 23 Mar 2012 10:58:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233350 - stable/9/usr.bin/netstat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 10:58:36 -0000 Author: dim Date: Fri Mar 23 10:58:35 2012 New Revision: 233350 URL: http://svn.freebsd.org/changeset/base/233350 Log: MFC r232748: After r232745, which makes sure __bswap16(), ntohs() and htons() return __uint16_t, we can partially undo r228668. Note the remark "Work around a clang false positive with format string warnings and ntohs macros (see LLVM PR 11313)" was actually incorrect. Before r232745, on some arches, the ntohs() macros did in fact return int, not uint16_t, so clang was right in warning about the %hu format string. Modified: stable/9/usr.bin/netstat/Makefile Directory Properties: stable/9/usr.bin/netstat/ (props changed) Modified: stable/9/usr.bin/netstat/Makefile ============================================================================== --- stable/9/usr.bin/netstat/Makefile Fri Mar 23 10:55:19 2012 (r233349) +++ stable/9/usr.bin/netstat/Makefile Fri Mar 23 10:58:35 2012 (r233350) @@ -8,9 +8,6 @@ SRCS= if.c inet.c main.c mbuf.c mroute.c unix.c atalk.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c WARNS?= 3 -# XXX: Work around a clang false positive with format string warnings -# and ntohs macros (see LLVM PR 11313). -NO_WFORMAT.clang= CFLAGS+=-fno-strict-aliasing CFLAGS+=-DIPSEC From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 11:01:05 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EE11106564A; Fri, 23 Mar 2012 11:01:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89BC68FC20; Fri, 23 Mar 2012 11:01:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NB15UU071283; Fri, 23 Mar 2012 11:01:05 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NB15m4071280; Fri, 23 Mar 2012 11:01:05 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201203231101.q2NB15m4071280@svn.freebsd.org> From: Dimitry Andric Date: Fri, 23 Mar 2012 11:01:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233351 - stable/9/sbin/fsdb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 11:01:05 -0000 Author: dim Date: Fri Mar 23 11:01:04 2012 New Revision: 233351 URL: http://svn.freebsd.org/changeset/base/233351 Log: MFC r232749: Partially undo r228693, by removing NO_WFORMAT.clang in fsdb's Makefile, and fixing the format string in sbin/fsdb/fsdbutil.c instead. Note the remark "Work around a problem with format string warnings and ntohs macros" was actually incorrect. The DIP(dp, di_nlink) macro invocation actually returned an int, due to its ternary expression, even though the di_nlink members of struct ufs1_dinode and struct ufs2_dinode are both defined as int16_t. Modified: stable/9/sbin/fsdb/Makefile stable/9/sbin/fsdb/fsdbutil.c Directory Properties: stable/9/sbin/fsdb/ (props changed) Modified: stable/9/sbin/fsdb/Makefile ============================================================================== --- stable/9/sbin/fsdb/Makefile Fri Mar 23 10:58:35 2012 (r233350) +++ stable/9/sbin/fsdb/Makefile Fri Mar 23 11:01:04 2012 (r233351) @@ -9,8 +9,6 @@ SRCS= fsdb.c fsdbutil.c \ pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c CFLAGS+= -I${.CURDIR}/../fsck_ffs WARNS?= 2 -# Work around a problem with format string warnings and ntohs macros. -NO_WFORMAT.clang= LDADD= -ledit -ltermcap DPADD= ${LIBEDIT} ${LIBTERMCAP} .PATH: ${.CURDIR}/../fsck_ffs ${.CURDIR}/../../sys/ufs/ffs Modified: stable/9/sbin/fsdb/fsdbutil.c ============================================================================== --- stable/9/sbin/fsdb/fsdbutil.c Fri Mar 23 10:58:35 2012 (r233350) +++ stable/9/sbin/fsdb/fsdbutil.c Fri Mar 23 11:01:04 2012 (r233351) @@ -195,7 +195,7 @@ printstat(const char *cp, ino_t inum, un blocks = DIP(dp, di_blocks); gen = DIP(dp, di_gen); - printf("LINKCNT=%hd FLAGS=%#x BLKCNT=%jx GEN=%jx\n", DIP(dp, di_nlink), + printf("LINKCNT=%d FLAGS=%#x BLKCNT=%jx GEN=%jx\n", DIP(dp, di_nlink), DIP(dp, di_flags), (intmax_t)blocks, (intmax_t)gen); } From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 11:26:55 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B844106566C; Fri, 23 Mar 2012 11:26:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2175B8FC0C; Fri, 23 Mar 2012 11:26:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NBQtdt072750; Fri, 23 Mar 2012 11:26:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NBQsKT072716; Fri, 23 Mar 2012 11:26:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203231126.q2NBQsKT072716@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 23 Mar 2012 11:26:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233353 - in stable/9/sys: cddl/compat/opensolaris/sys compat/ndis fs/cd9660 fs/devfs fs/ext2fs fs/msdosfs fs/nfsclient fs/nfsserver fs/pseudofs fs/udf i386/conf kern nfsclient sys ufs/... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 11:26:55 -0000 Author: kib Date: Fri Mar 23 11:26:54 2012 New Revision: 233353 URL: http://svn.freebsd.org/changeset/base/233353 Log: MFC r231949: Fix found places where uio_resid is truncated to int. Add the sysctl debug.iosize_max_clamp, enabled by default. Setting the sysctl to zero allows to perform the SSIZE_MAX-sized i/o requests from the usermode. MFC r232493: Remove unneeded cast to u_int. The values as small enough to fit into int, beside the use of MIN macro which performs type promotions. MFC r232494: Instead of incomplete handling of read(2)/write(2) return values that does not fit into registers, declare that we do not support this case using CTASSERT(), and remove endianess-unsafe code to split return value into td_retval. While there, change the style of the sysctl debug.iosize_max_clamp definition. MFC r232495: pipe_read(): change the type of size to int, and remove signed clamp. pipe_write(): change the type of desiredsize back to int, its value fits. Modified: stable/9/sys/cddl/compat/opensolaris/sys/vnode.h stable/9/sys/compat/ndis/subr_ndis.c stable/9/sys/fs/cd9660/cd9660_vnops.c stable/9/sys/fs/devfs/devfs_vnops.c stable/9/sys/fs/ext2fs/ext2_lookup.c stable/9/sys/fs/msdosfs/msdosfs_vnops.c stable/9/sys/fs/nfsclient/nfs_clbio.c stable/9/sys/fs/nfsclient/nfs_clvnops.c stable/9/sys/fs/nfsserver/nfs_nfsdstate.c stable/9/sys/fs/pseudofs/pseudofs_vnops.c stable/9/sys/fs/udf/udf_vnops.c stable/9/sys/kern/kern_ctf.c stable/9/sys/kern/kern_gzio.c stable/9/sys/kern/kern_ktrace.c stable/9/sys/kern/kern_linker.c stable/9/sys/kern/link_elf.c stable/9/sys/kern/link_elf_obj.c stable/9/sys/kern/subr_uio.c stable/9/sys/kern/sys_generic.c stable/9/sys/kern/sys_pipe.c stable/9/sys/kern/tty_ttydisc.c stable/9/sys/kern/uipc_mbuf.c stable/9/sys/kern/uipc_socket.c stable/9/sys/kern/uipc_syscalls.c stable/9/sys/kern/vfs_extattr.c stable/9/sys/kern/vfs_mountroot.c stable/9/sys/kern/vfs_syscalls.c stable/9/sys/kern/vfs_vnops.c stable/9/sys/nfsclient/nfs_bio.c stable/9/sys/sys/systm.h stable/9/sys/sys/vnode.h stable/9/sys/ufs/ffs/ffs_vnops.c stable/9/sys/ufs/ufs/ufs_lookup.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- stable/9/sys/cddl/compat/opensolaris/sys/vnode.h Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/cddl/compat/opensolaris/sys/vnode.h Fri Mar 23 11:26:54 2012 (r233353) @@ -223,7 +223,8 @@ zfs_vn_rdwr(enum uio_rw rw, vnode_t *vp, ssize_t *residp) { struct thread *td = curthread; - int error, vfslocked, resid; + int error, vfslocked; + ssize_t resid; ASSERT(ioflag == 0); ASSERT(ulimit == RLIM64_INFINITY); Modified: stable/9/sys/compat/ndis/subr_ndis.c ============================================================================== --- stable/9/sys/compat/ndis/subr_ndis.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/compat/ndis/subr_ndis.c Fri Mar 23 11:26:54 2012 (r233353) @@ -2862,7 +2862,8 @@ NdisMapFile(status, mappedbuffer, fileha struct thread *td = curthread; linker_file_t lf; caddr_t kldstart; - int error, resid, vfslocked; + int error, vfslocked; + ssize_t resid; struct vnode *vp; if (filehandle == NULL) { Modified: stable/9/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- stable/9/sys/fs/cd9660/cd9660_vnops.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/fs/cd9660/cd9660_vnops.c Fri Mar 23 11:26:54 2012 (r233353) @@ -318,8 +318,7 @@ cd9660_read(ap) do { lbn = lblkno(imp, uio->uio_offset); on = blkoff(imp, uio->uio_offset); - n = min((u_int)(imp->logical_block_size - on), - uio->uio_resid); + n = MIN(imp->logical_block_size - on, uio->uio_resid); diff = (off_t)ip->i_size - uio->uio_offset; if (diff <= 0) return (0); @@ -343,7 +342,7 @@ cd9660_read(ap) } else error = bread(vp, lbn, size, NOCRED, &bp); } - n = min(n, size - bp->b_resid); + n = MIN(n, size - bp->b_resid); if (error) { brelse(bp); return (error); Modified: stable/9/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/9/sys/fs/devfs/devfs_vnops.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/fs/devfs/devfs_vnops.c Fri Mar 23 11:26:54 2012 (r233353) @@ -1156,7 +1156,8 @@ static int devfs_read_f(struct file *fp, struct uio *uio, struct ucred *cred, int flags, struct thread *td) { struct cdev *dev; - int ioflag, error, ref, resid; + int ioflag, error, ref; + ssize_t resid; struct cdevsw *dsw; struct file *fpop; @@ -1634,7 +1635,8 @@ static int devfs_write_f(struct file *fp, struct uio *uio, struct ucred *cred, int flags, struct thread *td) { struct cdev *dev; - int error, ioflag, ref, resid; + int error, ioflag, ref; + ssize_t resid; struct cdevsw *dsw; struct file *fpop; Modified: stable/9/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_lookup.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/fs/ext2fs/ext2_lookup.c Fri Mar 23 11:26:54 2012 (r233353) @@ -1001,7 +1001,8 @@ ext2_dirempty(ip, parentino, cred) off_t off; struct dirtemplate dbuf; struct ext2fs_direct_2 *dp = (struct ext2fs_direct_2 *)&dbuf; - int error, count, namlen; + int error, namlen; + ssize_t count; #define MINDIRSIZ (sizeof(struct dirtemplate) / 2) for (off = 0; off < ip->i_size; off += dp->e2d_reclen) { Modified: stable/9/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_vnops.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/fs/msdosfs/msdosfs_vnops.c Fri Mar 23 11:26:54 2012 (r233353) @@ -543,7 +543,7 @@ msdosfs_read(ap) int error = 0; int blsize; int isadir; - int orig_resid; + ssize_t orig_resid; u_int n; u_long diff; u_long on; @@ -643,7 +643,7 @@ msdosfs_write(ap) { int n; int croffset; - int resid; + ssize_t resid; u_long osize; int error = 0; u_long count; Modified: stable/9/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clbio.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/fs/nfsclient/nfs_clbio.c Fri Mar 23 11:26:54 2012 (r233353) @@ -570,7 +570,7 @@ ncl_bioread(struct vnode *vp, struct uio n = 0; if (on < bcount) - n = min((unsigned)(bcount - on), uio->uio_resid); + n = MIN((unsigned)(bcount - on), uio->uio_resid); break; case VLNK: NFSINCRGLOBAL(newnfsstats.biocache_readlinks); @@ -589,7 +589,7 @@ ncl_bioread(struct vnode *vp, struct uio return (error); } } - n = min(uio->uio_resid, NFS_MAXPATHLEN - bp->b_resid); + n = MIN(uio->uio_resid, NFS_MAXPATHLEN - bp->b_resid); on = 0; break; case VDIR: @@ -757,8 +757,8 @@ nfs_directio_write(vp, uiop, cred, iofla struct iovec iov; do_sync: while (uiop->uio_resid > 0) { - size = min(uiop->uio_resid, wsize); - size = min(uiop->uio_iov->iov_len, size); + size = MIN(uiop->uio_resid, wsize); + size = MIN(uiop->uio_iov->iov_len, size); iov.iov_base = uiop->uio_iov->iov_base; iov.iov_len = size; uio.uio_iov = &iov; @@ -806,8 +806,8 @@ do_sync: * in NFS directio access. */ while (uiop->uio_resid > 0) { - size = min(uiop->uio_resid, wsize); - size = min(uiop->uio_iov->iov_len, size); + size = MIN(uiop->uio_resid, wsize); + size = MIN(uiop->uio_iov->iov_len, size); bp = getpbuf(&ncl_pbuf_freecnt); t_uio = malloc(sizeof(struct uio), M_NFSDIRECTIO, M_WAITOK); t_iov = malloc(sizeof(struct iovec), M_NFSDIRECTIO, M_WAITOK); @@ -1038,7 +1038,7 @@ flush_and_restart: NFSINCRGLOBAL(newnfsstats.biocache_writes); lbn = uio->uio_offset / biosize; on = uio->uio_offset & (biosize-1); - n = min((unsigned)(biosize - on), uio->uio_resid); + n = MIN((unsigned)(biosize - on), uio->uio_resid); again: /* * Handle direct append and file extension cases, calculate @@ -1587,7 +1587,7 @@ ncl_doio(struct vnode *vp, struct buf *b * writes, but that is not possible any longer. */ int nread = bp->b_bcount - uiop->uio_resid; - int left = uiop->uio_resid; + ssize_t left = uiop->uio_resid; if (left > 0) bzero((char *)bp->b_data + nread, left); Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvnops.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/fs/nfsclient/nfs_clvnops.c Fri Mar 23 11:26:54 2012 (r233353) @@ -2180,7 +2180,8 @@ nfs_readdir(struct vop_readdir_args *ap) struct vnode *vp = ap->a_vp; struct nfsnode *np = VTONFS(vp); struct uio *uio = ap->a_uio; - int tresid, error = 0; + ssize_t tresid; + int error = 0; struct vattr vattr; if (vp->v_type != VDIR) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdstate.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/fs/nfsserver/nfs_nfsdstate.c Fri Mar 23 11:26:54 2012 (r233353) @@ -3962,7 +3962,7 @@ nfsrv_setupstable(NFSPROC_T *p) struct nfst_rec *tsp; int error, i, tryagain; off_t off = 0; - int aresid, len; + ssize_t aresid, len; struct timeval curtime; /* Modified: stable/9/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- stable/9/sys/fs/pseudofs/pseudofs_vnops.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/fs/pseudofs/pseudofs_vnops.c Fri Mar 23 11:26:54 2012 (r233353) @@ -616,7 +616,8 @@ pfs_read(struct vop_read_args *va) struct proc *proc; struct sbuf *sb = NULL; int error, locked; - unsigned int buflen, offset, resid; + off_t offset; + ssize_t buflen, resid; PFS_TRACE(("%s", pn->pn_name)); pfs_assert_not_owned(pn); Modified: stable/9/sys/fs/udf/udf_vnops.c ============================================================================== --- stable/9/sys/fs/udf/udf_vnops.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/fs/udf/udf_vnops.c Fri Mar 23 11:26:54 2012 (r233353) @@ -439,8 +439,9 @@ udf_read(struct vop_read_args *ap) uint8_t *data; daddr_t lbn, rablock; off_t diff, fsize; + ssize_t n; int error = 0; - long size, n, on; + long size, on; if (uio->uio_resid == 0) return (0); Modified: stable/9/sys/kern/kern_ctf.c ============================================================================== --- stable/9/sys/kern/kern_ctf.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/kern_ctf.c Fri Mar 23 11:26:54 2012 (r233353) @@ -68,7 +68,7 @@ link_elf_ctf_get(linker_file_t lf, linke int flags; int i; int nbytes; - int resid; + ssize_t resid; int vfslocked; size_t sz; struct nameidata nd; Modified: stable/9/sys/kern/kern_gzio.c ============================================================================== --- stable/9/sys/kern/kern_gzio.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/kern_gzio.c Fri Mar 23 11:26:54 2012 (r233353) @@ -97,7 +97,7 @@ gzFile gz_open (path, mode, vp) gz_stream *s; char fmode[80]; /* copy of mode, without the compression level */ char *m = fmode; - int resid; + ssize_t resid; int error; char buf[GZ_HEADER_LEN + 1]; @@ -342,7 +342,7 @@ local void putU32 (s, x) { uint32_t xx; off_t curoff = s->outoff; - int resid; + ssize_t resid; #if BYTE_ORDER == BIG_ENDIAN xx = bswap32(x); Modified: stable/9/sys/kern/kern_ktrace.c ============================================================================== --- stable/9/sys/kern/kern_ktrace.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/kern_ktrace.c Fri Mar 23 11:26:54 2012 (r233353) @@ -682,7 +682,7 @@ ktrgenio(fd, rw, uio, error) } uio->uio_offset = 0; uio->uio_rw = UIO_WRITE; - datalen = imin(uio->uio_resid, ktr_geniosize); + datalen = MIN(uio->uio_resid, ktr_geniosize); buf = malloc(datalen, M_KTRACE, M_WAITOK); error = uiomove(buf, datalen, uio); free(uio, M_IOV); Modified: stable/9/sys/kern/kern_linker.c ============================================================================== --- stable/9/sys/kern/kern_linker.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/kern_linker.c Fri Mar 23 11:26:54 2012 (r233353) @@ -1747,7 +1747,8 @@ linker_hints_lookup(const char *path, in struct vattr vattr, mattr; u_char *hints = NULL; u_char *cp, *recptr, *bufend, *result, *best, *pathbuf, *sep; - int error, ival, bestver, *intp, reclen, found, flags, clen, blen; + int error, ival, bestver, *intp, found, flags, clen, blen; + ssize_t reclen; int vfslocked = 0; result = NULL; @@ -1792,7 +1793,7 @@ linker_hints_lookup(const char *path, in VFS_UNLOCK_GIANT(vfslocked); nd.ni_vp = NULL; if (reclen != 0) { - printf("can't read %d\n", reclen); + printf("can't read %zd\n", reclen); goto bad; } intp = (int *)hints; Modified: stable/9/sys/kern/link_elf.c ============================================================================== --- stable/9/sys/kern/link_elf.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/link_elf.c Fri Mar 23 11:26:54 2012 (r233353) @@ -655,7 +655,8 @@ link_elf_load_file(linker_class_t cls, c Elf_Addr base_vaddr; Elf_Addr base_vlimit; int error = 0; - int resid, flags; + ssize_t resid; + int flags; elf_file_t ef; linker_file_t lf; Elf_Shdr *shdr; Modified: stable/9/sys/kern/link_elf_obj.c ============================================================================== --- stable/9/sys/kern/link_elf_obj.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/link_elf_obj.c Fri Mar 23 11:26:54 2012 (r233353) @@ -440,7 +440,8 @@ link_elf_load_file(linker_class_t cls, c vm_offset_t mapbase; size_t mapsize; int error = 0; - int resid, flags; + ssize_t resid; + int flags; elf_file_t ef; linker_file_t lf; int symtabindex; Modified: stable/9/sys/kern/subr_uio.c ============================================================================== --- stable/9/sys/kern/subr_uio.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/subr_uio.c Fri Mar 23 11:26:54 2012 (r233353) @@ -171,7 +171,7 @@ uiomove_faultflag(void *cp, int n, struc { struct thread *td; struct iovec *iov; - u_int cnt; + size_t cnt; int error, newflags, save; td = curthread; @@ -245,14 +245,14 @@ out: int uiomove_frombuf(void *buf, int buflen, struct uio *uio) { - unsigned int offset, n; + size_t offset, n; if (uio->uio_offset < 0 || uio->uio_resid < 0 || (offset = uio->uio_offset) != uio->uio_offset) return (EINVAL); if (buflen <= 0 || offset >= buflen) return (0); - if ((n = buflen - offset) > INT_MAX) + if ((n = buflen - offset) > IOSIZE_MAX) return (EINVAL); return (uiomove((char *)buf + offset, n, uio)); } @@ -479,7 +479,7 @@ copyinuio(struct iovec *iovp, u_int iovc uio->uio_offset = -1; uio->uio_resid = 0; for (i = 0; i < iovcnt; i++) { - if (iov->iov_len > INT_MAX - uio->uio_resid) { + if (iov->iov_len > IOSIZE_MAX - uio->uio_resid) { free(uio, M_IOV); return (EINVAL); } Modified: stable/9/sys/kern/sys_generic.c ============================================================================== --- stable/9/sys/kern/sys_generic.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/sys_generic.c Fri Mar 23 11:26:54 2012 (r233353) @@ -74,6 +74,16 @@ __FBSDID("$FreeBSD$"); #include +int iosize_max_clamp = 1; +SYSCTL_INT(_debug, OID_AUTO, iosize_max_clamp, CTLFLAG_RW, + &iosize_max_clamp, 0, "Clamp max i/o size to INT_MAX"); +/* + * Assert that the return value of read(2) and write(2) syscalls fits + * into a register. If not, an architecture will need to provide the + * usermode wrappers to reconstruct the result. + */ +CTASSERT(sizeof(register_t) >= sizeof(size_t)); + static MALLOC_DEFINE(M_IOCTLOPS, "ioctlops", "ioctl data buffer"); static MALLOC_DEFINE(M_SELECT, "select", "select() buffer"); MALLOC_DEFINE(M_IOV, "iov", "large iov's"); @@ -145,7 +155,7 @@ sys_read(td, uap) struct iovec aiov; int error; - if (uap->nbyte > INT_MAX) + if (uap->nbyte > IOSIZE_MAX) return (EINVAL); aiov.iov_base = uap->buf; aiov.iov_len = uap->nbyte; @@ -178,7 +188,7 @@ sys_pread(td, uap) struct iovec aiov; int error; - if (uap->nbyte > INT_MAX) + if (uap->nbyte > IOSIZE_MAX) return (EINVAL); aiov.iov_base = uap->buf; aiov.iov_len = uap->nbyte; @@ -354,7 +364,7 @@ sys_write(td, uap) struct iovec aiov; int error; - if (uap->nbyte > INT_MAX) + if (uap->nbyte > IOSIZE_MAX) return (EINVAL); aiov.iov_base = (void *)(uintptr_t)uap->buf; aiov.iov_len = uap->nbyte; @@ -387,7 +397,7 @@ sys_pwrite(td, uap) struct iovec aiov; int error; - if (uap->nbyte > INT_MAX) + if (uap->nbyte > IOSIZE_MAX) return (EINVAL); aiov.iov_base = (void *)(uintptr_t)uap->buf; aiov.iov_len = uap->nbyte; Modified: stable/9/sys/kern/sys_pipe.c ============================================================================== --- stable/9/sys/kern/sys_pipe.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/sys_pipe.c Fri Mar 23 11:26:54 2012 (r233353) @@ -585,7 +585,7 @@ pipe_read(fp, uio, active_cred, flags, t struct pipe *rpipe = fp->f_data; int error; int nread = 0; - u_int size; + int size; PIPE_LOCK(rpipe); ++rpipe->pipe_busy; @@ -617,8 +617,8 @@ pipe_read(fp, uio, active_cred, flags, t size = rpipe->pipe_buffer.size - rpipe->pipe_buffer.out; if (size > rpipe->pipe_buffer.cnt) size = rpipe->pipe_buffer.cnt; - if (size > (u_int) uio->uio_resid) - size = (u_int) uio->uio_resid; + if (size > uio->uio_resid) + size = uio->uio_resid; PIPE_UNLOCK(rpipe); error = uiomove( @@ -650,7 +650,7 @@ pipe_read(fp, uio, active_cred, flags, t */ } else if ((size = rpipe->pipe_map.cnt) && (rpipe->pipe_state & PIPE_DIRECTW)) { - if (size > (u_int) uio->uio_resid) + if (size > uio->uio_resid) size = (u_int) uio->uio_resid; PIPE_UNLOCK(rpipe); @@ -764,9 +764,10 @@ pipe_build_write_buffer(wpipe, uio) KASSERT(wpipe->pipe_state & PIPE_DIRECTW, ("Clone attempt on non-direct write pipe!")); - size = (u_int) uio->uio_iov->iov_len; - if (size > wpipe->pipe_buffer.size) - size = wpipe->pipe_buffer.size; + if (uio->uio_iov->iov_len > wpipe->pipe_buffer.size) + size = wpipe->pipe_buffer.size; + else + size = uio->uio_iov->iov_len; if ((i = vm_fault_quick_hold_pages(&curproc->p_vmspace->vm_map, (vm_offset_t)uio->uio_iov->iov_base, size, VM_PROT_READ, @@ -960,7 +961,8 @@ pipe_write(fp, uio, active_cred, flags, int flags; { int error = 0; - int desiredsize, orig_resid; + int desiredsize; + ssize_t orig_resid; struct pipe *wpipe, *rpipe; rpipe = fp->f_data; Modified: stable/9/sys/kern/tty_ttydisc.c ============================================================================== --- stable/9/sys/kern/tty_ttydisc.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/tty_ttydisc.c Fri Mar 23 11:26:54 2012 (r233353) @@ -180,7 +180,7 @@ static int ttydisc_read_raw_no_timer(struct tty *tp, struct uio *uio, int ioflag) { size_t vmin = tp->t_termios.c_cc[VMIN]; - int oresid = uio->uio_resid; + ssize_t oresid = uio->uio_resid; int error; MPASS(tp->t_termios.c_cc[VTIME] == 0); @@ -265,7 +265,7 @@ static int ttydisc_read_raw_interbyte_timer(struct tty *tp, struct uio *uio, int ioflag) { size_t vmin = tp->t_termios.c_cc[VMIN]; - int oresid = uio->uio_resid; + ssize_t oresid = uio->uio_resid; int error; MPASS(tp->t_termios.c_cc[VMIN] != 0); @@ -1174,7 +1174,7 @@ int ttydisc_getc_uio(struct tty *tp, struct uio *uio) { int error = 0; - int obytes = uio->uio_resid; + ssize_t obytes = uio->uio_resid; size_t len; char buf[TTY_STACKBUF]; Modified: stable/9/sys/kern/uipc_mbuf.c ============================================================================== --- stable/9/sys/kern/uipc_mbuf.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/uipc_mbuf.c Fri Mar 23 11:26:54 2012 (r233353) @@ -1726,7 +1726,8 @@ struct mbuf * m_uiotombuf(struct uio *uio, int how, int len, int align, int flags) { struct mbuf *m, *mb; - int error, length, total; + int error, length; + ssize_t total; int progress = 0; /* Modified: stable/9/sys/kern/uipc_socket.c ============================================================================== --- stable/9/sys/kern/uipc_socket.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/uipc_socket.c Fri Mar 23 11:26:54 2012 (r233353) @@ -887,7 +887,8 @@ sosend_copyin(struct uio *uio, struct mb int flags) { struct mbuf *m, **mp, *top; - long len, resid; + long len; + ssize_t resid; int error; #ifdef ZERO_COPY_SOCKETS int cow_send; @@ -987,7 +988,8 @@ int sosend_dgram(struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *td) { - long space, resid; + long space; + ssize_t resid; int clen = 0, error, dontroute; #ifdef ZERO_COPY_SOCKETS int atomic = sosendallatonce(so) || top; @@ -1159,7 +1161,8 @@ int sosend_generic(struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *td) { - long space, resid; + long space; + ssize_t resid; int clen = 0, error, dontroute; int atomic = sosendallatonce(so) || top; @@ -1456,11 +1459,12 @@ soreceive_generic(struct socket *so, str struct mbuf **mp0, struct mbuf **controlp, int *flagsp) { struct mbuf *m, **mp; - int flags, len, error, offset; + int flags, error, offset; + ssize_t len; struct protosw *pr = so->so_proto; struct mbuf *nextrecord; int moff, type = 0; - int orig_resid = uio->uio_resid; + ssize_t orig_resid = uio->uio_resid; mp = mp0; if (psa != NULL) @@ -2119,7 +2123,8 @@ soreceive_dgram(struct socket *so, struc struct mbuf **mp0, struct mbuf **controlp, int *flagsp) { struct mbuf *m, *m2; - int flags, len, error; + int flags, error; + ssize_t len; struct protosw *pr = so->so_proto; struct mbuf *nextrecord; Modified: stable/9/sys/kern/uipc_syscalls.c ============================================================================== --- stable/9/sys/kern/uipc_syscalls.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/uipc_syscalls.c Fri Mar 23 11:26:54 2012 (r233353) @@ -756,8 +756,8 @@ kern_sendit(td, s, mp, flags, control, s struct uio auio; struct iovec *iov; struct socket *so; - int i; - int len, error; + int i, error; + ssize_t len; cap_rights_t rights; #ifdef KTRACE struct uio *ktruio = NULL; @@ -956,7 +956,7 @@ kern_recvit(td, s, mp, fromseg, controlp struct uio auio; struct iovec *iov; int i; - socklen_t len; + ssize_t len; int error; struct mbuf *m, *control = 0; caddr_t ctlbuf; @@ -1007,19 +1007,19 @@ kern_recvit(td, s, mp, fromseg, controlp (mp->msg_control || controlp) ? &control : (struct mbuf **)0, &mp->msg_flags); if (error) { - if (auio.uio_resid != (int)len && (error == ERESTART || + if (auio.uio_resid != len && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; } #ifdef KTRACE if (ktruio != NULL) { - ktruio->uio_resid = (int)len - auio.uio_resid; + ktruio->uio_resid = len - auio.uio_resid; ktrgenio(s, UIO_READ, ktruio, error); } #endif if (error) goto out; - td->td_retval[0] = (int)len - auio.uio_resid; + td->td_retval[0] = len - auio.uio_resid; if (mp->msg_name) { len = mp->msg_namelen; if (len <= 0 || fromsa == 0) @@ -2086,7 +2086,8 @@ retry_space: else if (uap->flags & SF_NODISKIO) error = EBUSY; else { - int bsize, resid; + int bsize; + ssize_t resid; /* * Ensure that our page is still around @@ -2518,7 +2519,8 @@ sys_sctp_generic_sendmsg_iov(td, uap) struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; struct socket *so; struct file *fp = NULL; - int error=0, len, i; + int error=0, i; + ssize_t len; struct sockaddr *to = NULL; #ifdef KTRACE struct uio *ktruio = NULL; @@ -2649,7 +2651,8 @@ sys_sctp_generic_recvmsg(td, uap) struct file *fp = NULL; struct sockaddr *fromsa; int fromlen; - int len, i, msg_flags; + ssize_t len; + int i, msg_flags; int error = 0; #ifdef KTRACE struct uio *ktruio = NULL; @@ -2727,7 +2730,7 @@ sys_sctp_generic_recvmsg(td, uap) (struct sctp_sndrcvinfo *)&sinfo, 1); CURVNET_RESTORE(); if (error) { - if (auio.uio_resid != (int)len && (error == ERESTART || + if (auio.uio_resid != len && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; } else { @@ -2736,13 +2739,13 @@ sys_sctp_generic_recvmsg(td, uap) } #ifdef KTRACE if (ktruio != NULL) { - ktruio->uio_resid = (int)len - auio.uio_resid; + ktruio->uio_resid = len - auio.uio_resid; ktrgenio(uap->sd, UIO_READ, ktruio, error); } #endif /* KTRACE */ if (error) goto out; - td->td_retval[0] = (int)len - auio.uio_resid; + td->td_retval[0] = len - auio.uio_resid; if (fromlen && uap->from) { len = fromlen; @@ -2750,7 +2753,7 @@ sys_sctp_generic_recvmsg(td, uap) len = 0; else { len = MIN(len, fromsa->sa_len); - error = copyout(fromsa, uap->from, (unsigned)len); + error = copyout(fromsa, uap->from, (size_t)len); if (error) goto out; } Modified: stable/9/sys/kern/vfs_extattr.c ============================================================================== --- stable/9/sys/kern/vfs_extattr.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/vfs_extattr.c Fri Mar 23 11:26:54 2012 (r233353) @@ -181,7 +181,7 @@ extattr_set_vp(struct vnode *vp, int att auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_offset = 0; - if (nbytes > INT_MAX) { + if (nbytes > IOSIZE_MAX) { error = EINVAL; goto done; } @@ -355,7 +355,7 @@ extattr_get_vp(struct vnode *vp, int att auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_offset = 0; - if (nbytes > INT_MAX) { + if (nbytes > IOSIZE_MAX) { error = EINVAL; goto done; } @@ -672,7 +672,7 @@ extattr_list_vp(struct vnode *vp, int at auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_offset = 0; - if (nbytes > INT_MAX) { + if (nbytes > IOSIZE_MAX) { error = EINVAL; goto done; } Modified: stable/9/sys/kern/vfs_mountroot.c ============================================================================== --- stable/9/sys/kern/vfs_mountroot.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/vfs_mountroot.c Fri Mar 23 11:26:54 2012 (r233353) @@ -871,9 +871,8 @@ vfs_mountroot_readconf(struct thread *td static char buf[128]; struct nameidata nd; off_t ofs; - int error, flags; - int len, resid; - int vfslocked; + ssize_t resid; + int error, flags, len, vfslocked; NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, "/.mount.conf", td); Modified: stable/9/sys/kern/vfs_syscalls.c ============================================================================== --- stable/9/sys/kern/vfs_syscalls.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/vfs_syscalls.c Fri Mar 23 11:26:54 2012 (r233353) @@ -2691,7 +2691,7 @@ kern_readlinkat(struct thread *td, int f struct nameidata nd; int vfslocked; - if (count > INT_MAX) + if (count > IOSIZE_MAX) return (EINVAL); NDINIT_AT(&nd, LOOKUP, NOFOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE | @@ -4152,7 +4152,8 @@ kern_getdirentries(struct thread *td, in int error, eofflag; AUDIT_ARG_FD(fd); - if (count > INT_MAX) + auio.uio_resid = count; + if (auio.uio_resid > IOSIZE_MAX) return (EINVAL); if ((error = getvnode(td->td_proc->p_fd, fd, CAP_READ | CAP_SEEK, &fp)) != 0) @@ -4176,7 +4177,6 @@ unionread: auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_USERSPACE; auio.uio_td = td; - auio.uio_resid = count; vn_lock(vp, LK_SHARED | LK_RETRY); AUDIT_ARG_VNODE1(vp); loff = auio.uio_offset = fp->f_offset; Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/kern/vfs_vnops.c Fri Mar 23 11:26:54 2012 (r233353) @@ -373,7 +373,7 @@ vn_rdwr(rw, vp, base, len, offset, segfl int ioflg; struct ucred *active_cred; struct ucred *file_cred; - int *aresid; + ssize_t *aresid; struct thread *td; { struct uio auio; @@ -470,7 +470,7 @@ vn_rdwr_inchunks(rw, vp, base, len, offs struct thread *td; { int error = 0; - int iaresid; + ssize_t iaresid; VFS_ASSERT_GIANT(vp->v_mount); Modified: stable/9/sys/nfsclient/nfs_bio.c ============================================================================== --- stable/9/sys/nfsclient/nfs_bio.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/nfsclient/nfs_bio.c Fri Mar 23 11:26:54 2012 (r233353) @@ -564,7 +564,7 @@ nfs_bioread(struct vnode *vp, struct uio n = 0; if (on < bcount) - n = min((unsigned)(bcount - on), uio->uio_resid); + n = MIN((unsigned)(bcount - on), uio->uio_resid); break; case VLNK: nfsstats.biocache_readlinks++; @@ -583,7 +583,7 @@ nfs_bioread(struct vnode *vp, struct uio return (error); } } - n = min(uio->uio_resid, NFS_MAXPATHLEN - bp->b_resid); + n = MIN(uio->uio_resid, NFS_MAXPATHLEN - bp->b_resid); on = 0; break; case VDIR: @@ -751,8 +751,8 @@ nfs_directio_write(vp, uiop, cred, iofla struct iovec iov; do_sync: while (uiop->uio_resid > 0) { - size = min(uiop->uio_resid, wsize); - size = min(uiop->uio_iov->iov_len, size); + size = MIN(uiop->uio_resid, wsize); + size = MIN(uiop->uio_iov->iov_len, size); iov.iov_base = uiop->uio_iov->iov_base; iov.iov_len = size; uio.uio_iov = &iov; @@ -800,8 +800,8 @@ do_sync: * in NFS directio access. */ while (uiop->uio_resid > 0) { - size = min(uiop->uio_resid, wsize); - size = min(uiop->uio_iov->iov_len, size); + size = MIN(uiop->uio_resid, wsize); + size = MIN(uiop->uio_iov->iov_len, size); bp = getpbuf(&nfs_pbuf_freecnt); t_uio = malloc(sizeof(struct uio), M_NFSDIRECTIO, M_WAITOK); t_iov = malloc(sizeof(struct iovec), M_NFSDIRECTIO, M_WAITOK); @@ -1029,7 +1029,7 @@ flush_and_restart: nfsstats.biocache_writes++; lbn = uio->uio_offset / biosize; on = uio->uio_offset & (biosize-1); - n = min((unsigned)(biosize - on), uio->uio_resid); + n = MIN((unsigned)(biosize - on), uio->uio_resid); again: /* * Handle direct append and file extension cases, calculate Modified: stable/9/sys/sys/systm.h ============================================================================== --- stable/9/sys/sys/systm.h Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/sys/systm.h Fri Mar 23 11:26:54 2012 (r233353) @@ -127,6 +127,9 @@ extern char **kenvp; extern const void *zero_region; /* address space maps to a zeroed page */ +extern int iosize_max_clamp; +#define IOSIZE_MAX (iosize_max_clamp ? INT_MAX : SSIZE_MAX) + /* * General function declarations. */ Modified: stable/9/sys/sys/vnode.h ============================================================================== --- stable/9/sys/sys/vnode.h Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/sys/vnode.h Fri Mar 23 11:26:54 2012 (r233353) @@ -656,7 +656,7 @@ void vn_pages_remove(struct vnode *vp, v int vn_pollrecord(struct vnode *vp, struct thread *p, int events); int vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base, int len, off_t offset, enum uio_seg segflg, int ioflg, - struct ucred *active_cred, struct ucred *file_cred, int *aresid, + struct ucred *active_cred, struct ucred *file_cred, ssize_t *aresid, struct thread *td); int vn_rdwr_inchunks(enum uio_rw rw, struct vnode *vp, void *base, size_t len, off_t offset, enum uio_seg segflg, int ioflg, Modified: stable/9/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_vnops.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/ufs/ffs/ffs_vnops.c Fri Mar 23 11:26:54 2012 (r233353) @@ -419,7 +419,8 @@ ffs_read(ap) ufs_lbn_t lbn, nextlbn; off_t bytesinfile; long size, xfersize, blkoffset; - int error, orig_resid; + ssize_t orig_resid; + int error; int seqcount; int ioflag; @@ -632,8 +633,9 @@ ffs_write(ap) struct buf *bp; ufs_lbn_t lbn; off_t osize; + ssize_t resid; int seqcount; - int blkoffset, error, flags, ioflag, resid, size, xfersize; + int blkoffset, error, flags, ioflag, size, xfersize; vp = ap->a_vp; uio = ap->a_uio; @@ -870,7 +872,8 @@ ffs_extread(struct vnode *vp, struct uio ufs_lbn_t lbn, nextlbn; off_t bytesinfile; long size, xfersize, blkoffset; - int error, orig_resid; + ssize_t orig_resid; + int error; ip = VTOI(vp); fs = ip->i_fs; @@ -1023,7 +1026,8 @@ ffs_extwrite(struct vnode *vp, struct ui struct buf *bp; ufs_lbn_t lbn; off_t osize; - int blkoffset, error, flags, resid, size, xfersize; + ssize_t resid; + int blkoffset, error, flags, size, xfersize; ip = VTOI(vp); fs = ip->i_fs; Modified: stable/9/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- stable/9/sys/ufs/ufs/ufs_lookup.c Fri Mar 23 11:18:07 2012 (r233352) +++ stable/9/sys/ufs/ufs/ufs_lookup.c Fri Mar 23 11:26:54 2012 (r233353) @@ -1337,7 +1337,8 @@ ufs_dirempty(ip, parentino, cred) doff_t off; struct dirtemplate dbuf; struct direct *dp = (struct direct *)&dbuf; - int error, count, namlen; + int error, namlen; + ssize_t count; #define MINDIRSIZ (sizeof (struct dirtemplate) / 2) for (off = 0; off < ip->i_size; off += dp->d_reclen) { From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 12:01:33 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F1F371065678; Fri, 23 Mar 2012 12:01:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCCD88FC23; Fri, 23 Mar 2012 12:01:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NC1XWS075191; Fri, 23 Mar 2012 12:01:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NC1Xt3075189; Fri, 23 Mar 2012 12:01:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231201.q2NC1Xt3075189@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 12:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233355 - in stable/9/sys: i386/conf kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 12:01:34 -0000 Author: jhb Date: Fri Mar 23 12:01:33 2012 New Revision: 233355 URL: http://svn.freebsd.org/changeset/base/233355 Log: MFC 232265: Properly clear a device's devclass if DEVICE_ATTACH() fails if the device does not have a fixed devclass. Modified: stable/9/sys/kern/subr_bus.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/kern/subr_bus.c ============================================================================== --- stable/9/sys/kern/subr_bus.c Fri Mar 23 11:35:01 2012 (r233354) +++ stable/9/sys/kern/subr_bus.c Fri Mar 23 12:01:33 2012 (r233355) @@ -2726,9 +2726,8 @@ device_attach(device_t dev) if ((error = DEVICE_ATTACH(dev)) != 0) { printf("device_attach: %s%d attach returned %d\n", dev->driver->name, dev->unit, error); - /* Unset the class; set in device_probe_child */ - if (dev->devclass == NULL) - (void)device_set_devclass(dev, NULL); + if (!(dev->flags & DF_FIXEDCLASS)) + devclass_delete_device(dev->devclass, dev); (void)device_set_driver(dev, NULL); device_sysctl_fini(dev); dev->state = DS_NOTPRESENT; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 12:02:01 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 284E61065676; Fri, 23 Mar 2012 12:02:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1BD08FC1B; Fri, 23 Mar 2012 12:02:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NC2023075241; Fri, 23 Mar 2012 12:02:00 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NC20SV075239; Fri, 23 Mar 2012 12:02:00 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231202.q2NC20SV075239@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 12:02:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233356 - in stable/8/sys: i386/conf kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 12:02:01 -0000 Author: jhb Date: Fri Mar 23 12:02:00 2012 New Revision: 233356 URL: http://svn.freebsd.org/changeset/base/233356 Log: MFC 232265: Properly clear a device's devclass if DEVICE_ATTACH() fails if the device does not have a fixed devclass. Modified: stable/8/sys/kern/subr_bus.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Fri Mar 23 12:01:33 2012 (r233355) +++ stable/8/sys/kern/subr_bus.c Fri Mar 23 12:02:00 2012 (r233356) @@ -2729,9 +2729,8 @@ device_attach(device_t dev) if ((error = DEVICE_ATTACH(dev)) != 0) { printf("device_attach: %s%d attach returned %d\n", dev->driver->name, dev->unit, error); - /* Unset the class; set in device_probe_child */ - if (dev->devclass == NULL) - (void)device_set_devclass(dev, NULL); + if (!(dev->flags & DF_FIXEDCLASS)) + devclass_delete_device(dev->devclass, dev); (void)device_set_driver(dev, NULL); device_sysctl_fini(dev); dev->state = DS_NOTPRESENT; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 12:05:52 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8195D1065670; Fri, 23 Mar 2012 12:05:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 428538FC27; Fri, 23 Mar 2012 12:05:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NC5qZl075451; Fri, 23 Mar 2012 12:05:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NC5qpw075449; Fri, 23 Mar 2012 12:05:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231205.q2NC5qpw075449@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 12:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233358 - in stable/9/sys: i386/conf kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 12:05:52 -0000 Author: jhb Date: Fri Mar 23 12:05:51 2012 New Revision: 233358 URL: http://svn.freebsd.org/changeset/base/233358 Log: MFC 232218: Clear the a device's description string anytime it's driver changes. Descriptions are specific to drivers and we don't change drivers on attached devices. This fixes a few places where we were not clearing the description when detaching a driver (e.g. if device_attach() failed). While here, fix a few other nits: - Remove spurious call to remove a device's driver from devclass_driver_deleted(). device_detach() removes it already. - Fix a typo. Modified: stable/9/sys/kern/subr_bus.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/kern/subr_bus.c ============================================================================== --- stable/9/sys/kern/subr_bus.c Fri Mar 23 12:04:44 2012 (r233357) +++ stable/9/sys/kern/subr_bus.c Fri Mar 23 12:05:51 2012 (r233358) @@ -1129,7 +1129,6 @@ devclass_driver_deleted(devclass_t buscl dev->parent->devclass == busclass) { if ((error = device_detach(dev)) != 0) return (error); - (void)device_set_driver(dev, NULL); BUS_PROBE_NOMATCH(dev->parent, dev); devnomatch(dev); dev->flags |= DF_DONENOMATCH; @@ -2091,7 +2090,7 @@ device_probe_child(device_t dev, device_ /* XXX What happens if we rebid and got no best? */ if (best) { /* - * If this device was atached, and we were asked to + * If this device was attached, and we were asked to * rescan, and it is a different driver, then we have * to detach the old driver and reattach this new one. * Note, we don't have to check for DF_REBID here @@ -2598,6 +2597,7 @@ device_set_driver(device_t dev, driver_t free(dev->softc, M_BUS_SC); dev->softc = NULL; } + device_set_desc(dev, NULL); kobj_delete((kobj_t) dev, NULL); dev->driver = driver; if (driver) { @@ -2782,7 +2782,6 @@ device_detach(device_t dev) dev->state = DS_NOTPRESENT; (void)device_set_driver(dev, NULL); - device_set_desc(dev, NULL); device_sysctl_fini(dev); return (0); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 12:06:33 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 552C11065690; Fri, 23 Mar 2012 12:06:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 260CB8FC15; Fri, 23 Mar 2012 12:06:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NC6Ww2075513; Fri, 23 Mar 2012 12:06:32 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NC6WRc075511; Fri, 23 Mar 2012 12:06:32 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231206.q2NC6WRc075511@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 12:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233359 - in stable/8/sys: i386/conf kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 12:06:33 -0000 Author: jhb Date: Fri Mar 23 12:06:32 2012 New Revision: 233359 URL: http://svn.freebsd.org/changeset/base/233359 Log: MFC 232218: Clear the a device's description string anytime it's driver changes. Descriptions are specific to drivers and we don't change drivers on attached devices. This fixes a few places where we were not clearing the description when detaching a driver (e.g. if device_attach() failed). While here, fix a few other nits: - Remove spurious call to remove a device's driver from devclass_driver_deleted(). device_detach() removes it already. - Fix a typo. Modified: stable/8/sys/kern/subr_bus.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Fri Mar 23 12:05:51 2012 (r233358) +++ stable/8/sys/kern/subr_bus.c Fri Mar 23 12:06:32 2012 (r233359) @@ -1165,7 +1165,6 @@ devclass_driver_deleted(devclass_t buscl dev->parent->devclass == busclass) { if ((error = device_detach(dev)) != 0) return (error); - (void)device_set_driver(dev, NULL); BUS_PROBE_NOMATCH(dev->parent, dev); devnomatch(dev); dev->flags |= DF_DONENOMATCH; @@ -2094,7 +2093,7 @@ device_probe_child(device_t dev, device_ /* XXX What happens if we rebid and got no best? */ if (best) { /* - * If this device was atached, and we were asked to + * If this device was attached, and we were asked to * rescan, and it is a different driver, then we have * to detach the old driver and reattach this new one. * Note, we don't have to check for DF_REBID here @@ -2601,6 +2600,7 @@ device_set_driver(device_t dev, driver_t free(dev->softc, M_BUS_SC); dev->softc = NULL; } + device_set_desc(dev, NULL); kobj_delete((kobj_t) dev, NULL); dev->driver = driver; if (driver) { @@ -2785,7 +2785,6 @@ device_detach(device_t dev) dev->state = DS_NOTPRESENT; (void)device_set_driver(dev, NULL); - device_set_desc(dev, NULL); device_sysctl_fini(dev); return (0); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 15:37:42 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 215D41065678; Fri, 23 Mar 2012 15:37:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B4D18FC17; Fri, 23 Mar 2012 15:37:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NFbfoP082290; Fri, 23 Mar 2012 15:37:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NFbf9k082283; Fri, 23 Mar 2012 15:37:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203231537.q2NFbf9k082283@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 23 Mar 2012 15:37:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233365 - in stable/8/sys: kern sys vm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 15:37:42 -0000 Author: kib Date: Fri Mar 23 15:37:41 2012 New Revision: 233365 URL: http://svn.freebsd.org/changeset/base/233365 Log: MFC r223889: Add a facility to disable processing page faults. When activated, uiomove generates EFAULT if any accessed address is not mapped, as opposed to handling the fault. Modified: stable/8/sys/kern/kern_subr.c stable/8/sys/sys/proc.h stable/8/sys/sys/systm.h stable/8/sys/sys/uio.h stable/8/sys/vm/vm_extern.h stable/8/sys/vm/vm_fault.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_subr.c ============================================================================== --- stable/8/sys/kern/kern_subr.c Fri Mar 23 14:12:51 2012 (r233364) +++ stable/8/sys/kern/kern_subr.c Fri Mar 23 15:37:41 2012 (r233365) @@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$"); SYSCTL_INT(_kern, KERN_IOV_MAX, iov_max, CTLFLAG_RD, NULL, UIO_MAXIOV, "Maximum number of elements in an I/O vector; sysconf(_SC_IOV_MAX)"); +static int uiomove_faultflag(void *cp, int n, struct uio *uio, int nofault); + #ifdef ZERO_COPY_SOCKETS /* Declared in uipc_socket.c */ extern int so_zero_copy_receive; @@ -132,23 +134,65 @@ retry: #endif /* ZERO_COPY_SOCKETS */ int +copyin_nofault(const void *udaddr, void *kaddr, size_t len) +{ + int error, save; + + save = vm_fault_disable_pagefaults(); + error = copyin(udaddr, kaddr, len); + vm_fault_enable_pagefaults(save); + return (error); +} + +int +copyout_nofault(const void *kaddr, void *udaddr, size_t len) +{ + int error, save; + + save = vm_fault_disable_pagefaults(); + error = copyout(kaddr, udaddr, len); + vm_fault_enable_pagefaults(save); + return (error); +} + +int uiomove(void *cp, int n, struct uio *uio) { - struct thread *td = curthread; + + return (uiomove_faultflag(cp, n, uio, 0)); +} + +int +uiomove_nofault(void *cp, int n, struct uio *uio) +{ + + return (uiomove_faultflag(cp, n, uio, 1)); +} + +static int +uiomove_faultflag(void *cp, int n, struct uio *uio, int nofault) +{ + struct thread *td; struct iovec *iov; u_int cnt; - int error = 0; - int save = 0; + int error, newflags, save; + + td = curthread; + error = 0; KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, ("uiomove: mode")); - KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread, + KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == td, ("uiomove proc")); - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, - "Calling uiomove()"); - - save = td->td_pflags & TDP_DEADLKTREAT; - td->td_pflags |= TDP_DEADLKTREAT; + if (!nofault) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "Calling uiomove()"); + + /* XXX does it make a sense to set TDP_DEADLKTREAT for UIO_SYSSPACE ? */ + newflags = TDP_DEADLKTREAT; + if (uio->uio_segflg == UIO_USERSPACE && nofault) + newflags |= TDP_NOFAULTING; + save = curthread_pflags_set(newflags); while (n > 0 && uio->uio_resid) { iov = uio->uio_iov; @@ -191,8 +235,7 @@ uiomove(void *cp, int n, struct uio *uio n -= cnt; } out: - if (save == 0) - td->td_pflags &= ~TDP_DEADLKTREAT; + curthread_pflags_restore(save); return (error); } Modified: stable/8/sys/sys/proc.h ============================================================================== --- stable/8/sys/sys/proc.h Fri Mar 23 14:12:51 2012 (r233364) +++ stable/8/sys/sys/proc.h Fri Mar 23 15:37:41 2012 (r233365) @@ -391,7 +391,7 @@ do { \ #define TDP_COWINPROGRESS 0x00000010 /* Snapshot copy-on-write in progress. */ #define TDP_ALTSTACK 0x00000020 /* Have alternate signal stack. */ #define TDP_DEADLKTREAT 0x00000040 /* Lock aquisition - deadlock treatment. */ -#define TDP_UNUSED80 0x00000080 /* available. */ +#define TDP_NOFAULTING 0x00000080 /* Do not handle page faults. */ #define TDP_NOSLEEPING 0x00000100 /* Thread is not allowed to sleep on a sq. */ #define TDP_OWEUPC 0x00000200 /* Call addupc() at next AST. */ #define TDP_ITHREAD 0x00000400 /* Thread is an interrupt thread. */ Modified: stable/8/sys/sys/systm.h ============================================================================== --- stable/8/sys/sys/systm.h Fri Mar 23 14:12:51 2012 (r233364) +++ stable/8/sys/sys/systm.h Fri Mar 23 15:37:41 2012 (r233365) @@ -216,8 +216,12 @@ int copyinstr(const void * __restrict ud __nonnull(1) __nonnull(2); int copyin(const void * __restrict udaddr, void * __restrict kaddr, size_t len) __nonnull(1) __nonnull(2); +int copyin_nofault(const void * __restrict udaddr, void * __restrict kaddr, + size_t len) __nonnull(1) __nonnull(2); int copyout(const void * __restrict kaddr, void * __restrict udaddr, size_t len) __nonnull(1) __nonnull(2); +int copyout_nofault(const void * __restrict kaddr, void * __restrict udaddr, + size_t len) __nonnull(1) __nonnull(2); int fubyte(const void *base); long fuword(const void *base); Modified: stable/8/sys/sys/uio.h ============================================================================== --- stable/8/sys/sys/uio.h Fri Mar 23 14:12:51 2012 (r233364) +++ stable/8/sys/sys/uio.h Fri Mar 23 15:37:41 2012 (r233365) @@ -101,6 +101,7 @@ int uiomove(void *cp, int n, struct uio int uiomove_frombuf(void *buf, int buflen, struct uio *uio); int uiomove_fromphys(struct vm_page *ma[], vm_offset_t offset, int n, struct uio *uio); +int uiomove_nofault(void *cp, int n, struct uio *uio); int uiomoveco(void *cp, int n, struct uio *uio, int disposable); #else /* !_KERNEL */ Modified: stable/8/sys/vm/vm_extern.h ============================================================================== --- stable/8/sys/vm/vm_extern.h Fri Mar 23 14:12:51 2012 (r233364) +++ stable/8/sys/vm/vm_extern.h Fri Mar 23 15:37:41 2012 (r233365) @@ -61,6 +61,8 @@ int useracc(void *, int, int); int vm_fault(vm_map_t, vm_offset_t, vm_prot_t, int); void vm_fault_copy_entry(vm_map_t, vm_map_t, vm_map_entry_t, vm_map_entry_t, vm_ooffset_t *); +int vm_fault_disable_pagefaults(void); +void vm_fault_enable_pagefaults(int save); void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t, boolean_t); int vm_forkproc(struct thread *, struct proc *, struct thread *, struct vmspace *, int); Modified: stable/8/sys/vm/vm_fault.c ============================================================================== --- stable/8/sys/vm/vm_fault.c Fri Mar 23 14:12:51 2012 (r233364) +++ stable/8/sys/vm/vm_fault.c Fri Mar 23 15:37:41 2012 (r233365) @@ -222,6 +222,9 @@ vm_fault(vm_map_t map, vm_offset_t vaddr struct vnode *vp; int locked, error; + if ((curthread->td_pflags & TDP_NOFAULTING) != 0) + return (KERN_PROTECTION_FAILURE); + hardfault = 0; growstack = TRUE; PCPU_INC(cnt.v_vm_faults); @@ -1405,3 +1408,17 @@ vm_fault_additional_pages(m, rbehind, ra /* return number of pages */ return i; } + +int +vm_fault_disable_pagefaults(void) +{ + + return (curthread_pflags_set(TDP_NOFAULTING)); +} + +void +vm_fault_enable_pagefaults(int save) +{ + + curthread_pflags_restore(save); +} From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 16:12:53 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A152106564A; Fri, 23 Mar 2012 16:12:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24FF58FC12; Fri, 23 Mar 2012 16:12:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NGCqCX083518; Fri, 23 Mar 2012 16:12:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NGCqat083516; Fri, 23 Mar 2012 16:12:52 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201203231612.q2NGCqat083516@svn.freebsd.org> From: Alexander Motin Date: Fri, 23 Mar 2012 16:12:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233367 - stable/9/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 16:12:53 -0000 Author: mav Date: Fri Mar 23 16:12:52 2012 New Revision: 233367 URL: http://svn.freebsd.org/changeset/base/233367 Log: MFC r232717: Be more polite when setting state->nextevent inside cpu_new_callout(). Hardclock is not the only who wakes idle CPU since kdtrace cyclic addition. Modified: stable/9/sys/kern/kern_clocksource.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_clocksource.c ============================================================================== --- stable/9/sys/kern/kern_clocksource.c Fri Mar 23 15:49:46 2012 (r233366) +++ stable/9/sys/kern/kern_clocksource.c Fri Mar 23 16:12:52 2012 (r233367) @@ -860,10 +860,11 @@ cpu_new_callout(int cpu, int ticks) * If timer is global - there is chance it is already programmed. */ if (periodic || (timer->et_flags & ET_FLAGS_PERCPU) == 0) { - state->nextevent = state->nexthard; tmp = hardperiod; bintime_mul(&tmp, ticks - 1); - bintime_add(&state->nextevent, &tmp); + bintime_add(&tmp, &state->nexthard); + if (bintime_cmp(&tmp, &state->nextevent, <)) + state->nextevent = tmp; if (periodic || bintime_cmp(&state->nextevent, &nexttick, >=)) { ET_HW_UNLOCK(state); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 16:17:47 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D2791065676; Fri, 23 Mar 2012 16:17:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E7AD8FC08; Fri, 23 Mar 2012 16:17:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NGHl1x083740; Fri, 23 Mar 2012 16:17:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NGHlKG083738; Fri, 23 Mar 2012 16:17:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201203231617.q2NGHlKG083738@svn.freebsd.org> From: Alexander Motin Date: Fri, 23 Mar 2012 16:17:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233368 - stable/9/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 16:17:47 -0000 Author: mav Date: Fri Mar 23 16:17:46 2012 New Revision: 233368 URL: http://svn.freebsd.org/changeset/base/233368 Log: MFC r232793: Revert r175376 and tune cpufreq(4) frequency comparison logic instead. Instead of using 25MHz equality threshold, look for the nearest value when handling dev.cpu.0.freq sysctl and for exact match when it is expected. ACPI may report extra level with frequency 1MHz above the nominal to control Intel Turbo Boost operation. It is not a bug, but feature: dev.cpu.0.freq_levels: 2934/106000 2933/95000 2800/82000 ... In this case value 2933 means 2.93GHz, but 2934 means 3.2-3.6GHz. I've found that my Core i7 based systems have Intel Turbo Boost not used by default and without this change it was absolutely invisible and hard to control. Modified: stable/9/sys/kern/kern_cpu.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_cpu.c ============================================================================== --- stable/9/sys/kern/kern_cpu.c Fri Mar 23 16:12:52 2012 (r233367) +++ stable/9/sys/kern/kern_cpu.c Fri Mar 23 16:17:46 2012 (r233368) @@ -311,7 +311,7 @@ cf_set_method(device_t dev, const struct } /* If already at this level, just return. */ - if (CPUFREQ_CMP(sc->curr_level.total_set.freq, level->total_set.freq)) { + if (sc->curr_level.total_set.freq == level->total_set.freq) { CF_DEBUG("skipping freq %d, same as current level %d\n", level->total_set.freq, sc->curr_level.total_set.freq); goto skip; @@ -470,7 +470,7 @@ cf_get_method(device_t dev, struct cf_le if (CPUFREQ_DRV_GET(devs[n], &set) != 0) continue; for (i = 0; i < count; i++) { - if (CPUFREQ_CMP(set.freq, levels[i].total_set.freq)) { + if (set.freq == levels[i].total_set.freq) { sc->curr_level = levels[i]; break; } @@ -626,16 +626,6 @@ cf_levels_method(device_t dev, struct cf /* Finally, output the list of levels. */ i = 0; TAILQ_FOREACH(lev, &sc->all_levels, link) { - /* - * Skip levels that are too close in frequency to the - * previous levels. Some systems report bogus duplicate - * settings (i.e., for acpi_perf). - */ - if (i > 0 && CPUFREQ_CMP(lev->total_set.freq, - levels[i - 1].total_set.freq)) { - sc->all_count--; - continue; - } /* Skip levels that have a frequency that is too low. */ if (lev->total_set.freq < cf_lowest_freq) { @@ -869,7 +859,7 @@ cpufreq_curr_sysctl(SYSCTL_HANDLER_ARGS) { struct cpufreq_softc *sc; struct cf_level *levels; - int count, devcount, error, freq, i, n; + int best, count, diff, bdiff, devcount, error, freq, i, n; device_t *devs; devs = NULL; @@ -901,17 +891,16 @@ cpufreq_curr_sysctl(SYSCTL_HANDLER_ARGS) "cpufreq: need to increase CF_MAX_LEVELS\n"); break; } + best = 0; + bdiff = 1 << 30; for (i = 0; i < count; i++) { - if (CPUFREQ_CMP(levels[i].total_set.freq, freq)) { - error = CPUFREQ_SET(devs[n], &levels[i], - CPUFREQ_PRIO_USER); - break; + diff = abs(levels[i].total_set.freq - freq); + if (diff < bdiff) { + bdiff = diff; + best = i; } } - if (i == count) { - error = EINVAL; - break; - } + error = CPUFREQ_SET(devs[n], &levels[best], CPUFREQ_PRIO_USER); } out: From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 16:19:15 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0DD9B106567F; Fri, 23 Mar 2012 16:19:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E37328FC21; Fri, 23 Mar 2012 16:19:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NGJE8l083849; Fri, 23 Mar 2012 16:19:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NGJEkQ083847; Fri, 23 Mar 2012 16:19:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201203231619.q2NGJEkQ083847@svn.freebsd.org> From: Alexander Motin Date: Fri, 23 Mar 2012 16:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233369 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 16:19:15 -0000 Author: mav Date: Fri Mar 23 16:19:14 2012 New Revision: 233369 URL: http://svn.freebsd.org/changeset/base/233369 Log: MFC r232793: Revert r175376 and tune cpufreq(4) frequency comparison logic instead. Instead of using 25MHz equality threshold, look for the nearest value when handling dev.cpu.0.freq sysctl and for exact match when it is expected. ACPI may report extra level with frequency 1MHz above the nominal to control Intel Turbo Boost operation. It is not a bug, but feature: dev.cpu.0.freq_levels: 2934/106000 2933/95000 2800/82000 ... In this case value 2933 means 2.93GHz, but 2934 means 3.2-3.6GHz. I've found that my Core i7 based systems have Intel Turbo Boost not used by default and without this change it was absolutely invisible and hard to control. Modified: stable/8/sys/kern/kern_cpu.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_cpu.c ============================================================================== --- stable/8/sys/kern/kern_cpu.c Fri Mar 23 16:17:46 2012 (r233368) +++ stable/8/sys/kern/kern_cpu.c Fri Mar 23 16:19:14 2012 (r233369) @@ -311,7 +311,7 @@ cf_set_method(device_t dev, const struct } /* If already at this level, just return. */ - if (CPUFREQ_CMP(sc->curr_level.total_set.freq, level->total_set.freq)) { + if (sc->curr_level.total_set.freq == level->total_set.freq) { CF_DEBUG("skipping freq %d, same as current level %d\n", level->total_set.freq, sc->curr_level.total_set.freq); goto skip; @@ -470,7 +470,7 @@ cf_get_method(device_t dev, struct cf_le if (CPUFREQ_DRV_GET(devs[n], &set) != 0) continue; for (i = 0; i < count; i++) { - if (CPUFREQ_CMP(set.freq, levels[i].total_set.freq)) { + if (set.freq == levels[i].total_set.freq) { sc->curr_level = levels[i]; break; } @@ -626,16 +626,6 @@ cf_levels_method(device_t dev, struct cf /* Finally, output the list of levels. */ i = 0; TAILQ_FOREACH(lev, &sc->all_levels, link) { - /* - * Skip levels that are too close in frequency to the - * previous levels. Some systems report bogus duplicate - * settings (i.e., for acpi_perf). - */ - if (i > 0 && CPUFREQ_CMP(lev->total_set.freq, - levels[i - 1].total_set.freq)) { - sc->all_count--; - continue; - } /* Skip levels that have a frequency that is too low. */ if (lev->total_set.freq < cf_lowest_freq) { @@ -869,7 +859,7 @@ cpufreq_curr_sysctl(SYSCTL_HANDLER_ARGS) { struct cpufreq_softc *sc; struct cf_level *levels; - int count, devcount, error, freq, i, n; + int best, count, diff, bdiff, devcount, error, freq, i, n; device_t *devs; devs = NULL; @@ -901,17 +891,16 @@ cpufreq_curr_sysctl(SYSCTL_HANDLER_ARGS) "cpufreq: need to increase CF_MAX_LEVELS\n"); break; } + best = 0; + bdiff = 1 << 30; for (i = 0; i < count; i++) { - if (CPUFREQ_CMP(levels[i].total_set.freq, freq)) { - error = CPUFREQ_SET(devs[n], &levels[i], - CPUFREQ_PRIO_USER); - break; + diff = abs(levels[i].total_set.freq - freq); + if (diff < bdiff) { + bdiff = diff; + best = i; } } - if (i == count) { - error = EINVAL; - break; - } + error = CPUFREQ_SET(devs[n], &levels[best], CPUFREQ_PRIO_USER); } out: From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 16:44:12 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id C26651065670; Fri, 23 Mar 2012 16:44:12 +0000 (UTC) Date: Fri, 23 Mar 2012 16:44:12 +0000 From: Alexey Dokuchaev To: John Baldwin Message-ID: <20120323164412.GB8323@FreeBSD.org> References: <201203231206.q2NC6WRc075511@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201203231206.q2NC6WRc075511@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233359 - in stable/8/sys: i386/conf kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 16:44:12 -0000 On Fri, Mar 23, 2012 at 12:06:32PM +0000, John Baldwin wrote: > Author: jhb > Date: Fri Mar 23 12:06:32 2012 > New Revision: 233359 > URL: http://svn.freebsd.org/changeset/base/233359 > > Log: > MFC 232218: > Clear the a device's description string anytime it's driver changes. > [...] Thanks John! ./danfe From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 16:59:04 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28C05106566B; Fri, 23 Mar 2012 16:59:04 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A3CD8FC0C; Fri, 23 Mar 2012 16:59:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NGx3GK085337; Fri, 23 Mar 2012 16:59:03 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NGx3D9085333; Fri, 23 Mar 2012 16:59:03 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201203231659.q2NGx3D9085333@svn.freebsd.org> From: Jim Harris Date: Fri, 23 Mar 2012 16:59:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233372 - stable/9/sys/dev/isci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 16:59:04 -0000 Author: jimharris Date: Fri Mar 23 16:59:03 2012 New Revision: 233372 URL: http://svn.freebsd.org/changeset/base/233372 Log: MFC r233371: Call xpt_bus_register during attach context, then freeze and do not release until domain discovery is complete. This fixes an isci(4) bug on FreeBSD 7.x where devices weren't always appearing after boot without an explicit rescan. Sponsored by: Intel Reported and tested by: Reviewed by: scottl Approved by: scottl Modified: stable/9/sys/dev/isci/isci.h stable/9/sys/dev/isci/isci_controller.c stable/9/sys/dev/isci/isci_remote_device.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/isci/isci.h ============================================================================== --- stable/9/sys/dev/isci/isci.h Fri Mar 23 16:28:11 2012 (r233371) +++ stable/9/sys/dev/isci/isci.h Fri Mar 23 16:59:03 2012 (r233372) @@ -122,6 +122,7 @@ struct ISCI_CONTROLLER SCI_CONTROLLER_HANDLE_T scif_controller_handle; struct ISCI_DOMAIN domain[SCI_MAX_DOMAINS]; BOOL is_started; + BOOL has_been_scanned; uint32_t initial_discovery_mask; BOOL is_frozen; uint8_t *remote_device_memory; Modified: stable/9/sys/dev/isci/isci_controller.c ============================================================================== --- stable/9/sys/dev/isci/isci_controller.c Fri Mar 23 16:28:11 2012 (r233371) +++ stable/9/sys/dev/isci/isci_controller.c Fri Mar 23 16:59:03 2012 (r233372) @@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include @@ -300,6 +303,16 @@ SCI_STATUS isci_controller_initialize(st TUNABLE_INT_FETCH("hw.isci.io_shortage", &io_shortage); controller->sim_queue_depth += io_shortage; + /* Attach to CAM using xpt_bus_register now, then immediately freeze + * the simq. It will get released later when initial domain discovery + * is complete. + */ + controller->has_been_scanned = FALSE; + mtx_lock(&controller->lock); + isci_controller_attach_to_cam(controller); + xpt_freeze_simq(controller->sim, 1); + mtx_unlock(&controller->lock); + return (scif_controller_initialize(controller->scif_controller_handle)); } @@ -441,13 +454,13 @@ void isci_controller_start(void *control void isci_controller_domain_discovery_complete( struct ISCI_CONTROLLER *isci_controller, struct ISCI_DOMAIN *isci_domain) { - if (isci_controller->sim == NULL) + if (!isci_controller->has_been_scanned) { - /* Controller has not been attached to CAM yet. We'll clear + /* Controller has not been scanned yet. We'll clear * the discovery bit for this domain, then check if all bits * are now clear. That would indicate that all domains are - * done with discovery and we can then attach the controller - * to CAM. + * done with discovery and we can then proceed with initial + * scan. */ isci_controller->initial_discovery_mask &= @@ -457,7 +470,25 @@ void isci_controller_domain_discovery_co struct isci_softc *driver = isci_controller->isci; uint8_t next_index = isci_controller->index + 1; - isci_controller_attach_to_cam(isci_controller); + isci_controller->has_been_scanned = TRUE; + + /* Unfreeze simq to allow initial scan to proceed. */ + xpt_release_simq(isci_controller->sim, TRUE); + +#if __FreeBSD_version < 800000 + /* When driver is loaded after boot, we need to + * explicitly rescan here for versions <8.0, because + * CAM only automatically scans new buses at boot + * time. + */ + union ccb *ccb = xpt_alloc_ccb_nowait(); + + xpt_create_path(&ccb->ccb_h.path, xpt_periph, + cam_sim_path(isci_controller->sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); + + xpt_rescan(ccb); +#endif if (next_index < driver->controller_count) { /* There are more controllers that need to Modified: stable/9/sys/dev/isci/isci_remote_device.c ============================================================================== --- stable/9/sys/dev/isci/isci_remote_device.c Fri Mar 23 16:28:11 2012 (r233371) +++ stable/9/sys/dev/isci/isci_remote_device.c Fri Mar 23 16:59:03 2012 (r233372) @@ -74,13 +74,12 @@ scif_cb_remote_device_ready(SCI_CONTROLL isci_controller->remote_device[device_index] = isci_remote_device; - if (isci_controller->sim != NULL) { - /* The sim object is not NULL, meaning we have attached - * the controller to CAM already. In that case, create - * a CCB to instruct CAM to rescan this device. - * If the sim object is NULL, this device will get - * scanned as part of the initial scan when the - * controller is attached to CAM. + if (isci_controller->has_been_scanned) { + /* The sim object has been scanned at least once + * already. In that case, create a CCB to instruct + * CAM to rescan this device. + * If the sim object has not been scanned, this device + * will get scanned as part of the initial scan. */ union ccb *ccb = xpt_alloc_ccb_nowait(); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 17:11:36 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E805A1065673; Fri, 23 Mar 2012 17:11:36 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C95BB8FC1E; Fri, 23 Mar 2012 17:11:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NHBa52085800; Fri, 23 Mar 2012 17:11:36 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NHBaAZ085796; Fri, 23 Mar 2012 17:11:36 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201203231711.q2NHBaAZ085796@svn.freebsd.org> From: Jim Harris Date: Fri, 23 Mar 2012 17:11:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233373 - stable/8/sys/dev/isci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 17:11:37 -0000 Author: jimharris Date: Fri Mar 23 17:11:36 2012 New Revision: 233373 URL: http://svn.freebsd.org/changeset/base/233373 Log: MFC r233371: Call xpt_bus_register during attach context, then freeze and do not release until domain discovery is complete. This fixes an isci(4) bug on FreeBSD 7.x where devices weren't always appearing after boot without an explicit rescan. Sponsored by: Intel Reported and tested by: Reviewed by: scottl Approved by: scottl Modified: stable/8/sys/dev/isci/isci.h stable/8/sys/dev/isci/isci_controller.c stable/8/sys/dev/isci/isci_remote_device.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/isci/isci.h ============================================================================== --- stable/8/sys/dev/isci/isci.h Fri Mar 23 16:59:03 2012 (r233372) +++ stable/8/sys/dev/isci/isci.h Fri Mar 23 17:11:36 2012 (r233373) @@ -122,6 +122,7 @@ struct ISCI_CONTROLLER SCI_CONTROLLER_HANDLE_T scif_controller_handle; struct ISCI_DOMAIN domain[SCI_MAX_DOMAINS]; BOOL is_started; + BOOL has_been_scanned; uint32_t initial_discovery_mask; BOOL is_frozen; uint8_t *remote_device_memory; Modified: stable/8/sys/dev/isci/isci_controller.c ============================================================================== --- stable/8/sys/dev/isci/isci_controller.c Fri Mar 23 16:59:03 2012 (r233372) +++ stable/8/sys/dev/isci/isci_controller.c Fri Mar 23 17:11:36 2012 (r233373) @@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include @@ -300,6 +303,16 @@ SCI_STATUS isci_controller_initialize(st TUNABLE_INT_FETCH("hw.isci.io_shortage", &io_shortage); controller->sim_queue_depth += io_shortage; + /* Attach to CAM using xpt_bus_register now, then immediately freeze + * the simq. It will get released later when initial domain discovery + * is complete. + */ + controller->has_been_scanned = FALSE; + mtx_lock(&controller->lock); + isci_controller_attach_to_cam(controller); + xpt_freeze_simq(controller->sim, 1); + mtx_unlock(&controller->lock); + return (scif_controller_initialize(controller->scif_controller_handle)); } @@ -441,13 +454,13 @@ void isci_controller_start(void *control void isci_controller_domain_discovery_complete( struct ISCI_CONTROLLER *isci_controller, struct ISCI_DOMAIN *isci_domain) { - if (isci_controller->sim == NULL) + if (!isci_controller->has_been_scanned) { - /* Controller has not been attached to CAM yet. We'll clear + /* Controller has not been scanned yet. We'll clear * the discovery bit for this domain, then check if all bits * are now clear. That would indicate that all domains are - * done with discovery and we can then attach the controller - * to CAM. + * done with discovery and we can then proceed with initial + * scan. */ isci_controller->initial_discovery_mask &= @@ -457,7 +470,25 @@ void isci_controller_domain_discovery_co struct isci_softc *driver = isci_controller->isci; uint8_t next_index = isci_controller->index + 1; - isci_controller_attach_to_cam(isci_controller); + isci_controller->has_been_scanned = TRUE; + + /* Unfreeze simq to allow initial scan to proceed. */ + xpt_release_simq(isci_controller->sim, TRUE); + +#if __FreeBSD_version < 800000 + /* When driver is loaded after boot, we need to + * explicitly rescan here for versions <8.0, because + * CAM only automatically scans new buses at boot + * time. + */ + union ccb *ccb = xpt_alloc_ccb_nowait(); + + xpt_create_path(&ccb->ccb_h.path, xpt_periph, + cam_sim_path(isci_controller->sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); + + xpt_rescan(ccb); +#endif if (next_index < driver->controller_count) { /* There are more controllers that need to Modified: stable/8/sys/dev/isci/isci_remote_device.c ============================================================================== --- stable/8/sys/dev/isci/isci_remote_device.c Fri Mar 23 16:59:03 2012 (r233372) +++ stable/8/sys/dev/isci/isci_remote_device.c Fri Mar 23 17:11:36 2012 (r233373) @@ -74,13 +74,12 @@ scif_cb_remote_device_ready(SCI_CONTROLL isci_controller->remote_device[device_index] = isci_remote_device; - if (isci_controller->sim != NULL) { - /* The sim object is not NULL, meaning we have attached - * the controller to CAM already. In that case, create - * a CCB to instruct CAM to rescan this device. - * If the sim object is NULL, this device will get - * scanned as part of the initial scan when the - * controller is attached to CAM. + if (isci_controller->has_been_scanned) { + /* The sim object has been scanned at least once + * already. In that case, create a CCB to instruct + * CAM to rescan this device. + * If the sim object has not been scanned, this device + * will get scanned as part of the initial scan. */ union ccb *ccb = xpt_alloc_ccb_nowait(); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 17:22:43 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D2A5D1065687; Fri, 23 Mar 2012 17:22:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A307A8FC12; Fri, 23 Mar 2012 17:22:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NHMhbQ086209; Fri, 23 Mar 2012 17:22:43 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NHMh5D086207; Fri, 23 Mar 2012 17:22:43 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231722.q2NHMh5D086207@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 17:22:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233374 - stable/9/sys/boot/i386/boot2 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 17:22:43 -0000 Author: jhb Date: Fri Mar 23 17:22:43 2012 New Revision: 233374 URL: http://svn.freebsd.org/changeset/base/233374 Log: MFC 232570,232754: Fix boot2 to handle boot config files that only contain a custom path to a loader or kernel. Specifically, kname cannot be pointed at cmd[] since it's value is change to be an empty string after the initial call to parse, and cmd[]'s value can be changed (thus losing a prior setting for kname) due to user input at the boot prompt. While here, ensure that that initial boot config file text is nul-terminated, that ops is initialized to zero, and that kname is always initialized to a valid string. In addition, include other changes to ensure boot2 still builds with Clang. Modified: stable/9/sys/boot/i386/boot2/boot2.c Modified: stable/9/sys/boot/i386/boot2/boot2.c ============================================================================== --- stable/9/sys/boot/i386/boot2/boot2.c Fri Mar 23 17:11:36 2012 (r233373) +++ stable/9/sys/boot/i386/boot2/boot2.c Fri Mar 23 17:22:43 2012 (r233374) @@ -128,9 +128,9 @@ static struct dsk { unsigned start; int init; } dsk; -static char cmd[512], cmddup[512]; -static const char *kname; -static uint32_t opts; +static char cmd[512], cmddup[512], knamebuf[1024]; +static const char *kname = NULL; +static uint32_t opts = 0; static int comspeed = SIOSPD; static struct bootinfo bootinfo; static uint8_t ioctrl = IO_KEYBOARD; @@ -223,8 +223,8 @@ main(void) { uint8_t autoboot; ino_t ino; + size_t nbyte; - kname = NULL; dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base); v86.ctl = V86_FLAGS; v86.efl = PSL_RESERVED_DEFAULT | PSL_I; @@ -240,8 +240,10 @@ main(void) autoboot = 1; if ((ino = lookup(PATH_CONFIG)) || - (ino = lookup(PATH_DOTCONFIG))) - fsread(ino, cmd, sizeof(cmd)); + (ino = lookup(PATH_DOTCONFIG))) { + nbyte = fsread(ino, cmd, sizeof(cmd) - 1); + cmd[nbyte] = '\0'; + } if (*cmd) { memcpy(cmddup, cmd, sizeof(cmd)); @@ -258,9 +260,9 @@ main(void) * or in case of failure, try to load a kernel directly instead. */ - if (autoboot && !kname) { + if (!kname) { kname = PATH_BOOT3; - if (!keyhit(3*SECOND)) { + if (autoboot && !keyhit(3*SECOND)) { load(); kname = PATH_KERNEL; } @@ -457,7 +459,12 @@ parse() ? DRV_HARD : 0) + drv; dsk_meta = 0; } - kname = arg; + if ((i = ep - arg)) { + if ((size_t)i >= sizeof(knamebuf)) + return -1; + memcpy(knamebuf, arg, i + 1); + kname = knamebuf; + } } arg = p; } From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 17:23:40 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5AA4106566C; Fri, 23 Mar 2012 17:23:40 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B63058FC0A; Fri, 23 Mar 2012 17:23:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NHNepX086284; Fri, 23 Mar 2012 17:23:40 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NHNeFC086280; Fri, 23 Mar 2012 17:23:40 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201203231723.q2NHNeFC086280@svn.freebsd.org> From: Jim Harris Date: Fri, 23 Mar 2012 17:23:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233375 - stable/7/sys/dev/isci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 17:23:40 -0000 Author: jimharris Date: Fri Mar 23 17:23:40 2012 New Revision: 233375 URL: http://svn.freebsd.org/changeset/base/233375 Log: MFC r233371: Call xpt_bus_register during attach context, then freeze and do not release until domain discovery is complete. This fixes an isci(4) bug on FreeBSD 7.x where devices weren't always appearing after boot without an explicit rescan. Sponsored by: Intel Reported and tested by: Reviewed by: scottl Approved by: scottl Modified: stable/7/sys/dev/isci/isci.h stable/7/sys/dev/isci/isci_controller.c stable/7/sys/dev/isci/isci_remote_device.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/isci/isci.h ============================================================================== --- stable/7/sys/dev/isci/isci.h Fri Mar 23 17:22:43 2012 (r233374) +++ stable/7/sys/dev/isci/isci.h Fri Mar 23 17:23:40 2012 (r233375) @@ -122,6 +122,7 @@ struct ISCI_CONTROLLER SCI_CONTROLLER_HANDLE_T scif_controller_handle; struct ISCI_DOMAIN domain[SCI_MAX_DOMAINS]; BOOL is_started; + BOOL has_been_scanned; uint32_t initial_discovery_mask; BOOL is_frozen; uint8_t *remote_device_memory; Modified: stable/7/sys/dev/isci/isci_controller.c ============================================================================== --- stable/7/sys/dev/isci/isci_controller.c Fri Mar 23 17:22:43 2012 (r233374) +++ stable/7/sys/dev/isci/isci_controller.c Fri Mar 23 17:23:40 2012 (r233375) @@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include @@ -300,6 +303,16 @@ SCI_STATUS isci_controller_initialize(st TUNABLE_INT_FETCH("hw.isci.io_shortage", &io_shortage); controller->sim_queue_depth += io_shortage; + /* Attach to CAM using xpt_bus_register now, then immediately freeze + * the simq. It will get released later when initial domain discovery + * is complete. + */ + controller->has_been_scanned = FALSE; + mtx_lock(&controller->lock); + isci_controller_attach_to_cam(controller); + xpt_freeze_simq(controller->sim, 1); + mtx_unlock(&controller->lock); + return (scif_controller_initialize(controller->scif_controller_handle)); } @@ -441,13 +454,13 @@ void isci_controller_start(void *control void isci_controller_domain_discovery_complete( struct ISCI_CONTROLLER *isci_controller, struct ISCI_DOMAIN *isci_domain) { - if (isci_controller->sim == NULL) + if (!isci_controller->has_been_scanned) { - /* Controller has not been attached to CAM yet. We'll clear + /* Controller has not been scanned yet. We'll clear * the discovery bit for this domain, then check if all bits * are now clear. That would indicate that all domains are - * done with discovery and we can then attach the controller - * to CAM. + * done with discovery and we can then proceed with initial + * scan. */ isci_controller->initial_discovery_mask &= @@ -457,7 +470,25 @@ void isci_controller_domain_discovery_co struct isci_softc *driver = isci_controller->isci; uint8_t next_index = isci_controller->index + 1; - isci_controller_attach_to_cam(isci_controller); + isci_controller->has_been_scanned = TRUE; + + /* Unfreeze simq to allow initial scan to proceed. */ + xpt_release_simq(isci_controller->sim, TRUE); + +#if __FreeBSD_version < 800000 + /* When driver is loaded after boot, we need to + * explicitly rescan here for versions <8.0, because + * CAM only automatically scans new buses at boot + * time. + */ + union ccb *ccb = xpt_alloc_ccb_nowait(); + + xpt_create_path(&ccb->ccb_h.path, xpt_periph, + cam_sim_path(isci_controller->sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); + + xpt_rescan(ccb); +#endif if (next_index < driver->controller_count) { /* There are more controllers that need to Modified: stable/7/sys/dev/isci/isci_remote_device.c ============================================================================== --- stable/7/sys/dev/isci/isci_remote_device.c Fri Mar 23 17:22:43 2012 (r233374) +++ stable/7/sys/dev/isci/isci_remote_device.c Fri Mar 23 17:23:40 2012 (r233375) @@ -74,13 +74,12 @@ scif_cb_remote_device_ready(SCI_CONTROLL isci_controller->remote_device[device_index] = isci_remote_device; - if (isci_controller->sim != NULL) { - /* The sim object is not NULL, meaning we have attached - * the controller to CAM already. In that case, create - * a CCB to instruct CAM to rescan this device. - * If the sim object is NULL, this device will get - * scanned as part of the initial scan when the - * controller is attached to CAM. + if (isci_controller->has_been_scanned) { + /* The sim object has been scanned at least once + * already. In that case, create a CCB to instruct + * CAM to rescan this device. + * If the sim object has not been scanned, this device + * will get scanned as part of the initial scan. */ union ccb *ccb = xpt_alloc_ccb_nowait(); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 17:24:29 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 97AB1106566C; Fri, 23 Mar 2012 17:24:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8301C8FC1B; Fri, 23 Mar 2012 17:24:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NHOTn4086349; Fri, 23 Mar 2012 17:24:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NHOTdx086348; Fri, 23 Mar 2012 17:24:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231724.q2NHOTdx086348@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 17:24:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233376 - stable/9/sys/i386/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 17:24:29 -0000 Author: jhb Date: Fri Mar 23 17:24:29 2012 New Revision: 233376 URL: http://svn.freebsd.org/changeset/base/233376 Log: Record mergeinfo for 233374. Modified: Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 17:24:52 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C39E8106566C; Fri, 23 Mar 2012 17:24:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A54D98FC0C; Fri, 23 Mar 2012 17:24:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NHOqki086397; Fri, 23 Mar 2012 17:24:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NHOqS9086394; Fri, 23 Mar 2012 17:24:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231724.q2NHOqS9086394@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 17:24:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233377 - in stable/8/sys: boot/i386/boot2 i386/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 17:24:52 -0000 Author: jhb Date: Fri Mar 23 17:24:52 2012 New Revision: 233377 URL: http://svn.freebsd.org/changeset/base/233377 Log: MFC 232570,232754: Fix boot2 to handle boot config files that only contain a custom path to a loader or kernel. Specifically, kname cannot be pointed at cmd[] since it's value is change to be an empty string after the initial call to parse, and cmd[]'s value can be changed (thus losing a prior setting for kname) due to user input at the boot prompt. While here, ensure that that initial boot config file text is nul-terminated, that ops is initialized to zero, and that kname is always initialized to a valid string. In addition, include other changes to ensure boot2 still builds with Clang. Modified: stable/8/sys/boot/i386/boot2/boot2.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/boot/i386/boot2/boot2.c ============================================================================== --- stable/8/sys/boot/i386/boot2/boot2.c Fri Mar 23 17:24:29 2012 (r233376) +++ stable/8/sys/boot/i386/boot2/boot2.c Fri Mar 23 17:24:52 2012 (r233377) @@ -128,9 +128,9 @@ static struct dsk { unsigned start; int init; } dsk; -static char cmd[512], cmddup[512]; -static const char *kname; -static uint32_t opts; +static char cmd[512], cmddup[512], knamebuf[1024]; +static const char *kname = NULL; +static uint32_t opts = 0; static int comspeed = SIOSPD; static struct bootinfo bootinfo; static uint8_t ioctrl = IO_KEYBOARD; @@ -223,8 +223,8 @@ main(void) { uint8_t autoboot; ino_t ino; + size_t nbyte; - kname = NULL; dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base); v86.ctl = V86_FLAGS; v86.efl = PSL_RESERVED_DEFAULT | PSL_I; @@ -240,8 +240,10 @@ main(void) autoboot = 1; if ((ino = lookup(PATH_CONFIG)) || - (ino = lookup(PATH_DOTCONFIG))) - fsread(ino, cmd, sizeof(cmd)); + (ino = lookup(PATH_DOTCONFIG))) { + nbyte = fsread(ino, cmd, sizeof(cmd) - 1); + cmd[nbyte] = '\0'; + } if (*cmd) { memcpy(cmddup, cmd, sizeof(cmd)); @@ -258,9 +260,9 @@ main(void) * or in case of failure, try to load a kernel directly instead. */ - if (autoboot && !kname) { + if (!kname) { kname = PATH_BOOT3; - if (!keyhit(3*SECOND)) { + if (autoboot && !keyhit(3*SECOND)) { load(); kname = PATH_KERNEL; } @@ -457,7 +459,12 @@ parse() ? DRV_HARD : 0) + drv; dsk_meta = 0; } - kname = arg; + if ((i = ep - arg)) { + if ((size_t)i >= sizeof(knamebuf)) + return -1; + memcpy(knamebuf, arg, i + 1); + kname = knamebuf; + } } arg = p; } From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 18:03:05 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 35764106568A; Fri, 23 Mar 2012 18:03:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 140E58FC2D; Fri, 23 Mar 2012 18:03:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NI34TZ087667; Fri, 23 Mar 2012 18:03:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NI34pG087662; Fri, 23 Mar 2012 18:03:04 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231803.q2NI34pG087662@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 18:03:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233379 - in stable/9: share/man/man9 sys/dev/pci sys/i386/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 18:03:05 -0000 Author: jhb Date: Fri Mar 23 18:03:04 2012 New Revision: 233379 URL: http://svn.freebsd.org/changeset/base/233379 Log: MFC 232360: Add pci_save_state() and pci_restore_state() wrappers around pci_cfg_save() and pci_cfg_restore() for device drivers to use when saving and restoring state (e.g. to handle device-specific resets). Modified: stable/9/share/man/man9/Makefile stable/9/share/man/man9/pci.9 stable/9/sys/dev/pci/pci.c stable/9/sys/dev/pci/pcivar.h Directory Properties: stable/9/share/man/man9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/share/man/man9/Makefile ============================================================================== --- stable/9/share/man/man9/Makefile Fri Mar 23 17:54:06 2012 (r233378) +++ stable/9/share/man/man9/Makefile Fri Mar 23 18:03:04 2012 (r233379) @@ -978,6 +978,8 @@ MLINKS+=pci.9 pci_disable_busmaster.9 \ pci.9 pci_find_device.9 \ pci.9 pci_get_powerstate.9 \ pci.9 pci_read_config.9 \ + pci.9 pci_restore_state.9 \ + pci.9 pci_save_state.9 \ pci.9 pci_set_powerstate.9 \ pci.9 pci_write_config.9 MLINKS+=pfil.9 pfil_add_hook.9 \ Modified: stable/9/share/man/man9/pci.9 ============================================================================== --- stable/9/share/man/man9/pci.9 Fri Mar 23 17:54:06 2012 (r233378) +++ stable/9/share/man/man9/pci.9 Fri Mar 23 18:03:04 2012 (r233379) @@ -38,6 +38,8 @@ .Nm pci_disable_io , .Nm pci_set_powerstate , .Nm pci_get_powerstate , +.Nm pci_save_state , +.Nm pci_restore_state , .Nm pci_find_bsf , .Nm pci_find_dbsf , .Nm pci_find_device @@ -63,6 +65,10 @@ .Fn pci_get_powerstate "device_t dev" .Ft uint32_t .Fn pci_read_config "device_t dev" "int reg" "int width" +.Ft void +.Fn pci_save_state "device_t dev" +.Ft void +.Fn pci_restore_state "device_t dev" .Ft device_t .Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" .Ft device_t @@ -188,6 +194,26 @@ of is set. .Pp The +.Fn pci_save_state +and +.Fn pci_restore_state +functions can be used by a device driver to save and restore standard PCI +config registers. +The +.Fn pci_save_state +function must be invoked while the device has valid state before +.Fn pci_restore_state +can be used. +If the device is not in the fully-powered state +.Pq Dv PCI_POWERSTATE_D0 +when +.Fn pci_restore_state +is invoked, +then the device will be transitioned to +.Dv PCI_POWERSTATE_D0 +before any config registers are restored. +.Pp +The .Fn pci_find_bsf function looks up the .Vt device_t Modified: stable/9/sys/dev/pci/pci.c ============================================================================== --- stable/9/sys/dev/pci/pci.c Fri Mar 23 17:54:06 2012 (r233378) +++ stable/9/sys/dev/pci/pci.c Fri Mar 23 18:03:04 2012 (r233379) @@ -4462,3 +4462,22 @@ pci_cfg_save(device_t dev, struct pci_de if (pci_get_powerstate(dev) != PCI_POWERSTATE_D3) pci_set_powerstate(dev, PCI_POWERSTATE_D3); } + +/* Wrapper APIs suitable for device driver use. */ +void +pci_save_state(device_t dev) +{ + struct pci_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + pci_cfg_save(dev, dinfo, 0); +} + +void +pci_restore_state(device_t dev) +{ + struct pci_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + pci_cfg_restore(dev, dinfo); +} Modified: stable/9/sys/dev/pci/pcivar.h ============================================================================== --- stable/9/sys/dev/pci/pcivar.h Fri Mar 23 17:54:06 2012 (r233378) +++ stable/9/sys/dev/pci/pcivar.h Fri Mar 23 18:03:04 2012 (r233379) @@ -467,6 +467,8 @@ int pci_msi_device_blacklisted(device_t void pci_ht_map_msi(device_t dev, uint64_t addr); int pci_get_max_read_req(device_t dev); +void pci_restore_state(device_t dev); +void pci_save_state(device_t dev); int pci_set_max_read_req(device_t dev, int size); #endif /* _SYS_BUS_H_ */ From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 18:03:39 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F0491065680; Fri, 23 Mar 2012 18:03:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68A548FC1A; Fri, 23 Mar 2012 18:03:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NI3diW087721; Fri, 23 Mar 2012 18:03:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NI3dx2087716; Fri, 23 Mar 2012 18:03:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231803.q2NI3dx2087716@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 18:03:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233380 - in stable/8: share/man/man9 sys/dev/pci sys/i386/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 18:03:39 -0000 Author: jhb Date: Fri Mar 23 18:03:38 2012 New Revision: 233380 URL: http://svn.freebsd.org/changeset/base/233380 Log: MFC 232360: Add pci_save_state() and pci_restore_state() wrappers around pci_cfg_save() and pci_cfg_restore() for device drivers to use when saving and restoring state (e.g. to handle device-specific resets). Modified: stable/8/share/man/man9/Makefile stable/8/share/man/man9/pci.9 stable/8/sys/dev/pci/pci.c stable/8/sys/dev/pci/pcivar.h Directory Properties: stable/8/share/man/man9/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Fri Mar 23 18:03:04 2012 (r233379) +++ stable/8/share/man/man9/Makefile Fri Mar 23 18:03:38 2012 (r233380) @@ -944,6 +944,8 @@ MLINKS+=pci.9 pci_disable_busmaster.9 \ pci.9 pci_find_device.9 \ pci.9 pci_get_powerstate.9 \ pci.9 pci_read_config.9 \ + pci.9 pci_restore_state.9 \ + pci.9 pci_save_state.9 \ pci.9 pci_set_powerstate.9 \ pci.9 pci_write_config.9 MLINKS+=pfil.9 pfil_add_hook.9 \ Modified: stable/8/share/man/man9/pci.9 ============================================================================== --- stable/8/share/man/man9/pci.9 Fri Mar 23 18:03:04 2012 (r233379) +++ stable/8/share/man/man9/pci.9 Fri Mar 23 18:03:38 2012 (r233380) @@ -38,6 +38,8 @@ .Nm pci_disable_io , .Nm pci_set_powerstate , .Nm pci_get_powerstate , +.Nm pci_save_state , +.Nm pci_restore_state , .Nm pci_find_bsf , .Nm pci_find_dbsf , .Nm pci_find_device @@ -63,6 +65,10 @@ .Fn pci_get_powerstate "device_t dev" .Ft uint32_t .Fn pci_read_config "device_t dev" "int reg" "int width" +.Ft void +.Fn pci_save_state "device_t dev" +.Ft void +.Fn pci_restore_state "device_t dev" .Ft device_t .Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" .Ft device_t @@ -188,6 +194,26 @@ of is set. .Pp The +.Fn pci_save_state +and +.Fn pci_restore_state +functions can be used by a device driver to save and restore standard PCI +config registers. +The +.Fn pci_save_state +function must be invoked while the device has valid state before +.Fn pci_restore_state +can be used. +If the device is not in the fully-powered state +.Pq Dv PCI_POWERSTATE_D0 +when +.Fn pci_restore_state +is invoked, +then the device will be transitioned to +.Dv PCI_POWERSTATE_D0 +before any config registers are restored. +.Pp +The .Fn pci_find_bsf function looks up the .Vt device_t Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Fri Mar 23 18:03:04 2012 (r233379) +++ stable/8/sys/dev/pci/pci.c Fri Mar 23 18:03:38 2012 (r233380) @@ -4171,3 +4171,22 @@ pci_cfg_save(device_t dev, struct pci_de if (pci_get_powerstate(dev) != PCI_POWERSTATE_D3) pci_set_powerstate(dev, PCI_POWERSTATE_D3); } + +/* Wrapper APIs suitable for device driver use. */ +void +pci_save_state(device_t dev) +{ + struct pci_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + pci_cfg_save(dev, dinfo, 0); +} + +void +pci_restore_state(device_t dev) +{ + struct pci_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + pci_cfg_restore(dev, dinfo); +} Modified: stable/8/sys/dev/pci/pcivar.h ============================================================================== --- stable/8/sys/dev/pci/pcivar.h Fri Mar 23 18:03:04 2012 (r233379) +++ stable/8/sys/dev/pci/pcivar.h Fri Mar 23 18:03:38 2012 (r233380) @@ -460,6 +460,8 @@ int pci_msi_device_blacklisted(device_t void pci_ht_map_msi(device_t dev, uint64_t addr); int pci_get_max_read_req(device_t dev); +void pci_restore_state(device_t dev); +void pci_save_state(device_t dev); int pci_set_max_read_req(device_t dev, int size); #endif /* _SYS_BUS_H_ */ From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 18:22:20 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1133106564A; Fri, 23 Mar 2012 18:22:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C23718FC0A; Fri, 23 Mar 2012 18:22:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NIMKIN088458; Fri, 23 Mar 2012 18:22:20 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NIMKbx088456; Fri, 23 Mar 2012 18:22:20 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231822.q2NIMKbx088456@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 18:22:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233383 - in stable/9/sys: dev/e1000 i386/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 18:22:21 -0000 Author: jhb Date: Fri Mar 23 18:22:20 2012 New Revision: 233383 URL: http://svn.freebsd.org/changeset/base/233383 Log: MFC 232367: Properly handle failures in igb_setup_msix() by returning 0 if MSI or MSI-X allocation fails. Modified: stable/9/sys/dev/e1000/if_igb.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/dev/e1000/if_igb.c ============================================================================== --- stable/9/sys/dev/e1000/if_igb.c Fri Mar 23 18:12:25 2012 (r233382) +++ stable/9/sys/dev/e1000/if_igb.c Fri Mar 23 18:22:20 2012 (r233383) @@ -2631,7 +2631,7 @@ igb_setup_msix(struct adapter *adapter) "MSIX Configuration Problem, " "%d vectors configured, but %d queues wanted!\n", msgs, want); - return (ENXIO); + return (0); } if ((msgs) && pci_alloc_msix(dev, &msgs) == 0) { device_printf(adapter->dev, @@ -2641,9 +2641,11 @@ igb_setup_msix(struct adapter *adapter) } msi: msgs = pci_msi_count(dev); - if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) - device_printf(adapter->dev,"Using MSI interrupt\n"); - return (msgs); + if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) { + device_printf(adapter->dev," Using MSI interrupt\n"); + return (msgs); + } + return (0); } /********************************************************************* From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 18:22:38 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA3701065678; Fri, 23 Mar 2012 18:22:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A421A8FC0C; Fri, 23 Mar 2012 18:22:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NIMcXN088508; Fri, 23 Mar 2012 18:22:38 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NIMc1M088506; Fri, 23 Mar 2012 18:22:38 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231822.q2NIMc1M088506@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 18:22:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233384 - in stable/8/sys: dev/e1000 i386/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 18:22:38 -0000 Author: jhb Date: Fri Mar 23 18:22:38 2012 New Revision: 233384 URL: http://svn.freebsd.org/changeset/base/233384 Log: MFC 232367: Properly handle failures in igb_setup_msix() by returning 0 if MSI or MSI-X allocation fails. Modified: stable/8/sys/dev/e1000/if_igb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/dev/e1000/if_igb.c ============================================================================== --- stable/8/sys/dev/e1000/if_igb.c Fri Mar 23 18:22:20 2012 (r233383) +++ stable/8/sys/dev/e1000/if_igb.c Fri Mar 23 18:22:38 2012 (r233384) @@ -2702,7 +2702,7 @@ igb_setup_msix(struct adapter *adapter) "MSIX Configuration Problem, " "%d vectors configured, but %d queues wanted!\n", msgs, want); - return (ENXIO); + return (0); } if ((msgs) && pci_alloc_msix(dev, &msgs) == 0) { device_printf(adapter->dev, @@ -2712,9 +2712,11 @@ igb_setup_msix(struct adapter *adapter) } msi: msgs = pci_msi_count(dev); - if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) - device_printf(adapter->dev,"Using MSI interrupt\n"); - return (msgs); + if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) { + device_printf(adapter->dev," Using MSI interrupt\n"); + return (msgs); + } + return (0); } /********************************************************************* From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 18:29:10 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DF711065670; Fri, 23 Mar 2012 18:29:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6EFBD8FC16; Fri, 23 Mar 2012 18:29:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NITAre088755; Fri, 23 Mar 2012 18:29:10 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NITAFU088752; Fri, 23 Mar 2012 18:29:10 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231829.q2NITAFU088752@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 18:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233385 - in stable/9/sys: fs/tmpfs i386/conf ufs/ufs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 18:29:10 -0000 Author: jhb Date: Fri Mar 23 18:29:09 2012 New Revision: 233385 URL: http://svn.freebsd.org/changeset/base/233385 Log: MFC 232401: Similar to the fixes in 226967 and 226987, purge any name cache entries associated with the previous vnode (if any) associated with the target of a rename(). Otherwise, a lookup of the target pathname concurrent with a rename() could re-add a name cache entry after the namei(RENAME) lookup in kern_renameat() had purged the target pathname. Modified: stable/9/sys/fs/tmpfs/tmpfs_vnops.c stable/9/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/9/sys/fs/tmpfs/tmpfs_vnops.c Fri Mar 23 18:22:38 2012 (r233384) +++ stable/9/sys/fs/tmpfs/tmpfs_vnops.c Fri Mar 23 18:29:09 2012 (r233385) @@ -1136,6 +1136,8 @@ tmpfs_rename(struct vop_rename_args *v) tmpfs_free_dirent(VFS_TO_TMPFS(tvp->v_mount), de, TRUE); } cache_purge(fvp); + if (tvp != NULL) + cache_purge(tvp); error = 0; Modified: stable/9/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/9/sys/ufs/ufs/ufs_vnops.c Fri Mar 23 18:22:38 2012 (r233384) +++ stable/9/sys/ufs/ufs/ufs_vnops.c Fri Mar 23 18:29:09 2012 (r233385) @@ -1534,8 +1534,15 @@ relock: * ufs_lookup_ino() and then VFS_VGET(), another thread might do a * normal lookup of the from name just before the VFS_VGET() call, * causing the cache entry to be re-instantiated. + * + * The same issue also applies to tvp if it exists as + * otherwise we may have a stale name cache entry for the new + * name that references the old i-node if it has other links + * or open file descriptors. */ cache_purge(fvp); + if (tvp) + cache_purge(tvp); unlockout: vput(fdvp); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 18:29:29 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F419C106566B; Fri, 23 Mar 2012 18:29:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C50598FC12; Fri, 23 Mar 2012 18:29:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NITSai088800; Fri, 23 Mar 2012 18:29:28 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NITSti088797; Fri, 23 Mar 2012 18:29:28 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231829.q2NITSti088797@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 18:29:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233386 - in stable/8/sys: fs/tmpfs i386/conf ufs/ufs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 18:29:29 -0000 Author: jhb Date: Fri Mar 23 18:29:28 2012 New Revision: 233386 URL: http://svn.freebsd.org/changeset/base/233386 Log: MFC 232401: Similar to the fixes in 226967 and 226987, purge any name cache entries associated with the previous vnode (if any) associated with the target of a rename(). Otherwise, a lookup of the target pathname concurrent with a rename() could re-add a name cache entry after the namei(RENAME) lookup in kern_renameat() had purged the target pathname. Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c stable/8/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vnops.c Fri Mar 23 18:29:09 2012 (r233385) +++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c Fri Mar 23 18:29:28 2012 (r233386) @@ -1072,6 +1072,8 @@ tmpfs_rename(struct vop_rename_args *v) tmpfs_free_dirent(VFS_TO_TMPFS(tvp->v_mount), de, TRUE); } cache_purge(fvp); + if (tvp != NULL) + cache_purge(tvp); error = 0; Modified: stable/8/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/8/sys/ufs/ufs/ufs_vnops.c Fri Mar 23 18:29:09 2012 (r233385) +++ stable/8/sys/ufs/ufs/ufs_vnops.c Fri Mar 23 18:29:28 2012 (r233386) @@ -1527,8 +1527,15 @@ relock: * ufs_lookup_ino() and then VFS_VGET(), another thread might do a * normal lookup of the from name just before the VFS_VGET() call, * causing the cache entry to be re-instantiated. + * + * The same issue also applies to tvp if it exists as + * otherwise we may have a stale name cache entry for the new + * name that references the old i-node if it has other links + * or open file descriptors. */ cache_purge(fvp); + if (tvp) + cache_purge(tvp); unlockout: vput(fdvp); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 20:25:51 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A59A1065670; Fri, 23 Mar 2012 20:25:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id CD7298FC18; Fri, 23 Mar 2012 20:25:50 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q2NKPh9W071136; Fri, 23 Mar 2012 22:25:43 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q2NKPhVQ098393; Fri, 23 Mar 2012 22:25:43 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q2NKPhur098392; Fri, 23 Mar 2012 22:25:43 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 23 Mar 2012 22:25:43 +0200 From: Konstantin Belousov To: Jim Harris Message-ID: <20120323202543.GN2358@deviant.kiev.zoral.com.ua> References: <201203231659.q2NGx3D9085333@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ki8osN6LALoCW/78" Content-Disposition: inline In-Reply-To: <201203231659.q2NGx3D9085333@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r233372 - stable/9/sys/dev/isci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 20:25:51 -0000 --ki8osN6LALoCW/78 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 23, 2012 at 04:59:03PM +0000, Jim Harris wrote: > Author: jimharris > Date: Fri Mar 23 16:59:03 2012 > New Revision: 233372 > URL: http://svn.freebsd.org/changeset/base/233372 >=20 > Log: > MFC r233371: Project policy requires to provide at least 3 days between head commit and consequent merge. This is explicitely stated in the committers guide, please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/rules.= html > =20 > Call xpt_bus_register during attach context, then freeze and do not rel= ease > until domain discovery is complete. This fixes an isci(4) bug on FreeB= SD 7.x > where devices weren't always appearing after boot without an explicit r= escan. --ki8osN6LALoCW/78 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk9s3EYACgkQC3+MBN1Mb4iaYwCfbUIwZLqlMiAAGJvDDQfq/j/K s+sAnRyDNs1yVFW4Nr/xM2XU9lrIQeuU =1rdP -----END PGP SIGNATURE----- --ki8osN6LALoCW/78-- From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 20:47:26 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CEAC106566C; Fri, 23 Mar 2012 20:47:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 045278FC22; Fri, 23 Mar 2012 20:47:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NKlPmK093455; Fri, 23 Mar 2012 20:47:25 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NKlPxK093447; Fri, 23 Mar 2012 20:47:25 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203232047.q2NKlPxK093447@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 20:47:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233393 - in stable/9/sys: dev/acpica dev/cardbus dev/pci i386/conf powerpc/ofw sparc64/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 20:47:26 -0000 Author: jhb Date: Fri Mar 23 20:47:25 2012 New Revision: 233393 URL: http://svn.freebsd.org/changeset/base/233393 Log: MFC 232403,232667: - Add a bus_dma tag to each PCI bus that is a child of a Host-PCI bridge. The tag enforces a single restriction that all DMA transactions must not cross a 4GB boundary. Note that while this restriction technically only applies to PCI-express, this change applies it to all PCI devices as it is simpler to implement that way and errs on the side of caution. - Add a softc structure for PCI bus devices to hold the bus_dma tag and a new pci_attach_common() routine that performs actions common to the attach phase of all PCI bus drivers. Right now this only consists of a bootverbose printf and the allocate of a bus_dma tag if necessary. - Adjust all PCI bus drivers to allocate a PCI bus softc and to call pci_attach_common() from their attach routines. Modified: stable/9/sys/dev/acpica/acpi_pci.c stable/9/sys/dev/cardbus/cardbus.c stable/9/sys/dev/pci/pci.c stable/9/sys/dev/pci/pci_private.h stable/9/sys/powerpc/ofw/ofw_pcibus.c stable/9/sys/sparc64/pci/ofw_pcibus.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/dev/acpica/acpi_pci.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_pci.c Fri Mar 23 20:18:48 2012 (r233392) +++ stable/9/sys/dev/acpica/acpi_pci.c Fri Mar 23 20:47:25 2012 (r233393) @@ -99,7 +99,8 @@ static device_method_t acpi_pci_methods[ static devclass_t pci_devclass; -DEFINE_CLASS_1(pci, acpi_pci_driver, acpi_pci_methods, 0, pci_driver); +DEFINE_CLASS_1(pci, acpi_pci_driver, acpi_pci_methods, sizeof(struct pci_softc), + pci_driver); DRIVER_MODULE(acpi_pci, pcib, acpi_pci_driver, pci_devclass, 0, 0); MODULE_DEPEND(acpi_pci, acpi, 1, 1, 1); MODULE_DEPEND(acpi_pci, pci, 1, 1, 1); @@ -276,7 +277,11 @@ acpi_pci_probe(device_t dev) static int acpi_pci_attach(device_t dev) { - int busno, domain; + int busno, domain, error; + + error = pci_attach_common(dev); + if (error) + return (error); /* * Since there can be multiple independantly numbered PCI @@ -286,9 +291,6 @@ acpi_pci_attach(device_t dev) */ domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); /* * First, PCI devices are added as in the normal PCI bus driver. Modified: stable/9/sys/dev/cardbus/cardbus.c ============================================================================== --- stable/9/sys/dev/cardbus/cardbus.c Fri Mar 23 20:18:48 2012 (r233392) +++ stable/9/sys/dev/cardbus/cardbus.c Fri Mar 23 20:47:25 2012 (r233393) @@ -316,6 +316,7 @@ static device_method_t cardbus_methods[] DEVMETHOD(device_resume, cardbus_resume), /* Bus interface */ + DEVMETHOD(bus_get_dma_tag, bus_generic_get_dma_tag), DEVMETHOD(bus_read_ivar, cardbus_read_ivar), DEVMETHOD(bus_driver_added, cardbus_driver_added), Modified: stable/9/sys/dev/pci/pci.c ============================================================================== --- stable/9/sys/dev/pci/pci.c Fri Mar 23 20:18:48 2012 (r233392) +++ stable/9/sys/dev/pci/pci.c Fri Mar 23 20:47:25 2012 (r233393) @@ -70,6 +70,21 @@ __FBSDID("$FreeBSD$"); #include "pcib_if.h" #include "pci_if.h" +/* + * XXX: Due to a limitation of the bus_dma_tag_create() API, we cannot + * specify a 4GB boundary on 32-bit targets. Usually this does not + * matter as it is ok to use a boundary of 0 on these systems. + * However, in the case of PAE, DMA addresses can cross a 4GB + * boundary, so as a workaround use a 2GB boundary. + */ +#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) +#ifdef PAE +#define PCI_DMA_BOUNDARY 0x80000000 +#else +#define PCI_DMA_BOUNDARY 0x100000000 +#endif +#endif + #define PCIR_IS_BIOS(cfg, reg) \ (((cfg)->hdrtype == PCIM_HDRTYPE_NORMAL && reg == PCIR_BIOS) || \ ((cfg)->hdrtype == PCIM_HDRTYPE_BRIDGE && reg == PCIR_BIOS_1)) @@ -95,6 +110,7 @@ static void pci_load_vendor_data(void); static int pci_describe_parse_line(char **ptr, int *vendor, int *device, char **desc); static char *pci_describe_device(device_t dev); +static bus_dma_tag_t pci_get_dma_tag(device_t bus, device_t dev); static int pci_modevent(module_t mod, int what, void *arg); static void pci_hdrtypedata(device_t pcib, int b, int s, int f, pcicfgregs *cfg); @@ -137,6 +153,7 @@ static device_method_t pci_methods[] = { DEVMETHOD(bus_setup_intr, pci_setup_intr), DEVMETHOD(bus_teardown_intr, pci_teardown_intr), + DEVMETHOD(bus_get_dma_tag, pci_get_dma_tag), DEVMETHOD(bus_get_resource_list,pci_get_resource_list), DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), @@ -173,7 +190,7 @@ static device_method_t pci_methods[] = { DEVMETHOD_END }; -DEFINE_CLASS_0(pci, pci_driver, pci_methods, 0); +DEFINE_CLASS_0(pci, pci_driver, pci_methods, sizeof(struct pci_softc)); static devclass_t pci_devclass; DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, 0); @@ -3160,10 +3177,49 @@ pci_probe(device_t dev) return (BUS_PROBE_GENERIC); } +int +pci_attach_common(device_t dev) +{ + struct pci_softc *sc; + int busno, domain; +#ifdef PCI_DMA_BOUNDARY + int error, tag_valid; +#endif + + sc = device_get_softc(dev); + domain = pcib_get_domain(dev); + busno = pcib_get_bus(dev); + if (bootverbose) + device_printf(dev, "domain=%d, physical bus=%d\n", + domain, busno); +#ifdef PCI_DMA_BOUNDARY + tag_valid = 0; + if (device_get_devclass(device_get_parent(device_get_parent(dev))) != + devclass_find("pci")) { + error = bus_dma_tag_create(bus_get_dma_tag(dev), 1, + PCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, + NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED, + BUS_SPACE_MAXSIZE, 0, NULL, NULL, &sc->sc_dma_tag); + if (error) + device_printf(dev, "Failed to create DMA tag: %d\n", + error); + else + tag_valid = 1; + } + if (!tag_valid) +#endif + sc->sc_dma_tag = bus_get_dma_tag(dev); + return (0); +} + static int pci_attach(device_t dev) { - int busno, domain; + int busno, domain, error; + + error = pci_attach_common(dev); + if (error) + return (error); /* * Since there can be multiple independantly numbered PCI @@ -3173,9 +3229,6 @@ pci_attach(device_t dev) */ domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); pci_add_children(dev, domain, busno, sizeof(struct pci_devinfo)); return (bus_generic_attach(dev)); } @@ -4262,6 +4315,14 @@ pci_get_resource_list (device_t dev, dev return (&dinfo->resources); } +bus_dma_tag_t +pci_get_dma_tag(device_t bus, device_t dev) +{ + struct pci_softc *sc = device_get_softc(bus); + + return (sc->sc_dma_tag); +} + uint32_t pci_read_config_method(device_t dev, device_t child, int reg, int width) { Modified: stable/9/sys/dev/pci/pci_private.h ============================================================================== --- stable/9/sys/dev/pci/pci_private.h Fri Mar 23 20:18:48 2012 (r233392) +++ stable/9/sys/dev/pci/pci_private.h Fri Mar 23 20:47:25 2012 (r233393) @@ -38,6 +38,10 @@ */ DECLARE_CLASS(pci_driver); +struct pci_softc { + bus_dma_tag_t sc_dma_tag; +}; + extern int pci_do_power_resume; extern int pci_do_power_suspend; @@ -46,6 +50,7 @@ void pci_add_children(device_t dev, int void pci_add_child(device_t bus, struct pci_devinfo *dinfo); void pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask); +int pci_attach_common(device_t dev); void pci_delete_child(device_t dev, device_t child); void pci_driver_added(device_t dev, driver_t *driver); int pci_print_child(device_t dev, device_t child); Modified: stable/9/sys/powerpc/ofw/ofw_pcibus.c ============================================================================== --- stable/9/sys/powerpc/ofw/ofw_pcibus.c Fri Mar 23 20:18:48 2012 (r233392) +++ stable/9/sys/powerpc/ofw/ofw_pcibus.c Fri Mar 23 20:47:25 2012 (r233393) @@ -95,8 +95,8 @@ struct ofw_pcibus_devinfo { static devclass_t pci_devclass; -DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, 1 /* no softc */, - pci_driver); +DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, + sizeof(struct pci_softc), pci_driver); DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0); MODULE_VERSION(ofw_pcibus, 1); MODULE_DEPEND(ofw_pcibus, pci, 1, 1, 1); @@ -116,12 +116,13 @@ static int ofw_pcibus_attach(device_t dev) { u_int busno, domain; + int error; + error = pci_attach_common(dev); + if (error) + return (error); domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); /* * Attach those children represented in the device tree. Modified: stable/9/sys/sparc64/pci/ofw_pcibus.c ============================================================================== --- stable/9/sys/sparc64/pci/ofw_pcibus.c Fri Mar 23 20:18:48 2012 (r233392) +++ stable/9/sys/sparc64/pci/ofw_pcibus.c Fri Mar 23 20:47:25 2012 (r233393) @@ -100,8 +100,8 @@ struct ofw_pcibus_devinfo { static devclass_t pci_devclass; -DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, 1 /* no softc */, - pci_driver); +DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, + sizeof(struct pci_softc), pci_driver); EARLY_DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0, BUS_PASS_BUS); MODULE_VERSION(ofw_pcibus, 1); @@ -230,13 +230,14 @@ ofw_pcibus_attach(device_t dev) phandle_t node, child; uint32_t clock; u_int busno, domain, func, slot; + int error; + error = pci_attach_common(dev); + if (error) + return (error); pcib = device_get_parent(dev); domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); node = ofw_bus_get_node(dev); /* From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 20:47:50 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC9701065674; Fri, 23 Mar 2012 20:47:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95B838FC18; Fri, 23 Mar 2012 20:47:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NKloJQ093507; Fri, 23 Mar 2012 20:47:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NKloX5093500; Fri, 23 Mar 2012 20:47:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203232047.q2NKloX5093500@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 20:47:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233394 - in stable/8/sys: dev/acpica dev/cardbus dev/pci i386/conf powerpc/ofw sparc64/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 20:47:50 -0000 Author: jhb Date: Fri Mar 23 20:47:49 2012 New Revision: 233394 URL: http://svn.freebsd.org/changeset/base/233394 Log: MFC 232403,232667: - Add a bus_dma tag to each PCI bus that is a child of a Host-PCI bridge. The tag enforces a single restriction that all DMA transactions must not cross a 4GB boundary. Note that while this restriction technically only applies to PCI-express, this change applies it to all PCI devices as it is simpler to implement that way and errs on the side of caution. - Add a softc structure for PCI bus devices to hold the bus_dma tag and a new pci_attach_common() routine that performs actions common to the attach phase of all PCI bus drivers. Right now this only consists of a bootverbose printf and the allocate of a bus_dma tag if necessary. - Adjust all PCI bus drivers to allocate a PCI bus softc and to call pci_attach_common() from their attach routines. Modified: stable/8/sys/dev/acpica/acpi_pci.c stable/8/sys/dev/cardbus/cardbus.c stable/8/sys/dev/pci/pci.c stable/8/sys/dev/pci/pci_private.h stable/8/sys/powerpc/ofw/ofw_pcibus.c stable/8/sys/sparc64/pci/ofw_pcibus.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/dev/acpica/acpi_pci.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_pci.c Fri Mar 23 20:47:25 2012 (r233393) +++ stable/8/sys/dev/acpica/acpi_pci.c Fri Mar 23 20:47:49 2012 (r233394) @@ -99,7 +99,8 @@ static device_method_t acpi_pci_methods[ static devclass_t pci_devclass; -DEFINE_CLASS_1(pci, acpi_pci_driver, acpi_pci_methods, 0, pci_driver); +DEFINE_CLASS_1(pci, acpi_pci_driver, acpi_pci_methods, sizeof(struct pci_softc), + pci_driver); DRIVER_MODULE(acpi_pci, pcib, acpi_pci_driver, pci_devclass, 0, 0); MODULE_DEPEND(acpi_pci, acpi, 1, 1, 1); MODULE_DEPEND(acpi_pci, pci, 1, 1, 1); @@ -288,7 +289,11 @@ acpi_pci_probe(device_t dev) static int acpi_pci_attach(device_t dev) { - int busno, domain; + int busno, domain, error; + + error = pci_attach_common(dev); + if (error) + return (error); /* * Since there can be multiple independantly numbered PCI @@ -298,9 +303,6 @@ acpi_pci_attach(device_t dev) */ domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); /* * First, PCI devices are added as in the normal PCI bus driver. Modified: stable/8/sys/dev/cardbus/cardbus.c ============================================================================== --- stable/8/sys/dev/cardbus/cardbus.c Fri Mar 23 20:47:25 2012 (r233393) +++ stable/8/sys/dev/cardbus/cardbus.c Fri Mar 23 20:47:49 2012 (r233394) @@ -345,6 +345,7 @@ static device_method_t cardbus_methods[] DEVMETHOD(device_resume, cardbus_resume), /* Bus interface */ + DEVMETHOD(bus_get_dma_tag, bus_generic_get_dma_tag), DEVMETHOD(bus_read_ivar, cardbus_read_ivar), DEVMETHOD(bus_write_ivar, pci_write_ivar), DEVMETHOD(bus_driver_added, cardbus_driver_added), Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Fri Mar 23 20:47:25 2012 (r233393) +++ stable/8/sys/dev/pci/pci.c Fri Mar 23 20:47:49 2012 (r233394) @@ -76,6 +76,21 @@ __FBSDID("$FreeBSD$"); #define ACPI_PWR_FOR_SLEEP(x, y, z) #endif +/* + * XXX: Due to a limitation of the bus_dma_tag_create() API, we cannot + * specify a 4GB boundary on 32-bit targets. Usually this does not + * matter as it is ok to use a boundary of 0 on these systems. + * However, in the case of PAE, DMA addresses can cross a 4GB + * boundary, so as a workaround use a 2GB boundary. + */ +#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) +#ifdef PAE +#define PCI_DMA_BOUNDARY 0x80000000 +#else +#define PCI_DMA_BOUNDARY 0x100000000 +#endif +#endif + static pci_addr_t pci_mapbase(uint64_t mapreg); static const char *pci_maptype(uint64_t mapreg); static int pci_mapsize(uint64_t testval); @@ -95,6 +110,7 @@ static void pci_load_vendor_data(void); static int pci_describe_parse_line(char **ptr, int *vendor, int *device, char **desc); static char *pci_describe_device(device_t dev); +static bus_dma_tag_t pci_get_dma_tag(device_t bus, device_t dev); static int pci_modevent(module_t mod, int what, void *arg); static void pci_hdrtypedata(device_t pcib, int b, int s, int f, pcicfgregs *cfg); @@ -137,6 +153,7 @@ static device_method_t pci_methods[] = { DEVMETHOD(bus_setup_intr, pci_setup_intr), DEVMETHOD(bus_teardown_intr, pci_teardown_intr), + DEVMETHOD(bus_get_dma_tag, pci_get_dma_tag), DEVMETHOD(bus_get_resource_list,pci_get_resource_list), DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), @@ -173,7 +190,7 @@ static device_method_t pci_methods[] = { DEVMETHOD_END }; -DEFINE_CLASS_0(pci, pci_driver, pci_methods, 0); +DEFINE_CLASS_0(pci, pci_driver, pci_methods, sizeof(struct pci_softc)); static devclass_t pci_devclass; DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, 0); @@ -2925,10 +2942,49 @@ pci_probe(device_t dev) return (BUS_PROBE_GENERIC); } +int +pci_attach_common(device_t dev) +{ + struct pci_softc *sc; + int busno, domain; +#ifdef PCI_DMA_BOUNDARY + int error, tag_valid; +#endif + + sc = device_get_softc(dev); + domain = pcib_get_domain(dev); + busno = pcib_get_bus(dev); + if (bootverbose) + device_printf(dev, "domain=%d, physical bus=%d\n", + domain, busno); +#ifdef PCI_DMA_BOUNDARY + tag_valid = 0; + if (device_get_devclass(device_get_parent(device_get_parent(dev))) != + devclass_find("pci")) { + error = bus_dma_tag_create(bus_get_dma_tag(dev), 1, + PCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, + NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED, + BUS_SPACE_MAXSIZE, 0, NULL, NULL, &sc->sc_dma_tag); + if (error) + device_printf(dev, "Failed to create DMA tag: %d\n", + error); + else + tag_valid = 1; + } + if (!tag_valid) +#endif + sc->sc_dma_tag = bus_get_dma_tag(dev); + return (0); +} + static int pci_attach(device_t dev) { - int busno, domain; + int busno, domain, error; + + error = pci_attach_common(dev); + if (error) + return (error); /* * Since there can be multiple independantly numbered PCI @@ -2938,9 +2994,6 @@ pci_attach(device_t dev) */ domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); pci_add_children(dev, domain, busno, sizeof(struct pci_devinfo)); return (bus_generic_attach(dev)); } @@ -3963,6 +4016,14 @@ pci_get_resource_list (device_t dev, dev return (&dinfo->resources); } +bus_dma_tag_t +pci_get_dma_tag(device_t bus, device_t dev) +{ + struct pci_softc *sc = device_get_softc(bus); + + return (sc->sc_dma_tag); +} + uint32_t pci_read_config_method(device_t dev, device_t child, int reg, int width) { Modified: stable/8/sys/dev/pci/pci_private.h ============================================================================== --- stable/8/sys/dev/pci/pci_private.h Fri Mar 23 20:47:25 2012 (r233393) +++ stable/8/sys/dev/pci/pci_private.h Fri Mar 23 20:47:49 2012 (r233394) @@ -38,11 +38,16 @@ */ DECLARE_CLASS(pci_driver); +struct pci_softc { + bus_dma_tag_t sc_dma_tag; +}; + void pci_add_children(device_t dev, int domain, int busno, size_t dinfo_size); void pci_add_child(device_t bus, struct pci_devinfo *dinfo); void pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask); +int pci_attach_common(device_t dev); void pci_driver_added(device_t dev, driver_t *driver); int pci_print_child(device_t dev, device_t child); void pci_probe_nomatch(device_t dev, device_t child); Modified: stable/8/sys/powerpc/ofw/ofw_pcibus.c ============================================================================== --- stable/8/sys/powerpc/ofw/ofw_pcibus.c Fri Mar 23 20:47:25 2012 (r233393) +++ stable/8/sys/powerpc/ofw/ofw_pcibus.c Fri Mar 23 20:47:49 2012 (r233394) @@ -95,8 +95,8 @@ struct ofw_pcibus_devinfo { static devclass_t pci_devclass; -DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, 1 /* no softc */, - pci_driver); +DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, + sizeof(struct pci_softc), pci_driver); DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0); MODULE_VERSION(ofw_pcibus, 1); MODULE_DEPEND(ofw_pcibus, pci, 1, 1, 1); @@ -116,12 +116,13 @@ static int ofw_pcibus_attach(device_t dev) { u_int busno, domain; + int error; + error = pci_attach_common(dev); + if (error) + return (error); domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); /* * Attach those children represented in the device tree. Modified: stable/8/sys/sparc64/pci/ofw_pcibus.c ============================================================================== --- stable/8/sys/sparc64/pci/ofw_pcibus.c Fri Mar 23 20:47:25 2012 (r233393) +++ stable/8/sys/sparc64/pci/ofw_pcibus.c Fri Mar 23 20:47:49 2012 (r233394) @@ -100,8 +100,8 @@ struct ofw_pcibus_devinfo { static devclass_t pci_devclass; -DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, 1 /* no softc */, - pci_driver); +DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, + sizeof(struct pci_softc), pci_driver); EARLY_DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0, BUS_PASS_BUS); MODULE_VERSION(ofw_pcibus, 1); @@ -230,13 +230,14 @@ ofw_pcibus_attach(device_t dev) phandle_t node, child; uint32_t clock; u_int busno, domain, func, slot; + int error; + error = pci_attach_common(dev); + if (error) + return (error); pcib = device_get_parent(dev); domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); node = ofw_bus_get_node(dev); /* From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 20:58:19 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 883E0106566B; Fri, 23 Mar 2012 20:58:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 718038FC08; Fri, 23 Mar 2012 20:58:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NKwJqc093991; Fri, 23 Mar 2012 20:58:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NKwJT0093987; Fri, 23 Mar 2012 20:58:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203232058.q2NKwJT0093987@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 20:58:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233395 - stable/9/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 20:58:19 -0000 Author: jhb Date: Fri Mar 23 20:58:18 2012 New Revision: 233395 URL: http://svn.freebsd.org/changeset/base/233395 Log: MFC 232362,232363,232463,232553,232569,232571: - Sort function prototypes. - Update the documentation on pci_get/set_powerstate(). These methods are not ACPI-specific at all, but deal with PCI power states. Also, pci_set_powerstate() fails with EOPNOTSUPP if a request is made that the underlying device does not support rather than falling back to somehow setting D0. - Document the following routines: pci_alloc_msi(), pci_alloc_msix(), pci_find_cap(), pci_get_max_read_req(), pci_get_vpd_ident(), pci_get_vpd_readonly(), pci_msi_count(), pci_msix_count(), pci_pending_msix(), pci_release_msi(), pci_remap_msix(), and pci_set_max_read_req(). - Group the functions into five sub-sections: raw configuration access, locating devices, device information, device configuration, and message signaled interrupts. - Discourage use of pci_disable_io() and pci_enable_io() in device drivers. The PCI bus driver handles this automatically as resources are activated. Modified: stable/9/share/man/man9/Makefile stable/9/share/man/man9/pci.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/Makefile ============================================================================== --- stable/9/share/man/man9/Makefile Fri Mar 23 20:47:49 2012 (r233394) +++ stable/9/share/man/man9/Makefile Fri Mar 23 20:58:18 2012 (r233395) @@ -969,18 +969,30 @@ MLINKS+=namei.9 NDFREE.9 \ MLINKS+=pbuf.9 getpbuf.9 \ pbuf.9 relpbuf.9 \ pbuf.9 trypbuf.9 -MLINKS+=pci.9 pci_disable_busmaster.9 \ +MLINKS+=pci.9 pci_alloc_msi.9 \ + pci.9 pci_alloc_msix.9 \ + pci.9 pci_disable_busmaster.9 \ pci.9 pci_disable_io.9 \ pci.9 pci_enable_busmaster.9 \ pci.9 pci_enable_io.9 \ pci.9 pci_find_bsf.9 \ + pci.9 pci_find_cap.9 \ pci.9 pci_find_dbsf.9 \ pci.9 pci_find_device.9 \ + pci.9 pci_get_max_read_req.9 \ pci.9 pci_get_powerstate.9 \ + pci.9 pci_get_vpd_ident.9 \ + pci.9 pci_get_vpd_readonly.9 \ + pci.9 pci_msi_count.9 \ + pci.9 pci_msix_count.9 \ + pci.9 pci_pending_msix.9 \ pci.9 pci_read_config.9 \ + pci.9 pci_release_msi.9 \ + pci.9 pci_remap_msix.9 \ pci.9 pci_restore_state.9 \ pci.9 pci_save_state.9 \ pci.9 pci_set_powerstate.9 \ + pci.9 pci_set_max_read_req.9 \ pci.9 pci_write_config.9 MLINKS+=pfil.9 pfil_add_hook.9 \ pfil.9 pfil_hook_get.9 \ Modified: stable/9/share/man/man9/pci.9 ============================================================================== --- stable/9/share/man/man9/pci.9 Fri Mar 23 20:47:49 2012 (r233394) +++ stable/9/share/man/man9/pci.9 Fri Mar 23 20:58:18 2012 (r233395) @@ -25,61 +25,103 @@ .\" .\" $FreeBSD$ .\" -.Dd September 30, 2007 +.Dd March 5, 2012 .Dt PCI 9 .Os .Sh NAME .Nm pci , -.Nm pci_read_config , -.Nm pci_write_config , -.Nm pci_enable_busmaster , +.Nm pci_alloc_msi , +.Nm pci_alloc_msix , .Nm pci_disable_busmaster , -.Nm pci_enable_io , .Nm pci_disable_io , -.Nm pci_set_powerstate , -.Nm pci_get_powerstate , -.Nm pci_save_state , -.Nm pci_restore_state , +.Nm pci_enable_busmaster , +.Nm pci_enable_io , .Nm pci_find_bsf , +.Nm pci_find_cap , .Nm pci_find_dbsf , -.Nm pci_find_device +.Nm pci_find_device , +.Nm pci_get_max_read_req , +.Nm pci_get_powerstate , +.Nm pci_get_vpd_ident , +.Nm pci_get_vpd_readonly , +.Nm pci_msi_count , +.Nm pci_msix_count , +.Nm pci_pending_msix , +.Nm pci_read_config , +.Nm pci_release_msi , +.Nm pci_remap_msix , +.Nm pci_restore_state , +.Nm pci_save_state , +.Nm pci_set_max_read_req , +.Nm pci_set_powerstate , +.Nm pci_write_config .Nd PCI bus interface .Sh SYNOPSIS .In sys/bus.h -.In dev/pci/pcivar.h .In dev/pci/pcireg.h -.In machine/pci_cfgreg.h -.Ft void -.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width" +.In dev/pci/pcivar.h .Ft int -.Fn pci_enable_busmaster "device_t dev" +.Fn pci_alloc_msi "device_t dev" "int *count" +.Ft int +.Fn pci_alloc_msix "device_t dev" "int *count" .Ft int .Fn pci_disable_busmaster "device_t dev" .Ft int +.Fn pci_disable_io "device_t dev" "int space" +.Ft int +.Fn pci_enable_busmaster "device_t dev" +.Ft int .Fn pci_enable_io "device_t dev" "int space" +.Ft device_t +.Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" .Ft int -.Fn pci_disable_io "device_t dev" "int space" +.Fn pci_find_cap "device_t dev" "int capability" "int *capreg" +.Ft device_t +.Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func" +.Ft device_t +.Fn pci_find_device "uint16_t vendor" "uint16_t device" .Ft int -.Fn pci_set_powerstate "device_t dev" "int state" +.Fn pci_get_max_read_req "device_t dev" .Ft int .Fn pci_get_powerstate "device_t dev" +.Ft int +.Fn pci_get_vpd_ident "device_t dev" "const char **identptr" +.Ft int +.Fn pci_get_vpd_readonly "device_t dev" "const char *kw" "const char **vptr" +.Ft int +.Fn pci_msi_count "device_t dev" +.Ft int +.Fn pci_msix_count "device_t dev" +.Ft int +.Fn pci_pending_msix "device_t dev" "u_int index" .Ft uint32_t .Fn pci_read_config "device_t dev" "int reg" "int width" +.Ft int +.Fn pci_release_msi "device_t dev" +.Ft int +.Fn pci_remap_msix "device_t dev" "int count" "const u_int *vectors" +.Ft void +.Fn pci_restore_state "device_t dev" .Ft void .Fn pci_save_state "device_t dev" +.Ft int +.Fn pci_set_max_read_req "device_t dev" "int size" +.Ft int +.Fn pci_set_powerstate "device_t dev" "int state" .Ft void -.Fn pci_restore_state "device_t dev" -.Ft device_t -.Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" -.Ft device_t -.Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func" -.Ft device_t -.Fn pci_find_device "uint16_t vendor" "uint16_t device" +.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width" .Sh DESCRIPTION The .Nm set of functions are used for managing PCI devices. -.Pp +The functions are split into several groups: +raw configuration access, +locating devices, +device information, +device configuration, +and +message signaled interrupts. +.Ss Raw Configuration Access The .Fn pci_read_config function is used to read data from the PCI configuration @@ -104,6 +146,126 @@ with .Fa width specifying the size of the access. .Pp +.Em NOTE : +Device drivers should only use these functions for functionality that +is not available via another +.Fn pci +function. +.Ss Locating Devices +The +.Fn pci_find_bsf +function looks up the +.Vt device_t +of a PCI device, given its +.Fa bus , +.Fa slot , +and +.Fa func . +The +.Fa slot +number actually refers to the number of the device on the bus, +which does not necessarily indicate its geographic location +in terms of a physical slot. +Note that in case the system has multiple PCI domains, +the +.Fn pci_find_bsf +function only searches the first one. +Actually, it is equivalent to: +.Bd -literal -offset indent +pci_find_dbsf(0, bus, slot, func); +.Ed +.Pp +The +.Fn pci_find_dbsf +function looks up the +.Vt device_t +of a PCI device, given its +.Fa domain , +.Fa bus , +.Fa slot , +and +.Fa func . +The +.Fa slot +number actually refers to the number of the device on the bus, +which does not necessarily indicate its geographic location +in terms of a physical slot. +.Pp +The +.Fn pci_find_device +function looks up the +.Vt device_t +of a PCI device, given its +.Fa vendor +and +.Fa device +IDs. +Note that there can be multiple matches for this search; this function +only returns the first matching device. +.Ss Device Information +The +.Fn pci_find_cap +function is used to locate the first instance of a PCI capability +register set for the device +.Fa dev . +The capability to locate is specified by ID via +.Fa capability . +Constant macros of the form +.Dv PCIY_xxx +for standard capability IDs are defined in +.In dev/pci/pcireg.h . +If the capability is found, then +.Fa *capreg +is set to the offset in configuration space of the capability register set, +and +.Fn pci_find_cap +returns zero. +If the capability is not found or the device does not support capabilities, +.Fn pci_find_cap +returns an error. +.Pp +The +.Fn pci_get_vpd_ident +function is used to fetch a device's Vital Product Data +.Pq VPD +identifier string. +If the device +.Fa dev +supports VPD and provides an identifier string, +then +.Fa *identptr +is set to point at a read-only, null-terminated copy of the identifier +string, +and +.Fn pci_get_vpd_ident +returns zero. +If the device does not support VPD or does not provide an identifier +string, +then +.Fn pci_get_vpd_ident +returns an error. +.Pp +The +.Fn pci_get_vpd_readonly +function is used to fetch the value of a single VPD read-only keyword +for the device +.Fa dev . +The keyword to fetch is identified by the two character string +.Fa kw . +If the device supports VPD and provides a read-only value for the +requested keyword, +then +.Fa *vptr +is set to point at a read-only, null-terminated copy of the value, +and +.Fn pci_get_vpd_readonly +returns zero. +If the device does not support VPD or does not provide the requested +keyword, +then +.Fn pci_get_vpd_readonly +returns an error. +.Ss Device Configuration The .Fn pci_enable_busmaster function enables PCI bus mastering for the device @@ -138,20 +300,51 @@ argument specifies which resource is aff or .Dv SYS_RES_IOPORT as appropriate. +Device drivers should generally not use these routines directly. +The PCI bus will enable decoding automatically when a +.Dv SYS_RES_MEMORY +or +.Dv SYS_RES_IOPORT +resource is activated via +.Xr bus_alloc_resource 9 +or +.Xr bus_activate_resource 9 . .Pp -.Em NOTE : -These functions should be used in preference to manually manipulating -the configuration space. +The +.Fn pci_get_max_read_req +function returns the current maximum read request size in bytes for a +PCI-express device. +If the +.Fa dev +device is not a PCI-express device, +.Fn pci_get_max_read_req +returns zero. +.Pp +The +.Fn pci_set_max_read_req +sets the PCI-express maximum read request size for +.Fa dev . +The requested +.Fa size +may be adjusted, +and +.Fn pci_set_max_read_req +returns the actual size set in bytes. +If the +.Fa dev +device is not a PCI-express device, +.Fn pci_set_max_read_req +returns zero. .Pp The .Fn pci_get_powerstate -function returns the current ACPI power state of the device +function returns the current power state of the device .Fa dev . If the device does not support power management capabilities, then the default state of .Dv PCI_POWERSTATE_D0 is returned. -The following power states are defined by ACPI: +The following power states are defined by PCI: .Bl -hang -width ".Dv PCI_POWERSTATE_UNKNOWN" .It Dv PCI_POWERSTATE_D0 State in which device is on and running. @@ -183,15 +376,13 @@ The .Fn pci_set_powerstate function is used to transition the device .Fa dev -to the ACPI power state +to the PCI power state .Fa state . -It checks to see if the device is PCI 2.2 compliant. -If so, it checks the -capabilities pointer to determine which power states the device supports. -If the device does not have power management capabilities, the default state -of -.Dv PCI_POWERSTATE_D0 -is set. +If the device does not support power management capabilities or +it does not support the specific power state +.Fa state , +then the function will fail with +.Er EOPNOTSUPP . .Pp The .Fn pci_save_state @@ -212,57 +403,216 @@ is invoked, then the device will be transitioned to .Dv PCI_POWERSTATE_D0 before any config registers are restored. -.Pp -The -.Fn pci_find_bsf -function looks up the -.Vt device_t -of a PCI device, given its -.Fa bus , -.Fa slot , +.Ss Message Signaled Interrupts +Message Signaled Interrupts +.Pq MSI and -.Fa func . +Enhanced Message Signaled Interrupts +.Pq MSI-X +are PCI capabilities that provide an alternate method for PCI +devices to signal interrupts. +The legacy INTx interrupt is available to PCI devices as a +.Dv SYS_RES_IRQ +resource with a resource ID of zero. +MSI and MSI-X interrupts are available to PCI devices as one or more +.Dv SYS_RES_IRQ +resources with resource IDs greater than zero. +A driver must ask the PCI bus to allocate MSI or MSI-X interrupts +using +.Fn pci_alloc_msi +or +.Fn pci_alloc_msix +before it can use MSI or MSI-X +.Dv SYS_RES_IRQ +resources. +A driver is not allowed to use the legacy INTx +.Dv SYS_RES_IRQ +resource if MSI or MSI-X interrupts have been allocated, +and attempts to allocate MSI or MSI-X interrupts will fail if the +driver is currently using the legacy INTx +.Dv SYS_RES_IRQ +resource. +A driver is only allowed to use either MSI or MSI-X, +but not both. +.Pp +The +.Fn pci_count_msi +function returns the maximum number of MSI messages supported by the +device +.Fa dev. +If the device does not support MSI, +then +.Fn pci_count_msi +returns zero. +.Pp +The +.Fn pci_alloc_msi +function attempts to allocate +.Fa *count +MSI messages for the device +.Fa dev . The -.Fa slot -number actually refers to the number of the device on the bus, -which does not necessarily indicate its geographic location -in terms of a physical slot. -Note that in case the system has multiple PCI domains, -the -.Fn pci_find_bsf -function only searches the first one. -Actually, it is equivalent to: -.Bd -literal -offset indent -pci_find_dbsf(0, bus, slot, func); -.Ed +.Fn pci_alloc_msi +function may allocate fewer messages than requested for various +reasons including requests for more messages than the device +.Fa dev +supports, +or if the system has a shortage of available MSI messages. +On success, +.Fa *count +is set to the number of messages allocated and +.Fn pci_alloc_msi +returns zero. +The +.Dv SYS_RES_IRQ +resources for the allocated messages will be available at consecutive +resource IDs beginning with one. +If +.Fn pci_alloc_msi +is not able to allocate any messages, +it returns an error. +Note that MSI only supports message counts that are powers of two; +requests to allocate a non-power of two count of messages will fail. +.Pp +The +.Fn pci_release_msi +function is used to release any allocated MSI or MSI-X messages back +to the system. +If any MSI or MSI-X +.Dv SYS_RES_IRQ +resources are allocated by the driver or have a configured interrupt +handler, +this function will fail with +.Er EBUSY . +The +.Fn pci_release_msi +function returns zero on success and an error on failure. +.Pp +The +.Fn pci_count_msix +function returns the maximum number of MSI-X messages supported by the +device +.Fa dev . +If the device does not support MSI-X, +then +.Fn pci_count_msix +returns zero. .Pp The -.Fn pci_find_dbsf -function looks up the -.Vt device_t -of a PCI device, given its -.Fa domain , -.Fa bus , -.Fa slot , -and -.Fa func . +.Fn pci_alloc_msix +function attempts to allocate +.Fa *count +MSI-X messages for the device +.Fa dev . The -.Fa slot -number actually refers to the number of the device on the bus, -which does not necessarily indicate its geographic location -in terms of a physical slot. +.Fn pci_alloc_msix +function may allocate fewer messages than requested for various +reasons including requests for more messages than the device +.Fa dev +supports, +or if the system has a shortage of available MSI-X messages. +On success, +.Fa *count +is set to the number of messages allocated and +.Fn pci_alloc_msix +returns zero. +For MSI-X messages, +the resource ID for each +.Dv SYS_RES_IRQ resource identifies the index in the MSI-X table of the +corresponding message. +A resource ID of one maps to the first index of the MSI-X table; +a resource ID two identifies the second index in the table, etc. +The +.Fn pci_alloc_msix +function assigns the +.Fa *count +messages allocated to the first +.Fa *count +table indicies. +If +.Fn pci_alloc_msix +is not able to allocate any messages, +it returns an error. +Unlike MSI, +MSI-X does not require message counts that are powers of two. .Pp The -.Fn pci_find_device -function looks up the -.Vt device_t -of a PCI device, given its -.Fa vendor -and -.Fa device -IDs. -Note that there can be multiple matches for this search; this function -only returns the first matching device. +.Fn pci_pending_msix +function examines the +.Fa dev +device's Pending Bit Array +.Pq PBA +to determine the pending status of the MSI-X message at table index +.Fa index . +If the indicated message is pending, +this function returns a non-zero value; +otherwise, +it returns zero. +Passing an invalid +.Fa index +to this function will result in undefined behavior. +.Pp +As mentioned in the description of +.Fn pci_alloc_msix , +MSI-X messages are initially assigned to the first N table entries. +A driver may use a different distribution of available messages to +table entries via the +.Fn pci_remap_msix +function. +Note that this function must be called after a succesful call to +.Fn pci_alloc_msix +but before any of the +.Dv SYS_RES_IRQ +resources are allocated. +The +.Fn pci_remap_msix +function returns zero on success, +or an error on failure. +.Pp +The +.Fa vectors +array should contain +.Fa count +message vectors. +The array maps directly to the MSI-X table in that the first entry in +the array specifies the message used for the first entry in the MSI-X +table, +the second entry in the array corresponds to the second entry in the +MSI-X table, +etc. +The vector value in each array index can either be zero to indicate +that no message should be assigned to the corresponding MSI-X table entry, +or it can be a number from one to N +.Po +where N is the count returned from the previous call to +.Fn pci_alloc_msix +.Pc +to indicate which of the allocated messages should be assigned to the +corresponding MSI-X table entry. +.Pp +If +.Fn pci_remap_msix +succeeds, +each MSI-X table entry with a non-zero vector will have an associated +.Dv SYS_RES_IRQ +resource whose resource ID corresponds to the table index as described +above for +.Fn pci_alloc_msix . +MSI-X table entries that with a vector of zero will not have an +associated +.Dv SYS_RES_IRQ resource. +Additionally, +if any of the original messages allocated by +.Fn pci_alloc_msix +are not used in the new distribution of messages in the MSI-X table, +they will be released automatically. +Note that if a driver wishes to use fewer messages than were allocated by +.Fn pci_alloc_msix , +the driver must use a single, contiguous range of messages beginning +with one in the new distribution. +The +.Fn pci_remap_msix +function will fail if this condition is not met. .Sh IMPLEMENTATION NOTES The .Vt pci_addr_t @@ -295,7 +645,9 @@ space on the target architecture. .Re .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@FreeBSD.org . +.An Bruce M Simpson Aq bms@FreeBSD.org +and +.An John Baldwin Aq jhb@FreeBSD.org . .Sh BUGS The kernel PCI code has a number of references to .Dq "slot numbers" . From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 20:58:28 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D78C106570E; Fri, 23 Mar 2012 20:58:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6700F8FC12; Fri, 23 Mar 2012 20:58:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NKwSOb094033; Fri, 23 Mar 2012 20:58:28 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NKwSpl094030; Fri, 23 Mar 2012 20:58:28 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203232058.q2NKwSpl094030@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 20:58:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233396 - stable/8/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 20:58:28 -0000 Author: jhb Date: Fri Mar 23 20:58:27 2012 New Revision: 233396 URL: http://svn.freebsd.org/changeset/base/233396 Log: MFC 232362,232363,232463,232553,232569,232571: - Sort function prototypes. - Update the documentation on pci_get/set_powerstate(). These methods are not ACPI-specific at all, but deal with PCI power states. Also, pci_set_powerstate() fails with EOPNOTSUPP if a request is made that the underlying device does not support rather than falling back to somehow setting D0. - Document the following routines: pci_alloc_msi(), pci_alloc_msix(), pci_find_cap(), pci_get_max_read_req(), pci_get_vpd_ident(), pci_get_vpd_readonly(), pci_msi_count(), pci_msix_count(), pci_pending_msix(), pci_release_msi(), pci_remap_msix(), and pci_set_max_read_req(). - Group the functions into five sub-sections: raw configuration access, locating devices, device information, device configuration, and message signaled interrupts. - Discourage use of pci_disable_io() and pci_enable_io() in device drivers. The PCI bus driver handles this automatically as resources are activated. Modified: stable/8/share/man/man9/Makefile stable/8/share/man/man9/pci.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Fri Mar 23 20:58:18 2012 (r233395) +++ stable/8/share/man/man9/Makefile Fri Mar 23 20:58:27 2012 (r233396) @@ -935,18 +935,30 @@ MLINKS+=namei.9 NDFREE.9 \ MLINKS+=pbuf.9 getpbuf.9 \ pbuf.9 relpbuf.9 \ pbuf.9 trypbuf.9 -MLINKS+=pci.9 pci_disable_busmaster.9 \ +MLINKS+=pci.9 pci_alloc_msi.9 \ + pci.9 pci_alloc_msix.9 \ + pci.9 pci_disable_busmaster.9 \ pci.9 pci_disable_io.9 \ pci.9 pci_enable_busmaster.9 \ pci.9 pci_enable_io.9 \ pci.9 pci_find_bsf.9 \ + pci.9 pci_find_cap.9 \ pci.9 pci_find_dbsf.9 \ pci.9 pci_find_device.9 \ + pci.9 pci_get_max_read_req.9 \ pci.9 pci_get_powerstate.9 \ + pci.9 pci_get_vpd_ident.9 \ + pci.9 pci_get_vpd_readonly.9 \ + pci.9 pci_msi_count.9 \ + pci.9 pci_msix_count.9 \ + pci.9 pci_pending_msix.9 \ pci.9 pci_read_config.9 \ + pci.9 pci_release_msi.9 \ + pci.9 pci_remap_msix.9 \ pci.9 pci_restore_state.9 \ pci.9 pci_save_state.9 \ pci.9 pci_set_powerstate.9 \ + pci.9 pci_set_max_read_req.9 \ pci.9 pci_write_config.9 MLINKS+=pfil.9 pfil_add_hook.9 \ pfil.9 pfil_hook_get.9 \ Modified: stable/8/share/man/man9/pci.9 ============================================================================== --- stable/8/share/man/man9/pci.9 Fri Mar 23 20:58:18 2012 (r233395) +++ stable/8/share/man/man9/pci.9 Fri Mar 23 20:58:27 2012 (r233396) @@ -25,61 +25,103 @@ .\" .\" $FreeBSD$ .\" -.Dd September 30, 2007 +.Dd March 5, 2012 .Dt PCI 9 .Os .Sh NAME .Nm pci , -.Nm pci_read_config , -.Nm pci_write_config , -.Nm pci_enable_busmaster , +.Nm pci_alloc_msi , +.Nm pci_alloc_msix , .Nm pci_disable_busmaster , -.Nm pci_enable_io , .Nm pci_disable_io , -.Nm pci_set_powerstate , -.Nm pci_get_powerstate , -.Nm pci_save_state , -.Nm pci_restore_state , +.Nm pci_enable_busmaster , +.Nm pci_enable_io , .Nm pci_find_bsf , +.Nm pci_find_cap , .Nm pci_find_dbsf , -.Nm pci_find_device +.Nm pci_find_device , +.Nm pci_get_max_read_req , +.Nm pci_get_powerstate , +.Nm pci_get_vpd_ident , +.Nm pci_get_vpd_readonly , +.Nm pci_msi_count , +.Nm pci_msix_count , +.Nm pci_pending_msix , +.Nm pci_read_config , +.Nm pci_release_msi , +.Nm pci_remap_msix , +.Nm pci_restore_state , +.Nm pci_save_state , +.Nm pci_set_max_read_req , +.Nm pci_set_powerstate , +.Nm pci_write_config .Nd PCI bus interface .Sh SYNOPSIS .In sys/bus.h -.In dev/pci/pcivar.h .In dev/pci/pcireg.h -.In machine/pci_cfgreg.h -.Ft void -.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width" +.In dev/pci/pcivar.h .Ft int -.Fn pci_enable_busmaster "device_t dev" +.Fn pci_alloc_msi "device_t dev" "int *count" +.Ft int +.Fn pci_alloc_msix "device_t dev" "int *count" .Ft int .Fn pci_disable_busmaster "device_t dev" .Ft int +.Fn pci_disable_io "device_t dev" "int space" +.Ft int +.Fn pci_enable_busmaster "device_t dev" +.Ft int .Fn pci_enable_io "device_t dev" "int space" +.Ft device_t +.Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" .Ft int -.Fn pci_disable_io "device_t dev" "int space" +.Fn pci_find_cap "device_t dev" "int capability" "int *capreg" +.Ft device_t +.Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func" +.Ft device_t +.Fn pci_find_device "uint16_t vendor" "uint16_t device" .Ft int -.Fn pci_set_powerstate "device_t dev" "int state" +.Fn pci_get_max_read_req "device_t dev" .Ft int .Fn pci_get_powerstate "device_t dev" +.Ft int +.Fn pci_get_vpd_ident "device_t dev" "const char **identptr" +.Ft int +.Fn pci_get_vpd_readonly "device_t dev" "const char *kw" "const char **vptr" +.Ft int +.Fn pci_msi_count "device_t dev" +.Ft int +.Fn pci_msix_count "device_t dev" +.Ft int +.Fn pci_pending_msix "device_t dev" "u_int index" .Ft uint32_t .Fn pci_read_config "device_t dev" "int reg" "int width" +.Ft int +.Fn pci_release_msi "device_t dev" +.Ft int +.Fn pci_remap_msix "device_t dev" "int count" "const u_int *vectors" +.Ft void +.Fn pci_restore_state "device_t dev" .Ft void .Fn pci_save_state "device_t dev" +.Ft int +.Fn pci_set_max_read_req "device_t dev" "int size" +.Ft int +.Fn pci_set_powerstate "device_t dev" "int state" .Ft void -.Fn pci_restore_state "device_t dev" -.Ft device_t -.Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" -.Ft device_t -.Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func" -.Ft device_t -.Fn pci_find_device "uint16_t vendor" "uint16_t device" +.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width" .Sh DESCRIPTION The .Nm set of functions are used for managing PCI devices. -.Pp +The functions are split into several groups: +raw configuration access, +locating devices, +device information, +device configuration, +and +message signaled interrupts. +.Ss Raw Configuration Access The .Fn pci_read_config function is used to read data from the PCI configuration @@ -104,6 +146,126 @@ with .Fa width specifying the size of the access. .Pp +.Em NOTE : +Device drivers should only use these functions for functionality that +is not available via another +.Fn pci +function. +.Ss Locating Devices +The +.Fn pci_find_bsf +function looks up the +.Vt device_t +of a PCI device, given its +.Fa bus , +.Fa slot , +and +.Fa func . +The +.Fa slot +number actually refers to the number of the device on the bus, +which does not necessarily indicate its geographic location +in terms of a physical slot. +Note that in case the system has multiple PCI domains, +the +.Fn pci_find_bsf +function only searches the first one. +Actually, it is equivalent to: +.Bd -literal -offset indent +pci_find_dbsf(0, bus, slot, func); +.Ed +.Pp +The +.Fn pci_find_dbsf +function looks up the +.Vt device_t +of a PCI device, given its +.Fa domain , +.Fa bus , +.Fa slot , +and +.Fa func . +The +.Fa slot +number actually refers to the number of the device on the bus, +which does not necessarily indicate its geographic location +in terms of a physical slot. +.Pp +The +.Fn pci_find_device +function looks up the +.Vt device_t +of a PCI device, given its +.Fa vendor +and +.Fa device +IDs. +Note that there can be multiple matches for this search; this function +only returns the first matching device. +.Ss Device Information +The +.Fn pci_find_cap +function is used to locate the first instance of a PCI capability +register set for the device +.Fa dev . +The capability to locate is specified by ID via +.Fa capability . +Constant macros of the form +.Dv PCIY_xxx +for standard capability IDs are defined in +.In dev/pci/pcireg.h . +If the capability is found, then +.Fa *capreg +is set to the offset in configuration space of the capability register set, +and +.Fn pci_find_cap +returns zero. +If the capability is not found or the device does not support capabilities, +.Fn pci_find_cap +returns an error. +.Pp +The +.Fn pci_get_vpd_ident +function is used to fetch a device's Vital Product Data +.Pq VPD +identifier string. +If the device +.Fa dev +supports VPD and provides an identifier string, +then +.Fa *identptr +is set to point at a read-only, null-terminated copy of the identifier +string, +and +.Fn pci_get_vpd_ident +returns zero. +If the device does not support VPD or does not provide an identifier +string, +then +.Fn pci_get_vpd_ident +returns an error. +.Pp +The +.Fn pci_get_vpd_readonly +function is used to fetch the value of a single VPD read-only keyword +for the device +.Fa dev . +The keyword to fetch is identified by the two character string +.Fa kw . +If the device supports VPD and provides a read-only value for the +requested keyword, +then +.Fa *vptr +is set to point at a read-only, null-terminated copy of the value, +and +.Fn pci_get_vpd_readonly +returns zero. +If the device does not support VPD or does not provide the requested +keyword, +then +.Fn pci_get_vpd_readonly +returns an error. +.Ss Device Configuration The .Fn pci_enable_busmaster function enables PCI bus mastering for the device @@ -138,20 +300,51 @@ argument specifies which resource is aff or .Dv SYS_RES_IOPORT as appropriate. +Device drivers should generally not use these routines directly. +The PCI bus will enable decoding automatically when a +.Dv SYS_RES_MEMORY +or +.Dv SYS_RES_IOPORT +resource is activated via +.Xr bus_alloc_resource 9 +or +.Xr bus_activate_resource 9 . .Pp -.Em NOTE : -These functions should be used in preference to manually manipulating -the configuration space. +The +.Fn pci_get_max_read_req +function returns the current maximum read request size in bytes for a +PCI-express device. +If the +.Fa dev +device is not a PCI-express device, +.Fn pci_get_max_read_req +returns zero. +.Pp +The +.Fn pci_set_max_read_req +sets the PCI-express maximum read request size for +.Fa dev . +The requested +.Fa size +may be adjusted, +and +.Fn pci_set_max_read_req +returns the actual size set in bytes. +If the +.Fa dev +device is not a PCI-express device, +.Fn pci_set_max_read_req +returns zero. .Pp The .Fn pci_get_powerstate -function returns the current ACPI power state of the device +function returns the current power state of the device .Fa dev . If the device does not support power management capabilities, then the default state of .Dv PCI_POWERSTATE_D0 is returned. -The following power states are defined by ACPI: +The following power states are defined by PCI: .Bl -hang -width ".Dv PCI_POWERSTATE_UNKNOWN" .It Dv PCI_POWERSTATE_D0 State in which device is on and running. @@ -183,15 +376,13 @@ The .Fn pci_set_powerstate function is used to transition the device .Fa dev -to the ACPI power state +to the PCI power state .Fa state . -It checks to see if the device is PCI 2.2 compliant. -If so, it checks the -capabilities pointer to determine which power states the device supports. -If the device does not have power management capabilities, the default state -of -.Dv PCI_POWERSTATE_D0 -is set. +If the device does not support power management capabilities or +it does not support the specific power state +.Fa state , +then the function will fail with +.Er EOPNOTSUPP . .Pp The .Fn pci_save_state @@ -212,57 +403,216 @@ is invoked, then the device will be transitioned to .Dv PCI_POWERSTATE_D0 before any config registers are restored. -.Pp -The -.Fn pci_find_bsf -function looks up the -.Vt device_t -of a PCI device, given its -.Fa bus , -.Fa slot , +.Ss Message Signaled Interrupts +Message Signaled Interrupts +.Pq MSI and -.Fa func . +Enhanced Message Signaled Interrupts +.Pq MSI-X +are PCI capabilities that provide an alternate method for PCI +devices to signal interrupts. +The legacy INTx interrupt is available to PCI devices as a +.Dv SYS_RES_IRQ +resource with a resource ID of zero. +MSI and MSI-X interrupts are available to PCI devices as one or more +.Dv SYS_RES_IRQ +resources with resource IDs greater than zero. +A driver must ask the PCI bus to allocate MSI or MSI-X interrupts +using +.Fn pci_alloc_msi +or +.Fn pci_alloc_msix +before it can use MSI or MSI-X +.Dv SYS_RES_IRQ +resources. +A driver is not allowed to use the legacy INTx +.Dv SYS_RES_IRQ +resource if MSI or MSI-X interrupts have been allocated, +and attempts to allocate MSI or MSI-X interrupts will fail if the +driver is currently using the legacy INTx +.Dv SYS_RES_IRQ +resource. +A driver is only allowed to use either MSI or MSI-X, +but not both. +.Pp +The +.Fn pci_count_msi +function returns the maximum number of MSI messages supported by the +device +.Fa dev. +If the device does not support MSI, +then +.Fn pci_count_msi +returns zero. +.Pp +The +.Fn pci_alloc_msi +function attempts to allocate +.Fa *count +MSI messages for the device +.Fa dev . The -.Fa slot -number actually refers to the number of the device on the bus, -which does not necessarily indicate its geographic location -in terms of a physical slot. -Note that in case the system has multiple PCI domains, -the -.Fn pci_find_bsf -function only searches the first one. -Actually, it is equivalent to: -.Bd -literal -offset indent -pci_find_dbsf(0, bus, slot, func); -.Ed +.Fn pci_alloc_msi +function may allocate fewer messages than requested for various +reasons including requests for more messages than the device +.Fa dev +supports, +or if the system has a shortage of available MSI messages. +On success, +.Fa *count +is set to the number of messages allocated and +.Fn pci_alloc_msi +returns zero. +The +.Dv SYS_RES_IRQ +resources for the allocated messages will be available at consecutive +resource IDs beginning with one. +If +.Fn pci_alloc_msi +is not able to allocate any messages, +it returns an error. +Note that MSI only supports message counts that are powers of two; +requests to allocate a non-power of two count of messages will fail. +.Pp +The +.Fn pci_release_msi +function is used to release any allocated MSI or MSI-X messages back +to the system. +If any MSI or MSI-X +.Dv SYS_RES_IRQ +resources are allocated by the driver or have a configured interrupt +handler, +this function will fail with +.Er EBUSY . +The +.Fn pci_release_msi +function returns zero on success and an error on failure. +.Pp +The +.Fn pci_count_msix +function returns the maximum number of MSI-X messages supported by the +device +.Fa dev . +If the device does not support MSI-X, +then +.Fn pci_count_msix +returns zero. .Pp The -.Fn pci_find_dbsf -function looks up the -.Vt device_t -of a PCI device, given its -.Fa domain , -.Fa bus , -.Fa slot , -and -.Fa func . +.Fn pci_alloc_msix +function attempts to allocate +.Fa *count +MSI-X messages for the device +.Fa dev . The -.Fa slot -number actually refers to the number of the device on the bus, -which does not necessarily indicate its geographic location -in terms of a physical slot. +.Fn pci_alloc_msix +function may allocate fewer messages than requested for various +reasons including requests for more messages than the device +.Fa dev +supports, +or if the system has a shortage of available MSI-X messages. +On success, +.Fa *count +is set to the number of messages allocated and +.Fn pci_alloc_msix +returns zero. +For MSI-X messages, +the resource ID for each +.Dv SYS_RES_IRQ resource identifies the index in the MSI-X table of the +corresponding message. +A resource ID of one maps to the first index of the MSI-X table; +a resource ID two identifies the second index in the table, etc. +The +.Fn pci_alloc_msix +function assigns the +.Fa *count +messages allocated to the first +.Fa *count +table indicies. +If +.Fn pci_alloc_msix +is not able to allocate any messages, +it returns an error. +Unlike MSI, +MSI-X does not require message counts that are powers of two. .Pp The -.Fn pci_find_device -function looks up the -.Vt device_t -of a PCI device, given its -.Fa vendor -and -.Fa device -IDs. -Note that there can be multiple matches for this search; this function -only returns the first matching device. +.Fn pci_pending_msix +function examines the +.Fa dev +device's Pending Bit Array +.Pq PBA +to determine the pending status of the MSI-X message at table index +.Fa index . +If the indicated message is pending, +this function returns a non-zero value; +otherwise, +it returns zero. +Passing an invalid +.Fa index +to this function will result in undefined behavior. +.Pp +As mentioned in the description of +.Fn pci_alloc_msix , +MSI-X messages are initially assigned to the first N table entries. +A driver may use a different distribution of available messages to +table entries via the +.Fn pci_remap_msix +function. +Note that this function must be called after a succesful call to +.Fn pci_alloc_msix +but before any of the +.Dv SYS_RES_IRQ +resources are allocated. +The +.Fn pci_remap_msix +function returns zero on success, +or an error on failure. +.Pp +The +.Fa vectors +array should contain +.Fa count +message vectors. +The array maps directly to the MSI-X table in that the first entry in +the array specifies the message used for the first entry in the MSI-X +table, +the second entry in the array corresponds to the second entry in the +MSI-X table, +etc. +The vector value in each array index can either be zero to indicate +that no message should be assigned to the corresponding MSI-X table entry, +or it can be a number from one to N +.Po +where N is the count returned from the previous call to +.Fn pci_alloc_msix +.Pc +to indicate which of the allocated messages should be assigned to the +corresponding MSI-X table entry. +.Pp +If +.Fn pci_remap_msix +succeeds, +each MSI-X table entry with a non-zero vector will have an associated +.Dv SYS_RES_IRQ +resource whose resource ID corresponds to the table index as described +above for +.Fn pci_alloc_msix . +MSI-X table entries that with a vector of zero will not have an +associated +.Dv SYS_RES_IRQ resource. +Additionally, +if any of the original messages allocated by +.Fn pci_alloc_msix +are not used in the new distribution of messages in the MSI-X table, +they will be released automatically. +Note that if a driver wishes to use fewer messages than were allocated by +.Fn pci_alloc_msix , +the driver must use a single, contiguous range of messages beginning +with one in the new distribution. +The +.Fn pci_remap_msix +function will fail if this condition is not met. .Sh IMPLEMENTATION NOTES The .Vt pci_addr_t @@ -295,7 +645,9 @@ space on the target architecture. .Re .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@FreeBSD.org . +.An Bruce M Simpson Aq bms@FreeBSD.org +and +.An John Baldwin Aq jhb@FreeBSD.org . .Sh BUGS The kernel PCI code has a number of references to .Dq "slot numbers" . From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 21:19:07 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E9DAD1065670; Fri, 23 Mar 2012 21:19:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB1368FC18; Fri, 23 Mar 2012 21:19:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NLJ7p3094755; Fri, 23 Mar 2012 21:19:07 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NLJ7mE094753; Fri, 23 Mar 2012 21:19:07 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203232119.q2NLJ7mE094753@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 21:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233398 - in stable/9/sys: dev/oce i386/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 21:19:08 -0000 Author: jhb Date: Fri Mar 23 21:19:07 2012 New Revision: 233398 URL: http://svn.freebsd.org/changeset/base/233398 Log: MFC 232470: Use pci_find_cap() instead of pci_find_extcap() to locate PCI find capabilities as the latter API is deprecated for this purpose. Modified: stable/9/sys/dev/oce/oce_hw.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/dev/oce/oce_hw.c ============================================================================== --- stable/9/sys/dev/oce/oce_hw.c Fri Mar 23 21:07:10 2012 (r233397) +++ stable/9/sys/dev/oce/oce_hw.c Fri Mar 23 21:19:07 2012 (r233398) @@ -203,12 +203,12 @@ void oce_get_pci_capabilities(POCE_SOFTC { uint32_t val; - if (pci_find_extcap(sc->dev, PCIY_PCIX, &val) == 0) { + if (pci_find_cap(sc->dev, PCIY_PCIX, &val) == 0) { if (val != 0) sc->flags |= OCE_FLAGS_PCIX; } - if (pci_find_extcap(sc->dev, PCIY_EXPRESS, &val) == 0) { + if (pci_find_cap(sc->dev, PCIY_EXPRESS, &val) == 0) { if (val != 0) { uint16_t link_status = pci_read_config(sc->dev, val + 0x12, 2); @@ -219,12 +219,12 @@ void oce_get_pci_capabilities(POCE_SOFTC } } - if (pci_find_extcap(sc->dev, PCIY_MSI, &val) == 0) { + if (pci_find_cap(sc->dev, PCIY_MSI, &val) == 0) { if (val != 0) sc->flags |= OCE_FLAGS_MSI_CAPABLE; } - if (pci_find_extcap(sc->dev, PCIY_MSIX, &val) == 0) { + if (pci_find_cap(sc->dev, PCIY_MSIX, &val) == 0) { if (val != 0) { val = pci_msix_count(sc->dev); sc->flags |= OCE_FLAGS_MSIX_CAPABLE; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 23 22:03:46 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DD996106566B; Fri, 23 Mar 2012 22:03:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C84218FC0C; Fri, 23 Mar 2012 22:03:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NM3kQb096133; Fri, 23 Mar 2012 22:03:46 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NM3kR8096131; Fri, 23 Mar 2012 22:03:46 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203232203.q2NM3kR8096131@svn.freebsd.org> From: Eitan Adler Date: Fri, 23 Mar 2012 22:03:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233399 - stable/9/lib/libc/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 22:03:47 -0000 Author: eadler Date: Fri Mar 23 22:03:46 2012 New Revision: 233399 URL: http://svn.freebsd.org/changeset/base/233399 Log: MFC r230155: Make man page wording more clear PR: docs/164078 Approved by: cperciva (implicit) Modified: stable/9/lib/libc/sys/setuid.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/setuid.2 ============================================================================== --- stable/9/lib/libc/sys/setuid.2 Fri Mar 23 21:19:07 2012 (r233398) +++ stable/9/lib/libc/sys/setuid.2 Fri Mar 23 22:03:46 2012 (r233399) @@ -170,7 +170,7 @@ potentially sensitive data. .Pp To prevent these files from remaining open after an .Xr exec 3 -call, be sure to set the close-on-exec flag is set: +call, be sure to set the close-on-exec flag: .Bd -literal void pseudocode(void) From owner-svn-src-stable@FreeBSD.ORG Sat Mar 24 09:56:06 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2664A1065676 for ; Sat, 24 Mar 2012 09:56:06 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 54CDC8FC28 for ; Sat, 24 Mar 2012 09:56:05 +0000 (UTC) Received: by bkcjc3 with SMTP id jc3so4184502bkc.13 for ; Sat, 24 Mar 2012 02:56:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=w36bMeb0K2/Zbb5kxmEEQ4v/y13XNc1zxktronhN/Lk=; b=aDNJsClkkS8QD4sB9uNHNNQ9LdYDclqRsorNFCEMmDlKBfroKhtOPVEtosC3zBOKF6 diPzsSW42gcbkk0a5k/WHLqAzByfDSCD7wblhh6ADhI4IfQkB9ywq9bHOJhIiNpMfmJp Pq7r+FQh+1QTKhtsjYrYu4B4yHtcUV84oeTzuUhqSRlYWt3KHxcQGxCnMwBwthvvNWtw boNNxAjtAQFs7vSZPrYNv1x2ao1iSmwe5526JcdDT94Iq0OtQ6zEmG7q1v/88We2SfG0 wZm6jZOFwxJhLrGyoHohqk4TGK2QTHU5kUc9mdT0PodDGJGHmcbTwZrDqdM2Qb84xIZG +umg== Received: by 10.204.149.218 with SMTP id u26mr5948032bkv.82.1332582964066; Sat, 24 Mar 2012 02:56:04 -0700 (PDT) Received: from [10.254.254.77] (ppp109-252-211-172.pppoe.spdop.ru. [109.252.211.172]) by mx.google.com with ESMTPS id t17sm20795191bke.6.2012.03.24.02.56.02 (version=SSLv3 cipher=OTHER); Sat, 24 Mar 2012 02:56:03 -0700 (PDT) Message-ID: <4F6D9A2D.8060708@zonov.org> Date: Sat, 24 Mar 2012 13:55:57 +0400 From: Andrey Zonov User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: Sergey Kandaurov References: <201203140944.q2E9ilvF094386@svn.freebsd.org> In-Reply-To: <201203140944.q2E9ilvF094386@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlU0lGA8M4cJ9hwR51/5XBKgUK2xBTPMuf8vxLFfGMe1iMuhytl2zgFcPC2oPTY50jlHkRN Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r232961 - stable/9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2012 09:56:06 -0000 On 14.03.2012 13:44, Sergey Kandaurov wrote: > Author: pluknet > Date: Wed Mar 14 09:44:46 2012 > New Revision: 232961 > URL: http://svn.freebsd.org/changeset/base/232961 > > Log: > MFC r232671: Add lib32 part for libutil after its version bump to 9. > > PR: misc/165523 > Submitted by: Andrey Zonov > > Modified: > stable/9/ObsoleteFiles.inc (contents, props changed) > > Modified: stable/9/ObsoleteFiles.inc > ============================================================================== > --- stable/9/ObsoleteFiles.inc Wed Mar 14 09:15:50 2012 (r232960) > +++ stable/9/ObsoleteFiles.inc Wed Mar 14 09:44:46 2012 (r232961) > @@ -352,6 +352,9 @@ OLD_FILES+=usr/share/man/man5/lastlog.5. > OLD_FILES+=usr/share/man/man5/utmp.5.gz > OLD_FILES+=usr/share/man/man5/wtmp.5.gz > OLD_LIBS+=lib/libutil.so.8 > +.if ${TARGET_ARCH} == "amd64" > +OLB_LIBS+=usr/lib32/libutil.so.8 > +.endif > # 20100105: new userland semaphore implementation > OLD_FILES+=usr/include/sys/semaphore.h > # 20100103: ntptrace(8) removed Thanks! But what about other files which I reported? -- Andrey Zonov